miniscript-languageserver 1.4.6 → 1.4.7

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
@@ -104,13 +104,13 @@ ${e}`;for(let a=0;a<this.details.length;++a){let u=a+1;o=`${o}
104
104
 
105
105
  `),n=t.tags.filter(s=>s.tag===Ia.Param).map(s=>({label:s.name,types:s.type.split("|"),opt:s.optional})),r=t.tags.find(s=>s.tag===Ia.Return)??{type:"any"},i=t.tags.filter(s=>s.tag===Ia.Example).map(L0);return{descriptions:e,args:n,returns:r,examples:i}}function aM(t){let e=(0,sM.parse)(`/**
106
106
  ${t.getDescription()}
107
- */`),[n]=e;if(n.tags.length>0){let{descriptions:r,args:i,returns:s,examples:o}=oM(n);return M0.SignatureDefinitionFunction.parse({type:M0.SignatureDefinitionBaseType.Function,arguments:t.getArguments().map((a,u)=>{let c=a.getLabel(),l=a.getTypes().map(p=>p.toString()),d=a.isOptional();return{types:l,opt:d,...i[u],label:c}}),returns:s.type.split("|"),description:r,example:o})}return t}ts.enrichWithMetaInformation=aM});var Qm=g($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});$l.createResolveChain=void 0;var sn=Ne();function Ti(t,e,n=null,r=!1){switch(t.type){case sn.ASTType.ParenthesisExpression:{Ti(t.expression,e,n);return}case sn.ASTType.MemberExpression:{let i=t;Ti(i.base,e),e.push({ref:t,getter:i.identifier,unary:n,isInCallExpression:r});return}case sn.ASTType.IndexExpression:{let i=t;Ti(i.base,e),e.push({ref:t,getter:i.index,unary:n,isInCallExpression:r});return}case sn.ASTType.CallStatement:{Ti(t.expression,e,n,!0);return}case sn.ASTType.CallExpression:{Ti(t.base,e,n,!0);return}case sn.ASTType.NegationExpression:case sn.ASTType.BinaryNegatedExpression:case sn.ASTType.UnaryExpression:{let i=t;Ti(i.argument,e,i);return}case sn.ASTType.Identifier:{e.push({ref:t,getter:t,unary:n,isInCallExpression:r});return}case sn.ASTType.NumericLiteral:case sn.ASTType.StringLiteral:case sn.ASTType.NilLiteral:case sn.ASTType.MapConstructorExpression:case sn.ASTType.ListConstructorExpression:{e.push({ref:t,value:t,unary:n,isInCallExpression:r});return}case sn.ASTType.SliceExpression:Ti(t.base,e),e.push({ref:t,unary:n,isInCallExpression:r})}}function uM(t){let e=[];return Ti(t,e),e}$l.createResolveChain=uM});var q0=g(Zm=>{function N0(t,e){return t>e?1:-1}Zm.hash=function t(e,n){var r=5381;if(typeof e=="object"&&e!==null&&(e.toString===Object.prototype.toString||e.toString===Array.prototype.toString)){n||(n=new WeakSet);for(var i=Object.keys(e).sort(N0),s=0;s<i.length;s++){var o=i[s],a=e[o];if(r=33*r^t(o,n),typeof a=="object"&&a!==null&&(e.toString===Object.prototype.toString||e.toString===Array.prototype.toString)){if(n.has(a))continue;n.add(a)}r=33*r^t(a,n)}return 33*r^t(e.constructor,n)}var u=typeof e;try{e instanceof Date?u+=e.getTime():u+=String(e)}catch{u+=String(Object.assign({},e))}for(var c=0;c<u.length;c++)r=33*r^u.charCodeAt(c);return r},Zm.sortNumbers=N0});var ny=g(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.ObjectSet=so.ObjectSetIterator=void 0;var ey=q0(),Bl=class{constructor(e){let n=this;n.value=e,n.index=0}next(){let e=this;return e.index>=e.value.length?{value:null,done:!0}:{value:e.value[e.index++],done:!1}}};so.ObjectSetIterator=Bl;var ty=class{constructor(e){let r=(e?Array.from(e):[]).map(i=>[(0,ey.hash)(i),i]);this._map=new Map(r),this._first=null,this._last=null,r.length>0&&(this._first=r[0][0],this._last=r[r.length-1][0])}[Symbol.iterator](){return new Bl(Array.from(this._map.values()))}first(){return this._first!=null?this._map.get(this._first)??null:null}last(){return this._last!=null?this._map.get(this._last)??null:null}toArray(){return Array.from(this._map.values())}add(e){let n=(0,ey.hash)(e);return this._map.set(n,e),this._first??(this._first=n),this._last=n,this}delete(e){let n=(0,ey.hash)(e);return this._map.delete(n)}extend(e){for(let[n,r]of e._map)this._map.set(n,r),this._first??(this._first=n),this._last=n;return this}toJSON(){return Array.from(this._map.values())}clear(){this._map.clear()}};so.ObjectSet=ty});var ry=g(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});Ul.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION=void 0;Ul.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION="This is a custom method. You can add a description for this method by adding a comment above or after the function.\n```\nmyFunction = function(a, b, c) // This function does xyz\n```\nor\n```\n/*\n This function does xyz\n*/\nmyFunction = function(a, b, c)\n```"});var ns=g(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.CompletionItemKind=void 0;var cM;(function(t){t.Variable="var",t.Property="var",t.Function="function",t.Literal="literal",t.Constant="constant",t.ListConstructor="list",t.MapConstructor="map",t.Expression="expr",t.Unknown="unknown"})(cM=Ma.CompletionItemKind||(Ma.CompletionItemKind={}))});var iy=g(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.isResolveChainItemWithValue=kr.isResolveChainItemWithIdentifier=kr.isResolveChainItemWithMember=kr.isResolveChainItemWithIndex=void 0;var Si=Ne(),lM=t=>t!=null&&t.ref.type===Si.ASTType.IndexExpression;kr.isResolveChainItemWithIndex=lM;var dM=t=>t!=null&&t.ref.type===Si.ASTType.MemberExpression;kr.isResolveChainItemWithMember=dM;var fM=t=>t!=null&&t.ref.type===Si.ASTType.Identifier;kr.isResolveChainItemWithIdentifier=fM;var pM=t=>t!=null&&(t.ref.type===Si.ASTType.NumericLiteral||t.ref.type===Si.ASTType.StringLiteral||t.ref.type===Si.ASTType.NilLiteral||t.ref.type===Si.ASTType.MapConstructorExpression||t.ref.type===Si.ASTType.ListConstructorExpression);kr.isResolveChainItemWithValue=pM});var sy=g(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});Hl.isSignatureDefinitionFunction=void 0;var hM=Un(),gM=t=>t.getType().type===hM.SignatureDefinitionBaseType.Function;Hl.isSignatureDefinitionFunction=gM});var j0=g(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});Wl.aggregateEntity=void 0;var mM=t=>{let e=[],n=t;for(;n!=null;)e.push(n),n=n.getIsa();return e};Wl.aggregateEntity=mM});var La=g(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});Gl.injectIdentifers=void 0;var yM=j0(),bM=(t,e)=>{let n=(0,yM.aggregateEntity)(e);for(let r of n)for(let[i,s]of r.values)if(i.startsWith("i:")){let o=i.slice(2);if(t.has(o))continue;t.set(o,{kind:s.kind,line:s.line})}};Gl.injectIdentifers=bM});var Kl=g(Vl=>{"use strict";Object.defineProperty(Vl,"__esModule",{value:!0});Vl.isEligibleForProperties=void 0;var oy=Un(),vM=t=>t.types.has(oy.SignatureDefinitionBaseType.Map)||t.types.has(oy.SignatureDefinitionBaseType.List)||t.types.has(oy.SignatureDefinitionBaseType.Any);Vl.isEligibleForProperties=vM});var Xl=g(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});zl.lookupProperty=void 0;var _M=Kl(),TM=(t,e)=>{let n=t;for(;(0,_M.isEligibleForProperties)(n);){let r=n.values.get(`i:${e}`);if(r!=null)return r;let i=n.getIsa();if(i==null)break;n=i}return null};zl.lookupProperty=TM});var uo=g(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.Entity=ki.resolveEntity=void 0;var oo=Un(),ao=ns(),SM=sy(),kM=La(),Yl=Kl(),F0=Xl(),$0=ny(),xM=(t,e,n=!1)=>{if(e.isCallable()&&!n){let r=e.getReturnEntity();if(r!==null)return r;let i=e.getCallableReturnTypes();return i?new rs({kind:ao.CompletionItemKind.Variable,container:t,label:e.label,context:e.context}).addType(...i):new rs({kind:ao.CompletionItemKind.Variable,container:t,label:e.label,context:e.context}).addType(oo.SignatureDefinitionBaseType.Any)}return e};ki.resolveEntity=xM;var ay={hasProperty(t,e,n){return!!(0,F0.lookupProperty)(t,n)||!t.isAPI()&&!!e.getDefinition(Array.from(t.types),n,!0)},resolveProperty(t,e,n,r=!1){let i=(0,F0.lookupProperty)(t,n)??null;return i==null?t.isAPI()?null:e.getDefinition(Array.from(t.types),n,r):(0,ki.resolveEntity)(e,i,r)},setProperty(t,e,n,r){if(!(0,Yl.isEligibleForProperties)(t))return!1;let i=`i:${n}`,s=t.values.get(i);return s?s.extend(r):t.values.set(i,r.copy({container:e,label:n,context:t})),!0}},uy={hasProperty(t,e,n){if(!(0,Yl.isEligibleForProperties)(t))return!1;for(let r of n.types)if(t.values.has(`t:${r}`))return!0;return!1},resolveProperty(t,e,n,r=!1){if(!(0,Yl.isEligibleForProperties)(t))return new rs({kind:ao.CompletionItemKind.Variable,container:e,label:n.label,context:t}).addType(oo.SignatureDefinitionBaseType.Any);let i=new rs({kind:ao.CompletionItemKind.Variable,container:e,label:n.label,context:t});for(let s of n.types){let o=t.values.get(`t:${s}`);o&&i.extend(o)}return i.types.size===0&&i.addType(oo.SignatureDefinitionBaseType.Any),(0,ki.resolveEntity)(e,i,r)},setProperty(t,e,n,r){if(!(0,Yl.isEligibleForProperties)(t))return!1;for(let i of n.types){let s=`t:${i}`,o=t.values.get(s);o?o.extend(r):t.values.set(s,r.copy({container:e,label:i,context:t}))}return!0}},rs=class t{get kind(){return this._kind}get line(){return this._line}get signatureDefinitions(){return this._signatureDefinitions}get context(){return this._context}get label(){return this._label}get types(){return this._types}get values(){return this._values}constructor(e){this._isAPI=e.isAPI??!1,this._isFromSignature=e.isFromSignature??!1,this._kind=e.kind,this._line=e.line??-1,this._label=e.label??"anonymous",this._signatureDefinitions=e.signatureDefinitions??new $0.ObjectSet,this._types=e.types??new Set,this._values=e.values??new Map,this._context=e.context??null,this._container=e.container,this._returnEntity=e.returnEntity??null}isFromSignature(){return this._isFromSignature}hasContext(){return this._context!=null&&!this._context.isAPI}getIsa(){return this._values.get("i:__isa")??null}hasIsa(){return this._values.has("i:__isa")}isAPI(){return this._isAPI}isCallable(){return this._types.has(oo.SignatureDefinitionBaseType.Function)}getCallableReturnTypes(){if(!this.isCallable())return null;let e=Array.from(this._signatureDefinitions).filter(n=>(0,SM.isSignatureDefinitionFunction)(n));return e.length===0?null:e.flatMap(n=>n.getReturns()).map(n=>n.type)}addSignatureType(e){return this._signatureDefinitions.add(e),this.addType(e.getType().type),this}setReturnEntity(e){return this._returnEntity=e,this}getReturnEntity(){return this._returnEntity}setKind(e){return this._kind=e,this}setLine(e){return this._line=e,this}setLabel(e){return this._label=e,this}setContext(e){return this._context=e,this}addType(...e){for(let n of e)this._types.add(n);return this}hasProperty(e){switch(typeof e){case"object":return uy.hasProperty(this,this._container,e);default:return ay.hasProperty(this,this._container,e)}}resolveProperty(e,n=!1){switch(typeof e){case"object":return uy.resolveProperty(this,this._container,e,n);default:return ay.resolveProperty(this,this._container,e,n)}}setProperty(e,n){switch(typeof e){case"object":return uy.setProperty(this,this._container,e,n);default:return ay.setProperty(this,this._container,e,n)}}extend(e){if(e===this)return this;this._isFromSignature=!1,this._signatureDefinitions.extend(e.signatureDefinitions),this.addType(...e.types);for(let[n,r]of e.values){let i=this.values.get(n);i==null?this.values.set(n,r.copy({container:this._container,context:this})):i.extend(r)}return this}insertSignature(e){let n=Object.keys(e.getDefinitions());this.addType(oo.SignatureDefinitionBaseType.Map);for(let r=0;r<n.length;r++){let i=n[r],s=e.getDefinition(i),o=new t({label:i,kind:s.getType().type===oo.SignatureDefinitionBaseType.Function?ao.CompletionItemKind.Function:ao.CompletionItemKind.Property,container:this._container,isFromSignature:!0});o.addSignatureType(s),this.setProperty(i,o)}return this}getAllIdentifier(){let e=new Map;for(let n of this._types){let r=this._container.getAllIdentifier(n);for(let i of r)e.set(...i)}return(0,kM.injectIdentifers)(e,this),e}toJSONInternal(e=new WeakMap){if(e.has(this))return e.get(this);let n={};return e.set(this,n),n.kind=this.kind,n.signatureDefinitions=this._signatureDefinitions.toJSON(),n.types=Array.from(this._types),n.values=Array.from(this._values).reduce((r,[i,s])=>(r[i]=s?.toJSONInternal(e),r),{}),n}toJSON(){return this.toJSONInternal()}copy(e={}){let n=new t({kind:e.kind??this._kind,line:e.line??this._line,isFromSignature:e.isFromSignature??this._isFromSignature,isAPI:e.isAPI??this._isAPI,container:e.container??this._container,label:e.label??this._label,context:e.context??this._context,signatureDefinitions:new $0.ObjectSet(Array.from(this._signatureDefinitions,r=>r.copy())),types:new Set(this._types),returnEntity:this._returnEntity,values:e.values??this.values});return e.deepCopy&&(n._values=new Map(Array.from(this._values,([r,i])=>[r,i.copy({deepCopy:e.deepCopy,container:e.container,line:e.line,context:n,values:i.values})]))),n}};ki.Entity=rs});var dy=g(Zl=>{"use strict";Object.defineProperty(Zl,"__esModule",{value:!0});Zl.Scope=void 0;var Jl=Un(),is=ns(),cy=La(),Ql=uo(),ly=class t{get signatureDefinitions(){return null}get kind(){return is.CompletionItemKind.Constant}get line(){return this._locals.line}get label(){return this._locals.label}get context(){return this._locals.context}get types(){return new Set(Jl.SignatureDefinitionBaseType.Map)}get values(){return this._locals.values}get globals(){return this._globals}get outer(){return this._parent?.locals??null}get locals(){return this._locals}constructor(e){this._container=e.container,this._parent=e.parent??null,this._globals=e.globals,this._locals=e.locals??new Ql.Entity({kind:is.CompletionItemKind.Constant,container:this._container,label:"locals"}).addType(Jl.SignatureDefinitionBaseType.Map)}getIsa(){return null}hasIsa(){return!1}setCustomType(e,n){this._container.setCustomType(e,n)}addSignatureType(){throw new Error("Cannot add signature type to scope!")}hasProperty(e){return this._locals.hasProperty(e)}resolveProperty(e,n){return this._locals.resolveProperty(e,n)}resolveNamespace(e,n=!1){if(typeof e!="string")throw new Error("Invalid property type for scope!");if(e==="locals")return this._locals;if(e==="outer")return this._parent?.locals??this._globals;if(e==="globals")return this._globals;if(this._locals.values.has(`i:${e}`)){let r=this._locals.values.get(`i:${e}`);return(0,Ql.resolveEntity)(this._container,r,n)}else if(this._parent?.locals.values.has(`i:${e}`)){let r=this._parent.locals.values.get(`i:${e}`);return(0,Ql.resolveEntity)(this._container,r,n)}else if(this._globals.values.has(`i:${e}`)){let r=this._globals.values.get(`i:${e}`);return(0,Ql.resolveEntity)(this._container,r,n)}return this._container.getGeneralDefinition(e,n)}setProperty(e,n){return this._locals.setProperty(e,n)}extend(e){return this._locals.extend(e),this}addType(){throw new Error("Scope cannot get type assigned!")}setReturnEntity(){throw new Error("Scope cannot set return entity!")}getReturnEntity(){throw new Error("Scope cannot get return entity!")}setKind(e){return this._locals.setKind(e),this}setLine(e){return this._locals.setLine(e),this}setLabel(e){return this._locals.setLabel(e),this}setContext(e){return this._locals.setContext(e),this}insertSignature(e){return this._locals.insertSignature(e),this}isAPI(){return!1}hasContext(){return!1}isFromSignature(){return!1}isCallable(){return!1}getCallableReturnTypes(){return null}getAllIdentifier(){let e=new Map([["globals",{kind:is.CompletionItemKind.Constant,line:-1}],["locals",{kind:is.CompletionItemKind.Constant,line:-1}],["outer",{kind:is.CompletionItemKind.Constant,line:-1}],...this._container.getAllIdentifier(Jl.SignatureDefinitionBaseType.General)]);return this._locals!==this._globals&&(0,cy.injectIdentifers)(e,this._globals),this._parent&&(0,cy.injectIdentifers)(e,this._parent.locals),(0,cy.injectIdentifers)(e,this._locals),this.isSelfAvailable()&&e.set("self",{kind:is.CompletionItemKind.Constant,line:-1}),this.isSuperAvailable()&&e.set("super",{kind:is.CompletionItemKind.Constant,line:-1}),e}isSelfAvailable(){return this._locals.context!=null&&this._locals.context.types.has(Jl.SignatureDefinitionBaseType.Map)}isSuperAvailable(){return this.isSelfAvailable()&&this._locals.context.hasProperty("__isa")}toJSON(){return this._locals.toJSON()}copy(e={}){return new t({container:e.container??this._container,parent:this._parent.copy({container:e.container,line:-1,deepCopy:!0}),globals:this._globals.copy({container:e.container,line:-1,deepCopy:!0}),locals:this._locals.copy({...e,deepCopy:!0})})}};Zl.Scope=ly});var co=g(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.GreybelKeyword=void 0;var wM;(function(t){t.Envar="#envar",t.Import="#import",t.Include="#include",t.ImportWithComment="//import",t.IncludeWithComment="//include",t.Debugger="debugger",t.Line="#line",t.File="#filename",t.Inject="#inject"})(wM=Na.GreybelKeyword||(Na.GreybelKeyword={}))});var hy=g(py=>{"use strict";Object.defineProperty(py,"__esModule",{value:!0});var ss=Ne(),EM=co(),fy=class extends ss.LexerValidator{constructor(){super(...arguments),this.isKeyword=Set.prototype.has.bind(new Set([...Object.values(ss.Keyword),...Object.values(EM.GreybelKeyword)]))}isIdentifierStart(e){return super.isIdentifierStart(e)||e===ss.CharacterCode.HASH}isMultilineComment(e,n){return ss.CharacterCode.SLASH===e&&ss.CharacterCode.ASTERISK===n}isMultilineCommentEnd(e,n){return ss.CharacterCode.ASTERISK===e&&ss.CharacterCode.SLASH===n}isComment(e,n){return super.isComment(e,n)||this.isMultilineComment(e,n)}};py.default=fy});var gy=g(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});qa.CharacterCode=void 0;var AM;(function(t){t[t.VERTICAL_LINE=124]="VERTICAL_LINE",t[t.AMPERSAND=38]="AMPERSAND"})(AM=qa.CharacterCode||(qa.CharacterCode={}))});var lo=g(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.Operator=void 0;var OM;(function(t){t.BitwiseAnd="&",t.BitwiseOr="|",t.LeftShift="<<",t.RightShift=">>",t.UnsignedRightShift=">>>"})(OM=ja.Operator||(ja.Operator={}))});var yy=g(Fa=>{"use strict";var CM=Fa&&Fa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fa,"__esModule",{value:!0});var nr=Ne(),RM=CM(hy()),B0=gy(),U0=co(),my=lo();function H0(t){let e=this.content[this.index];return this.index+=e.length,this.createPunctuator(e,t)}var ed=class t extends nr.Lexer{constructor(e,n={}){n.validator=n.validator||new RM.default,super(e,n)}scan(e,n){let r=t.greybelScanHandlers[e];return r?r.call(this,n)||super.scan(e,n):super.scan(e,n)}scanMultilineComment(e){let n=this,r=n.line,i=n.lineStart,s=n.index,o=n.offset,a=n.offset,u=!1;for(;n.index<n.length;){let d=n.codeAt();if(n.validator.isEndOfLine(d))n.validator.isWinNewline(d,n.codeAt(1))&&n.index++,n.line++,a=n.index+1;else if(n.validator.isMultilineCommentEnd(n.codeAt(),n.codeAt(1))){u=!0;break}n.index++}if(!u)return n.raise("Unexpected end of file in multiline comment.",new nr.ASTRange(new nr.ASTPosition(r,s-o+1),new nr.ASTPosition(n.line,n.index-a+3)));let c=n.content.slice(s+2,n.index);n.index+=2;let l=new nr.Token({type:nr.TokenType.Comment,value:c,line:r,lineStart:i,range:[n.tokenStart,n.index],offsetRange:[o,a],afterSpace:e,lastLine:n.line,lastLineStart:n.lineStart});return n.offset=a,n.snapshot.enqueue(l),l}scanComment(e){let n=this,r=n.validator;return n.content.startsWith(U0.GreybelKeyword.ImportWithComment,n.index)||n.content.startsWith(U0.GreybelKeyword.IncludeWithComment,n.index)?(n.index++,n.scanIdentifierOrKeyword(e)):r.isMultilineComment(n.codeAt(),n.codeAt(1))?n.scanMultilineComment(e):super.scanComment(e)}};Fa.default=ed;ed.greybelScanHandlers={[nr.CharacterCode.ARROW_LEFT]:function(e){if(nr.CharacterCode.ARROW_LEFT===this.codeAt(1))return this.scanPunctuator(my.Operator.LeftShift,e)},[nr.CharacterCode.ARROW_RIGHT]:function(e){if(nr.CharacterCode.ARROW_RIGHT===this.codeAt(1))return nr.CharacterCode.ARROW_RIGHT===this.codeAt(2)?this.scanPunctuator(my.Operator.UnsignedRightShift,e):this.scanPunctuator(my.Operator.RightShift,e)},[B0.CharacterCode.AMPERSAND]:H0,[B0.CharacterCode.VERTICAL_LINE]:H0}});var td=g($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.ASTType=void 0;var DM;(function(t){t.FeatureImportExpression="FeatureImportExpression",t.FeatureIncludeExpression="FeatureIncludeExpression",t.FeatureEnvarExpression="FeatureEnvarExpression",t.FeatureInjectExpression="FeatureInjectExpression",t.FeatureDebuggerExpression="FeatureDebuggerExpression",t.FeatureLineExpression="FeatureLineExpression",t.FeatureFileExpression="FeatureFileExpression"})(DM=$a.ASTType||($a.ASTType={}))});var vy=g(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.ASTChunkAdvanced=void 0;var PM=Ne(),by=class t extends PM.ASTChunk{constructor(e){super(e),this.imports=e.imports||[],this.includes=e.includes||[],this.injects=e.injects||[]}clone(){return new t({literals:this.literals.map(e=>e.clone()),scopes:this.scopes.map(e=>e.clone()),imports:this.imports.map(e=>e.clone()),includes:this.includes.map(e=>e.clone()),injects:this.injects.map(e=>e.clone()),lines:this.lines,start:this.start,end:this.end,range:this.range,scope:this.scope})}};nd.ASTChunkAdvanced=by});var wy=g(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.ASTFeatureFileExpression=Hn.ASTFeatureInjectExpression=Hn.ASTFeatureEnvarExpression=Hn.ASTFeatureIncludeExpression=Hn.ASTFeatureImportExpression=void 0;var Ba=Ne(),Ua=td(),_y=class t extends Ba.ASTBase{constructor(e){super(Ua.ASTType.FeatureImportExpression,e),this.name=e.name,this.path=e.path,this.chunk=e.chunk,this.namespace=e.namespace}toString(){return`FeatureImportExpression[${this.start}-${this.end}][name = ${this.name}, path = ${this.path}]`}clone(){return new t({name:this.name.clone(),path:this.path,chunk:this.chunk.clone(),namespace:this.namespace,start:this.start,end:this.end,range:this.range,scope:this.scope})}};Hn.ASTFeatureImportExpression=_y;var Ty=class t extends Ba.ASTBase{constructor(e){super(Ua.ASTType.FeatureIncludeExpression,e),this.path=e.path,this.chunk=e.chunk,this.namespace=e.namespace}toString(){return`FeatureIncludeExpression[${this.start}-${this.end}][path = ${this.path}]`}clone(){return new t({path:this.path,chunk:this.chunk.clone(),namespace:this.namespace,start:this.start,end:this.end,range:this.range,scope:this.scope})}};Hn.ASTFeatureIncludeExpression=Ty;var Sy=class t extends Ba.ASTBase{constructor(e){super(Ua.ASTType.FeatureEnvarExpression,e),this.name=e.name}toString(){return`FeatureEnvarExpression[${this.start}-${this.end}][name = ${this.name}]`}clone(){return new t({name:this.name,start:this.start,end:this.end,range:this.range,scope:this.scope})}};Hn.ASTFeatureEnvarExpression=Sy;var ky=class t extends Ba.ASTBase{constructor(e){super(Ua.ASTType.FeatureInjectExpression,e),this.path=e.path}toString(){return`FeatureInjectExpression[${this.start}-${this.end}][path = ${this.path}]`}clone(){return new t({path:this.path,start:this.start,end:this.end,range:this.range,scope:this.scope})}};Hn.ASTFeatureInjectExpression=ky;var xy=class t extends Ba.ASTBase{constructor(e){super(Ua.ASTType.FeatureFileExpression,e),this.filename=e.filename}toString(){return`FeatureFileExpression[${this.start}-${this.end}][path = ${this.filename}]`}clone(){return new t({filename:this.filename,start:this.start,end:this.end,range:this.range,scope:this.scope})}};Hn.ASTFeatureFileExpression=xy});var Oy=g(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.ASTFeatureInjectExpression=Mt.ASTFeatureIncludeExpression=Mt.ASTFeatureImportExpression=Mt.ASTFeatureFileExpression=Mt.ASTFeatureEnvarExpression=Mt.ASTChunkAdvanced=Mt.ASTType=Mt.ASTProvider=void 0;var Ey=Ne(),W0=td(),IM=vy(),Ha=wy(),Ay=class extends Ey.ASTProvider{featureImportExpression(e){return new Ha.ASTFeatureImportExpression(e)}featureIncludeExpression(e){return new Ha.ASTFeatureIncludeExpression(e)}featureEnvarExpression(e){return new Ha.ASTFeatureEnvarExpression(e)}featureInjectExpression(e){return new Ha.ASTFeatureInjectExpression(e)}featureDebuggerExpression(e){return new Ey.ASTBase(W0.ASTType.FeatureDebuggerExpression,e)}featureLineExpression(e){return new Ey.ASTBase(W0.ASTType.FeatureLineExpression,e)}featureFileExpression(e){return new Ha.ASTFeatureFileExpression(e)}chunkAdvanced(e){return new IM.ASTChunkAdvanced(e)}};Mt.ASTProvider=Ay;var MM=td();Object.defineProperty(Mt,"ASTType",{enumerable:!0,get:function(){return MM.ASTType}});var LM=vy();Object.defineProperty(Mt,"ASTChunkAdvanced",{enumerable:!0,get:function(){return LM.ASTChunkAdvanced}});var Wa=wy();Object.defineProperty(Mt,"ASTFeatureEnvarExpression",{enumerable:!0,get:function(){return Wa.ASTFeatureEnvarExpression}});Object.defineProperty(Mt,"ASTFeatureFileExpression",{enumerable:!0,get:function(){return Wa.ASTFeatureFileExpression}});Object.defineProperty(Mt,"ASTFeatureImportExpression",{enumerable:!0,get:function(){return Wa.ASTFeatureImportExpression}});Object.defineProperty(Mt,"ASTFeatureIncludeExpression",{enumerable:!0,get:function(){return Wa.ASTFeatureIncludeExpression}});Object.defineProperty(Mt,"ASTFeatureInjectExpression",{enumerable:!0,get:function(){return Wa.ASTFeatureInjectExpression}})});var Cy=g(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.SelectorGroups=pt.SelectorGroupType=pt.Selectors=pt.SelectorTypes=void 0;var Be=Ne(),rd=co(),Ga=lo(),NM;(function(t){t.From="From",t.Envar="Envar",t.Inject="Inject",t.Line="Line",t.File="File",t.LeftShift="LeftShift",t.RightShift="RightShift",t.UnsignedRightShift="UnsignedRightShift",t.BitwiseOr="BitwiseOr",t.BitwiseAnd="BitwiseAnd",t.Escape="Escape"})(NM=pt.SelectorTypes||(pt.SelectorTypes={}));pt.Selectors=Object.assign(Object.assign({},Be.Selectors),{From:(0,Be.createSelector)({type:Be.TokenType.Identifier,value:"from"}),Envar:(0,Be.createSelector)({type:Be.TokenType.Keyword,value:rd.GreybelKeyword.Envar}),Inject:(0,Be.createSelector)({type:Be.TokenType.Keyword,value:rd.GreybelKeyword.Inject}),Line:(0,Be.createSelector)({type:Be.TokenType.Keyword,value:rd.GreybelKeyword.Line}),File:(0,Be.createSelector)({type:Be.TokenType.Keyword,value:rd.GreybelKeyword.File}),LeftShift:(0,Be.createSelector)({type:Be.TokenType.Punctuator,value:Ga.Operator.LeftShift}),RightShift:(0,Be.createSelector)({type:Be.TokenType.Punctuator,value:Ga.Operator.RightShift}),UnsignedRightShift:(0,Be.createSelector)({type:Be.TokenType.Punctuator,value:Ga.Operator.UnsignedRightShift}),BitwiseOr:(0,Be.createSelector)({type:Be.TokenType.Punctuator,value:Ga.Operator.BitwiseOr}),BitwiseAnd:(0,Be.createSelector)({type:Be.TokenType.Punctuator,value:Ga.Operator.BitwiseAnd}),Escape:(0,Be.createSelector)({type:Be.TokenType.Punctuator,value:Be.Operator.Escape})});var $r;(function(t){t.MapSeparator="MapSeparator",t.ListSeparator="ListSeparator",t.PathSegmentEnd="PathSegmentEnd",t.BitwiseOperators="BitwiseOperators"})($r=pt.SelectorGroupType||(pt.SelectorGroupType={}));pt.SelectorGroups=Object.assign(Object.assign({},Be.SelectorGroups),{[$r.MapSeparator]:(0,Be.createSelectorGroup)($r.MapSeparator,[pt.Selectors.MapSeperator,pt.Selectors.CRBracket]),[$r.ListSeparator]:(0,Be.createSelectorGroup)($r.ListSeparator,[pt.Selectors.MapSeperator,pt.Selectors.SRBracket]),[$r.PathSegmentEnd]:(0,Be.createSelectorGroup)($r.PathSegmentEnd,[pt.Selectors.EndOfLine,pt.Selectors.Comment,pt.Selectors.EndOfFile]),[$r.BitwiseOperators]:(0,Be.createSelectorGroup)($r.BitwiseOperators,[pt.Selectors.LeftShift,pt.Selectors.RightShift,pt.Selectors.UnsignedRightShift])})});var K0=g(Va=>{"use strict";var qM=Va&&Va.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Va,"__esModule",{value:!0});var pn=Ne(),jM=ea(),G0=oa(),FM=qM(yy()),$M=Oy(),os=co(),V0=lo(),qe=Cy(),Ry=class extends pn.Parser{constructor(e,n={}){var r;n.lexer=n.lexer||new FM.default(e,{unsafe:n.unsafe,tabWidth:n.tabWidth}),n.astProvider=n.astProvider||new $M.ASTProvider,super(e,n);let i=this;i.filename=(r=n.filename)!==null&&r!==void 0?r:"unknown",i.imports=[],i.includes=[],i.injects=[]}skipNewlines(){let e=this,n=0;for(;;){if(qe.Selectors.Comment(e.token)){let r=e.astProvider.comment({value:e.token.value,isMultiline:e.token.value.indexOf(`
107
+ */`),[n]=e;if(n.tags.length>0){let{descriptions:r,args:i,returns:s,examples:o}=oM(n);return M0.SignatureDefinitionFunction.parse({type:M0.SignatureDefinitionBaseType.Function,arguments:t.getArguments().map((a,u)=>{let c=a.getLabel(),l=a.getTypes().map(p=>p.toString()),d=a.isOptional();return{types:l,opt:d,...i[u],label:c}}),returns:s.type.split("|"),description:r,example:o})}return t}ts.enrichWithMetaInformation=aM});var Qm=g($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});$l.createResolveChain=void 0;var sn=Ne();function Ti(t,e,n=null,r=!1){switch(t.type){case sn.ASTType.ParenthesisExpression:{Ti(t.expression,e,n);return}case sn.ASTType.MemberExpression:{let i=t;Ti(i.base,e),e.push({ref:t,getter:i.identifier,unary:n,isInCallExpression:r});return}case sn.ASTType.IndexExpression:{let i=t;Ti(i.base,e),e.push({ref:t,getter:i.index,unary:n,isInCallExpression:r});return}case sn.ASTType.CallStatement:{Ti(t.expression,e,n,!0);return}case sn.ASTType.CallExpression:{Ti(t.base,e,n,!0);return}case sn.ASTType.NegationExpression:case sn.ASTType.BinaryNegatedExpression:case sn.ASTType.UnaryExpression:{let i=t;Ti(i.argument,e,i);return}case sn.ASTType.Identifier:{e.push({ref:t,getter:t,unary:n,isInCallExpression:r});return}case sn.ASTType.NumericLiteral:case sn.ASTType.StringLiteral:case sn.ASTType.NilLiteral:case sn.ASTType.MapConstructorExpression:case sn.ASTType.ListConstructorExpression:{e.push({ref:t,value:t,unary:n,isInCallExpression:r});return}case sn.ASTType.SliceExpression:Ti(t.base,e),e.push({ref:t,unary:n,isInCallExpression:r})}}function uM(t){let e=[];return Ti(t,e),e}$l.createResolveChain=uM});var q0=g(Zm=>{function N0(t,e){return t>e?1:-1}Zm.hash=function t(e,n){var r=5381;if(typeof e=="object"&&e!==null&&(e.toString===Object.prototype.toString||e.toString===Array.prototype.toString)){n||(n=new WeakSet);for(var i=Object.keys(e).sort(N0),s=0;s<i.length;s++){var o=i[s],a=e[o];if(r=33*r^t(o,n),typeof a=="object"&&a!==null&&(e.toString===Object.prototype.toString||e.toString===Array.prototype.toString)){if(n.has(a))continue;n.add(a)}r=33*r^t(a,n)}return 33*r^t(e.constructor,n)}var u=typeof e;try{e instanceof Date?u+=e.getTime():u+=String(e)}catch{u+=String(Object.assign({},e))}for(var c=0;c<u.length;c++)r=33*r^u.charCodeAt(c);return r},Zm.sortNumbers=N0});var ny=g(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.ObjectSet=so.ObjectSetIterator=void 0;var ey=q0(),Bl=class{constructor(e){let n=this;n.value=e,n.index=0}next(){let e=this;return e.index>=e.value.length?{value:null,done:!0}:{value:e.value[e.index++],done:!1}}};so.ObjectSetIterator=Bl;var ty=class{constructor(e){let r=(e?Array.from(e):[]).map(i=>[(0,ey.hash)(i),i]);this._map=new Map(r),this._first=null,this._last=null,r.length>0&&(this._first=r[0][0],this._last=r[r.length-1][0])}[Symbol.iterator](){return new Bl(Array.from(this._map.values()))}first(){return this._first!=null?this._map.get(this._first)??null:null}last(){return this._last!=null?this._map.get(this._last)??null:null}toArray(){return Array.from(this._map.values())}add(e){let n=(0,ey.hash)(e);return this._map.set(n,e),this._first??(this._first=n),this._last=n,this}delete(e){let n=(0,ey.hash)(e);return this._map.delete(n)}extend(e){for(let[n,r]of e._map)this._map.set(n,r),this._first??(this._first=n),this._last=n;return this}toJSON(){return Array.from(this._map.values())}clear(){this._map.clear()}};so.ObjectSet=ty});var ry=g(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});Ul.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION=void 0;Ul.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION="This is a custom method. You can add a description for this method by adding a comment above or after the function.\n```\nmyFunction = function(a, b, c) // This function does xyz\n```\nor\n```\n/*\n This function does xyz\n*/\nmyFunction = function(a, b, c)\n```"});var ns=g(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.CompletionItemKind=void 0;var cM;(function(t){t.Variable="var",t.Property="var",t.Function="function",t.Literal="literal",t.Constant="constant",t.ListConstructor="list",t.MapConstructor="map",t.Expression="expr",t.Unknown="unknown"})(cM=Ma.CompletionItemKind||(Ma.CompletionItemKind={}))});var iy=g(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.isResolveChainItemWithValue=kr.isResolveChainItemWithIdentifier=kr.isResolveChainItemWithMember=kr.isResolveChainItemWithIndex=void 0;var Si=Ne(),lM=t=>t!=null&&t.ref.type===Si.ASTType.IndexExpression;kr.isResolveChainItemWithIndex=lM;var dM=t=>t!=null&&t.ref.type===Si.ASTType.MemberExpression;kr.isResolveChainItemWithMember=dM;var fM=t=>t!=null&&t.ref.type===Si.ASTType.Identifier;kr.isResolveChainItemWithIdentifier=fM;var pM=t=>t!=null&&(t.ref.type===Si.ASTType.NumericLiteral||t.ref.type===Si.ASTType.StringLiteral||t.ref.type===Si.ASTType.NilLiteral||t.ref.type===Si.ASTType.MapConstructorExpression||t.ref.type===Si.ASTType.ListConstructorExpression);kr.isResolveChainItemWithValue=pM});var sy=g(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});Hl.isSignatureDefinitionFunction=void 0;var hM=Un(),gM=t=>t.getType().type===hM.SignatureDefinitionBaseType.Function;Hl.isSignatureDefinitionFunction=gM});var j0=g(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});Wl.aggregateEntity=void 0;var mM=t=>{let e=[],n=t;for(;n!=null;)e.push(n),n=n.getIsa();return e};Wl.aggregateEntity=mM});var La=g(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});Gl.injectIdentifers=void 0;var yM=j0(),bM=(t,e)=>{let n=(0,yM.aggregateEntity)(e);for(let r of n)for(let[i,s]of r.values)if(i.startsWith("i:")){let o=i.slice(2);if(t.has(o))continue;t.set(o,{kind:s.kind,line:s.line})}};Gl.injectIdentifers=bM});var Kl=g(Vl=>{"use strict";Object.defineProperty(Vl,"__esModule",{value:!0});Vl.isEligibleForProperties=void 0;var oy=Un(),vM=t=>t.types.has(oy.SignatureDefinitionBaseType.Map)||t.types.has(oy.SignatureDefinitionBaseType.List)||t.types.has(oy.SignatureDefinitionBaseType.Any);Vl.isEligibleForProperties=vM});var Xl=g(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});zl.lookupProperty=void 0;var _M=Kl(),TM=(t,e)=>{let n=t;for(;(0,_M.isEligibleForProperties)(n);){let r=n.values.get(`i:${e}`);if(r!=null)return r;let i=n.getIsa();if(i==null)break;n=i}return null};zl.lookupProperty=TM});var uo=g(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.Entity=ki.resolveEntity=void 0;var oo=Un(),ao=ns(),SM=sy(),kM=La(),Yl=Kl(),F0=Xl(),$0=ny(),xM=(t,e,n=!1)=>{if(e.isCallable()&&!n){let r=e.getReturnEntity();if(r!==null)return r;let i=e.getCallableReturnTypes();return i?new rs({kind:ao.CompletionItemKind.Variable,container:t,label:e.label,context:e.context}).addType(...i):new rs({kind:ao.CompletionItemKind.Variable,container:t,label:e.label,context:e.context}).addType(oo.SignatureDefinitionBaseType.Any)}return e};ki.resolveEntity=xM;var ay={hasProperty(t,e,n){return!!(0,F0.lookupProperty)(t,n)||!t.isAPI()&&!!e.getDefinition(Array.from(t.types),n,!0)},resolveProperty(t,e,n,r=!1){let i=(0,F0.lookupProperty)(t,n)??null;return i==null?t.isAPI()?null:e.getDefinition(Array.from(t.types),n,r):(0,ki.resolveEntity)(e,i,r)},setProperty(t,e,n,r){if(!(0,Yl.isEligibleForProperties)(t))return!1;let i=`i:${n}`,s=t.values.get(i);return s?s.extend(r):t.values.set(i,r.copy({container:e,label:n,context:t})),!0}},uy={hasProperty(t,e,n){if(!(0,Yl.isEligibleForProperties)(t))return!1;for(let r of n.types)if(t.values.has(`t:${r}`))return!0;return!1},resolveProperty(t,e,n,r=!1){if(!(0,Yl.isEligibleForProperties)(t))return new rs({kind:ao.CompletionItemKind.Variable,container:e,label:n.label,context:t}).addType(oo.SignatureDefinitionBaseType.Any);let i=new rs({kind:ao.CompletionItemKind.Variable,container:e,label:n.label,context:t});for(let s of n.types){let o=t.values.get(`t:${s}`);o&&i.extend(o)}return i.types.size===0&&i.addType(oo.SignatureDefinitionBaseType.Any),(0,ki.resolveEntity)(e,i,r)},setProperty(t,e,n,r){if(!(0,Yl.isEligibleForProperties)(t))return!1;for(let i of n.types){let s=`t:${i}`,o=t.values.get(s);o?o.extend(r):t.values.set(s,r.copy({container:e,label:i,context:t}))}return!0}},rs=class t{get definitions(){return this._definitions}get kind(){return this._kind}get line(){return this._line}get signatureDefinitions(){return this._signatureDefinitions}get context(){return this._context}get label(){return this._label}get types(){return this._types}get values(){return this._values}constructor(e){this._isAPI=e.isAPI??!1,this._isFromSignature=e.isFromSignature??!1,this._kind=e.kind,this._line=e.line??-1,this._label=e.label??"anonymous",this._signatureDefinitions=e.signatureDefinitions??new $0.ObjectSet,this._types=e.types??new Set,this._definitions=e.definitions??[],this._values=e.values??new Map,this._context=e.context??null,this._container=e.container,this._returnEntity=e.returnEntity??null}isFromSignature(){return this._isFromSignature}hasContext(){return this._context!=null&&!this._context.isAPI}getIsa(){return this._values.get("i:__isa")??null}hasIsa(){return this._values.has("i:__isa")}isAPI(){return this._isAPI}isCallable(){return this._types.has(oo.SignatureDefinitionBaseType.Function)}getCallableReturnTypes(){if(!this.isCallable())return null;let e=Array.from(this._signatureDefinitions).filter(n=>(0,SM.isSignatureDefinitionFunction)(n));return e.length===0?null:e.flatMap(n=>n.getReturns()).map(n=>n.type)}addSignatureType(e){return this._signatureDefinitions.add(e),this.addType(e.getType().type),this}setReturnEntity(e){return this._returnEntity=e,this}getReturnEntity(){return this._returnEntity}setKind(e){return this._kind=e,this}setLine(e){return this._line=e,this}setLabel(e){return this._label=e,this}setContext(e){return this._context=e,this}addType(...e){for(let n of e)this._types.add(n);return this}hasProperty(e){switch(typeof e){case"object":return uy.hasProperty(this,this._container,e);default:return ay.hasProperty(this,this._container,e)}}resolveProperty(e,n=!1){switch(typeof e){case"object":return uy.resolveProperty(this,this._container,e,n);default:return ay.resolveProperty(this,this._container,e,n)}}setProperty(e,n){switch(typeof e){case"object":return uy.setProperty(this,this._container,e,n);default:return ay.setProperty(this,this._container,e,n)}}extend(e){if(e===this)return this;this._isFromSignature=!1,this._signatureDefinitions.extend(e.signatureDefinitions),this._definitions.push(...e.definitions),this.addType(...e.types);for(let[n,r]of e.values){let i=this.values.get(n);i==null?this.values.set(n,r.copy({container:this._container,context:this})):i.extend(r)}return this}insertSignature(e){let n=Object.keys(e.getDefinitions());this.addType(oo.SignatureDefinitionBaseType.Map);for(let r=0;r<n.length;r++){let i=n[r],s=e.getDefinition(i),o=new t({label:i,kind:s.getType().type===oo.SignatureDefinitionBaseType.Function?ao.CompletionItemKind.Function:ao.CompletionItemKind.Property,container:this._container,isFromSignature:!0});o.addSignatureType(s),this.setProperty(i,o)}return this}getAllIdentifier(){let e=new Map;for(let n of this._types){let r=this._container.getAllIdentifier(n);for(let i of r)e.set(...i)}return(0,kM.injectIdentifers)(e,this),e}toJSONInternal(e=new WeakMap){if(e.has(this))return e.get(this);let n={};return e.set(this,n),n.kind=this.kind,n.signatureDefinitions=this._signatureDefinitions.toJSON(),n.types=Array.from(this._types),n.values=Array.from(this._values).reduce((r,[i,s])=>(r[i]=s?.toJSONInternal(e),r),{}),n}toJSON(){return this.toJSONInternal()}copy(e={}){let n=new t({kind:e.kind??this._kind,line:e.line??this._line,isFromSignature:e.isFromSignature??this._isFromSignature,isAPI:e.isAPI??this._isAPI,container:e.container??this._container,label:e.label??this._label,context:e.context??this._context,signatureDefinitions:new $0.ObjectSet(Array.from(this._signatureDefinitions,r=>r.copy())),types:new Set(this._types),returnEntity:this._returnEntity,values:e.values??this.values,definitions:e.definitions??this._definitions});return e.deepCopy&&(n._values=new Map(Array.from(this._values,([r,i])=>[r,i.copy({deepCopy:e.deepCopy,container:e.container,line:e.line,context:n,values:i.values})])),n._definitions=[...this._definitions]),n}};ki.Entity=rs});var dy=g(Zl=>{"use strict";Object.defineProperty(Zl,"__esModule",{value:!0});Zl.Scope=void 0;var Jl=Un(),is=ns(),cy=La(),Ql=uo(),ly=class t{get definitions(){return[]}get signatureDefinitions(){return null}get kind(){return is.CompletionItemKind.Constant}get line(){return this._locals.line}get label(){return this._locals.label}get context(){return this._locals.context}get types(){return new Set(Jl.SignatureDefinitionBaseType.Map)}get values(){return this._locals.values}get globals(){return this._globals}get outer(){return this._parent?.locals??null}get locals(){return this._locals}constructor(e){this._container=e.container,this._parent=e.parent??null,this._globals=e.globals,this._locals=e.locals??new Ql.Entity({kind:is.CompletionItemKind.Constant,container:this._container,label:"locals"}).addType(Jl.SignatureDefinitionBaseType.Map)}getIsa(){return null}hasIsa(){return!1}setCustomType(e,n){this._container.setCustomType(e,n)}addSignatureType(){throw new Error("Cannot add signature type to scope!")}hasProperty(e){return this._locals.hasProperty(e)}resolveProperty(e,n){return this._locals.resolveProperty(e,n)}resolveNamespace(e,n=!1){if(typeof e!="string")throw new Error("Invalid property type for scope!");if(e==="locals")return this._locals;if(e==="outer")return this._parent?.locals??this._globals;if(e==="globals")return this._globals;if(this._locals.values.has(`i:${e}`)){let r=this._locals.values.get(`i:${e}`);return(0,Ql.resolveEntity)(this._container,r,n)}else if(this._parent?.locals.values.has(`i:${e}`)){let r=this._parent.locals.values.get(`i:${e}`);return(0,Ql.resolveEntity)(this._container,r,n)}else if(this._globals.values.has(`i:${e}`)){let r=this._globals.values.get(`i:${e}`);return(0,Ql.resolveEntity)(this._container,r,n)}return this._container.getGeneralDefinition(e,n)}setProperty(e,n){return this._locals.setProperty(e,n)}extend(e){return this._locals.extend(e),this}addType(){throw new Error("Scope cannot get type assigned!")}setReturnEntity(){throw new Error("Scope cannot set return entity!")}getReturnEntity(){throw new Error("Scope cannot get return entity!")}setKind(e){return this._locals.setKind(e),this}setLine(e){return this._locals.setLine(e),this}setLabel(e){return this._locals.setLabel(e),this}setContext(e){return this._locals.setContext(e),this}insertSignature(e){return this._locals.insertSignature(e),this}isAPI(){return!1}hasContext(){return!1}isFromSignature(){return!1}isCallable(){return!1}getCallableReturnTypes(){return null}getAllIdentifier(){let e=new Map([["globals",{kind:is.CompletionItemKind.Constant,line:-1}],["locals",{kind:is.CompletionItemKind.Constant,line:-1}],["outer",{kind:is.CompletionItemKind.Constant,line:-1}],...this._container.getAllIdentifier(Jl.SignatureDefinitionBaseType.General)]);return this._locals!==this._globals&&(0,cy.injectIdentifers)(e,this._globals),this._parent&&(0,cy.injectIdentifers)(e,this._parent.locals),(0,cy.injectIdentifers)(e,this._locals),this.isSelfAvailable()&&e.set("self",{kind:is.CompletionItemKind.Constant,line:-1}),this.isSuperAvailable()&&e.set("super",{kind:is.CompletionItemKind.Constant,line:-1}),e}isSelfAvailable(){return this._locals.context!=null&&this._locals.context.types.has(Jl.SignatureDefinitionBaseType.Map)}isSuperAvailable(){return this.isSelfAvailable()&&this._locals.context.hasProperty("__isa")}toJSON(){return this._locals.toJSON()}copy(e={}){return new t({container:e.container??this._container,parent:this._parent.copy({container:e.container,line:-1,deepCopy:!0}),globals:this._globals.copy({container:e.container,line:-1,deepCopy:!0}),locals:this._locals.copy({...e,deepCopy:!0})})}};Zl.Scope=ly});var co=g(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.GreybelKeyword=void 0;var wM;(function(t){t.Envar="#envar",t.Import="#import",t.Include="#include",t.ImportWithComment="//import",t.IncludeWithComment="//include",t.Debugger="debugger",t.Line="#line",t.File="#filename",t.Inject="#inject"})(wM=Na.GreybelKeyword||(Na.GreybelKeyword={}))});var hy=g(py=>{"use strict";Object.defineProperty(py,"__esModule",{value:!0});var ss=Ne(),EM=co(),fy=class extends ss.LexerValidator{constructor(){super(...arguments),this.isKeyword=Set.prototype.has.bind(new Set([...Object.values(ss.Keyword),...Object.values(EM.GreybelKeyword)]))}isIdentifierStart(e){return super.isIdentifierStart(e)||e===ss.CharacterCode.HASH}isMultilineComment(e,n){return ss.CharacterCode.SLASH===e&&ss.CharacterCode.ASTERISK===n}isMultilineCommentEnd(e,n){return ss.CharacterCode.ASTERISK===e&&ss.CharacterCode.SLASH===n}isComment(e,n){return super.isComment(e,n)||this.isMultilineComment(e,n)}};py.default=fy});var gy=g(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});qa.CharacterCode=void 0;var AM;(function(t){t[t.VERTICAL_LINE=124]="VERTICAL_LINE",t[t.AMPERSAND=38]="AMPERSAND"})(AM=qa.CharacterCode||(qa.CharacterCode={}))});var lo=g(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.Operator=void 0;var OM;(function(t){t.BitwiseAnd="&",t.BitwiseOr="|",t.LeftShift="<<",t.RightShift=">>",t.UnsignedRightShift=">>>"})(OM=ja.Operator||(ja.Operator={}))});var yy=g(Fa=>{"use strict";var CM=Fa&&Fa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fa,"__esModule",{value:!0});var nr=Ne(),RM=CM(hy()),B0=gy(),U0=co(),my=lo();function H0(t){let e=this.content[this.index];return this.index+=e.length,this.createPunctuator(e,t)}var ed=class t extends nr.Lexer{constructor(e,n={}){n.validator=n.validator||new RM.default,super(e,n)}scan(e,n){let r=t.greybelScanHandlers[e];return r?r.call(this,n)||super.scan(e,n):super.scan(e,n)}scanMultilineComment(e){let n=this,r=n.line,i=n.lineStart,s=n.index,o=n.offset,a=n.offset,u=!1;for(;n.index<n.length;){let d=n.codeAt();if(n.validator.isEndOfLine(d))n.validator.isWinNewline(d,n.codeAt(1))&&n.index++,n.line++,a=n.index+1;else if(n.validator.isMultilineCommentEnd(n.codeAt(),n.codeAt(1))){u=!0;break}n.index++}if(!u)return n.raise("Unexpected end of file in multiline comment.",new nr.ASTRange(new nr.ASTPosition(r,s-o+1),new nr.ASTPosition(n.line,n.index-a+3)));let c=n.content.slice(s+2,n.index);n.index+=2;let l=new nr.Token({type:nr.TokenType.Comment,value:c,line:r,lineStart:i,range:[n.tokenStart,n.index],offsetRange:[o,a],afterSpace:e,lastLine:n.line,lastLineStart:n.lineStart});return n.offset=a,n.snapshot.enqueue(l),l}scanComment(e){let n=this,r=n.validator;return n.content.startsWith(U0.GreybelKeyword.ImportWithComment,n.index)||n.content.startsWith(U0.GreybelKeyword.IncludeWithComment,n.index)?(n.index++,n.scanIdentifierOrKeyword(e)):r.isMultilineComment(n.codeAt(),n.codeAt(1))?n.scanMultilineComment(e):super.scanComment(e)}};Fa.default=ed;ed.greybelScanHandlers={[nr.CharacterCode.ARROW_LEFT]:function(e){if(nr.CharacterCode.ARROW_LEFT===this.codeAt(1))return this.scanPunctuator(my.Operator.LeftShift,e)},[nr.CharacterCode.ARROW_RIGHT]:function(e){if(nr.CharacterCode.ARROW_RIGHT===this.codeAt(1))return nr.CharacterCode.ARROW_RIGHT===this.codeAt(2)?this.scanPunctuator(my.Operator.UnsignedRightShift,e):this.scanPunctuator(my.Operator.RightShift,e)},[B0.CharacterCode.AMPERSAND]:H0,[B0.CharacterCode.VERTICAL_LINE]:H0}});var td=g($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.ASTType=void 0;var DM;(function(t){t.FeatureImportExpression="FeatureImportExpression",t.FeatureIncludeExpression="FeatureIncludeExpression",t.FeatureEnvarExpression="FeatureEnvarExpression",t.FeatureInjectExpression="FeatureInjectExpression",t.FeatureDebuggerExpression="FeatureDebuggerExpression",t.FeatureLineExpression="FeatureLineExpression",t.FeatureFileExpression="FeatureFileExpression"})(DM=$a.ASTType||($a.ASTType={}))});var vy=g(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.ASTChunkAdvanced=void 0;var PM=Ne(),by=class t extends PM.ASTChunk{constructor(e){super(e),this.imports=e.imports||[],this.includes=e.includes||[],this.injects=e.injects||[]}clone(){return new t({literals:this.literals.map(e=>e.clone()),scopes:this.scopes.map(e=>e.clone()),imports:this.imports.map(e=>e.clone()),includes:this.includes.map(e=>e.clone()),injects:this.injects.map(e=>e.clone()),lines:this.lines,start:this.start,end:this.end,range:this.range,scope:this.scope})}};nd.ASTChunkAdvanced=by});var wy=g(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.ASTFeatureFileExpression=Hn.ASTFeatureInjectExpression=Hn.ASTFeatureEnvarExpression=Hn.ASTFeatureIncludeExpression=Hn.ASTFeatureImportExpression=void 0;var Ba=Ne(),Ua=td(),_y=class t extends Ba.ASTBase{constructor(e){super(Ua.ASTType.FeatureImportExpression,e),this.name=e.name,this.path=e.path,this.chunk=e.chunk,this.namespace=e.namespace}toString(){return`FeatureImportExpression[${this.start}-${this.end}][name = ${this.name}, path = ${this.path}]`}clone(){return new t({name:this.name.clone(),path:this.path,chunk:this.chunk.clone(),namespace:this.namespace,start:this.start,end:this.end,range:this.range,scope:this.scope})}};Hn.ASTFeatureImportExpression=_y;var Ty=class t extends Ba.ASTBase{constructor(e){super(Ua.ASTType.FeatureIncludeExpression,e),this.path=e.path,this.chunk=e.chunk,this.namespace=e.namespace}toString(){return`FeatureIncludeExpression[${this.start}-${this.end}][path = ${this.path}]`}clone(){return new t({path:this.path,chunk:this.chunk.clone(),namespace:this.namespace,start:this.start,end:this.end,range:this.range,scope:this.scope})}};Hn.ASTFeatureIncludeExpression=Ty;var Sy=class t extends Ba.ASTBase{constructor(e){super(Ua.ASTType.FeatureEnvarExpression,e),this.name=e.name}toString(){return`FeatureEnvarExpression[${this.start}-${this.end}][name = ${this.name}]`}clone(){return new t({name:this.name,start:this.start,end:this.end,range:this.range,scope:this.scope})}};Hn.ASTFeatureEnvarExpression=Sy;var ky=class t extends Ba.ASTBase{constructor(e){super(Ua.ASTType.FeatureInjectExpression,e),this.path=e.path}toString(){return`FeatureInjectExpression[${this.start}-${this.end}][path = ${this.path}]`}clone(){return new t({path:this.path,start:this.start,end:this.end,range:this.range,scope:this.scope})}};Hn.ASTFeatureInjectExpression=ky;var xy=class t extends Ba.ASTBase{constructor(e){super(Ua.ASTType.FeatureFileExpression,e),this.filename=e.filename}toString(){return`FeatureFileExpression[${this.start}-${this.end}][path = ${this.filename}]`}clone(){return new t({filename:this.filename,start:this.start,end:this.end,range:this.range,scope:this.scope})}};Hn.ASTFeatureFileExpression=xy});var Oy=g(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.ASTFeatureInjectExpression=Mt.ASTFeatureIncludeExpression=Mt.ASTFeatureImportExpression=Mt.ASTFeatureFileExpression=Mt.ASTFeatureEnvarExpression=Mt.ASTChunkAdvanced=Mt.ASTType=Mt.ASTProvider=void 0;var Ey=Ne(),W0=td(),IM=vy(),Ha=wy(),Ay=class extends Ey.ASTProvider{featureImportExpression(e){return new Ha.ASTFeatureImportExpression(e)}featureIncludeExpression(e){return new Ha.ASTFeatureIncludeExpression(e)}featureEnvarExpression(e){return new Ha.ASTFeatureEnvarExpression(e)}featureInjectExpression(e){return new Ha.ASTFeatureInjectExpression(e)}featureDebuggerExpression(e){return new Ey.ASTBase(W0.ASTType.FeatureDebuggerExpression,e)}featureLineExpression(e){return new Ey.ASTBase(W0.ASTType.FeatureLineExpression,e)}featureFileExpression(e){return new Ha.ASTFeatureFileExpression(e)}chunkAdvanced(e){return new IM.ASTChunkAdvanced(e)}};Mt.ASTProvider=Ay;var MM=td();Object.defineProperty(Mt,"ASTType",{enumerable:!0,get:function(){return MM.ASTType}});var LM=vy();Object.defineProperty(Mt,"ASTChunkAdvanced",{enumerable:!0,get:function(){return LM.ASTChunkAdvanced}});var Wa=wy();Object.defineProperty(Mt,"ASTFeatureEnvarExpression",{enumerable:!0,get:function(){return Wa.ASTFeatureEnvarExpression}});Object.defineProperty(Mt,"ASTFeatureFileExpression",{enumerable:!0,get:function(){return Wa.ASTFeatureFileExpression}});Object.defineProperty(Mt,"ASTFeatureImportExpression",{enumerable:!0,get:function(){return Wa.ASTFeatureImportExpression}});Object.defineProperty(Mt,"ASTFeatureIncludeExpression",{enumerable:!0,get:function(){return Wa.ASTFeatureIncludeExpression}});Object.defineProperty(Mt,"ASTFeatureInjectExpression",{enumerable:!0,get:function(){return Wa.ASTFeatureInjectExpression}})});var Cy=g(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.SelectorGroups=pt.SelectorGroupType=pt.Selectors=pt.SelectorTypes=void 0;var Be=Ne(),rd=co(),Ga=lo(),NM;(function(t){t.From="From",t.Envar="Envar",t.Inject="Inject",t.Line="Line",t.File="File",t.LeftShift="LeftShift",t.RightShift="RightShift",t.UnsignedRightShift="UnsignedRightShift",t.BitwiseOr="BitwiseOr",t.BitwiseAnd="BitwiseAnd",t.Escape="Escape"})(NM=pt.SelectorTypes||(pt.SelectorTypes={}));pt.Selectors=Object.assign(Object.assign({},Be.Selectors),{From:(0,Be.createSelector)({type:Be.TokenType.Identifier,value:"from"}),Envar:(0,Be.createSelector)({type:Be.TokenType.Keyword,value:rd.GreybelKeyword.Envar}),Inject:(0,Be.createSelector)({type:Be.TokenType.Keyword,value:rd.GreybelKeyword.Inject}),Line:(0,Be.createSelector)({type:Be.TokenType.Keyword,value:rd.GreybelKeyword.Line}),File:(0,Be.createSelector)({type:Be.TokenType.Keyword,value:rd.GreybelKeyword.File}),LeftShift:(0,Be.createSelector)({type:Be.TokenType.Punctuator,value:Ga.Operator.LeftShift}),RightShift:(0,Be.createSelector)({type:Be.TokenType.Punctuator,value:Ga.Operator.RightShift}),UnsignedRightShift:(0,Be.createSelector)({type:Be.TokenType.Punctuator,value:Ga.Operator.UnsignedRightShift}),BitwiseOr:(0,Be.createSelector)({type:Be.TokenType.Punctuator,value:Ga.Operator.BitwiseOr}),BitwiseAnd:(0,Be.createSelector)({type:Be.TokenType.Punctuator,value:Ga.Operator.BitwiseAnd}),Escape:(0,Be.createSelector)({type:Be.TokenType.Punctuator,value:Be.Operator.Escape})});var $r;(function(t){t.MapSeparator="MapSeparator",t.ListSeparator="ListSeparator",t.PathSegmentEnd="PathSegmentEnd",t.BitwiseOperators="BitwiseOperators"})($r=pt.SelectorGroupType||(pt.SelectorGroupType={}));pt.SelectorGroups=Object.assign(Object.assign({},Be.SelectorGroups),{[$r.MapSeparator]:(0,Be.createSelectorGroup)($r.MapSeparator,[pt.Selectors.MapSeperator,pt.Selectors.CRBracket]),[$r.ListSeparator]:(0,Be.createSelectorGroup)($r.ListSeparator,[pt.Selectors.MapSeperator,pt.Selectors.SRBracket]),[$r.PathSegmentEnd]:(0,Be.createSelectorGroup)($r.PathSegmentEnd,[pt.Selectors.EndOfLine,pt.Selectors.Comment,pt.Selectors.EndOfFile]),[$r.BitwiseOperators]:(0,Be.createSelectorGroup)($r.BitwiseOperators,[pt.Selectors.LeftShift,pt.Selectors.RightShift,pt.Selectors.UnsignedRightShift])})});var K0=g(Va=>{"use strict";var qM=Va&&Va.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Va,"__esModule",{value:!0});var pn=Ne(),jM=ea(),G0=oa(),FM=qM(yy()),$M=Oy(),os=co(),V0=lo(),qe=Cy(),Ry=class extends pn.Parser{constructor(e,n={}){var r;n.lexer=n.lexer||new FM.default(e,{unsafe:n.unsafe,tabWidth:n.tabWidth}),n.astProvider=n.astProvider||new $M.ASTProvider,super(e,n);let i=this;i.filename=(r=n.filename)!==null&&r!==void 0?r:"unknown",i.imports=[],i.includes=[],i.injects=[]}skipNewlines(){let e=this,n=0;for(;;){if(qe.Selectors.Comment(e.token)){let r=e.astProvider.comment({value:e.token.value,isMultiline:e.token.value.indexOf(`
108
108
  `)!==-1,start:e.token.start,end:e.token.end,range:e.token.range,scope:e.currentScope});e.addItemToLines(r),e.backpatches.peek().body.push(r)}else if(qe.Selectors.EndOfLine(e.token))n++;else break;e.next()}return n}parseMap(e=!1,n=!1){let r=this;if(!qe.Selectors.CLBracket(r.token))return r.parseList(e,n);let i=r.currentScope,s=r.token,o=[],a=r.astProvider.mapConstructorExpression({fields:o,start:s.start,end:null,range:[s.range[0],null],scope:i});if(r.next(),qe.Selectors.CRBracket(r.token))r.next();else for(;!qe.Selectors.EndOfFile(r.token);){if(r.skipNewlines(),qe.Selectors.CRBracket(r.token)){r.next();break}let u=r.astProvider.mapKeyString({key:null,value:null,start:r.token.start,end:null,range:[r.token.range[0],null],scope:i});if(u.key=r.parseExpr(null),r.requireToken(qe.Selectors.MapKeyValueSeperator),r.skipNewlines(),r.currentAssignment){let l=r.astProvider.assignmentStatement({variable:r.astProvider.indexExpression({index:u.key,base:r.currentAssignment.variable,start:u.start,end:r.token.end,range:[u.range[0],r.token.range[1]],scope:i}),init:null,start:u.start,end:null,range:[u.range[0],null]}),d=r.currentAssignment;r.currentAssignment=l,u.value=r.parseExpr(u),r.currentAssignment=d,l.init=u.value,l.end=r.previousToken.end,l.range[1]=r.previousToken.range[1],i.assignments.push(l)}else u.value=r.parseExpr(u);u.end=r.previousToken.end,u.range[1]=r.previousToken.range[1],o.push(u),r.skipNewlines();let c=r.requireTokenOfAny(qe.SelectorGroups.MapSeparator,s.start);if(qe.Selectors.CRBracket(c))break}return a.end=r.token.start,a.range[1]=r.token.range[1],a}parseList(e=!1,n=!1){let r=this;if(!qe.Selectors.SLBracket(r.token))return r.parseQuantity(e,n);let i=r.currentScope,s=r.token,o=[],a=r.astProvider.listConstructorExpression({fields:o,start:s.start,end:null,range:[s.range[0],null],scope:i});if(r.next(),qe.Selectors.SRBracket(r.token))r.next();else for(;!qe.Selectors.EndOfFile(r.token);){if(r.skipNewlines(),qe.Selectors.SRBracket(r.token)){r.next();break}let u=r.astProvider.listValue({value:null,start:r.token.start,end:null,range:[r.token.range[0],null],scope:i});if(r.currentAssignment){let l=r.astProvider.assignmentStatement({variable:r.astProvider.indexExpression({index:r.astProvider.literal(pn.TokenType.NumericLiteral,{value:o.length,raw:`${o.length}`,start:s.start,end:r.token.end,range:[s.range[0],r.token.range[1]],scope:i}),base:r.currentAssignment.variable,start:null,end:null,range:[null,null],scope:i}),init:null,start:null,end:null,range:[null,null]}),d=r.currentAssignment,p=r.token;r.currentAssignment=d,u.value=r.parseExpr(u),r.currentAssignment=d,l.variable.start=p.start,l.variable.end=r.previousToken.end,l.variable.range=[p.range[0],r.previousToken.range[1]],l.init=u.value,l.start=u.start,l.end=r.previousToken.end,l.range=[u.range[0],r.previousToken.range[1]],i.assignments.push(l)}else u.value=r.parseExpr(u);u.end=r.previousToken.end,u.range[1]=r.previousToken.range[1],o.push(u),r.skipNewlines();let c=r.requireTokenOfAny(qe.SelectorGroups.ListSeparator,s.start);if(qe.Selectors.SRBracket(c))break}return a.end=r.token.start,a.range[1]=r.token.range[1],a}parsePathSegment(){let e=this;if(this.token.type===pn.ASTType.StringLiteral){let r=this.token.value;return this.next(),r}let n="";for(;!qe.SelectorGroups.PathSegmentEnd(e.token);)n=n+e.token.value,e.next();return e.consumeMany(qe.SelectorGroups.PathSegmentEnd),n}parseFeatureIncludeStatement(){let e=this,n=e.previousToken,r=e.parsePathSegment(),i=e.astProvider.featureIncludeExpression({path:r,start:n.start,end:e.previousToken.end,range:[n.range[0],e.previousToken.range[1]],scope:e.currentScope});return e.includes.push(i),i}parseFeatureImportStatement(){var e;let n=this,r=n.previousToken,i=n.parseIdentifier();if(!n.consume(qe.Selectors.From))return n.raise("expected from keyword",new G0.Range(r.start,new jM.Position((e=n.token.lastLine)!==null&&e!==void 0?e:n.token.line,n.token.end.character))),n.parseInvalidCode();let s=n.parsePathSegment(),o=n.astProvider.featureImportExpression({name:i,path:s,start:r.start,end:n.previousToken.end,range:[r.range[0],n.previousToken.range[1]],scope:n.currentScope});n.imports.push(o);let a=n.astProvider.assignmentStatement({variable:i,init:n.astProvider.literal(pn.TokenType.NilLiteral,{value:null,raw:"null",start:i.start,end:i.end,range:i.range,scope:n.currentScope}),start:i.start,end:i.end,range:i.range,scope:n.currentScope});return n.currentScope.assignments.push(a),o}parseFeatureEnvarExpression(){let e=this,n=e.previousToken,r=e.token.value;return e.next(),e.astProvider.featureEnvarExpression({name:r,start:n.start,end:e.previousToken.end,range:[n.range[0],e.previousToken.range[1]],scope:e.currentScope})}parseFeatureInjectExpression(){let e=this,n=e.previousToken,r=this.parsePathSegment();e.next();let i=e.astProvider.featureInjectExpression({path:r,start:n.start,end:e.previousToken.end,range:[n.range[0],e.previousToken.range[1]],scope:e.currentScope});return e.injects.push(i),i}parseIsa(e=!1,n=!1){let r=this,i=r.token,s=r.parseBitwiseOr(e,n);if(qe.Selectors.Isa(r.token)){r.next(),r.skipNewlines();let o=r.parseBitwiseOr();return r.astProvider.isaExpression({operator:pn.Operator.Isa,left:s,right:o,start:i.start,end:r.previousToken.end,range:[i.range[0],r.previousToken.range[1]],scope:r.currentScope})}return s}parseBitwiseOr(e=!1,n=!1){let r=this,i=r.token,o=r.parseBitwiseAnd(e,n);for(;qe.Selectors.BitwiseOr(r.token);){r.next();let a=r.parseBitwiseAnd();o=r.astProvider.binaryExpression({operator:V0.Operator.BitwiseOr,left:o,right:a,start:i.start,end:r.previousToken.end,range:[i.range[0],r.previousToken.range[1]],scope:r.currentScope})}return o}parseBitwiseAnd(e=!1,n=!1){let r=this,i=r.token,o=r.parseComparisons(e,n);for(;qe.Selectors.BitwiseAnd(r.token);){r.next();let a=r.parseComparisons();o=r.astProvider.binaryExpression({operator:V0.Operator.BitwiseAnd,left:o,right:a,start:i.start,end:r.previousToken.end,range:[i.range[0],r.previousToken.range[1]],scope:r.currentScope})}return o}parseAddSub(e=!1,n=!1){let r=this,i=r.token,o=r.parseBitwise(e,n);for(;qe.Selectors.Plus(r.token)||qe.Selectors.Minus(r.token)&&(!n||!r.token.afterSpace||r.lexer.isAtWhitespace());){let a=r.token;r.next(),r.skipNewlines();let u=r.parseBitwise();o=r.astProvider.binaryExpression({operator:a.value,left:o,right:u,start:i.start,end:r.previousToken.end,range:[i.range[0],r.previousToken.range[1]],scope:r.currentScope})}return o}parseBitwise(e=!1,n=!1){let r=this,i=r.token,o=r.parseMultDiv(e,n);for(;qe.SelectorGroups.BitwiseOperators(r.token);){let a=r.token;r.next(),r.skipNewlines();let u=r.parseMultDiv();o=r.astProvider.binaryExpression({operator:a.value,left:o,right:u,start:i.start,end:r.previousToken.end,range:[i.range[0],r.previousToken.range[1]],scope:r.currentScope})}return o}parseAtom(){let e=this;return qe.Selectors.Envar(e.token)?(e.next(),e.parseFeatureEnvarExpression()):qe.Selectors.Inject(e.token)?(e.next(),e.parseFeatureInjectExpression()):qe.Selectors.Line(e.token)?(e.next(),e.astProvider.featureLineExpression({start:new pn.ASTPosition(e.previousToken.line,e.previousToken.start.character),end:new pn.ASTPosition(e.previousToken.line,e.previousToken.end.character),range:e.previousToken.range,scope:e.currentScope})):qe.Selectors.File(e.token)?(e.next(),e.astProvider.featureFileExpression({filename:e.filename,start:new pn.ASTPosition(e.previousToken.line,e.previousToken.start.character),end:new pn.ASTPosition(e.previousToken.line,e.previousToken.end.character),range:e.previousToken.range,scope:e.currentScope})):super.parseAtom()}parseStatement(){let e=this,n=e.backpatches.peek();if(e.isType(pn.TokenType.Keyword))switch(e.token.value){case os.GreybelKeyword.Include:case os.GreybelKeyword.IncludeWithComment:{e.next();let i=e.parseFeatureIncludeStatement();e.addItemToLines(i),n.body.push(i);return}case os.GreybelKeyword.Import:case os.GreybelKeyword.ImportWithComment:{e.next();let i=e.parseFeatureImportStatement();e.addItemToLines(i),n.body.push(i);return}case os.GreybelKeyword.Envar:{e.next();let i=e.parseFeatureEnvarExpression();e.addItemToLines(i),n.body.push(i);return}case os.GreybelKeyword.Inject:{e.next();let i=e.parseFeatureInjectExpression();e.addItemToLines(i),n.body.push(i);return}case os.GreybelKeyword.Debugger:{e.next();let i=e.astProvider.featureDebuggerExpression({start:new pn.ASTPosition(e.previousToken.line,e.previousToken.start.character),end:new pn.ASTPosition(e.previousToken.line,e.previousToken.end.character),range:e.previousToken.range,scope:e.currentScope});e.addItemToLines(i),n.body.push(i);return}default:break}super.parseStatement()}parseChunk(){let e=this;e.next();let n=e.token,r=e.astProvider.chunkAdvanced({start:n.start,end:null,range:[n.range[0],null]}),i=new pn.PendingChunk(r);for(e.backpatches.setDefault(i),e.pushScope(r);!qe.Selectors.EndOfFile(e.token)&&(e.skipNewlines(),!qe.Selectors.EndOfFile(e.token));)e.lexer.recordSnapshot(),e.statementErrors=[],e.parseStatement(),e.statementErrors.length>0&&e.tryToRecover();let s=e.backpatches.pop();for(;!(0,pn.isPendingChunk)(s);){let o=e.raise(`found open block ${s.block.type}`,new G0.Range(s.block.start,s.block.start));if(s.complete(e.previousToken),e.errors.push(o),!e.unsafe)throw o;s=e.backpatches.pop()}return e.finishRemaingScopes(),e.popScope(),i.complete(e.token),r.literals=e.literals,r.scopes=e.scopes,r.lines=e.lines,r.imports=e.imports,r.includes=e.includes,r.injects=e.injects,r}};Va.default=Ry});var Br=g(Ct=>{"use strict";var BM=Ct&&Ct.__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]}),Ka=Ct&&Ct.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&BM(e,t,n)},Dy=Ct&&Ct.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ct,"__esModule",{value:!0});Ct.Parser=Ct.LexerValidator=Ct.Lexer=void 0;var UM=yy();Object.defineProperty(Ct,"Lexer",{enumerable:!0,get:function(){return Dy(UM).default}});var HM=hy();Object.defineProperty(Ct,"LexerValidator",{enumerable:!0,get:function(){return Dy(HM).default}});var WM=K0();Object.defineProperty(Ct,"Parser",{enumerable:!0,get:function(){return Dy(WM).default}});Ka(Oy(),Ct);Ka(gy(),Ct);Ka(co(),Ct);Ka(lo(),Ct);Ka(Cy(),Ct)});var z0=g(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});id.parseMapDescription=void 0;var GM=cm();function VM(t){return{path:t.name,type:t.type}}function KM(t){let e=t.tags.find(r=>r.tag==="type");if(!e)return null;let n=t.tags.filter(r=>r.tag==="property");return{type:e.name,properties:n.map(VM)}}function zM(t){let e=(0,GM.parse)(`/**
109
109
  ${t}
110
110
  */`),[n]=e;return n.tags.length>0?KM(n):null}id.parseMapDescription=zM});var Iy=g(od=>{"use strict";Object.defineProperty(od,"__esModule",{value:!0});od.Aggregator=void 0;var sd=Br(),Pe=Un(),Ee=Ne(),XM=ry(),ke=ns(),as=iy(),X0=Vg(),YM=Jm(),Y0=Qm(),J0=ha(),JM=z0(),QM=uo(),Py=class{get definitions(){return this._definitions}get parent(){return this._parent}constructor(e){this._root=e.root,this._scope=e.scope,this._document=e.document,this._parent=e.parent??null,this._definitions=new Map}factory(e){return new QM.Entity({kind:e,container:this._document.container})}createMapDescription(e){let n=this._document.getLastASTItemOfLine(e.start.line-1),r=this._document.findASTItemInLine(e.start.line,Ee.ASTType.Comment);if(n instanceof Ee.ASTComment){let i=new Set,s=[],o=e.start.line-1;for(;o>=0;){let a=this._document.getLastASTItemOfLine(o--);if(!i.has(a))if(a instanceof Ee.ASTComment)i.add(a),s.unshift(a.value);else break}return s.join(`
