miniscript-languageserver 1.1.4 → 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 +1 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -223,4 +223,4 @@ end if`},IfClause:(n,r)=>{let i=t.make(n.condition),s=[],o;for(o of n.body){let
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.4",
3
+ "version": "1.1.5",
4
4
  "description": "Language server for MiniScript",
5
5
  "main": "./index.js",
6
6
  "scripts": {