miniscript-languageserver 1.9.3 → 1.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +2 -2
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -112,7 +112,7 @@ ${e}`;for(let a=0;a<this.details.length;++a){let u=a+1;o=`${o}
112
112
 
113
113
  `)}else if(i instanceof Ee.ASTComment)return(0,uC.normalizeText)(i.value);return n}resolveFunctionStatement(e){let n=this.createFunctionDescription(e),r=Te.SignatureDefinitionFunction.parse({type:Te.SignatureDefinitionBaseType.Function,description:n,arguments:e.parameters.map(i=>{if(i.type===Ee.ASTType.Identifier)return{label:i.name??"unknown",type:Te.SignatureDefinitionBaseType.Any};let s=i;return{label:s.variable?.name??"unknown",types:Array.from(this.resolveTypeWithDefault(s.init).types)}}),returns:["any"]});return this.factory(we.CompletionItemKind.Function).addType(Te.SignatureDefinitionBaseType.Function).addSignatureType((0,VF.enrichWithMetaInformation)(r)).setLine(e.start.line)}resolveParenthesisExpression(e){return this.resolveTypeWithDefault(e.expression)}resolveBinaryExpression(e){let n=this.factory(we.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(we.CompletionItemKind.Expression).setLabel("Logical Expr").addType(Te.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveComparisonGroupExpression(e){return this.factory(we.CompletionItemKind.Expression).setLabel("Comparison Group Expr").addType(Te.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveIsaExpression(e){return this.factory(we.CompletionItemKind.Expression).setLabel("Isa Expr").addType(Te.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveCallStatement(e){let n=this.resolveNamespace(e);return n===null?this.factory(we.CompletionItemKind.Variable).addType(Te.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveCallExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(we.CompletionItemKind.Variable).addType(Te.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveUnaryExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(we.CompletionItemKind.Variable).addType(Te.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveMapConstructorExpression(e){let n=this.factory(we.CompletionItemKind.MapConstructor).addType(Te.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){let o=i.key.value.toString();n.setProperty(o,s),n.values.get(`${iC.PropertyType.Identifier}:${o}`)?.definitions.push({source:this._document.source,node:i})}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(we.CompletionItemKind.ListConstructor).addType(Te.SignatureDefinitionBaseType.List);for(let r=0;r<e.fields.length;r++){let i=e.fields[r],s=this.factory(we.CompletionItemKind.Variable).addType(Te.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(we.CompletionItemKind.Variable).addType(Te.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(we.CompletionItemKind.Variable).addType(Te.SignatureDefinitionBaseType.Any).setLine(e.start.line):r}resolveMemberExpression(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(we.CompletionItemKind.Property).addType(Te.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(we.CompletionItemKind.Property).addType(Te.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(we.CompletionItemKind.Literal).addType("null").setLabel("null").setLine(e.start.line);case Ee.ASTType.StringLiteral:{let r=e.value.toString();return this.factory(we.CompletionItemKind.Literal).addType(Te.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(we.CompletionItemKind.Literal).addType(Te.SignatureDefinitionBaseType.Number).setLabel(r).setLine(e.start.line)}case Fu.ASTType.FeatureFileExpression:return this.factory(we.CompletionItemKind.Expression).addType(Te.SignatureDefinitionBaseType.String).setLabel("File Expr").setLine(e.start.line);case Fu.ASTType.FeatureLineExpression:return this.factory(we.CompletionItemKind.Expression).addType(Te.SignatureDefinitionBaseType.Number).setLabel("Line Expr").setLine(e.start.line);case Fu.ASTType.FeatureEnvarExpression:return this.factory(we.CompletionItemKind.Expression).addType(Te.SignatureDefinitionBaseType.String).setLabel("Envar Expr").setLine(e.start.line);case Fu.ASTType.FeatureInjectExpression:return this.factory(we.CompletionItemKind.Expression).addType(Te.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(we.CompletionItemKind.Variable).addType(Te.SignatureDefinitionBaseType.Any);return e!=null&&i.setLine(e.start.line),i}return r}resolveChain(e,n=!1,r=!1){if(e.length===0)return null;let i=new Id(this,e,n,r),s=null,o=i.next();for(;!o.done;)s=o.value,o=i.next();return s}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(we.CompletionItemKind.Property).addType(Te.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,oC.createResolveChain)(e);return this.resolveChain(r,n)}defineProperty(e,n,r){let i=e.setProperty(n,r);return this._lastModifiedProperty=e.resolveProperty(n,!0),i}defineNamespace(e,n){let r=(0,oC.createResolveChain)(e),i=r.pop();if(this._lastModifiedProperty=null,r.length>0){let o=this.resolveChain(r,!1,!0);if(o===null)return!1;if((0,Bs.isResolveChainItemWithMember)(i))return this.defineProperty(o,i.getter.name,n);if((0,Bs.isResolveChainItemWithIndex)(i)){if((0,cC.isValidIdentifierLiteral)(i.getter))return this.defineProperty(o,i.getter.value.toString(),n);{let a=this.resolveTypeWithDefault(i.getter);return this.defineProperty(o,a,n)}}return!1}let s=this._scope;return(0,Bs.isResolveChainItemWithIdentifier)(i)?this.defineProperty(s,i.getter.name,n):!1}addDefinition(e,n){this._lastModifiedProperty?.definitions.push({source:this._document.source,node:e});let r=(0,sC.createExpressionId)(n),i=this._definitions;r.startsWith("globals.")?(i=this._document.getRootScopeContext().aggregator.definitions,r=r.slice(8)):r.startsWith("locals.")?(i=this._definitions,r=r.slice(7)):r.startsWith("outer.")&&(i=this.parent.definitions,r=r.slice(6));let s=i.get(r);s?s.push({source:this._document.source,node:e}):i.set(r,[{source:this._document.source,node:e}])}resolveAvailableAssignmentsWithQuery(e){let n=[];return new Set([this,this._parent,this._document.getRootScopeContext().aggregator]).forEach(i=>{let s=i.definitions;s.forEach((o,a)=>{if(a.includes(e)){let u=s.get(a);(0,aC.merge)(n,u)}})}),n}resolveAvailableAssignments(e){let n=(0,sC.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=[];return new Set([r,r._parent,r._document.getRootScopeContext().aggregator]).forEach(o=>{if(o==null)return;let a=o.resolveNamespace(e,!0);a!=null&&(0,aC.merge)(i,a.definitions)}),i}analyzeAssignmentDefinition(e){let n=this.resolveType(e.init)?.copy({source:this._document.source}).setLine(e.start.line)??this.factory(we.CompletionItemKind.Variable).addType(Te.SignatureDefinitionBaseType.Any).setLine(e.start.line);this.defineNamespace(e.variable,n),this.addDefinition(e,e.variable)}analyzeForDefinition(e){let n=this.resolveType(e.iterator)?.copy({source:this._document.source}).setLine(e.start.line)??this.factory(we.CompletionItemKind.Variable).addType(Te.SignatureDefinitionBaseType.Any).setLine(e.start.line),r=this.factory(we.CompletionItemKind.Variable).setLine(e.start.line);if(n.types.has(Te.SignatureDefinitionBaseType.List)){let o=n.values.get(`${iC.PropertyType.Type}:number`);o!=null&&r.extend(o)}if(n.types.has(Te.SignatureDefinitionBaseType.String)&&r.addType(Te.SignatureDefinitionBaseType.String),n.types.has(Te.SignatureDefinitionBaseType.Map)){let o=this.factory(we.CompletionItemKind.Variable).addTypes(n.getPropertyTypes()).setLine(e.start.line),a=this.factory(we.CompletionItemKind.Property).addTypes(n.getValueTypes()).setLine(e.start.line);r.addType(Te.SignatureDefinitionBaseType.Map),r.setProperty("key",o),r.setProperty("value",a)}r.types.size===0&&r.addType(Te.SignatureDefinitionBaseType.Any),this.defineNamespace(e.variable,r),this.addDefinition(e,e.variable);let i=this.factory(we.CompletionItemKind.Variable).addType(Te.SignatureDefinitionBaseType.Number).setLine(e.start.line),s=new Ee.ASTIdentifier({name:`__${e.variable.name}_idx`,kind:Ee.ASTIdentifierKind.Variable,range:e.range,start:e.start,end:e.end});this.defineNamespace(s,i),this.addDefinition(e,s)}analyzeImportDefinition(e){let n=e.name,r=this.scope.resolveProperty(n.name,!0);if(r!=null){this._lastModifiedProperty=r,this.addDefinition(e,e.name);return}let i=this.factory(we.CompletionItemKind.Variable).addType(Te.SignatureDefinitionBaseType.Any).setLine(e.start.line);this.defineNamespace(e.name,i),this.addDefinition(e,e.name)}analyze(){for(let e=0;e<this._root.definitions.length;e++){let n=this._root.definitions[e];switch(n.type){case Ee.ASTType.AssignmentStatement:{this.analyzeAssignmentDefinition(n);break}case Ee.ASTType.ForGenericStatement:{this.analyzeForDefinition(n);break}case Fu.ASTType.FeatureImportExpression:{this.analyzeImportDefinition(n);break}}}}extend(e){e.definitions.forEach((n,r)=>{let i=this.definitions.get(r);i?(0,XF.mergeUnique)(i,n):this.definitions.set(r,n)})}};Xo.Aggregator=sv});var uv=m(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});Md.Document=void 0;var vi=jn(),QF=ke(),lC=Ls(),ZF=iv(),hC=ov(),dC=zo(),fC=q_(),av=class t{get source(){return this._source}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._source=e.source,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(vi.SignatureDefinitionBaseType.Map),funcRef:this._container.primitives.get(vi.SignatureDefinitionBaseType.Function),number:this._container.primitives.get(vi.SignatureDefinitionBaseType.Number),string:this._container.primitives.get(vi.SignatureDefinitionBaseType.String),list:this._container.primitives.get(vi.SignatureDefinitionBaseType.List)}}initApi(){let e=this._container.primitives.get(vi.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 dC.Entity({source:this._source,kind:lC.CompletionItemKind.Constant,container:this._container,label:"globals"}).addType(vi.SignatureDefinitionBaseType.Map)}analyzeScope(e){let n=this._scopeMapping.get(e.scope),r=new fC.Scope({source:this._source,container:this._container,parent:n?.scope,globals:this._globals}),i=new hC.Aggregator({scope:r,root:e,document:this,parent:n?.aggregator});this._scopeMapping.set(e,{scope:r,aggregator:i});let s=e.assignment instanceof QF.ASTAssignmentStatement?this.resolveNamespace(e.assignment.variable,!0):null;if(s!==null){let o=s?.context;o!=null&&o.types.has(vi.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),h=c.getTypes();l===null?r.setProperty(c.getLabel(),new dC.Entity({source:this._source,kind:lC.CompletionItemKind.Variable,container:this._container}).addTypesWithMeta(h)):(l.types.delete(vi.SignatureDefinitionBaseType.Any),l.addTypesWithMeta(h))}}}}analyze(){let e=new fC.Scope({source:this._source,container:this._container,globals:this._globals,locals:this._globals}),n=new hC.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];if(!n||n.length===0)return null;let r=n[0];for(let i=1;i<n.length;i++){let s=n[i];(s.start.line>r.start.line||s.start.line===r.start.line&&s.start.character>r.start.character)&&(r=s)}return r}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;o.forEach((a,u)=>{if(u.includes(e)){let c=o.get(u);(0,ZF.merge)(n,c)}})}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({source:this._source,root:this._root,container:this._container.copy()});for(let r=0;r<e.length;r++){let i=e[r];n._globals.extend(i._globals,!0,!0),n._intrinscis.map.extend(i._intrinscis.map,!0,!0),n._intrinscis.funcRef.extend(i._intrinscis.funcRef,!0,!0),n._intrinscis.number.extend(i._intrinscis.number,!0,!0),n._intrinscis.string.extend(i._intrinscis.string,!0,!0),n._intrinscis.list.extend(i._intrinscis.list,!0,!0),n._container.mergeCustomTypes(i._container)}n.analyze();for(let r=0;r<e.length;r++){let i=e[r];n.getRootScopeContext().aggregator.extend(i.getRootScopeContext().aggregator)}return n}};Md.Document=av});var dv=m(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});Ld.ContainerProxy=void 0;var Ar=jn(),cv=Ns(),Si=zo(),pC=Ls(),gC=xu(),lv=vd(),hv=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;return this._container.getPrimitives().forEach((n,r)=>{let i=new Si.Entity({source:"internal",kind:pC.CompletionItemKind.Internal,container:this,isAPI:r===Ar.SignatureDefinitionBaseType.General}).addType(Ar.SignatureDefinitionBaseType.Map).insertSignature(n);e.set(r,i)}),e}createTypes(){let e=new Map;return this._container.getTypes().forEach((n,r)=>{let i=new Si.Entity({source:"internal",kind:pC.CompletionItemKind.Internal,container:this}).addType(Ar.SignatureDefinitionBaseType.Map).insertSignature(n);e.set(r,i)}),e}setCustomType(e,n){this._types.has(e)||(this._types.set(e,n),this._customTypes.add(e))}mergeCustomTypes(e){e._customTypes.forEach(n=>{let r=e._types.get(n);r!=null&&this.setCustomType(n,r.copy({deepCopy:!0}))})}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(Ar.SignatureDefinitionBaseType.Any)?new Set(this._container.getAllVisibleTypes()):new Set(e),i=new Map;return r.forEach(s=>{let o=this.getTypeSignature(s);if(o===null)return;let a=(0,lv.lookupProperty)(cv.PropertyType.Identifier,o,n);a!==null&&i.set(s,a)}),i}getDefinition(e,n,r=!1){if(typeof e=="string")return this.getDefinition([e],n);let i=(0,lv.lookupProperty)(cv.PropertyType.Identifier,this._primitives.get(Ar.SignatureDefinitionBaseType.Any),n);if(e.includes(Ar.SignatureDefinitionBaseType.Any)&&i)return Si.Entity.resolveEntity(this,i,r);let s=this.searchDefinitionMatches(e,n);if(s.size===0)return null;if(s.size===1)return Si.Entity.resolveEntity(this,s.values().next().value,r);if(s.has(Ar.SignatureDefinitionBaseType.Any))return Si.Entity.resolveEntity(this,s.get(Ar.SignatureDefinitionBaseType.Any),r);if(i!==null)return Si.Entity.resolveEntity(this,i,r);let o=s.values().next().value,a=new Si.Entity({source:"internal",label:n,kind:o.kind,container:this});return s.forEach(u=>{let c=Si.Entity.resolveEntity(this,u,r);a.extend(c,!0,!0)}),a}getGeneralDefinition(e,n=!1){let r=(0,lv.lookupProperty)(cv.PropertyType.Identifier,this._primitives.get(Ar.SignatureDefinitionBaseType.General),e);return r==null?null:Si.Entity.resolveEntity(this,r,n)}injectTypeIdentifiers(e,n){let r=this.getTypeSignature(n);if(r!=null&&((0,gC.injectIdentifers)(e,r),this._types.has(n))){let i=this._primitives.get(Ar.SignatureDefinitionBaseType.Map);(0,gC.injectIdentifers)(e,i)}}getAvailableIdentifier(e){let n=new Map;if(e===Ar.SignatureDefinitionBaseType.Any){let r=this._container.getAllVisibleTypes();for(let i=0;i<r.length;i++)this.injectTypeIdentifiers(n,r[i]);return n}return this.injectTypeIdentifiers(n,e),n}copy(){return new t({container:this._container})}};Ld.ContainerProxy=hv});var mC=m(Nd=>{"use strict";Object.defineProperty(Nd,"__esModule",{value:!0});Nd.TypeManager=void 0;var e$=uv(),t$=dv(),fv=class{constructor(e){this._container=new t$.ContainerProxy({container:e.container}),this._types=new Map}analyze(e,n){let r=new e$.Document({source:e,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}};Nd.TypeManager=fv});var Yo=m(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.TypeManager=ee.ContainerProxy=ee.Document=ee.Aggregator=ee.Scope=ee.Entity=ee.aggregateEntity=ee.lookupProperty=ee.isEligibleForProperties=ee.injectIdentifers=ee.isSignatureDefinitionFunction=ee.isResolveChainItemWithValue=ee.isResolveChainItemWithMember=ee.isResolveChainItemWithIndex=ee.isResolveChainItemWithIdentifier=ee.IsaPropertyPattern=ee.IdentifierPropertyPattern=ee.PropertyType=ee.CompletionItemKind=ee.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION=ee.ObjectSetIterator=ee.ObjectSet=ee.rotateBits=ee.getStringHashCode=ee.getHashCode=ee.createResolveChain=ee.enrichWithMetaInformation=ee.createExpressionId=ee.createExpressionHash=ee.isValidIdentifierLiteral=void 0;var n$=iu();Object.defineProperty(ee,"isValidIdentifierLiteral",{enumerable:!0,get:function(){return n$.isValidIdentifierLiteral}});var r$=Sk();Object.defineProperty(ee,"createExpressionHash",{enumerable:!0,get:function(){return r$.createExpressionHash}});var i$=hb();Object.defineProperty(ee,"createExpressionId",{enumerable:!0,get:function(){return i$.createExpressionId}});var s$=w_();Object.defineProperty(ee,"enrichWithMetaInformation",{enumerable:!0,get:function(){return s$.enrichWithMetaInformation}});var o$=T_();Object.defineProperty(ee,"createResolveChain",{enumerable:!0,get:function(){return o$.createResolveChain}});var pv=lb();Object.defineProperty(ee,"getHashCode",{enumerable:!0,get:function(){return pv.getHashCode}});Object.defineProperty(ee,"getStringHashCode",{enumerable:!0,get:function(){return pv.getStringHashCode}});Object.defineProperty(ee,"rotateBits",{enumerable:!0,get:function(){return pv.rotateBits}});var yC=A_();Object.defineProperty(ee,"ObjectSet",{enumerable:!0,get:function(){return yC.ObjectSet}});Object.defineProperty(ee,"ObjectSetIterator",{enumerable:!0,get:function(){return yC.ObjectSetIterator}});var a$=C_();Object.defineProperty(ee,"DEFAULT_CUSTOM_FUNCTION_DESCRIPTION",{enumerable:!0,get:function(){return a$.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION}});var u$=Ls();Object.defineProperty(ee,"CompletionItemKind",{enumerable:!0,get:function(){return u$.CompletionItemKind}});var gv=Ns();Object.defineProperty(ee,"PropertyType",{enumerable:!0,get:function(){return gv.PropertyType}});Object.defineProperty(ee,"IdentifierPropertyPattern",{enumerable:!0,get:function(){return gv.IdentifierPropertyPattern}});Object.defineProperty(ee,"IsaPropertyPattern",{enumerable:!0,get:function(){return gv.IsaPropertyPattern}});var qd=R_();Object.defineProperty(ee,"isResolveChainItemWithIdentifier",{enumerable:!0,get:function(){return qd.isResolveChainItemWithIdentifier}});Object.defineProperty(ee,"isResolveChainItemWithIndex",{enumerable:!0,get:function(){return qd.isResolveChainItemWithIndex}});Object.defineProperty(ee,"isResolveChainItemWithMember",{enumerable:!0,get:function(){return qd.isResolveChainItemWithMember}});Object.defineProperty(ee,"isResolveChainItemWithValue",{enumerable:!0,get:function(){return qd.isResolveChainItemWithValue}});var c$=P_();Object.defineProperty(ee,"isSignatureDefinitionFunction",{enumerable:!0,get:function(){return c$.isSignatureDefinitionFunction}});var l$=xu();Object.defineProperty(ee,"injectIdentifers",{enumerable:!0,get:function(){return l$.injectIdentifers}});var h$=bd();Object.defineProperty(ee,"isEligibleForProperties",{enumerable:!0,get:function(){return h$.isEligibleForProperties}});var d$=vd();Object.defineProperty(ee,"lookupProperty",{enumerable:!0,get:function(){return d$.lookupProperty}});var f$=D_();Object.defineProperty(ee,"aggregateEntity",{enumerable:!0,get:function(){return f$.aggregateEntity}});var p$=zo();Object.defineProperty(ee,"Entity",{enumerable:!0,get:function(){return p$.Entity}});var g$=q_();Object.defineProperty(ee,"Scope",{enumerable:!0,get:function(){return g$.Scope}});var m$=ov();Object.defineProperty(ee,"Aggregator",{enumerable:!0,get:function(){return m$.Aggregator}});var y$=uv();Object.defineProperty(ee,"Document",{enumerable:!0,get:function(){return y$.Document}});var b$=dv();Object.defineProperty(ee,"ContainerProxy",{enumerable:!0,get:function(){return b$.ContainerProxy}});var _$=mC();Object.defineProperty(ee,"TypeManager",{enumerable:!0,get:function(){return _$.TypeManager}})});var mv=m(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.getSymbolItemKind=Jo.getCompletionItemKind=void 0;var at=Yo(),v$={[at.CompletionItemKind.Constant]:21,[at.CompletionItemKind.Internal]:21,[at.CompletionItemKind.InternalFunction]:21,[at.CompletionItemKind.InternalProperty]:21,[at.CompletionItemKind.Property]:6,[at.CompletionItemKind.Variable]:6,[at.CompletionItemKind.Expression]:6,[at.CompletionItemKind.Function]:3,[at.CompletionItemKind.ListConstructor]:12,[at.CompletionItemKind.MapConstructor]:12,[at.CompletionItemKind.Literal]:12,[at.CompletionItemKind.Unknown]:12},S$=t=>v$[t]??6;Jo.getCompletionItemKind=S$;var w$={[at.CompletionItemKind.Constant]:14,[at.CompletionItemKind.Internal]:14,[at.CompletionItemKind.InternalFunction]:14,[at.CompletionItemKind.InternalProperty]:14,[at.CompletionItemKind.Variable]:13,[at.CompletionItemKind.Property]:13,[at.CompletionItemKind.Expression]:13,[at.CompletionItemKind.Function]:12,[at.CompletionItemKind.ListConstructor]:18,[at.CompletionItemKind.MapConstructor]:19,[at.CompletionItemKind.Literal]:13,[at.CompletionItemKind.Unknown]:13},T$=t=>w$[t]??13;Jo.getSymbolItemKind=T$});var bC=m(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});jd.CompletionListBuilder=void 0;var E$=mv(),yv=class{constructor(){this.collection=new Map,this.default=[]}setDefault(e){this.default=e}addCollection(e){e!=null&&(this.collection=new Map([...this.collection,...e]))}build(){let e=[];for(let[n,r]of this.collection)e.push({label:n,kind:(0,E$.getCompletionItemKind)(r.kind)});return[...e,...this.default]}};jd.CompletionListBuilder=yv});var $d=m(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.findEx=Qo.ScraperWalker=void 0;var x$=ke(),k$=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:()=>{}}},Fd=class{constructor(e,n={}){this.map=Object.assign(k$(this.visit.bind(this)),n),this.callback=e,this.state={exit:!1,skip:!1}}visit(e,n=0){if(e==null)return;if(e.type==null)throw console.error("Error ast type:",e),new Error("Unexpected as type");let r=this.callback(e,n);if(r!=null&&Object.assign(this.state,r),this.state.exit||this.state.skip){this.state.skip=!1;return}let i=this.map[e.type];i?.call(this,e,n+1)}};Qo.ScraperWalker=Fd;function A$(t,e){let n=[];return new Fd((i,s)=>{let o=t(i,s)||{};return o.valid&&i.type!==x$.ASTType.InvalidCodeExpression&&n.push(i),{exit:!!o.exit,skip:!!o.skip}}).visit(e),n}Qo.findEx=A$});var bv=m(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.lookupBase=mn.lookupIdentifier=mn.lookupScopes=mn.lookupRootScope=void 0;var wi=ke(),C$=t=>{let e=t;for(;e.scope;)e=e.scope;return e};mn.lookupRootScope=C$;var O$=t=>{if(!t.scope)return[t];let e=(0,mn.lookupRootScope)(t);return e===t.scope?[t,e]:[t,t.scope,e]};mn.lookupScopes=O$;var R$=t=>{switch(t.type){case wi.ASTType.CallStatement:return(0,mn.lookupIdentifier)(t.expression);case wi.ASTType.CallExpression:return(0,mn.lookupIdentifier)(t.base);case wi.ASTType.Identifier:return t;case wi.ASTType.MemberExpression:return(0,mn.lookupIdentifier)(t.identifier);case wi.ASTType.IndexExpression:return(0,mn.lookupIdentifier)(t.index);default:return null}};mn.lookupIdentifier=R$;var P$=(t=null)=>{switch(t?.type){case wi.ASTType.MemberExpression:return t.base;case wi.ASTType.IndexExpression:return t.base;case wi.ASTType.CallExpression:return t.base;case wi.ASTType.SliceExpression:return t.base;default:return null}};mn.lookupBase=P$});var ea=m(Jr=>{"use strict";var D$=Jr&&Jr.__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]}),I$=Jr&&Jr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M$=Jr&&Jr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&D$(e,t,n);return I$(e,t),e};Object.defineProperty(Jr,"__esModule",{value:!0});Jr.LookupHelper=void 0;var L$=jn(),_C=ke(),Zo=Yo(),N$=M$($d()),q$=bv(),_v=class{constructor(e,n){this.document=e,this.context=n,this.mergedTypeMap=null}async getTypeMap(){return this.mergedTypeMap==null&&(this.mergedTypeMap=await this.context.documentMerger.build(this.document,this.context)),this.mergedTypeMap}async findAllAssignmentsOfIdentifier(e,n){let r=await this.getTypeMap();if(r==null)return[];let i=r.getScopeContext(n);return i==null?[]:i.aggregator.resolveAvailableAssignmentsWithQuery(e)}async findAllAssignmentsOfItem(e,n){let r=await this.getTypeMap();if(r==null)return[];let i=r.getScopeContext(n);return i==null?[]:i.aggregator.resolveAvailableAssignments(e)}async findAllAvailableIdentifierInRoot(){let e=await this.getTypeMap();return e==null?new Map:e.getRootScopeContext().scope.getAvailableIdentifier()}async findAllAvailableIdentifier(e){let n=await this.getTypeMap();if(n==null)return new Map;let r=n.getScopeContext(e);return r==null?new Map:r.scope.getAvailableIdentifier()}async findAllAvailableIdentifierRelatedToPosition(e){let n=await this.getTypeMap(),r=new Map;if(n==null)return r;for(let a of n.container.getAvailableIdentifier(L$.SignatureDefinitionBaseType.General))r.set(...a);let i=n.getScopeContext(e.scope);if(i==null)return r;i.scope.isSelfAvailable()&&r.set("self",{kind:Zo.CompletionItemKind.Constant,line:-1}),i.scope.isSuperAvailable()&&r.set("super",{kind:Zo.CompletionItemKind.Constant,line:-1});let s=new Map;(0,Zo.injectIdentifers)(s,i.scope);let o=Array.from(s.entries()).map(([a,u])=>({identifier:a,...u})).sort((a,u)=>a.line-u.line);for(let a=0;a<o.length;a++){let u=o[a];if(u.line>=e.end.line)break;r.set(u.identifier,{kind:u.kind,line:u.line})}return i.scope.locals!==i.scope.globals&&(0,Zo.injectIdentifers)(r,i.scope.globals),i.scope.outer&&(0,Zo.injectIdentifers)(r,i.scope.outer),r}lookupAST(e){let n=this,i=this.context.documentManager.get(n.document).document.lines[e.line+1];if(!i)return null;for(let s=0;s<i.length;s++){let o=i[s],a=N$.findEx((c,l)=>{let h=c.start.line-1,d=c.start.character-1,g=c.end.line-1,y=c.end.character-1;return h>e.line?{exit:!0}:h<g?{valid:e.line>h&&e.line<g||e.line===h&&d<=e.character||e.line===g&&y>=e.character}:{valid:h<=e.line&&d<=e.character&&g>=e.line&&y>=e.character}},o),u=a.pop();if(u)return{closest:u,outer:a}}return null}async lookupBasePath(e){let n=await this.getTypeMap();if(n===null)return null;let r=(0,q$.lookupBase)(e);return r?n.resolveNamespace(r):null}async lookupTypeInfo({closest:e,outer:n}){let r=await this.getTypeMap();if(r===null)return null;let i=n.length>0?n[n.length-1]:void 0;return i?.type===_C.ASTType.MemberExpression&&e===i.identifier||i?.type===_C.ASTType.IndexExpression&&e===i.index&&(0,Zo.isValidIdentifierLiteral)(e)?r.resolveType(i,!0):r.resolveType(e,!0)}lookupType(e){let n=this,r=n.lookupAST(e);return r?n.lookupTypeInfo(r):null}};Jr.LookupHelper=_v});var vC=m(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.AVAILABLE_CONSTANTS=void 0;Bd.AVAILABLE_CONSTANTS=["true","false","null","params","globals","locals","outer"].map(t=>({label:t,kind:21}))});var SC=m(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.AVAILABLE_KEYWORDS=void 0;var ta=Yr(),un=ke();Wd.AVAILABLE_KEYWORDS=[un.Keyword.If,un.Keyword.In,un.Keyword.Or,un.Keyword.And,un.Keyword.Isa,un.Keyword.For,un.Keyword.New,un.Keyword.Not,un.Keyword.End,un.Keyword.Then,un.Keyword.Else,un.Keyword.Break,un.Keyword.While,un.Keyword.Return,un.Keyword.Function,un.Keyword.Continue,ta.GreybelKeyword.Envar,ta.GreybelKeyword.Import,ta.GreybelKeyword.Include,ta.GreybelKeyword.Debugger,ta.GreybelKeyword.Line,ta.GreybelKeyword.File].map(t=>({label:t,kind:14}))});var wC=m(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});Ud.AVAILABLE_OPERATORS=void 0;var $u=Vo(),Ut=ke();Ud.AVAILABLE_OPERATORS=[Ut.Operator.Plus,Ut.Operator.Asterik,Ut.Operator.Minus,Ut.Operator.Slash,Ut.Operator.Power,Ut.Operator.Modulo,Ut.Operator.LessThan,Ut.Operator.GreaterThan,Ut.Operator.LessThanOrEqual,Ut.Operator.GreaterThanOrEqual,Ut.Operator.NotEqual,Ut.Operator.Equal,Ut.Operator.AddShorthand,Ut.Operator.SubtractShorthand,Ut.Operator.MultiplyShorthand,Ut.Operator.DivideShorthand,$u.Operator.BitwiseAnd,$u.Operator.BitwiseOr,$u.Operator.LeftShift,$u.Operator.RightShift,$u.Operator.UnsignedRightShift,Ut.Operator.Assign,Ut.Operator.Reference].map(t=>({label:t,kind:24}))});var EC=m(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.activate=ar.getDefaultCompletionList=ar.getPropertyCompletionList=void 0;var TC=ke(),j$=bC(),F$=ea(),$$=vC(),B$=SC(),W$=wC(),U$=async(t,e)=>{let n=await t.lookupBasePath(e);return n===null?null:n.getAvailableIdentifier()};ar.getPropertyCompletionList=U$;var H$=()=>[...B$.AVAILABLE_KEYWORDS,...W$.AVAILABLE_OPERATORS,...$$.AVAILABLE_CONSTANTS];ar.getDefaultCompletionList=H$;function G$(t){t.connection.onCompletion(async e=>{if(!t.getConfiguration().autocomplete)return;let n=await t.fs.getTextDocument(e.textDocument.uri);if(n==null)return;let r=await t.documentManager.getLatest(n),i=new F$.LookupHelper(r.textDocument,t),s=i.lookupAST(e.position),o=new j$.CompletionListBuilder;if(s){let{closest:a}=s;a instanceof TC.ASTMemberExpression?o.addCollection(await(0,ar.getPropertyCompletionList)(i,a)):a instanceof TC.ASTIndexExpression?o.addCollection(await(0,ar.getPropertyCompletionList)(i,a)):(o.setDefault((0,ar.getDefaultCompletionList)()),o.addCollection(await i.findAllAvailableIdentifierRelatedToPosition(s.closest)))}else o.setDefault((0,ar.getDefaultCompletionList)()),o.addCollection(await i.findAllAvailableIdentifierInRoot());return o.build()}),t.connection.onCompletionResolve(e=>e)}ar.activate=G$});var kC=m((JK,xC)=>{"use strict";xC.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var vv=m((QK,CC)=>{var Bu=kC(),AC={};for(let t of Object.keys(Bu))AC[Bu[t]]=t;var re={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};CC.exports=re;for(let t of Object.keys(re)){if(!("channels"in re[t]))throw new Error("missing channels property: "+t);if(!("labels"in re[t]))throw new Error("missing channel labels property: "+t);if(re[t].labels.length!==re[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:n}=re[t];delete re[t].channels,delete re[t].labels,Object.defineProperty(re[t],"channels",{value:e}),Object.defineProperty(re[t],"labels",{value:n})}re.rgb.hsl=function(t){let e=t[0]/255,n=t[1]/255,r=t[2]/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=s-i,a,u;s===i?a=0:e===s?a=(n-r)/o:n===s?a=2+(r-e)/o:r===s&&(a=4+(e-n)/o),a=Math.min(a*60,360),a<0&&(a+=360);let c=(i+s)/2;return s===i?u=0:c<=.5?u=o/(s+i):u=o/(2-s-i),[a,u*100,c*100]};re.rgb.hsv=function(t){let e,n,r,i,s,o=t[0]/255,a=t[1]/255,u=t[2]/255,c=Math.max(o,a,u),l=c-Math.min(o,a,u),h=function(d){return(c-d)/6/l+1/2};return l===0?(i=0,s=0):(s=l/c,e=h(o),n=h(a),r=h(u),o===c?i=r-n:a===c?i=1/3+e-r:u===c&&(i=2/3+n-e),i<0?i+=1:i>1&&(i-=1)),[i*360,s*100,c*100]};re.rgb.hwb=function(t){let e=t[0],n=t[1],r=t[2],i=re.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(n,r));return r=1-1/255*Math.max(e,Math.max(n,r)),[i,s*100,r*100]};re.rgb.cmyk=function(t){let e=t[0]/255,n=t[1]/255,r=t[2]/255,i=Math.min(1-e,1-n,1-r),s=(1-e-i)/(1-i)||0,o=(1-n-i)/(1-i)||0,a=(1-r-i)/(1-i)||0;return[s*100,o*100,a*100,i*100]};function z$(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}re.rgb.keyword=function(t){let e=AC[t];if(e)return e;let n=1/0,r;for(let i of Object.keys(Bu)){let s=Bu[i],o=z$(t,s);o<n&&(n=o,r=i)}return r};re.keyword.rgb=function(t){return Bu[t]};re.rgb.xyz=function(t){let e=t[0]/255,n=t[1]/255,r=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;let i=e*.4124+n*.3576+r*.1805,s=e*.2126+n*.7152+r*.0722,o=e*.0193+n*.1192+r*.9505;return[i*100,s*100,o*100]};re.rgb.lab=function(t){let e=re.rgb.xyz(t),n=e[0],r=e[1],i=e[2];n/=95.047,r/=100,i/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let s=116*r-16,o=500*(n-r),a=200*(r-i);return[s,o,a]};re.hsl.rgb=function(t){let e=t[0]/360,n=t[1]/100,r=t[2]/100,i,s,o;if(n===0)return o=r*255,[o,o,o];r<.5?i=r*(1+n):i=r+n-r*n;let a=2*r-i,u=[0,0,0];for(let c=0;c<3;c++)s=e+1/3*-(c-1),s<0&&s++,s>1&&s--,6*s<1?o=a+(i-a)*6*s:2*s<1?o=i:3*s<2?o=a+(i-a)*(2/3-s)*6:o=a,u[c]=o*255;return u};re.hsl.hsv=function(t){let e=t[0],n=t[1]/100,r=t[2]/100,i=n,s=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,i*=s<=1?s:2-s;let o=(r+n)/2,a=r===0?2*i/(s+i):2*n/(r+n);return[e,a*100,o*100]};re.hsv.rgb=function(t){let e=t[0]/60,n=t[1]/100,r=t[2]/100,i=Math.floor(e)%6,s=e-Math.floor(e),o=255*r*(1-n),a=255*r*(1-n*s),u=255*r*(1-n*(1-s));switch(r*=255,i){case 0:return[r,u,o];case 1:return[a,r,o];case 2:return[o,r,u];case 3:return[o,a,r];case 4:return[u,o,r];case 5:return[r,o,a]}};re.hsv.hsl=function(t){let e=t[0],n=t[1]/100,r=t[2]/100,i=Math.max(r,.01),s,o;o=(2-n)*r;let a=(2-n)*i;return s=n*i,s/=a<=1?a:2-a,s=s||0,o/=2,[e,s*100,o*100]};re.hwb.rgb=function(t){let e=t[0]/360,n=t[1]/100,r=t[2]/100,i=n+r,s;i>1&&(n/=i,r/=i);let o=Math.floor(6*e),a=1-r;s=6*e-o,o&1&&(s=1-s);let u=n+s*(a-n),c,l,h;switch(o){default:case 6:case 0:c=a,l=u,h=n;break;case 1:c=u,l=a,h=n;break;case 2:c=n,l=a,h=u;break;case 3:c=n,l=u,h=a;break;case 4:c=u,l=n,h=a;break;case 5:c=a,l=n,h=u;break}return[c*255,l*255,h*255]};re.cmyk.rgb=function(t){let e=t[0]/100,n=t[1]/100,r=t[2]/100,i=t[3]/100,s=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,n*(1-i)+i),a=1-Math.min(1,r*(1-i)+i);return[s*255,o*255,a*255]};re.xyz.rgb=function(t){let e=t[0]/100,n=t[1]/100,r=t[2]/100,i,s,o;return i=e*3.2406+n*-1.5372+r*-.4986,s=e*-.9689+n*1.8758+r*.0415,o=e*.0557+n*-.204+r*1.057,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),[i*255,s*255,o*255]};re.xyz.lab=function(t){let e=t[0],n=t[1],r=t[2];e/=95.047,n/=100,r/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116;let i=116*n-16,s=500*(e-n),o=200*(n-r);return[i,s,o]};re.lab.xyz=function(t){let e=t[0],n=t[1],r=t[2],i,s,o;s=(e+16)/116,i=n/500+s,o=s-r/200;let a=s**3,u=i**3,c=o**3;return s=a>.008856?a:(s-16/116)/7.787,i=u>.008856?u:(i-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,i*=95.047,s*=100,o*=108.883,[i,s,o]};re.lab.lch=function(t){let e=t[0],n=t[1],r=t[2],i;i=Math.atan2(r,n)*360/2/Math.PI,i<0&&(i+=360);let o=Math.sqrt(n*n+r*r);return[e,o,i]};re.lch.lab=function(t){let e=t[0],n=t[1],i=t[2]/360*2*Math.PI,s=n*Math.cos(i),o=n*Math.sin(i);return[e,s,o]};re.rgb.ansi16=function(t,e=null){let[n,r,i]=t,s=e===null?re.rgb.hsv(t)[2]:e;if(s=Math.round(s/50),s===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return s===2&&(o+=60),o};re.hsv.ansi16=function(t){return re.rgb.ansi16(re.hsv.rgb(t),t[2])};re.rgb.ansi256=function(t){let e=t[0],n=t[1],r=t[2];return e===n&&n===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)};re.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let n=(~~(t>50)+1)*.5,r=(e&1)*n*255,i=(e>>1&1)*n*255,s=(e>>2&1)*n*255;return[r,i,s]};re.ansi256.rgb=function(t){if(t>=232){let s=(t-232)*10+8;return[s,s,s]}t-=16;let e,n=Math.floor(t/36)/5*255,r=Math.floor((e=t%36)/6)/5*255,i=e%6/5*255;return[n,r,i]};re.rgb.hex=function(t){let n=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(n.length)+n};re.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let n=e[0];e[0].length===3&&(n=n.split("").map(a=>a+a).join(""));let r=parseInt(n,16),i=r>>16&255,s=r>>8&255,o=r&255;return[i,s,o]};re.rgb.hcg=function(t){let e=t[0]/255,n=t[1]/255,r=t[2]/255,i=Math.max(Math.max(e,n),r),s=Math.min(Math.min(e,n),r),o=i-s,a,u;return o<1?a=s/(1-o):a=0,o<=0?u=0:i===e?u=(n-r)/o%6:i===n?u=2+(r-e)/o:u=4+(e-n)/o,u/=6,u%=1,[u*360,o*100,a*100]};re.hsl.hcg=function(t){let e=t[1]/100,n=t[2]/100,r=n<.5?2*e*n:2*e*(1-n),i=0;return r<1&&(i=(n-.5*r)/(1-r)),[t[0],r*100,i*100]};re.hsv.hcg=function(t){let e=t[1]/100,n=t[2]/100,r=e*n,i=0;return r<1&&(i=(n-r)/(1-r)),[t[0],r*100,i*100]};re.hcg.rgb=function(t){let e=t[0]/360,n=t[1]/100,r=t[2]/100;if(n===0)return[r*255,r*255,r*255];let i=[0,0,0],s=e%1*6,o=s%1,a=1-o,u=0;switch(Math.floor(s)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=a,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=a,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=a}return u=(1-n)*r,[(n*i[0]+u)*255,(n*i[1]+u)*255,(n*i[2]+u)*255]};re.hcg.hsv=function(t){let e=t[1]/100,n=t[2]/100,r=e+n*(1-e),i=0;return r>0&&(i=e/r),[t[0],i*100,r*100]};re.hcg.hsl=function(t){let e=t[1]/100,r=t[2]/100*(1-e)+.5*e,i=0;return r>0&&r<.5?i=e/(2*r):r>=.5&&r<1&&(i=e/(2*(1-r))),[t[0],i*100,r*100]};re.hcg.hwb=function(t){let e=t[1]/100,n=t[2]/100,r=e+n*(1-e);return[t[0],(r-e)*100,(1-r)*100]};re.hwb.hcg=function(t){let e=t[1]/100,r=1-t[2]/100,i=r-e,s=0;return i<1&&(s=(r-i)/(1-i)),[t[0],i*100,s*100]};re.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};re.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};re.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};re.gray.hsl=function(t){return[0,0,t[0]]};re.gray.hsv=re.gray.hsl;re.gray.hwb=function(t){return[0,100,t[0]]};re.gray.cmyk=function(t){return[0,0,0,t[0]]};re.gray.lab=function(t){return[t[0],0,0]};re.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,r=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(r.length)+r};re.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var RC=m((ZK,OC)=>{var Hd=vv();function K$(){let t={},e=Object.keys(Hd);for(let n=e.length,r=0;r<n;r++)t[e[r]]={distance:-1,parent:null};return t}function V$(t){let e=K$(),n=[t];for(e[t].distance=0;n.length;){let r=n.pop(),i=Object.keys(Hd[r]);for(let s=i.length,o=0;o<s;o++){let a=i[o],u=e[a];u.distance===-1&&(u.distance=e[r].distance+1,u.parent=r,n.unshift(a))}}return e}function X$(t,e){return function(n){return e(t(n))}}function Y$(t,e){let n=[e[t].parent,t],r=Hd[e[t].parent][t],i=e[t].parent;for(;e[i].parent;)n.unshift(e[i].parent),r=X$(Hd[e[i].parent][i],r),i=e[i].parent;return r.conversion=n,r}OC.exports=function(t){let e=V$(t),n={},r=Object.keys(e);for(let i=r.length,s=0;s<i;s++){let o=r[s];e[o].parent!==null&&(n[o]=Y$(o,e))}return n}});var DC=m((eV,PC)=>{var Sv=vv(),J$=RC(),na={},Q$=Object.keys(Sv);function Z$(t){let e=function(...n){let r=n[0];return r==null?r:(r.length>1&&(n=r),t(n))};return"conversion"in t&&(e.conversion=t.conversion),e}function eB(t){let e=function(...n){let r=n[0];if(r==null)return r;r.length>1&&(n=r);let i=t(n);if(typeof i=="object")for(let s=i.length,o=0;o<s;o++)i[o]=Math.round(i[o]);return i};return"conversion"in t&&(e.conversion=t.conversion),e}Q$.forEach(t=>{na[t]={},Object.defineProperty(na[t],"channels",{value:Sv[t].channels}),Object.defineProperty(na[t],"labels",{value:Sv[t].labels});let e=J$(t);Object.keys(e).forEach(r=>{let i=e[r];na[t][r]=eB(i),na[t][r].raw=Z$(i)})});PC.exports=na});var MC=m(ra=>{"use strict";var tB=ra&&ra.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ra,"__esModule",{value:!0});ra.activate=void 0;var wv=tB(DC()),nB=ke(),IC;(function(t){t.Black="black",t.Blue="blue",t.Green="green",t.Orange="orange",t.Purple="purple",t.Red="red",t.White="white",t.Yellow="yellow"})(IC||(IC={}));var Tv={black:"#000000",blue:"#0000FF",green:"#00FF00",orange:"#FF8800",purple:"#CC8899",red:"#FF0000",white:"#FFFFFF",yellow:"#FFFF00"},rB=()=>new RegExp(`(?:mark|color)=(${Object.keys(Tv).join("|")}|(?:#[0-9a-f]{6}|#[0-9a-f]{3}))`,"ig"),iB=Object.prototype.hasOwnProperty;function sB(t){t.connection.onColorPresentation(e=>[{label:`#${wv.default.rgb.hex(e.color.red*255,e.color.green*255,e.color.blue*255)}`}]),t.connection.onDocumentColor(async e=>{let n=await t.fs.getTextDocument(e.textDocument.uri);if(n==null)return;let s=(await t.documentManager.getLatest(n)).document.literals.filter(u=>u.type===nB.ASTType.StringLiteral),o=[],a=({match:u,markup:c,value:l,astPosition:h,lineIndex:d})=>{let g=u.index+c.indexOf("=")+1,y=g+l.length,_=h.line-1+d,C=g,k=y;return d===0&&(C+=h.character,k+=h.character),{start:{line:_,character:C},end:{line:_,character:k}}};for(let u=0;u<s.length;u++){let c=s[u];if(!c.start)continue;let l=c.start,h=c.value.toString().split(`
114
114
  `);for(let d=0;d<h.length;d++){let g=h[d],y=rB(),_;for(;_=y.exec(g);){let[C,k]=_,T=a({match:_,markup:C,value:k,astPosition:l,lineIndex:d});if(k.startsWith("#")){let[w,v,L]=wv.default.hex.rgb(k.slice(1));o.push({range:T,color:{red:w/255,green:v/255,blue:L/255,alpha:1}})}else if(iB.call(Tv,k)){let[w,v,L]=wv.default.hex.rgb(Tv[k].slice(1));o.push({range:T,color:{red:w/255,green:v/255,blue:L/255,alpha:1}})}else o.push({range:T,color:{red:0,green:0,blue:0,alpha:1}})}}}return o})}ra.activate=sB});var NC=m(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});Gd.activate=void 0;var LC=ke(),oB=ea(),aB=t=>`${t.targetUri}:${t.targetRange.start.line}:${t.targetRange.start.character}-${t.targetRange.end.line}:${t.targetRange.end.character}`,uB=t=>{let e=t.node,n,r;switch(e.type){case LC.ASTType.ForGenericStatement:{let i=e;n={line:i.variable.start.line-1,character:i.variable.start.character-1},r={line:i.variable.end.line-1,character:i.variable.end.character-1};break}default:n={line:e.start.line-1,character:e.start.character-1},r={line:e.end.line-1,character:e.end.character-1}}return{targetUri:t.source,targetRange:{start:n,end:r},targetSelectionRange:{start:n,end:r}}},cB=async(t,e,n)=>{let r=await t.findAllAssignmentsOfItem(e,n),i=[],s=new Set;for(let o of r){let a=o.node;if(!a.start||!a.end)continue;let u=uB(o),c=aB(u);s.has(c)||(s.add(c),i.push(u))}return i};function lB(t){t.connection.onDefinition(async e=>{let n=await t.fs.getTextDocument(e.textDocument.uri);if(n==null)return;let r=new oB.LookupHelper(n,t),i=r.lookupAST(e.position);if(!i)return;let{outer:s,closest:o}=i,a=s.length>0?s[s.length-1]:void 0,u=o;return a&&a instanceof LC.ASTMemberExpression&&a.identifier===o&&(u=a),await cB(r,u,u.scope)})}Gd.activate=lB});var qC=m(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});zd.activate=void 0;async function hB(t,e){let n=await e.documentManager.getLatest(t);return n.errors.map(r=>{if(r?.range){let i=r.range;return{range:{start:{line:i.start.line-1,character:i.start.character-1},end:{line:i.end.line-1,character:i.end.character-1}},message:r.message,severity:1}}return{range:{start:n.document.start,end:n.document.end},message:r.message,severity:1}})}function dB(t){t.connection.languages.diagnostics.on(async e=>{if(!t.getConfiguration().diagnostic)return;let n=await t.fs.getTextDocument(e.textDocument.uri);if(n==null)return;let r=await hB(n,t);return r.length===0?{kind:"full",items:[]}:{kind:"full",items:r}})}zd.activate=dB});var jC=m(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.getStringHashCode=void 0;Kd.getStringHashCode=function(){let t=new Map,e=n=>{let r,i;for(r=0,i=0;r<n.length;r++)i=Math.imul(31,i)+n.charCodeAt(r)|0;return i};return n=>{if(n.length===0)return 0;let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i}}()});var Ev=m(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});Yd.createExpressionHash=void 0;var Vd=ke(),FC=jC(),Xd=(t,e)=>t.$$hash=e,fB=t=>{var e;return(e=t.$$hash)!==null&&e!==void 0?e:null};function ia(t){let e=fB(t);if(e!==null)return e;let n=(0,FC.getStringHashCode)(t.type);switch(t.type){case Vd.ASTType.ParenthesisExpression:return ia(t.expression);case Vd.ASTType.MemberExpression:{let r=t;return n^=ia(r.base),n^=ia(r.identifier),Xd(t,n)}case Vd.ASTType.IndexExpression:{let r=t;return n^=ia(r.base),n^=ia(r.index),Xd(t,n)}case Vd.ASTType.Identifier:{let r=t;return n^=(0,FC.getStringHashCode)(r.name),Xd(t,n)}}return Xd(t,n)}function pB(t){return ia(t)}Yd.createExpressionHash=pB});var aa=m(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.getLiteralValue=oa.getLiteralRawValue=void 0;var sa=ke(),gB=t=>{switch(t.type){case sa.ASTType.NilLiteral:return"null";case sa.ASTType.NumericLiteral:{let e=t;return`${e.negated?"-":""}${e.raw}`}case sa.ASTType.BooleanLiteral:{let e=t;return`${e.negated?"-":""}${e.raw}`}default:return t.raw.toString()}};oa.getLiteralRawValue=gB;var mB=t=>{switch(t.type){case sa.ASTType.NilLiteral:return"null";case sa.ASTType.NumericLiteral:{let e=t;return`${e.negated?"-":""}${e.value}`}case sa.ASTType.BooleanLiteral:{let e=t;return`${e.negated?"-":""}${e.value}`}default:return t.value.toString()}};oa.getLiteralValue=mB});var kv=m(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.BeautifyBodyIterator=Us.FILLER_TYPE=void 0;var Ws=ke();Us.FILLER_TYPE="FILLER";var xv=class{constructor(e,n){this._base=e,this._items=n.sort((r,i)=>r.range[0]-i.range[0]),this._index=0,this._freeSpaceIndex=0,this._freeSpace=0,this._lastEndLine=0,this._checkedIndexes=new Set,this._previous=null}getBlockOpenerEndLine(e){switch(e.type){case Ws.ASTType.IfClause:return e.condition.end.line;case Ws.ASTType.WhileStatement:return e.condition.end.line;case Ws.ASTType.ForGenericStatement:return e.iterator.end.line;case Ws.ASTType.Chunk:return e.start.line-1}return e.start.line}getBlockCloseEndLine(e){switch(e.type){case Ws.ASTType.Chunk:return e.end.line+1}return e.end.line}getPreviousEndLine(e){if(e==null)return 0;if(e.type===Ws.ASTType.IfShortcutStatement){let n=e;return n.clauses[n.clauses.length-1].body[0].end.line}return e.end.line}getFreeSpaceItem(){let e={line:this._lastEndLine+this._freeSpaceIndex+1,character:0};return this._freeSpaceIndex++,this._freeSpace===this._freeSpaceIndex&&(this._lastEndLine=0,this._freeSpaceIndex=0,this._freeSpace=0),new Ws.ASTBase(Us.FILLER_TYPE,{start:e,end:e,range:[0,0],scope:this._base.scope})}next(){if(this._freeSpace>this._freeSpaceIndex)return{value:this.getFreeSpaceItem(),done:!1};if(this._index>=this._items.length){if(!this._checkedIndexes.has(this._items.length)){let n=this._previous?this.getPreviousEndLine(this._previous):this.getBlockOpenerEndLine(this._base),r=Math.max(this.getBlockCloseEndLine(this._base)-n-1,0);if(r>0)return this._checkedIndexes.add(this._items.length),this._lastEndLine=n,this._freeSpace=r,{value:this.getFreeSpaceItem(),done:!1}}return{value:null,done:!0}}let e=this._items[this._index];if(!this._checkedIndexes.has(this._index)){let n=this._previous?this.getPreviousEndLine(this._previous):this.getBlockOpenerEndLine(this._base),r=Math.max(e.start.line-n-1,0);if(r>0)return this._checkedIndexes.add(this._index),this._lastEndLine=n,this._freeSpace=r,{value:this.getFreeSpaceItem(),done:!1}}return this._index++,this._previous=e,{value:e,done:!1}}};Us.BeautifyBodyIterator=xv});var Cv=m(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.BeautifyContext=Gs.IndentationType=void 0;var Hs=ke(),$C=kv(),BC;(function(t){t[t.Tab=0]="Tab",t[t.Whitespace=1]="Whitespace"})(BC=Gs.IndentationType||(Gs.IndentationType={}));var Av=class{get indent(){return this._indent}get isMultilineAllowed(){return this._isMultilineAllowed}constructor(e,n){this.factory=e,this.options=n,this._indent=0,this._stack=[],this._contexts=new Map,this._isMultilineAllowed=!0,this.getIndent=n.indentation===BC.Tab?(r=0)=>" ".repeat(this._indent+r):(r=0)=>" ".repeat(n.indentationSpaces).repeat(this._indent+r)}buildChunkContext(e){let n=new Map,r=Object.keys(e.lines),i=new Set;for(let s=0;s<r.length;s++){let o=Number(r[s]),u=e.lines[o].filter(c=>c.type===Hs.ASTType.Comment);for(let c=0;c<u.length;c++){let l=u[c];if(!i.has(l))if(i.add(l),l.isMultiline){let h=l.value.split(`
115
- `);h.forEach((d,g)=>{let y=o+g;n.has(y)||n.set(y,[]);let C=e.lines[y].filter(L=>L.type!==Hs.ASTType.Comment).map(L=>L.start.character),k=C.length>0?Math.min(...C):-1,T=y===o,w=y===o+h.length-1,v=w?l.end.character<k:!1;n.get(y).push({isMultiline:!0,isStart:T,isEnd:w,isBefore:v,value:d})})}else n.has(o)||n.set(o,[]),n.get(o).push({isMultiline:!1,isStart:!1,isEnd:!1,isBefore:!1,value:l.value})}}return{commentBuckets:n}}getChunkContext(e){return this._contexts.get(e)}getCurrentChunk(){return this._stack[this._stack.length-1]}pushStack(e){this._stack.push(e),this._contexts.set(e,this.buildChunkContext(e))}popStack(){this._stack.pop()}disableMultiline(){this._isMultilineAllowed=!1}enableMultiline(){this._isMultilineAllowed=!0}incIndent(){this._indent++}decIndent(){this._indent--}getBlockOpenerEndLine(e){return e instanceof Hs.ASTIfClause||e instanceof Hs.ASTWhileStatement?e.condition.end.line:e instanceof Hs.ASTForGenericStatement?e.iterator.end.line:e instanceof Hs.ASTChunk?e.start.line-1:e.start.line}getPreviousEndLine(e){if(e==null)return 0;if(e.type===Hs.ASTType.IfShortcutStatement){let n=e;return n.clauses[n.clauses.length-1].body[0].end.line}return e.end.line}buildBlock(e){let n=new $C.BeautifyBodyIterator(e,e.body),r=n.next();for(;!r.done;){let i=r.value;if(i.type===$C.FILLER_TYPE){this.factory.pushSegment(this.getIndent()),this.factory.pushComment(i.start.line),this.factory.eol(),r=n.next();continue}this.factory.pushSegment(this.getIndent()),this.factory.process(i,{isCommand:!0}),this.factory.eol(),r=n.next()}}};Gs.BeautifyContext=Av});var Ov=m(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.commentToText=qt.hasEmptyBody=qt.containsMultilineItemInShortcutClauses=qt.getLastComment=qt.unwrap=qt.countRightBinaryExpressions=qt.SHORTHAND_OPERATORS=void 0;var kn=ke();qt.SHORTHAND_OPERATORS=[kn.Operator.Plus,kn.Operator.Minus,kn.Operator.Asterik,kn.Operator.Slash,kn.Operator.Modulo,kn.Operator.Power];var yB=t=>{if(t=(0,qt.unwrap)(t),t instanceof kn.ASTComparisonGroupExpression)return t.expressions.length;let e=[t],n=0;for(;e.length>0;){let r=e.pop();r instanceof kn.ASTBinaryExpression&&n++,(r instanceof kn.ASTBinaryExpression||r instanceof kn.ASTLogicalExpression||r instanceof kn.ASTIsaExpression)&&(e.push((0,qt.unwrap)(r.left)),e.push((0,qt.unwrap)(r.right)))}return n};qt.countRightBinaryExpressions=yB;var bB=t=>{for(;t instanceof kn.ASTParenthesisExpression;)t=t.expression;return t};qt.unwrap=bB;var _B=t=>{for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.type===kn.ASTType.Comment)return n}return null};qt.getLastComment=_B;var vB=(t,e)=>e.some(n=>t.line<n.body[0].end.line);qt.containsMultilineItemInShortcutClauses=vB;var SB=t=>!t.some(e=>!(e instanceof kn.ASTComment));qt.hasEmptyBody=SB;var wB=t=>t.isMultiline?t.isStart&&!t.isEnd?"/* "+t.value.trim():!t.isStart&&t.isEnd?t.value.trim()+" */":t.isStart&&t.isEnd?"/* "+t.value.trim()+" */":t.value.trim():"// "+t.value.trim();qt.commentToText=wB});var Pv=m(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.Stack=void 0;var Rv=class{constructor(){let e=this;e.currentStack=[]}get(e){let r=this.currentStack;e==null&&(e=0);let i=r.length-e-1;return i<0?null:r[i]}depth(){return this.currentStack.filter(function(e){return Object.prototype.hasOwnProperty.call(e,"body")}).length}lookup(e){let n=this;for(let r=n.currentStack.length-2;r>=0;r--)if(e(n.currentStack[r]))return!0;return!1}push(e){let n=this;return n.currentStack.push(e),n}pop(){let e=this;return e.currentStack.pop(),e}};Jd.Stack=Rv});var Wu=m(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.Factory=void 0;var TB=Pv(),Dv=class{get activeLine(){return this._activeLine}get lines(){return this._lines}get currentStack(){return this._currentStack}get currentDependency(){return this._currentDependency}constructor(e){this.transformer=e,this._activeLine=this.createLine(),this._lines=[],this._currentDependency=null,this._currentStack=new TB.Stack}pushSegment(e,n){this._activeLine.segments.push(e)}pushComment(e){throw new Error("Not implemented")}createLine(){return{segments:[]}}eol(e){this._lines.push(this._activeLine),this._activeLine=this.createLine()}reset(){this._activeLine=this.createLine(),this._lines=[]}process(e,n={}){let r=this,i=r._currentStack;if(e==null)return;if(e.type==null)throw console.error("Error AST type:",e),new Error("Unexpected AST type");let s=r.handlers[e.type];if(s==null)throw console.error("Error AST:",e),new Error("Type does not exist "+e.type);i.push(e),s.call(this,e,n),i.pop()}};Qd.Factory=Dv});var Mv=m(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.BeautifyFactory=void 0;var Uu=ke(),EB=require("path"),WC=Ev(),Zd=aa(),ef=kv(),UC=Cv(),Cr=Ov(),xB=Wu(),Iv=class extends xB.Factory{constructor(e){super(e),this.handlers={ParenthesisExpression:function(o,a){this.pushSegment("(",o),this.process(o.expression,{hasLogicalIndentActive:a.hasLogicalIndentActive}),this.pushSegment(")",o)},Comment:function(o,a){},AssignmentStatement:function(o,a){let u=o.variable,c=o.init;if(this.process(u),(u instanceof Uu.ASTIdentifier||u instanceof Uu.ASTMemberExpression)&&c instanceof Uu.ASTBinaryExpression&&(c.left instanceof Uu.ASTIdentifier||c.left instanceof Uu.ASTMemberExpression)&&Cr.SHORTHAND_OPERATORS.includes(c.operator)&&(0,WC.createExpressionHash)(u)===(0,WC.createExpressionHash)(c.left)){this.pushSegment(" "+c.operator+"= ",o),this.process((0,Cr.unwrap)(c.right));return}this.pushSegment(" = ",o),this.process(c)},MemberExpression:function(o,a){this.process(o.base),this.pushSegment(o.indexer,o),this.process(o.identifier)},FunctionDeclaration:function(o,a){if(o.parameters.length===0)this.pushSegment("function",{start:o.start,end:o.start});else{this.context.disableMultiline(),this.pushSegment("function(",{start:o.start,end:o.start});for(let u=0;u<o.parameters.length;u++){let c=o.parameters[u];this.process(c),u!==o.parameters.length-1&&this.pushSegment(", ",c)}this.pushSegment(")",{start:o.start,end:o.start}),this.context.enableMultiline()}this.eol(),this.context.incIndent(),this.context.buildBlock(o),this.context.decIndent(),this.pushSegment(this.context.getIndent()+"end function",{start:o.end,end:o.end})},MapConstructorExpression:function(o,a){if(o.fields.length===0){this.pushSegment("{}",o);return}if(o.fields.length===1){this.pushSegment("{ ",o),this.process(o.fields[0]),this.pushSegment(" }",o);return}if(this.context.isMultilineAllowed){this.context.incIndent(),this.pushSegment("{",{start:o.start,end:o.start}),this.eol();let u=new ef.BeautifyBodyIterator(o,o.fields),c=u.next();for(;!c.done;){let l=c.value;if(l.type===ef.FILLER_TYPE){this.pushSegment(this.context.getIndent()),this.pushComment(l.start.line),this.eol(),c=u.next();continue}this.pushSegment(this.context.getIndent(),l),this.process(l),this.pushSegment(",",l),this.eol(),c=u.next()}this.context.decIndent(),this.pushSegment(this.context.getIndent()+"}",{start:o.end,end:o.end});return}this.pushSegment("{ ",{start:o.start,end:o.start});for(let u=0;u<o.fields.length;u++){let c=o.fields[u];this.process(c),u!==o.fields.length-1&&this.pushSegment(", ",c)}this.context.decIndent(),this.pushSegment(" }",{start:o.end,end:o.end})},MapKeyString:function(o,a){this.process(o.key),this.pushSegment(": ",o),this.process(o.value)},Identifier:function(o,a){this.pushSegment(o.name,o)},ReturnStatement:function(o,a){this.pushSegment("return ",o),o.argument&&this.process(o.argument)},NumericLiteral:function(o,a){this.pushSegment((0,Zd.getLiteralValue)(o),o)},WhileStatement:function(o,a){this.pushSegment("while ",{start:o.start,end:o.start}),this.context.disableMultiline(),this.process(o.condition),this.context.enableMultiline(),this.eol(),this.context.incIndent(),this.context.buildBlock(o),this.context.decIndent(),this.pushSegment(this.context.getIndent()+"end while",{start:o.end,end:o.end})},CallExpression:function(o,a){let u=this.lines.length-1;if(this.process(o.base),o.arguments.length===0)return;if(o.arguments.length>3&&this.context.isMultilineAllowed){this.context.incIndent(),this.pushSegment("(",{start:o.start,end:o.start}),this.eol();for(let h=0;h<o.arguments.length;h++){let d=o.arguments[h];this.pushSegment(this.context.getIndent(),d),this.process(d),h!==o.arguments.length-1&&(this.pushSegment(",",d),this.eol())}this.context.decIndent(),this.pushSegment(")",{start:o.end,end:o.end});return}a.isCommand&&!this.transformer.buildOptions.keepParentheses?this.pushSegment(" ",{start:o.start,end:o.start}):this.pushSegment("(",{start:o.start,end:o.start});let c=this.lines.length;for(let h=0;h<o.arguments.length;h++){let d=o.arguments[h];this.process(d),h!==o.arguments.length-1&&this.pushSegment(", ",d)}let l=c!==this.lines.length;if(o.arguments.length>1&&l){this.eol(),this._lines=this._lines.slice(0,u+1),this.pushSegment(this.context.getIndent(),o.base),this.process(o.base),this.pushSegment("(",{start:o.start,end:o.start}),this.eol(),this.context.incIndent();for(let h=0;h<o.arguments.length;h++){let d=o.arguments[h];this.pushSegment(this.context.getIndent(),d),this.process(d),h!==o.arguments.length-1&&(this.pushSegment(",",d),this.eol())}this.context.decIndent(),this.pushSegment(")",{start:o.end,end:o.end});return}a.isCommand&&!this.transformer.buildOptions.keepParentheses||this.pushSegment(")",{start:o.end,end:o.end})},StringLiteral:function(o,a){this.pushSegment((0,Zd.getLiteralRawValue)(o),{start:o.end,end:o.end})},SliceExpression:function(o,a){this.process(o.base),this.pushSegment("[",o),this.process(o.left),this.pushSegment(" : ",o),this.process(o.right),this.pushSegment("]",o)},IndexExpression:function(o,a){this.process(o.base),this.pushSegment("[",o),this.process(o.index),this.pushSegment("]",o)},UnaryExpression:function(o,a){o.operator==="new"?this.pushSegment(o.operator+" ",o):this.pushSegment(o.operator,o),this.process(o.argument)},NegationExpression:function(o,a){this.pushSegment("not ",o),this.process(o.argument)},FeatureEnvarExpression:function(o,a){if(this.transformer.buildOptions.isDevMode){this.pushSegment(`#envar ${o.name}`,o);return}let u=this.transformer.environmentVariables.get(o.name);if(!u){this.pushSegment("null",o);return}this.pushSegment(`"${u}"`,o)},IfShortcutStatement:function(o,a){for(let u=0;u<o.clauses.length;u++){let c=o.clauses[u];this.process(c),u!==o.clauses.length-1&&this.pushSegment(" ",o)}},IfShortcutClause:function(o,a){this.pushSegment("if ",o),this.process((0,Cr.unwrap)(o.condition)),this.pushSegment(" then ",o),this.process(o.body[0])},ElseifShortcutClause:function(o,a){this.pushSegment("else if ",o),this.process((0,Cr.unwrap)(o.condition)),this.pushSegment(" then ",o),this.process(o.body[0])},ElseShortcutClause:function(o,a){this.pushSegment("else ",o),this.process(o.body[0])},NilLiteral:function(o,a){this.pushSegment((0,Zd.getLiteralRawValue)(o),o)},ForGenericStatement:function(o,a){this.pushSegment("for ",{start:o.start,end:o.start}),this.process((0,Cr.unwrap)(o.variable)),this.pushSegment(" in ",{start:o.start,end:o.start}),this.process((0,Cr.unwrap)(o.iterator)),this.eol(),this.context.incIndent(),this.context.buildBlock(o),this.context.decIndent(),this.pushSegment(this.context.getIndent()+"end for",{start:o.end,end:o.end})},IfStatement:function(o,a){for(let u of o.clauses)this.process(u);this.pushSegment(this.context.getIndent()+"end if",{start:o.end,end:o.end})},IfClause:function(o,a){this.pushSegment("if ",{start:o.start,end:o.start}),this.process((0,Cr.unwrap)(o.condition)),this.pushSegment(" then",{start:o.start,end:o.start}),this.eol(),this.context.incIndent(),this.context.buildBlock(o),this.context.decIndent()},ElseifClause:function(o,a){this.pushSegment(this.context.getIndent()+"else if ",{start:o.start,end:o.start}),this.process((0,Cr.unwrap)(o.condition)),this.pushSegment(" then",{start:o.start,end:o.start}),this.eol(),this.context.incIndent(),this.context.buildBlock(o),this.context.decIndent()},ElseClause:function(o,a){this.pushSegment(this.context.getIndent()+"else",{start:o.start,end:o.start}),this.eol(),this.context.incIndent(),this.context.buildBlock(o),this.context.decIndent()},ContinueStatement:function(o,a){this.pushSegment("continue",o)},BreakStatement:function(o,a){this.pushSegment("break",o)},CallStatement:function(o,a){this.process(o.expression,{isCommand:!0})},FeatureInjectExpression:function(o,a){if(this.transformer.buildOptions.isDevMode){this.pushSegment(`#inject "${o.path}";`,o);return}if(this.currentDependency===null){this.pushSegment(`#inject "${o.path}";`,o);return}let u=this.currentDependency.injections.get(o.path);if(u==null){this.pushSegment("null",o);return}this.pushSegment(`"${u.replace(/"/g,()=>'""')}"`,o)},FeatureImportExpression:function(o,a){if(this.transformer.buildOptions.isDevMode){this.pushSegment("#import ",o),this.process(o.name),this.pushSegment(` from "${o.path}";`,o);return}if(!o.chunk){this.pushSegment("#import ",o),this.process(o.name),this.pushSegment(` from "${o.path}";`,o);return}this.process(o.name),this.pushSegment(' = __REQUIRE("'+o.namespace+'")',o)},FeatureIncludeExpression:function(o,a){if(this.transformer.buildOptions.isDevMode){this.pushSegment(`#include "${o.path}";`,o);return}if(!o.chunk){this.pushSegment(`#include "${o.path}";`,o);return}this.process(o.chunk)},FeatureDebuggerExpression:function(o,a){if(this.transformer.buildOptions.isDevMode){this.pushSegment("debugger",o);return}this.pushSegment("//debugger",o)},FeatureLineExpression:function(o,a){if(this.transformer.buildOptions.isDevMode){this.pushSegment("#line",o);return}this.pushSegment(`${o.start.line}`,o)},FeatureFileExpression:function(o,a){if(this.transformer.buildOptions.isDevMode){this.pushSegment("#filename",o);return}this.pushSegment(`"${(0,EB.basename)(o.filename).replace(/"/g,()=>'"')}"`,o)},ListConstructorExpression:function(o,a){if(o.fields.length===0){this.pushSegment("[]",o);return}if(o.fields.length===1){this.pushSegment("[ ",o),this.process(o.fields[0]),this.pushSegment(" ]",o);return}if(this.context.isMultilineAllowed){this.context.incIndent(),this.pushSegment("[",{start:o.start,end:o.start}),this.eol();let u=new ef.BeautifyBodyIterator(o,o.fields),c=u.next();for(;!c.done;){let l=c.value;if(l.type===ef.FILLER_TYPE){this.pushSegment(this.context.getIndent()),this.pushComment(l.start.line),this.eol(),c=u.next();continue}this.pushSegment(this.context.getIndent(),l),this.process(l),this.pushSegment(",",l),this.eol(),c=u.next()}this.context.decIndent(),this.pushSegment(this.context.getIndent()+"]",{start:o.end,end:o.end});return}this.pushSegment("[ ",o);for(let u=0;u<o.fields.length;u++){let c=o.fields[u];this.process(c),u!==o.fields.length-1&&this.pushSegment(", ",c)}this.pushSegment(" ]",o)},ListValue:function(o,a){this.process(o.value)},BooleanLiteral:function(o,a){this.pushSegment((0,Zd.getLiteralRawValue)(o),o)},EmptyExpression:function(o,a){this.pushSegment("",o)},IsaExpression:function(o,a){this.process(o.left,{hasLogicalIndentActive:a.hasLogicalIndentActive}),this.pushSegment(" "+o.operator+" ",o),this.process(o.right,{hasLogicalIndentActive:a.hasLogicalIndentActive})},LogicalExpression:function(o,a){if((0,Cr.countRightBinaryExpressions)(o.right)>2){a.hasLogicalIndentActive||this.context.incIndent(),this.process(o.left,{hasLogicalIndentActive:!0}),this.pushSegment(" "+o.operator+" ",o),this.eol(),this.pushSegment(this.context.getIndent(),o),this.process(o.right,{hasLogicalIndentActive:!0}),a.hasLogicalIndentActive||this.context.decIndent();return}this.process(o.left,{hasLogicalIndentActive:a.hasLogicalIndentActive}),this.pushSegment(" "+o.operator+" ",o),this.process(o.right,{hasLogicalIndentActive:a.hasLogicalIndentActive})},BinaryExpression:function(o,a){if(o.operator==="|"){this.pushSegment("bitOr(",o),this.process(o.left),this.pushSegment(", ",o),this.process(o.right),this.pushSegment(")",o);return}else if(o.operator==="&"){this.pushSegment("bitAnd(",o),this.process(o.left),this.pushSegment(", ",o),this.process(o.right),this.pushSegment(")",o);return}else if(o.operator==="<<"||o.operator===">>"||o.operator===">>>")throw new Error("Operators in binary expression are not supported");this.process(o.left),this.pushSegment(" "+o.operator+" ",o),this.process(o.right)},BinaryNegatedExpression:function(o,a){this.pushSegment(o.operator,o),this.process(o.argument)},ComparisonGroupExpression:function(o,a){this.process(o.expressions[0]);for(let u=0;u<o.operators.length;u++)this.pushSegment(" "+o.operators[u]+" ",o),this.process(o.expressions[u+1])},Chunk:function(o,a){this.context.pushStack(o),this.context.buildBlock(o),this.context.popStack()}};let{keepParentheses:n=!1,indentation:r=UC.IndentationType.Tab,indentationSpaces:i=2,isDevMode:s=!1}=e.buildOptions;this.context=new UC.BeautifyContext(this,{keepParentheses:n,indentation:r,indentationSpaces:i,isDevMode:s})}createLine(){return{segments:[],comments:[]}}pushSegment(e,n){this._activeLine.segments.push(e),n!=null&&this.pushComment(n.start.line)}pushComment(e){let n=this.context.getCurrentChunk(),r=this.context.getChunkContext(n),i=r.commentBuckets.get(e);i&&(this._activeLine.comments.push(...i),r.commentBuckets.delete(e))}transform(e,n){return this.reset(),this._currentDependency=n,this.process(e),this._lines.map(r=>{let i=r.segments.join(""),s=i.trim();if(r.comments.length===0)return s.length===0?"":i;let o=r.comments.filter(l=>l.isBefore),a=o.map(Cr.commentToText).join(""),u=r.comments.filter(l=>!l.isBefore),c=u.map(Cr.commentToText).join("");return s.length===0&&o.length===0&&u.length===0?"":(s.length>0&&o.length>0&&(i=" "+i),s.length>0&&u.length>0&&(i=i+" "),a+i+c)}).join(`
115
+ `);h.forEach((d,g)=>{let y=o+g;n.has(y)||n.set(y,[]);let C=e.lines[y].filter(L=>L.type!==Hs.ASTType.Comment).map(L=>L.start.character),k=C.length>0?Math.min(...C):-1,T=y===o,w=y===o+h.length-1,v=w?l.end.character<k:!1;n.get(y).push({isMultiline:!0,isStart:T,isEnd:w,isBefore:v,value:d})})}else n.has(o)||n.set(o,[]),n.get(o).push({isMultiline:!1,isStart:!1,isEnd:!1,isBefore:!1,value:l.value})}}return{commentBuckets:n}}getChunkContext(e){return this._contexts.get(e)}getCurrentChunk(){return this._stack[this._stack.length-1]}pushStack(e){this._stack.push(e),this._contexts.set(e,this.buildChunkContext(e))}popStack(){this._stack.pop()}disableMultiline(){this._isMultilineAllowed=!1}enableMultiline(){this._isMultilineAllowed=!0}incIndent(){this._indent++}decIndent(){this._indent--}getBlockOpenerEndLine(e){return e instanceof Hs.ASTIfClause||e instanceof Hs.ASTWhileStatement?e.condition.end.line:e instanceof Hs.ASTForGenericStatement?e.iterator.end.line:e instanceof Hs.ASTChunk?e.start.line-1:e.start.line}getPreviousEndLine(e){if(e==null)return 0;if(e.type===Hs.ASTType.IfShortcutStatement){let n=e;return n.clauses[n.clauses.length-1].body[0].end.line}return e.end.line}buildBlock(e){let n=new $C.BeautifyBodyIterator(e,e.body),r=n.next();for(;!r.done;){let i=r.value;if(i.type===$C.FILLER_TYPE){this.factory.pushSegment(this.getIndent()),this.factory.pushComment(i.start.line),this.factory.eol(),r=n.next();continue}this.factory.pushSegment(this.getIndent()),this.factory.process(i,{isCommand:!0}),this.factory.eol(),r=n.next()}}};Gs.BeautifyContext=Av});var Ov=m(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.commentToText=qt.hasEmptyBody=qt.containsMultilineItemInShortcutClauses=qt.getLastComment=qt.unwrap=qt.countRightBinaryExpressions=qt.SHORTHAND_OPERATORS=void 0;var kn=ke();qt.SHORTHAND_OPERATORS=[kn.Operator.Plus,kn.Operator.Minus,kn.Operator.Asterik,kn.Operator.Slash,kn.Operator.Modulo,kn.Operator.Power];var yB=t=>{if(t=(0,qt.unwrap)(t),t instanceof kn.ASTComparisonGroupExpression)return t.expressions.length;let e=[t],n=0;for(;e.length>0;){let r=e.pop();r instanceof kn.ASTBinaryExpression&&n++,(r instanceof kn.ASTBinaryExpression||r instanceof kn.ASTLogicalExpression||r instanceof kn.ASTIsaExpression)&&(e.push((0,qt.unwrap)(r.left)),e.push((0,qt.unwrap)(r.right)))}return n};qt.countRightBinaryExpressions=yB;var bB=t=>{for(;t instanceof kn.ASTParenthesisExpression;)t=t.expression;return t};qt.unwrap=bB;var _B=t=>{for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.type===kn.ASTType.Comment)return n}return null};qt.getLastComment=_B;var vB=(t,e)=>e.some(n=>t.line<n.body[0].end.line);qt.containsMultilineItemInShortcutClauses=vB;var SB=t=>!t.some(e=>!(e instanceof kn.ASTComment));qt.hasEmptyBody=SB;var wB=t=>t.isMultiline?t.isStart&&!t.isEnd?"/* "+t.value.trim():!t.isStart&&t.isEnd?t.value.trim()+" */":t.isStart&&t.isEnd?"/* "+t.value.trim()+" */":t.value.trim():"// "+t.value.trim();qt.commentToText=wB});var Pv=m(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.Stack=void 0;var Rv=class{constructor(){let e=this;e.currentStack=[]}get(e){let r=this.currentStack;e==null&&(e=0);let i=r.length-e-1;return i<0?null:r[i]}depth(){return this.currentStack.filter(function(e){return Object.prototype.hasOwnProperty.call(e,"body")}).length}lookup(e){let n=this;for(let r=n.currentStack.length-2;r>=0;r--)if(e(n.currentStack[r]))return!0;return!1}push(e){let n=this;return n.currentStack.push(e),n}pop(){let e=this;return e.currentStack.pop(),e}};Jd.Stack=Rv});var Wu=m(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.Factory=void 0;var TB=Pv(),Dv=class{get activeLine(){return this._activeLine}get lines(){return this._lines}get currentStack(){return this._currentStack}get currentDependency(){return this._currentDependency}constructor(e){this.transformer=e,this._activeLine=this.createLine(),this._lines=[],this._currentDependency=null,this._currentStack=new TB.Stack}pushSegment(e,n){this._activeLine.segments.push(e)}pushComment(e){throw new Error("Not implemented")}createLine(){return{segments:[]}}eol(e){this._lines.push(this._activeLine),this._activeLine=this.createLine()}reset(){this._activeLine=this.createLine(),this._lines=[]}process(e,n={}){let r=this,i=r._currentStack;if(e==null)return;if(e.type==null)throw console.error("Error AST type:",e),new Error("Unexpected AST type");let s=r.handlers[e.type];if(s==null)throw console.error("Error AST:",e),new Error("Type does not exist "+e.type);i.push(e),s.call(this,e,n),i.pop()}};Qd.Factory=Dv});var Mv=m(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.BeautifyFactory=void 0;var Uu=ke(),EB=require("path"),WC=Ev(),Zd=aa(),ef=kv(),UC=Cv(),Cr=Ov(),xB=Wu(),Iv=class extends xB.Factory{constructor(e){super(e),this.handlers={ParenthesisExpression:function(o,a){this.pushSegment("(",o),this.process(o.expression,{hasLogicalIndentActive:a.hasLogicalIndentActive}),this.pushSegment(")",o)},Comment:function(o,a){},AssignmentStatement:function(o,a){let u=o.variable,c=o.init;if(this.process(u),(u instanceof Uu.ASTIdentifier||u instanceof Uu.ASTMemberExpression)&&c instanceof Uu.ASTBinaryExpression&&(c.left instanceof Uu.ASTIdentifier||c.left instanceof Uu.ASTMemberExpression)&&Cr.SHORTHAND_OPERATORS.includes(c.operator)&&(0,WC.createExpressionHash)(u)===(0,WC.createExpressionHash)(c.left)){this.pushSegment(" "+c.operator+"= ",o),this.process((0,Cr.unwrap)(c.right));return}this.pushSegment(" = ",o),this.process(c)},MemberExpression:function(o,a){this.process(o.base),this.pushSegment(o.indexer,o),this.process(o.identifier)},FunctionDeclaration:function(o,a){if(o.parameters.length===0)this.pushSegment("function",{start:o.start,end:o.start});else{this.context.disableMultiline(),this.pushSegment("function(",{start:o.start,end:o.start});for(let u=0;u<o.parameters.length;u++){let c=o.parameters[u];this.process(c),u!==o.parameters.length-1&&this.pushSegment(", ",c)}this.pushSegment(")",{start:o.start,end:o.start}),this.context.enableMultiline()}this.eol(),this.context.incIndent(),this.context.buildBlock(o),this.context.decIndent(),this.pushSegment(this.context.getIndent()+"end function",{start:o.end,end:o.end})},MapConstructorExpression:function(o,a){if(o.fields.length===0){this.pushSegment("{}",o);return}if(o.fields.length===1){this.pushSegment("{ ",o),this.process(o.fields[0]),this.pushSegment(" }",o);return}if(this.context.isMultilineAllowed){this.context.incIndent(),this.pushSegment("{",{start:o.start,end:o.start}),this.eol();let u=new ef.BeautifyBodyIterator(o,o.fields),c=u.next();for(;!c.done;){let l=c.value;if(l.type===ef.FILLER_TYPE){this.pushSegment(this.context.getIndent()),this.pushComment(l.start.line),this.eol(),c=u.next();continue}this.pushSegment(this.context.getIndent(),l),this.process(l),this.pushSegment(",",l),this.eol(),c=u.next()}this.context.decIndent(),this.pushSegment(this.context.getIndent()+"}",{start:o.end,end:o.end});return}this.pushSegment("{ ",{start:o.start,end:o.start});for(let u=0;u<o.fields.length;u++){let c=o.fields[u];this.process(c),u!==o.fields.length-1&&this.pushSegment(", ",c)}this.context.decIndent(),this.pushSegment(" }",{start:o.end,end:o.end})},MapKeyString:function(o,a){this.process(o.key),this.pushSegment(": ",o),this.process(o.value)},Identifier:function(o,a){this.pushSegment(o.name,o)},ReturnStatement:function(o,a){this.pushSegment("return ",o),o.argument&&this.process(o.argument)},NumericLiteral:function(o,a){this.pushSegment((0,Zd.getLiteralValue)(o),o)},WhileStatement:function(o,a){this.pushSegment("while ",{start:o.start,end:o.start}),this.context.disableMultiline(),this.process(o.condition),this.context.enableMultiline(),this.eol(),this.context.incIndent(),this.context.buildBlock(o),this.context.decIndent(),this.pushSegment(this.context.getIndent()+"end while",{start:o.end,end:o.end})},CallExpression:function(o,a){let u=this.lines.length-1;if(this.process(o.base),o.arguments.length===0)return;if(o.arguments.length>3&&this.context.isMultilineAllowed){this.context.incIndent(),this.pushSegment("(",{start:o.start,end:o.start}),this.eol();for(let l=0;l<o.arguments.length;l++){let h=o.arguments[l];this.pushSegment(this.context.getIndent(),h),this.process(h),l!==o.arguments.length-1&&(this.pushSegment(",",h),this.eol())}this.context.decIndent(),this.pushSegment(")",{start:o.end,end:o.end});return}a.isCommand&&!this.transformer.buildOptions.keepParentheses?this.pushSegment(" ",{start:o.start,end:o.start}):this.pushSegment("(",{start:o.start,end:o.start});let c=this.lines.length;for(let l=0;l<o.arguments.length;l++){let h=o.arguments[l];this.process(h),l!==o.arguments.length-1&&this.pushSegment(", ",h)}a.isCommand&&!this.transformer.buildOptions.keepParentheses||this.pushSegment(")",{start:o.end,end:o.end})},StringLiteral:function(o,a){this.pushSegment((0,Zd.getLiteralRawValue)(o),{start:o.end,end:o.end})},SliceExpression:function(o,a){this.process(o.base),this.pushSegment("[",o),this.process(o.left),this.pushSegment(" : ",o),this.process(o.right),this.pushSegment("]",o)},IndexExpression:function(o,a){this.process(o.base),this.pushSegment("[",o),this.process(o.index),this.pushSegment("]",o)},UnaryExpression:function(o,a){o.operator==="new"?this.pushSegment(o.operator+" ",o):this.pushSegment(o.operator,o),this.process(o.argument)},NegationExpression:function(o,a){this.pushSegment("not ",o),this.process(o.argument)},FeatureEnvarExpression:function(o,a){if(this.transformer.buildOptions.isDevMode){this.pushSegment(`#envar ${o.name}`,o);return}let u=this.transformer.environmentVariables.get(o.name);if(!u){this.pushSegment("null",o);return}this.pushSegment(`"${u}"`,o)},IfShortcutStatement:function(o,a){for(let u=0;u<o.clauses.length;u++){let c=o.clauses[u];this.process(c),u!==o.clauses.length-1&&this.pushSegment(" ",o)}},IfShortcutClause:function(o,a){this.pushSegment("if ",o),this.process((0,Cr.unwrap)(o.condition)),this.pushSegment(" then ",o),this.process(o.body[0])},ElseifShortcutClause:function(o,a){this.pushSegment("else if ",o),this.process((0,Cr.unwrap)(o.condition)),this.pushSegment(" then ",o),this.process(o.body[0])},ElseShortcutClause:function(o,a){this.pushSegment("else ",o),this.process(o.body[0])},NilLiteral:function(o,a){this.pushSegment((0,Zd.getLiteralRawValue)(o),o)},ForGenericStatement:function(o,a){this.pushSegment("for ",{start:o.start,end:o.start}),this.process((0,Cr.unwrap)(o.variable)),this.pushSegment(" in ",{start:o.start,end:o.start}),this.process((0,Cr.unwrap)(o.iterator)),this.eol(),this.context.incIndent(),this.context.buildBlock(o),this.context.decIndent(),this.pushSegment(this.context.getIndent()+"end for",{start:o.end,end:o.end})},IfStatement:function(o,a){for(let u of o.clauses)this.process(u);this.pushSegment(this.context.getIndent()+"end if",{start:o.end,end:o.end})},IfClause:function(o,a){this.pushSegment("if ",{start:o.start,end:o.start}),this.process((0,Cr.unwrap)(o.condition)),this.pushSegment(" then",{start:o.start,end:o.start}),this.eol(),this.context.incIndent(),this.context.buildBlock(o),this.context.decIndent()},ElseifClause:function(o,a){this.pushSegment(this.context.getIndent()+"else if ",{start:o.start,end:o.start}),this.process((0,Cr.unwrap)(o.condition)),this.pushSegment(" then",{start:o.start,end:o.start}),this.eol(),this.context.incIndent(),this.context.buildBlock(o),this.context.decIndent()},ElseClause:function(o,a){this.pushSegment(this.context.getIndent()+"else",{start:o.start,end:o.start}),this.eol(),this.context.incIndent(),this.context.buildBlock(o),this.context.decIndent()},ContinueStatement:function(o,a){this.pushSegment("continue",o)},BreakStatement:function(o,a){this.pushSegment("break",o)},CallStatement:function(o,a){this.process(o.expression,{isCommand:!0})},FeatureInjectExpression:function(o,a){if(this.transformer.buildOptions.isDevMode){this.pushSegment(`#inject "${o.path}";`,o);return}if(this.currentDependency===null){this.pushSegment(`#inject "${o.path}";`,o);return}let u=this.currentDependency.injections.get(o.path);if(u==null){this.pushSegment("null",o);return}this.pushSegment(`"${u.replace(/"/g,()=>'""')}"`,o)},FeatureImportExpression:function(o,a){if(this.transformer.buildOptions.isDevMode){this.pushSegment("#import ",o),this.process(o.name),this.pushSegment(` from "${o.path}";`,o);return}if(!o.chunk){this.pushSegment("#import ",o),this.process(o.name),this.pushSegment(` from "${o.path}";`,o);return}this.process(o.name),this.pushSegment(' = __REQUIRE("'+o.namespace+'")',o)},FeatureIncludeExpression:function(o,a){if(this.transformer.buildOptions.isDevMode){this.pushSegment(`#include "${o.path}";`,o);return}if(!o.chunk){this.pushSegment(`#include "${o.path}";`,o);return}this.process(o.chunk)},FeatureDebuggerExpression:function(o,a){if(this.transformer.buildOptions.isDevMode){this.pushSegment("debugger",o);return}this.pushSegment("//debugger",o)},FeatureLineExpression:function(o,a){if(this.transformer.buildOptions.isDevMode){this.pushSegment("#line",o);return}this.pushSegment(`${o.start.line}`,o)},FeatureFileExpression:function(o,a){if(this.transformer.buildOptions.isDevMode){this.pushSegment("#filename",o);return}this.pushSegment(`"${(0,EB.basename)(o.filename).replace(/"/g,()=>'"')}"`,o)},ListConstructorExpression:function(o,a){if(o.fields.length===0){this.pushSegment("[]",o);return}if(o.fields.length===1){this.pushSegment("[ ",o),this.process(o.fields[0]),this.pushSegment(" ]",o);return}if(this.context.isMultilineAllowed){this.context.incIndent(),this.pushSegment("[",{start:o.start,end:o.start}),this.eol();let u=new ef.BeautifyBodyIterator(o,o.fields),c=u.next();for(;!c.done;){let l=c.value;if(l.type===ef.FILLER_TYPE){this.pushSegment(this.context.getIndent()),this.pushComment(l.start.line),this.eol(),c=u.next();continue}this.pushSegment(this.context.getIndent(),l),this.process(l),this.pushSegment(",",l),this.eol(),c=u.next()}this.context.decIndent(),this.pushSegment(this.context.getIndent()+"]",{start:o.end,end:o.end});return}this.pushSegment("[ ",o);for(let u=0;u<o.fields.length;u++){let c=o.fields[u];this.process(c),u!==o.fields.length-1&&this.pushSegment(", ",c)}this.pushSegment(" ]",o)},ListValue:function(o,a){this.process(o.value)},BooleanLiteral:function(o,a){this.pushSegment((0,Zd.getLiteralRawValue)(o),o)},EmptyExpression:function(o,a){this.pushSegment("",o)},IsaExpression:function(o,a){this.process(o.left,{hasLogicalIndentActive:a.hasLogicalIndentActive}),this.pushSegment(" "+o.operator+" ",o),this.process(o.right,{hasLogicalIndentActive:a.hasLogicalIndentActive})},LogicalExpression:function(o,a){if((0,Cr.countRightBinaryExpressions)(o.right)>2){a.hasLogicalIndentActive||this.context.incIndent(),this.process(o.left,{hasLogicalIndentActive:!0}),this.pushSegment(" "+o.operator+" ",o),this.eol(),this.pushSegment(this.context.getIndent(),o),this.process(o.right,{hasLogicalIndentActive:!0}),a.hasLogicalIndentActive||this.context.decIndent();return}this.process(o.left,{hasLogicalIndentActive:a.hasLogicalIndentActive}),this.pushSegment(" "+o.operator+" ",o),this.process(o.right,{hasLogicalIndentActive:a.hasLogicalIndentActive})},BinaryExpression:function(o,a){if(o.operator==="|"){this.pushSegment("bitOr(",o),this.process(o.left),this.pushSegment(", ",o),this.process(o.right),this.pushSegment(")",o);return}else if(o.operator==="&"){this.pushSegment("bitAnd(",o),this.process(o.left),this.pushSegment(", ",o),this.process(o.right),this.pushSegment(")",o);return}else if(o.operator==="<<"||o.operator===">>"||o.operator===">>>")throw new Error("Operators in binary expression are not supported");this.process(o.left),this.pushSegment(" "+o.operator+" ",o),this.process(o.right)},BinaryNegatedExpression:function(o,a){this.pushSegment(o.operator,o),this.process(o.argument)},ComparisonGroupExpression:function(o,a){this.process(o.expressions[0]);for(let u=0;u<o.operators.length;u++)this.pushSegment(" "+o.operators[u]+" ",o),this.process(o.expressions[u+1])},Chunk:function(o,a){this.context.pushStack(o),this.context.buildBlock(o),this.context.popStack()}};let{keepParentheses:n=!1,indentation:r=UC.IndentationType.Tab,indentationSpaces:i=2,isDevMode:s=!1}=e.buildOptions;this.context=new UC.BeautifyContext(this,{keepParentheses:n,indentation:r,indentationSpaces:i,isDevMode:s})}createLine(){return{segments:[],comments:[]}}pushSegment(e,n){this._activeLine.segments.push(e),n!=null&&this.pushComment(n.start.line)}pushComment(e){let n=this.context.getCurrentChunk(),r=this.context.getChunkContext(n),i=r.commentBuckets.get(e);i&&(this._activeLine.comments.push(...i),r.commentBuckets.delete(e))}transform(e,n){return this.reset(),this._currentDependency=n,this.process(e),this._lines.map(r=>{let i=r.segments.join(""),s=i.trim();if(r.comments.length===0)return s.length===0?"":i;let o=r.comments.filter(l=>l.isBefore),a=o.map(Cr.commentToText).join(""),u=r.comments.filter(l=>!l.isBefore),c=u.map(Cr.commentToText).join("");return s.length===0&&o.length===0&&u.length===0?"":(s.length>0&&o.length>0&&(i=" "+i),s.length>0&&u.length>0&&(i=i+" "),a+i+c)}).join(`
116
116
  `)}generateOptimizations(){return[]}};tf.BeautifyFactory=Iv});var Nv=m(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.DefaultFactory=void 0;var kB=require("path"),nf=aa(),AB=Wu(),Lv=class extends AB.Factory{constructor(){super(...arguments),this.handlers={ParenthesisExpression:function(e,n){this.pushSegment("("),this.process(e.expression),this.pushSegment(")")},Comment:function(e,n){if(e.isMultiline){this.pushSegment(e.value.split(`
117
117
  `).map(r=>`//${r}`).join(`
118
118
  `));return}this.pushSegment("//"+e.value)},AssignmentStatement:function(e,n){let r=e.variable,i=e.init;this.process(r),this.pushSegment("="),this.process(i)},MemberExpression:function(e,n){this.process(e.base),this.pushSegment(e.indexer),this.process(e.identifier)},FunctionDeclaration:function(e,n){if(e.parameters.length===0)this.pushSegment("function");else{this.pushSegment("function(");for(let r=0;r<e.parameters.length;r++){let i=e.parameters[r];this.process(i),r!==e.parameters.length-1&&this.pushSegment(",")}this.pushSegment(")")}this.eol();for(let r of e.body)this.process(r),this.eol();this.pushSegment("end function")},MapConstructorExpression:function(e,n){this.pushSegment("{");for(let r=0;r<e.fields.length;r++){let i=e.fields[r];this.process(i),r!==e.fields.length-1&&this.pushSegment(",")}this.pushSegment("}")},MapKeyString:function(e,n){this.process(e.key),this.pushSegment(":"),this.process(e.value)},Identifier:function(e,n){this.pushSegment(e.name)},ReturnStatement:function(e,n){this.pushSegment("return "),e.argument&&this.process(e.argument)},NumericLiteral:function(e,n){this.pushSegment((0,nf.getLiteralValue)(e))},WhileStatement:function(e,n){this.pushSegment("while "),this.process(e.condition),this.eol();for(let r of e.body)this.process(r),this.eol();this.pushSegment("end while")},CallExpression:function(e,n){if(this.process(e.base),e.arguments.length!==0){this.pushSegment("(");for(let r=0;r<e.arguments.length;r++){let i=e.arguments[r];this.process(i),r!==e.arguments.length-1&&this.pushSegment(",")}this.pushSegment(")")}},StringLiteral:function(e,n){this.pushSegment((0,nf.getLiteralRawValue)(e))},SliceExpression:function(e,n){this.process(e.base),this.pushSegment("["),this.process(e.left),this.pushSegment(":"),this.process(e.right),this.pushSegment("]")},IndexExpression:function(e,n){this.process(e.base),this.pushSegment("["),this.process(e.index),this.pushSegment("]")},UnaryExpression:function(e,n){e.operator==="new"?this.pushSegment(e.operator+" "):this.pushSegment(e.operator),this.process(e.argument)},NegationExpression:function(e,n){this.pushSegment(e.operator+" "),this.process(e.argument)},FeatureEnvarExpression:function(e,n){if(this.transformer.buildOptions.isDevMode){this.pushSegment(`#envar ${e.name}`);return}let r=this.transformer.environmentVariables.get(e.name);if(!r){this.pushSegment("null");return}this.pushSegment(`"${r}"`)},IfShortcutStatement:function(e,n){for(let r=0;r<e.clauses.length;r++){let i=e.clauses[r];this.process(i),r!==e.clauses.length-1&&this.pushSegment(" ")}},IfShortcutClause:function(e,n){this.pushSegment("if "),this.process(e.condition),this.pushSegment(" then "),this.process(e.body[0])},ElseifShortcutClause:function(e,n){this.pushSegment("else if "),this.process(e.condition),this.pushSegment(" then "),this.process(e.body[0])},ElseShortcutClause:function(e,n){this.pushSegment("else "),this.process(e.body[0])},NilLiteral:function(e,n){this.pushSegment((0,nf.getLiteralRawValue)(e))},ForGenericStatement:function(e,n){this.pushSegment("for "),this.process(e.variable),this.pushSegment(" in "),this.process(e.iterator),this.eol();for(let r of e.body)this.process(r),this.eol();this.pushSegment("end for")},IfStatement:function(e,n){for(let r of e.clauses)this.process(r);this.pushSegment("end if")},IfClause:function(e,n){this.pushSegment("if "),this.process(e.condition),this.pushSegment(" then"),this.eol();for(let r of e.body)this.process(r),this.eol()},ElseifClause:function(e,n){this.pushSegment("else if "),this.process(e.condition),this.pushSegment(" then"),this.eol();for(let r of e.body)this.process(r),this.eol()},ElseClause:function(e,n){this.pushSegment("else"),this.eol();for(let r of e.body)this.process(r),this.eol()},ContinueStatement:function(e,n){this.pushSegment("continue")},BreakStatement:function(e,n){this.pushSegment("break")},CallStatement:function(e,n){this.process(e.expression)},FeatureInjectExpression:function(e,n){if(this.transformer.buildOptions.isDevMode){this.pushSegment(`#inject "${e.path}"`);return}if(this.currentDependency===null){this.pushSegment(`#inject "${e.path}";`);return}let r=this.currentDependency.injections.get(e.path);if(r==null){this.pushSegment("null");return}this.pushSegment(`"${r.replace(/"/g,()=>'""')}"`)},FeatureImportExpression:function(e,n){if(this.transformer.buildOptions.isDevMode){this.pushSegment("#import "),this.process(e.name),this.pushSegment(` from "${e.path}";`);return}if(!e.chunk){this.pushSegment("#import "),this.process(e.name),this.pushSegment(` from "${e.path}";`);return}this.process(e.name),this.pushSegment(' = __REQUIRE("'+e.namespace+'")')},FeatureIncludeExpression:function(e,n){if(this.transformer.buildOptions.isDevMode){this.pushSegment(`#include "${e.path}";`);return}if(!e.chunk){this.pushSegment(`#include "${e.path}";`);return}this.process(e.chunk)},FeatureDebuggerExpression:function(e,n){if(this.transformer.buildOptions.isDevMode){this.pushSegment("debugger");return}this.pushSegment("//debugger")},FeatureLineExpression:function(e,n){if(this.transformer.buildOptions.isDevMode){this.pushSegment("#line");return}this.pushSegment(`${e.start.line}`)},FeatureFileExpression:function(e,n){if(this.transformer.buildOptions.isDevMode){this.pushSegment("#filename");return}this.pushSegment(`"${(0,kB.basename)(e.filename).replace(/"/g,()=>'"')}"`)},ListConstructorExpression:function(e,n){this.pushSegment("[");for(let r=0;r<e.fields.length;r++){let i=e.fields[r];this.process(i),r!==e.fields.length-1&&this.pushSegment(",")}this.pushSegment("]")},ListValue:function(e,n){this.process(e.value)},BooleanLiteral:function(e,n){this.pushSegment((0,nf.getLiteralRawValue)(e))},EmptyExpression:function(e,n){this.pushSegment("")},IsaExpression:function(e,n){this.process(e.left),this.pushSegment(" "+e.operator+" "),this.process(e.right)},LogicalExpression:function(e,n){this.process(e.left),this.pushSegment(" "+e.operator+" "),this.process(e.right)},BinaryExpression:function(e,n){if(e.operator==="|"){this.pushSegment("bitOr("),this.process(e.left),this.pushSegment(","),this.process(e.right),this.pushSegment(")");return}else if(e.operator==="&"){this.pushSegment("bitAnd("),this.process(e.left),this.pushSegment(","),this.process(e.right),this.pushSegment(")");return}else if(e.operator==="<<"||e.operator===">>"||e.operator===">>>")throw new Error("Operators in binary expression are not supported");this.process(e.left),this.pushSegment(e.operator),this.process(e.right)},BinaryNegatedExpression:function(e,n){this.pushSegment(e.operator),this.process(e.argument)},ComparisonGroupExpression:function(e,n){this.process(e.expressions[0]);for(let r=0;r<e.operators.length;r++)this.pushSegment(e.operators[r]),this.process(e.expressions[r+1])},Chunk:function(e,n){for(let r of e.body)this.process(r),this.eol()}}}transform(e,n){return this.reset(),this._currentDependency=n,this.process(e),this._lines.map(r=>r.segments.join("")).join(`
@@ -143,7 +143,7 @@ ${e}`;for(let a=0;a<this.details.length;++a){let u=a+1;o=`${o}
143
143
  `),n.length>0&&(t.appendMarkdown(`#### Examples:
144
144
  `),t.appendCodeblock(fO.LanguageId,n.join(`
145
145
  `)))};lt.appendTooltipBody=Y2;var J2=t=>{let e=[];for(let n of t.signatureDefinitions){let r=n,s={label:(0,lt.createTooltipHeader)(t,r)},o=r.getArguments()??[],a=new pO.MarkdownString("");(0,lt.appendTooltipBody)(a,r),s.parameters=o.map(u=>({label:`${u.getLabel()}${u.isOptional()?"?":""}: ${u.getTypes().join(" or ")}`})),s.documentation=a.toString(),e.push(s)}return e};lt.createSignatureInfo=J2;var Q2=t=>{let e=[];for(let n of t.signatureDefinitions){let r=new pO.MarkdownString(""),i=n;(0,lt.appendTooltipHeader)(r,t,i),(0,lt.appendTooltipBody)(r,i),e.push(r)}return{contents:e.map(n=>n.toString())}};lt.createHover=Q2});var bO=m(ha=>{"use strict";var Z2=ha&&ha.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ha,"__esModule",{value:!0});ha.activate=void 0;var mO=Yr(),pS=jn(),eW=Z2(require("path")),Yu=Af(),tW=ea(),yO=Of(),Pf=Rf(),nW=ji(),rW=async(t,e,n)=>{let r=Yu.URI.parse(e.uri),i=await t.fs.getWorkspaceFolderUri(r);return i==null?Yu.Utils.joinPath(r,".."):n.startsWith("/")?i:Yu.Utils.joinPath(r,"..")};function iW(t){async function e(n,r){let i=new yO.MarkdownString(""),o=r.closest.path,a=await rW(t,n,o),u=Yu.Utils.joinPath(a,o),c=Yu.Utils.joinPath(a,`${o}`),l=await t.fs.findExistingPath(u.toString(),c.toString()),h=l==null?["Cannot open file."]:[`[Inserts file "${eW.default.basename(l)}" inside this code when building](${l.toString()})`,"***","Click the link above to open the file."];return i.appendMarkdown(h.join(`
146
- `)),{contents:i.toString()}}t.connection.onHover(async n=>{if(!t.getConfiguration().hoverdocs)return;let r=await t.fs.getTextDocument(n.textDocument.uri);if(r==null)return;let i=new tW.LookupHelper(r,t),s=i.lookupAST(n.position);if(!s)return;if(s.closest.type===mO.ASTType.FeatureImportExpression||s.closest.type===mO.ASTType.FeatureIncludeExpression)return await e(r,s);let o=await i.lookupTypeInfo(s);if(!o)return;if(o.isCallable())return(0,Pf.createHover)(o);let a=new yO.MarkdownString(""),u=o.toMeta().map(pS.SignatureDefinitionTypeMeta.parse),c=`(${(0,Pf.formatKind)(o.kind)}) ${o.label}: ${(0,Pf.formatTypes)(u)}`;if(o.types.has(pS.SignatureDefinitionBaseType.Map)){let l={};for(let[h,d]of o.values){let g=d.toMeta().map(pS.SignatureDefinitionTypeMeta.parse);l[h.slice(2)]=(0,Pf.formatTypes)(g)}c+=" "+JSON.stringify(l,null,2)}return a.appendCodeblock(nW.LanguageId,c),{contents:a.toString()}})}ha.activate=iW});var vO=m(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.activate=void 0;var _O=ke(),sW=ea(),oW=Rf(),aW=t=>{if(t.closest.type===_O.ASTType.CallExpression)return t.closest;for(let e=t.outer.length-1;e>=0;e--){let n=t.outer[e];if(n.type===_O.ASTType.CallExpression)return n}return null};function uW(t){t.connection.onSignatureHelp(async e=>{if(!t.getConfiguration().autocomplete)return;let n=await t.fs.getTextDocument(e.textDocument.uri);if(n==null)return;await t.documentManager.getLatest(n);let r=new sW.LookupHelper(n,t),i=r.lookupAST(e.position);if(!i)return;let{closest:s}=i,o=aW(i);if(o===null)return;let a=await r.lookupTypeInfo({closest:o.base,outer:s.scope?[s.scope]:[]});if(!a||!a.isCallable())return;let c=o.arguments.findIndex(h=>{let d=h.start.character-1,g=h.end.character;return d<=e.position.character&&g>=e.position.character}),l={activeParameter:c===-1?0:c,signatures:[],activeSignature:0};return l.signatures.push(...(0,oW.createSignatureInfo)(a)),l})}Df.activate=uW});var wO=m(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.activate=void 0;var SO=ji();function cW(t){let e=r=>r.languageId!==SO.LanguageId?!1:t.documentManager.schedule(r),n=r=>{r.languageId===SO.LanguageId&&t.documentManager.clear(r)};t.fs.on("text-document-open",e),t.fs.on("text-document-change",e),t.fs.on("text-document-close",n)}If.activate=cW});var TO=m((BV,lW)=>{lW.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 EO=m((WV,hW)=>{hW.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:
146
+ `)),{contents:i.toString()}}t.connection.onHover(async n=>{if(!t.getConfiguration().hoverdocs)return;let r=await t.fs.getTextDocument(n.textDocument.uri);if(r==null)return;let i=new tW.LookupHelper(r,t),s=i.lookupAST(n.position);if(!s)return;if(s.closest.type===mO.ASTType.FeatureImportExpression||s.closest.type===mO.ASTType.FeatureIncludeExpression)return await e(r,s);let o=await i.lookupTypeInfo(s);if(!o)return;if(o.isCallable())return(0,Pf.createHover)(o);let a=new yO.MarkdownString(""),u=o.toMeta().map(pS.SignatureDefinitionTypeMeta.parse),c=`(${(0,Pf.formatKind)(o.kind)}) ${o.label}: ${(0,Pf.formatTypes)(u)}`;if(o.types.has(pS.SignatureDefinitionBaseType.Map)){let l={};for(let[h,d]of o.values){let g=d.toMeta().map(pS.SignatureDefinitionTypeMeta.parse);l[h.slice(2)]=(0,Pf.formatTypes)(g)}c+=" "+JSON.stringify(l,null,2)}return a.appendCodeblock(nW.LanguageId,c),{contents:a.toString()}})}ha.activate=iW});var vO=m(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.activate=void 0;var _O=ke(),sW=ea(),oW=Rf(),aW=t=>{if(t.closest.type===_O.ASTType.CallExpression)return t.closest;for(let e=t.outer.length-1;e>=0;e--){let n=t.outer[e];if(n.type===_O.ASTType.CallExpression)return n}return null};function uW(t){t.connection.onSignatureHelp(async e=>{if(!t.getConfiguration().autocomplete)return;let n=await t.fs.getTextDocument(e.textDocument.uri);if(n==null)return;await t.documentManager.getLatest(n);let r=new sW.LookupHelper(n,t),i=r.lookupAST(e.position);if(!i)return;let{closest:s}=i,o=aW(i);if(o===null)return;let a=await r.lookupTypeInfo({closest:o.base,outer:s.scope?[s.scope]:[]});if(!a||!a.isCallable())return;let c=o.arguments.findIndex(h=>{let d=h.start.character-1,g=h.end.character;return d<=e.position.character&&g>=e.position.character}),l={activeParameter:c===-1?0:c,signatures:[],activeSignature:0};return l.signatures.push(...(0,oW.createSignatureInfo)(a)),l})}Df.activate=uW});var wO=m(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.activate=void 0;var SO=ji();function cW(t){let e=r=>r.languageId!==SO.LanguageId?!1:t.documentManager.schedule(r),n=r=>{r.languageId===SO.LanguageId&&t.documentManager.clear(r)};t.fs.on("text-document-open",e),t.fs.on("text-document-change",e),t.fs.on("text-document-close",n)}If.activate=cW});var TO=m((BV,lW)=>{lW.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 EO=m((WV,hW)=>{hW.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:"Generates a `list` where each item is a `number`. By default, if only one argument is provided, the list starts at the given value and decrements by one for each item. You can optionally define a start and end value, as well as customize the incremental value. 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:
147
147
  miniscript: a string such as "1.5"
148
148
  buildDate: a date in yyyy-mm-dd format, like "2020-05-28"
149
149
  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.9.3",
3
+ "version": "1.9.4",
4
4
  "description": "Language server for MiniScript",
5
5
  "main": "./index.js",
6
6
  "scripts": {
@@ -69,9 +69,9 @@
69
69
  "dependencies": {
70
70
  "glob": "^11.0.0",
71
71
  "greybel-core": "~2.5.1",
72
- "greybel-transpiler": "~3.6.1",
72
+ "greybel-transpiler": "~3.6.2",
73
73
  "miniscript-languageserver-core": "^1.8.0",
74
- "miniscript-meta": "~1.3.1",
74
+ "miniscript-meta": "~1.3.2",
75
75
  "miniscript-type-analyzer": "~0.20.3"
76
76
  }
77
77
  }