111
111
  `)}else if(r instanceof Ee.ASTComment)return r.value;return null}createCustomTypeFromMap(e,n){let r=this.createMapDescription(e);if(r==null)return;let i=(0,JM.parseMapDescription)(r);i!=null&&(i.properties.forEach(s=>{if(s.path==="__isa")return;let o=s.path.split("."),a=this.factory(ke.CompletionItemKind.Property).addType(s.type).setLabel(o[o.length-1]);this.setEntityInPath(n,o,a)}),this._scope.setCustomType(i.type,n))}createFunctionDescription(e,n=XM.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION){let r=this._document.getLastASTItemOfLine(e.start.line-1),i=this._document.findASTItemInLine(e.start.line,Ee.ASTType.Comment);if(r instanceof Ee.ASTComment){let s=new Set,o=[],a=e.start.line-1;for(;a>=0;){let u=this._document.getLastASTItemOfLine(a--);if(!s.has(u))if(u instanceof Ee.ASTComment)s.add(u),o.unshift(u.value);else break}return o.join(`
112
112
 
113
- `)}else if(i instanceof Ee.ASTComment)return i.value;return n}resolveFunctionStatement(e){let n=Pe.SignatureDefinitionFunction.parse({type:Pe.SignatureDefinitionBaseType.Function,description:this.createFunctionDescription(e),arguments:e.parameters.map(r=>{if(r.type===Ee.ASTType.Identifier)return{label:r.name??"unknown",type:Pe.SignatureDefinitionBaseType.Any};let i=r;return{label:i.variable?.name??"unknown",types:Array.from(this.resolveTypeWithDefault(i.init).types)}}),returns:["any"]});return this.factory(ke.CompletionItemKind.Function).addType(Pe.SignatureDefinitionBaseType.Function).addSignatureType((0,YM.enrichWithMetaInformation)(n)).setLine(e.start.line)}resolveParenthesisExpression(e){return this.resolveTypeWithDefault(e.expression)}resolveBinaryExpression(e){let n=this.factory(ke.CompletionItemKind.Expression).setLabel("Binary Expr").setLine(e.start.line),r=this.resolveTypeWithDefault(e.left),i=this.resolveTypeWithDefault(e.right);return n.extend(r),n.extend(i),n}resolveLogicalExpression(e){return this.factory(ke.CompletionItemKind.Expression).setLabel("Logical Expr").addType(Pe.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveComparisonGroupExpression(e){return this.factory(ke.CompletionItemKind.Expression).setLabel("Comparison Group Expr").addType(Pe.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveIsaExpression(e){return this.factory(ke.CompletionItemKind.Expression).setLabel("Isa Expr").addType(Pe.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveCallStatement(e){let n=this.resolveNamespace(e);return n===null?this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveCallExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveUnaryExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveMapConstructorExpression(e){let n=this.factory(ke.CompletionItemKind.MapConstructor).addType(Pe.SignatureDefinitionBaseType.Map);for(let r=0;r<e.fields.length;r++){let i=e.fields[r],s=this.resolveTypeWithDefault(i.value).setLine(i.start.line);if(i.key.type===Ee.ASTType.StringLiteral)n.setProperty(i.key.value.toString(),s);else{let o=this.resolveTypeWithDefault(i.key).setLine(i.start.line);n.setProperty(o,s)}}return this.createCustomTypeFromMap(e,n),n.setLabel("{}").setLine(e.start.line)}resolveListConstructorExpression(e){let n=this.factory(ke.CompletionItemKind.ListConstructor).addType(Pe.SignatureDefinitionBaseType.List);for(let r=0;r<e.fields.length;r++){let i=e.fields[r],s=this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Number).setLine(i.start.line),o=this.resolveTypeWithDefault(i.value).setLine(i.start.line);n.setProperty(s,o)}return n.setLabel("[]").setLine(e.start.line)}resolveSliceExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLine(e.start.line):n.setLine(e.start.line)}resolveIndexExpression(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLine(e.start.line):r}resolveMemberExpression(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(ke.CompletionItemKind.Property).addType(Pe.SignatureDefinitionBaseType.Any).setLabel(e.identifier.name).setLine(e.start.line):r}resolveIdentifier(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(ke.CompletionItemKind.Property).addType(Pe.SignatureDefinitionBaseType.Any).setLabel(e.name).setLine(e.start.line):r}resolveType(e,n=!1){if(e==null)return null;switch(e.type){case Ee.ASTType.ParenthesisExpression:return this.resolveParenthesisExpression(e);case Ee.ASTType.CallStatement:return this.resolveCallStatement(e);case Ee.ASTType.CallExpression:return this.resolveCallExpression(e);case Ee.ASTType.BinaryExpression:return this.resolveBinaryExpression(e);case Ee.ASTType.LogicalExpression:return this.resolveLogicalExpression(e);case Ee.ASTType.IsaExpression:return this.resolveIsaExpression(e);case Ee.ASTType.ComparisonGroupExpression:return this.resolveComparisonGroupExpression(e);case Ee.ASTType.FunctionDeclaration:return this.resolveFunctionStatement(e);case Ee.ASTType.SliceExpression:return this.resolveSliceExpression(e);case Ee.ASTType.IndexExpression:return this.resolveIndexExpression(e,n);case Ee.ASTType.MemberExpression:return this.resolveMemberExpression(e,n);case Ee.ASTType.Identifier:return this.resolveIdentifier(e,n);case Ee.ASTType.MapConstructorExpression:return this.resolveMapConstructorExpression(e);case Ee.ASTType.ListConstructorExpression:return this.resolveListConstructorExpression(e);case Ee.ASTType.NegationExpression:case Ee.ASTType.BinaryNegatedExpression:case Ee.ASTType.UnaryExpression:return this.resolveUnaryExpression(e);case Ee.ASTType.NilLiteral:return this.factory(ke.CompletionItemKind.Literal).addType("null").setLabel("null").setLine(e.start.line);case Ee.ASTType.StringLiteral:{let r=e.value.toString();return this.factory(ke.CompletionItemKind.Literal).addType(Pe.SignatureDefinitionBaseType.String).setLabel(`"${r.length>20?r.substr(0,20)+"...":r}"`).setLine(e.start.line)}case Ee.ASTType.NumericLiteral:case Ee.ASTType.BooleanLiteral:{let r=e.value.toString();return this.factory(ke.CompletionItemKind.Literal).addType(Pe.SignatureDefinitionBaseType.Number).setLabel(r).setLine(e.start.line)}case sd.ASTType.FeatureFileExpression:return this.factory(ke.CompletionItemKind.Expression).addType(Pe.SignatureDefinitionBaseType.String).setLabel("File Expr").setLine(e.start.line);case sd.ASTType.FeatureLineExpression:return this.factory(ke.CompletionItemKind.Expression).addType(Pe.SignatureDefinitionBaseType.Number).setLabel("Line Expr").setLine(e.start.line);case sd.ASTType.FeatureEnvarExpression:return this.factory(ke.CompletionItemKind.Expression).addType(Pe.SignatureDefinitionBaseType.String).setLabel("Envar Expr").setLine(e.start.line);case sd.ASTType.FeatureInjectExpression:return this.factory(ke.CompletionItemKind.Expression).addType(Pe.SignatureDefinitionBaseType.String).setLabel("Inject Expr").setLine(e.start.line);default:return null}}resolveTypeWithDefault(e=null,n=!1){let r=this.resolveType(e,n);if(r==null){let i=this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any);return e!=null&&i.setLine(e.start.line),i}return r}resolveChain(e,n=!1){if(e.length===0)return null;let r=null,i=e[0],s=i.unary?.operator==="@"&&!i.isInCallExpression||n&&e.length===1;if((0,as.isResolveChainItemWithIdentifier)(i))if(i.getter.name==="globals")r=this._scope.globals;else if(i.getter.name==="outer")r=this._scope.outer;else if(i.getter.name==="locals")r=this._scope.locals;else if(i.getter.name==="super"){let a=this._document.getScopeContext(i.ref.scope)?.scope.context?.getIsa();a==null?r=this.factory(ke.CompletionItemKind.Constant).addType("null").setLabel("super"):r=a.copy({kind:ke.CompletionItemKind.Constant,label:"super",values:a.values})}else if(i.getter.name==="self"){let a=this._document.getScopeContext(i.ref.scope)?.scope.context;a==null?r=this.factory(ke.CompletionItemKind.Constant).addType("null").setLabel("self"):r=a.copy({kind:ke.CompletionItemKind.Constant,label:"self",values:a.values})}else r=this._scope.resolveNamespace(i.getter.name,s)??this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLabel(i.getter.name);else if((0,as.isResolveChainItemWithValue)(i))r=this.resolveTypeWithDefault(i.value,s);else return null;if(i.unary?.operator===Ee.Keyword.New&&r!==null){let a=this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Map).setLabel(r.label);a.setProperty("__isa",r),this.createCustomTypeFromMap(i.unary,a),r=a}let o=e.length;for(let a=1;a<o&&r!==null;a++){let u=e[a],c=u.unary?.operator==="@"&&!u.isInCallExpression||n&&e.length-1===a;if((0,as.isResolveChainItemWithMember)(u))r=r.resolveProperty(u.getter.name,c)??this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLabel(u.getter.name);else if((0,as.isResolveChainItemWithIndex)(u))if((0,J0.isValidIdentifierLiteral)(u.getter)){let l=u.getter.value.toString();r=r.resolveProperty(l,u.isInCallExpression)??this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLabel(l)}else{let l=this.resolveTypeWithDefault(u.getter);r=r.resolveProperty(l,u.isInCallExpression)??this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any)}else if(u.ref.type===Ee.ASTType.SliceExpression)r=r.copy();else return null;if(u.unary?.operator===Ee.Keyword.New&&r!==null){let l=this.factory(ke.CompletionItemKind.Property).addType(Pe.SignatureDefinitionBaseType.Map).setLabel(r.label);l.setProperty("__isa",r),this.createCustomTypeFromMap(u.unary,l),r=l}}return r}setEntityInPath(e,n,r){let i=e;for(let s=0;s<n.length-1;s++){let o=n[s],a=i.resolveProperty(o);if(a==null){let u=this.factory(ke.CompletionItemKind.Property).addType(Pe.SignatureDefinitionBaseType.Map).setLabel(o);i.setProperty(o,u),a=u}i=a}return i.setProperty(n[n.length-1],r)}getEntityInPath(e,n){let r=e;for(let i=0;i<n.length;i++){let s=n[i],o=r.resolveProperty(s);if(o==null)return null;r=o}return r}resolveNamespace(e,n=!1){let r=(0,Y0.createResolveChain)(e);return this.resolveChain(r,n)}defineNamespace(e,n){let r=(0,Y0.createResolveChain)(e),i=r.pop();if(r.length>0){let o=this.resolveChain(r);if(o===null)return!1;if((0,as.isResolveChainItemWithMember)(i))return o.setProperty(i.getter.name,n);if((0,as.isResolveChainItemWithIndex)(i)){if((0,J0.isValidIdentifierLiteral)(i.getter))return o.setProperty(i.getter.value.toString(),n);{let a=this.resolveTypeWithDefault(i.getter);return o.setProperty(a,n)}}return!1}let s=this._scope;return(0,as.isResolveChainItemWithIdentifier)(i)?s.setProperty(i.getter.name,n):!1}resolveAvailableAssignmentsWithQuery(e){let n=[],r=new Set([this,this._parent,this._document.getRootScopeContext().aggregator]);for(let i of r){let s=i.definitions;for(let o of s.keys())if(o.includes(e)){let a=s.get(o);n.push(...a)}}return n}resolveAvailableAssignments(e){let n=(0,X0.createExpressionId)(e),r=this;n.startsWith("globals.")?(r=this._document.getRootScopeContext().aggregator,n=n.slice(8)):n.startsWith("locals.")?(r=this,n=n.slice(7)):n.startsWith("outer.")&&(r=this.parent,n=n.slice(6));let i=[],s=new Set([r,r._parent,r._document.getRootScopeContext().aggregator]);for(let o of s){if(o==null)continue;let a=o._definitions.get(n);a!=null&&i.push(...a)}return i}analyze(){for(let e=0;e<this._root.assignments.length;e++){let n=this._root.assignments[e],r=this.resolveType(n.init)?.copy().setLine(n.start.line)??this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLine(n.start.line);this.defineNamespace(n.variable,r);let i=(0,X0.createExpressionId)(n.variable),s=this._definitions;i.startsWith("globals.")?(s=this._document.getRootScopeContext().aggregator.definitions,i=i.slice(8)):i.startsWith("locals.")?(s=this._definitions,i=i.slice(7)):i.startsWith("outer.")&&(s=this.parent.definitions,i=i.slice(6));let o=s.get(i);o?o.push(n):s.set(i,[n])}}};od.Aggregator=Py});var Ly=g(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.Document=void 0;var Ur=Un(),ZM=Ne(),Q0=ns(),Z0=Iy(),eE=uo(),tE=dy(),My=class t{get root(){return this._root}get container(){return this._container}get intrinsics(){return this._intrinscis}get globals(){return this._globals}get api(){return this._api}constructor(e){this._root=e.root,this._container=e.container,this._scopeMapping=e.scopeMapping??new WeakMap,this._intrinscis=e.intrinsics??this.createIntrinscis(),this._api=e.api??this.initApi(),this._globals=e.globals??this.initGlobals()}createIntrinscis(){return{map:this._container.primitives.get(Ur.SignatureDefinitionBaseType.Map),funcRef:this._container.primitives.get(Ur.SignatureDefinitionBaseType.Function),number:this._container.primitives.get(Ur.SignatureDefinitionBaseType.Number),string:this._container.primitives.get(Ur.SignatureDefinitionBaseType.String),list:this._container.primitives.get(Ur.SignatureDefinitionBaseType.List)}}initApi(){let e=this._container.primitives.get(Ur.SignatureDefinitionBaseType.General);return e.resolveProperty("map",!0).setReturnEntity(this._intrinscis.map),e.resolveProperty("funcRef",!0).setReturnEntity(this._intrinscis.funcRef),e.resolveProperty("number",!0).setReturnEntity(this._intrinscis.number),e.resolveProperty("string",!0).setReturnEntity(this._intrinscis.string),e.resolveProperty("list",!0).setReturnEntity(this._intrinscis.list),e}initGlobals(){return new eE.Entity({kind:Q0.CompletionItemKind.Constant,container:this._container,label:"globals"}).addType(Ur.SignatureDefinitionBaseType.Map)}analyzeScope(e){let n=this._scopeMapping.get(e.scope),r=new tE.Scope({container:this._container,parent:n?.scope,globals:this._globals}),i=new Z0.Aggregator({scope:r,root:e,document:this,parent:n?.aggregator});this._scopeMapping.set(e,{scope:r,aggregator:i});let s=e.assignment instanceof ZM.ASTAssignmentStatement?this.resolveNamespace(e.assignment.variable,!0):null;if(s!==null){let o=s?.context;o!=null&&o.types.has(Ur.SignatureDefinitionBaseType.Map)&&o!==this._globals&&r.setContext(o)}if(i.analyze(),s!==null){let o=s.signatureDefinitions.last();if(o!=null){let a=o.getArguments();for(let u=0;u<a.length;u++){let c=a[u],l=r.resolveProperty(c.getLabel(),!0),d=c.getTypes().map(p=>p.type);l===null?r.setProperty(c.getLabel(),new eE.Entity({kind:Q0.CompletionItemKind.Variable,container:this._container}).addType(...d)):(l.types.delete(Ur.SignatureDefinitionBaseType.Any),l.addType(...d))}}}}analyze(){let e=new tE.Scope({container:this._container,globals:this._globals,locals:this._globals}),n=new Z0.Aggregator({scope:e,root:this._root,document:this});this._scopeMapping.set(this._root,{scope:e,aggregator:n}),n.analyze();for(let r=0;r<this._root.scopes.length;r++){let i=this._root.scopes[r];this.analyzeScope(i)}}getRootScopeContext(){return this._scopeMapping.get(this._root)}getAllScopeContexts(){return[this._root,...this._root.scopes].map(e=>this._scopeMapping.get(e))}getScopeContext(e){return this._scopeMapping.get(e)??null}getLastASTItemOfLine(e){let n=this._root.lines[e];return n&&n.length>0?n[n.length-1]:null}findASTItemInLine(e,n){let r=this._root.lines[e];if(r&&r.length>0){let i=r.find(s=>s.type===n);if(i)return i}return null}resolveAllAssignmentsWithQuery(e){let n=[],r=[this._root,...this._root.scopes];for(let i=0;i<r.length;i++){let o=this._scopeMapping.get(r[i]).aggregator.definitions;for(let a of o.keys())if(a.includes(e)){let u=o.get(a);n.push(...u)}}return n}resolveAvailableAssignments(e){return this._scopeMapping.get(e.scope)?.aggregator.resolveAvailableAssignments(e)??[]}resolveType(e,n){return this._scopeMapping.get(e.scope)?.aggregator.resolveType(e,n)??null}resolveTypeWithDefault(e,n){return this._scopeMapping.get(e.scope)?.aggregator.resolveTypeWithDefault(e,n)}resolveNamespace(e,n=!1){return this._scopeMapping.get(e.scope)?.aggregator.resolveNamespace(e,n)??null}merge(...e){let n=new t({root:this._root,container:this._container.copy()});for(let r of e)n._globals.extend(r._globals.copy({line:-1})),n._intrinscis.map.extend(r._intrinscis.map.copy({line:-1})),n._intrinscis.funcRef.extend(r._intrinscis.funcRef.copy({line:-1})),n._intrinscis.number.extend(r._intrinscis.number.copy({line:-1})),n._intrinscis.string.extend(r._intrinscis.string.copy({line:-1})),n._intrinscis.list.extend(r._intrinscis.list.copy({line:-1})),n._container.mergeCustomTypes(r._container);return n.analyze(),n}};ad.Document=My});var jy=g(ud=>{"use strict";Object.defineProperty(ud,"__esModule",{value:!0});ud.ContainerProxy=void 0;var rr=Un(),xi=uo(),nE=ns(),rE=La(),Ny=Xl(),qy=class t{get primitives(){return this._primitives}get types(){return this._types}constructor(e){this._container=e.container,this._primitives=e.primitives??this.createPrimitives(),this._types=e.types??this.createTypes(),this._customTypes=new Set}createPrimitives(){let e=new Map;for(let[n,r]of this._container.getPrimitives()){let i=new xi.Entity({kind:nE.CompletionItemKind.Constant,container:this,isAPI:n===rr.SignatureDefinitionBaseType.General}).addType(rr.SignatureDefinitionBaseType.Map).insertSignature(r);e.set(n,i)}return e}createTypes(){let e=new Map;for(let[n,r]of this._container.getTypes()){let i=new xi.Entity({kind:nE.CompletionItemKind.Constant,container:this}).addType(rr.SignatureDefinitionBaseType.Map).insertSignature(r);e.set(n,i)}return e}setCustomType(e,n){this._types.has(e)||(this._types.set(e,n),this._customTypes.add(e))}mergeCustomTypes(e){for(let n of e._customTypes){let r=e._types.get(n);r!=null&&this.setCustomType(n,r.copy({deepCopy:!0,line:-1}))}}getTypeSignature(e){return this._primitives.get(e)??this._types.get(e)??null}searchDefinitionMatches(e,n){if(typeof e=="string")return this.searchDefinitionMatches([e],n);let r=e.includes(rr.SignatureDefinitionBaseType.Any)?new Set(this._container.getAllVisibleTypes()):new Set(e),i=new Map;for(let s of r){let o=this.getTypeSignature(s);if(o===null)continue;let a=(0,Ny.lookupProperty)(o,n);a!==null&&i.set(s,a)}return i}getDefinition(e,n,r=!1){if(typeof e=="string")return this.getDefinition([e],n);let i=(0,Ny.lookupProperty)(this._primitives.get(rr.SignatureDefinitionBaseType.Any),n);if(e.includes(rr.SignatureDefinitionBaseType.Any)&&i)return(0,xi.resolveEntity)(this,i,r);let s=this.searchDefinitionMatches(e,n);return s.size===0?null:s.size===1?(0,xi.resolveEntity)(this,s.values().next().value,r):s.has(rr.SignatureDefinitionBaseType.Any)?(0,xi.resolveEntity)(this,s.get(rr.SignatureDefinitionBaseType.Any),r):i!==null?(0,xi.resolveEntity)(this,i,r):(0,xi.resolveEntity)(this,s.values().next().value,r)}getGeneralDefinition(e,n=!1){let r=(0,Ny.lookupProperty)(this._primitives.get(rr.SignatureDefinitionBaseType.General),e);return r==null?null:(0,xi.resolveEntity)(this,r,n)}injectTypeIdentifiers(e,n){let r=this.getTypeSignature(n);if(r!=null&&((0,rE.injectIdentifers)(e,r),this._types.has(n))){let i=this._primitives.get(rr.SignatureDefinitionBaseType.Map);(0,rE.injectIdentifers)(e,i)}}getAllIdentifier(e){let n=new Map;if(e===rr.SignatureDefinitionBaseType.Any){for(let r of this._container.getAllVisibleTypes())this.injectTypeIdentifiers(n,r);return n}return this.injectTypeIdentifiers(n,e),n}copy(){return new t({container:this._container})}};ud.ContainerProxy=qy});var iE=g(cd=>{"use strict";Object.defineProperty(cd,"__esModule",{value:!0});cd.TypeManager=void 0;var eL=Ly(),tL=jy(),Fy=class{constructor(e){this._container=new tL.ContainerProxy({container:e.container}),this._types=new Map}analyze(e,n){let r=new eL.Document({container:this._container.copy(),root:n});try{r.analyze()}catch(i){console.error(i)}return this._types.set(e,r),r}get(e){return this._types.get(e)??null}};cd.TypeManager=Fy});var za=g(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.TypeManager=oe.ContainerProxy=oe.Document=oe.Aggregator=oe.Scope=oe.Entity=oe.lookupProperty=oe.isEligibleForProperties=oe.injectIdentifers=oe.isSignatureDefinitionFunction=oe.isResolveChainItemWithValue=oe.isResolveChainItemWithMember=oe.isResolveChainItemWithIndex=oe.isResolveChainItemWithIdentifier=oe.CompletionItemKind=oe.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION=oe.ObjectSetIterator=oe.ObjectSet=oe.rotateBits=oe.getStringHashCode=oe.getHashCode=oe.createResolveChain=oe.enrichWithMetaInformation=oe.createExpressionId=oe.createExpressionHash=oe.isValidIdentifierLiteral=void 0;var nL=ha();Object.defineProperty(oe,"isValidIdentifierLiteral",{enumerable:!0,get:function(){return nL.isValidIdentifierLiteral}});var rL=ax();Object.defineProperty(oe,"createExpressionHash",{enumerable:!0,get:function(){return rL.createExpressionHash}});var iL=Vg();Object.defineProperty(oe,"createExpressionId",{enumerable:!0,get:function(){return iL.createExpressionId}});var sL=Jm();Object.defineProperty(oe,"enrichWithMetaInformation",{enumerable:!0,get:function(){return sL.enrichWithMetaInformation}});var oL=Qm();Object.defineProperty(oe,"createResolveChain",{enumerable:!0,get:function(){return oL.createResolveChain}});var $y=Gg();Object.defineProperty(oe,"getHashCode",{enumerable:!0,get:function(){return $y.getHashCode}});Object.defineProperty(oe,"getStringHashCode",{enumerable:!0,get:function(){return $y.getStringHashCode}});Object.defineProperty(oe,"rotateBits",{enumerable:!0,get:function(){return $y.rotateBits}});var sE=ny();Object.defineProperty(oe,"ObjectSet",{enumerable:!0,get:function(){return sE.ObjectSet}});Object.defineProperty(oe,"ObjectSetIterator",{enumerable:!0,get:function(){return sE.ObjectSetIterator}});var aL=ry();Object.defineProperty(oe,"DEFAULT_CUSTOM_FUNCTION_DESCRIPTION",{enumerable:!0,get:function(){return aL.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION}});var uL=ns();Object.defineProperty(oe,"CompletionItemKind",{enumerable:!0,get:function(){return uL.CompletionItemKind}});var ld=iy();Object.defineProperty(oe,"isResolveChainItemWithIdentifier",{enumerable:!0,get:function(){return ld.isResolveChainItemWithIdentifier}});Object.defineProperty(oe,"isResolveChainItemWithIndex",{enumerable:!0,get:function(){return ld.isResolveChainItemWithIndex}});Object.defineProperty(oe,"isResolveChainItemWithMember",{enumerable:!0,get:function(){return ld.isResolveChainItemWithMember}});Object.defineProperty(oe,"isResolveChainItemWithValue",{enumerable:!0,get:function(){return ld.isResolveChainItemWithValue}});var cL=sy();Object.defineProperty(oe,"isSignatureDefinitionFunction",{enumerable:!0,get:function(){return cL.isSignatureDefinitionFunction}});var lL=La();Object.defineProperty(oe,"injectIdentifers",{enumerable:!0,get:function(){return lL.injectIdentifers}});var dL=Kl();Object.defineProperty(oe,"isEligibleForProperties",{enumerable:!0,get:function(){return dL.isEligibleForProperties}});var fL=Xl();Object.defineProperty(oe,"lookupProperty",{enumerable:!0,get:function(){return fL.lookupProperty}});var pL=uo();Object.defineProperty(oe,"Entity",{enumerable:!0,get:function(){return pL.Entity}});var hL=dy();Object.defineProperty(oe,"Scope",{enumerable:!0,get:function(){return hL.Scope}});var gL=Iy();Object.defineProperty(oe,"Aggregator",{enumerable:!0,get:function(){return gL.Aggregator}});var mL=Ly();Object.defineProperty(oe,"Document",{enumerable:!0,get:function(){return mL.Document}});var yL=jy();Object.defineProperty(oe,"ContainerProxy",{enumerable:!0,get:function(){return yL.ContainerProxy}});var bL=iE();Object.defineProperty(oe,"TypeManager",{enumerable:!0,get:function(){return bL.TypeManager}})});var By=g(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.getSymbolItemKind=fo.getCompletionItemKind=void 0;var Xt=za(),vL=t=>{switch(t){case Xt.CompletionItemKind.Constant:return 21;case Xt.CompletionItemKind.Variable:return 6;case Xt.CompletionItemKind.Expression:return 6;case Xt.CompletionItemKind.Function:return 3;case Xt.CompletionItemKind.ListConstructor:case Xt.CompletionItemKind.MapConstructor:case Xt.CompletionItemKind.Literal:case Xt.CompletionItemKind.Unknown:return 12}};fo.getCompletionItemKind=vL;var _L=t=>{switch(t){case Xt.CompletionItemKind.Constant:return 14;case Xt.CompletionItemKind.Variable:return 13;case Xt.CompletionItemKind.Expression:return 13;case Xt.CompletionItemKind.Function:return 12;case Xt.CompletionItemKind.ListConstructor:return 18;case Xt.CompletionItemKind.MapConstructor:return 19;case Xt.CompletionItemKind.Literal:case Xt.CompletionItemKind.Unknown:return 13}};fo.getSymbolItemKind=_L});var Hy=g(dd=>{"use strict";Object.defineProperty(dd,"__esModule",{value:!0});dd.findEx=void 0;var TL=Ne(),SL=function(t){return{ParenthesisExpression:(e,n)=>{t(e.expression,n)},AssignmentStatement:function(e,n){t(e.init,n),t(e.variable,n)},MemberExpression:function(e,n){t(e.base,n),t(e.identifier,n)},FunctionDeclaration:function(e,n){for(let r=0;r<e.parameters.length;r++)t(e.parameters[r],n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},MapConstructorExpression:function(e,n){for(let r=0;r<e.fields.length;r++)t(e.fields[r],n)},ReturnStatement:function(e,n){e.argument&&t(e.argument,n)},WhileStatement:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},IndexExpression:function(e,n){t(e.base,n),t(e.index,n)},SliceExpression:function(e,n){t(e.base,n),t(e.left,n),t(e.right,n)},ListValue:function(e,n){t(e.value,n)},MapKeyString:function(e,n){t(e.key,n),t(e.value,n)},IfShortcutStatement:function(e,n){for(let r=0;r<e.clauses.length;r++)t(e.clauses[r],n)},IfShortcutClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseifShortcutClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseShortcutClause:function(e,n){for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ForGenericStatement:function(e,n){t(e.variable,n),t(e.iterator,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},IfStatement:function(e,n){for(let r=0;r<e.clauses.length;r++)t(e.clauses[r],n)},IfClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseifClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseClause:function(e,n){for(let r=0;r<e.body.length;r++)t(e.body[r],n)},NegationExpression:function(e,n){t(e.argument,n)},CallExpression:function(e,n){t(e.base,n);for(let r=0;r<e.arguments.length;r++)t(e.arguments[r],n)},CallStatement:function(e,n){t(e.expression,n)},ListConstructorExpression:function(e,n){for(let r=0;r<e.fields.length;r++)t(e.fields[r],n)},BinaryExpression:function(e,n){t(e.left,n),t(e.right,n)},BinaryNegatedExpression:function(e,n){t(e.argument,n)},IsaExpression:function(e,n){t(e.left,n),t(e.right,n)},LogicalExpression:function(e,n){t(e.left,n),t(e.right,n)},ComparisonGroupExpression:function(e,n){for(let r=0;r<e.expressions.length;r++)t(e.expressions[r],n)},UnaryExpression:function(e,n){t(e.argument,n)},Chunk:function(e,n){for(let r=0;r<e.body.length;r++)t(e.body[r],n)},InvalidCodeExpression:()=>{}}},Uy=class{constructor(e){this.map=SL(this.visit.bind(this)),this.callback=e,this.state={exit:!1}}visit(e,n=0){let r=this;if(e==null)return;if(e.type==null)throw console.error("Error ast type:",e),new Error("Unexpected as type");if(r.state=r.callback(e,n),r.state.exit||r.state.skip)return;let i=r.map[e.type];i?.call(r,e,n+1)}};function kL(t,e){let n=[];return new Uy((i,s)=>{let o=t(i,s)||{};return o.valid&&i.type!==TL.ASTType.InvalidCodeExpression&&n.push(i),{exit:!!o.exit,skip:!!o.skip}}).visit(e),n}dd.findEx=kL});var oE=g((pU,xL)=>{xL.exports={insert:{description:"Depending on the data type this method will insert a value to the provided index. Due to the insertion, the object will be mutated. To get a better idea about the behaviour look into the `insert` method related to `list` or `string`.",example:["list = [2, 3, 4]","list.insert(2, 42)",'print("List with inserted item: " + list.join(", "))']},indexOf:{description:"Depending on the data type this function searches for the index of the provided value. To get a better idea about the behaviour look into the `indexOf` methods related to `string`, `list` and `map`.",example:['index = "test".indexOf("e")','print("e is at: " + index)']},hasIndex:{description:"Depending on data type this function checks if the provided index is available inside the value. To get a better idea about the behaviour look into the `hasIndex` methods related to `string`, `list` and `map`.",example:['print("List has index: " + [1, 2, 3].hasIndex(2)']},remove:{description:"Depending on the data type this function will remove a value in the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `remove` methods related to `list` and `map`.",example:["list = [9, 3, 5, 7]","list.remove(5)",'print("List after removal: " + list.join(", "))']},push:{description:"Depending on data type this function will append a value to the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `push` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","list.push(42)",'print("The answer to everything is: " + list.pop)']},pull:{description:"Depending on data type this function will return the first item in the provided value. Additionally, this function removes the last item and therefore mutates the object. To get a better idea about the behaviour look into the `pop` methods related to `list` and `map`.",example:["myList = [42, 1, 3]","answer = myList.pull",'print("Answer to everything: " + answer)']},pop:{description:"Depending on data type this function will return the last item in the provided value. Additionally, this function removes the last item and therefore mutates the object. To get a better idea about the behaviour look into the `pop` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("The last item is: " + list.pop)']},shuffle:{description:"Depending on data type this function will shuffle data. Instead of returning the newly shuffled data, this function will mutate the data. To get a better idea about the behaviour look into the `shuffle` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","list.shuffle",'print("And the winner is: " + list[0])']},sum:{description:"Depending on data type this function returns the sum of all items. To get a better idea about the behaviour look into the `sum` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("Sum of all items is: " + list.sum)']},indexes:{description:"Depending on data type this function returns a `list` with all available indexes. To get a better idea about the behaviour look into the `indexes` methods related to `string`, `list` and `map`.",example:['indexesOfStr = "test".indexes','print("Following indexes are available: " + indexesOfStr.join(", "))']},len:{description:"Depending on data type this function returns the length of the provided value. To get a better idea about the behaviour look into the `len` methods related to `string`, `list` and `map`.",example:['length = "test".len','print("Length of string is: " + length)']},values:{description:"Depending on data type this function returns a `list` with all available values. To get a better idea about the behaviour look into the `values` methods related to `string`, `list` and `map`.",example:['indexesOfStr = "test".values','print("Following values are available: " + indexesOfStr.join(", "))']}}});var aE=g((hU,wL)=>{wL.exports={hasIndex:{description:"Depending on data type this function checks if the provided index is available inside the value. To get a better idea about the behaviour look into the `hasIndex` methods related to `string`, `list` and `map`.",example:['print("List has index: " + hasIndex([1, 2, 3], 2)']},print:{description:"Print a message on the Terminal.",example:['print("hello world")']},indexes:{description:"Depending on data type this function returns a `list` with all available indexes. To get a better idea about the behaviour look into the `indexes` methods related to `string`, `list` and `map`.",example:['indexesOfStr = indexes("test")','print("Following indexes are available: " + indexesOfStr.join(", "))']},values:{description:"Depending on data type this function returns a `list` with all available values. To get a better idea about the behaviour look into the `values` methods related to `string`, `list` and `map`.",example:['indexesOfStr = values("test")','print("Following values are available: " + indexesOfStr.join(", "))']},indexOf:{description:"Depending on the data type this function searches for the index of the provided value. To get a better idea about the behaviour look into the `indexOf` methods related to `string`, `list` and `map`.",example:['index = indexOf("test", "e")','print("e is at: " + index)']},len:{description:"Depending on data type this function returns the length of the provided value. To get a better idea about the behaviour look into the `len` methods related to `string`, `list` and `map`.",example:['length = len("test")','print("Length of string is: " + length)']},shuffle:{description:"Depending on data type this function will shuffle data. Instead of returning the newly shuffled data, this function will mutate the data. To get a better idea about the behaviour look into the `shuffle` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","shuffle(list)",'print("And the winner is: " + list[0])']},val:{description:"Casts a `string` to a `number`. In case the provided `string` does not represent a valid `number` the `number` zero will get returned.",example:['num = val("1.25")','print("Number in string is: " + num)']},lower:{description:"Returns a `string` which is the lowercase transformed version of the provided `string`.",example:['myString = lower("HELLO WORLD")',"print(myString)"]},upper:{description:"Returns a `string` which is the uppercase transformed version of the provided `string`.",example:['myString = upper("hello world")',"print(myString)"]},sum:{description:"Depending on data type this function returns the sum of all items. To get a better idea about the behaviour look into the `sum` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("Sum of all items is: " + sum(list))']},pop:{description:"Depending on data type this function will return the last item in the provided value. Additionally, this function removes the last item and therefore mutates the object. To get a better idea about the behaviour look into the `pop` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("The last item is: " + pop(list))']},pull:{description:"Depending on data type this function will return the first item in the provided value. Additionally, this function removes the first item and therefore mutates the object. To get a better idea about the behaviour look into the `pull` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("The first item is: " + pull(list))']},push:{description:"Depending on data type this function will append a value to the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `push` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","push(list, 42)",'print("The answer to everything is: " + pop(list))']},sort:{description:"Depending on the data type this function will sort the values in the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `sort` methods related to `list` and `map`.",example:["list = [9, 3, 5, 7]","sort(list)",'print("Sorted list: " + list.join(", "))']},remove:{description:"Depending on the data type this function will remove a value in the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `remove` methods related to `list` and `map`.",example:["list = [9, 3, 5, 7]","remove(list, 5)",'print("List after removal: " + list.join(", "))']},wait:{description:"Puts script execution on hold. Optionally the duration can be provided via the time argument. By default, the duration will be 1 second. The duration cannot be below 0.01 or above 300.",example:["start = time","wait(5)","elapsed = time - start",'print("Waited: " + elapsed)']},bitwise:{description:'Enables to perform bitwise operations. Supported operators are: `"&"`, `"|"`, `"^"`, `"<<"`, `">>"`, `">>>"`. Returns a `number`.',example:["num = params[0].to_int",'isOdd = bitwise("&", num, 1) == 1',"if isOdd then",' print("Number is odd.")',"else",' print("Number is even.")',"end if"]},abs:{description:"Returns the absolute value of `number`.",example:["a = 1","b = 5","difference = abs(a - b)",'print("Difference between a and b is: " + difference)']},acos:{description:"Returns the inverse cosine (in radians) of a `number`.",example:["adjacent = 8","hypotenuse = 10","calcAngle = acos(adjacent / hypotenuse)",'print("Angle: " + calcAngle)']},asin:{description:"Returns the inverse sine (in radians) of a `number`.",example:["opposite = 6","hypotenuse = 10","calcAngle = acos(opposite / hypotenuse)",'print("Angle: " + calcAngle)']},atan:{description:"Returns the inverse tangent (in radians) of a `number`.",example:["opposite = 8","hypotenuse = 10","calcAngle = atan(opposite / hypotenuse)",'print("Angle: " + calcAngle)']},tan:{description:"Returns the tangent of a `number` in radians.",example:["degrees = 90","tanFromDegrees = tan(degress * pi / 180)",'print("Tan from degrees: " + tanFromDegrees)']},cos:{description:"Returns the cosine of a `number` in radians.",example:["radians = 1","radius = 10","circleX = cos(radians) * radius","print(circleX)"]},code:{description:"Returns the Unicode `number` of the first character of the string. In case an empty `string` is provided the script execution will crash.",example:['key = user_input("Press a key!", false, true)',"isA = key.code == 97","if isA then",' print("You pressed A.")',"else",' print("You did not press A.")',"end if"]},char:{description:"Returns the Unicode character `string` related to the provided unicode `number`. The provided `number` needs to be between 0 and 65535. Any `number` which is outside this range will cause the script to throw a runtime error.",example:['key = user_input("Press a key!", false, true)',"isA = key == char(97)","if isA then",' print("You pressed A.")',"else",' print("You did not press A.")',"end if"]},sin:{description:"Returns the sine of a `number` in radians.",example:["radians = 1","radius = 10","circleY = sin(radians) * radius","print(circleY)"]},floor:{description:"Returns `number` rounded down to the integer value of the provided `number`.",example:["price = 25.43467","floored = floor(price * 100) / 100",'print("Floored price: " + floored)']},range:{description:"Returns a `list` where each item is a `number`. By default, the `list` starts with the `number` zero and increments by one for each item. Optionally start and end can be defined. Additionally, the incremental value can be changed as well. In case the incremental value is zero this function will throw a runtime error.",example:['print("Countdown:")',"for num in range(10)"," print(num)","end for",'print("Done!")']},round:{description:"Returns `number` rounded to the integer value of the provided `number`.",example:["price = 25.43467","rounded = round(price * 100) / 100",'print("Price: " + rounded)']},rnd:{description:"Returns a random `number` between 0 and 1. Optionally a seed `number` can be provided.",example:["min = 10","max = 20","output = floor(rnd * (max - min + 1) + min)",'input = user_input("Guess a number between 10 and 20!").to_int',"if (input == output) then",' print("You guessed right!")',"else",' print("You failed! The number was " + output)',"end if"]},sign:{description:"Returns a one or minus one, indicating the sign of the number passed as argument. If the input is zero, it will be returned as-is.",example:["print(sign(40))","print(sign(-40))","print(sign(0))"]},sqrt:{description:"Returns the square root of a `number`.",example:["a = 3","b = 4","calcHypotenuse = sqrt((a * a) + (b * b))",'print("Hypotenuse: " + calcHypotenuse)']},str:{description:"Returns the `string` value of provided data. Can be used to turn a `number` into a `string` or to get the signature of a `function`.",example:["signature = str(@user_input)","argSegment = signature[9:signature.len - 1]",'args = argSegment.split(",")','print("Function has " + args.len + " arguments.")']},ceil:{description:"Returns `number` rounded up to the integer value of the provided `number`.",example:["price = 25.43467","upperPrice = ceil(price * 100) / 100",'print("Upper price: " + upperPrice)']},pi:{description:"Returns the `number` PI to the precision of six.",example:["radius = 10","circumference = 2 * pi * radius",'print("Circumference: " + circumference)']},slice:{description:"Returns a sliced `list`. Valid data types for slicing are `string` and `list`. The returned `list` will contain all elements related to the provided start and end index.",example:['myString = "not your text"','print("my " + slice(myString, 9))']},hash:{description:"Returns numeric hash for the provided data.",example:['hashA = hash({ "a": 2, "b": 1 })','hashB = hash({ "b": 1, "a": 2 })',"if (hashA == hashB) then",' print("Objects are alike!")',"else",' print("Objects are different!")',"end if"]},time:{description:"Returns a `number` of seconds representing the elapsed time since the script got started.",example:["start = time","for i in range(10000)"," var = i * 100","end for","endTime = time - start",'print("Script execution done within: " + endTime)']},bitAnd:{description:"Performs a bitwise AND for the provided values. Returns a `number`.",example:['print("Result of bitwise AND: " + bitAnd(1, 2))']},bitOr:{description:"Performs a bitwise OR for the provided values. Returns a `number`.",example:['print("Result of bitwise OR: " + bitOr(1, 2))']},bitXor:{description:"Permorms a bitwise XOR for the provided values. Returns a `number`.",example:['print("Result of bitwise XOR: " + bitXor(1, 2))']},log:{description:"Returns the natural logarithm of a `number`. By default, the base is 10. Optionally the base can be changed.",example:["a = 2","b = 8","baseLog = log(a) / log(b)",'print("Base log is: " + baseLog)']},yield:{description:"Waits for the next tick.",example:["while (true)"," yield",' print("tick")',"end while"]},get_custom_object:{description:"Returns `map` which is shared throughout all script executions. Can be helpful in case forwarding an entity is desired.",example:["get_custom_object.shouldEndScript = false","while (get_custom_object.shouldEndScript)",' print("Waiting...")'," wait(2)","end while"]},insert:{description:"Depending on the data type this function will insert a value to the provided index. Due to the insertion, the object will be mutated. To get a better idea about the behaviour look into the `insert` method related to `list` or `string`.",example:["list = [2, 3, 4]","insert(list, 2, 42)",'print("List with inserted item: " + list.join(", "))']},join:{description:"Returns a concatenated `string` containing all stringified values inside the `list`. These values will be separated via the provided separator.",example:["myList = [42, 1, 3]",`print(join(myList, " .-*'*-. "))`]},split:{description:"Returns a `list` where each item is a segment of the `string`. The separation depends on the provided separator `string`. Keep in mind that for some odd reason, this method is using regular expressions for matching.",example:['myString = "42 as an answer is wrong"','segments = split(myString, " ")','if segments[0] != "42" then',' print("Invalid information spotted!")',"else",' print("Information seems valid!")',"end if"]},replace:{description:"Depending on the data type this function will replace a value in the provided object. Due to the replacement, the object might get mutated. To get a better idea about the behaviour look into the `replace` method related to `map`, `list` or `string`.",example:['myString = "42 as an answer is wrong"','newString = replace(myString, "wrong", "right")',"print(newString)"]},refEquals:{description:"Tests whether two values refer to the very same object (rather than merely representing the same value). For numbers, this is the same as ==, but for strings, lists, and maps, it is reference equality."},version:{description:`Get a map with information about the version of MiniScript and the host environment that you're currently running. This will include at least the following keys:
113
+ `)}else if(i instanceof Ee.ASTComment)return i.value;return n}resolveFunctionStatement(e){let n=Pe.SignatureDefinitionFunction.parse({type:Pe.SignatureDefinitionBaseType.Function,description:this.createFunctionDescription(e),arguments:e.parameters.map(r=>{if(r.type===Ee.ASTType.Identifier)return{label:r.name??"unknown",type:Pe.SignatureDefinitionBaseType.Any};let i=r;return{label:i.variable?.name??"unknown",types:Array.from(this.resolveTypeWithDefault(i.init).types)}}),returns:["any"]});return this.factory(ke.CompletionItemKind.Function).addType(Pe.SignatureDefinitionBaseType.Function).addSignatureType((0,YM.enrichWithMetaInformation)(n)).setLine(e.start.line)}resolveParenthesisExpression(e){return this.resolveTypeWithDefault(e.expression)}resolveBinaryExpression(e){let n=this.factory(ke.CompletionItemKind.Expression).setLabel("Binary Expr").setLine(e.start.line),r=this.resolveTypeWithDefault(e.left),i=this.resolveTypeWithDefault(e.right);return n.extend(r),n.extend(i),n}resolveLogicalExpression(e){return this.factory(ke.CompletionItemKind.Expression).setLabel("Logical Expr").addType(Pe.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveComparisonGroupExpression(e){return this.factory(ke.CompletionItemKind.Expression).setLabel("Comparison Group Expr").addType(Pe.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveIsaExpression(e){return this.factory(ke.CompletionItemKind.Expression).setLabel("Isa Expr").addType(Pe.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveCallStatement(e){let n=this.resolveNamespace(e);return n===null?this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveCallExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveUnaryExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveMapConstructorExpression(e){let n=this.factory(ke.CompletionItemKind.MapConstructor).addType(Pe.SignatureDefinitionBaseType.Map);for(let r=0;r<e.fields.length;r++){let i=e.fields[r],s=this.resolveTypeWithDefault(i.value).setLine(i.start.line);if(i.key.type===Ee.ASTType.StringLiteral)n.setProperty(i.key.value.toString(),s);else{let o=this.resolveTypeWithDefault(i.key).setLine(i.start.line);n.setProperty(o,s)}}return this.createCustomTypeFromMap(e,n),n.setLabel("{}").setLine(e.start.line)}resolveListConstructorExpression(e){let n=this.factory(ke.CompletionItemKind.ListConstructor).addType(Pe.SignatureDefinitionBaseType.List);for(let r=0;r<e.fields.length;r++){let i=e.fields[r],s=this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Number).setLine(i.start.line),o=this.resolveTypeWithDefault(i.value).setLine(i.start.line);n.setProperty(s,o)}return n.setLabel("[]").setLine(e.start.line)}resolveSliceExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLine(e.start.line):n.setLine(e.start.line)}resolveIndexExpression(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLine(e.start.line):r}resolveMemberExpression(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(ke.CompletionItemKind.Property).addType(Pe.SignatureDefinitionBaseType.Any).setLabel(e.identifier.name).setLine(e.start.line):r}resolveIdentifier(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(ke.CompletionItemKind.Property).addType(Pe.SignatureDefinitionBaseType.Any).setLabel(e.name).setLine(e.start.line):r}resolveType(e,n=!1){if(e==null)return null;switch(e.type){case Ee.ASTType.ParenthesisExpression:return this.resolveParenthesisExpression(e);case Ee.ASTType.CallStatement:return this.resolveCallStatement(e);case Ee.ASTType.CallExpression:return this.resolveCallExpression(e);case Ee.ASTType.BinaryExpression:return this.resolveBinaryExpression(e);case Ee.ASTType.LogicalExpression:return this.resolveLogicalExpression(e);case Ee.ASTType.IsaExpression:return this.resolveIsaExpression(e);case Ee.ASTType.ComparisonGroupExpression:return this.resolveComparisonGroupExpression(e);case Ee.ASTType.FunctionDeclaration:return this.resolveFunctionStatement(e);case Ee.ASTType.SliceExpression:return this.resolveSliceExpression(e);case Ee.ASTType.IndexExpression:return this.resolveIndexExpression(e,n);case Ee.ASTType.MemberExpression:return this.resolveMemberExpression(e,n);case Ee.ASTType.Identifier:return this.resolveIdentifier(e,n);case Ee.ASTType.MapConstructorExpression:return this.resolveMapConstructorExpression(e);case Ee.ASTType.ListConstructorExpression:return this.resolveListConstructorExpression(e);case Ee.ASTType.NegationExpression:case Ee.ASTType.BinaryNegatedExpression:case Ee.ASTType.UnaryExpression:return this.resolveUnaryExpression(e);case Ee.ASTType.NilLiteral:return this.factory(ke.CompletionItemKind.Literal).addType("null").setLabel("null").setLine(e.start.line);case Ee.ASTType.StringLiteral:{let r=e.value.toString();return this.factory(ke.CompletionItemKind.Literal).addType(Pe.SignatureDefinitionBaseType.String).setLabel(`"${r.length>20?r.substr(0,20)+"...":r}"`).setLine(e.start.line)}case Ee.ASTType.NumericLiteral:case Ee.ASTType.BooleanLiteral:{let r=e.value.toString();return this.factory(ke.CompletionItemKind.Literal).addType(Pe.SignatureDefinitionBaseType.Number).setLabel(r).setLine(e.start.line)}case sd.ASTType.FeatureFileExpression:return this.factory(ke.CompletionItemKind.Expression).addType(Pe.SignatureDefinitionBaseType.String).setLabel("File Expr").setLine(e.start.line);case sd.ASTType.FeatureLineExpression:return this.factory(ke.CompletionItemKind.Expression).addType(Pe.SignatureDefinitionBaseType.Number).setLabel("Line Expr").setLine(e.start.line);case sd.ASTType.FeatureEnvarExpression:return this.factory(ke.CompletionItemKind.Expression).addType(Pe.SignatureDefinitionBaseType.String).setLabel("Envar Expr").setLine(e.start.line);case sd.ASTType.FeatureInjectExpression:return this.factory(ke.CompletionItemKind.Expression).addType(Pe.SignatureDefinitionBaseType.String).setLabel("Inject Expr").setLine(e.start.line);default:return null}}resolveTypeWithDefault(e=null,n=!1){let r=this.resolveType(e,n);if(r==null){let i=this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any);return e!=null&&i.setLine(e.start.line),i}return r}resolveChain(e,n=!1){if(e.length===0)return null;let r=null,i=e[0],s=i.unary?.operator==="@"&&!i.isInCallExpression||n&&e.length===1;if((0,as.isResolveChainItemWithIdentifier)(i))if(i.getter.name==="globals")r=this._scope.globals;else if(i.getter.name==="outer")r=this._scope.outer;else if(i.getter.name==="locals")r=this._scope.locals;else if(i.getter.name==="super"){let a=this._document.getScopeContext(i.ref.scope)?.scope.context?.getIsa();a==null?r=this.factory(ke.CompletionItemKind.Constant).addType("null").setLabel("super"):r=a.copy({kind:ke.CompletionItemKind.Constant,label:"super",values:a.values})}else if(i.getter.name==="self"){let a=this._document.getScopeContext(i.ref.scope)?.scope.context;a==null?r=this.factory(ke.CompletionItemKind.Constant).addType("null").setLabel("self"):r=a.copy({kind:ke.CompletionItemKind.Constant,label:"self",values:a.values})}else r=this._scope.resolveNamespace(i.getter.name,s)??this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLabel(i.getter.name);else if((0,as.isResolveChainItemWithValue)(i))r=this.resolveTypeWithDefault(i.value,s);else return null;if(i.unary?.operator===Ee.Keyword.New&&r!==null){let a=this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Map).setLabel(r.label);a.setProperty("__isa",r),this.createCustomTypeFromMap(i.unary,a),r=a}let o=e.length;for(let a=1;a<o&&r!==null;a++){let u=e[a],c=u.unary?.operator==="@"&&!u.isInCallExpression||n&&e.length-1===a;if((0,as.isResolveChainItemWithMember)(u))r=r.resolveProperty(u.getter.name,c)??this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLabel(u.getter.name);else if((0,as.isResolveChainItemWithIndex)(u))if((0,J0.isValidIdentifierLiteral)(u.getter)){let l=u.getter.value.toString();r=r.resolveProperty(l,u.isInCallExpression)??this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLabel(l)}else{let l=this.resolveTypeWithDefault(u.getter);r=r.resolveProperty(l,u.isInCallExpression)??this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any)}else if(u.ref.type===Ee.ASTType.SliceExpression)r=r.copy();else return null;if(u.unary?.operator===Ee.Keyword.New&&r!==null){let l=this.factory(ke.CompletionItemKind.Property).addType(Pe.SignatureDefinitionBaseType.Map).setLabel(r.label);l.setProperty("__isa",r),this.createCustomTypeFromMap(u.unary,l),r=l}}return r}setEntityInPath(e,n,r){let i=e;for(let s=0;s<n.length-1;s++){let o=n[s],a=i.resolveProperty(o);if(a==null){let u=this.factory(ke.CompletionItemKind.Property).addType(Pe.SignatureDefinitionBaseType.Map).setLabel(o);i.setProperty(o,u),a=u}i=a}return i.setProperty(n[n.length-1],r)}getEntityInPath(e,n){let r=e;for(let i=0;i<n.length;i++){let s=n[i],o=r.resolveProperty(s);if(o==null)return null;r=o}return r}resolveNamespace(e,n=!1){let r=(0,Y0.createResolveChain)(e);return this.resolveChain(r,n)}defineNamespace(e,n){let r=(0,Y0.createResolveChain)(e),i=r.pop();if(r.length>0){let o=this.resolveChain(r);if(o===null)return!1;if((0,as.isResolveChainItemWithMember)(i))return o.setProperty(i.getter.name,n);if((0,as.isResolveChainItemWithIndex)(i)){if((0,J0.isValidIdentifierLiteral)(i.getter))return o.setProperty(i.getter.value.toString(),n);{let a=this.resolveTypeWithDefault(i.getter);return o.setProperty(a,n)}}return!1}let s=this._scope;return(0,as.isResolveChainItemWithIdentifier)(i)?s.setProperty(i.getter.name,n):!1}resolveAvailableAssignmentsWithQuery(e){let n=[],r=new Set([this,this._parent,this._document.getRootScopeContext().aggregator]);for(let i of r){let s=i.definitions;for(let o of s.keys())if(o.includes(e)){let a=s.get(o);n.push(...a)}}return n}resolveAvailableAssignments(e){let n=(0,X0.createExpressionId)(e),r=this;n.startsWith("globals.")?(r=this._document.getRootScopeContext().aggregator,n=n.slice(8)):n.startsWith("locals.")?(r=this,n=n.slice(7)):n.startsWith("outer.")&&(r=this.parent,n=n.slice(6));let i=[],s=new Set([r,r._parent,r._document.getRootScopeContext().aggregator]);for(let o of s){if(o==null)continue;let a=o.resolveNamespace(e,!0);a!=null&&i.push(...a.definitions)}return i}analyze(){for(let e=0;e<this._root.assignments.length;e++){let n=this._root.assignments[e],r=this.resolveType(n.init)?.copy().setLine(n.start.line)??this.factory(ke.CompletionItemKind.Variable).addType(Pe.SignatureDefinitionBaseType.Any).setLine(n.start.line);r.definitions.push(n),this.defineNamespace(n.variable,r);let i=(0,X0.createExpressionId)(n.variable),s=this._definitions;i.startsWith("globals.")?(s=this._document.getRootScopeContext().aggregator.definitions,i=i.slice(8)):i.startsWith("locals.")?(s=this._definitions,i=i.slice(7)):i.startsWith("outer.")&&(s=this.parent.definitions,i=i.slice(6));let o=s.get(i);o?o.push(n):s.set(i,[n])}}};od.Aggregator=Py});var Ly=g(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.Document=void 0;var Ur=Un(),ZM=Ne(),Q0=ns(),Z0=Iy(),eE=uo(),tE=dy(),My=class t{get root(){return this._root}get container(){return this._container}get intrinsics(){return this._intrinscis}get globals(){return this._globals}get api(){return this._api}constructor(e){this._root=e.root,this._container=e.container,this._scopeMapping=e.scopeMapping??new WeakMap,this._intrinscis=e.intrinsics??this.createIntrinscis(),this._api=e.api??this.initApi(),this._globals=e.globals??this.initGlobals()}createIntrinscis(){return{map:this._container.primitives.get(Ur.SignatureDefinitionBaseType.Map),funcRef:this._container.primitives.get(Ur.SignatureDefinitionBaseType.Function),number:this._container.primitives.get(Ur.SignatureDefinitionBaseType.Number),string:this._container.primitives.get(Ur.SignatureDefinitionBaseType.String),list:this._container.primitives.get(Ur.SignatureDefinitionBaseType.List)}}initApi(){let e=this._container.primitives.get(Ur.SignatureDefinitionBaseType.General);return e.resolveProperty("map",!0).setReturnEntity(this._intrinscis.map),e.resolveProperty("funcRef",!0).setReturnEntity(this._intrinscis.funcRef),e.resolveProperty("number",!0).setReturnEntity(this._intrinscis.number),e.resolveProperty("string",!0).setReturnEntity(this._intrinscis.string),e.resolveProperty("list",!0).setReturnEntity(this._intrinscis.list),e}initGlobals(){return new eE.Entity({kind:Q0.CompletionItemKind.Constant,container:this._container,label:"globals"}).addType(Ur.SignatureDefinitionBaseType.Map)}analyzeScope(e){let n=this._scopeMapping.get(e.scope),r=new tE.Scope({container:this._container,parent:n?.scope,globals:this._globals}),i=new Z0.Aggregator({scope:r,root:e,document:this,parent:n?.aggregator});this._scopeMapping.set(e,{scope:r,aggregator:i});let s=e.assignment instanceof ZM.ASTAssignmentStatement?this.resolveNamespace(e.assignment.variable,!0):null;if(s!==null){let o=s?.context;o!=null&&o.types.has(Ur.SignatureDefinitionBaseType.Map)&&o!==this._globals&&r.setContext(o)}if(i.analyze(),s!==null){let o=s.signatureDefinitions.last();if(o!=null){let a=o.getArguments();for(let u=0;u<a.length;u++){let c=a[u],l=r.resolveProperty(c.getLabel(),!0),d=c.getTypes().map(p=>p.type);l===null?r.setProperty(c.getLabel(),new eE.Entity({kind:Q0.CompletionItemKind.Variable,container:this._container}).addType(...d)):(l.types.delete(Ur.SignatureDefinitionBaseType.Any),l.addType(...d))}}}}analyze(){let e=new tE.Scope({container:this._container,globals:this._globals,locals:this._globals}),n=new Z0.Aggregator({scope:e,root:this._root,document:this});this._scopeMapping.set(this._root,{scope:e,aggregator:n}),n.analyze();for(let r=0;r<this._root.scopes.length;r++){let i=this._root.scopes[r];this.analyzeScope(i)}}getRootScopeContext(){return this._scopeMapping.get(this._root)}getAllScopeContexts(){return[this._root,...this._root.scopes].map(e=>this._scopeMapping.get(e))}getScopeContext(e){return this._scopeMapping.get(e)??null}getLastASTItemOfLine(e){let n=this._root.lines[e];return n&&n.length>0?n[n.length-1]:null}findASTItemInLine(e,n){let r=this._root.lines[e];if(r&&r.length>0){let i=r.find(s=>s.type===n);if(i)return i}return null}resolveAllAssignmentsWithQuery(e){let n=[],r=[this._root,...this._root.scopes];for(let i=0;i<r.length;i++){let o=this._scopeMapping.get(r[i]).aggregator.definitions;for(let a of o.keys())if(a.includes(e)){let u=o.get(a);n.push(...u)}}return n}resolveAvailableAssignments(e){return this._scopeMapping.get(e.scope)?.aggregator.resolveAvailableAssignments(e)??[]}resolveType(e,n){return this._scopeMapping.get(e.scope)?.aggregator.resolveType(e,n)??null}resolveTypeWithDefault(e,n){return this._scopeMapping.get(e.scope)?.aggregator.resolveTypeWithDefault(e,n)}resolveNamespace(e,n=!1){return this._scopeMapping.get(e.scope)?.aggregator.resolveNamespace(e,n)??null}merge(...e){let n=new t({root:this._root,container:this._container.copy()});for(let r of e)n._globals.extend(r._globals.copy({line:-1})),n._intrinscis.map.extend(r._intrinscis.map.copy({line:-1})),n._intrinscis.funcRef.extend(r._intrinscis.funcRef.copy({line:-1})),n._intrinscis.number.extend(r._intrinscis.number.copy({line:-1})),n._intrinscis.string.extend(r._intrinscis.string.copy({line:-1})),n._intrinscis.list.extend(r._intrinscis.list.copy({line:-1})),n._container.mergeCustomTypes(r._container);return n.analyze(),n}};ad.Document=My});var jy=g(ud=>{"use strict";Object.defineProperty(ud,"__esModule",{value:!0});ud.ContainerProxy=void 0;var rr=Un(),xi=uo(),nE=ns(),rE=La(),Ny=Xl(),qy=class t{get primitives(){return this._primitives}get types(){return this._types}constructor(e){this._container=e.container,this._primitives=e.primitives??this.createPrimitives(),this._types=e.types??this.createTypes(),this._customTypes=new Set}createPrimitives(){let e=new Map;for(let[n,r]of this._container.getPrimitives()){let i=new xi.Entity({kind:nE.CompletionItemKind.Constant,container:this,isAPI:n===rr.SignatureDefinitionBaseType.General}).addType(rr.SignatureDefinitionBaseType.Map).insertSignature(r);e.set(n,i)}return e}createTypes(){let e=new Map;for(let[n,r]of this._container.getTypes()){let i=new xi.Entity({kind:nE.CompletionItemKind.Constant,container:this}).addType(rr.SignatureDefinitionBaseType.Map).insertSignature(r);e.set(n,i)}return e}setCustomType(e,n){this._types.has(e)||(this._types.set(e,n),this._customTypes.add(e))}mergeCustomTypes(e){for(let n of e._customTypes){let r=e._types.get(n);r!=null&&this.setCustomType(n,r.copy({deepCopy:!0,line:-1}))}}getTypeSignature(e){return this._primitives.get(e)??this._types.get(e)??null}searchDefinitionMatches(e,n){if(typeof e=="string")return this.searchDefinitionMatches([e],n);let r=e.includes(rr.SignatureDefinitionBaseType.Any)?new Set(this._container.getAllVisibleTypes()):new Set(e),i=new Map;for(let s of r){let o=this.getTypeSignature(s);if(o===null)continue;let a=(0,Ny.lookupProperty)(o,n);a!==null&&i.set(s,a)}return i}getDefinition(e,n,r=!1){if(typeof e=="string")return this.getDefinition([e],n);let i=(0,Ny.lookupProperty)(this._primitives.get(rr.SignatureDefinitionBaseType.Any),n);if(e.includes(rr.SignatureDefinitionBaseType.Any)&&i)return(0,xi.resolveEntity)(this,i,r);let s=this.searchDefinitionMatches(e,n);return s.size===0?null:s.size===1?(0,xi.resolveEntity)(this,s.values().next().value,r):s.has(rr.SignatureDefinitionBaseType.Any)?(0,xi.resolveEntity)(this,s.get(rr.SignatureDefinitionBaseType.Any),r):i!==null?(0,xi.resolveEntity)(this,i,r):(0,xi.resolveEntity)(this,s.values().next().value,r)}getGeneralDefinition(e,n=!1){let r=(0,Ny.lookupProperty)(this._primitives.get(rr.SignatureDefinitionBaseType.General),e);return r==null?null:(0,xi.resolveEntity)(this,r,n)}injectTypeIdentifiers(e,n){let r=this.getTypeSignature(n);if(r!=null&&((0,rE.injectIdentifers)(e,r),this._types.has(n))){let i=this._primitives.get(rr.SignatureDefinitionBaseType.Map);(0,rE.injectIdentifers)(e,i)}}getAllIdentifier(e){let n=new Map;if(e===rr.SignatureDefinitionBaseType.Any){for(let r of this._container.getAllVisibleTypes())this.injectTypeIdentifiers(n,r);return n}return this.injectTypeIdentifiers(n,e),n}copy(){return new t({container:this._container})}};ud.ContainerProxy=qy});var iE=g(cd=>{"use strict";Object.defineProperty(cd,"__esModule",{value:!0});cd.TypeManager=void 0;var eL=Ly(),tL=jy(),Fy=class{constructor(e){this._container=new tL.ContainerProxy({container:e.container}),this._types=new Map}analyze(e,n){let r=new eL.Document({container:this._container.copy(),root:n});try{r.analyze()}catch(i){console.error(i)}return this._types.set(e,r),r}get(e){return this._types.get(e)??null}};cd.TypeManager=Fy});var za=g(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.TypeManager=oe.ContainerProxy=oe.Document=oe.Aggregator=oe.Scope=oe.Entity=oe.lookupProperty=oe.isEligibleForProperties=oe.injectIdentifers=oe.isSignatureDefinitionFunction=oe.isResolveChainItemWithValue=oe.isResolveChainItemWithMember=oe.isResolveChainItemWithIndex=oe.isResolveChainItemWithIdentifier=oe.CompletionItemKind=oe.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION=oe.ObjectSetIterator=oe.ObjectSet=oe.rotateBits=oe.getStringHashCode=oe.getHashCode=oe.createResolveChain=oe.enrichWithMetaInformation=oe.createExpressionId=oe.createExpressionHash=oe.isValidIdentifierLiteral=void 0;var nL=ha();Object.defineProperty(oe,"isValidIdentifierLiteral",{enumerable:!0,get:function(){return nL.isValidIdentifierLiteral}});var rL=ax();Object.defineProperty(oe,"createExpressionHash",{enumerable:!0,get:function(){return rL.createExpressionHash}});var iL=Vg();Object.defineProperty(oe,"createExpressionId",{enumerable:!0,get:function(){return iL.createExpressionId}});var sL=Jm();Object.defineProperty(oe,"enrichWithMetaInformation",{enumerable:!0,get:function(){return sL.enrichWithMetaInformation}});var oL=Qm();Object.defineProperty(oe,"createResolveChain",{enumerable:!0,get:function(){return oL.createResolveChain}});var $y=Gg();Object.defineProperty(oe,"getHashCode",{enumerable:!0,get:function(){return $y.getHashCode}});Object.defineProperty(oe,"getStringHashCode",{enumerable:!0,get:function(){return $y.getStringHashCode}});Object.defineProperty(oe,"rotateBits",{enumerable:!0,get:function(){return $y.rotateBits}});var sE=ny();Object.defineProperty(oe,"ObjectSet",{enumerable:!0,get:function(){return sE.ObjectSet}});Object.defineProperty(oe,"ObjectSetIterator",{enumerable:!0,get:function(){return sE.ObjectSetIterator}});var aL=ry();Object.defineProperty(oe,"DEFAULT_CUSTOM_FUNCTION_DESCRIPTION",{enumerable:!0,get:function(){return aL.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION}});var uL=ns();Object.defineProperty(oe,"CompletionItemKind",{enumerable:!0,get:function(){return uL.CompletionItemKind}});var ld=iy();Object.defineProperty(oe,"isResolveChainItemWithIdentifier",{enumerable:!0,get:function(){return ld.isResolveChainItemWithIdentifier}});Object.defineProperty(oe,"isResolveChainItemWithIndex",{enumerable:!0,get:function(){return ld.isResolveChainItemWithIndex}});Object.defineProperty(oe,"isResolveChainItemWithMember",{enumerable:!0,get:function(){return ld.isResolveChainItemWithMember}});Object.defineProperty(oe,"isResolveChainItemWithValue",{enumerable:!0,get:function(){return ld.isResolveChainItemWithValue}});var cL=sy();Object.defineProperty(oe,"isSignatureDefinitionFunction",{enumerable:!0,get:function(){return cL.isSignatureDefinitionFunction}});var lL=La();Object.defineProperty(oe,"injectIdentifers",{enumerable:!0,get:function(){return lL.injectIdentifers}});var dL=Kl();Object.defineProperty(oe,"isEligibleForProperties",{enumerable:!0,get:function(){return dL.isEligibleForProperties}});var fL=Xl();Object.defineProperty(oe,"lookupProperty",{enumerable:!0,get:function(){return fL.lookupProperty}});var pL=uo();Object.defineProperty(oe,"Entity",{enumerable:!0,get:function(){return pL.Entity}});var hL=dy();Object.defineProperty(oe,"Scope",{enumerable:!0,get:function(){return hL.Scope}});var gL=Iy();Object.defineProperty(oe,"Aggregator",{enumerable:!0,get:function(){return gL.Aggregator}});var mL=Ly();Object.defineProperty(oe,"Document",{enumerable:!0,get:function(){return mL.Document}});var yL=jy();Object.defineProperty(oe,"ContainerProxy",{enumerable:!0,get:function(){return yL.ContainerProxy}});var bL=iE();Object.defineProperty(oe,"TypeManager",{enumerable:!0,get:function(){return bL.TypeManager}})});var By=g(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.getSymbolItemKind=fo.getCompletionItemKind=void 0;var Xt=za(),vL=t=>{switch(t){case Xt.CompletionItemKind.Constant:return 21;case Xt.CompletionItemKind.Variable:return 6;case Xt.CompletionItemKind.Expression:return 6;case Xt.CompletionItemKind.Function:return 3;case Xt.CompletionItemKind.ListConstructor:case Xt.CompletionItemKind.MapConstructor:case Xt.CompletionItemKind.Literal:case Xt.CompletionItemKind.Unknown:return 12}};fo.getCompletionItemKind=vL;var _L=t=>{switch(t){case Xt.CompletionItemKind.Constant:return 14;case Xt.CompletionItemKind.Variable:return 13;case Xt.CompletionItemKind.Expression:return 13;case Xt.CompletionItemKind.Function:return 12;case Xt.CompletionItemKind.ListConstructor:return 18;case Xt.CompletionItemKind.MapConstructor:return 19;case Xt.CompletionItemKind.Literal:case Xt.CompletionItemKind.Unknown:return 13}};fo.getSymbolItemKind=_L});var Hy=g(dd=>{"use strict";Object.defineProperty(dd,"__esModule",{value:!0});dd.findEx=void 0;var TL=Ne(),SL=function(t){return{ParenthesisExpression:(e,n)=>{t(e.expression,n)},AssignmentStatement:function(e,n){t(e.init,n),t(e.variable,n)},MemberExpression:function(e,n){t(e.base,n),t(e.identifier,n)},FunctionDeclaration:function(e,n){for(let r=0;r<e.parameters.length;r++)t(e.parameters[r],n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},MapConstructorExpression:function(e,n){for(let r=0;r<e.fields.length;r++)t(e.fields[r],n)},ReturnStatement:function(e,n){e.argument&&t(e.argument,n)},WhileStatement:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},IndexExpression:function(e,n){t(e.base,n),t(e.index,n)},SliceExpression:function(e,n){t(e.base,n),t(e.left,n),t(e.right,n)},ListValue:function(e,n){t(e.value,n)},MapKeyString:function(e,n){t(e.key,n),t(e.value,n)},IfShortcutStatement:function(e,n){for(let r=0;r<e.clauses.length;r++)t(e.clauses[r],n)},IfShortcutClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseifShortcutClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseShortcutClause:function(e,n){for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ForGenericStatement:function(e,n){t(e.variable,n),t(e.iterator,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},IfStatement:function(e,n){for(let r=0;r<e.clauses.length;r++)t(e.clauses[r],n)},IfClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseifClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseClause:function(e,n){for(let r=0;r<e.body.length;r++)t(e.body[r],n)},NegationExpression:function(e,n){t(e.argument,n)},CallExpression:function(e,n){t(e.base,n);for(let r=0;r<e.arguments.length;r++)t(e.arguments[r],n)},CallStatement:function(e,n){t(e.expression,n)},ListConstructorExpression:function(e,n){for(let r=0;r<e.fields.length;r++)t(e.fields[r],n)},BinaryExpression:function(e,n){t(e.left,n),t(e.right,n)},BinaryNegatedExpression:function(e,n){t(e.argument,n)},IsaExpression:function(e,n){t(e.left,n),t(e.right,n)},LogicalExpression:function(e,n){t(e.left,n),t(e.right,n)},ComparisonGroupExpression:function(e,n){for(let r=0;r<e.expressions.length;r++)t(e.expressions[r],n)},UnaryExpression:function(e,n){t(e.argument,n)},Chunk:function(e,n){for(let r=0;r<e.body.length;r++)t(e.body[r],n)},InvalidCodeExpression:()=>{}}},Uy=class{constructor(e){this.map=SL(this.visit.bind(this)),this.callback=e,this.state={exit:!1}}visit(e,n=0){let r=this;if(e==null)return;if(e.type==null)throw console.error("Error ast type:",e),new Error("Unexpected as type");if(r.state=r.callback(e,n),r.state.exit||r.state.skip)return;let i=r.map[e.type];i?.call(r,e,n+1)}};function kL(t,e){let n=[];return new Uy((i,s)=>{let o=t(i,s)||{};return o.valid&&i.type!==TL.ASTType.InvalidCodeExpression&&n.push(i),{exit:!!o.exit,skip:!!o.skip}}).visit(e),n}dd.findEx=kL});var oE=g((pU,xL)=>{xL.exports={insert:{description:"Depending on the data type this method will insert a value to the provided index. Due to the insertion, the object will be mutated. To get a better idea about the behaviour look into the `insert` method related to `list` or `string`.",example:["list = [2, 3, 4]","list.insert(2, 42)",'print("List with inserted item: " + list.join(", "))']},indexOf:{description:"Depending on the data type this function searches for the index of the provided value. To get a better idea about the behaviour look into the `indexOf` methods related to `string`, `list` and `map`.",example:['index = "test".indexOf("e")','print("e is at: " + index)']},hasIndex:{description:"Depending on data type this function checks if the provided index is available inside the value. To get a better idea about the behaviour look into the `hasIndex` methods related to `string`, `list` and `map`.",example:['print("List has index: " + [1, 2, 3].hasIndex(2)']},remove:{description:"Depending on the data type this function will remove a value in the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `remove` methods related to `list` and `map`.",example:["list = [9, 3, 5, 7]","list.remove(5)",'print("List after removal: " + list.join(", "))']},push:{description:"Depending on data type this function will append a value to the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `push` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","list.push(42)",'print("The answer to everything is: " + list.pop)']},pull:{description:"Depending on data type this function will return the first item in the provided value. Additionally, this function removes the last item and therefore mutates the object. To get a better idea about the behaviour look into the `pop` methods related to `list` and `map`.",example:["myList = [42, 1, 3]","answer = myList.pull",'print("Answer to everything: " + answer)']},pop:{description:"Depending on data type this function will return the last item in the provided value. Additionally, this function removes the last item and therefore mutates the object. To get a better idea about the behaviour look into the `pop` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("The last item is: " + list.pop)']},shuffle:{description:"Depending on data type this function will shuffle data. Instead of returning the newly shuffled data, this function will mutate the data. To get a better idea about the behaviour look into the `shuffle` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","list.shuffle",'print("And the winner is: " + list[0])']},sum:{description:"Depending on data type this function returns the sum of all items. To get a better idea about the behaviour look into the `sum` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("Sum of all items is: " + list.sum)']},indexes:{description:"Depending on data type this function returns a `list` with all available indexes. To get a better idea about the behaviour look into the `indexes` methods related to `string`, `list` and `map`.",example:['indexesOfStr = "test".indexes','print("Following indexes are available: " + indexesOfStr.join(", "))']},len:{description:"Depending on data type this function returns the length of the provided value. To get a better idea about the behaviour look into the `len` methods related to `string`, `list` and `map`.",example:['length = "test".len','print("Length of string is: " + length)']},values:{description:"Depending on data type this function returns a `list` with all available values. To get a better idea about the behaviour look into the `values` methods related to `string`, `list` and `map`.",example:['indexesOfStr = "test".values','print("Following values are available: " + indexesOfStr.join(", "))']}}});var aE=g((hU,wL)=>{wL.exports={hasIndex:{description:"Depending on data type this function checks if the provided index is available inside the value. To get a better idea about the behaviour look into the `hasIndex` methods related to `string`, `list` and `map`.",example:['print("List has index: " + hasIndex([1, 2, 3], 2)']},print:{description:"Print a message on the Terminal.",example:['print("hello world")']},indexes:{description:"Depending on data type this function returns a `list` with all available indexes. To get a better idea about the behaviour look into the `indexes` methods related to `string`, `list` and `map`.",example:['indexesOfStr = indexes("test")','print("Following indexes are available: " + indexesOfStr.join(", "))']},values:{description:"Depending on data type this function returns a `list` with all available values. To get a better idea about the behaviour look into the `values` methods related to `string`, `list` and `map`.",example:['indexesOfStr = values("test")','print("Following values are available: " + indexesOfStr.join(", "))']},indexOf:{description:"Depending on the data type this function searches for the index of the provided value. To get a better idea about the behaviour look into the `indexOf` methods related to `string`, `list` and `map`.",example:['index = indexOf("test", "e")','print("e is at: " + index)']},len:{description:"Depending on data type this function returns the length of the provided value. To get a better idea about the behaviour look into the `len` methods related to `string`, `list` and `map`.",example:['length = len("test")','print("Length of string is: " + length)']},shuffle:{description:"Depending on data type this function will shuffle data. Instead of returning the newly shuffled data, this function will mutate the data. To get a better idea about the behaviour look into the `shuffle` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","shuffle(list)",'print("And the winner is: " + list[0])']},val:{description:"Casts a `string` to a `number`. In case the provided `string` does not represent a valid `number` the `number` zero will get returned.",example:['num = val("1.25")','print("Number in string is: " + num)']},lower:{description:"Returns a `string` which is the lowercase transformed version of the provided `string`.",example:['myString = lower("HELLO WORLD")',"print(myString)"]},upper:{description:"Returns a `string` which is the uppercase transformed version of the provided `string`.",example:['myString = upper("hello world")',"print(myString)"]},sum:{description:"Depending on data type this function returns the sum of all items. To get a better idea about the behaviour look into the `sum` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("Sum of all items is: " + sum(list))']},pop:{description:"Depending on data type this function will return the last item in the provided value. Additionally, this function removes the last item and therefore mutates the object. To get a better idea about the behaviour look into the `pop` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("The last item is: " + pop(list))']},pull:{description:"Depending on data type this function will return the first item in the provided value. Additionally, this function removes the first item and therefore mutates the object. To get a better idea about the behaviour look into the `pull` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("The first item is: " + pull(list))']},push:{description:"Depending on data type this function will append a value to the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `push` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","push(list, 42)",'print("The answer to everything is: " + pop(list))']},sort:{description:"Depending on the data type this function will sort the values in the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `sort` methods related to `list` and `map`.",example:["list = [9, 3, 5, 7]","sort(list)",'print("Sorted list: " + list.join(", "))']},remove:{description:"Depending on the data type this function will remove a value in the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `remove` methods related to `list` and `map`.",example:["list = [9, 3, 5, 7]","remove(list, 5)",'print("List after removal: " + list.join(", "))']},wait:{description:"Puts script execution on hold. Optionally the duration can be provided via the time argument. By default, the duration will be 1 second. The duration cannot be below 0.01 or above 300.",example:["start = time","wait(5)","elapsed = time - start",'print("Waited: " + elapsed)']},bitwise:{description:'Enables to perform bitwise operations. Supported operators are: `"&"`, `"|"`, `"^"`, `"<<"`, `">>"`, `">>>"`. Returns a `number`.',example:["num = params[0].to_int",'isOdd = bitwise("&", num, 1) == 1',"if isOdd then",' print("Number is odd.")',"else",' print("Number is even.")',"end if"]},abs:{description:"Returns the absolute value of `number`.",example:["a = 1","b = 5","difference = abs(a - b)",'print("Difference between a and b is: " + difference)']},acos:{description:"Returns the inverse cosine (in radians) of a `number`.",example:["adjacent = 8","hypotenuse = 10","calcAngle = acos(adjacent / hypotenuse)",'print("Angle: " + calcAngle)']},asin:{description:"Returns the inverse sine (in radians) of a `number`.",example:["opposite = 6","hypotenuse = 10","calcAngle = acos(opposite / hypotenuse)",'print("Angle: " + calcAngle)']},atan:{description:"Returns the inverse tangent (in radians) of a `number`.",example:["opposite = 8","hypotenuse = 10","calcAngle = atan(opposite / hypotenuse)",'print("Angle: " + calcAngle)']},tan:{description:"Returns the tangent of a `number` in radians.",example:["degrees = 90","tanFromDegrees = tan(degress * pi / 180)",'print("Tan from degrees: " + tanFromDegrees)']},cos:{description:"Returns the cosine of a `number` in radians.",example:["radians = 1","radius = 10","circleX = cos(radians) * radius","print(circleX)"]},code:{description:"Returns the Unicode `number` of the first character of the string. In case an empty `string` is provided the script execution will crash.",example:['key = user_input("Press a key!", false, true)',"isA = key.code == 97","if isA then",' print("You pressed A.")',"else",' print("You did not press A.")',"end if"]},char:{description:"Returns the Unicode character `string` related to the provided unicode `number`. The provided `number` needs to be between 0 and 65535. Any `number` which is outside this range will cause the script to throw a runtime error.",example:['key = user_input("Press a key!", false, true)',"isA = key == char(97)","if isA then",' print("You pressed A.")',"else",' print("You did not press A.")',"end if"]},sin:{description:"Returns the sine of a `number` in radians.",example:["radians = 1","radius = 10","circleY = sin(radians) * radius","print(circleY)"]},floor:{description:"Returns `number` rounded down to the integer value of the provided `number`.",example:["price = 25.43467","floored = floor(price * 100) / 100",'print("Floored price: " + floored)']},range:{description:"Returns a `list` where each item is a `number`. By default, the `list` starts with the `number` zero and increments by one for each item. Optionally start and end can be defined. Additionally, the incremental value can be changed as well. In case the incremental value is zero this function will throw a runtime error.",example:['print("Countdown:")',"for num in range(10)"," print(num)","end for",'print("Done!")']},round:{description:"Returns `number` rounded to the integer value of the provided `number`.",example:["price = 25.43467","rounded = round(price * 100) / 100",'print("Price: " + rounded)']},rnd:{description:"Returns a random `number` between 0 and 1. Optionally a seed `number` can be provided.",example:["min = 10","max = 20","output = floor(rnd * (max - min + 1) + min)",'input = user_input("Guess a number between 10 and 20!").to_int',"if (input == output) then",' print("You guessed right!")',"else",' print("You failed! The number was " + output)',"end if"]},sign:{description:"Returns a one or minus one, indicating the sign of the number passed as argument. If the input is zero, it will be returned as-is.",example:["print(sign(40))","print(sign(-40))","print(sign(0))"]},sqrt:{description:"Returns the square root of a `number`.",example:["a = 3","b = 4","calcHypotenuse = sqrt((a * a) + (b * b))",'print("Hypotenuse: " + calcHypotenuse)']},str:{description:"Returns the `string` value of provided data. Can be used to turn a `number` into a `string` or to get the signature of a `function`.",example:["signature = str(@user_input)","argSegment = signature[9:signature.len - 1]",'args = argSegment.split(",")','print("Function has " + args.len + " arguments.")']},ceil:{description:"Returns `number` rounded up to the integer value of the provided `number`.",example:["price = 25.43467","upperPrice = ceil(price * 100) / 100",'print("Upper price: " + upperPrice)']},pi:{description:"Returns the `number` PI to the precision of six.",example:["radius = 10","circumference = 2 * pi * radius",'print("Circumference: " + circumference)']},slice:{description:"Returns a sliced `list`. Valid data types for slicing are `string` and `list`. The returned `list` will contain all elements related to the provided start and end index.",example:['myString = "not your text"','print("my " + slice(myString, 9))']},hash:{description:"Returns numeric hash for the provided data.",example:['hashA = hash({ "a": 2, "b": 1 })','hashB = hash({ "b": 1, "a": 2 })',"if (hashA == hashB) then",' print("Objects are alike!")',"else",' print("Objects are different!")',"end if"]},time:{description:"Returns a `number` of seconds representing the elapsed time since the script got started.",example:["start = time","for i in range(10000)"," var = i * 100","end for","endTime = time - start",'print("Script execution done within: " + endTime)']},bitAnd:{description:"Performs a bitwise AND for the provided values. Returns a `number`.",example:['print("Result of bitwise AND: " + bitAnd(1, 2))']},bitOr:{description:"Performs a bitwise OR for the provided values. Returns a `number`.",example:['print("Result of bitwise OR: " + bitOr(1, 2))']},bitXor:{description:"Permorms a bitwise XOR for the provided values. Returns a `number`.",example:['print("Result of bitwise XOR: " + bitXor(1, 2))']},log:{description:"Returns the natural logarithm of a `number`. By default, the base is 10. Optionally the base can be changed.",example:["a = 2","b = 8","baseLog = log(a) / log(b)",'print("Base log is: " + baseLog)']},yield:{description:"Waits for the next tick.",example:["while (true)"," yield",' print("tick")',"end while"]},get_custom_object:{description:"Returns `map` which is shared throughout all script executions. Can be helpful in case forwarding an entity is desired.",example:["get_custom_object.shouldEndScript = false","while (get_custom_object.shouldEndScript)",' print("Waiting...")'," wait(2)","end while"]},insert:{description:"Depending on the data type this function will insert a value to the provided index. Due to the insertion, the object will be mutated. To get a better idea about the behaviour look into the `insert` method related to `list` or `string`.",example:["list = [2, 3, 4]","insert(list, 2, 42)",'print("List with inserted item: " + list.join(", "))']},join:{description:"Returns a concatenated `string` containing all stringified values inside the `list`. These values will be separated via the provided separator.",example:["myList = [42, 1, 3]",`print(join(myList, " .-*'*-. "))`]},split:{description:"Returns a `list` where each item is a segment of the `string`. The separation depends on the provided separator `string`. Keep in mind that for some odd reason, this method is using regular expressions for matching.",example:['myString = "42 as an answer is wrong"','segments = split(myString, " ")','if segments[0] != "42" then',' print("Invalid information spotted!")',"else",' print("Information seems valid!")',"end if"]},replace:{description:"Depending on the data type this function will replace a value in the provided object. Due to the replacement, the object might get mutated. To get a better idea about the behaviour look into the `replace` method related to `map`, `list` or `string`.",example:['myString = "42 as an answer is wrong"','newString = replace(myString, "wrong", "right")',"print(newString)"]},refEquals:{description:"Tests whether two values refer to the very same object (rather than merely representing the same value). For numbers, this is the same as ==, but for strings, lists, and maps, it is reference equality."},version:{description:`Get a map with information about the version of MiniScript and the host environment that you're currently running. This will include at least the following keys:
114
114
  miniscript: a string such as "1.5"
115
115
  buildDate: a date in yyyy-mm-dd format, like "2020-05-28"
116
116
  host: a number for the host major and minor version, like 0.9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miniscript-languageserver",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "description": "Language server for MiniScript",
5
5
  "main": "./index.js",
6
6
  "scripts": {
@@ -70,7 +70,7 @@
70
70
  "greybel-core": "~2.1.1",
71
71
  "miniscript-meta": "~1.2.3",
72
72
  "greybel-transpiler": "~3.2.4",
73
- "miniscript-type-analyzer": "~0.10.5",
73
+ "miniscript-type-analyzer": "~0.11.1",
74
74
  "miniscript-languageserver-core": "^1.3.1"
75
75
  }
76
76
  }