miniscript-languageserver 1.1.3 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +2 -2
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -218,9 +218,9 @@ end if`},IfClause:(n,r)=>{let i=t.make(n.condition),s=[],o;for(o of n.body){let
218
218
  return EXPORTED[r]
219
219
  end function`).parseChunk();Ei.MAIN_BOILERPLATE=new eb.Parser('"$0"').parseChunk()});var Rd=m(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.OutputProcessor=void 0;var Ix=tb(),nb=class{constructor(e,n,{header:r=Ix.HEADER_BOILERPLATE,main:i=Ix.MAIN_BOILERPLATE}={}){this.context=e,this.transformer=n,this.processed=[],this.headerBoilerplate=this.transformer.transform(r),this.mainBoilerplate=this.transformer.transform(i)}addLiteralsOptimization(){let e=this.context,n=Array.from(e.literals.getMapping().values()).filter(i=>i.namespace!=null),r=e.variables.get("globals");return n.length>0&&this.processed.push("globals."+r+"=globals",...n.map(i=>`${r}.${i.namespace}=${i.literal.raw}`)),this}addHeader(){return this.processed.push(this.headerBoilerplate),this}addCode(e,n=!1){if(n){let r=this.mainBoilerplate.replace('"$0"',e);this.processed.push(r)}else this.processed.push(e);return this}build(){return this.processed.join(`
220
220
  `)}};Od.OutputProcessor=nb});var Px=m(bo=>{"use strict";var EN=bo&&bo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(bo,"__esModule",{value:!0});bo.DirectTranspiler=void 0;var AN=EN(require("events")),xN=Fr(),Dd=md(),kN=za(),CN=Ad(),ON=Cd(),RN=Sd(),DN=Rd(),IN=Object.prototype.hasOwnProperty,rb=class extends AN.default{constructor(e){super();let n=this;n.code=e.code,n.obfuscation=IN.call(e,"obfuscation")?e.obfuscation:!0,n.buildType=e.buildType||Dd.BuildType.DEFAULT,n.buildOptions=e.buildOptions||{isDevMode:!1},n.disableLiteralsOptimization=e.disableLiteralsOptimization||n.buildType!==Dd.BuildType.UGLIFY,n.disableNamespacesOptimization=e.disableNamespacesOptimization||n.buildType!==Dd.BuildType.UGLIFY,n.environmentVariables=e.environmentVariables||new Map,n.excludedNamespaces=e.excludedNamespaces||[]}parse(){let e=this,n=(0,Dd.getFactory)(e.buildType),i=new xN.Parser(e.code).parseChunk(),s=(0,RN.fetchNamespaces)(i),o=[].concat(i.literals),a=(0,ON.generateCharsetMap)(e.obfuscation),u=new kN.Context({variablesCharset:a.variables,variablesExcluded:e.excludedNamespaces,modulesCharset:a.modules});e.disableNamespacesOptimization||new Set(s).forEach(y=>u.variables.createNamespace(y)),e.disableLiteralsOptimization||o.forEach(p=>u.literals.add(p));let c=new CN.Transformer({buildOptions:e.buildOptions,mapFactory:n,context:u,environmentVariables:e.environmentVariables}),l=new DN.OutputProcessor(u,c);e.disableLiteralsOptimization||l.addLiteralsOptimization();let d=c.transform(i);return l.addCode(d),l.build()}};bo.DirectTranspiler=rb});var sb=m(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});Id.ResourceProvider=void 0;var ib=class{getHandler(){let e=require("fs"),n=require("path");return{getTargetRelativeTo:(r,i)=>{let s=n.resolve(r,".."),o=n.resolve(s,i);return Promise.resolve(e.existsSync(o)?o:o+".src")},has:r=>Promise.resolve(e.existsSync(r)),get:r=>Promise.resolve(e.readFileSync(r,"utf8")),resolve:r=>Promise.resolve(n.resolve(r))}}};Id.ResourceProvider=ib});var ab=m(Ai=>{"use strict";var PN=Ai&&Ai.__awaiter||function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(l){try{c(r.next(l))}catch(d){o(d)}}function u(l){try{c(r.throw(l))}catch(d){o(d)}}function c(l){l.done?s(l.value):i(l.value).then(a,u)}c((r=r.apply(t,e||[])).next())})},MN=Ai&&Ai.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ai,"__esModule",{value:!0});Ai.Target=void 0;var LN=MN(require("events")),NN=Fr(),qN=Yy(),Mx=_d(),ob=class extends LN.default{constructor(e){super();let n=this;n.target=e.target,n.resourceHandler=e.resourceHandler,n.context=e.context}parse(e){return PN(this,void 0,void 0,function*(){let n=this,r=n.resourceHandler,i=yield r.resolve(n.target);if(!(yield r.has(i)))throw new Error("Target "+i+" does not exist...");let s=n.context,o=yield r.get(i);n.emit("parse-before",i);try{let u=new NN.Parser(o,{filename:i}).parseChunk(),c=new qN.Dependency({target:i,resourceHandler:r,chunk:u,context:s}),{namespaces:l,literals:d}=yield c.findDependencies();if(!e.disableNamespacesOptimization){let p=new Set(l);for(let y of p)s.variables.createNamespace(y)}if(!e.disableLiteralsOptimization)for(let p of d)s.literals.add(p);return{main:{chunk:u,dependency:c}}}catch(a){throw a instanceof Mx.BuildError?a:new Mx.BuildError(a.message,{target:this.target,range:a.range})}})}};Ai.Target=ob});var Lx=m(_o=>{"use strict";var jN=_o&&_o.__awaiter||function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(l){try{c(r.next(l))}catch(d){o(d)}}function u(l){try{c(r.throw(l))}catch(d){o(d)}}function c(l){l.done?s(l.value):i(l.value).then(a,u)}c((r=r.apply(t,e||[])).next())})};Object.defineProperty(_o,"__esModule",{value:!0});_o.Transpiler=void 0;var FN=cb(),$N=tb(),Pd=md(),BN=za(),UN=sb(),HN=ab(),WN=Ad(),GN=Cd(),VN=Rd(),zN=Object.prototype.hasOwnProperty,ub=class{constructor(e){let n=this;n.target=e.target,n.resourceHandler=e.resourceHandler||new UN.ResourceProvider().getHandler(),n.obfuscation=zN.call(e,"obfuscation")?e.obfuscation:!0;let r=(0,GN.generateCharsetMap)(n.obfuscation);n.context=new BN.Context({variablesCharset:r.variables,variablesExcluded:e.excludedNamespaces,modulesCharset:r.modules}),n.buildType=e.buildType||Pd.BuildType.DEFAULT,n.buildOptions=e.buildOptions||{isDevMode:!1},n.installer=e.installer||!1,n.disableLiteralsOptimization=e.disableLiteralsOptimization||n.buildType!==Pd.BuildType.UGLIFY,n.disableNamespacesOptimization=e.disableNamespacesOptimization||n.buildType!==Pd.BuildType.UGLIFY,n.environmentVariables=e.environmentVariables||new Map}parse(){return jN(this,void 0,void 0,function*(){let e=this,n=(0,Pd.getFactory)(e.buildType),r=e.context,s=yield new HN.Target({target:e.target,resourceHandler:e.resourceHandler,context:e.context}).parse({disableLiteralsOptimization:e.disableLiteralsOptimization,disableNamespacesOptimization:e.disableNamespacesOptimization}),o=new WN.Transformer({buildOptions:e.buildOptions,mapFactory:n,context:r,environmentVariables:e.environmentVariables,resourceHandler:e.resourceHandler}),a=s.main,u=o.transform($N.MODULE_BOILERPLATE),c=(l,d)=>{let p=r.modules.get(l.getId()),y={},v=0,x=function(w){let E=w.getNamespace();if(!(E in y)){if(E!==p&&w.type===FN.DependencyType.Import){let _=o.transform(w.chunk,w);y[E]=u.replace('"$0"','"'+E+'"').replace('"$1"',_),v++}for(let _ of w.dependencies)x(_)}};x(l);let I=new VN.OutputProcessor(r,o);d&&I.addLiteralsOptimization(),v>0&&I.addHeader(),Object.keys(y).forEach(w=>I.addCode(y[w]));let P=o.transform(l.chunk,l);return I.addCode(P,!0),I.build()};return{[e.target]:c(a.dependency,!e.disableLiteralsOptimization)}})}};_o.Transpiler=ub});var cb=m(ee=>{"use strict";var Nx=ee&&ee.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),KN=ee&&ee.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XN=ee&&ee.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&Nx(e,t,n);return KN(e,t),e},YN=ee&&ee.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Nx(e,t,n)};Object.defineProperty(ee,"__esModule",{value:!0});ee.Stack=ee.OutputProcessor=ee.NamespaceGenerator=ee.LiteralsMapper=ee.fetchNamespaces=ee.BuildError=ee.generateCharsetMap=ee.DependencyType=ee.Transpiler=ee.Transformer=ee.Target=ee.DirectTranspiler=ee.Dependency=ee.ContextDataProperty=ee.Context=ee.uglifyFactory=ee.defaultFactory=ee.BeautifyUtils=ee.BeautifyContext=ee.beautifyFactory=ee.getFactory=ee.BuildType=void 0;var qx=md();Object.defineProperty(ee,"BuildType",{enumerable:!0,get:function(){return qx.BuildType}});Object.defineProperty(ee,"getFactory",{enumerable:!0,get:function(){return qx.getFactory}});var JN=Ny();Object.defineProperty(ee,"beautifyFactory",{enumerable:!0,get:function(){return JN.beautifyFactory}});var QN=Ly();Object.defineProperty(ee,"BeautifyContext",{enumerable:!0,get:function(){return QN.BeautifyContext}});ee.BeautifyUtils=XN(dd());var ZN=qy();Object.defineProperty(ee,"defaultFactory",{enumerable:!0,get:function(){return ZN.defaultFactory}});var eq=jy();Object.defineProperty(ee,"uglifyFactory",{enumerable:!0,get:function(){return eq.uglifyFactory}});var jx=za();Object.defineProperty(ee,"Context",{enumerable:!0,get:function(){return jx.Context}});Object.defineProperty(ee,"ContextDataProperty",{enumerable:!0,get:function(){return jx.ContextDataProperty}});var tq=Yy();Object.defineProperty(ee,"Dependency",{enumerable:!0,get:function(){return tq.Dependency}});var nq=Px();Object.defineProperty(ee,"DirectTranspiler",{enumerable:!0,get:function(){return nq.DirectTranspiler}});YN(sb(),ee);var rq=ab();Object.defineProperty(ee,"Target",{enumerable:!0,get:function(){return rq.Target}});var iq=Ad();Object.defineProperty(ee,"Transformer",{enumerable:!0,get:function(){return iq.Transformer}});var sq=Lx();Object.defineProperty(ee,"Transpiler",{enumerable:!0,get:function(){return sq.Transpiler}});var oq=Gy();Object.defineProperty(ee,"DependencyType",{enumerable:!0,get:function(){return oq.DependencyType}});var aq=Cd();Object.defineProperty(ee,"generateCharsetMap",{enumerable:!0,get:function(){return aq.generateCharsetMap}});var uq=_d();Object.defineProperty(ee,"BuildError",{enumerable:!0,get:function(){return uq.BuildError}});var cq=Sd();Object.defineProperty(ee,"fetchNamespaces",{enumerable:!0,get:function(){return cq.fetchNamespaces}});var lq=By();Object.defineProperty(ee,"LiteralsMapper",{enumerable:!0,get:function(){return lq.LiteralsMapper}});var dq=Hy();Object.defineProperty(ee,"NamespaceGenerator",{enumerable:!0,get:function(){return dq.NamespaceGenerator}});var fq=Rd();Object.defineProperty(ee,"OutputProcessor",{enumerable:!0,get:function(){return fq.OutputProcessor}});var pq=Qy();Object.defineProperty(ee,"Stack",{enumerable:!0,get:function(){return pq.Stack}})});var $x=m(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});Md.activate=void 0;var Fx=cb();function hq(t){async function e(n){try{let r=t.getConfiguration();return new Fx.DirectTranspiler({code:n,buildType:Fx.BuildType.BEAUTIFY,buildOptions:{isDevMode:!0,keepParentheses:r.transpiler.beautify.keepParentheses,indentation:r.transpiler.beautify.indentation==="Tab"?0:1,indentationSpaces:r.transpiler.beautify.indentationSpaces}}).parse()}catch{return null}}t.connection.onDocumentFormatting(async n=>{if(!t.getConfiguration().formatter)return;let r=await t.fs.getTextDocument(n.textDocument.uri);if(r==null)return;let i=await t.documentManager.getLatest(r),s=await e(r.getText());return s===null?[]:[{range:{start:{line:0,character:0},end:i.document.end},newText:s}]})}Md.activate=hq});var Ld=m((Xa,lb)=>{(function(t,e){if(typeof Xa=="object"&&typeof lb=="object")lb.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var n=e();for(var r in n)(typeof Xa=="object"?Xa:t)[r]=n[r]}})(Xa,()=>(()=>{"use strict";var t={470:i=>{function s(u){if(typeof u!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(u))}function o(u,c){for(var l,d="",p=0,y=-1,v=0,x=0;x<=u.length;++x){if(x<u.length)l=u.charCodeAt(x);else{if(l===47)break;l=47}if(l===47){if(!(y===x-1||v===1))if(y!==x-1&&v===2){if(d.length<2||p!==2||d.charCodeAt(d.length-1)!==46||d.charCodeAt(d.length-2)!==46){if(d.length>2){var I=d.lastIndexOf("/");if(I!==d.length-1){I===-1?(d="",p=0):p=(d=d.slice(0,I)).length-1-d.lastIndexOf("/"),y=x,v=0;continue}}else if(d.length===2||d.length===1){d="",p=0,y=x,v=0;continue}}c&&(d.length>0?d+="/..":d="..",p=2)}else d.length>0?d+="/"+u.slice(y+1,x):d=u.slice(y+1,x),p=x-y-1;y=x,v=0}else l===46&&v!==-1?++v:v=-1}return d}var a={resolve:function(){for(var u,c="",l=!1,d=arguments.length-1;d>=-1&&!l;d--){var p;d>=0?p=arguments[d]:(u===void 0&&(u=process.cwd()),p=u),s(p),p.length!==0&&(c=p+"/"+c,l=p.charCodeAt(0)===47)}return c=o(c,!l),l?c.length>0?"/"+c:"/":c.length>0?c:"."},normalize:function(u){if(s(u),u.length===0)return".";var c=u.charCodeAt(0)===47,l=u.charCodeAt(u.length-1)===47;return(u=o(u,!c)).length!==0||c||(u="."),u.length>0&&l&&(u+="/"),c?"/"+u:u},isAbsolute:function(u){return s(u),u.length>0&&u.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var u,c=0;c<arguments.length;++c){var l=arguments[c];s(l),l.length>0&&(u===void 0?u=l:u+="/"+l)}return u===void 0?".":a.normalize(u)},relative:function(u,c){if(s(u),s(c),u===c||(u=a.resolve(u))===(c=a.resolve(c)))return"";for(var l=1;l<u.length&&u.charCodeAt(l)===47;++l);for(var d=u.length,p=d-l,y=1;y<c.length&&c.charCodeAt(y)===47;++y);for(var v=c.length-y,x=p<v?p:v,I=-1,P=0;P<=x;++P){if(P===x){if(v>x){if(c.charCodeAt(y+P)===47)return c.slice(y+P+1);if(P===0)return c.slice(y+P)}else p>x&&(u.charCodeAt(l+P)===47?I=P:P===0&&(I=0));break}var w=u.charCodeAt(l+P);if(w!==c.charCodeAt(y+P))break;w===47&&(I=P)}var E="";for(P=l+I+1;P<=d;++P)P!==d&&u.charCodeAt(P)!==47||(E.length===0?E+="..":E+="/..");return E.length>0?E+c.slice(y+I):(y+=I,c.charCodeAt(y)===47&&++y,c.slice(y))},_makeLong:function(u){return u},dirname:function(u){if(s(u),u.length===0)return".";for(var c=u.charCodeAt(0),l=c===47,d=-1,p=!0,y=u.length-1;y>=1;--y)if((c=u.charCodeAt(y))===47){if(!p){d=y;break}}else p=!1;return d===-1?l?"/":".":l&&d===1?"//":u.slice(0,d)},basename:function(u,c){if(c!==void 0&&typeof c!="string")throw new TypeError('"ext" argument must be a string');s(u);var l,d=0,p=-1,y=!0;if(c!==void 0&&c.length>0&&c.length<=u.length){if(c.length===u.length&&c===u)return"";var v=c.length-1,x=-1;for(l=u.length-1;l>=0;--l){var I=u.charCodeAt(l);if(I===47){if(!y){d=l+1;break}}else x===-1&&(y=!1,x=l+1),v>=0&&(I===c.charCodeAt(v)?--v==-1&&(p=l):(v=-1,p=x))}return d===p?p=x:p===-1&&(p=u.length),u.slice(d,p)}for(l=u.length-1;l>=0;--l)if(u.charCodeAt(l)===47){if(!y){d=l+1;break}}else p===-1&&(y=!1,p=l+1);return p===-1?"":u.slice(d,p)},extname:function(u){s(u);for(var c=-1,l=0,d=-1,p=!0,y=0,v=u.length-1;v>=0;--v){var x=u.charCodeAt(v);if(x!==47)d===-1&&(p=!1,d=v+1),x===46?c===-1?c=v:y!==1&&(y=1):c!==-1&&(y=-1);else if(!p){l=v+1;break}}return c===-1||d===-1||y===0||y===1&&c===d-1&&c===l+1?"":u.slice(c,d)},format:function(u){if(u===null||typeof u!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof u);return function(c,l){var d=l.dir||l.root,p=l.base||(l.name||"")+(l.ext||"");return d?d===l.root?d+p:d+"/"+p:p}(0,u)},parse:function(u){s(u);var c={root:"",dir:"",base:"",ext:"",name:""};if(u.length===0)return c;var l,d=u.charCodeAt(0),p=d===47;p?(c.root="/",l=1):l=0;for(var y=-1,v=0,x=-1,I=!0,P=u.length-1,w=0;P>=l;--P)if((d=u.charCodeAt(P))!==47)x===-1&&(I=!1,x=P+1),d===46?y===-1?y=P:w!==1&&(w=1):y!==-1&&(w=-1);else if(!I){v=P+1;break}return y===-1||x===-1||w===0||w===1&&y===x-1&&y===v+1?x!==-1&&(c.base=c.name=v===0&&p?u.slice(1,x):u.slice(v,x)):(v===0&&p?(c.name=u.slice(1,y),c.base=u.slice(1,x)):(c.name=u.slice(v,y),c.base=u.slice(v,x)),c.ext=u.slice(y,x)),v>0?c.dir=u.slice(0,v-1):p&&(c.dir="/"),c},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,i.exports=a},674:(i,s)=>{if(Object.defineProperty(s,"__esModule",{value:!0}),s.isWindows=void 0,typeof process=="object")s.isWindows=process.platform==="win32";else if(typeof navigator=="object"){let o=navigator.userAgent;s.isWindows=o.indexOf("Windows")>=0}},796:(i,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.uriToFsPath=s.URI=void 0;let a=o(674),u=/^\w[\w\d+.-]*$/,c=/^\//,l=/^\/\//;function d(U,k){if(!U.scheme&&k)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${U.authority}", path: "${U.path}", query: "${U.query}", fragment: "${U.fragment}"}`);if(U.scheme&&!u.test(U.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(U.path){if(U.authority){if(!c.test(U.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(l.test(U.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}let p="",y="/",v=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class x{static isUri(k){return k instanceof x||!!k&&typeof k.authority=="string"&&typeof k.fragment=="string"&&typeof k.path=="string"&&typeof k.query=="string"&&typeof k.scheme=="string"&&typeof k.fsPath=="string"&&typeof k.with=="function"&&typeof k.toString=="function"}scheme;authority;path;query;fragment;constructor(k,M,L,q,ce,ae=!1){typeof k=="object"?(this.scheme=k.scheme||p,this.authority=k.authority||p,this.path=k.path||p,this.query=k.query||p,this.fragment=k.fragment||p):(this.scheme=function(Ct,dt){return Ct||dt?Ct:"file"}(k,ae),this.authority=M||p,this.path=function(Ct,dt){switch(Ct){case"https":case"http":case"file":dt?dt[0]!==y&&(dt=y+dt):dt=y}return dt}(this.scheme,L||p),this.query=q||p,this.fragment=ce||p,d(this,ae))}get fsPath(){return j(this,!1)}with(k){if(!k)return this;let{scheme:M,authority:L,path:q,query:ce,fragment:ae}=k;return M===void 0?M=this.scheme:M===null&&(M=p),L===void 0?L=this.authority:L===null&&(L=p),q===void 0?q=this.path:q===null&&(q=p),ce===void 0?ce=this.query:ce===null&&(ce=p),ae===void 0?ae=this.fragment:ae===null&&(ae=p),M===this.scheme&&L===this.authority&&q===this.path&&ce===this.query&&ae===this.fragment?this:new P(M,L,q,ce,ae)}static parse(k,M=!1){let L=v.exec(k);return L?new P(L[2]||p,fe(L[4]||p),fe(L[5]||p),fe(L[7]||p),fe(L[9]||p),M):new P(p,p,p,p,p)}static file(k){let M=p;if(a.isWindows&&(k=k.replace(/\\/g,y)),k[0]===y&&k[1]===y){let L=k.indexOf(y,2);L===-1?(M=k.substring(2),k=y):(M=k.substring(2,L),k=k.substring(L)||y)}return new P("file",M,k,p,p)}static from(k){let M=new P(k.scheme,k.authority,k.path,k.query,k.fragment);return d(M,!0),M}toString(k=!1){return O(this,k)}toJSON(){return this}static revive(k){if(k){if(k instanceof x)return k;{let M=new P(k);return M._formatted=k.external,M._fsPath=k._sep===I?k.fsPath:null,M}}return k}}s.URI=x;let I=a.isWindows?1:void 0;class P extends x{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=j(this,!1)),this._fsPath}toString(k=!1){return k?O(this,!0):(this._formatted||(this._formatted=O(this,!1)),this._formatted)}toJSON(){let k={$mid:1};return this._fsPath&&(k.fsPath=this._fsPath,k._sep=I),this._formatted&&(k.external=this._formatted),this.path&&(k.path=this.path),this.scheme&&(k.scheme=this.scheme),this.authority&&(k.authority=this.authority),this.query&&(k.query=this.query),this.fragment&&(k.fragment=this.fragment),k}}let w={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function E(U,k,M){let L,q=-1;for(let ce=0;ce<U.length;ce++){let ae=U.charCodeAt(ce);if(ae>=97&&ae<=122||ae>=65&&ae<=90||ae>=48&&ae<=57||ae===45||ae===46||ae===95||ae===126||k&&ae===47||M&&ae===91||M&&ae===93||M&&ae===58)q!==-1&&(L+=encodeURIComponent(U.substring(q,ce)),q=-1),L!==void 0&&(L+=U.charAt(ce));else{L===void 0&&(L=U.substr(0,ce));let Ct=w[ae];Ct!==void 0?(q!==-1&&(L+=encodeURIComponent(U.substring(q,ce)),q=-1),L+=Ct):q===-1&&(q=ce)}}return q!==-1&&(L+=encodeURIComponent(U.substring(q))),L!==void 0?L:U}function _(U){let k;for(let M=0;M<U.length;M++){let L=U.charCodeAt(M);L===35||L===63?(k===void 0&&(k=U.substr(0,M)),k+=w[L]):k!==void 0&&(k+=U[M])}return k!==void 0?k:U}function j(U,k){let M;return M=U.authority&&U.path.length>1&&U.scheme==="file"?`//${U.authority}${U.path}`:U.path.charCodeAt(0)===47&&(U.path.charCodeAt(1)>=65&&U.path.charCodeAt(1)<=90||U.path.charCodeAt(1)>=97&&U.path.charCodeAt(1)<=122)&&U.path.charCodeAt(2)===58?k?U.path.substr(1):U.path[1].toLowerCase()+U.path.substr(2):U.path,a.isWindows&&(M=M.replace(/\//g,"\\")),M}function O(U,k){let M=k?_:E,L="",{scheme:q,authority:ce,path:ae,query:Ct,fragment:dt}=U;if(q&&(L+=q,L+=":"),(ce||q==="file")&&(L+=y,L+=y),ce){let Pe=ce.indexOf("@");if(Pe!==-1){let rn=ce.substr(0,Pe);ce=ce.substr(Pe+1),Pe=rn.lastIndexOf(":"),Pe===-1?L+=M(rn,!1,!1):(L+=M(rn.substr(0,Pe),!1,!1),L+=":",L+=M(rn.substr(Pe+1),!1,!0)),L+="@"}ce=ce.toLowerCase(),Pe=ce.lastIndexOf(":"),Pe===-1?L+=M(ce,!1,!0):(L+=M(ce.substr(0,Pe),!1,!0),L+=ce.substr(Pe))}if(ae){if(ae.length>=3&&ae.charCodeAt(0)===47&&ae.charCodeAt(2)===58){let Pe=ae.charCodeAt(1);Pe>=65&&Pe<=90&&(ae=`/${String.fromCharCode(Pe+32)}:${ae.substr(3)}`)}else if(ae.length>=2&&ae.charCodeAt(1)===58){let Pe=ae.charCodeAt(0);Pe>=65&&Pe<=90&&(ae=`${String.fromCharCode(Pe+32)}:${ae.substr(2)}`)}L+=M(ae,!0,!1)}return Ct&&(L+="?",L+=M(Ct,!1,!1)),dt&&(L+="#",L+=k?dt:E(dt,!1,!1)),L}function H(U){try{return decodeURIComponent(U)}catch{return U.length>3?U.substr(0,3)+H(U.substr(3)):U}}s.uriToFsPath=j;let re=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function fe(U){return U.match(re)?U.replace(re,k=>H(k)):U}},679:function(i,s,o){var a=this&&this.__createBinding||(Object.create?function(v,x,I,P){P===void 0&&(P=I);var w=Object.getOwnPropertyDescriptor(x,I);w&&!("get"in w?!x.__esModule:w.writable||w.configurable)||(w={enumerable:!0,get:function(){return x[I]}}),Object.defineProperty(v,P,w)}:function(v,x,I,P){P===void 0&&(P=I),v[P]=x[I]}),u=this&&this.__setModuleDefault||(Object.create?function(v,x){Object.defineProperty(v,"default",{enumerable:!0,value:x})}:function(v,x){v.default=x}),c=this&&this.__importStar||function(v){if(v&&v.__esModule)return v;var x={};if(v!=null)for(var I in v)I!=="default"&&Object.prototype.hasOwnProperty.call(v,I)&&a(x,v,I);return u(x,v),x};Object.defineProperty(s,"__esModule",{value:!0}),s.Utils=void 0;let l=c(o(470)),d=l.posix||l,p="/";var y;(function(v){v.joinPath=function(x,...I){return x.with({path:d.join(x.path,...I)})},v.resolvePath=function(x,...I){let P=x.path,w=!1;P[0]!==p&&(P=p+P,w=!0);let E=d.resolve(P,...I);return w&&E[0]===p&&!x.authority&&(E=E.substring(1)),x.with({path:E})},v.dirname=function(x){if(x.path.length===0||x.path===p)return x;let I=d.dirname(x.path);return I.length===1&&I.charCodeAt(0)===46&&(I=""),x.with({path:I})},v.basename=function(x){return d.basename(x.path)},v.extname=function(x){return d.extname(x.path)}})(y||(s.Utils=y={}))}},e={};function n(i){var s=e[i];if(s!==void 0)return s.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,n),o.exports}var r={};return(()=>{var i=r;Object.defineProperty(i,"__esModule",{value:!0}),i.Utils=i.URI=void 0;let s=n(796);Object.defineProperty(i,"URI",{enumerable:!0,get:function(){return s.URI}});let o=n(679);Object.defineProperty(i,"Utils",{enumerable:!0,get:function(){return o.Utils}})})(),r})())});var qd=m(Nd=>{"use strict";Object.defineProperty(Nd,"__esModule",{value:!0});Nd.MarkdownString=void 0;var db=class{constructor(e=""){this.sanitize=!0,this.value=e}appendText(e){return this.value+=e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&"),this}appendMarkdown(e){return this.value+=e,this}appendCodeblock(e,n){return this.value+="\n```",this.value+=e,this.value+=`
221
- `,this.value+=n,this.value+="\n```\n",this}toString(){return this.value}};Nd.MarkdownString=db});var jd=m(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.createHover=gt.createSignatureInfo=gt.appendTooltipBody=gt.appendTooltipHeader=gt.createTooltipHeader=gt.formatDefaultValue=gt.formatTypes=void 0;var Bx=qs(),Ux=qd();function fb(t=[]){return t.map(e=>e.toString().replace(",","\u066B")).join(" or ")}gt.formatTypes=fb;function Hx(t){return typeof t=="string"?`"${t}"`:t.toString()}gt.formatDefaultValue=Hx;var mq=(t,e)=>{let n=e.getArguments()||[],r=fb(e.getReturns())||"null";if(n.length===0)return`(${t.kind}) ${t.label} (): ${r}`;let i=n.map(s=>`${s.getLabel()}${s.isOptional()?"?":""}: ${fb(s.getTypes())}${s.getDefault()?` = ${Hx(s.getDefault().value)}`:""}`).join(", ");return`(${t.kind}) ${t.label} (${i}): ${r}`};gt.createTooltipHeader=mq;var gq=(t,e,n)=>{t.appendCodeblock(Bx.LanguageId,(0,gt.createTooltipHeader)(e,n)),t.appendMarkdown(`***
221
+ `,this.value+=n,this.value+="\n```\n",this}toString(){return this.value}};Nd.MarkdownString=db});var jd=m(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.createHover=gt.createSignatureInfo=gt.appendTooltipBody=gt.appendTooltipHeader=gt.createTooltipHeader=gt.formatDefaultValue=gt.formatTypes=void 0;var Bx=qs(),Ux=qd();function fb(t){return t==null?"":t.map(e=>e.toString().replace(",","\u066B")).join(" or ")}gt.formatTypes=fb;function Hx(t){return typeof t=="string"?`"${t}"`:t.toString()}gt.formatDefaultValue=Hx;var mq=(t,e)=>{let n=e.getArguments()||[],r=fb(e.getReturns())||"null";if(n.length===0)return`(${t.kind}) ${t.label} (): ${r}`;let i=n.map(s=>`${s.getLabel()}${s.isOptional()?"?":""}: ${fb(s.getTypes())}${s.getDefault()?` = ${Hx(s.getDefault().value)}`:""}`).join(", ");return`(${t.kind}) ${t.label} (${i}): ${r}`};gt.createTooltipHeader=mq;var gq=(t,e,n)=>{t.appendCodeblock(Bx.LanguageId,(0,gt.createTooltipHeader)(e,n)),t.appendMarkdown(`***
222
222
  `)};gt.appendTooltipHeader=gq;var yq=(t,e)=>{let n=e.getExample()||[];t.appendMarkdown(e.getDescription()+`
223
223
  `),n.length>0&&(t.appendMarkdown(`#### Examples:
224
224
  `),t.appendCodeblock(Bx.LanguageId,n.join(`
225
225
  `)))};gt.appendTooltipBody=yq;var bq=t=>{let e=[];for(let n of t.signatureDefinitions){let r=n,s={label:(0,gt.createTooltipHeader)(t,r)},o=r.getArguments()??[],a=new Ux.MarkdownString("");(0,gt.appendTooltipBody)(a,r),s.parameters=o.map(u=>({label:`${u.getLabel()}${u.isOptional()?"?":""}: ${u.getTypes().join(" or ")}`})),s.documentation=a.toString(),e.push(s)}return e};gt.createSignatureInfo=bq;var _q=t=>{let e=[];for(let n of t.signatureDefinitions){let r=new Ux.MarkdownString(""),i=n;(0,gt.appendTooltipHeader)(r,t,i),(0,gt.appendTooltipBody)(r,i),e.push(r)}return{contents:e.map(n=>n.toString())}};gt.createHover=_q});var Vx=m(vo=>{"use strict";var vq=vo&&vo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vo,"__esModule",{value:!0});vo.activate=void 0;var Wx=Fr(),pb=$n(),Sq=vq(require("path")),Fd=Ld(),Tq=fo(),Gx=qd(),hb=jd(),wq=qs();function Eq(t){async function e(n,r){let i=new Gx.MarkdownString(""),o=r.closest.path,a=await t.fs.getWorkspaceFolderUris(),u=o.startsWith("/")?a[0]:Fd.Utils.joinPath(Fd.URI.parse(n.uri),".."),c=Fd.Utils.joinPath(u,o),l=Fd.Utils.joinPath(u,`${o}`),d=await t.fs.findExistingPath(c.toString(),l.toString()),p=[`[Inserts file "${Sq.default.basename(d)}" inside this code when building](${d.toString()})`,"***","Click the link above to open the file."];return i.appendMarkdown(p.join(`
226
- `)),{contents:i.toString()}}t.connection.onHover(async n=>{if(!t.getConfiguration().hoverdocs)return;let r=await t.fs.getTextDocument(n.textDocument.uri);if(r==null)return;let i=new Tq.LookupHelper(r,t),s=i.lookupAST(n.position);if(!s)return;if(s.closest.type===Wx.ASTType.FeatureImportExpression||s.closest.type===Wx.ASTType.FeatureIncludeExpression)return await e(r,s);let o=await i.lookupTypeInfo(s);if(!o)return;if(o.isCallable())return(0,hb.createHover)(o);let a=new Gx.MarkdownString(""),u=Array.from(o.types).map(pb.SignatureDefinitionTypeMeta.parse),c=`(${o.kind}) ${o.label}: ${(0,hb.formatTypes)(u)}`;if(o.types.has(pb.SignatureDefinitionBaseType.Map)){let l={};for(let[d,p]of o.values){let y=Array.from(p.types).map(pb.SignatureDefinitionTypeMeta.parse);l[d.slice(2)]=(0,hb.formatTypes)(y)}c+=" "+JSON.stringify(l,null,2)}return a.appendCodeblock(wq.LanguageId,c),{contents:a.toString()}})}vo.activate=Eq});var Kx=m($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});$d.activate=void 0;var zx=je(),Aq=fo(),xq=jd(),kq=t=>{if(t.closest.type===zx.ASTType.CallExpression)return t.closest;for(let e=t.outer.length-1;e>=0;e--){let n=t.outer[e];if(n.type===zx.ASTType.CallExpression)return n}return null};function Cq(t){t.connection.onSignatureHelp(async e=>{if(!t.getConfiguration().autocomplete)return;let n=await t.fs.getTextDocument(e.textDocument.uri);if(n==null)return;await t.documentManager.getLatest(n);let r=new Aq.LookupHelper(n,t),i=r.lookupAST(e.position);if(!i)return;let{closest:s}=i,o=kq(i);if(o===null)return;let a=await r.lookupTypeInfo({closest:o.base,outer:s.scope?[s.scope]:[]});if(!a||!a.isCallable())return;let c=o.arguments.findIndex(d=>{let p=d.start.character-1,y=d.end.character;return p<=e.position.character&&y>=e.position.character}),l={activeParameter:c===-1?0:c,signatures:[],activeSignature:0};return l.signatures.push(...(0,xq.createSignatureInfo)(a)),l})}$d.activate=Cq});var Yx=m(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.activate=void 0;var Xx=qs();function Oq(t){let e=r=>r.languageId!==Xx.LanguageId?!1:t.documentManager.schedule(r),n=r=>{r.languageId===Xx.LanguageId&&t.documentManager.clear(r)};t.fs.on("text-document-open",e),t.fs.on("text-document-change",e),t.fs.on("text-document-close",n)}Bd.activate=Oq});var Qx=m(So=>{"use strict";var Rq=So&&So.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(So,"__esModule",{value:!0});So.activate=void 0;var Dq=$a(),Iq=Ay(),Pq=Rq(Ua()),Jx=(t,e)=>{let n=Pq.default.get(t.uri),r=n.resolveAllAssignmentsWithQuery(e),i=[];for(let s of r){let o=s,a=n.resolveNamespace(o.variable,!0);if(a==null)continue;let u=a?.label??(0,Dq.createExpressionId)(s.variable),c=a?.kind?(0,Iq.getSymbolItemKind)(a.kind):13,l={line:o.variable.start.line-1,character:o.variable.start.character-1},d={line:o.variable.end.line-1,character:o.variable.end.character-1};i.push({name:u,containerName:u,kind:c,location:{uri:t.uri,range:{start:l,end:d}}})}return i};function Mq(t){t.connection.onDocumentSymbol(async e=>{let n=await t.fs.getTextDocument(e.textDocument.uri);return n==null?void 0:t.documentManager.get(n).document?Jx(n,""):[]}),t.connection.onWorkspaceSymbol(e=>{let n=[];for(let r of t.fs.getAllTextDocuments())t.documentManager.get(r).document&&n.push(...Jx(r,e.query));return n})}So.activate=Mq});var vb=m((wU,nk)=>{var Ya=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Lq=typeof AbortController=="function",Ud=Lq?AbortController:class{constructor(){this.signal=new Zx}abort(e=new Error("This operation was aborted")){this.signal.reason=this.signal.reason||e,this.signal.aborted=!0,this.signal.dispatchEvent({type:"abort",target:this.signal})}},Nq=typeof AbortSignal=="function",qq=typeof Ud.AbortSignal=="function",Zx=Nq?AbortSignal:qq?Ud.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,this.onabort(e),this._listeners.forEach(n=>n(e),this))}onabort(){}addEventListener(e,n){e==="abort"&&this._listeners.push(n)}removeEventListener(e,n){e==="abort"&&(this._listeners=this._listeners.filter(r=>r!==n))}},bb=new Set,mb=(t,e)=>{let n=`LRU_CACHE_OPTION_${t}`;Hd(n)&&_b(n,`${t} option`,`options.${e}`,wo)},gb=(t,e)=>{let n=`LRU_CACHE_METHOD_${t}`;if(Hd(n)){let{prototype:r}=wo,{get:i}=Object.getOwnPropertyDescriptor(r,t);_b(n,`${t} method`,`cache.${e}()`,i)}},jq=(t,e)=>{let n=`LRU_CACHE_PROPERTY_${t}`;if(Hd(n)){let{prototype:r}=wo,{get:i}=Object.getOwnPropertyDescriptor(r,t);_b(n,`${t} property`,`cache.${e}`,i)}},ek=(...t)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...t):console.error(...t)},Hd=t=>!bb.has(t),_b=(t,e,n,r)=>{bb.add(t);let i=`The ${e} is deprecated. Please use ${n} instead.`;ek(i,"DeprecationWarning",t,r)},xi=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),tk=t=>xi(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?To:null:null,To=class extends Array{constructor(e){super(e),this.fill(0)}},yb=class{constructor(e){if(e===0)return[];let n=tk(e);this.heap=new n(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},wo=class t{constructor(e={}){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:u,dispose:c,disposeAfter:l,noDisposeOnSet:d,noUpdateTTL:p,maxSize:y=0,maxEntrySize:v=0,sizeCalculation:x,fetchMethod:I,fetchContext:P,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:j,ignoreFetchAbort:O}=e,{length:H,maxAge:re,stale:fe}=e instanceof t?{}:e;if(n!==0&&!xi(n))throw new TypeError("max option must be a nonnegative integer");let U=n?tk(n):Array;if(!U)throw new Error("invalid max value: "+n);if(this.max=n,this.maxSize=y,this.maxEntrySize=v||this.maxSize,this.sizeCalculation=x||H,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=I||null,this.fetchMethod&&typeof this.fetchMethod!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=P,!this.fetchMethod&&P!==void 0)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(n).fill(null),this.valList=new Array(n).fill(null),this.next=new U(n),this.prev=new U(n),this.head=0,this.tail=0,this.free=new yb(n),this.initialFill=1,this.size=0,typeof c=="function"&&(this.dispose=c),typeof l=="function"?(this.disposeAfter=l,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!d,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!_,this.allowStaleOnFetchAbort=!!j,this.ignoreFetchAbort=!!O,this.maxEntrySize!==0){if(this.maxSize!==0&&!xi(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");if(!xi(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!u||!!fe,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=xi(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||re||0,this.ttl){if(!xi(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(this.max===0&&this.ttl===0&&this.maxSize===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){let k="LRU_CACHE_UNBOUNDED";Hd(k)&&(bb.add(k),ek("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",k,t))}fe&&mb("stale","allowStale"),re&&mb("maxAge","ttl"),H&&mb("length","sizeCalculation")}getRemainingTTL(e){return this.has(e,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new To(this.max),this.starts=new To(this.max),this.setItemTTL=(r,i,s=Ya.now())=>{if(this.starts[r]=i!==0?s:0,this.ttls[r]=i,i!==0&&this.ttlAutopurge){let o=setTimeout(()=>{this.isStale(r)&&this.delete(this.keyList[r])},i+1);o.unref&&o.unref()}},this.updateItemAge=r=>{this.starts[r]=this.ttls[r]!==0?Ya.now():0},this.statusTTL=(r,i)=>{r&&(r.ttl=this.ttls[i],r.start=this.starts[i],r.now=e||n(),r.remainingTTL=r.now+r.ttl-r.start)};let e=0,n=()=>{let r=Ya.now();if(this.ttlResolution>0){e=r;let i=setTimeout(()=>e=0,this.ttlResolution);i.unref&&i.unref()}return r};this.getRemainingTTL=r=>{let i=this.keyMap.get(r);return i===void 0?0:this.ttls[i]===0||this.starts[i]===0?1/0:this.starts[i]+this.ttls[i]-(e||n())},this.isStale=r=>this.ttls[r]!==0&&this.starts[r]!==0&&(e||n())-this.starts[r]>this.ttls[r]}updateItemAge(e){}statusTTL(e,n){}setItemTTL(e,n,r){}isStale(e){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new To(this.max),this.removeItemSize=e=>{this.calculatedSize-=this.sizes[e],this.sizes[e]=0},this.requireSize=(e,n,r,i)=>{if(this.isBackgroundFetch(n))return 0;if(!xi(r))if(i){if(typeof i!="function")throw new TypeError("sizeCalculation must be a function");if(r=i(n,e),!xi(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.addItemSize=(e,n,r)=>{if(this.sizes[e]=n,this.maxSize){let i=this.maxSize-this.sizes[e];for(;this.calculatedSize>i;)this.evict(!0)}this.calculatedSize+=this.sizes[e],r&&(r.entrySize=n,r.totalCalculatedSize=this.calculatedSize)}}removeItemSize(e){}addItemSize(e,n){}requireSize(e,n,r,i){if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}*indexes({allowStale:e=this.allowStale}={}){if(this.size)for(let n=this.tail;!(!this.isValidIndex(n)||((e||!this.isStale(n))&&(yield n),n===this.head));)n=this.prev[n]}*rindexes({allowStale:e=this.allowStale}={}){if(this.size)for(let n=this.head;!(!this.isValidIndex(n)||((e||!this.isStale(n))&&(yield n),n===this.tail));)n=this.next[n]}isValidIndex(e){return e!==void 0&&this.keyMap.get(this.keyList[e])===e}*entries(){for(let e of this.indexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*rentries(){for(let e of this.rindexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*keys(){for(let e of this.indexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*rkeys(){for(let e of this.rindexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*values(){for(let e of this.indexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}*rvalues(){for(let e of this.rindexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}[Symbol.iterator](){return this.entries()}find(e,n){for(let r of this.indexes()){let i=this.valList[r],s=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.keyList[r],this))return this.get(this.keyList[r],n)}}forEach(e,n=this){for(let r of this.indexes()){let i=this.valList[r],s=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(n,s,this.keyList[r],this)}}rforEach(e,n=this){for(let r of this.rindexes()){let i=this.valList[r],s=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(n,s,this.keyList[r],this)}}get prune(){return gb("prune","purgeStale"),this.purgeStale}purgeStale(){let e=!1;for(let n of this.rindexes({allowStale:!0}))this.isStale(n)&&(this.delete(this.keyList[n]),e=!0);return e}dump(){let e=[];for(let n of this.indexes({allowStale:!0})){let r=this.keyList[n],i=this.valList[n],s=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;if(s===void 0)continue;let o={value:s};if(this.ttls){o.ttl=this.ttls[n];let a=Ya.now()-this.starts[n];o.start=Math.floor(Date.now()-a)}this.sizes&&(o.size=this.sizes[n]),e.unshift([r,o])}return e}load(e){this.clear();for(let[n,r]of e){if(r.start){let i=Date.now()-r.start;r.start=Ya.now()-i}this.set(n,r.value,r)}}dispose(e,n,r){}set(e,n,{ttl:r=this.ttl,start:i,noDisposeOnSet:s=this.noDisposeOnSet,size:o=0,sizeCalculation:a=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,status:c}={}){if(o=this.requireSize(e,n,o,a),this.maxEntrySize&&o>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.delete(e),this;let l=this.size===0?void 0:this.keyMap.get(e);if(l===void 0)l=this.newIndex(),this.keyList[l]=e,this.valList[l]=n,this.keyMap.set(e,l),this.next[this.tail]=l,this.prev[l]=this.tail,this.tail=l,this.size++,this.addItemSize(l,o,c),c&&(c.set="add"),u=!1;else{this.moveToTail(l);let d=this.valList[l];if(n!==d){if(this.isBackgroundFetch(d)?d.__abortController.abort(new Error("replaced")):s||(this.dispose(d,e,"set"),this.disposeAfter&&this.disposed.push([d,e,"set"])),this.removeItemSize(l),this.valList[l]=n,this.addItemSize(l,o,c),c){c.set="replace";let p=d&&this.isBackgroundFetch(d)?d.__staleWhileFetching:d;p!==void 0&&(c.oldValue=p)}}else c&&(c.set="update")}if(r!==0&&this.ttl===0&&!this.ttls&&this.initializeTTLTracking(),u||this.setItemTTL(l,r,i),this.statusTTL(c,l),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return this.size===0?this.tail:this.size===this.max&&this.max!==0?this.evict(!1):this.free.length!==0?this.free.pop():this.initialFill++}pop(){if(this.size){let e=this.valList[this.head];return this.evict(!0),e}}evict(e){let n=this.head,r=this.keyList[n],i=this.valList[n];return this.isBackgroundFetch(i)?i.__abortController.abort(new Error("evicted")):(this.dispose(i,r,"evict"),this.disposeAfter&&this.disposed.push([i,r,"evict"])),this.removeItemSize(n),e&&(this.keyList[n]=null,this.valList[n]=null,this.free.push(n)),this.head=this.next[n],this.keyMap.delete(r),this.size--,n}has(e,{updateAgeOnHas:n=this.updateAgeOnHas,status:r}={}){let i=this.keyMap.get(e);if(i!==void 0)if(this.isStale(i))r&&(r.has="stale",this.statusTTL(r,i));else return n&&this.updateItemAge(i),r&&(r.has="hit"),this.statusTTL(r,i),!0;else r&&(r.has="miss");return!1}peek(e,{allowStale:n=this.allowStale}={}){let r=this.keyMap.get(e);if(r!==void 0&&(n||!this.isStale(r))){let i=this.valList[r];return this.isBackgroundFetch(i)?i.__staleWhileFetching:i}}backgroundFetch(e,n,r,i){let s=n===void 0?void 0:this.valList[n];if(this.isBackgroundFetch(s))return s;let o=new Ud;r.signal&&r.signal.addEventListener("abort",()=>o.abort(r.signal.reason));let a={signal:o.signal,options:r,context:i},u=(y,v=!1)=>{let{aborted:x}=o.signal,I=r.ignoreFetchAbort&&y!==void 0;return r.status&&(x&&!v?(r.status.fetchAborted=!0,r.status.fetchError=o.signal.reason,I&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),x&&!I&&!v?l(o.signal.reason):(this.valList[n]===p&&(y===void 0?p.__staleWhileFetching?this.valList[n]=p.__staleWhileFetching:this.delete(e):(r.status&&(r.status.fetchUpdated=!0),this.set(e,y,a.options))),y)},c=y=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=y),l(y)),l=y=>{let{aborted:v}=o.signal,x=v&&r.allowStaleOnFetchAbort,I=x||r.allowStaleOnFetchRejection,P=I||r.noDeleteOnFetchRejection;if(this.valList[n]===p&&(!P||p.__staleWhileFetching===void 0?this.delete(e):x||(this.valList[n]=p.__staleWhileFetching)),I)return r.status&&p.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),p.__staleWhileFetching;if(p.__returned===p)throw y},d=(y,v)=>{this.fetchMethod(e,s,a).then(x=>y(x),v),o.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(y(),r.allowStaleOnFetchAbort&&(y=x=>u(x,!0)))})};r.status&&(r.status.fetchDispatched=!0);let p=new Promise(d).then(u,c);return p.__abortController=o,p.__staleWhileFetching=s,p.__returned=null,n===void 0?(this.set(e,p,{...a.options,status:void 0}),n=this.keyMap.get(e)):this.valList[n]=p,p}isBackgroundFetch(e){return e&&typeof e=="object"&&typeof e.then=="function"&&Object.prototype.hasOwnProperty.call(e,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(e,"__returned")&&(e.__returned===e||e.__returned===null)}async fetch(e,{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:a=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,fetchContext:v=this.fetchContext,forceRefresh:x=!1,status:I,signal:P}={}){if(!this.fetchMethod)return I&&(I.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:I});let w={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:s,noDisposeOnSet:o,size:a,sizeCalculation:u,noUpdateTTL:c,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:I,signal:P},E=this.keyMap.get(e);if(E===void 0){I&&(I.fetch="miss");let _=this.backgroundFetch(e,E,w,v);return _.__returned=_}else{let _=this.valList[E];if(this.isBackgroundFetch(_)){let fe=n&&_.__staleWhileFetching!==void 0;return I&&(I.fetch="inflight",fe&&(I.returnedStale=!0)),fe?_.__staleWhileFetching:_.__returned=_}let j=this.isStale(E);if(!x&&!j)return I&&(I.fetch="hit"),this.moveToTail(E),r&&this.updateItemAge(E),this.statusTTL(I,E),_;let O=this.backgroundFetch(e,E,w,v),H=O.__staleWhileFetching!==void 0,re=H&&n;return I&&(I.fetch=H&&j?"stale":"refresh",re&&j&&(I.returnedStale=!0)),re?O.__staleWhileFetching:O.__returned=O}}get(e,{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:s}={}){let o=this.keyMap.get(e);if(o!==void 0){let a=this.valList[o],u=this.isBackgroundFetch(a);return this.statusTTL(s,o),this.isStale(o)?(s&&(s.get="stale"),u?(s&&(s.returnedStale=n&&a.__staleWhileFetching!==void 0),n?a.__staleWhileFetching:void 0):(i||this.delete(e),s&&(s.returnedStale=n),n?a:void 0)):(s&&(s.get="hit"),u?a.__staleWhileFetching:(this.moveToTail(o),r&&this.updateItemAge(o),a))}else s&&(s.get="miss")}connect(e,n){this.prev[n]=e,this.next[e]=n}moveToTail(e){e!==this.tail&&(e===this.head?this.head=this.next[e]:this.connect(this.prev[e],this.next[e]),this.connect(this.tail,e),this.tail=e)}get del(){return gb("del","delete"),this.delete}delete(e){let n=!1;if(this.size!==0){let r=this.keyMap.get(e);if(r!==void 0)if(n=!0,this.size===1)this.clear();else{this.removeItemSize(r);let i=this.valList[r];this.isBackgroundFetch(i)?i.__abortController.abort(new Error("deleted")):(this.dispose(i,e,"delete"),this.disposeAfter&&this.disposed.push([i,e,"delete"])),this.keyMap.delete(e),this.keyList[r]=null,this.valList[r]=null,r===this.tail?this.tail=this.prev[r]:r===this.head?this.head=this.next[r]:(this.next[this.prev[r]]=this.next[r],this.prev[this.next[r]]=this.prev[r]),this.size--,this.free.push(r)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return n}clear(){for(let e of this.rindexes({allowStale:!0})){let n=this.valList[e];if(this.isBackgroundFetch(n))n.__abortController.abort(new Error("deleted"));else{let r=this.keyList[e];this.dispose(n,r,"delete"),this.disposeAfter&&this.disposed.push([n,r,"delete"])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return gb("reset","clear"),this.clear}get length(){return jq("length","size"),this.size}static get AbortController(){return Ud}static get AbortSignal(){return Zx}};nk.exports=wo});var ck=m((EU,uk)=>{var Eb=Object.defineProperty,Fq=Object.getOwnPropertyDescriptor,$q=Object.getOwnPropertyNames,Bq=Object.prototype.hasOwnProperty,Uq=(t,e)=>{for(var n in e)Eb(t,n,{get:e[n],enumerable:!0})},Hq=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of $q(e))!Bq.call(t,i)&&i!==n&&Eb(t,i,{get:()=>e[i],enumerable:!(r=Fq(e,i))||r.enumerable});return t},Wq=t=>Hq(Eb({},"__esModule",{value:!0}),t),rk={};Uq(rk,{ScheduleIntervalHelper:()=>Sb,SchedulePostMessageHelper:()=>Tb,ScheduleSetImmmediateHelper:()=>wb,schedule:()=>zq,scheduleProvider:()=>ak});uk.exports=Wq(rk);var Gq=Promise.prototype.then.bind(Promise.resolve()),Ab=class Wd{constructor(){this.queue=[],this.sleep=0}static{this.SLEEP_LIMIT=512}static{this.QUEUE_LIMIT=1024}static isApplicable(){return!1}static createCallback(){throw new Error("Cannot create callback from base schedule helper!")}tick(){let e=this.queue,n=Math.min(e.length,Wd.QUEUE_LIMIT);this.queue=this.queue.slice(Wd.QUEUE_LIMIT);for(let r=0;r<n;Gq(e[r++]));if(this.queue.length>0&&(this.sleep=0),this.sleep++<=Wd.SLEEP_LIMIT){this.nextTick();return}this.endTick()}start(){this.isTickActive()||(this.sleep=0,this.startTick())}add(e){this.queue.push(e),this.start()}},Sb=class ik extends Ab{constructor(){super(...arguments),this.timer=null,this.boundTick=this.tick.bind(this)}static isApplicable(){return!!globalThis.setInterval}static createCallback(){let e=new ik;return e.add.bind(e)}isTickActive(){return this.timer!==null}startTick(){this.timer=setInterval(this.boundTick,0)}nextTick(){}endTick(){clearInterval(this.timer),this.timer=null}},Vq=()=>{try{return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}catch{}return!1},Tb=class sk extends Ab{constructor(){super(),this.id=(Math.random()+1).toString(36).substring(7),this.active=!1,self.addEventListener("message",this.onMessage.bind(this))}static isApplicable(){return!Vq()&&!!self.postMessage&&!!self.addEventListener}static createCallback(){let e=new sk;return e.add.bind(e)}onMessage(e){e.source!==self||e.data!==this.id||this.tick()}isTickActive(){return this.active}startTick(){this.active=!0,self.postMessage(this.id)}nextTick(){self.postMessage(this.id)}endTick(){this.active=!1}},wb=class ok extends Ab{constructor(){super(...arguments),this.immediate=null,this.boundTick=this.tick.bind(this)}static isApplicable(){return!!globalThis.setImmediate}static createCallback(){let e=new ok;return e.add.bind(e)}isTickActive(){return this.immediate!==null}startTick(){this.immediate=setImmediate(this.boundTick)}nextTick(){this.immediate=setImmediate(this.boundTick)}endTick(){clearImmediate(this.immediate),this.immediate=null}};function ak(){if(wb.isApplicable())return wb.createCallback();if(Tb.isApplicable())return Tb.createCallback();if(Sb.isApplicable())return Sb.createCallback();throw new Error("No schedule helper fulfills requirements!")}var zq=ak()});var fk=m(wn=>{"use strict";var Cb=wn&&wn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wn,"__esModule",{value:!0});wn.DocumentManager=wn.PROCESSING_TIMEOUT=wn.ActiveDocument=wn.DocumentURIBuilder=void 0;var Kq=Cb(require("events")),lk=Fr(),Xq=Cb(vb()),xb=ck(),Gd=Ld(),dk=Cb(Ua()),Vd=class{constructor(e,n=null){this.workspaceFolderUri=n,this.rootPath=e}getFromWorkspaceFolder(e){if(this.workspaceFolderUri==null)throw new Error("Workspace folder is not defined!");return Gd.Utils.joinPath(this.workspaceFolderUri,e).toString()}getFromRootPath(e){return Gd.Utils.joinPath(this.rootPath,e).toString()}};wn.DocumentURIBuilder=Vd;var Eo=class{constructor(e){this.documentManager=e.documentManager,this.content=e.content,this.textDocument=e.textDocument,this.document=e.document,this.errors=e.errors}getDirectory(){return Gd.Utils.joinPath(Gd.URI.parse(this.textDocument.uri),"..")}getImportsAndIncludes(e=null){if(this.document==null)return[];let n=this.document,r=this.getDirectory(),i=this.documentManager.context,s=new Vd(r,e),o=a=>a.startsWith("/")?i.fs.findExistingPath(s.getFromWorkspaceFolder(a),s.getFromWorkspaceFolder(`${a}.src`)):i.fs.findExistingPath(s.getFromRootPath(a),s.getFromRootPath(`${a}.src`));return[...n.imports.filter(a=>a.path).map(a=>o(a.path)),...n.includes.filter(a=>a.path).map(a=>o(a.path))]}async getDependencies(){if(this.document==null)return[];if(this.dependencies)return this.dependencies;let e=await this.documentManager.context.fs.getWorkspaceFolderUris(),n=this.getImportsAndIncludes(e[0]),r=new Set([...n]);return this.dependencies=Array.from(r),this.dependencies}async getImports(){if(this.document==null)return[];let e=new Set,n=new Set([this.textDocument.uri]),r=async i=>{let s=await i.getDependencies();for(let o of s){if(n.has(o))continue;let a=await this.documentManager.open(o);n.add(o),a!==null&&(e.add(a),a.document!==null&&await r(a))}};return await r(this),Array.from(e)}};wn.ActiveDocument=Eo;wn.PROCESSING_TIMEOUT=100;var kb=class extends Kq.default{get context(){return this._context}setContext(e){return this._context=e,this}constructor(e=wn.PROCESSING_TIMEOUT){super(),this._context=null,this._timer=null,this.results=new Xq.default({ttl:1e3*60*20,ttlAutopurge:!0}),this.scheduledItems=new Map,this.tickRef=this.tick.bind(this),this.processingTimeout=e,(0,xb.schedule)(this.tickRef)}tick(){if(this.scheduledItems.size===0){this._timer=null;return}let e=Date.now(),n=Array.from(this.scheduledItems.values());for(let r=0;r<n.length;r++){let i=n[r];e-i.createdAt>this.processingTimeout&&(0,xb.schedule)(()=>this.refresh(i.document))}this._timer=setTimeout(this.tickRef,0)}refresh(e){let n=e.uri;if(!this.scheduledItems.has(n)&&this.results.has(n))return this.results.get(n);let r=this.create(e);return this.results.set(n,r),this.emit("parsed",e,r),this.scheduledItems.delete(n),r}create(e){let n=e.getText(),r=new lk.Parser(n,{unsafe:!0}),i=r.parseChunk();if(i.body?.length>0)return dk.default.analyze(e.uri,i),new Eo({documentManager:this,content:n,textDocument:e,document:i,errors:[...r.lexer.errors,...r.errors]});try{let o=new lk.Parser(e.getText()).parseChunk();return dk.default.analyze(e.uri,o),new Eo({documentManager:this,content:n,textDocument:e,document:o,errors:[]})}catch(s){return new Eo({documentManager:this,content:n,textDocument:e,document:null,errors:[s]})}}schedule(e){let n=e.uri,r=e.getText();return this.results.get(n)?.content===r?!1:(this.scheduledItems.set(n,{document:e,createdAt:Date.now()}),this._timer===null&&(this._timer=setTimeout(this.tickRef,0)),!0)}async open(e){try{let n=await this.context.fs.getTextDocument(e);return n==null?null:this.get(n)}catch{return null}}get(e){return this.results.get(e.uri)||this.refresh(e)}getLatest(e,n=5e3){return new Promise(r=>{(0,xb.schedule)(()=>{if(!this.scheduledItems.has(e.uri))return r(this.get(e));let i=()=>{this.removeListener("parsed",s),r(this.get(e))},s=a=>{a.uri===e.uri&&(this.removeListener("parsed",s),clearTimeout(o),r(this.get(e)))},o=setTimeout(i,n);this.addListener("parsed",s)})})}clear(e){this.results.delete(e.uri),this.emit("cleared",e)}};wn.DocumentManager=kb});var hk=m(Ao=>{"use strict";var Yq=Ao&&Ao.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ao,"__esModule",{value:!0});Ao.CoreContext=void 0;var Jq=Yq(require("events")),Ob=qs();function pk(t){return{formatter:t?.formatter??!0,autocomplete:t?.autocomplete??!0,hoverdocs:t?.hoverdocs??!0,diagnostic:t?.diagnostic??!0,transpiler:{beautify:{keepParentheses:t?.transpiler?.beautify?.keepParentheses??!0,indentation:t?.transpiler?.beautify?.indentation??Ob.IndentationType.Tab,indentationSpaces:t?.transpiler?.beautify?.indentationSpaces??2}}}}var Rb=class extends Jq.default{constructor(){super(),this._configuration=pk(),this._features={configuration:!1,workspaceFolder:!1}}get features(){return this._features}getConfiguration(){return this._configuration}async syncConfiguraton(){let e=await this.connection.workspace.getConfiguration(Ob.ConfigurationNamespace);this._configuration=pk(e)}configureCapabilties(e){this._features.configuration=!!(e.workspace&&e.workspace.configuration),this._features.workspaceFolder=!!(e.workspace&&e.workspace.workspaceFolders)}async onInitialize(e){this.configureCapabilties(e.capabilities);let n={capabilities:{completionProvider:{triggerCharacters:["."],resolveProvider:!0},hoverProvider:!0,colorProvider:!0,definitionProvider:!0,documentFormattingProvider:!0,signatureHelpProvider:{triggerCharacters:[",","("]},documentSymbolProvider:!0,workspaceSymbolProvider:!0,diagnosticProvider:{identifier:Ob.LanguageId,interFileDependencies:!1,workspaceDiagnostics:!1},textDocumentSync:2}};return this._features.workspaceFolder&&(n.capabilities.workspace={workspaceFolders:{supported:!0}}),this.emit("ready",this),n}async onInitialized(e){this._features.configuration&&(await this.syncConfiguraton(),this.connection.onDidChangeConfiguration(async()=>{let n=this._configuration;await this.syncConfiguraton(),this.emit("configuration-change",this,this._configuration,n)})),this.emit("loaded",this)}async listen(){this.fs.listen(this.connection),this.connection.onInitialize(this.onInitialize.bind(this)),this.connection.onInitialized(this.onInitialized.bind(this)),this.connection.listen()}};Ao.CoreContext=Rb});var zd=m(K=>{"use strict";var Qq=K&&K.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),Zq=K&&K.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ej=K&&K.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&Qq(e,t,n);return Zq(e,t),e},tj=K&&K.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(K,"__esModule",{value:!0});K.CoreContext=K.typeAnalyzer=K.lookupBase=K.lookupIdentifier=K.appendTooltipHeader=K.appendTooltipBody=K.formatTypes=K.formatDefaultValue=K.createTooltipHeader=K.createSignatureInfo=K.createHover=K.MarkdownString=K.LookupHelper=K.DocumentManager=K.ActiveDocument=K.ASTScraper=K.activateSymbol=K.activateSubscriptions=K.activateSignature=K.activateHover=K.activateFormatter=K.activateDiagnostic=K.activateDefinition=K.activateColor=K.activateAutocomplete=K.ConfigurationNamespace=K.LanguageId=K.IndentationType=void 0;var Db=qs();Object.defineProperty(K,"IndentationType",{enumerable:!0,get:function(){return Db.IndentationType}});Object.defineProperty(K,"LanguageId",{enumerable:!0,get:function(){return Db.LanguageId}});Object.defineProperty(K,"ConfigurationNamespace",{enumerable:!0,get:function(){return Db.ConfigurationNamespace}});var nj=sx();Object.defineProperty(K,"activateAutocomplete",{enumerable:!0,get:function(){return nj.activate}});var rj=mx();Object.defineProperty(K,"activateColor",{enumerable:!0,get:function(){return rj.activate}});var ij=bx();Object.defineProperty(K,"activateDefinition",{enumerable:!0,get:function(){return ij.activate}});var sj=_x();Object.defineProperty(K,"activateDiagnostic",{enumerable:!0,get:function(){return sj.activate}});var oj=$x();Object.defineProperty(K,"activateFormatter",{enumerable:!0,get:function(){return oj.activate}});var aj=Vx();Object.defineProperty(K,"activateHover",{enumerable:!0,get:function(){return aj.activate}});var uj=Kx();Object.defineProperty(K,"activateSignature",{enumerable:!0,get:function(){return uj.activate}});var cj=Yx();Object.defineProperty(K,"activateSubscriptions",{enumerable:!0,get:function(){return cj.activate}});var lj=Qx();Object.defineProperty(K,"activateSymbol",{enumerable:!0,get:function(){return lj.activate}});K.ASTScraper=ej(ky());var mk=fk();Object.defineProperty(K,"ActiveDocument",{enumerable:!0,get:function(){return mk.ActiveDocument}});Object.defineProperty(K,"DocumentManager",{enumerable:!0,get:function(){return mk.DocumentManager}});var dj=fo();Object.defineProperty(K,"LookupHelper",{enumerable:!0,get:function(){return dj.LookupHelper}});var fj=qd();Object.defineProperty(K,"MarkdownString",{enumerable:!0,get:function(){return fj.MarkdownString}});var cs=jd();Object.defineProperty(K,"createHover",{enumerable:!0,get:function(){return cs.createHover}});Object.defineProperty(K,"createSignatureInfo",{enumerable:!0,get:function(){return cs.createSignatureInfo}});Object.defineProperty(K,"createTooltipHeader",{enumerable:!0,get:function(){return cs.createTooltipHeader}});Object.defineProperty(K,"formatDefaultValue",{enumerable:!0,get:function(){return cs.formatDefaultValue}});Object.defineProperty(K,"formatTypes",{enumerable:!0,get:function(){return cs.formatTypes}});Object.defineProperty(K,"appendTooltipBody",{enumerable:!0,get:function(){return cs.appendTooltipBody}});Object.defineProperty(K,"appendTooltipHeader",{enumerable:!0,get:function(){return cs.appendTooltipHeader}});var Ib=Ua();Object.defineProperty(K,"lookupIdentifier",{enumerable:!0,get:function(){return Ib.lookupIdentifier}});Object.defineProperty(K,"lookupBase",{enumerable:!0,get:function(){return Ib.lookupBase}});Object.defineProperty(K,"typeAnalyzer",{enumerable:!0,get:function(){return tj(Ib).default}});var pj=hk();Object.defineProperty(K,"CoreContext",{enumerable:!0,get:function(){return pj.CoreContext}})});var _k={};Ik(_k,{TextDocument:()=>Pb});function Mb(t,e){if(t.length<=1)return t;let n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);Mb(r,e),Mb(i,e);let s=0,o=0,a=0;for(;s<r.length&&o<i.length;)e(r[s],i[o])<=0?t[a++]=r[s++]:t[a++]=i[o++];for(;s<r.length;)t[a++]=r[s++];for(;o<i.length;)t[a++]=i[o++];return t}function gk(t,e,n=0){let r=e?[n]:[];for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);yk(s)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,r.push(n+i+1))}return r}function yk(t){return t===13||t===10}function bk(t){let e=t.start,n=t.end;return e.line>n.line||e.line===n.line&&e.character>n.character?{start:n,end:e}:t}function hj(t){let e=bk(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var Kd,Pb,vk=Dk(()=>{"use strict";Kd=class t{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){for(let r of e)if(t.isIncremental(r)){let i=bk(r.range),s=this.offsetAt(i.start),o=this.offsetAt(i.end);this._content=this._content.substring(0,s)+r.text+this._content.substring(o,this._content.length);let a=Math.max(i.start.line,0),u=Math.max(i.end.line,0),c=this._lineOffsets,l=gk(r.text,!1,s);if(u-a===l.length)for(let p=0,y=l.length;p<y;p++)c[p+a+1]=l[p];else l.length<1e4?c.splice(a+1,u-a,...l):this._lineOffsets=c=c.slice(0,a+1).concat(l,c.slice(u+1));let d=r.text.length-(o-s);if(d!==0)for(let p=a+1+l.length,y=c.length;p<y;p++)c[p]=c[p]+d}else if(t.isFull(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=gk(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return{line:0,character:e};for(;r<i;){let o=Math.floor((r+i)/2);n[o]>e?i=o:r=o+1}let s=r-1;return e=this.ensureBeforeEOL(e,n[s]),{line:s,character:e-n[s]}}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line];if(e.character<=0)return r;let i=e.line+1<n.length?n[e.line+1]:this._content.length,s=Math.min(r+e.character,i);return this.ensureBeforeEOL(s,r)}ensureBeforeEOL(e,n){for(;e>n&&yk(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}};(function(t){function e(i,s,o,a){return new Kd(i,s,o,a)}t.create=e;function n(i,s,o){if(i instanceof Kd)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=n;function r(i,s){let o=i.getText(),a=Mb(s.map(hj),(l,d)=>{let p=l.range.start.line-d.range.start.line;return p===0?l.range.start.character-d.range.start.character:p}),u=0,c=[];for(let l of a){let d=i.offsetAt(l.range.start);if(d<u)throw new Error("Overlapping edit");d>u&&c.push(o.substring(u,d)),l.newText.length&&c.push(l.newText),u=i.offsetAt(l.range.end)}return c.push(o.substr(u)),c.join("")}t.applyEdits=r})(Pb||(Pb={}))});var Tk=m(xo=>{"use strict";var qb=xo&&xo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xo,"__esModule",{value:!0});xo.FileSystem=void 0;var mj=Yp(),Sk=(vk(),Mk(_k)),gj=qb(require("events")),Lb=Ld(),yj=qb(require("fs")),bj=zd(),_j=qb(vb()),Nb=class extends gj.default{constructor(e){super(),this._context=e,this._textDocumentManager=new mj.TextDocuments(Sk.TextDocument),this._tempTextDocumentCache=new _j.default({ttl:1e3,max:100})}async getWorkspaceFolderUris(){if(!this._context.features.workspaceFolder)return[];let e=await this._workspace.getWorkspaceFolders();return Array.from(new Set(e.map(n=>n.uri))).map(n=>Lb.URI.parse(n))}findExistingPath(...e){if(e.length===0)return"";for(let n=0;n<e.length;n++)if(this.getTextDocument(e[n])!=null)return e[n];return e[0]}getAllTextDocuments(){return this._textDocumentManager.all()}async fetchTextDocument(e){let n=Lb.URI.parse(e),r=this._tempTextDocumentCache.get(e);if(r!=null)return r;let i=null;try{let s=await yj.default.promises.readFile(n.fsPath,{encoding:"utf-8"});i=Sk.TextDocument.create(e,bj.LanguageId,0,s)}catch{}return this._tempTextDocumentCache.set(e,i),i}async getTextDocument(e){let n=this._textDocumentManager.get(e);return n||(Lb.URI.parse(e).scheme=="file"?await this.fetchTextDocument(e):null)}async readFile(e){return(await this.getTextDocument(e)).getText()}listen(e){this._workspace=e.workspace,this._textDocumentManager.listen(e),this._textDocumentManager.onDidOpen(n=>{this.emit("text-document-open",n.document)}),this._textDocumentManager.onDidChangeContent(n=>{this.emit("text-document-change",n.document)}),this._textDocumentManager.onDidClose(n=>{this.emit("text-document-close",n.document)})}};xo.FileSystem=Nb});var Ak=m(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.NodeContext=void 0;var wk=Yp(),Ek=zd(),vj=Tk(),jb=class extends Ek.CoreContext{constructor(){super(),this.documentManager=new Ek.DocumentManager().setContext(this),this.connection=(0,wk.createConnection)(wk.ProposedFeatures.all),this.fs=new vj.FileSystem(this)}};Xd.NodeContext=jb});Object.defineProperty(exports,"__esModule",{value:!0});var Sj=Ak(),Ur=zd(),xk=new Sj.NodeContext;xk.on("ready",t=>{(0,Ur.activateAutocomplete)(t),(0,Ur.activateColor)(t),(0,Ur.activateDefinition)(t),(0,Ur.activateDiagnostic)(t),(0,Ur.activateFormatter)(t),(0,Ur.activateHover)(t),(0,Ur.activateSignature)(t),(0,Ur.activateSubscriptions)(t),(0,Ur.activateSymbol)(t)});xk.listen();
226
+ `)),{contents:i.toString()}}t.connection.onHover(async n=>{if(!t.getConfiguration().hoverdocs)return;let r=await t.fs.getTextDocument(n.textDocument.uri);if(r==null)return;let i=new Tq.LookupHelper(r,t),s=i.lookupAST(n.position);if(!s)return;if(s.closest.type===Wx.ASTType.FeatureImportExpression||s.closest.type===Wx.ASTType.FeatureIncludeExpression)return await e(r,s);let o=await i.lookupTypeInfo(s);if(!o)return;if(o.isCallable())return(0,hb.createHover)(o);let a=new Gx.MarkdownString(""),u=Array.from(o.types).map(pb.SignatureDefinitionTypeMeta.parse),c=`(${o.kind}) ${o.label}: ${(0,hb.formatTypes)(u)}`;if(o.types.has(pb.SignatureDefinitionBaseType.Map)){let l={};for(let[d,p]of o.values){let y=Array.from(p.types).map(pb.SignatureDefinitionTypeMeta.parse);l[d.slice(2)]=(0,hb.formatTypes)(y)}c+=" "+JSON.stringify(l,null,2)}return a.appendCodeblock(wq.LanguageId,c),{contents:a.toString()}})}vo.activate=Eq});var Kx=m($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});$d.activate=void 0;var zx=je(),Aq=fo(),xq=jd(),kq=t=>{if(t.closest.type===zx.ASTType.CallExpression)return t.closest;for(let e=t.outer.length-1;e>=0;e--){let n=t.outer[e];if(n.type===zx.ASTType.CallExpression)return n}return null};function Cq(t){t.connection.onSignatureHelp(async e=>{if(!t.getConfiguration().autocomplete)return;let n=await t.fs.getTextDocument(e.textDocument.uri);if(n==null)return;await t.documentManager.getLatest(n);let r=new Aq.LookupHelper(n,t),i=r.lookupAST(e.position);if(!i)return;let{closest:s}=i,o=kq(i);if(o===null)return;let a=await r.lookupTypeInfo({closest:o.base,outer:s.scope?[s.scope]:[]});if(!a||!a.isCallable())return;let c=o.arguments.findIndex(d=>{let p=d.start.character-1,y=d.end.character;return p<=e.position.character&&y>=e.position.character}),l={activeParameter:c===-1?0:c,signatures:[],activeSignature:0};return l.signatures.push(...(0,xq.createSignatureInfo)(a)),l})}$d.activate=Cq});var Yx=m(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.activate=void 0;var Xx=qs();function Oq(t){let e=r=>r.languageId!==Xx.LanguageId?!1:t.documentManager.schedule(r),n=r=>{r.languageId===Xx.LanguageId&&t.documentManager.clear(r)};t.fs.on("text-document-open",e),t.fs.on("text-document-change",e),t.fs.on("text-document-close",n)}Bd.activate=Oq});var Qx=m(So=>{"use strict";var Rq=So&&So.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(So,"__esModule",{value:!0});So.activate=void 0;var Dq=$a(),Iq=Ay(),Pq=Rq(Ua()),Jx=(t,e)=>{let n=Pq.default.get(t.uri),r=n.resolveAllAssignmentsWithQuery(e),i=[];for(let s of r){let o=s,a=n.resolveNamespace(o.variable,!0);if(a==null)continue;let u=a?.label??(0,Dq.createExpressionId)(s.variable),c=a?.kind?(0,Iq.getSymbolItemKind)(a.kind):13,l={line:o.variable.start.line-1,character:o.variable.start.character-1},d={line:o.variable.end.line-1,character:o.variable.end.character-1};i.push({name:u,containerName:u,kind:c,location:{uri:t.uri,range:{start:l,end:d}}})}return i};function Mq(t){t.connection.onDocumentSymbol(async e=>{let n=await t.fs.getTextDocument(e.textDocument.uri);return n==null?void 0:t.documentManager.get(n).document?Jx(n,""):[]}),t.connection.onWorkspaceSymbol(e=>{let n=[];for(let r of t.fs.getAllTextDocuments())t.documentManager.get(r).document&&n.push(...Jx(r,e.query));return n})}So.activate=Mq});var vb=m((wU,nk)=>{var Ya=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Lq=typeof AbortController=="function",Ud=Lq?AbortController:class{constructor(){this.signal=new Zx}abort(e=new Error("This operation was aborted")){this.signal.reason=this.signal.reason||e,this.signal.aborted=!0,this.signal.dispatchEvent({type:"abort",target:this.signal})}},Nq=typeof AbortSignal=="function",qq=typeof Ud.AbortSignal=="function",Zx=Nq?AbortSignal:qq?Ud.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,this.onabort(e),this._listeners.forEach(n=>n(e),this))}onabort(){}addEventListener(e,n){e==="abort"&&this._listeners.push(n)}removeEventListener(e,n){e==="abort"&&(this._listeners=this._listeners.filter(r=>r!==n))}},bb=new Set,mb=(t,e)=>{let n=`LRU_CACHE_OPTION_${t}`;Hd(n)&&_b(n,`${t} option`,`options.${e}`,wo)},gb=(t,e)=>{let n=`LRU_CACHE_METHOD_${t}`;if(Hd(n)){let{prototype:r}=wo,{get:i}=Object.getOwnPropertyDescriptor(r,t);_b(n,`${t} method`,`cache.${e}()`,i)}},jq=(t,e)=>{let n=`LRU_CACHE_PROPERTY_${t}`;if(Hd(n)){let{prototype:r}=wo,{get:i}=Object.getOwnPropertyDescriptor(r,t);_b(n,`${t} property`,`cache.${e}`,i)}},ek=(...t)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...t):console.error(...t)},Hd=t=>!bb.has(t),_b=(t,e,n,r)=>{bb.add(t);let i=`The ${e} is deprecated. Please use ${n} instead.`;ek(i,"DeprecationWarning",t,r)},xi=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),tk=t=>xi(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?To:null:null,To=class extends Array{constructor(e){super(e),this.fill(0)}},yb=class{constructor(e){if(e===0)return[];let n=tk(e);this.heap=new n(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},wo=class t{constructor(e={}){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:u,dispose:c,disposeAfter:l,noDisposeOnSet:d,noUpdateTTL:p,maxSize:y=0,maxEntrySize:v=0,sizeCalculation:x,fetchMethod:I,fetchContext:P,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:j,ignoreFetchAbort:O}=e,{length:H,maxAge:re,stale:fe}=e instanceof t?{}:e;if(n!==0&&!xi(n))throw new TypeError("max option must be a nonnegative integer");let U=n?tk(n):Array;if(!U)throw new Error("invalid max value: "+n);if(this.max=n,this.maxSize=y,this.maxEntrySize=v||this.maxSize,this.sizeCalculation=x||H,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=I||null,this.fetchMethod&&typeof this.fetchMethod!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=P,!this.fetchMethod&&P!==void 0)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(n).fill(null),this.valList=new Array(n).fill(null),this.next=new U(n),this.prev=new U(n),this.head=0,this.tail=0,this.free=new yb(n),this.initialFill=1,this.size=0,typeof c=="function"&&(this.dispose=c),typeof l=="function"?(this.disposeAfter=l,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!d,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!_,this.allowStaleOnFetchAbort=!!j,this.ignoreFetchAbort=!!O,this.maxEntrySize!==0){if(this.maxSize!==0&&!xi(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");if(!xi(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!u||!!fe,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=xi(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||re||0,this.ttl){if(!xi(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(this.max===0&&this.ttl===0&&this.maxSize===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){let k="LRU_CACHE_UNBOUNDED";Hd(k)&&(bb.add(k),ek("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",k,t))}fe&&mb("stale","allowStale"),re&&mb("maxAge","ttl"),H&&mb("length","sizeCalculation")}getRemainingTTL(e){return this.has(e,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new To(this.max),this.starts=new To(this.max),this.setItemTTL=(r,i,s=Ya.now())=>{if(this.starts[r]=i!==0?s:0,this.ttls[r]=i,i!==0&&this.ttlAutopurge){let o=setTimeout(()=>{this.isStale(r)&&this.delete(this.keyList[r])},i+1);o.unref&&o.unref()}},this.updateItemAge=r=>{this.starts[r]=this.ttls[r]!==0?Ya.now():0},this.statusTTL=(r,i)=>{r&&(r.ttl=this.ttls[i],r.start=this.starts[i],r.now=e||n(),r.remainingTTL=r.now+r.ttl-r.start)};let e=0,n=()=>{let r=Ya.now();if(this.ttlResolution>0){e=r;let i=setTimeout(()=>e=0,this.ttlResolution);i.unref&&i.unref()}return r};this.getRemainingTTL=r=>{let i=this.keyMap.get(r);return i===void 0?0:this.ttls[i]===0||this.starts[i]===0?1/0:this.starts[i]+this.ttls[i]-(e||n())},this.isStale=r=>this.ttls[r]!==0&&this.starts[r]!==0&&(e||n())-this.starts[r]>this.ttls[r]}updateItemAge(e){}statusTTL(e,n){}setItemTTL(e,n,r){}isStale(e){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new To(this.max),this.removeItemSize=e=>{this.calculatedSize-=this.sizes[e],this.sizes[e]=0},this.requireSize=(e,n,r,i)=>{if(this.isBackgroundFetch(n))return 0;if(!xi(r))if(i){if(typeof i!="function")throw new TypeError("sizeCalculation must be a function");if(r=i(n,e),!xi(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.addItemSize=(e,n,r)=>{if(this.sizes[e]=n,this.maxSize){let i=this.maxSize-this.sizes[e];for(;this.calculatedSize>i;)this.evict(!0)}this.calculatedSize+=this.sizes[e],r&&(r.entrySize=n,r.totalCalculatedSize=this.calculatedSize)}}removeItemSize(e){}addItemSize(e,n){}requireSize(e,n,r,i){if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}*indexes({allowStale:e=this.allowStale}={}){if(this.size)for(let n=this.tail;!(!this.isValidIndex(n)||((e||!this.isStale(n))&&(yield n),n===this.head));)n=this.prev[n]}*rindexes({allowStale:e=this.allowStale}={}){if(this.size)for(let n=this.head;!(!this.isValidIndex(n)||((e||!this.isStale(n))&&(yield n),n===this.tail));)n=this.next[n]}isValidIndex(e){return e!==void 0&&this.keyMap.get(this.keyList[e])===e}*entries(){for(let e of this.indexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*rentries(){for(let e of this.rindexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*keys(){for(let e of this.indexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*rkeys(){for(let e of this.rindexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*values(){for(let e of this.indexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}*rvalues(){for(let e of this.rindexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}[Symbol.iterator](){return this.entries()}find(e,n){for(let r of this.indexes()){let i=this.valList[r],s=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.keyList[r],this))return this.get(this.keyList[r],n)}}forEach(e,n=this){for(let r of this.indexes()){let i=this.valList[r],s=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(n,s,this.keyList[r],this)}}rforEach(e,n=this){for(let r of this.rindexes()){let i=this.valList[r],s=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(n,s,this.keyList[r],this)}}get prune(){return gb("prune","purgeStale"),this.purgeStale}purgeStale(){let e=!1;for(let n of this.rindexes({allowStale:!0}))this.isStale(n)&&(this.delete(this.keyList[n]),e=!0);return e}dump(){let e=[];for(let n of this.indexes({allowStale:!0})){let r=this.keyList[n],i=this.valList[n],s=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;if(s===void 0)continue;let o={value:s};if(this.ttls){o.ttl=this.ttls[n];let a=Ya.now()-this.starts[n];o.start=Math.floor(Date.now()-a)}this.sizes&&(o.size=this.sizes[n]),e.unshift([r,o])}return e}load(e){this.clear();for(let[n,r]of e){if(r.start){let i=Date.now()-r.start;r.start=Ya.now()-i}this.set(n,r.value,r)}}dispose(e,n,r){}set(e,n,{ttl:r=this.ttl,start:i,noDisposeOnSet:s=this.noDisposeOnSet,size:o=0,sizeCalculation:a=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,status:c}={}){if(o=this.requireSize(e,n,o,a),this.maxEntrySize&&o>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.delete(e),this;let l=this.size===0?void 0:this.keyMap.get(e);if(l===void 0)l=this.newIndex(),this.keyList[l]=e,this.valList[l]=n,this.keyMap.set(e,l),this.next[this.tail]=l,this.prev[l]=this.tail,this.tail=l,this.size++,this.addItemSize(l,o,c),c&&(c.set="add"),u=!1;else{this.moveToTail(l);let d=this.valList[l];if(n!==d){if(this.isBackgroundFetch(d)?d.__abortController.abort(new Error("replaced")):s||(this.dispose(d,e,"set"),this.disposeAfter&&this.disposed.push([d,e,"set"])),this.removeItemSize(l),this.valList[l]=n,this.addItemSize(l,o,c),c){c.set="replace";let p=d&&this.isBackgroundFetch(d)?d.__staleWhileFetching:d;p!==void 0&&(c.oldValue=p)}}else c&&(c.set="update")}if(r!==0&&this.ttl===0&&!this.ttls&&this.initializeTTLTracking(),u||this.setItemTTL(l,r,i),this.statusTTL(c,l),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return this.size===0?this.tail:this.size===this.max&&this.max!==0?this.evict(!1):this.free.length!==0?this.free.pop():this.initialFill++}pop(){if(this.size){let e=this.valList[this.head];return this.evict(!0),e}}evict(e){let n=this.head,r=this.keyList[n],i=this.valList[n];return this.isBackgroundFetch(i)?i.__abortController.abort(new Error("evicted")):(this.dispose(i,r,"evict"),this.disposeAfter&&this.disposed.push([i,r,"evict"])),this.removeItemSize(n),e&&(this.keyList[n]=null,this.valList[n]=null,this.free.push(n)),this.head=this.next[n],this.keyMap.delete(r),this.size--,n}has(e,{updateAgeOnHas:n=this.updateAgeOnHas,status:r}={}){let i=this.keyMap.get(e);if(i!==void 0)if(this.isStale(i))r&&(r.has="stale",this.statusTTL(r,i));else return n&&this.updateItemAge(i),r&&(r.has="hit"),this.statusTTL(r,i),!0;else r&&(r.has="miss");return!1}peek(e,{allowStale:n=this.allowStale}={}){let r=this.keyMap.get(e);if(r!==void 0&&(n||!this.isStale(r))){let i=this.valList[r];return this.isBackgroundFetch(i)?i.__staleWhileFetching:i}}backgroundFetch(e,n,r,i){let s=n===void 0?void 0:this.valList[n];if(this.isBackgroundFetch(s))return s;let o=new Ud;r.signal&&r.signal.addEventListener("abort",()=>o.abort(r.signal.reason));let a={signal:o.signal,options:r,context:i},u=(y,v=!1)=>{let{aborted:x}=o.signal,I=r.ignoreFetchAbort&&y!==void 0;return r.status&&(x&&!v?(r.status.fetchAborted=!0,r.status.fetchError=o.signal.reason,I&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),x&&!I&&!v?l(o.signal.reason):(this.valList[n]===p&&(y===void 0?p.__staleWhileFetching?this.valList[n]=p.__staleWhileFetching:this.delete(e):(r.status&&(r.status.fetchUpdated=!0),this.set(e,y,a.options))),y)},c=y=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=y),l(y)),l=y=>{let{aborted:v}=o.signal,x=v&&r.allowStaleOnFetchAbort,I=x||r.allowStaleOnFetchRejection,P=I||r.noDeleteOnFetchRejection;if(this.valList[n]===p&&(!P||p.__staleWhileFetching===void 0?this.delete(e):x||(this.valList[n]=p.__staleWhileFetching)),I)return r.status&&p.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),p.__staleWhileFetching;if(p.__returned===p)throw y},d=(y,v)=>{this.fetchMethod(e,s,a).then(x=>y(x),v),o.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(y(),r.allowStaleOnFetchAbort&&(y=x=>u(x,!0)))})};r.status&&(r.status.fetchDispatched=!0);let p=new Promise(d).then(u,c);return p.__abortController=o,p.__staleWhileFetching=s,p.__returned=null,n===void 0?(this.set(e,p,{...a.options,status:void 0}),n=this.keyMap.get(e)):this.valList[n]=p,p}isBackgroundFetch(e){return e&&typeof e=="object"&&typeof e.then=="function"&&Object.prototype.hasOwnProperty.call(e,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(e,"__returned")&&(e.__returned===e||e.__returned===null)}async fetch(e,{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:a=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,fetchContext:v=this.fetchContext,forceRefresh:x=!1,status:I,signal:P}={}){if(!this.fetchMethod)return I&&(I.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:I});let w={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:s,noDisposeOnSet:o,size:a,sizeCalculation:u,noUpdateTTL:c,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:I,signal:P},E=this.keyMap.get(e);if(E===void 0){I&&(I.fetch="miss");let _=this.backgroundFetch(e,E,w,v);return _.__returned=_}else{let _=this.valList[E];if(this.isBackgroundFetch(_)){let fe=n&&_.__staleWhileFetching!==void 0;return I&&(I.fetch="inflight",fe&&(I.returnedStale=!0)),fe?_.__staleWhileFetching:_.__returned=_}let j=this.isStale(E);if(!x&&!j)return I&&(I.fetch="hit"),this.moveToTail(E),r&&this.updateItemAge(E),this.statusTTL(I,E),_;let O=this.backgroundFetch(e,E,w,v),H=O.__staleWhileFetching!==void 0,re=H&&n;return I&&(I.fetch=H&&j?"stale":"refresh",re&&j&&(I.returnedStale=!0)),re?O.__staleWhileFetching:O.__returned=O}}get(e,{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:s}={}){let o=this.keyMap.get(e);if(o!==void 0){let a=this.valList[o],u=this.isBackgroundFetch(a);return this.statusTTL(s,o),this.isStale(o)?(s&&(s.get="stale"),u?(s&&(s.returnedStale=n&&a.__staleWhileFetching!==void 0),n?a.__staleWhileFetching:void 0):(i||this.delete(e),s&&(s.returnedStale=n),n?a:void 0)):(s&&(s.get="hit"),u?a.__staleWhileFetching:(this.moveToTail(o),r&&this.updateItemAge(o),a))}else s&&(s.get="miss")}connect(e,n){this.prev[n]=e,this.next[e]=n}moveToTail(e){e!==this.tail&&(e===this.head?this.head=this.next[e]:this.connect(this.prev[e],this.next[e]),this.connect(this.tail,e),this.tail=e)}get del(){return gb("del","delete"),this.delete}delete(e){let n=!1;if(this.size!==0){let r=this.keyMap.get(e);if(r!==void 0)if(n=!0,this.size===1)this.clear();else{this.removeItemSize(r);let i=this.valList[r];this.isBackgroundFetch(i)?i.__abortController.abort(new Error("deleted")):(this.dispose(i,e,"delete"),this.disposeAfter&&this.disposed.push([i,e,"delete"])),this.keyMap.delete(e),this.keyList[r]=null,this.valList[r]=null,r===this.tail?this.tail=this.prev[r]:r===this.head?this.head=this.next[r]:(this.next[this.prev[r]]=this.next[r],this.prev[this.next[r]]=this.prev[r]),this.size--,this.free.push(r)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return n}clear(){for(let e of this.rindexes({allowStale:!0})){let n=this.valList[e];if(this.isBackgroundFetch(n))n.__abortController.abort(new Error("deleted"));else{let r=this.keyList[e];this.dispose(n,r,"delete"),this.disposeAfter&&this.disposed.push([n,r,"delete"])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return gb("reset","clear"),this.clear}get length(){return jq("length","size"),this.size}static get AbortController(){return Ud}static get AbortSignal(){return Zx}};nk.exports=wo});var ck=m((EU,uk)=>{var Eb=Object.defineProperty,Fq=Object.getOwnPropertyDescriptor,$q=Object.getOwnPropertyNames,Bq=Object.prototype.hasOwnProperty,Uq=(t,e)=>{for(var n in e)Eb(t,n,{get:e[n],enumerable:!0})},Hq=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of $q(e))!Bq.call(t,i)&&i!==n&&Eb(t,i,{get:()=>e[i],enumerable:!(r=Fq(e,i))||r.enumerable});return t},Wq=t=>Hq(Eb({},"__esModule",{value:!0}),t),rk={};Uq(rk,{ScheduleIntervalHelper:()=>Sb,SchedulePostMessageHelper:()=>Tb,ScheduleSetImmmediateHelper:()=>wb,schedule:()=>zq,scheduleProvider:()=>ak});uk.exports=Wq(rk);var Gq=Promise.prototype.then.bind(Promise.resolve()),Ab=class Wd{constructor(){this.queue=[],this.sleep=0}static{this.SLEEP_LIMIT=512}static{this.QUEUE_LIMIT=1024}static isApplicable(){return!1}static createCallback(){throw new Error("Cannot create callback from base schedule helper!")}tick(){let e=this.queue,n=Math.min(e.length,Wd.QUEUE_LIMIT);this.queue=this.queue.slice(Wd.QUEUE_LIMIT);for(let r=0;r<n;Gq(e[r++]));if(this.queue.length>0&&(this.sleep=0),this.sleep++<=Wd.SLEEP_LIMIT){this.nextTick();return}this.endTick()}start(){this.isTickActive()||(this.sleep=0,this.startTick())}add(e){this.queue.push(e),this.start()}},Sb=class ik extends Ab{constructor(){super(...arguments),this.timer=null,this.boundTick=this.tick.bind(this)}static isApplicable(){return!!globalThis.setInterval}static createCallback(){let e=new ik;return e.add.bind(e)}isTickActive(){return this.timer!==null}startTick(){this.timer=setInterval(this.boundTick,0)}nextTick(){}endTick(){clearInterval(this.timer),this.timer=null}},Vq=()=>{try{return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}catch{}return!1},Tb=class sk extends Ab{constructor(){super(),this.id=(Math.random()+1).toString(36).substring(7),this.active=!1,self.addEventListener("message",this.onMessage.bind(this))}static isApplicable(){return!Vq()&&!!self.postMessage&&!!self.addEventListener}static createCallback(){let e=new sk;return e.add.bind(e)}onMessage(e){e.source!==self||e.data!==this.id||this.tick()}isTickActive(){return this.active}startTick(){this.active=!0,self.postMessage(this.id)}nextTick(){self.postMessage(this.id)}endTick(){this.active=!1}},wb=class ok extends Ab{constructor(){super(...arguments),this.immediate=null,this.boundTick=this.tick.bind(this)}static isApplicable(){return!!globalThis.setImmediate}static createCallback(){let e=new ok;return e.add.bind(e)}isTickActive(){return this.immediate!==null}startTick(){this.immediate=setImmediate(this.boundTick)}nextTick(){this.immediate=setImmediate(this.boundTick)}endTick(){clearImmediate(this.immediate),this.immediate=null}};function ak(){if(wb.isApplicable())return wb.createCallback();if(Tb.isApplicable())return Tb.createCallback();if(Sb.isApplicable())return Sb.createCallback();throw new Error("No schedule helper fulfills requirements!")}var zq=ak()});var fk=m(wn=>{"use strict";var Cb=wn&&wn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wn,"__esModule",{value:!0});wn.DocumentManager=wn.PROCESSING_TIMEOUT=wn.ActiveDocument=wn.DocumentURIBuilder=void 0;var Kq=Cb(require("events")),lk=Fr(),Xq=Cb(vb()),xb=ck(),Gd=Ld(),dk=Cb(Ua()),Vd=class{constructor(e,n=null){this.workspaceFolderUri=n,this.rootPath=e}getFromWorkspaceFolder(e){if(this.workspaceFolderUri==null)throw new Error("Workspace folder is not defined!");return Gd.Utils.joinPath(this.workspaceFolderUri,e).toString()}getFromRootPath(e){return Gd.Utils.joinPath(this.rootPath,e).toString()}};wn.DocumentURIBuilder=Vd;var Eo=class{constructor(e){this.documentManager=e.documentManager,this.content=e.content,this.textDocument=e.textDocument,this.document=e.document,this.errors=e.errors}getDirectory(){return Gd.Utils.joinPath(Gd.URI.parse(this.textDocument.uri),"..")}getImportsAndIncludes(e=null){if(this.document==null)return[];let n=this.document,r=this.getDirectory(),i=this.documentManager.context,s=new Vd(r,e),o=a=>a.startsWith("/")?i.fs.findExistingPath(s.getFromWorkspaceFolder(a),s.getFromWorkspaceFolder(`${a}.src`)):i.fs.findExistingPath(s.getFromRootPath(a),s.getFromRootPath(`${a}.src`));return[...n.imports.filter(a=>a.path).map(a=>o(a.path)),...n.includes.filter(a=>a.path).map(a=>o(a.path))]}async getDependencies(){if(this.document==null)return[];if(this.dependencies)return this.dependencies;let e=await this.documentManager.context.fs.getWorkspaceFolderUris(),n=this.getImportsAndIncludes(e[0]),r=new Set([...n]);return this.dependencies=Array.from(r),this.dependencies}async getImports(){if(this.document==null)return[];let e=new Set,n=new Set([this.textDocument.uri]),r=async i=>{let s=await i.getDependencies();for(let o of s){if(n.has(o))continue;let a=await this.documentManager.open(o);n.add(o),a!==null&&(e.add(a),a.document!==null&&await r(a))}};return await r(this),Array.from(e)}};wn.ActiveDocument=Eo;wn.PROCESSING_TIMEOUT=100;var kb=class extends Kq.default{get context(){return this._context}setContext(e){return this._context=e,this}constructor(e=wn.PROCESSING_TIMEOUT){super(),this._context=null,this._timer=null,this.results=new Xq.default({ttl:1e3*60*20,ttlAutopurge:!0}),this.scheduledItems=new Map,this.tickRef=this.tick.bind(this),this.processingTimeout=e,(0,xb.schedule)(this.tickRef)}tick(){if(this.scheduledItems.size===0){this._timer=null;return}let e=Date.now(),n=Array.from(this.scheduledItems.values());for(let r=0;r<n.length;r++){let i=n[r];e-i.createdAt>this.processingTimeout&&(0,xb.schedule)(()=>this.refresh(i.document))}this._timer=setTimeout(this.tickRef,0)}refresh(e){let n=e.uri;if(!this.scheduledItems.has(n)&&this.results.has(n))return this.results.get(n);let r=this.create(e);return this.results.set(n,r),this.emit("parsed",e,r),this.scheduledItems.delete(n),r}create(e){let n=e.getText(),r=new lk.Parser(n,{unsafe:!0}),i=r.parseChunk();if(i.body?.length>0)return dk.default.analyze(e.uri,i),new Eo({documentManager:this,content:n,textDocument:e,document:i,errors:[...r.lexer.errors,...r.errors]});try{let o=new lk.Parser(e.getText()).parseChunk();return dk.default.analyze(e.uri,o),new Eo({documentManager:this,content:n,textDocument:e,document:o,errors:[]})}catch(s){return new Eo({documentManager:this,content:n,textDocument:e,document:null,errors:[s]})}}schedule(e){let n=e.uri,r=e.getText();return this.results.get(n)?.content===r?!1:(this.scheduledItems.set(n,{document:e,createdAt:Date.now()}),this._timer===null&&(this._timer=setTimeout(this.tickRef,0)),!0)}async open(e){try{let n=await this.context.fs.getTextDocument(e);return n==null?null:this.get(n)}catch{return null}}get(e){return this.results.get(e.uri)||this.refresh(e)}getLatest(e,n=5e3){return new Promise(r=>{(0,xb.schedule)(()=>{if(!this.scheduledItems.has(e.uri))return r(this.get(e));let i=()=>{this.removeListener("parsed",s),r(this.get(e))},s=a=>{a.uri===e.uri&&(this.removeListener("parsed",s),clearTimeout(o),r(this.get(e)))},o=setTimeout(i,n);this.addListener("parsed",s)})})}clear(e){this.results.delete(e.uri),this.emit("cleared",e)}};wn.DocumentManager=kb});var hk=m(Ao=>{"use strict";var Yq=Ao&&Ao.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ao,"__esModule",{value:!0});Ao.CoreContext=void 0;var Jq=Yq(require("events")),Ob=qs();function pk(t){return{formatter:t?.formatter??!0,autocomplete:t?.autocomplete??!0,hoverdocs:t?.hoverdocs??!0,diagnostic:t?.diagnostic??!0,transpiler:{beautify:{keepParentheses:t?.transpiler?.beautify?.keepParentheses??!0,indentation:t?.transpiler?.beautify?.indentation??Ob.IndentationType.Tab,indentationSpaces:t?.transpiler?.beautify?.indentationSpaces??2}}}}var Rb=class extends Jq.default{constructor(){super(),this._configuration=pk(),this._features={configuration:!1,workspaceFolder:!1}}get features(){return this._features}getConfiguration(){return this._configuration}async syncConfiguraton(){let e=await this.connection.workspace.getConfiguration(Ob.ConfigurationNamespace);this._configuration=pk(e)}configureCapabilties(e){this._features.configuration=!!(e.workspace&&e.workspace.configuration),this._features.workspaceFolder=!!(e.workspace&&e.workspace.workspaceFolders)}async onInitialize(e){this.configureCapabilties(e.capabilities);let n={capabilities:{completionProvider:{triggerCharacters:["."],resolveProvider:!0},hoverProvider:!0,colorProvider:!0,definitionProvider:!0,documentFormattingProvider:!0,signatureHelpProvider:{triggerCharacters:[",","("]},documentSymbolProvider:!0,workspaceSymbolProvider:!0,diagnosticProvider:{identifier:Ob.LanguageId,interFileDependencies:!1,workspaceDiagnostics:!1},textDocumentSync:2}};return this._features.workspaceFolder&&(n.capabilities.workspace={workspaceFolders:{supported:!0}}),this.emit("ready",this),n}async onInitialized(e){this._features.configuration&&(await this.syncConfiguraton(),this.connection.onDidChangeConfiguration(async()=>{let n=this._configuration;await this.syncConfiguraton(),this.emit("configuration-change",this,this._configuration,n)})),this.emit("loaded",this)}async listen(){this.fs.listen(this.connection),this.connection.onInitialize(this.onInitialize.bind(this)),this.connection.onInitialized(this.onInitialized.bind(this)),this.connection.listen()}};Ao.CoreContext=Rb});var zd=m(K=>{"use strict";var Qq=K&&K.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),Zq=K&&K.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ej=K&&K.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&Qq(e,t,n);return Zq(e,t),e},tj=K&&K.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(K,"__esModule",{value:!0});K.CoreContext=K.typeAnalyzer=K.lookupBase=K.lookupIdentifier=K.appendTooltipHeader=K.appendTooltipBody=K.formatTypes=K.formatDefaultValue=K.createTooltipHeader=K.createSignatureInfo=K.createHover=K.MarkdownString=K.LookupHelper=K.DocumentManager=K.ActiveDocument=K.ASTScraper=K.activateSymbol=K.activateSubscriptions=K.activateSignature=K.activateHover=K.activateFormatter=K.activateDiagnostic=K.activateDefinition=K.activateColor=K.activateAutocomplete=K.ConfigurationNamespace=K.LanguageId=K.IndentationType=void 0;var Db=qs();Object.defineProperty(K,"IndentationType",{enumerable:!0,get:function(){return Db.IndentationType}});Object.defineProperty(K,"LanguageId",{enumerable:!0,get:function(){return Db.LanguageId}});Object.defineProperty(K,"ConfigurationNamespace",{enumerable:!0,get:function(){return Db.ConfigurationNamespace}});var nj=sx();Object.defineProperty(K,"activateAutocomplete",{enumerable:!0,get:function(){return nj.activate}});var rj=mx();Object.defineProperty(K,"activateColor",{enumerable:!0,get:function(){return rj.activate}});var ij=bx();Object.defineProperty(K,"activateDefinition",{enumerable:!0,get:function(){return ij.activate}});var sj=_x();Object.defineProperty(K,"activateDiagnostic",{enumerable:!0,get:function(){return sj.activate}});var oj=$x();Object.defineProperty(K,"activateFormatter",{enumerable:!0,get:function(){return oj.activate}});var aj=Vx();Object.defineProperty(K,"activateHover",{enumerable:!0,get:function(){return aj.activate}});var uj=Kx();Object.defineProperty(K,"activateSignature",{enumerable:!0,get:function(){return uj.activate}});var cj=Yx();Object.defineProperty(K,"activateSubscriptions",{enumerable:!0,get:function(){return cj.activate}});var lj=Qx();Object.defineProperty(K,"activateSymbol",{enumerable:!0,get:function(){return lj.activate}});K.ASTScraper=ej(ky());var mk=fk();Object.defineProperty(K,"ActiveDocument",{enumerable:!0,get:function(){return mk.ActiveDocument}});Object.defineProperty(K,"DocumentManager",{enumerable:!0,get:function(){return mk.DocumentManager}});var dj=fo();Object.defineProperty(K,"LookupHelper",{enumerable:!0,get:function(){return dj.LookupHelper}});var fj=qd();Object.defineProperty(K,"MarkdownString",{enumerable:!0,get:function(){return fj.MarkdownString}});var cs=jd();Object.defineProperty(K,"createHover",{enumerable:!0,get:function(){return cs.createHover}});Object.defineProperty(K,"createSignatureInfo",{enumerable:!0,get:function(){return cs.createSignatureInfo}});Object.defineProperty(K,"createTooltipHeader",{enumerable:!0,get:function(){return cs.createTooltipHeader}});Object.defineProperty(K,"formatDefaultValue",{enumerable:!0,get:function(){return cs.formatDefaultValue}});Object.defineProperty(K,"formatTypes",{enumerable:!0,get:function(){return cs.formatTypes}});Object.defineProperty(K,"appendTooltipBody",{enumerable:!0,get:function(){return cs.appendTooltipBody}});Object.defineProperty(K,"appendTooltipHeader",{enumerable:!0,get:function(){return cs.appendTooltipHeader}});var Ib=Ua();Object.defineProperty(K,"lookupIdentifier",{enumerable:!0,get:function(){return Ib.lookupIdentifier}});Object.defineProperty(K,"lookupBase",{enumerable:!0,get:function(){return Ib.lookupBase}});Object.defineProperty(K,"typeAnalyzer",{enumerable:!0,get:function(){return tj(Ib).default}});var pj=hk();Object.defineProperty(K,"CoreContext",{enumerable:!0,get:function(){return pj.CoreContext}})});var _k={};Ik(_k,{TextDocument:()=>Pb});function Mb(t,e){if(t.length<=1)return t;let n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);Mb(r,e),Mb(i,e);let s=0,o=0,a=0;for(;s<r.length&&o<i.length;)e(r[s],i[o])<=0?t[a++]=r[s++]:t[a++]=i[o++];for(;s<r.length;)t[a++]=r[s++];for(;o<i.length;)t[a++]=i[o++];return t}function gk(t,e,n=0){let r=e?[n]:[];for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);yk(s)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,r.push(n+i+1))}return r}function yk(t){return t===13||t===10}function bk(t){let e=t.start,n=t.end;return e.line>n.line||e.line===n.line&&e.character>n.character?{start:n,end:e}:t}function hj(t){let e=bk(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var Kd,Pb,vk=Dk(()=>{"use strict";Kd=class t{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){for(let r of e)if(t.isIncremental(r)){let i=bk(r.range),s=this.offsetAt(i.start),o=this.offsetAt(i.end);this._content=this._content.substring(0,s)+r.text+this._content.substring(o,this._content.length);let a=Math.max(i.start.line,0),u=Math.max(i.end.line,0),c=this._lineOffsets,l=gk(r.text,!1,s);if(u-a===l.length)for(let p=0,y=l.length;p<y;p++)c[p+a+1]=l[p];else l.length<1e4?c.splice(a+1,u-a,...l):this._lineOffsets=c=c.slice(0,a+1).concat(l,c.slice(u+1));let d=r.text.length-(o-s);if(d!==0)for(let p=a+1+l.length,y=c.length;p<y;p++)c[p]=c[p]+d}else if(t.isFull(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=gk(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return{line:0,character:e};for(;r<i;){let o=Math.floor((r+i)/2);n[o]>e?i=o:r=o+1}let s=r-1;return e=this.ensureBeforeEOL(e,n[s]),{line:s,character:e-n[s]}}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line];if(e.character<=0)return r;let i=e.line+1<n.length?n[e.line+1]:this._content.length,s=Math.min(r+e.character,i);return this.ensureBeforeEOL(s,r)}ensureBeforeEOL(e,n){for(;e>n&&yk(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}};(function(t){function e(i,s,o,a){return new Kd(i,s,o,a)}t.create=e;function n(i,s,o){if(i instanceof Kd)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=n;function r(i,s){let o=i.getText(),a=Mb(s.map(hj),(l,d)=>{let p=l.range.start.line-d.range.start.line;return p===0?l.range.start.character-d.range.start.character:p}),u=0,c=[];for(let l of a){let d=i.offsetAt(l.range.start);if(d<u)throw new Error("Overlapping edit");d>u&&c.push(o.substring(u,d)),l.newText.length&&c.push(l.newText),u=i.offsetAt(l.range.end)}return c.push(o.substr(u)),c.join("")}t.applyEdits=r})(Pb||(Pb={}))});var Tk=m(xo=>{"use strict";var qb=xo&&xo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xo,"__esModule",{value:!0});xo.FileSystem=void 0;var mj=Yp(),Sk=(vk(),Mk(_k)),gj=qb(require("events")),Lb=Ld(),yj=qb(require("fs")),bj=zd(),_j=qb(vb()),Nb=class extends gj.default{constructor(e){super(),this._context=e,this._textDocumentManager=new mj.TextDocuments(Sk.TextDocument),this._tempTextDocumentCache=new _j.default({ttl:1e3,max:100})}async getWorkspaceFolderUris(){if(!this._context.features.workspaceFolder)return[];let e=await this._workspace.getWorkspaceFolders();return e==null?[]:Array.from(new Set(e.map(n=>n.uri))).map(n=>Lb.URI.parse(n))}findExistingPath(...e){if(e.length===0)return"";for(let n=0;n<e.length;n++)if(this.getTextDocument(e[n])!=null)return e[n];return e[0]}getAllTextDocuments(){return this._textDocumentManager.all()}async fetchTextDocument(e){let n=Lb.URI.parse(e),r=this._tempTextDocumentCache.get(e);if(r!=null)return r;let i=null;try{let s=await yj.default.promises.readFile(n.fsPath,{encoding:"utf-8"});i=Sk.TextDocument.create(e,bj.LanguageId,0,s)}catch{}return this._tempTextDocumentCache.set(e,i),i}async getTextDocument(e){let n=this._textDocumentManager.get(e);return n||(Lb.URI.parse(e).scheme=="file"?await this.fetchTextDocument(e):null)}async readFile(e){return(await this.getTextDocument(e)).getText()}listen(e){this._workspace=e.workspace,this._textDocumentManager.listen(e),this._textDocumentManager.onDidOpen(n=>{this.emit("text-document-open",n.document)}),this._textDocumentManager.onDidChangeContent(n=>{this.emit("text-document-change",n.document)}),this._textDocumentManager.onDidClose(n=>{this.emit("text-document-close",n.document)})}};xo.FileSystem=Nb});var Ak=m(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.NodeContext=void 0;var wk=Yp(),Ek=zd(),vj=Tk(),jb=class extends Ek.CoreContext{constructor(){super(),this.documentManager=new Ek.DocumentManager().setContext(this),this.connection=(0,wk.createConnection)(wk.ProposedFeatures.all),this.fs=new vj.FileSystem(this)}};Xd.NodeContext=jb});Object.defineProperty(exports,"__esModule",{value:!0});var Sj=Ak(),Ur=zd(),xk=new Sj.NodeContext;xk.on("ready",t=>{(0,Ur.activateAutocomplete)(t),(0,Ur.activateColor)(t),(0,Ur.activateDefinition)(t),(0,Ur.activateDiagnostic)(t),(0,Ur.activateFormatter)(t),(0,Ur.activateHover)(t),(0,Ur.activateSignature)(t),(0,Ur.activateSubscriptions)(t),(0,Ur.activateSymbol)(t)});xk.listen();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miniscript-languageserver",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Language server for MiniScript",
5
5
  "main": "./index.js",
6
6
  "scripts": {
@@ -71,6 +71,6 @@
71
71
  "miniscript-meta": "~1.2.3",
72
72
  "greybel-transpiler": "~3.0.9",
73
73
  "miniscript-type-analyzer": "~0.8.2",
74
- "miniscript-languageserver-core": "^1.0.3"
74
+ "miniscript-languageserver-core": "^1.0.4"
75
75
  }
76
76
  }