From caf9131cde6e373fa304143a16209bfb65165206 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Fri, 22 Dec 2023 10:45:04 +0200 Subject: [PATCH 01/20] refactor: replace all CRLF with LF --- .../compilation/VariableDeclareStatement.java | 104 +- .../compilation/control/BreakStatement.java | 44 +- .../control/ContinueStatement.java | 44 +- .../compilation/control/DebugStatement.java | 38 +- .../compilation/control/DeleteStatement.java | 54 +- .../compilation/control/DoWhileStatement.java | 74 +- .../compilation/control/ForInStatement.java | 146 +- .../compilation/control/ForStatement.java | 94 +- .../compilation/control/IfStatement.java | 104 +- .../compilation/control/ReturnStatement.java | 46 +- .../compilation/control/SwitchStatement.java | 174 +- .../compilation/control/ThrowStatement.java | 44 +- .../compilation/control/TryStatement.java | 122 +- .../compilation/control/WhileStatement.java | 108 +- .../compilation/values/ArrayStatement.java | 82 +- .../compilation/values/CallStatement.java | 102 +- .../compilation/values/ChangeStatement.java | 64 +- .../compilation/values/ConstantStatement.java | 46 +- .../compilation/values/DiscardStatement.java | 48 +- .../compilation/values/FunctionStatement.java | 278 +- .../values/GlobalThisStatement.java | 40 +- .../values/IndexAssignStatement.java | 96 +- .../compilation/values/IndexStatement.java | 98 +- .../compilation/values/LazyAndStatement.java | 78 +- .../compilation/values/LazyOrStatement.java | 78 +- .../compilation/values/ObjectStatement.java | 126 +- .../values/OperationStatement.java | 74 +- .../compilation/values/RegexStatement.java | 52 +- .../compilation/values/TypeofStatement.java | 66 +- .../values/VariableAssignStatement.java | 76 +- .../values/VariableIndexStatement.java | 46 +- .../compilation/values/VariableStatement.java | 64 +- src/me/topchetoeu/jscript/engine/Context.java | 250 +- src/me/topchetoeu/jscript/engine/Engine.java | 350 +- .../jscript/engine/Environment.java | 262 +- .../jscript/engine/debug/DebugController.java | 102 +- .../jscript/engine/debug/DebugHandler.java | 68 +- .../jscript/engine/debug/DebugServer.java | 490 +-- .../jscript/engine/debug/SimpleDebugger.java | 1940 ++++----- .../jscript/engine/frame/CodeFrame.java | 634 +-- .../jscript/engine/frame/ConvertHint.java | 10 +- .../engine/frame/InstructionResult.java | 18 +- .../jscript/engine/frame/Runners.java | 700 +-- .../jscript/engine/scope/GlobalScope.java | 156 +- .../jscript/engine/scope/LocalScope.java | 58 +- .../engine/scope/LocalScopeRecord.java | 154 +- .../jscript/engine/scope/ScopeRecord.java | 14 +- .../jscript/engine/scope/ValueVariable.java | 56 +- .../jscript/engine/scope/Variable.java | 18 +- .../jscript/engine/values/ArrayValue.java | 440 +- .../jscript/engine/values/CodeFunction.java | 114 +- .../jscript/engine/values/FunctionValue.java | 140 +- .../jscript/engine/values/NativeFunction.java | 50 +- .../jscript/engine/values/NativeWrapper.java | 64 +- .../jscript/engine/values/ObjectValue.java | 688 +-- .../jscript/engine/values/ScopeValue.java | 108 +- .../jscript/engine/values/Symbol.java | 30 +- .../topchetoeu/jscript/events/Awaitable.java | 50 +- .../jscript/events/DataNotifier.java | 68 +- src/me/topchetoeu/jscript/events/Event.java | 98 +- .../jscript/events/FinishedException.java | 14 +- src/me/topchetoeu/jscript/events/Handle.java | 8 +- .../topchetoeu/jscript/events/Notifier.java | 38 +- .../topchetoeu/jscript/events/Observable.java | 150 +- .../topchetoeu/jscript/events/Observer.java | 12 +- src/me/topchetoeu/jscript/events/Pipe.java | 116 +- .../jscript/events/WarmObservable.java | 92 +- .../jscript/exceptions/EngineException.java | 234 +- .../jscript/exceptions/SyntaxException.java | 26 +- .../jscript/filesystem/MemoryFile.java | 134 +- .../jscript/filesystem/MemoryFilesystem.java | 180 +- src/me/topchetoeu/jscript/interop/Native.java | 26 +- .../jscript/interop/NativeGetter.java | 26 +- .../jscript/interop/NativeSetter.java | 26 +- .../jscript/interop/OverloadFunction.java | 254 +- src/me/topchetoeu/jscript/json/JSON.java | 486 +-- .../topchetoeu/jscript/json/JSONElement.java | 176 +- src/me/topchetoeu/jscript/json/JSONList.java | 52 +- src/me/topchetoeu/jscript/json/JSONMap.java | 300 +- src/me/topchetoeu/jscript/lib/MapLib.java | 156 +- src/me/topchetoeu/jscript/lib/PromiseLib.java | 734 ++-- src/me/topchetoeu/jscript/lib/SetLib.java | 120 +- .../topchetoeu/jscript/parsing/Operator.java | 224 +- .../topchetoeu/jscript/parsing/ParseRes.java | 192 +- .../topchetoeu/jscript/parsing/Parsing.java | 3806 ++++++++--------- .../topchetoeu/jscript/parsing/RawToken.java | 28 +- .../topchetoeu/jscript/parsing/TestRes.java | 88 +- src/me/topchetoeu/jscript/parsing/Token.java | 108 +- .../topchetoeu/jscript/parsing/TokenType.java | 16 +- 89 files changed, 8831 insertions(+), 8831 deletions(-) diff --git a/src/me/topchetoeu/jscript/compilation/VariableDeclareStatement.java b/src/me/topchetoeu/jscript/compilation/VariableDeclareStatement.java index 4c3b731..294d8b1 100644 --- a/src/me/topchetoeu/jscript/compilation/VariableDeclareStatement.java +++ b/src/me/topchetoeu/jscript/compilation/VariableDeclareStatement.java @@ -1,52 +1,52 @@ -package me.topchetoeu.jscript.compilation; - -import java.util.List; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; -import me.topchetoeu.jscript.compilation.values.FunctionStatement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class VariableDeclareStatement extends Statement { - public static class Pair { - public final String name; - public final Statement value; - public final Location location; - - public Pair(String name, Statement value, Location location) { - this.name = name; - this.value = value; - this.location = location; - } - } - - public final List values; - - @Override - public void declare(ScopeRecord varsScope) { - for (var key : values) { - varsScope.define(key.name); - } - } - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - for (var entry : values) { - if (entry.name == null) continue; - var key = scope.getKey(entry.name); - - if (key instanceof String) target.add(Instruction.makeVar(entry.location, (String)key)); - - if (entry.value != null) { - FunctionStatement.compileWithName(entry.value, target, scope, true, entry.name, BreakpointType.STEP_OVER); - target.add(Instruction.storeVar(entry.location, key)); - } - } - - if (pollute) target.add(Instruction.loadValue(loc(), null)); - } - - public VariableDeclareStatement(Location loc, List values) { - super(loc); - this.values = values; - } -} +package me.topchetoeu.jscript.compilation; + +import java.util.List; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; +import me.topchetoeu.jscript.compilation.values.FunctionStatement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class VariableDeclareStatement extends Statement { + public static class Pair { + public final String name; + public final Statement value; + public final Location location; + + public Pair(String name, Statement value, Location location) { + this.name = name; + this.value = value; + this.location = location; + } + } + + public final List values; + + @Override + public void declare(ScopeRecord varsScope) { + for (var key : values) { + varsScope.define(key.name); + } + } + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + for (var entry : values) { + if (entry.name == null) continue; + var key = scope.getKey(entry.name); + + if (key instanceof String) target.add(Instruction.makeVar(entry.location, (String)key)); + + if (entry.value != null) { + FunctionStatement.compileWithName(entry.value, target, scope, true, entry.name, BreakpointType.STEP_OVER); + target.add(Instruction.storeVar(entry.location, key)); + } + } + + if (pollute) target.add(Instruction.loadValue(loc(), null)); + } + + public VariableDeclareStatement(Location loc, List values) { + super(loc); + this.values = values; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/control/BreakStatement.java b/src/me/topchetoeu/jscript/compilation/control/BreakStatement.java index c9a9f4a..4c6c4c2 100644 --- a/src/me/topchetoeu/jscript/compilation/control/BreakStatement.java +++ b/src/me/topchetoeu/jscript/compilation/control/BreakStatement.java @@ -1,22 +1,22 @@ -package me.topchetoeu.jscript.compilation.control; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class BreakStatement extends Statement { - public final String label; - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - target.add(Instruction.nop(loc(), "break", label)); - if (pollute) target.add(Instruction.loadValue(loc(), null)); - } - - public BreakStatement(Location loc, String label) { - super(loc); - this.label = label; - } -} +package me.topchetoeu.jscript.compilation.control; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class BreakStatement extends Statement { + public final String label; + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + target.add(Instruction.nop(loc(), "break", label)); + if (pollute) target.add(Instruction.loadValue(loc(), null)); + } + + public BreakStatement(Location loc, String label) { + super(loc); + this.label = label; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/control/ContinueStatement.java b/src/me/topchetoeu/jscript/compilation/control/ContinueStatement.java index 87b6452..0269c09 100644 --- a/src/me/topchetoeu/jscript/compilation/control/ContinueStatement.java +++ b/src/me/topchetoeu/jscript/compilation/control/ContinueStatement.java @@ -1,22 +1,22 @@ -package me.topchetoeu.jscript.compilation.control; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class ContinueStatement extends Statement { - public final String label; - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - target.add(Instruction.nop(loc(), "cont", label)); - if (pollute) target.add(Instruction.loadValue(loc(), null)); - } - - public ContinueStatement(Location loc, String label) { - super(loc); - this.label = label; - } -} +package me.topchetoeu.jscript.compilation.control; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class ContinueStatement extends Statement { + public final String label; + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + target.add(Instruction.nop(loc(), "cont", label)); + if (pollute) target.add(Instruction.loadValue(loc(), null)); + } + + public ContinueStatement(Location loc, String label) { + super(loc); + this.label = label; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/control/DebugStatement.java b/src/me/topchetoeu/jscript/compilation/control/DebugStatement.java index bf610eb..6d908a8 100644 --- a/src/me/topchetoeu/jscript/compilation/control/DebugStatement.java +++ b/src/me/topchetoeu/jscript/compilation/control/DebugStatement.java @@ -1,19 +1,19 @@ -package me.topchetoeu.jscript.compilation.control; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class DebugStatement extends Statement { - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - target.add(Instruction.debug(loc())); - if (pollute) target.add(Instruction.loadValue(loc(), null)); - } - - public DebugStatement(Location loc) { - super(loc); - } -} +package me.topchetoeu.jscript.compilation.control; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class DebugStatement extends Statement { + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + target.add(Instruction.debug(loc())); + if (pollute) target.add(Instruction.loadValue(loc(), null)); + } + + public DebugStatement(Location loc) { + super(loc); + } +} diff --git a/src/me/topchetoeu/jscript/compilation/control/DeleteStatement.java b/src/me/topchetoeu/jscript/compilation/control/DeleteStatement.java index 894b4ab..cd7e97b 100644 --- a/src/me/topchetoeu/jscript/compilation/control/DeleteStatement.java +++ b/src/me/topchetoeu/jscript/compilation/control/DeleteStatement.java @@ -1,27 +1,27 @@ -package me.topchetoeu.jscript.compilation.control; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class DeleteStatement extends Statement { - public final Statement key; - public final Statement value; - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - value.compile(target, scope, true); - key.compile(target, scope, true); - - target.add(Instruction.delete(loc())); - if (pollute) target.add(Instruction.loadValue(loc(), true)); - } - - public DeleteStatement(Location loc, Statement key, Statement value) { - super(loc); - this.key = key; - this.value = value; - } -} +package me.topchetoeu.jscript.compilation.control; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class DeleteStatement extends Statement { + public final Statement key; + public final Statement value; + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + value.compile(target, scope, true); + key.compile(target, scope, true); + + target.add(Instruction.delete(loc())); + if (pollute) target.add(Instruction.loadValue(loc(), true)); + } + + public DeleteStatement(Location loc, Statement key, Statement value) { + super(loc); + this.key = key; + this.value = value; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/control/DoWhileStatement.java b/src/me/topchetoeu/jscript/compilation/control/DoWhileStatement.java index b3e7a68..e4b1a32 100644 --- a/src/me/topchetoeu/jscript/compilation/control/DoWhileStatement.java +++ b/src/me/topchetoeu/jscript/compilation/control/DoWhileStatement.java @@ -1,37 +1,37 @@ -package me.topchetoeu.jscript.compilation.control; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class DoWhileStatement extends Statement { - public final Statement condition, body; - public final String label; - - @Override - public void declare(ScopeRecord globScope) { - body.declare(globScope); - } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - int start = target.size(); - body.compile(target, scope, false, BreakpointType.STEP_OVER); - int mid = target.size(); - condition.compile(target, scope, true, BreakpointType.STEP_OVER); - int end = target.size(); - - WhileStatement.replaceBreaks(target, label, start, mid - 1, mid, end + 1); - target.add(Instruction.jmpIf(loc(), start - end)); - } - - public DoWhileStatement(Location loc, String label, Statement condition, Statement body) { - super(loc); - this.label = label; - this.condition = condition; - this.body = body; - } -} +package me.topchetoeu.jscript.compilation.control; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class DoWhileStatement extends Statement { + public final Statement condition, body; + public final String label; + + @Override + public void declare(ScopeRecord globScope) { + body.declare(globScope); + } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + int start = target.size(); + body.compile(target, scope, false, BreakpointType.STEP_OVER); + int mid = target.size(); + condition.compile(target, scope, true, BreakpointType.STEP_OVER); + int end = target.size(); + + WhileStatement.replaceBreaks(target, label, start, mid - 1, mid, end + 1); + target.add(Instruction.jmpIf(loc(), start - end)); + } + + public DoWhileStatement(Location loc, String label, Statement condition, Statement body) { + super(loc); + this.label = label; + this.condition = condition; + this.body = body; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/control/ForInStatement.java b/src/me/topchetoeu/jscript/compilation/control/ForInStatement.java index ae40175..4488bfc 100644 --- a/src/me/topchetoeu/jscript/compilation/control/ForInStatement.java +++ b/src/me/topchetoeu/jscript/compilation/control/ForInStatement.java @@ -1,73 +1,73 @@ -package me.topchetoeu.jscript.compilation.control; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; -import me.topchetoeu.jscript.engine.Operation; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class ForInStatement extends Statement { - public final String varName; - public final boolean isDeclaration; - public final Statement varValue, object, body; - public final String label; - public final Location varLocation; - - @Override - public void declare(ScopeRecord globScope) { - body.declare(globScope); - if (isDeclaration) globScope.define(varName); - } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - var key = scope.getKey(varName); - - int first = target.size(); - if (key instanceof String) target.add(Instruction.makeVar(loc(), (String)key)); - - if (varValue != null) { - varValue.compile(target, scope, true); - target.add(Instruction.storeVar(loc(), scope.getKey(varName))); - } - - object.compile(target, scope, true, BreakpointType.STEP_OVER); - target.add(Instruction.keys(loc(), true)); - - int start = target.size(); - target.add(Instruction.dup(loc())); - target.add(Instruction.loadValue(loc(), null)); - target.add(Instruction.operation(loc(), Operation.EQUALS)); - int mid = target.size(); - target.add(Instruction.nop(loc())); - - target.add(Instruction.loadMember(varLocation, "value")); - target.add(Instruction.storeVar(object.loc(), key)); - target.setDebug(BreakpointType.STEP_OVER); - - body.compile(target, scope, false, BreakpointType.STEP_OVER); - - int end = target.size(); - - WhileStatement.replaceBreaks(target, label, mid + 1, end, start, end + 1); - - target.add(Instruction.jmp(loc(), start - end)); - target.add(Instruction.discard(loc())); - target.set(mid, Instruction.jmpIf(loc(), end - mid + 1)); - if (pollute) target.add(Instruction.loadValue(loc(), null)); - target.get(first).locate(loc()); - } - - public ForInStatement(Location loc, Location varLocation, String label, boolean isDecl, String varName, Statement varValue, Statement object, Statement body) { - super(loc); - this.varLocation = varLocation; - this.label = label; - this.isDeclaration = isDecl; - this.varName = varName; - this.varValue = varValue; - this.object = object; - this.body = body; - } -} +package me.topchetoeu.jscript.compilation.control; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; +import me.topchetoeu.jscript.engine.Operation; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class ForInStatement extends Statement { + public final String varName; + public final boolean isDeclaration; + public final Statement varValue, object, body; + public final String label; + public final Location varLocation; + + @Override + public void declare(ScopeRecord globScope) { + body.declare(globScope); + if (isDeclaration) globScope.define(varName); + } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + var key = scope.getKey(varName); + + int first = target.size(); + if (key instanceof String) target.add(Instruction.makeVar(loc(), (String)key)); + + if (varValue != null) { + varValue.compile(target, scope, true); + target.add(Instruction.storeVar(loc(), scope.getKey(varName))); + } + + object.compile(target, scope, true, BreakpointType.STEP_OVER); + target.add(Instruction.keys(loc(), true)); + + int start = target.size(); + target.add(Instruction.dup(loc())); + target.add(Instruction.loadValue(loc(), null)); + target.add(Instruction.operation(loc(), Operation.EQUALS)); + int mid = target.size(); + target.add(Instruction.nop(loc())); + + target.add(Instruction.loadMember(varLocation, "value")); + target.add(Instruction.storeVar(object.loc(), key)); + target.setDebug(BreakpointType.STEP_OVER); + + body.compile(target, scope, false, BreakpointType.STEP_OVER); + + int end = target.size(); + + WhileStatement.replaceBreaks(target, label, mid + 1, end, start, end + 1); + + target.add(Instruction.jmp(loc(), start - end)); + target.add(Instruction.discard(loc())); + target.set(mid, Instruction.jmpIf(loc(), end - mid + 1)); + if (pollute) target.add(Instruction.loadValue(loc(), null)); + target.get(first).locate(loc()); + } + + public ForInStatement(Location loc, Location varLocation, String label, boolean isDecl, String varName, Statement varValue, Statement object, Statement body) { + super(loc); + this.varLocation = varLocation; + this.label = label; + this.isDeclaration = isDecl; + this.varName = varName; + this.varValue = varValue; + this.object = object; + this.body = body; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/control/ForStatement.java b/src/me/topchetoeu/jscript/compilation/control/ForStatement.java index 1385fb1..24eca5b 100644 --- a/src/me/topchetoeu/jscript/compilation/control/ForStatement.java +++ b/src/me/topchetoeu/jscript/compilation/control/ForStatement.java @@ -1,47 +1,47 @@ -package me.topchetoeu.jscript.compilation.control; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class ForStatement extends Statement { - public final Statement declaration, assignment, condition, body; - public final String label; - - @Override - public void declare(ScopeRecord globScope) { - declaration.declare(globScope); - body.declare(globScope); - } - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - declaration.compile(target, scope, false, BreakpointType.STEP_OVER); - - int start = target.size(); - condition.compile(target, scope, true, BreakpointType.STEP_OVER); - int mid = target.size(); - target.add(Instruction.nop(null)); - body.compile(target, scope, false, BreakpointType.STEP_OVER); - int beforeAssign = target.size(); - assignment.compile(target, scope, false, BreakpointType.STEP_OVER); - int end = target.size(); - - WhileStatement.replaceBreaks(target, label, mid + 1, end, beforeAssign, end + 1); - - target.add(Instruction.jmp(loc(), start - end)); - target.set(mid, Instruction.jmpIfNot(loc(), end - mid + 1)); - if (pollute) target.add(Instruction.loadValue(loc(), null)); - } - - public ForStatement(Location loc, String label, Statement declaration, Statement condition, Statement assignment, Statement body) { - super(loc); - this.label = label; - this.declaration = declaration; - this.condition = condition; - this.assignment = assignment; - this.body = body; - } -} +package me.topchetoeu.jscript.compilation.control; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class ForStatement extends Statement { + public final Statement declaration, assignment, condition, body; + public final String label; + + @Override + public void declare(ScopeRecord globScope) { + declaration.declare(globScope); + body.declare(globScope); + } + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + declaration.compile(target, scope, false, BreakpointType.STEP_OVER); + + int start = target.size(); + condition.compile(target, scope, true, BreakpointType.STEP_OVER); + int mid = target.size(); + target.add(Instruction.nop(null)); + body.compile(target, scope, false, BreakpointType.STEP_OVER); + int beforeAssign = target.size(); + assignment.compile(target, scope, false, BreakpointType.STEP_OVER); + int end = target.size(); + + WhileStatement.replaceBreaks(target, label, mid + 1, end, beforeAssign, end + 1); + + target.add(Instruction.jmp(loc(), start - end)); + target.set(mid, Instruction.jmpIfNot(loc(), end - mid + 1)); + if (pollute) target.add(Instruction.loadValue(loc(), null)); + } + + public ForStatement(Location loc, String label, Statement declaration, Statement condition, Statement assignment, Statement body) { + super(loc); + this.label = label; + this.declaration = declaration; + this.condition = condition; + this.assignment = assignment; + this.body = body; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/control/IfStatement.java b/src/me/topchetoeu/jscript/compilation/control/IfStatement.java index bba4a58..6aa3974 100644 --- a/src/me/topchetoeu/jscript/compilation/control/IfStatement.java +++ b/src/me/topchetoeu/jscript/compilation/control/IfStatement.java @@ -1,52 +1,52 @@ -package me.topchetoeu.jscript.compilation.control; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class IfStatement extends Statement { - public final Statement condition, body, elseBody; - - @Override - public void declare(ScopeRecord globScope) { - body.declare(globScope); - if (elseBody != null) elseBody.declare(globScope); - } - - @Override public void compile(CompileTarget target, ScopeRecord scope, boolean pollute, BreakpointType breakpoint) { - condition.compile(target, scope, true, breakpoint); - - if (elseBody == null) { - int i = target.size(); - target.add(Instruction.nop(null)); - body.compile(target, scope, pollute, breakpoint); - int endI = target.size(); - target.set(i, Instruction.jmpIfNot(loc(), endI - i)); - } - else { - int start = target.size(); - target.add(Instruction.nop(null)); - body.compile(target, scope, pollute, breakpoint); - target.add(Instruction.nop(null)); - int mid = target.size(); - elseBody.compile(target, scope, pollute, breakpoint); - int end = target.size(); - - target.set(start, Instruction.jmpIfNot(loc(), mid - start)); - target.set(mid - 1, Instruction.jmp(loc(), end - mid + 1)); - } - } - @Override public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - compile(target, scope, pollute, BreakpointType.STEP_IN); - } - - public IfStatement(Location loc, Statement condition, Statement body, Statement elseBody) { - super(loc); - this.condition = condition; - this.body = body; - this.elseBody = elseBody; - } -} +package me.topchetoeu.jscript.compilation.control; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class IfStatement extends Statement { + public final Statement condition, body, elseBody; + + @Override + public void declare(ScopeRecord globScope) { + body.declare(globScope); + if (elseBody != null) elseBody.declare(globScope); + } + + @Override public void compile(CompileTarget target, ScopeRecord scope, boolean pollute, BreakpointType breakpoint) { + condition.compile(target, scope, true, breakpoint); + + if (elseBody == null) { + int i = target.size(); + target.add(Instruction.nop(null)); + body.compile(target, scope, pollute, breakpoint); + int endI = target.size(); + target.set(i, Instruction.jmpIfNot(loc(), endI - i)); + } + else { + int start = target.size(); + target.add(Instruction.nop(null)); + body.compile(target, scope, pollute, breakpoint); + target.add(Instruction.nop(null)); + int mid = target.size(); + elseBody.compile(target, scope, pollute, breakpoint); + int end = target.size(); + + target.set(start, Instruction.jmpIfNot(loc(), mid - start)); + target.set(mid - 1, Instruction.jmp(loc(), end - mid + 1)); + } + } + @Override public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + compile(target, scope, pollute, BreakpointType.STEP_IN); + } + + public IfStatement(Location loc, Statement condition, Statement body, Statement elseBody) { + super(loc); + this.condition = condition; + this.body = body; + this.elseBody = elseBody; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/control/ReturnStatement.java b/src/me/topchetoeu/jscript/compilation/control/ReturnStatement.java index 1ec792f..4b78ae7 100644 --- a/src/me/topchetoeu/jscript/compilation/control/ReturnStatement.java +++ b/src/me/topchetoeu/jscript/compilation/control/ReturnStatement.java @@ -1,23 +1,23 @@ -package me.topchetoeu.jscript.compilation.control; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class ReturnStatement extends Statement { - public final Statement value; - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - if (value == null) target.add(Instruction.loadValue(loc(), null)); - else value.compile(target, scope, true); - target.add(Instruction.ret(loc())); - } - - public ReturnStatement(Location loc, Statement value) { - super(loc); - this.value = value; - } -} +package me.topchetoeu.jscript.compilation.control; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class ReturnStatement extends Statement { + public final Statement value; + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + if (value == null) target.add(Instruction.loadValue(loc(), null)); + else value.compile(target, scope, true); + target.add(Instruction.ret(loc())); + } + + public ReturnStatement(Location loc, Statement value) { + super(loc); + this.value = value; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/control/SwitchStatement.java b/src/me/topchetoeu/jscript/compilation/control/SwitchStatement.java index dc5d5a9..fb665d3 100644 --- a/src/me/topchetoeu/jscript/compilation/control/SwitchStatement.java +++ b/src/me/topchetoeu/jscript/compilation/control/SwitchStatement.java @@ -1,87 +1,87 @@ -package me.topchetoeu.jscript.compilation.control; - -import java.util.HashMap; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; -import me.topchetoeu.jscript.compilation.Instruction.Type; -import me.topchetoeu.jscript.engine.Operation; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class SwitchStatement extends Statement { - public static class SwitchCase { - public final Statement value; - public final int statementI; - - public SwitchCase(Statement value, int statementI) { - this.value = value; - this.statementI = statementI; - } - } - - public final Statement value; - public final SwitchCase[] cases; - public final Statement[] body; - public final int defaultI; - - @Override - public void declare(ScopeRecord varsScope) { - for (var stm : body) stm.declare(varsScope); - } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - var caseToStatement = new HashMap(); - var statementToIndex = new HashMap(); - - value.compile(target, scope, true, BreakpointType.STEP_OVER); - - for (var ccase : cases) { - target.add(Instruction.dup(loc())); - ccase.value.compile(target, scope, true); - target.add(Instruction.operation(loc(), Operation.EQUALS)); - caseToStatement.put(target.size(), ccase.statementI); - target.add(Instruction.nop(null)); - } - - int start = target.size(); - - target.add(Instruction.nop(null)); - - for (var stm : body) { - statementToIndex.put(statementToIndex.size(), target.size()); - stm.compile(target, scope, false, BreakpointType.STEP_OVER); - } - - int end = target.size(); - target.add(Instruction.discard(loc())); - if (pollute) target.add(Instruction.loadValue(loc(), null)); - - if (defaultI < 0 || defaultI >= body.length) target.set(start, Instruction.jmp(loc(), end - start)); - else target.set(start, Instruction.jmp(loc(), statementToIndex.get(defaultI) - start)); - - for (int i = start; i < end; i++) { - var instr = target.get(i); - if (instr.type == Type.NOP && instr.is(0, "break") && instr.get(1) == null) { - target.set(i, Instruction.jmp(loc(), end - i).locate(instr.location)); - } - } - for (var el : caseToStatement.entrySet()) { - var i = statementToIndex.get(el.getValue()); - if (i == null) i = end; - target.set(el.getKey(), Instruction.jmpIf(loc(), i - el.getKey())); - } - - } - - public SwitchStatement(Location loc, Statement value, int defaultI, SwitchCase[] cases, Statement[] body) { - super(loc); - this.value = value; - this.defaultI = defaultI; - this.cases = cases; - this.body = body; - } -} +package me.topchetoeu.jscript.compilation.control; + +import java.util.HashMap; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; +import me.topchetoeu.jscript.compilation.Instruction.Type; +import me.topchetoeu.jscript.engine.Operation; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class SwitchStatement extends Statement { + public static class SwitchCase { + public final Statement value; + public final int statementI; + + public SwitchCase(Statement value, int statementI) { + this.value = value; + this.statementI = statementI; + } + } + + public final Statement value; + public final SwitchCase[] cases; + public final Statement[] body; + public final int defaultI; + + @Override + public void declare(ScopeRecord varsScope) { + for (var stm : body) stm.declare(varsScope); + } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + var caseToStatement = new HashMap(); + var statementToIndex = new HashMap(); + + value.compile(target, scope, true, BreakpointType.STEP_OVER); + + for (var ccase : cases) { + target.add(Instruction.dup(loc())); + ccase.value.compile(target, scope, true); + target.add(Instruction.operation(loc(), Operation.EQUALS)); + caseToStatement.put(target.size(), ccase.statementI); + target.add(Instruction.nop(null)); + } + + int start = target.size(); + + target.add(Instruction.nop(null)); + + for (var stm : body) { + statementToIndex.put(statementToIndex.size(), target.size()); + stm.compile(target, scope, false, BreakpointType.STEP_OVER); + } + + int end = target.size(); + target.add(Instruction.discard(loc())); + if (pollute) target.add(Instruction.loadValue(loc(), null)); + + if (defaultI < 0 || defaultI >= body.length) target.set(start, Instruction.jmp(loc(), end - start)); + else target.set(start, Instruction.jmp(loc(), statementToIndex.get(defaultI) - start)); + + for (int i = start; i < end; i++) { + var instr = target.get(i); + if (instr.type == Type.NOP && instr.is(0, "break") && instr.get(1) == null) { + target.set(i, Instruction.jmp(loc(), end - i).locate(instr.location)); + } + } + for (var el : caseToStatement.entrySet()) { + var i = statementToIndex.get(el.getValue()); + if (i == null) i = end; + target.set(el.getKey(), Instruction.jmpIf(loc(), i - el.getKey())); + } + + } + + public SwitchStatement(Location loc, Statement value, int defaultI, SwitchCase[] cases, Statement[] body) { + super(loc); + this.value = value; + this.defaultI = defaultI; + this.cases = cases; + this.body = body; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/control/ThrowStatement.java b/src/me/topchetoeu/jscript/compilation/control/ThrowStatement.java index 5aa69ff..68ec881 100644 --- a/src/me/topchetoeu/jscript/compilation/control/ThrowStatement.java +++ b/src/me/topchetoeu/jscript/compilation/control/ThrowStatement.java @@ -1,22 +1,22 @@ -package me.topchetoeu.jscript.compilation.control; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class ThrowStatement extends Statement { - public final Statement value; - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - value.compile(target, scope, true); - target.add(Instruction.throwInstr(loc())); - } - - public ThrowStatement(Location loc, Statement value) { - super(loc); - this.value = value; - } -} +package me.topchetoeu.jscript.compilation.control; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class ThrowStatement extends Statement { + public final Statement value; + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + value.compile(target, scope, true); + target.add(Instruction.throwInstr(loc())); + } + + public ThrowStatement(Location loc, Statement value) { + super(loc); + this.value = value; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/control/TryStatement.java b/src/me/topchetoeu/jscript/compilation/control/TryStatement.java index f906d9e..32d1350 100644 --- a/src/me/topchetoeu/jscript/compilation/control/TryStatement.java +++ b/src/me/topchetoeu/jscript/compilation/control/TryStatement.java @@ -1,61 +1,61 @@ -package me.topchetoeu.jscript.compilation.control; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; -import me.topchetoeu.jscript.engine.scope.GlobalScope; -import me.topchetoeu.jscript.engine.scope.LocalScopeRecord; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class TryStatement extends Statement { - public final Statement tryBody; - public final Statement catchBody; - public final Statement finallyBody; - public final String name; - - @Override - public void declare(ScopeRecord globScope) { - tryBody.declare(globScope); - if (catchBody != null) catchBody.declare(globScope); - if (finallyBody != null) finallyBody.declare(globScope); - } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute, BreakpointType bpt) { - target.add(Instruction.nop(null)); - - int start = target.size(), catchStart = -1, finallyStart = -1; - - tryBody.compile(target, scope, false); - target.add(Instruction.tryEnd(loc())); - - if (catchBody != null) { - catchStart = target.size() - start; - var local = scope instanceof GlobalScope ? scope.child() : (LocalScopeRecord)scope; - local.define(name, true); - catchBody.compile(target, scope, false); - local.undefine(); - target.add(Instruction.tryEnd(loc())); - } - - if (finallyBody != null) { - finallyStart = target.size() - start; - finallyBody.compile(target, scope, false); - target.add(Instruction.tryEnd(loc())); - } - - target.set(start - 1, Instruction.tryStart(loc(), catchStart, finallyStart, target.size() - start)); - target.setDebug(start - 1, BreakpointType.STEP_OVER); - if (pollute) target.add(Instruction.loadValue(loc(), null)); - } - - public TryStatement(Location loc, Statement tryBody, Statement catchBody, Statement finallyBody, String name) { - super(loc); - this.tryBody = tryBody; - this.catchBody = catchBody; - this.finallyBody = finallyBody; - this.name = name; - } -} +package me.topchetoeu.jscript.compilation.control; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; +import me.topchetoeu.jscript.engine.scope.GlobalScope; +import me.topchetoeu.jscript.engine.scope.LocalScopeRecord; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class TryStatement extends Statement { + public final Statement tryBody; + public final Statement catchBody; + public final Statement finallyBody; + public final String name; + + @Override + public void declare(ScopeRecord globScope) { + tryBody.declare(globScope); + if (catchBody != null) catchBody.declare(globScope); + if (finallyBody != null) finallyBody.declare(globScope); + } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute, BreakpointType bpt) { + target.add(Instruction.nop(null)); + + int start = target.size(), catchStart = -1, finallyStart = -1; + + tryBody.compile(target, scope, false); + target.add(Instruction.tryEnd(loc())); + + if (catchBody != null) { + catchStart = target.size() - start; + var local = scope instanceof GlobalScope ? scope.child() : (LocalScopeRecord)scope; + local.define(name, true); + catchBody.compile(target, scope, false); + local.undefine(); + target.add(Instruction.tryEnd(loc())); + } + + if (finallyBody != null) { + finallyStart = target.size() - start; + finallyBody.compile(target, scope, false); + target.add(Instruction.tryEnd(loc())); + } + + target.set(start - 1, Instruction.tryStart(loc(), catchStart, finallyStart, target.size() - start)); + target.setDebug(start - 1, BreakpointType.STEP_OVER); + if (pollute) target.add(Instruction.loadValue(loc(), null)); + } + + public TryStatement(Location loc, Statement tryBody, Statement catchBody, Statement finallyBody, String name) { + super(loc); + this.tryBody = tryBody; + this.catchBody = catchBody; + this.finallyBody = finallyBody; + this.name = name; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/control/WhileStatement.java b/src/me/topchetoeu/jscript/compilation/control/WhileStatement.java index fb474ce..19c04cc 100644 --- a/src/me/topchetoeu/jscript/compilation/control/WhileStatement.java +++ b/src/me/topchetoeu/jscript/compilation/control/WhileStatement.java @@ -1,54 +1,54 @@ -package me.topchetoeu.jscript.compilation.control; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; -import me.topchetoeu.jscript.compilation.Instruction.Type; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class WhileStatement extends Statement { - public final Statement condition, body; - public final String label; - - @Override - public void declare(ScopeRecord globScope) { - body.declare(globScope); - } - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - int start = target.size(); - condition.compile(target, scope, true); - int mid = target.size(); - target.add(Instruction.nop(null)); - body.compile(target, scope, false, BreakpointType.STEP_OVER); - - int end = target.size(); - - replaceBreaks(target, label, mid + 1, end, start, end + 1); - - target.add(Instruction.jmp(loc(), start - end)); - target.set(mid, Instruction.jmpIfNot(loc(), end - mid + 1)); - if (pollute) target.add(Instruction.loadValue(loc(), null)); - } - - public WhileStatement(Location loc, String label, Statement condition, Statement body) { - super(loc); - this.label = label; - this.condition = condition; - this.body = body; - } - - public static void replaceBreaks(CompileTarget target, String label, int start, int end, int continuePoint, int breakPoint) { - for (int i = start; i < end; i++) { - var instr = target.get(i); - if (instr.type == Type.NOP && instr.is(0, "cont") && (instr.get(1) == null || instr.is(1, label))) { - target.set(i, Instruction.jmp(instr.location, continuePoint - i).setDbgData(target.get(i))); - } - if (instr.type == Type.NOP && instr.is(0, "break") && (instr.get(1) == null || instr.is(1, label))) { - target.set(i, Instruction.jmp(instr.location, breakPoint - i).setDbgData(target.get(i))); - } - } - } -} +package me.topchetoeu.jscript.compilation.control; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; +import me.topchetoeu.jscript.compilation.Instruction.Type; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class WhileStatement extends Statement { + public final Statement condition, body; + public final String label; + + @Override + public void declare(ScopeRecord globScope) { + body.declare(globScope); + } + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + int start = target.size(); + condition.compile(target, scope, true); + int mid = target.size(); + target.add(Instruction.nop(null)); + body.compile(target, scope, false, BreakpointType.STEP_OVER); + + int end = target.size(); + + replaceBreaks(target, label, mid + 1, end, start, end + 1); + + target.add(Instruction.jmp(loc(), start - end)); + target.set(mid, Instruction.jmpIfNot(loc(), end - mid + 1)); + if (pollute) target.add(Instruction.loadValue(loc(), null)); + } + + public WhileStatement(Location loc, String label, Statement condition, Statement body) { + super(loc); + this.label = label; + this.condition = condition; + this.body = body; + } + + public static void replaceBreaks(CompileTarget target, String label, int start, int end, int continuePoint, int breakPoint) { + for (int i = start; i < end; i++) { + var instr = target.get(i); + if (instr.type == Type.NOP && instr.is(0, "cont") && (instr.get(1) == null || instr.is(1, label))) { + target.set(i, Instruction.jmp(instr.location, continuePoint - i).setDbgData(target.get(i))); + } + if (instr.type == Type.NOP && instr.is(0, "break") && (instr.get(1) == null || instr.is(1, label))) { + target.set(i, Instruction.jmp(instr.location, breakPoint - i).setDbgData(target.get(i))); + } + } + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/ArrayStatement.java b/src/me/topchetoeu/jscript/compilation/values/ArrayStatement.java index a7249b0..2654644 100644 --- a/src/me/topchetoeu/jscript/compilation/values/ArrayStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/ArrayStatement.java @@ -1,41 +1,41 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class ArrayStatement extends Statement { - public final Statement[] statements; - - @Override public boolean pure() { - for (var stm : statements) { - if (!stm.pure()) return false; - } - - return true; - } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - target.add(Instruction.loadArr(loc(), statements.length)); - - for (var i = 0; i < statements.length; i++) { - var el = statements[i]; - if (el != null) { - target.add(Instruction.dup(loc())); - target.add(Instruction.loadValue(loc(), i)); - el.compile(target, scope, true); - target.add(Instruction.storeMember(loc())); - } - } - - if (!pollute) target.add(Instruction.discard(loc())); - } - - public ArrayStatement(Location loc, Statement[] statements) { - super(loc); - this.statements = statements; - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class ArrayStatement extends Statement { + public final Statement[] statements; + + @Override public boolean pure() { + for (var stm : statements) { + if (!stm.pure()) return false; + } + + return true; + } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + target.add(Instruction.loadArr(loc(), statements.length)); + + for (var i = 0; i < statements.length; i++) { + var el = statements[i]; + if (el != null) { + target.add(Instruction.dup(loc())); + target.add(Instruction.loadValue(loc(), i)); + el.compile(target, scope, true); + target.add(Instruction.storeMember(loc())); + } + } + + if (!pollute) target.add(Instruction.discard(loc())); + } + + public ArrayStatement(Location loc, Statement[] statements) { + super(loc); + this.statements = statements; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/CallStatement.java b/src/me/topchetoeu/jscript/compilation/values/CallStatement.java index 2ccacb0..e8066ce 100644 --- a/src/me/topchetoeu/jscript/compilation/values/CallStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/CallStatement.java @@ -1,51 +1,51 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class CallStatement extends Statement { - public final Statement func; - public final Statement[] args; - public final boolean isNew; - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute, BreakpointType type) { - if (isNew) func.compile(target, scope, true); - else if (func instanceof IndexStatement) { - ((IndexStatement)func).compile(target, scope, true, true); - } - else { - target.add(Instruction.loadValue(loc(), null)); - func.compile(target, scope, true); - } - - for (var arg : args) arg.compile(target, scope, true); - - if (isNew) target.add(Instruction.callNew(loc(), args.length)); - else target.add(Instruction.call(loc(), args.length)); - target.setDebug(type); - - if (!pollute) target.add(Instruction.discard(loc())); - } - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - compile(target, scope, pollute, BreakpointType.STEP_IN); - } - - public CallStatement(Location loc, boolean isNew, Statement func, Statement ...args) { - super(loc); - this.isNew = isNew; - this.func = func; - this.args = args; - } - public CallStatement(Location loc, boolean isNew, Statement obj, Object key, Statement ...args) { - super(loc); - this.isNew = isNew; - this.func = new IndexStatement(loc, obj, new ConstantStatement(loc, key)); - this.args = args; - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class CallStatement extends Statement { + public final Statement func; + public final Statement[] args; + public final boolean isNew; + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute, BreakpointType type) { + if (isNew) func.compile(target, scope, true); + else if (func instanceof IndexStatement) { + ((IndexStatement)func).compile(target, scope, true, true); + } + else { + target.add(Instruction.loadValue(loc(), null)); + func.compile(target, scope, true); + } + + for (var arg : args) arg.compile(target, scope, true); + + if (isNew) target.add(Instruction.callNew(loc(), args.length)); + else target.add(Instruction.call(loc(), args.length)); + target.setDebug(type); + + if (!pollute) target.add(Instruction.discard(loc())); + } + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + compile(target, scope, pollute, BreakpointType.STEP_IN); + } + + public CallStatement(Location loc, boolean isNew, Statement func, Statement ...args) { + super(loc); + this.isNew = isNew; + this.func = func; + this.args = args; + } + public CallStatement(Location loc, boolean isNew, Statement obj, Object key, Statement ...args) { + super(loc); + this.isNew = isNew; + this.func = new IndexStatement(loc, obj, new ConstantStatement(loc, key)); + this.args = args; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/ChangeStatement.java b/src/me/topchetoeu/jscript/compilation/values/ChangeStatement.java index f6705f7..31282a7 100644 --- a/src/me/topchetoeu/jscript/compilation/values/ChangeStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/ChangeStatement.java @@ -1,32 +1,32 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.AssignableStatement; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.Operation; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class ChangeStatement extends Statement { - public final AssignableStatement value; - public final double addAmount; - public final boolean postfix; - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - value.toAssign(new ConstantStatement(loc(), -addAmount), Operation.SUBTRACT).compile(target, scope, true); - if (!pollute) target.add(Instruction.discard(loc())); - else if (postfix) { - target.add(Instruction.loadValue(loc(), addAmount)); - target.add(Instruction.operation(loc(), Operation.SUBTRACT)); - } - } - - public ChangeStatement(Location loc, AssignableStatement value, double addAmount, boolean postfix) { - super(loc); - this.value = value; - this.addAmount = addAmount; - this.postfix = postfix; - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.AssignableStatement; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.Operation; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class ChangeStatement extends Statement { + public final AssignableStatement value; + public final double addAmount; + public final boolean postfix; + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + value.toAssign(new ConstantStatement(loc(), -addAmount), Operation.SUBTRACT).compile(target, scope, true); + if (!pollute) target.add(Instruction.discard(loc())); + else if (postfix) { + target.add(Instruction.loadValue(loc(), addAmount)); + target.add(Instruction.operation(loc(), Operation.SUBTRACT)); + } + } + + public ChangeStatement(Location loc, AssignableStatement value, double addAmount, boolean postfix) { + super(loc); + this.value = value; + this.addAmount = addAmount; + this.postfix = postfix; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/ConstantStatement.java b/src/me/topchetoeu/jscript/compilation/values/ConstantStatement.java index 9d5454e..7d4923b 100644 --- a/src/me/topchetoeu/jscript/compilation/values/ConstantStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/ConstantStatement.java @@ -1,23 +1,23 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class ConstantStatement extends Statement { - public final Object value; - - @Override public boolean pure() { return true; } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - if (pollute) target.add(Instruction.loadValue(loc(), value)); - } - - public ConstantStatement(Location loc, Object val) { - super(loc); - this.value = val; - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class ConstantStatement extends Statement { + public final Object value; + + @Override public boolean pure() { return true; } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + if (pollute) target.add(Instruction.loadValue(loc(), value)); + } + + public ConstantStatement(Location loc, Object val) { + super(loc); + this.value = val; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/DiscardStatement.java b/src/me/topchetoeu/jscript/compilation/values/DiscardStatement.java index a16cc9a..cf61cd1 100644 --- a/src/me/topchetoeu/jscript/compilation/values/DiscardStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/DiscardStatement.java @@ -1,24 +1,24 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class DiscardStatement extends Statement { - public final Statement value; - - @Override public boolean pure() { return value.pure(); } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - value.compile(target, scope, false); - if (pollute) target.add(Instruction.loadValue(loc(), null)); - } - - public DiscardStatement(Location loc, Statement val) { - super(loc); - this.value = val; - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class DiscardStatement extends Statement { + public final Statement value; + + @Override public boolean pure() { return value.pure(); } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + value.compile(target, scope, false); + if (pollute) target.add(Instruction.loadValue(loc(), null)); + } + + public DiscardStatement(Location loc, Statement val) { + super(loc); + this.value = val; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/FunctionStatement.java b/src/me/topchetoeu/jscript/compilation/values/FunctionStatement.java index 06d1540..aafb3eb 100644 --- a/src/me/topchetoeu/jscript/compilation/values/FunctionStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/FunctionStatement.java @@ -1,139 +1,139 @@ -package me.topchetoeu.jscript.compilation.values; - -import java.util.Random; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.CompoundStatement; -import me.topchetoeu.jscript.compilation.FunctionBody; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; -import me.topchetoeu.jscript.compilation.Instruction.Type; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; -import me.topchetoeu.jscript.exceptions.SyntaxException; - -public class FunctionStatement extends Statement { - public final CompoundStatement body; - public final String varName; - public final String[] args; - public final boolean statement; - public final Location end; - - private static Random rand = new Random(); - - @Override public boolean pure() { return varName == null && statement; } - - @Override - public void declare(ScopeRecord scope) { - if (varName != null && statement) scope.define(varName); - } - - public static void checkBreakAndCont(CompileTarget target, int start) { - for (int i = start; i < target.size(); i++) { - if (target.get(i).type == Type.NOP) { - if (target.get(i).is(0, "break") ) { - throw new SyntaxException(target.get(i).location, "Break was placed outside a loop."); - } - if (target.get(i).is(0, "cont")) { - throw new SyntaxException(target.get(i).location, "Continue was placed outside a loop."); - } - } - } - } - - private long compileBody(CompileTarget target, ScopeRecord scope, boolean polute, BreakpointType bp) { - for (var i = 0; i < args.length; i++) { - for (var j = 0; j < i; j++) { - if (args[i].equals(args[j])) { - throw new SyntaxException(loc(), "Duplicate parameter '" + args[i] + "'."); - } - } - } - - var id = rand.nextLong(); - var subscope = scope.child(); - var subtarget = new CompileTarget(target.functions, target.breakpoints); - - subscope.define("this"); - var argsVar = subscope.define("arguments"); - - if (args.length > 0) { - for (var i = 0; i < args.length; i++) { - subtarget.add(Instruction.loadVar(loc(), argsVar)); - subtarget.add(Instruction.loadMember(loc(), i)); - subtarget.add(Instruction.storeVar(loc(), subscope.define(args[i]))); - } - } - - if (!statement && this.varName != null) { - subtarget.add(Instruction.storeSelfFunc(loc(), (int)subscope.define(this.varName))); - subtarget.setDebug(bp); - } - - body.declare(subscope); - body.compile(subtarget, subscope, false); - subtarget.add(Instruction.ret(end)); - checkBreakAndCont(subtarget, 0); - - if (polute) target.add(Instruction.loadFunc(loc(), id, subscope.getCaptures())); - target.functions.put(id, new FunctionBody( - subscope.localsCount(), args.length, - subtarget.array(), subscope.captures(), subscope.locals() - )); - - return id; - } - - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute, String name, BreakpointType bp) { - if (this.varName != null) name = this.varName; - - var hasVar = this.varName != null && statement; - var hasName = name != null; - - compileBody(target, scope, pollute || hasVar || hasName, bp); - - if (hasName) { - if (pollute || hasVar) target.add(Instruction.dup(loc())); - target.add(Instruction.loadValue(loc(), "name")); - target.add(Instruction.loadValue(loc(), name)); - target.add(Instruction.storeMember(loc())); - } - - if (hasVar) { - var key = scope.getKey(this.varName); - - if (key instanceof String) target.add(Instruction.makeVar(loc(), (String)key)); - target.add(Instruction.storeVar(loc(), scope.getKey(this.varName), false)); - } - } - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute, String name) { - compile(target, scope, pollute, name, BreakpointType.NONE); - } - @Override public void compile(CompileTarget target, ScopeRecord scope, boolean pollute, BreakpointType bp) { - compile(target, scope, pollute, (String)null, bp); - } - @Override public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - compile(target, scope, pollute, (String)null, BreakpointType.NONE); - } - - public FunctionStatement(Location loc, Location end, String varName, String[] args, boolean statement, CompoundStatement body) { - super(loc); - - this.end = end; - this.varName = varName; - this.statement = statement; - - this.args = args; - this.body = body; - } - - public static void compileWithName(Statement stm, CompileTarget target, ScopeRecord scope, boolean pollute, String name) { - if (stm instanceof FunctionStatement) ((FunctionStatement)stm).compile(target, scope, pollute, name); - else stm.compile(target, scope, pollute); - } - public static void compileWithName(Statement stm, CompileTarget target, ScopeRecord scope, boolean pollute, String name, BreakpointType bp) { - if (stm instanceof FunctionStatement) ((FunctionStatement)stm).compile(target, scope, pollute, name, bp); - else stm.compile(target, scope, pollute, bp); - } -} +package me.topchetoeu.jscript.compilation.values; + +import java.util.Random; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.CompoundStatement; +import me.topchetoeu.jscript.compilation.FunctionBody; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; +import me.topchetoeu.jscript.compilation.Instruction.Type; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; +import me.topchetoeu.jscript.exceptions.SyntaxException; + +public class FunctionStatement extends Statement { + public final CompoundStatement body; + public final String varName; + public final String[] args; + public final boolean statement; + public final Location end; + + private static Random rand = new Random(); + + @Override public boolean pure() { return varName == null && statement; } + + @Override + public void declare(ScopeRecord scope) { + if (varName != null && statement) scope.define(varName); + } + + public static void checkBreakAndCont(CompileTarget target, int start) { + for (int i = start; i < target.size(); i++) { + if (target.get(i).type == Type.NOP) { + if (target.get(i).is(0, "break") ) { + throw new SyntaxException(target.get(i).location, "Break was placed outside a loop."); + } + if (target.get(i).is(0, "cont")) { + throw new SyntaxException(target.get(i).location, "Continue was placed outside a loop."); + } + } + } + } + + private long compileBody(CompileTarget target, ScopeRecord scope, boolean polute, BreakpointType bp) { + for (var i = 0; i < args.length; i++) { + for (var j = 0; j < i; j++) { + if (args[i].equals(args[j])) { + throw new SyntaxException(loc(), "Duplicate parameter '" + args[i] + "'."); + } + } + } + + var id = rand.nextLong(); + var subscope = scope.child(); + var subtarget = new CompileTarget(target.functions, target.breakpoints); + + subscope.define("this"); + var argsVar = subscope.define("arguments"); + + if (args.length > 0) { + for (var i = 0; i < args.length; i++) { + subtarget.add(Instruction.loadVar(loc(), argsVar)); + subtarget.add(Instruction.loadMember(loc(), i)); + subtarget.add(Instruction.storeVar(loc(), subscope.define(args[i]))); + } + } + + if (!statement && this.varName != null) { + subtarget.add(Instruction.storeSelfFunc(loc(), (int)subscope.define(this.varName))); + subtarget.setDebug(bp); + } + + body.declare(subscope); + body.compile(subtarget, subscope, false); + subtarget.add(Instruction.ret(end)); + checkBreakAndCont(subtarget, 0); + + if (polute) target.add(Instruction.loadFunc(loc(), id, subscope.getCaptures())); + target.functions.put(id, new FunctionBody( + subscope.localsCount(), args.length, + subtarget.array(), subscope.captures(), subscope.locals() + )); + + return id; + } + + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute, String name, BreakpointType bp) { + if (this.varName != null) name = this.varName; + + var hasVar = this.varName != null && statement; + var hasName = name != null; + + compileBody(target, scope, pollute || hasVar || hasName, bp); + + if (hasName) { + if (pollute || hasVar) target.add(Instruction.dup(loc())); + target.add(Instruction.loadValue(loc(), "name")); + target.add(Instruction.loadValue(loc(), name)); + target.add(Instruction.storeMember(loc())); + } + + if (hasVar) { + var key = scope.getKey(this.varName); + + if (key instanceof String) target.add(Instruction.makeVar(loc(), (String)key)); + target.add(Instruction.storeVar(loc(), scope.getKey(this.varName), false)); + } + } + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute, String name) { + compile(target, scope, pollute, name, BreakpointType.NONE); + } + @Override public void compile(CompileTarget target, ScopeRecord scope, boolean pollute, BreakpointType bp) { + compile(target, scope, pollute, (String)null, bp); + } + @Override public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + compile(target, scope, pollute, (String)null, BreakpointType.NONE); + } + + public FunctionStatement(Location loc, Location end, String varName, String[] args, boolean statement, CompoundStatement body) { + super(loc); + + this.end = end; + this.varName = varName; + this.statement = statement; + + this.args = args; + this.body = body; + } + + public static void compileWithName(Statement stm, CompileTarget target, ScopeRecord scope, boolean pollute, String name) { + if (stm instanceof FunctionStatement) ((FunctionStatement)stm).compile(target, scope, pollute, name); + else stm.compile(target, scope, pollute); + } + public static void compileWithName(Statement stm, CompileTarget target, ScopeRecord scope, boolean pollute, String name, BreakpointType bp) { + if (stm instanceof FunctionStatement) ((FunctionStatement)stm).compile(target, scope, pollute, name, bp); + else stm.compile(target, scope, pollute, bp); + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/GlobalThisStatement.java b/src/me/topchetoeu/jscript/compilation/values/GlobalThisStatement.java index ba60194..d7550ad 100644 --- a/src/me/topchetoeu/jscript/compilation/values/GlobalThisStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/GlobalThisStatement.java @@ -1,20 +1,20 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class GlobalThisStatement extends Statement { - @Override public boolean pure() { return true; } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - if (pollute) target.add(Instruction.loadGlob(loc())); - } - - public GlobalThisStatement(Location loc) { - super(loc); - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class GlobalThisStatement extends Statement { + @Override public boolean pure() { return true; } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + if (pollute) target.add(Instruction.loadGlob(loc())); + } + + public GlobalThisStatement(Location loc) { + super(loc); + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/IndexAssignStatement.java b/src/me/topchetoeu/jscript/compilation/values/IndexAssignStatement.java index 77cb68c..77ea430 100644 --- a/src/me/topchetoeu/jscript/compilation/values/IndexAssignStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/IndexAssignStatement.java @@ -1,48 +1,48 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; -import me.topchetoeu.jscript.engine.Operation; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class IndexAssignStatement extends Statement { - public final Statement object; - public final Statement index; - public final Statement value; - public final Operation operation; - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - if (operation != null) { - object.compile(target, scope, true); - index.compile(target, scope, true); - target.add(Instruction.dup(loc(), 2)); - - target.add(Instruction.loadMember(loc())); - value.compile(target, scope, true); - target.add(Instruction.operation(loc(), operation)); - - target.add(Instruction.storeMember(loc(), pollute)); - target.setDebug(BreakpointType.STEP_IN); - } - else { - object.compile(target, scope, true); - index.compile(target, scope, true); - value.compile(target, scope, true); - - target.add(Instruction.storeMember(loc(), pollute)); - target.setDebug(BreakpointType.STEP_IN); - } - } - - public IndexAssignStatement(Location loc, Statement object, Statement index, Statement value, Operation operation) { - super(loc); - this.object = object; - this.index = index; - this.value = value; - this.operation = operation; - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; +import me.topchetoeu.jscript.engine.Operation; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class IndexAssignStatement extends Statement { + public final Statement object; + public final Statement index; + public final Statement value; + public final Operation operation; + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + if (operation != null) { + object.compile(target, scope, true); + index.compile(target, scope, true); + target.add(Instruction.dup(loc(), 2)); + + target.add(Instruction.loadMember(loc())); + value.compile(target, scope, true); + target.add(Instruction.operation(loc(), operation)); + + target.add(Instruction.storeMember(loc(), pollute)); + target.setDebug(BreakpointType.STEP_IN); + } + else { + object.compile(target, scope, true); + index.compile(target, scope, true); + value.compile(target, scope, true); + + target.add(Instruction.storeMember(loc(), pollute)); + target.setDebug(BreakpointType.STEP_IN); + } + } + + public IndexAssignStatement(Location loc, Statement object, Statement index, Statement value, Operation operation) { + super(loc); + this.object = object; + this.index = index; + this.value = value; + this.operation = operation; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/IndexStatement.java b/src/me/topchetoeu/jscript/compilation/values/IndexStatement.java index f2b7c42..ca966ee 100644 --- a/src/me/topchetoeu/jscript/compilation/values/IndexStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/IndexStatement.java @@ -1,49 +1,49 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.AssignableStatement; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; -import me.topchetoeu.jscript.engine.Operation; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class IndexStatement extends AssignableStatement { - public final Statement object; - public final Statement index; - - @Override - public Statement toAssign(Statement val, Operation operation) { - return new IndexAssignStatement(loc(), object, index, val, operation); - } - public void compile(CompileTarget target, ScopeRecord scope, boolean dupObj, boolean pollute) { - object.compile(target, scope, true); - if (dupObj) target.add(Instruction.dup(loc())); - if (index instanceof ConstantStatement) { - target.add(Instruction.loadMember(loc(), ((ConstantStatement)index).value)); - target.setDebug(BreakpointType.STEP_IN); - return; - } - - index.compile(target, scope, true); - target.add(Instruction.loadMember(loc())); - target.setDebug(BreakpointType.STEP_IN); - if (!pollute) target.add(Instruction.discard(loc())); - } - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - compile(target, scope, false, pollute); - } - - public IndexStatement(Location loc, Statement object, Statement index) { - super(loc); - this.object = object; - this.index = index; - } - public IndexStatement(Location loc, Statement object, Object index) { - super(loc); - this.object = object; - this.index = new ConstantStatement(loc, index); - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.AssignableStatement; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.compilation.Instruction.BreakpointType; +import me.topchetoeu.jscript.engine.Operation; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class IndexStatement extends AssignableStatement { + public final Statement object; + public final Statement index; + + @Override + public Statement toAssign(Statement val, Operation operation) { + return new IndexAssignStatement(loc(), object, index, val, operation); + } + public void compile(CompileTarget target, ScopeRecord scope, boolean dupObj, boolean pollute) { + object.compile(target, scope, true); + if (dupObj) target.add(Instruction.dup(loc())); + if (index instanceof ConstantStatement) { + target.add(Instruction.loadMember(loc(), ((ConstantStatement)index).value)); + target.setDebug(BreakpointType.STEP_IN); + return; + } + + index.compile(target, scope, true); + target.add(Instruction.loadMember(loc())); + target.setDebug(BreakpointType.STEP_IN); + if (!pollute) target.add(Instruction.discard(loc())); + } + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + compile(target, scope, false, pollute); + } + + public IndexStatement(Location loc, Statement object, Statement index) { + super(loc); + this.object = object; + this.index = index; + } + public IndexStatement(Location loc, Statement object, Object index) { + super(loc); + this.object = object; + this.index = new ConstantStatement(loc, index); + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/LazyAndStatement.java b/src/me/topchetoeu/jscript/compilation/values/LazyAndStatement.java index f71f841..17fdc07 100644 --- a/src/me/topchetoeu/jscript/compilation/values/LazyAndStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/LazyAndStatement.java @@ -1,39 +1,39 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; -import me.topchetoeu.jscript.engine.values.Values; - -public class LazyAndStatement extends Statement { - public final Statement first, second; - - @Override public boolean pure() { return first.pure() && second.pure(); } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - if (first instanceof ConstantStatement) { - if (Values.not(((ConstantStatement)first).value)) { - first.compile(target, scope, pollute); - } - else second.compile(target, scope, pollute); - return; - } - - first.compile(target, scope, true); - if (pollute) target.add(Instruction.dup(loc())); - int start = target.size(); - target.add(Instruction.nop(null)); - if (pollute) target.add(Instruction.discard(loc())); - second.compile(target, scope, pollute); - target.set(start, Instruction.jmpIfNot(loc(), target.size() - start)); - } - - public LazyAndStatement(Location loc, Statement first, Statement second) { - super(loc); - this.first = first; - this.second = second; - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; +import me.topchetoeu.jscript.engine.values.Values; + +public class LazyAndStatement extends Statement { + public final Statement first, second; + + @Override public boolean pure() { return first.pure() && second.pure(); } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + if (first instanceof ConstantStatement) { + if (Values.not(((ConstantStatement)first).value)) { + first.compile(target, scope, pollute); + } + else second.compile(target, scope, pollute); + return; + } + + first.compile(target, scope, true); + if (pollute) target.add(Instruction.dup(loc())); + int start = target.size(); + target.add(Instruction.nop(null)); + if (pollute) target.add(Instruction.discard(loc())); + second.compile(target, scope, pollute); + target.set(start, Instruction.jmpIfNot(loc(), target.size() - start)); + } + + public LazyAndStatement(Location loc, Statement first, Statement second) { + super(loc); + this.first = first; + this.second = second; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/LazyOrStatement.java b/src/me/topchetoeu/jscript/compilation/values/LazyOrStatement.java index 22ddd5b..ca3b569 100644 --- a/src/me/topchetoeu/jscript/compilation/values/LazyOrStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/LazyOrStatement.java @@ -1,39 +1,39 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; -import me.topchetoeu.jscript.engine.values.Values; - -public class LazyOrStatement extends Statement { - public final Statement first, second; - - @Override public boolean pure() { return first.pure() && second.pure(); } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - if (first instanceof ConstantStatement) { - if (Values.not(((ConstantStatement)first).value)) { - second.compile(target, scope, pollute); - } - else first.compile(target, scope, pollute); - return; - } - - first.compile(target, scope, true); - if (pollute) target.add(Instruction.dup(loc())); - int start = target.size(); - target.add(Instruction.nop(null)); - if (pollute) target.add(Instruction.discard(loc())); - second.compile(target, scope, pollute); - target.set(start, Instruction.jmpIf(loc(), target.size() - start)); - } - - public LazyOrStatement(Location loc, Statement first, Statement second) { - super(loc); - this.first = first; - this.second = second; - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; +import me.topchetoeu.jscript.engine.values.Values; + +public class LazyOrStatement extends Statement { + public final Statement first, second; + + @Override public boolean pure() { return first.pure() && second.pure(); } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + if (first instanceof ConstantStatement) { + if (Values.not(((ConstantStatement)first).value)) { + second.compile(target, scope, pollute); + } + else first.compile(target, scope, pollute); + return; + } + + first.compile(target, scope, true); + if (pollute) target.add(Instruction.dup(loc())); + int start = target.size(); + target.add(Instruction.nop(null)); + if (pollute) target.add(Instruction.discard(loc())); + second.compile(target, scope, pollute); + target.set(start, Instruction.jmpIf(loc(), target.size() - start)); + } + + public LazyOrStatement(Location loc, Statement first, Statement second) { + super(loc); + this.first = first; + this.second = second; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/ObjectStatement.java b/src/me/topchetoeu/jscript/compilation/values/ObjectStatement.java index 5e95ff0..48d4ab7 100644 --- a/src/me/topchetoeu/jscript/compilation/values/ObjectStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/ObjectStatement.java @@ -1,63 +1,63 @@ -package me.topchetoeu.jscript.compilation.values; - -import java.util.ArrayList; -import java.util.Map; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class ObjectStatement extends Statement { - public final Map map; - public final Map getters; - public final Map setters; - - @Override public boolean pure() { - for (var el : map.values()) { - if (!el.pure()) return false; - } - - return true; - } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - target.add(Instruction.loadObj(loc())); - - for (var el : map.entrySet()) { - target.add(Instruction.dup(loc())); - target.add(Instruction.loadValue(loc(), el.getKey())); - var val = el.getValue(); - FunctionStatement.compileWithName(val, target, scope, true, el.getKey().toString()); - target.add(Instruction.storeMember(loc())); - } - - var keys = new ArrayList(); - keys.addAll(getters.keySet()); - keys.addAll(setters.keySet()); - - for (var key : keys) { - if (key instanceof String) target.add(Instruction.loadValue(loc(), (String)key)); - else target.add(Instruction.loadValue(loc(), (Double)key)); - - if (getters.containsKey(key)) getters.get(key).compile(target, scope, true); - else target.add(Instruction.loadValue(loc(), null)); - - if (setters.containsKey(key)) setters.get(key).compile(target, scope, true); - else target.add(Instruction.loadValue(loc(), null)); - - target.add(Instruction.defProp(loc())); - } - - if (!pollute) target.add(Instruction.discard(loc())); - } - - public ObjectStatement(Location loc, Map map, Map getters, Map setters) { - super(loc); - this.map = map; - this.getters = getters; - this.setters = setters; - } -} +package me.topchetoeu.jscript.compilation.values; + +import java.util.ArrayList; +import java.util.Map; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class ObjectStatement extends Statement { + public final Map map; + public final Map getters; + public final Map setters; + + @Override public boolean pure() { + for (var el : map.values()) { + if (!el.pure()) return false; + } + + return true; + } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + target.add(Instruction.loadObj(loc())); + + for (var el : map.entrySet()) { + target.add(Instruction.dup(loc())); + target.add(Instruction.loadValue(loc(), el.getKey())); + var val = el.getValue(); + FunctionStatement.compileWithName(val, target, scope, true, el.getKey().toString()); + target.add(Instruction.storeMember(loc())); + } + + var keys = new ArrayList(); + keys.addAll(getters.keySet()); + keys.addAll(setters.keySet()); + + for (var key : keys) { + if (key instanceof String) target.add(Instruction.loadValue(loc(), (String)key)); + else target.add(Instruction.loadValue(loc(), (Double)key)); + + if (getters.containsKey(key)) getters.get(key).compile(target, scope, true); + else target.add(Instruction.loadValue(loc(), null)); + + if (setters.containsKey(key)) setters.get(key).compile(target, scope, true); + else target.add(Instruction.loadValue(loc(), null)); + + target.add(Instruction.defProp(loc())); + } + + if (!pollute) target.add(Instruction.discard(loc())); + } + + public ObjectStatement(Location loc, Map map, Map getters, Map setters) { + super(loc); + this.map = map; + this.getters = getters; + this.setters = setters; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/OperationStatement.java b/src/me/topchetoeu/jscript/compilation/values/OperationStatement.java index 7ab59a0..47c1899 100644 --- a/src/me/topchetoeu/jscript/compilation/values/OperationStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/OperationStatement.java @@ -1,37 +1,37 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.Operation; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class OperationStatement extends Statement { - public final Statement[] args; - public final Operation operation; - - @Override public boolean pure() { - for (var el : args) { - if (!el.pure()) return false; - } - - return true; - } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - for (var arg : args) { - arg.compile(target, scope, true); - } - - if (pollute) target.add(Instruction.operation(loc(), operation)); - else target.add(Instruction.discard(loc())); - } - - public OperationStatement(Location loc, Operation operation, Statement ...args) { - super(loc); - this.operation = operation; - this.args = args; - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.Operation; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class OperationStatement extends Statement { + public final Statement[] args; + public final Operation operation; + + @Override public boolean pure() { + for (var el : args) { + if (!el.pure()) return false; + } + + return true; + } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + for (var arg : args) { + arg.compile(target, scope, true); + } + + if (pollute) target.add(Instruction.operation(loc(), operation)); + else target.add(Instruction.discard(loc())); + } + + public OperationStatement(Location loc, Operation operation, Statement ...args) { + super(loc); + this.operation = operation; + this.args = args; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/RegexStatement.java b/src/me/topchetoeu/jscript/compilation/values/RegexStatement.java index aaec539..00d5c54 100644 --- a/src/me/topchetoeu/jscript/compilation/values/RegexStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/RegexStatement.java @@ -1,26 +1,26 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class RegexStatement extends Statement { - public final String pattern, flags; - - // Not really pure, since a function is called, but can be ignored. - @Override public boolean pure() { return true; } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - target.add(Instruction.loadRegex(loc(), pattern, flags)); - if (!pollute) target.add(Instruction.discard(loc())); - } - - public RegexStatement(Location loc, String pattern, String flags) { - super(loc); - this.pattern = pattern; - this.flags = flags; - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class RegexStatement extends Statement { + public final String pattern, flags; + + // Not really pure, since a function is called, but can be ignored. + @Override public boolean pure() { return true; } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + target.add(Instruction.loadRegex(loc(), pattern, flags)); + if (!pollute) target.add(Instruction.discard(loc())); + } + + public RegexStatement(Location loc, String pattern, String flags) { + super(loc); + this.pattern = pattern; + this.flags = flags; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/TypeofStatement.java b/src/me/topchetoeu/jscript/compilation/values/TypeofStatement.java index 37a8ce1..f610c99 100644 --- a/src/me/topchetoeu/jscript/compilation/values/TypeofStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/TypeofStatement.java @@ -1,33 +1,33 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class TypeofStatement extends Statement { - public final Statement value; - - // Not really pure, since a variable from the global scope could be accessed, - // which could lead to code execution, that would get omitted - @Override public boolean pure() { return true; } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - if (value instanceof VariableStatement) { - var i = scope.getKey(((VariableStatement)value).name); - if (i instanceof String) { - target.add(Instruction.typeof(loc(), (String)i)); - return; - } - } - value.compile(target, scope, pollute); - target.add(Instruction.typeof(loc())); - } - - public TypeofStatement(Location loc, Statement value) { - super(loc); - this.value = value; - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class TypeofStatement extends Statement { + public final Statement value; + + // Not really pure, since a variable from the global scope could be accessed, + // which could lead to code execution, that would get omitted + @Override public boolean pure() { return true; } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + if (value instanceof VariableStatement) { + var i = scope.getKey(((VariableStatement)value).name); + if (i instanceof String) { + target.add(Instruction.typeof(loc(), (String)i)); + return; + } + } + value.compile(target, scope, pollute); + target.add(Instruction.typeof(loc())); + } + + public TypeofStatement(Location loc, Statement value) { + super(loc); + this.value = value; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/VariableAssignStatement.java b/src/me/topchetoeu/jscript/compilation/values/VariableAssignStatement.java index 84be851..b0f39c7 100644 --- a/src/me/topchetoeu/jscript/compilation/values/VariableAssignStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/VariableAssignStatement.java @@ -1,38 +1,38 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.engine.Operation; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class VariableAssignStatement extends Statement { - public final String name; - public final Statement value; - public final Operation operation; - - @Override public boolean pure() { return false; } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - var i = scope.getKey(name); - if (operation != null) { - target.add(Instruction.loadVar(loc(), i)); - FunctionStatement.compileWithName(value, target, scope, true, name); - target.add(Instruction.operation(loc(), operation)); - target.add(Instruction.storeVar(loc(), i, pollute)); - } - else { - FunctionStatement.compileWithName(value, target, scope, true, name); - target.add(Instruction.storeVar(loc(), i, pollute)); - } - } - - public VariableAssignStatement(Location loc, String name, Statement val, Operation operation) { - super(loc); - this.name = name; - this.value = val; - this.operation = operation; - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.engine.Operation; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class VariableAssignStatement extends Statement { + public final String name; + public final Statement value; + public final Operation operation; + + @Override public boolean pure() { return false; } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + var i = scope.getKey(name); + if (operation != null) { + target.add(Instruction.loadVar(loc(), i)); + FunctionStatement.compileWithName(value, target, scope, true, name); + target.add(Instruction.operation(loc(), operation)); + target.add(Instruction.storeVar(loc(), i, pollute)); + } + else { + FunctionStatement.compileWithName(value, target, scope, true, name); + target.add(Instruction.storeVar(loc(), i, pollute)); + } + } + + public VariableAssignStatement(Location loc, String name, Statement val, Operation operation) { + super(loc); + this.name = name; + this.value = val; + this.operation = operation; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/VariableIndexStatement.java b/src/me/topchetoeu/jscript/compilation/values/VariableIndexStatement.java index f0350a1..a1ac426 100644 --- a/src/me/topchetoeu/jscript/compilation/values/VariableIndexStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/VariableIndexStatement.java @@ -1,23 +1,23 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class VariableIndexStatement extends Statement { - public final int index; - - @Override public boolean pure() { return true; } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - if (pollute) target.add(Instruction.loadVar(loc(), index)); - } - - public VariableIndexStatement(Location loc, int i) { - super(loc); - this.index = i; - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class VariableIndexStatement extends Statement { + public final int index; + + @Override public boolean pure() { return true; } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + if (pollute) target.add(Instruction.loadVar(loc(), index)); + } + + public VariableIndexStatement(Location loc, int i) { + super(loc); + this.index = i; + } +} diff --git a/src/me/topchetoeu/jscript/compilation/values/VariableStatement.java b/src/me/topchetoeu/jscript/compilation/values/VariableStatement.java index 3f4402f..070797e 100644 --- a/src/me/topchetoeu/jscript/compilation/values/VariableStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/VariableStatement.java @@ -1,32 +1,32 @@ -package me.topchetoeu.jscript.compilation.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.AssignableStatement; -import me.topchetoeu.jscript.compilation.CompileTarget; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Statement; -import me.topchetoeu.jscript.engine.Operation; -import me.topchetoeu.jscript.engine.scope.ScopeRecord; - -public class VariableStatement extends AssignableStatement { - public final String name; - - @Override public boolean pure() { return false; } - - @Override - public Statement toAssign(Statement val, Operation operation) { - return new VariableAssignStatement(loc(), name, val, operation); - } - - @Override - public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { - var i = scope.getKey(name); - target.add(Instruction.loadVar(loc(), i)); - if (!pollute) target.add(Instruction.discard(loc())); - } - - public VariableStatement(Location loc, String name) { - super(loc); - this.name = name; - } -} +package me.topchetoeu.jscript.compilation.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.AssignableStatement; +import me.topchetoeu.jscript.compilation.CompileTarget; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Statement; +import me.topchetoeu.jscript.engine.Operation; +import me.topchetoeu.jscript.engine.scope.ScopeRecord; + +public class VariableStatement extends AssignableStatement { + public final String name; + + @Override public boolean pure() { return false; } + + @Override + public Statement toAssign(Statement val, Operation operation) { + return new VariableAssignStatement(loc(), name, val, operation); + } + + @Override + public void compile(CompileTarget target, ScopeRecord scope, boolean pollute) { + var i = scope.getKey(name); + target.add(Instruction.loadVar(loc(), i)); + if (!pollute) target.add(Instruction.discard(loc())); + } + + public VariableStatement(Location loc, String name) { + super(loc); + this.name = name; + } +} diff --git a/src/me/topchetoeu/jscript/engine/Context.java b/src/me/topchetoeu/jscript/engine/Context.java index 354d49c..0a0ecab 100644 --- a/src/me/topchetoeu/jscript/engine/Context.java +++ b/src/me/topchetoeu/jscript/engine/Context.java @@ -1,125 +1,125 @@ -package me.topchetoeu.jscript.engine; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Stack; -import java.util.TreeSet; -import java.util.stream.Collectors; - -import me.topchetoeu.jscript.Filename; -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.engine.frame.CodeFrame; -import me.topchetoeu.jscript.engine.values.ArrayValue; -import me.topchetoeu.jscript.engine.values.FunctionValue; -import me.topchetoeu.jscript.engine.values.Values; -import me.topchetoeu.jscript.exceptions.EngineException; -import me.topchetoeu.jscript.mapping.SourceMap; - -public class Context { - private final Stack env = new Stack<>(); - private final ArrayList frames = new ArrayList<>(); - public final Engine engine; - - public Environment environment() { - return env.empty() ? null : env.peek(); - } - - public Context pushEnv(Environment env) { - this.env.push(env); - return this; - } - public void popEnv() { - if (!env.empty()) this.env.pop(); - } - - public FunctionValue compile(Filename filename, String raw) { - var env = environment(); - var result = env.compile.call(this, null, raw, filename.toString(), env); - - var function = (FunctionValue)Values.getMember(this, result, "function"); - if (!engine.debugging) return function; - - var rawMapChain = ((ArrayValue)Values.getMember(this, result, "mapChain")).toArray(); - var breakpoints = new TreeSet<>( - Arrays.stream(((ArrayValue)Values.getMember(this, result, "breakpoints")).toArray()) - .map(v -> Location.parse(Values.toString(this, v))) - .collect(Collectors.toList()) - ); - var maps = new SourceMap[rawMapChain.length]; - - for (var i = 0; i < maps.length; i++) maps[i] = SourceMap.parse(Values.toString(this, (String)rawMapChain[i])); - - var map = SourceMap.chain(maps); - - if (map != null) { - var newBreakpoints = new TreeSet(); - for (var bp : breakpoints) { - bp = map.toCompiled(bp); - if (bp != null) newBreakpoints.add(bp); - } - breakpoints = newBreakpoints; - } - - engine.onSource(filename, raw, breakpoints, map); - - return function; - } - - - public void pushFrame(CodeFrame frame) { - frames.add(frame); - if (frames.size() > engine.maxStackFrames) throw EngineException.ofRange("Stack overflow!"); - pushEnv(frame.function.environment); - engine.onFramePush(this, frame); - } - public boolean popFrame(CodeFrame frame) { - if (frames.size() == 0) return false; - if (frames.get(frames.size() - 1) != frame) return false; - frames.remove(frames.size() - 1); - popEnv(); - engine.onFramePop(this, frame); - return true; - } - public CodeFrame peekFrame() { - if (frames.size() == 0) return null; - return frames.get(frames.size() - 1); - } - - public List frames() { - return Collections.unmodifiableList(frames); - } - public List stackTrace() { - var res = new ArrayList(); - - for (var i = frames.size() - 1; i >= 0; i--) { - var el = frames.get(i); - var name = el.function.name; - Location loc = null; - - for (var j = el.codePtr; j >= 0 && loc == null; j--) loc = el.function.body[j].location; - if (loc == null) loc = el.function.loc(); - - var trace = ""; - - if (loc != null) trace += "at " + loc.toString() + " "; - if (name != null && !name.equals("")) trace += "in " + name + " "; - - trace = trace.trim(); - - if (!trace.equals("")) res.add(trace); - } - - return res; - } - - public Context(Engine engine) { - this.engine = engine; - } - public Context(Engine engine, Environment env) { - this(engine); - this.pushEnv(env); - - } -} +package me.topchetoeu.jscript.engine; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Stack; +import java.util.TreeSet; +import java.util.stream.Collectors; + +import me.topchetoeu.jscript.Filename; +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.engine.frame.CodeFrame; +import me.topchetoeu.jscript.engine.values.ArrayValue; +import me.topchetoeu.jscript.engine.values.FunctionValue; +import me.topchetoeu.jscript.engine.values.Values; +import me.topchetoeu.jscript.exceptions.EngineException; +import me.topchetoeu.jscript.mapping.SourceMap; + +public class Context { + private final Stack env = new Stack<>(); + private final ArrayList frames = new ArrayList<>(); + public final Engine engine; + + public Environment environment() { + return env.empty() ? null : env.peek(); + } + + public Context pushEnv(Environment env) { + this.env.push(env); + return this; + } + public void popEnv() { + if (!env.empty()) this.env.pop(); + } + + public FunctionValue compile(Filename filename, String raw) { + var env = environment(); + var result = env.compile.call(this, null, raw, filename.toString(), env); + + var function = (FunctionValue)Values.getMember(this, result, "function"); + if (!engine.debugging) return function; + + var rawMapChain = ((ArrayValue)Values.getMember(this, result, "mapChain")).toArray(); + var breakpoints = new TreeSet<>( + Arrays.stream(((ArrayValue)Values.getMember(this, result, "breakpoints")).toArray()) + .map(v -> Location.parse(Values.toString(this, v))) + .collect(Collectors.toList()) + ); + var maps = new SourceMap[rawMapChain.length]; + + for (var i = 0; i < maps.length; i++) maps[i] = SourceMap.parse(Values.toString(this, (String)rawMapChain[i])); + + var map = SourceMap.chain(maps); + + if (map != null) { + var newBreakpoints = new TreeSet(); + for (var bp : breakpoints) { + bp = map.toCompiled(bp); + if (bp != null) newBreakpoints.add(bp); + } + breakpoints = newBreakpoints; + } + + engine.onSource(filename, raw, breakpoints, map); + + return function; + } + + + public void pushFrame(CodeFrame frame) { + frames.add(frame); + if (frames.size() > engine.maxStackFrames) throw EngineException.ofRange("Stack overflow!"); + pushEnv(frame.function.environment); + engine.onFramePush(this, frame); + } + public boolean popFrame(CodeFrame frame) { + if (frames.size() == 0) return false; + if (frames.get(frames.size() - 1) != frame) return false; + frames.remove(frames.size() - 1); + popEnv(); + engine.onFramePop(this, frame); + return true; + } + public CodeFrame peekFrame() { + if (frames.size() == 0) return null; + return frames.get(frames.size() - 1); + } + + public List frames() { + return Collections.unmodifiableList(frames); + } + public List stackTrace() { + var res = new ArrayList(); + + for (var i = frames.size() - 1; i >= 0; i--) { + var el = frames.get(i); + var name = el.function.name; + Location loc = null; + + for (var j = el.codePtr; j >= 0 && loc == null; j--) loc = el.function.body[j].location; + if (loc == null) loc = el.function.loc(); + + var trace = ""; + + if (loc != null) trace += "at " + loc.toString() + " "; + if (name != null && !name.equals("")) trace += "in " + name + " "; + + trace = trace.trim(); + + if (!trace.equals("")) res.add(trace); + } + + return res; + } + + public Context(Engine engine) { + this.engine = engine; + } + public Context(Engine engine, Environment env) { + this(engine); + this.pushEnv(env); + + } +} diff --git a/src/me/topchetoeu/jscript/engine/Engine.java b/src/me/topchetoeu/jscript/engine/Engine.java index 773ec9f..320585e 100644 --- a/src/me/topchetoeu/jscript/engine/Engine.java +++ b/src/me/topchetoeu/jscript/engine/Engine.java @@ -1,175 +1,175 @@ -package me.topchetoeu.jscript.engine; - -import java.util.HashMap; -import java.util.TreeSet; -import java.util.concurrent.PriorityBlockingQueue; - -import me.topchetoeu.jscript.Filename; -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.FunctionBody; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.engine.debug.DebugController; -import me.topchetoeu.jscript.engine.frame.CodeFrame; -import me.topchetoeu.jscript.engine.values.FunctionValue; -import me.topchetoeu.jscript.events.Awaitable; -import me.topchetoeu.jscript.events.DataNotifier; -import me.topchetoeu.jscript.exceptions.EngineException; -import me.topchetoeu.jscript.exceptions.InterruptException; -import me.topchetoeu.jscript.mapping.SourceMap; - -public class Engine implements DebugController { - private class UncompiledFunction extends FunctionValue { - public final Filename filename; - public final String raw; - private FunctionValue compiled = null; - - @Override - public Object call(Context ctx, Object thisArg, Object ...args) { - if (compiled == null) compiled = ctx.compile(filename, raw); - return compiled.call(ctx, thisArg, args); - } - - public UncompiledFunction(Filename filename, String raw) { - super(filename + "", 0); - this.filename = filename; - this.raw = raw; - } - } - - private static class Task implements Comparable { - public final FunctionValue func; - public final Object thisArg; - public final Object[] args; - public final DataNotifier notifier = new DataNotifier<>(); - public final Context ctx; - public final boolean micro; - - public Task(Context ctx, FunctionValue func, Object thisArg, Object[] args, boolean micro) { - this.ctx = ctx; - this.func = func; - this.thisArg = thisArg; - this.args = args; - this.micro = micro; - } - - @Override - public int compareTo(Task other) { - return Integer.compare(this.micro ? 0 : 1, other.micro ? 0 : 1); - } - } - - private static int nextId = 0; - public static final HashMap functions = new HashMap<>(); - - public final int id = ++nextId; - public final boolean debugging; - public int maxStackFrames = 10000; - - private final HashMap sources = new HashMap<>(); - private final HashMap> bpts = new HashMap<>(); - private final HashMap maps = new HashMap<>(); - - public Location mapToCompiled(Location location) { - var map = maps.get(location.filename()); - if (map == null) return location; - return map.toCompiled(location); - } - public Location mapToOriginal(Location location) { - var map = maps.get(location.filename()); - if (map == null) return location; - return map.toOriginal(location); - } - - private DebugController debugger; - private Thread thread; - private PriorityBlockingQueue tasks = new PriorityBlockingQueue<>(); - - public synchronized boolean attachDebugger(DebugController debugger) { - if (!debugging || this.debugger != null) return false; - - for (var source : sources.entrySet()) debugger.onSource( - source.getKey(), source.getValue(), - bpts.get(source.getKey()), - maps.get(source.getKey()) - ); - - this.debugger = debugger; - return true; - } - public synchronized boolean detachDebugger() { - if (!debugging || this.debugger == null) return false; - this.debugger = null; - return true; - } - - private void runTask(Task task) { - try { - task.notifier.next(task.func.call(task.ctx, task.thisArg, task.args)); - } - catch (RuntimeException e) { - if (e instanceof InterruptException) throw e; - task.notifier.error(e); - } - } - public void run(boolean untilEmpty) { - while (!untilEmpty || !tasks.isEmpty()) { - try { - runTask(tasks.take()); - } - catch (InterruptedException | InterruptException e) { - for (var msg : tasks) msg.notifier.error(new InterruptException(e)); - break; - } - } - } - - public Thread start() { - if (this.thread == null) { - this.thread = new Thread(() -> run(false), "JavaScript Runner #" + id); - this.thread.start(); - } - return this.thread; - } - public void stop() { - thread.interrupt(); - thread = null; - } - public boolean inExecThread() { - return Thread.currentThread() == thread; - } - public synchronized boolean isRunning() { - return this.thread != null; - } - - public Awaitable pushMsg(boolean micro, Context ctx, FunctionValue func, Object thisArg, Object ...args) { - var msg = new Task(ctx == null ? new Context(this) : ctx, func, thisArg, args, micro); - tasks.add(msg); - return msg.notifier; - } - public Awaitable pushMsg(boolean micro, Context ctx, Filename filename, String raw, Object thisArg, Object ...args) { - return pushMsg(micro, ctx, new UncompiledFunction(filename, raw), thisArg, args); - } - - @Override - public void onFramePush(Context ctx, CodeFrame frame) { - if (debugging && debugger != null) debugger.onFramePush(ctx, frame); - } - @Override public void onFramePop(Context ctx, CodeFrame frame) { - if (debugging && debugger != null) debugger.onFramePop(ctx, frame); - } - @Override public boolean onInstruction(Context ctx, CodeFrame frame, Instruction instruction, Object returnVal, EngineException error, boolean caught) { - if (debugging && debugger != null) return debugger.onInstruction(ctx, frame, instruction, returnVal, error, caught); - else return false; - } - @Override public void onSource(Filename filename, String source, TreeSet breakpoints, SourceMap map) { - if (!debugging) return; - if (debugger != null) debugger.onSource(filename, source, breakpoints, map); - sources.put(filename, source); - bpts.put(filename, breakpoints); - maps.put(filename, map); - } - - public Engine(boolean debugging) { - this.debugging = debugging; - } -} +package me.topchetoeu.jscript.engine; + +import java.util.HashMap; +import java.util.TreeSet; +import java.util.concurrent.PriorityBlockingQueue; + +import me.topchetoeu.jscript.Filename; +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.FunctionBody; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.engine.debug.DebugController; +import me.topchetoeu.jscript.engine.frame.CodeFrame; +import me.topchetoeu.jscript.engine.values.FunctionValue; +import me.topchetoeu.jscript.events.Awaitable; +import me.topchetoeu.jscript.events.DataNotifier; +import me.topchetoeu.jscript.exceptions.EngineException; +import me.topchetoeu.jscript.exceptions.InterruptException; +import me.topchetoeu.jscript.mapping.SourceMap; + +public class Engine implements DebugController { + private class UncompiledFunction extends FunctionValue { + public final Filename filename; + public final String raw; + private FunctionValue compiled = null; + + @Override + public Object call(Context ctx, Object thisArg, Object ...args) { + if (compiled == null) compiled = ctx.compile(filename, raw); + return compiled.call(ctx, thisArg, args); + } + + public UncompiledFunction(Filename filename, String raw) { + super(filename + "", 0); + this.filename = filename; + this.raw = raw; + } + } + + private static class Task implements Comparable { + public final FunctionValue func; + public final Object thisArg; + public final Object[] args; + public final DataNotifier notifier = new DataNotifier<>(); + public final Context ctx; + public final boolean micro; + + public Task(Context ctx, FunctionValue func, Object thisArg, Object[] args, boolean micro) { + this.ctx = ctx; + this.func = func; + this.thisArg = thisArg; + this.args = args; + this.micro = micro; + } + + @Override + public int compareTo(Task other) { + return Integer.compare(this.micro ? 0 : 1, other.micro ? 0 : 1); + } + } + + private static int nextId = 0; + public static final HashMap functions = new HashMap<>(); + + public final int id = ++nextId; + public final boolean debugging; + public int maxStackFrames = 10000; + + private final HashMap sources = new HashMap<>(); + private final HashMap> bpts = new HashMap<>(); + private final HashMap maps = new HashMap<>(); + + public Location mapToCompiled(Location location) { + var map = maps.get(location.filename()); + if (map == null) return location; + return map.toCompiled(location); + } + public Location mapToOriginal(Location location) { + var map = maps.get(location.filename()); + if (map == null) return location; + return map.toOriginal(location); + } + + private DebugController debugger; + private Thread thread; + private PriorityBlockingQueue tasks = new PriorityBlockingQueue<>(); + + public synchronized boolean attachDebugger(DebugController debugger) { + if (!debugging || this.debugger != null) return false; + + for (var source : sources.entrySet()) debugger.onSource( + source.getKey(), source.getValue(), + bpts.get(source.getKey()), + maps.get(source.getKey()) + ); + + this.debugger = debugger; + return true; + } + public synchronized boolean detachDebugger() { + if (!debugging || this.debugger == null) return false; + this.debugger = null; + return true; + } + + private void runTask(Task task) { + try { + task.notifier.next(task.func.call(task.ctx, task.thisArg, task.args)); + } + catch (RuntimeException e) { + if (e instanceof InterruptException) throw e; + task.notifier.error(e); + } + } + public void run(boolean untilEmpty) { + while (!untilEmpty || !tasks.isEmpty()) { + try { + runTask(tasks.take()); + } + catch (InterruptedException | InterruptException e) { + for (var msg : tasks) msg.notifier.error(new InterruptException(e)); + break; + } + } + } + + public Thread start() { + if (this.thread == null) { + this.thread = new Thread(() -> run(false), "JavaScript Runner #" + id); + this.thread.start(); + } + return this.thread; + } + public void stop() { + thread.interrupt(); + thread = null; + } + public boolean inExecThread() { + return Thread.currentThread() == thread; + } + public synchronized boolean isRunning() { + return this.thread != null; + } + + public Awaitable pushMsg(boolean micro, Context ctx, FunctionValue func, Object thisArg, Object ...args) { + var msg = new Task(ctx == null ? new Context(this) : ctx, func, thisArg, args, micro); + tasks.add(msg); + return msg.notifier; + } + public Awaitable pushMsg(boolean micro, Context ctx, Filename filename, String raw, Object thisArg, Object ...args) { + return pushMsg(micro, ctx, new UncompiledFunction(filename, raw), thisArg, args); + } + + @Override + public void onFramePush(Context ctx, CodeFrame frame) { + if (debugging && debugger != null) debugger.onFramePush(ctx, frame); + } + @Override public void onFramePop(Context ctx, CodeFrame frame) { + if (debugging && debugger != null) debugger.onFramePop(ctx, frame); + } + @Override public boolean onInstruction(Context ctx, CodeFrame frame, Instruction instruction, Object returnVal, EngineException error, boolean caught) { + if (debugging && debugger != null) return debugger.onInstruction(ctx, frame, instruction, returnVal, error, caught); + else return false; + } + @Override public void onSource(Filename filename, String source, TreeSet breakpoints, SourceMap map) { + if (!debugging) return; + if (debugger != null) debugger.onSource(filename, source, breakpoints, map); + sources.put(filename, source); + bpts.put(filename, breakpoints); + maps.put(filename, map); + } + + public Engine(boolean debugging) { + this.debugging = debugging; + } +} diff --git a/src/me/topchetoeu/jscript/engine/Environment.java b/src/me/topchetoeu/jscript/engine/Environment.java index 7fb7714..f55c165 100644 --- a/src/me/topchetoeu/jscript/engine/Environment.java +++ b/src/me/topchetoeu/jscript/engine/Environment.java @@ -1,131 +1,131 @@ -package me.topchetoeu.jscript.engine; - -import java.util.HashMap; -import java.util.stream.Collectors; - -import me.topchetoeu.jscript.Filename; -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.engine.scope.GlobalScope; -import me.topchetoeu.jscript.engine.values.ArrayValue; -import me.topchetoeu.jscript.engine.values.FunctionValue; -import me.topchetoeu.jscript.engine.values.NativeFunction; -import me.topchetoeu.jscript.engine.values.ObjectValue; -import me.topchetoeu.jscript.engine.values.Symbol; -import me.topchetoeu.jscript.engine.values.Values; -import me.topchetoeu.jscript.exceptions.EngineException; -import me.topchetoeu.jscript.filesystem.RootFilesystem; -import me.topchetoeu.jscript.interop.Native; -import me.topchetoeu.jscript.interop.NativeGetter; -import me.topchetoeu.jscript.interop.NativeSetter; -import me.topchetoeu.jscript.interop.NativeWrapperProvider; -import me.topchetoeu.jscript.parsing.Parsing; -import me.topchetoeu.jscript.permissions.Permission; -import me.topchetoeu.jscript.permissions.PermissionsProvider; - -public class Environment implements PermissionsProvider { - private HashMap prototypes = new HashMap<>(); - - public final Data data = new Data(); - public static final HashMap symbols = new HashMap<>(); - - public GlobalScope global; - public WrappersProvider wrappers; - public PermissionsProvider permissions = null; - public final RootFilesystem filesystem = new RootFilesystem(this); - - private static int nextId = 0; - - @Native public boolean stackVisible = true; - @Native public int id = ++nextId; - - @Native public FunctionValue compile = new NativeFunction("compile", (ctx, thisArg, args) -> { - var source = Values.toString(ctx, args[0]); - var filename = Values.toString(ctx, args[1]); - var isDebug = Values.toBoolean(args[2]); - - var env = Values.wrapper(args[2], Environment.class); - var res = new ObjectValue(); - - var target = Parsing.compile(env, Filename.parse(filename), source); - Engine.functions.putAll(target.functions); - Engine.functions.remove(0l); - - res.defineProperty(ctx, "function", target.func(env)); - res.defineProperty(ctx, "mapChain", new ArrayValue()); - - - if (isDebug) { - res.defineProperty(ctx, "breakpoints", ArrayValue.of(ctx, target.breakpoints.stream().map(Location::toString).collect(Collectors.toList()))); - } - - return res; - }); - @Native public FunctionValue regexConstructor = new NativeFunction("RegExp", (ctx, thisArg, args) -> { - throw EngineException.ofError("Regular expressions not supported.").setCtx(ctx.environment(), ctx.engine); - }); - - public Environment addData(Data data) { - this.data.addAll(data); - return this; - } - - @Native public ObjectValue proto(String name) { - return prototypes.get(name); - } - @Native public void setProto(String name, ObjectValue val) { - prototypes.put(name, val); - } - - @Native public Symbol symbol(String name) { - return getSymbol(name); - } - - @NativeGetter("global") public ObjectValue getGlobal() { - return global.obj; - } - @NativeSetter("global") public void setGlobal(ObjectValue val) { - global = new GlobalScope(val); - } - - @Native public Environment fork() { - var res = new Environment(compile, null, global); - res.wrappers = wrappers.fork(res); - res.regexConstructor = regexConstructor; - res.prototypes = new HashMap<>(prototypes); - return res; - } - @Native public Environment child() { - var res = fork(); - res.global = res.global.globalChild(); - return res; - } - - @Override public boolean hasPermission(Permission perm, char delim) { - return permissions == null || permissions.hasPermission(perm, delim); - } - @Override public boolean hasPermission(Permission perm) { - return permissions == null || permissions.hasPermission(perm); - } - - public Context context(Engine engine) { - return new Context(engine).pushEnv(this); - } - - public static Symbol getSymbol(String name) { - if (symbols.containsKey(name)) return symbols.get(name); - else { - var res = new Symbol(name); - symbols.put(name, res); - return res; - } - } - - public Environment(FunctionValue compile, WrappersProvider nativeConverter, GlobalScope global) { - if (compile != null) this.compile = compile; - if (nativeConverter == null) nativeConverter = new NativeWrapperProvider(this); - if (global == null) global = new GlobalScope(); - - this.wrappers = nativeConverter; - this.global = global; - } -} +package me.topchetoeu.jscript.engine; + +import java.util.HashMap; +import java.util.stream.Collectors; + +import me.topchetoeu.jscript.Filename; +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.engine.scope.GlobalScope; +import me.topchetoeu.jscript.engine.values.ArrayValue; +import me.topchetoeu.jscript.engine.values.FunctionValue; +import me.topchetoeu.jscript.engine.values.NativeFunction; +import me.topchetoeu.jscript.engine.values.ObjectValue; +import me.topchetoeu.jscript.engine.values.Symbol; +import me.topchetoeu.jscript.engine.values.Values; +import me.topchetoeu.jscript.exceptions.EngineException; +import me.topchetoeu.jscript.filesystem.RootFilesystem; +import me.topchetoeu.jscript.interop.Native; +import me.topchetoeu.jscript.interop.NativeGetter; +import me.topchetoeu.jscript.interop.NativeSetter; +import me.topchetoeu.jscript.interop.NativeWrapperProvider; +import me.topchetoeu.jscript.parsing.Parsing; +import me.topchetoeu.jscript.permissions.Permission; +import me.topchetoeu.jscript.permissions.PermissionsProvider; + +public class Environment implements PermissionsProvider { + private HashMap prototypes = new HashMap<>(); + + public final Data data = new Data(); + public static final HashMap symbols = new HashMap<>(); + + public GlobalScope global; + public WrappersProvider wrappers; + public PermissionsProvider permissions = null; + public final RootFilesystem filesystem = new RootFilesystem(this); + + private static int nextId = 0; + + @Native public boolean stackVisible = true; + @Native public int id = ++nextId; + + @Native public FunctionValue compile = new NativeFunction("compile", (ctx, thisArg, args) -> { + var source = Values.toString(ctx, args[0]); + var filename = Values.toString(ctx, args[1]); + var isDebug = Values.toBoolean(args[2]); + + var env = Values.wrapper(args[2], Environment.class); + var res = new ObjectValue(); + + var target = Parsing.compile(env, Filename.parse(filename), source); + Engine.functions.putAll(target.functions); + Engine.functions.remove(0l); + + res.defineProperty(ctx, "function", target.func(env)); + res.defineProperty(ctx, "mapChain", new ArrayValue()); + + + if (isDebug) { + res.defineProperty(ctx, "breakpoints", ArrayValue.of(ctx, target.breakpoints.stream().map(Location::toString).collect(Collectors.toList()))); + } + + return res; + }); + @Native public FunctionValue regexConstructor = new NativeFunction("RegExp", (ctx, thisArg, args) -> { + throw EngineException.ofError("Regular expressions not supported.").setCtx(ctx.environment(), ctx.engine); + }); + + public Environment addData(Data data) { + this.data.addAll(data); + return this; + } + + @Native public ObjectValue proto(String name) { + return prototypes.get(name); + } + @Native public void setProto(String name, ObjectValue val) { + prototypes.put(name, val); + } + + @Native public Symbol symbol(String name) { + return getSymbol(name); + } + + @NativeGetter("global") public ObjectValue getGlobal() { + return global.obj; + } + @NativeSetter("global") public void setGlobal(ObjectValue val) { + global = new GlobalScope(val); + } + + @Native public Environment fork() { + var res = new Environment(compile, null, global); + res.wrappers = wrappers.fork(res); + res.regexConstructor = regexConstructor; + res.prototypes = new HashMap<>(prototypes); + return res; + } + @Native public Environment child() { + var res = fork(); + res.global = res.global.globalChild(); + return res; + } + + @Override public boolean hasPermission(Permission perm, char delim) { + return permissions == null || permissions.hasPermission(perm, delim); + } + @Override public boolean hasPermission(Permission perm) { + return permissions == null || permissions.hasPermission(perm); + } + + public Context context(Engine engine) { + return new Context(engine).pushEnv(this); + } + + public static Symbol getSymbol(String name) { + if (symbols.containsKey(name)) return symbols.get(name); + else { + var res = new Symbol(name); + symbols.put(name, res); + return res; + } + } + + public Environment(FunctionValue compile, WrappersProvider nativeConverter, GlobalScope global) { + if (compile != null) this.compile = compile; + if (nativeConverter == null) nativeConverter = new NativeWrapperProvider(this); + if (global == null) global = new GlobalScope(); + + this.wrappers = nativeConverter; + this.global = global; + } +} diff --git a/src/me/topchetoeu/jscript/engine/debug/DebugController.java b/src/me/topchetoeu/jscript/engine/debug/DebugController.java index de4e4a1..36fa7b1 100644 --- a/src/me/topchetoeu/jscript/engine/debug/DebugController.java +++ b/src/me/topchetoeu/jscript/engine/debug/DebugController.java @@ -1,51 +1,51 @@ -package me.topchetoeu.jscript.engine.debug; - -import java.util.TreeSet; - -import me.topchetoeu.jscript.Filename; -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.frame.CodeFrame; -import me.topchetoeu.jscript.exceptions.EngineException; -import me.topchetoeu.jscript.mapping.SourceMap; - -public interface DebugController { - /** - * Called when a script has been loaded - * @param filename The name of the source - * @param source The name of the source - * @param breakpoints A set of all the breakpointable locations in this source - * @param map The source map associated with this file. null if this source map isn't mapped - */ - void onSource(Filename filename, String source, TreeSet breakpoints, SourceMap map); - - /** - * Called immediatly before an instruction is executed, as well as after an instruction, if it has threw or returned. - * This function might pause in order to await debugging commands. - * @param ctx The context of execution - * @param frame The frame in which execution is occuring - * @param instruction The instruction which was or will be executed - * @param loc The most recent location the code frame has been at - * @param returnVal The return value of the instruction, Runners.NO_RETURN if none - * @param error The error that the instruction threw, null if none - * @param caught Whether or not the error has been caught - * @return Whether or not the frame should restart - */ - boolean onInstruction(Context ctx, CodeFrame frame, Instruction instruction, Object returnVal, EngineException error, boolean caught); - - /** - * Called immediatly before a frame has been pushed on the frame stack. - * This function might pause in order to await debugging commands. - * @param ctx The context of execution - * @param frame The code frame which was pushed - */ - void onFramePush(Context ctx, CodeFrame frame); - /** - * Called immediatly after a frame has been popped out of the frame stack. - * This function might pause in order to await debugging commands. - * @param ctx The context of execution - * @param frame The code frame which was popped out - */ - void onFramePop(Context ctx, CodeFrame frame); -} +package me.topchetoeu.jscript.engine.debug; + +import java.util.TreeSet; + +import me.topchetoeu.jscript.Filename; +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.frame.CodeFrame; +import me.topchetoeu.jscript.exceptions.EngineException; +import me.topchetoeu.jscript.mapping.SourceMap; + +public interface DebugController { + /** + * Called when a script has been loaded + * @param filename The name of the source + * @param source The name of the source + * @param breakpoints A set of all the breakpointable locations in this source + * @param map The source map associated with this file. null if this source map isn't mapped + */ + void onSource(Filename filename, String source, TreeSet breakpoints, SourceMap map); + + /** + * Called immediatly before an instruction is executed, as well as after an instruction, if it has threw or returned. + * This function might pause in order to await debugging commands. + * @param ctx The context of execution + * @param frame The frame in which execution is occuring + * @param instruction The instruction which was or will be executed + * @param loc The most recent location the code frame has been at + * @param returnVal The return value of the instruction, Runners.NO_RETURN if none + * @param error The error that the instruction threw, null if none + * @param caught Whether or not the error has been caught + * @return Whether or not the frame should restart + */ + boolean onInstruction(Context ctx, CodeFrame frame, Instruction instruction, Object returnVal, EngineException error, boolean caught); + + /** + * Called immediatly before a frame has been pushed on the frame stack. + * This function might pause in order to await debugging commands. + * @param ctx The context of execution + * @param frame The code frame which was pushed + */ + void onFramePush(Context ctx, CodeFrame frame); + /** + * Called immediatly after a frame has been popped out of the frame stack. + * This function might pause in order to await debugging commands. + * @param ctx The context of execution + * @param frame The code frame which was popped out + */ + void onFramePop(Context ctx, CodeFrame frame); +} diff --git a/src/me/topchetoeu/jscript/engine/debug/DebugHandler.java b/src/me/topchetoeu/jscript/engine/debug/DebugHandler.java index 371217b..1392e10 100644 --- a/src/me/topchetoeu/jscript/engine/debug/DebugHandler.java +++ b/src/me/topchetoeu/jscript/engine/debug/DebugHandler.java @@ -1,34 +1,34 @@ -package me.topchetoeu.jscript.engine.debug; - -public interface DebugHandler { - void enable(V8Message msg); - void disable(V8Message msg); - - void setBreakpointByUrl(V8Message msg); - void removeBreakpoint(V8Message msg); - void continueToLocation(V8Message msg); - - void getScriptSource(V8Message msg); - void getPossibleBreakpoints(V8Message msg); - - void resume(V8Message msg); - void pause(V8Message msg); - - void stepInto(V8Message msg); - void stepOut(V8Message msg); - void stepOver(V8Message msg); - - void setPauseOnExceptions(V8Message msg); - - void evaluateOnCallFrame(V8Message msg); - - void getProperties(V8Message msg); - void releaseObjectGroup(V8Message msg); - void releaseObject(V8Message msg); - /** - * This method might not execute the actual code for well-known requests - */ - void callFunctionOn(V8Message msg); - - void runtimeEnable(V8Message msg); -} +package me.topchetoeu.jscript.engine.debug; + +public interface DebugHandler { + void enable(V8Message msg); + void disable(V8Message msg); + + void setBreakpointByUrl(V8Message msg); + void removeBreakpoint(V8Message msg); + void continueToLocation(V8Message msg); + + void getScriptSource(V8Message msg); + void getPossibleBreakpoints(V8Message msg); + + void resume(V8Message msg); + void pause(V8Message msg); + + void stepInto(V8Message msg); + void stepOut(V8Message msg); + void stepOver(V8Message msg); + + void setPauseOnExceptions(V8Message msg); + + void evaluateOnCallFrame(V8Message msg); + + void getProperties(V8Message msg); + void releaseObjectGroup(V8Message msg); + void releaseObject(V8Message msg); + /** + * This method might not execute the actual code for well-known requests + */ + void callFunctionOn(V8Message msg); + + void runtimeEnable(V8Message msg); +} diff --git a/src/me/topchetoeu/jscript/engine/debug/DebugServer.java b/src/me/topchetoeu/jscript/engine/debug/DebugServer.java index 001c9cb..0884618 100644 --- a/src/me/topchetoeu/jscript/engine/debug/DebugServer.java +++ b/src/me/topchetoeu/jscript/engine/debug/DebugServer.java @@ -1,245 +1,245 @@ -package me.topchetoeu.jscript.engine.debug; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.security.MessageDigest; -import java.util.Base64; -import java.util.HashMap; - -import me.topchetoeu.jscript.Metadata; -import me.topchetoeu.jscript.Reading; -import me.topchetoeu.jscript.engine.debug.WebSocketMessage.Type; -import me.topchetoeu.jscript.events.Notifier; -import me.topchetoeu.jscript.exceptions.SyntaxException; -import me.topchetoeu.jscript.exceptions.UncheckedException; -import me.topchetoeu.jscript.exceptions.UncheckedIOException; -import me.topchetoeu.jscript.json.JSON; -import me.topchetoeu.jscript.json.JSONList; -import me.topchetoeu.jscript.json.JSONMap; - -public class DebugServer { - public static String browserDisplayName = Metadata.name() + "/" + Metadata.version(); - - public final HashMap targets = new HashMap<>(); - - private final byte[] favicon, index, protocol; - private final Notifier connNotifier = new Notifier(); - - private static void send(HttpRequest req, String val) throws IOException { - req.writeResponse(200, "OK", "application/json", val.getBytes()); - } - - // SILENCE JAVA - private MessageDigest getDigestInstance() { - try { - return MessageDigest.getInstance("sha1"); - } - catch (Throwable e) { throw new UncheckedException(e); } - - } - - private static Thread runAsync(Runnable func, String name) { - var res = new Thread(func); - res.setName(name); - res.start(); - return res; - } - - private void handle(WebSocket ws, Debugger debugger) { - WebSocketMessage raw; - - debugger.connect(); - - while ((raw = ws.receive()) != null) { - if (raw.type != Type.Text) { - ws.send(new V8Error("Expected a text message.")); - continue; - } - - V8Message msg; - - try { - msg = new V8Message(raw.textData()); - } - catch (SyntaxException e) { - ws.send(new V8Error(e.getMessage())); - return; - } - - try { - switch (msg.name) { - case "Debugger.enable": - connNotifier.next(); - debugger.enable(msg); continue; - case "Debugger.disable": debugger.disable(msg); continue; - - case "Debugger.setBreakpointByUrl": debugger.setBreakpointByUrl(msg); continue; - case "Debugger.removeBreakpoint": debugger.removeBreakpoint(msg); continue; - case "Debugger.continueToLocation": debugger.continueToLocation(msg); continue; - - case "Debugger.getScriptSource": debugger.getScriptSource(msg); continue; - case "Debugger.getPossibleBreakpoints": debugger.getPossibleBreakpoints(msg); continue; - - case "Debugger.resume": debugger.resume(msg); continue; - case "Debugger.pause": debugger.pause(msg); continue; - - case "Debugger.stepInto": debugger.stepInto(msg); continue; - case "Debugger.stepOut": debugger.stepOut(msg); continue; - case "Debugger.stepOver": debugger.stepOver(msg); continue; - - case "Debugger.setPauseOnExceptions": debugger.setPauseOnExceptions(msg); continue; - case "Debugger.evaluateOnCallFrame": debugger.evaluateOnCallFrame(msg); continue; - - case "Runtime.releaseObjectGroup": debugger.releaseObjectGroup(msg); continue; - case "Runtime.releaseObject": debugger.releaseObject(msg); continue; - case "Runtime.getProperties": debugger.getProperties(msg); continue; - case "Runtime.callFunctionOn": debugger.callFunctionOn(msg); continue; - // case "NodeWorker.enable": debugger.nodeWorkerEnable(msg); continue; - case "Runtime.enable": debugger.runtimeEnable(msg); continue; - } - - if ( - msg.name.startsWith("DOM.") || - msg.name.startsWith("DOMDebugger.") || - msg.name.startsWith("Emulation.") || - msg.name.startsWith("Input.") || - msg.name.startsWith("Network.") || - msg.name.startsWith("Page.") - ) ws.send(new V8Error("This isn't a browser...")); - else ws.send(new V8Error("This API is not supported yet.")); - } - catch (Throwable e) { - e.printStackTrace(); - throw new UncheckedException(e); - } - } - - debugger.disconnect(); - } - private void onWsConnect(HttpRequest req, Socket socket, DebuggerProvider debuggerProvider) { - var key = req.headers.get("sec-websocket-key"); - - if (key == null) { - req.writeResponse( - 426, "Upgrade Required", "text/txt", - "Expected a WS upgrade".getBytes() - ); - return; - } - - var resKey = Base64.getEncoder().encodeToString(getDigestInstance().digest( - (key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11").getBytes() - )); - - req.writeCode(101, "Switching Protocols"); - req.writeHeader("Connection", "Upgrade"); - req.writeHeader("Sec-WebSocket-Accept", resKey); - req.writeLastHeader("Upgrade", "WebSocket"); - - var ws = new WebSocket(socket); - var debugger = debuggerProvider.getDebugger(ws, req); - - if (debugger == null) { - ws.close(); - return; - } - - runAsync(() -> { - try { handle(ws, debugger); } - catch (RuntimeException e) { - ws.send(new V8Error(e.getMessage())); - } - finally { ws.close(); debugger.disconnect(); } - }, "Debug Handler"); - } - - public void awaitConnection() { - connNotifier.await(); - } - - public void run(InetSocketAddress address) { - try { - ServerSocket server = new ServerSocket(); - server.bind(address); - - try { - while (true) { - var socket = server.accept(); - var req = HttpRequest.read(socket); - - if (req == null) continue; - - switch (req.path) { - case "/json/version": - send(req, "{\"Browser\":\"" + browserDisplayName + "\",\"Protocol-Version\":\"1.1\"}"); - break; - case "/json/list": - case "/json": { - var res = new JSONList(); - - for (var el : targets.entrySet()) { - res.add(new JSONMap() - .set("description", "JScript debugger") - .set("favicon", "/favicon.ico") - .set("id", el.getKey()) - .set("type", "node") - .set("webSocketDebuggerUrl", "ws://" + address.getHostString() + ":" + address.getPort() + "/" + el.getKey()) - ); - } - send(req, JSON.stringify(res)); - break; - } - case "/json/protocol": - req.writeResponse(200, "OK", "application/json", protocol); - break; - case "/json/new": - case "/json/activate": - case "/json/close": - case "/devtools/inspector.html": - req.writeResponse( - 501, "Not Implemented", "text/txt", - "This feature isn't (and probably won't be) implemented.".getBytes() - ); - break; - case "/": - case "/index.html": - req.writeResponse(200, "OK", "text/html", index); - break; - case "/favicon.ico": - req.writeResponse(200, "OK", "image/png", favicon); - break; - default: - if (req.path.length() > 1 && targets.containsKey(req.path.substring(1))) { - onWsConnect(req, socket, targets.get(req.path.substring(1))); - } - break; - } - } - } - finally { server.close(); } - } - catch (IOException e) { throw new UncheckedIOException(e); } - } - - public Thread start(InetSocketAddress address, boolean daemon) { - var res = new Thread(() -> run(address), "Debug Server"); - res.setDaemon(daemon); - res.start(); - return res; - } - - public DebugServer() { - try { - this.favicon = Reading.resourceToStream("debugger/favicon.png").readAllBytes(); - this.protocol = Reading.resourceToStream("debugger/protocol.json").readAllBytes(); - this.index = Reading.resourceToString("debugger/index.html") - .replace("${NAME}", Metadata.name()) - .replace("${VERSION}", Metadata.version()) - .replace("${AUTHOR}", Metadata.author()) - .getBytes(); - } - catch (IOException e) { throw new UncheckedIOException(e); } - } -} +package me.topchetoeu.jscript.engine.debug; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.security.MessageDigest; +import java.util.Base64; +import java.util.HashMap; + +import me.topchetoeu.jscript.Metadata; +import me.topchetoeu.jscript.Reading; +import me.topchetoeu.jscript.engine.debug.WebSocketMessage.Type; +import me.topchetoeu.jscript.events.Notifier; +import me.topchetoeu.jscript.exceptions.SyntaxException; +import me.topchetoeu.jscript.exceptions.UncheckedException; +import me.topchetoeu.jscript.exceptions.UncheckedIOException; +import me.topchetoeu.jscript.json.JSON; +import me.topchetoeu.jscript.json.JSONList; +import me.topchetoeu.jscript.json.JSONMap; + +public class DebugServer { + public static String browserDisplayName = Metadata.name() + "/" + Metadata.version(); + + public final HashMap targets = new HashMap<>(); + + private final byte[] favicon, index, protocol; + private final Notifier connNotifier = new Notifier(); + + private static void send(HttpRequest req, String val) throws IOException { + req.writeResponse(200, "OK", "application/json", val.getBytes()); + } + + // SILENCE JAVA + private MessageDigest getDigestInstance() { + try { + return MessageDigest.getInstance("sha1"); + } + catch (Throwable e) { throw new UncheckedException(e); } + + } + + private static Thread runAsync(Runnable func, String name) { + var res = new Thread(func); + res.setName(name); + res.start(); + return res; + } + + private void handle(WebSocket ws, Debugger debugger) { + WebSocketMessage raw; + + debugger.connect(); + + while ((raw = ws.receive()) != null) { + if (raw.type != Type.Text) { + ws.send(new V8Error("Expected a text message.")); + continue; + } + + V8Message msg; + + try { + msg = new V8Message(raw.textData()); + } + catch (SyntaxException e) { + ws.send(new V8Error(e.getMessage())); + return; + } + + try { + switch (msg.name) { + case "Debugger.enable": + connNotifier.next(); + debugger.enable(msg); continue; + case "Debugger.disable": debugger.disable(msg); continue; + + case "Debugger.setBreakpointByUrl": debugger.setBreakpointByUrl(msg); continue; + case "Debugger.removeBreakpoint": debugger.removeBreakpoint(msg); continue; + case "Debugger.continueToLocation": debugger.continueToLocation(msg); continue; + + case "Debugger.getScriptSource": debugger.getScriptSource(msg); continue; + case "Debugger.getPossibleBreakpoints": debugger.getPossibleBreakpoints(msg); continue; + + case "Debugger.resume": debugger.resume(msg); continue; + case "Debugger.pause": debugger.pause(msg); continue; + + case "Debugger.stepInto": debugger.stepInto(msg); continue; + case "Debugger.stepOut": debugger.stepOut(msg); continue; + case "Debugger.stepOver": debugger.stepOver(msg); continue; + + case "Debugger.setPauseOnExceptions": debugger.setPauseOnExceptions(msg); continue; + case "Debugger.evaluateOnCallFrame": debugger.evaluateOnCallFrame(msg); continue; + + case "Runtime.releaseObjectGroup": debugger.releaseObjectGroup(msg); continue; + case "Runtime.releaseObject": debugger.releaseObject(msg); continue; + case "Runtime.getProperties": debugger.getProperties(msg); continue; + case "Runtime.callFunctionOn": debugger.callFunctionOn(msg); continue; + // case "NodeWorker.enable": debugger.nodeWorkerEnable(msg); continue; + case "Runtime.enable": debugger.runtimeEnable(msg); continue; + } + + if ( + msg.name.startsWith("DOM.") || + msg.name.startsWith("DOMDebugger.") || + msg.name.startsWith("Emulation.") || + msg.name.startsWith("Input.") || + msg.name.startsWith("Network.") || + msg.name.startsWith("Page.") + ) ws.send(new V8Error("This isn't a browser...")); + else ws.send(new V8Error("This API is not supported yet.")); + } + catch (Throwable e) { + e.printStackTrace(); + throw new UncheckedException(e); + } + } + + debugger.disconnect(); + } + private void onWsConnect(HttpRequest req, Socket socket, DebuggerProvider debuggerProvider) { + var key = req.headers.get("sec-websocket-key"); + + if (key == null) { + req.writeResponse( + 426, "Upgrade Required", "text/txt", + "Expected a WS upgrade".getBytes() + ); + return; + } + + var resKey = Base64.getEncoder().encodeToString(getDigestInstance().digest( + (key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11").getBytes() + )); + + req.writeCode(101, "Switching Protocols"); + req.writeHeader("Connection", "Upgrade"); + req.writeHeader("Sec-WebSocket-Accept", resKey); + req.writeLastHeader("Upgrade", "WebSocket"); + + var ws = new WebSocket(socket); + var debugger = debuggerProvider.getDebugger(ws, req); + + if (debugger == null) { + ws.close(); + return; + } + + runAsync(() -> { + try { handle(ws, debugger); } + catch (RuntimeException e) { + ws.send(new V8Error(e.getMessage())); + } + finally { ws.close(); debugger.disconnect(); } + }, "Debug Handler"); + } + + public void awaitConnection() { + connNotifier.await(); + } + + public void run(InetSocketAddress address) { + try { + ServerSocket server = new ServerSocket(); + server.bind(address); + + try { + while (true) { + var socket = server.accept(); + var req = HttpRequest.read(socket); + + if (req == null) continue; + + switch (req.path) { + case "/json/version": + send(req, "{\"Browser\":\"" + browserDisplayName + "\",\"Protocol-Version\":\"1.1\"}"); + break; + case "/json/list": + case "/json": { + var res = new JSONList(); + + for (var el : targets.entrySet()) { + res.add(new JSONMap() + .set("description", "JScript debugger") + .set("favicon", "/favicon.ico") + .set("id", el.getKey()) + .set("type", "node") + .set("webSocketDebuggerUrl", "ws://" + address.getHostString() + ":" + address.getPort() + "/" + el.getKey()) + ); + } + send(req, JSON.stringify(res)); + break; + } + case "/json/protocol": + req.writeResponse(200, "OK", "application/json", protocol); + break; + case "/json/new": + case "/json/activate": + case "/json/close": + case "/devtools/inspector.html": + req.writeResponse( + 501, "Not Implemented", "text/txt", + "This feature isn't (and probably won't be) implemented.".getBytes() + ); + break; + case "/": + case "/index.html": + req.writeResponse(200, "OK", "text/html", index); + break; + case "/favicon.ico": + req.writeResponse(200, "OK", "image/png", favicon); + break; + default: + if (req.path.length() > 1 && targets.containsKey(req.path.substring(1))) { + onWsConnect(req, socket, targets.get(req.path.substring(1))); + } + break; + } + } + } + finally { server.close(); } + } + catch (IOException e) { throw new UncheckedIOException(e); } + } + + public Thread start(InetSocketAddress address, boolean daemon) { + var res = new Thread(() -> run(address), "Debug Server"); + res.setDaemon(daemon); + res.start(); + return res; + } + + public DebugServer() { + try { + this.favicon = Reading.resourceToStream("debugger/favicon.png").readAllBytes(); + this.protocol = Reading.resourceToStream("debugger/protocol.json").readAllBytes(); + this.index = Reading.resourceToString("debugger/index.html") + .replace("${NAME}", Metadata.name()) + .replace("${VERSION}", Metadata.version()) + .replace("${AUTHOR}", Metadata.author()) + .getBytes(); + } + catch (IOException e) { throw new UncheckedIOException(e); } + } +} diff --git a/src/me/topchetoeu/jscript/engine/debug/SimpleDebugger.java b/src/me/topchetoeu/jscript/engine/debug/SimpleDebugger.java index 5143ad7..136096f 100644 --- a/src/me/topchetoeu/jscript/engine/debug/SimpleDebugger.java +++ b/src/me/topchetoeu/jscript/engine/debug/SimpleDebugger.java @@ -1,970 +1,970 @@ -package me.topchetoeu.jscript.engine.debug; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -import me.topchetoeu.jscript.Filename; -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.compilation.Instruction.Type; -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.Engine; -import me.topchetoeu.jscript.engine.frame.CodeFrame; -import me.topchetoeu.jscript.engine.frame.Runners; -import me.topchetoeu.jscript.engine.scope.GlobalScope; -import me.topchetoeu.jscript.engine.values.ArrayValue; -import me.topchetoeu.jscript.engine.values.CodeFunction; -import me.topchetoeu.jscript.engine.values.FunctionValue; -import me.topchetoeu.jscript.engine.values.ObjectValue; -import me.topchetoeu.jscript.engine.values.Symbol; -import me.topchetoeu.jscript.engine.values.Values; -import me.topchetoeu.jscript.events.Notifier; -import me.topchetoeu.jscript.exceptions.EngineException; -import me.topchetoeu.jscript.json.JSON; -import me.topchetoeu.jscript.json.JSONElement; -import me.topchetoeu.jscript.json.JSONList; -import me.topchetoeu.jscript.json.JSONMap; -import me.topchetoeu.jscript.mapping.SourceMap; -import me.topchetoeu.jscript.parsing.Parsing; - -// very simple indeed -public class SimpleDebugger implements Debugger { - public static final Set VSCODE_EMPTY = Set.of( - "function(...runtimeArgs){\n let t = 1024; let e = null;\n if(e)try{let r=\"<>\",i=e.call(this,r);if(i!==r)return String(i)}catch(r){return`<>${JSON.stringify([String(r),\"object\"])}`}if(typeof this==\"object\"&&this){let r;for(let i of[Symbol.for(\"debug.description\"),Symbol.for(\"nodejs.util.inspect.custom\")])try{r=this[i]();break}catch{}if(!r&&!String(this.toString).includes(\"[native code]\")&&(r=String(this)),r&&!r.startsWith(\"[object \"))return r.length>=t?r.slice(0,t)+\"\\u2026\":r}\n ;\n\n}", - "function(...runtimeArgs){\n let t = 1024; let e = null;\n let r={},i=\"<>\";if(typeof this!=\"object\"||!this)return r;for(let[n,s]of Object.entries(this)){if(e)try{let o=e.call(s,i);if(o!==i){r[n]=String(o);continue}}catch(o){r[n]=`<>${JSON.stringify([String(o),n])}`;continue}if(typeof s==\"object\"&&s){let o;for(let a of runtimeArgs[0])try{o=s[a]();break}catch{}!o&&!String(s.toString).includes(\"[native code]\")&&(o=String(s)),o&&!o.startsWith(\"[object \")&&(r[n]=o.length>=t?o.slice(0,t)+\"\\u2026\":o)}}return r\n ;\n\n}", - "function(){let t={__proto__:this.__proto__\n},e=Object.getOwnPropertyNames(this);for(let r=0;r>>0;if(String(n>>>0)===i&&n>>>0!==4294967295)continue;let s=Object.getOwnPropertyDescriptor(this,i);s&&Object.defineProperty(t,i,s)}return t}", - "function(){return[Symbol.for(\"debug.description\"),Symbol.for(\"nodejs.util.inspect.custom\")]\n}" - ); - public static final Set VSCODE_SELF = Set.of( - "function(t,e){let r={\n},i=t===-1?0:t,n=e===-1?this.length:t+e;for(let s=i;s{if(p!==\"function\")return n;if(l===\"constructor\")return\"class\";let m=String(f);return m.startsWith(\"class \")||m.includes(\"[native code]\")&&/^[A-Z]/.test(l)?\"class\":r?\"function\":\"method\"\n},o=l=>{switch(typeof l){case\"number\":case\"boolean\":return`${l}`;case\"object\":return l===null?\"null\":l.constructor.name||\"object\";case\"function\":return`fn(${new Array(l.length).fill(\"?\").join(\", \")})`;default:return typeof l}},s=[],a=new Set,u=\"~\",c=t===void 0?this:t;for(;c!=null;c=c.__proto__){u+=\"~\";let l=Object.getOwnPropertyNames(c).filter(p=>p.startsWith(e)&&!p.match(/^\\d+$/));for(let p of l){if(a.has(p))continue;a.add(p);let f=Object.getOwnPropertyDescriptor(c,p),m=n,h;try{let H=c[p];m=i(p,typeof f?.value,H),h=o(H)}catch{}s.push({label:p,sortText:u+p.replace(/^_+/,H=>\"{\".repeat(H.length)),type:m,detail:h})}r=!1}return{result:s,isArray:this instanceof Array}}"; - - private static enum State { - RESUMED, - STEPPING_IN, - STEPPING_OUT, - STEPPING_OVER, - PAUSED_NORMAL, - PAUSED_EXCEPTION, - } - private static enum CatchType { - NONE, - UNCAUGHT, - ALL, - } - private static class Source { - public final int id; - public final Filename filename; - public final String source; - public final TreeSet breakpoints; - - public Source(int id, Filename filename, String source, TreeSet breakpoints) { - this.id = id; - this.filename = filename; - this.source = source; - this.breakpoints = breakpoints; - } - } - private static class Breakpoint { - public final int id; - public final Location location; - public final String condition; - - public Breakpoint(int id, Location location, String condition) { - this.id = id; - this.location = location; - this.condition = condition; - } - } - private static class BreakpointCandidate { - public final int id; - public final String condition; - public final Pattern pattern; - public final int line, start; - public final HashSet resolvedBreakpoints = new HashSet<>(); - - public BreakpointCandidate(int id, Pattern pattern, int line, int start, String condition) { - this.id = id; - this.pattern = pattern; - this.line = line; - this.start = start; - if (condition != null && condition.trim().equals("")) condition = null; - this.condition = condition; - } - } - private class Frame { - public CodeFrame frame; - public CodeFunction func; - public int id; - public ObjectValue local, capture, global, valstack; - public JSONMap serialized; - public Location location; - public boolean debugData = false; - - public void updateLoc(Location loc) { - if (loc == null) return; - this.location = loc; - } - - public Frame(Context ctx, CodeFrame frame, int id) { - this.frame = frame; - this.func = frame.function; - this.id = id; - - this.global = frame.function.environment.global.obj; - this.local = frame.getLocalScope(ctx, true); - this.capture = frame.getCaptureScope(ctx, true); - this.local.setPrototype(ctx, capture); - this.capture.setPrototype(ctx, global); - this.valstack = frame.getValStackScope(ctx); - debugData = true; - - this.serialized = new JSONMap() - .set("callFrameId", id + "") - .set("functionName", func.name) - .set("scopeChain", new JSONList() - .add(new JSONMap().set("type", "local").set("name", "Local Scope").set("object", serializeObj(ctx, local))) - .add(new JSONMap().set("type", "closure").set("name", "Closure").set("object", serializeObj(ctx, capture))) - .add(new JSONMap().set("type", "global").set("name", "Global Scope").set("object", serializeObj(ctx, global))) - .add(new JSONMap().set("type", "other").set("name", "Value Stack").set("object", serializeObj(ctx, valstack))) - ); - } - } - private class ObjRef { - public final ObjectValue obj; - public final Context ctx; - public final HashSet heldGroups = new HashSet<>(); - public boolean held = true; - - public boolean shouldRelease() { - return !held && heldGroups.size() == 0; - } - - public ObjRef(Context ctx, ObjectValue obj) { - this.ctx = ctx; - this.obj = obj; - } - } - - private static class RunResult { - public final Context ctx; - public final Object result; - public final EngineException error; - - public RunResult(Context ctx, Object result, EngineException error) { - this.ctx = ctx; - this.result = result; - this.error = error; - } - } - - public boolean enabled = true; - public CatchType execptionType = CatchType.NONE; - public State state = State.RESUMED; - - public final WebSocket ws; - public final Engine target; - - private ObjectValue emptyObject = new ObjectValue(); - - private HashMap idToBptCand = new HashMap<>(); - - private HashMap idToBreakpoint = new HashMap<>(); - private HashMap locToBreakpoint = new HashMap<>(); - private HashSet tmpBreakpts = new HashSet<>(); - - private HashMap filenameToId = new HashMap<>(); - private HashMap idToSource = new HashMap<>(); - private ArrayList pendingSources = new ArrayList<>(); - - private HashMap idToFrame = new HashMap<>(); - private HashMap codeFrameToFrame = new HashMap<>(); - - private HashMap idToObject = new HashMap<>(); - private HashMap objectToId = new HashMap<>(); - private HashMap> objectGroups = new HashMap<>(); - - private Notifier updateNotifier = new Notifier(); - private boolean pendingPause = false; - - private int nextId = 0; - private Frame stepOutFrame = null, currFrame = null; - private int stepOutPtr = 0; - - private boolean compare(String src, String target) { - if (src.length() != target.length()) return false; - var diff = 0; - var all = 0; - - for (var i = 0; i < src.length(); i++) { - var a = src.charAt(i); - var b = target.charAt(i); - var letter = Parsing.isLetter(a) && Parsing.isLetter(b); - - if (a != b) { - if (letter) diff++; - else return false; - } - - if (letter) all++; - } - - return diff / (float)all < .5f; - } - private boolean compare(String src, Set target) { - for (var el : target) { - if (compare(src, el)) return true; - } - return false; - } - - private int nextId() { - return nextId++; - } - - private synchronized void updateFrames(Context ctx) { - var frame = ctx.peekFrame(); - if (frame == null) return; - - if (!codeFrameToFrame.containsKey(frame)) { - var id = nextId(); - var fr = new Frame(ctx, frame, id); - - idToFrame.put(id, fr); - codeFrameToFrame.put(frame, fr); - } - - currFrame = codeFrameToFrame.get(frame); - } - private JSONList serializeFrames(Context ctx) { - var res = new JSONList(); - var frames = ctx.frames(); - - for (var i = frames.size() - 1; i >= 0; i--) { - var frame = codeFrameToFrame.get(frames.get(i)); - if (frame.location == null) continue; - frame.serialized.set("location", serializeLocation(frame.location)); - if (frame.location != null) res.add(frame.serialized); - } - - return res; - } - - private Location correctLocation(Source source, Location loc) { - var set = source.breakpoints; - - if (set.contains(loc)) return loc; - - var tail = set.tailSet(loc); - if (tail.isEmpty()) return null; - - return tail.first(); - } - private Location deserializeLocation(JSONElement el, boolean correct) { - if (!el.isMap()) throw new RuntimeException("Expected location to be a map."); - var id = Integer.parseInt(el.map().string("scriptId")); - var line = (int)el.map().number("lineNumber") + 1; - var column = (int)el.map().number("columnNumber") + 1; - - if (!idToSource.containsKey(id)) throw new RuntimeException(String.format("The specified source %s doesn't exist.", id)); - - var res = new Location(line, column, idToSource.get(id).filename); - if (correct) res = correctLocation(idToSource.get(id), res); - return res; - } - private JSONMap serializeLocation(Location loc) { - var source = filenameToId.get(loc.filename()); - return new JSONMap() - .set("scriptId", source + "") - .set("lineNumber", loc.line() - 1) - .set("columnNumber", loc.start() - 1); - } - - private Integer objectId(Context ctx, ObjectValue obj) { - if (objectToId.containsKey(obj)) return objectToId.get(obj); - else { - int id = nextId(); - var ref = new ObjRef(ctx, obj); - objectToId.put(obj, id); - idToObject.put(id, ref); - return id; - } - } - private JSONMap serializeObj(Context ctx, Object val, boolean byValue) { - val = Values.normalize(null, val); - - if (val == Values.NULL) { - return new JSONMap() - .set("type", "object") - .set("subtype", "null") - .setNull("value") - .set("description", "null"); - } - - if (val instanceof ObjectValue) { - var obj = (ObjectValue)val; - var id = objectId(ctx, obj); - var type = "object"; - String subtype = null; - String className = null; - - if (obj instanceof FunctionValue) type = "function"; - if (obj instanceof ArrayValue) subtype = "array"; - - try { className = Values.toString(ctx, Values.getMemberPath(ctx, obj, "constructor", "name")); } - catch (Exception e) { } - - var res = new JSONMap() - .set("type", type) - .set("objectId", id + ""); - - if (subtype != null) res.set("subtype", subtype); - if (className != null) { - res.set("className", className); - } - - if (obj instanceof ArrayValue) res.set("description", "Array(" + ((ArrayValue)obj).size() + ")"); - else if (obj instanceof FunctionValue) res.set("description", obj.toString()); - else { - var defaultToString = false; - - try { - defaultToString = - Values.getMember(ctx, obj, "toString") == - Values.getMember(ctx, ctx.environment().proto("object"), "toString"); - } - catch (Exception e) { } - - try { res.set("description", className + (defaultToString ? "" : " { " + Values.toString(ctx, obj) + " }")); } - catch (EngineException e) { res.set("description", className); } - } - - - if (byValue) try { res.put("value", JSON.fromJs(ctx, obj)); } - catch (Exception e) { } - - return res; - } - - if (val == null) return new JSONMap().set("type", "undefined"); - if (val instanceof String) return new JSONMap().set("type", "string").set("value", (String)val); - if (val instanceof Boolean) return new JSONMap().set("type", "boolean").set("value", (Boolean)val); - if (val instanceof Symbol) return new JSONMap().set("type", "symbol").set("description", val.toString()); - if (val instanceof Number) { - var num = (double)(Number)val; - var res = new JSONMap().set("type", "number"); - - if (Double.POSITIVE_INFINITY == num) res.set("unserializableValue", "Infinity"); - else if (Double.NEGATIVE_INFINITY == num) res.set("unserializableValue", "-Infinity"); - else if (Double.doubleToRawLongBits(num) == Double.doubleToRawLongBits(-0d)) res.set("unserializableValue", "-0"); - else if (Double.doubleToRawLongBits(num) == Double.doubleToRawLongBits(0d)) res.set("unserializableValue", "0"); - else if (Double.isNaN(num)) res.set("unserializableValue", "NaN"); - else res.set("value", num); - - return res; - } - - throw new IllegalArgumentException("Unexpected JS object."); - } - private JSONMap serializeObj(Context ctx, Object val) { - return serializeObj(ctx, val, false); - } - private void addObjectGroup(String name, Object val) { - if (val instanceof ObjectValue) { - var obj = (ObjectValue)val; - var id = objectToId.getOrDefault(obj, -1); - if (id < 0) return; - - var ref = idToObject.get(id); - - if (objectGroups.containsKey(name)) objectGroups.get(name).add(ref); - else objectGroups.put(name, new ArrayList<>(List.of(ref))); - - ref.heldGroups.add(name); - } - } - private void releaseGroup(String name) { - var objs = objectGroups.remove(name); - - if (objs != null) for (var obj : objs) { - if (obj.heldGroups.remove(name) && obj.shouldRelease()) { - var id = objectToId.remove(obj.obj); - if (id != null) idToObject.remove(id); - } - } - } - private Object deserializeArgument(JSONMap val) { - if (val.isString("objectId")) return idToObject.get(Integer.parseInt(val.string("objectId"))).obj; - else if (val.isString("unserializableValue")) switch (val.string("unserializableValue")) { - case "NaN": return Double.NaN; - case "-Infinity": return Double.NEGATIVE_INFINITY; - case "Infinity": return Double.POSITIVE_INFINITY; - case "-0": return -0.; - } - var res = val.get("value"); - if (res == null) return null; - else return JSON.toJs(res); - } - - private JSONMap serializeException(Context ctx, EngineException err) { - String text = null; - - try { - text = Values.toString(ctx, err.value); - } - catch (EngineException e) { - text = "[error while stringifying]"; - } - - var res = new JSONMap() - .set("exceptionId", nextId()) - .set("exception", serializeObj(ctx, err.value)) - .set("text", text); - - return res; - } - - private void resume(State state) { - this.state = state; - ws.send(new V8Event("Debugger.resumed", new JSONMap())); - updateNotifier.next(); - } - private void pauseDebug(Context ctx, Breakpoint bp) { - state = State.PAUSED_NORMAL; - var map = new JSONMap() - .set("callFrames", serializeFrames(ctx)) - .set("reason", "debugCommand"); - - if (bp != null) map.set("hitBreakpoints", new JSONList().add(bp.id + "")); - ws.send(new V8Event("Debugger.paused", map)); - } - private void pauseException(Context ctx) { - state = State.PAUSED_EXCEPTION; - var map = new JSONMap() - .set("callFrames", serializeFrames(ctx)) - .set("reason", "exception"); - - ws.send(new V8Event("Debugger.paused", map)); - } - - private void sendSource(Source src) { - ws.send(new V8Event("Debugger.scriptParsed", new JSONMap() - .set("scriptId", src.id + "") - .set("hash", src.source.hashCode()) - .set("url", src.filename + "") - )); - } - - private void addBreakpoint(Breakpoint bpt) { - idToBreakpoint.put(bpt.id, bpt); - locToBreakpoint.put(bpt.location, bpt); - - ws.send(new V8Event("Debugger.breakpointResolved", new JSONMap() - .set("breakpointId", bpt.id) - .set("location", serializeLocation(bpt.location)) - )); - } - - private RunResult run(Frame codeFrame, String code) { - if (codeFrame == null) return new RunResult(null, code, new EngineException("Invalid code frame!")); - var engine = new Engine(false); - var env = codeFrame.func.environment.fork(); - - env.global = new GlobalScope(codeFrame.local); - - var ctx = new Context(engine).pushEnv(env); - var awaiter = engine.pushMsg(false, ctx, new Filename("jscript", "eval"), code, codeFrame.frame.thisArg, codeFrame.frame.args); - - engine.run(true); - - try { return new RunResult(ctx, awaiter.await(), null); } - catch (EngineException e) { return new RunResult(ctx, null, e); } - } - - private ObjectValue vscodeAutoSuggest(Context ctx, Object target, String query, boolean variable) { - var res = new ArrayValue(); - var passed = new HashSet(); - var tildas = "~"; - if (target == null) target = ctx.environment().getGlobal(); - - for (var proto = target; proto != null && proto != Values.NULL; proto = Values.getPrototype(ctx, proto)) { - for (var el : Values.getMembers(ctx, proto, true, true)) { - var strKey = Values.toString(ctx, el); - if (passed.contains(strKey)) continue; - passed.add(strKey); - - var val = Values.getMember(ctx, Values.getMemberDescriptor(ctx, proto, el), "value"); - var desc = new ObjectValue(); - var sortText = ""; - if (strKey.startsWith(query)) sortText += "0@"; - else if (strKey.toLowerCase().startsWith(query.toLowerCase())) sortText += "1@"; - else if (strKey.contains(query)) sortText += "2@"; - else if (strKey.toLowerCase().contains(query.toLowerCase())) sortText += "3@"; - else sortText += "4@"; - sortText += tildas + strKey; - - desc.defineProperty(ctx, "label", strKey); - desc.defineProperty(ctx, "sortText", sortText); - - if (val instanceof FunctionValue) { - if (strKey.equals("constructor")) desc.defineProperty(ctx, "type", "name"); - else desc.defineProperty(ctx, "type", variable ? "function" : "method"); - } - else desc.defineProperty(ctx, "type", variable ? "variable" : "property"); - - switch (Values.type(val)) { - case "number": - case "boolean": - desc.defineProperty(ctx, "detail", Values.toString(ctx, val)); - break; - case "object": - if (val == Values.NULL) desc.defineProperty(ctx, "detail", "null"); - else try { - desc.defineProperty(ctx, "detail", Values.getMemberPath(ctx, target, "constructor", "name")); - } - catch (IllegalArgumentException e) { - desc.defineProperty(ctx, "detail", "object"); - } - break; - case "function": { - var type = "fn("; - for (var i = 0; i < ((FunctionValue)val).length; i++) { - if (i != 0) type += ","; - type += "?"; - } - type += ")"; - desc.defineProperty(ctx, "detail", type); - break; - } - default: - desc.defineProperty(ctx, "type", Values.type(val)); - break; - } - - res.set(ctx, res.size(), desc); - } - - tildas += "~"; - variable = true; - } - - var resObj = new ObjectValue(); - resObj.defineProperty(ctx, "result", res); - resObj.defineProperty(ctx, "isArray", target instanceof ArrayValue); - return resObj; - } - - @Override public synchronized void enable(V8Message msg) { - enabled = true; - ws.send(msg.respond()); - - for (var el : pendingSources) sendSource(el); - pendingSources.clear(); - - updateNotifier.next(); - } - @Override public synchronized void disable(V8Message msg) { - enabled = false; - ws.send(msg.respond()); - updateNotifier.next(); - } - - @Override public synchronized void getScriptSource(V8Message msg) { - int id = Integer.parseInt(msg.params.string("scriptId")); - ws.send(msg.respond(new JSONMap().set("scriptSource", idToSource.get(id).source))); - } - @Override public synchronized void getPossibleBreakpoints(V8Message msg) { - var src = idToSource.get(Integer.parseInt(msg.params.map("start").string("scriptId"))); - var start = deserializeLocation(msg.params.get("start"), false); - var end = msg.params.isMap("end") ? deserializeLocation(msg.params.get("end"), false) : null; - - var res = new JSONList(); - - for (var loc : src.breakpoints.tailSet(start, true)) { - if (end != null && loc.compareTo(end) > 0) break; - res.add(serializeLocation(loc)); - } - - ws.send(msg.respond(new JSONMap().set("locations", res))); - } - - @Override public synchronized void pause(V8Message msg) { - pendingPause = true; - ws.send(msg.respond()); - } - @Override public synchronized void resume(V8Message msg) { - resume(State.RESUMED); - ws.send(msg.respond(new JSONMap())); - } - - @Override public synchronized void setBreakpointByUrl(V8Message msg) { - var line = (int)msg.params.number("lineNumber") + 1; - var col = (int)msg.params.number("columnNumber", 0) + 1; - var cond = msg.params.string("condition", "").trim(); - - if (cond.equals("")) cond = null; - if (cond != null) cond = "(" + cond + ")"; - - Pattern regex; - - if (msg.params.isString("url")) regex = Pattern.compile(Pattern.quote(msg.params.string("url"))); - else regex = Pattern.compile(msg.params.string("urlRegex")); - - var bpcd = new BreakpointCandidate(nextId(), regex, line, col, cond); - idToBptCand.put(bpcd.id, bpcd); - - var locs = new JSONList(); - - for (var src : idToSource.values()) { - if (regex.matcher(src.filename.toString()).matches()) { - var loc = correctLocation(src, new Location(line, col, src.filename)); - if (loc == null) continue; - var bp = new Breakpoint(nextId(), loc, bpcd.condition); - - bpcd.resolvedBreakpoints.add(bp); - locs.add(serializeLocation(loc)); - addBreakpoint(bp); - } - } - - ws.send(msg.respond(new JSONMap() - .set("breakpointId", bpcd.id + "") - .set("locations", locs) - )); - } - @Override public synchronized void removeBreakpoint(V8Message msg) { - var id = Integer.parseInt(msg.params.string("breakpointId")); - - if (idToBptCand.containsKey(id)) { - var bpcd = idToBptCand.get(id); - for (var bp : bpcd.resolvedBreakpoints) { - idToBreakpoint.remove(bp.id); - locToBreakpoint.remove(bp.location); - } - idToBptCand.remove(id); - } - else if (idToBreakpoint.containsKey(id)) { - var bp = idToBreakpoint.remove(id); - locToBreakpoint.remove(bp.location); - } - ws.send(msg.respond()); - } - @Override public synchronized void continueToLocation(V8Message msg) { - var loc = deserializeLocation(msg.params.get("location"), true); - - tmpBreakpts.add(loc); - - resume(State.RESUMED); - ws.send(msg.respond()); - } - - @Override public synchronized void setPauseOnExceptions(V8Message msg) { - switch (msg.params.string("state")) { - case "none": execptionType = CatchType.NONE; break; - case "all": execptionType = CatchType.ALL; break; - case "uncaught": execptionType = CatchType.UNCAUGHT; break; - default: - ws.send(new V8Error("Invalid exception pause type.")); - return; - } - - ws.send(msg.respond()); - } - - @Override public synchronized void stepInto(V8Message msg) { - if (state == State.RESUMED) ws.send(new V8Error("Debugger is resumed.")); - else { - stepOutFrame = currFrame; - stepOutPtr = currFrame.frame.codePtr; - resume(State.STEPPING_IN); - ws.send(msg.respond()); - } - } - @Override public synchronized void stepOut(V8Message msg) { - if (state == State.RESUMED) ws.send(new V8Error("Debugger is resumed.")); - else { - stepOutFrame = currFrame; - stepOutPtr = currFrame.frame.codePtr; - resume(State.STEPPING_OUT); - ws.send(msg.respond()); - } - } - @Override public synchronized void stepOver(V8Message msg) { - if (state == State.RESUMED) ws.send(new V8Error("Debugger is resumed.")); - else { - stepOutFrame = currFrame; - stepOutPtr = currFrame.frame.codePtr; - resume(State.STEPPING_OVER); - ws.send(msg.respond()); - } - } - - @Override public synchronized void evaluateOnCallFrame(V8Message msg) { - var cfId = Integer.parseInt(msg.params.string("callFrameId")); - var expr = msg.params.string("expression"); - var group = msg.params.string("objectGroup", null); - - var cf = idToFrame.get(cfId); - var res = run(cf, expr); - - if (group != null) addObjectGroup(group, res.result); - - if (res.error != null) ws.send(msg.respond(new JSONMap().set("exceptionDetails", serializeException(res.ctx, res.error)))); - else ws.send(msg.respond(new JSONMap().set("result", serializeObj(res.ctx, res.result)))); - } - - @Override public synchronized void releaseObjectGroup(V8Message msg) { - var group = msg.params.string("objectGroup"); - releaseGroup(group); - ws.send(msg.respond()); - } - @Override public synchronized void releaseObject(V8Message msg) { - var id = Integer.parseInt(msg.params.string("objectId")); - var ref = idToObject.get(id); - ref.held = false; - - if (ref.shouldRelease()) { - objectToId.remove(ref.obj); - idToObject.remove(id); - } - - ws.send(msg.respond()); - } - @Override public synchronized void getProperties(V8Message msg) { - var ref = idToObject.get(Integer.parseInt(msg.params.string("objectId"))); - var obj = ref.obj; - - var res = new JSONList(); - var ctx = ref.ctx; - - if (obj != emptyObject && obj != null) { - for (var key : obj.keys(true)) { - var propDesc = new JSONMap(); - - if (obj.properties.containsKey(key)) { - var prop = obj.properties.get(key); - - propDesc.set("name", Values.toString(ctx, key)); - if (prop.getter != null) propDesc.set("get", serializeObj(ctx, prop.getter)); - if (prop.setter != null) propDesc.set("set", serializeObj(ctx, prop.setter)); - propDesc.set("enumerable", obj.memberEnumerable(key)); - propDesc.set("configurable", obj.memberConfigurable(key)); - propDesc.set("isOwn", true); - res.add(propDesc); - } - else { - propDesc.set("name", Values.toString(ctx, key)); - propDesc.set("value", serializeObj(ctx, obj.getMember(ctx, key))); - propDesc.set("writable", obj.memberWritable(key)); - propDesc.set("enumerable", obj.memberEnumerable(key)); - propDesc.set("configurable", obj.memberConfigurable(key)); - propDesc.set("isOwn", true); - res.add(propDesc); - } - } - - var proto = obj.getPrototype(ctx); - - var protoDesc = new JSONMap(); - protoDesc.set("name", "__proto__"); - protoDesc.set("value", serializeObj(ctx, proto == null ? Values.NULL : proto)); - protoDesc.set("writable", true); - protoDesc.set("enumerable", false); - protoDesc.set("configurable", false); - protoDesc.set("isOwn", true); - res.add(protoDesc); - } - - ws.send(msg.respond(new JSONMap().set("result", res))); - } - @Override public synchronized void callFunctionOn(V8Message msg) { - var src = msg.params.string("functionDeclaration"); - var args = msg.params - .list("arguments", new JSONList()) - .stream() - .map(v -> v.map()) - .map(this::deserializeArgument) - .collect(Collectors.toList()); - var byValue = msg.params.bool("returnByValue", false); - - var thisArgRef = idToObject.get(Integer.parseInt(msg.params.string("objectId"))); - var thisArg = thisArgRef.obj; - var ctx = thisArgRef.ctx; - - while (true) { - var start = src.lastIndexOf("//# sourceURL="); - if (start < 0) break; - var end = src.indexOf("\n", start); - if (end < 0) src = src.substring(0, start); - else src = src.substring(0, start) + src.substring(end + 1); - } - - try { - Object res = null; - if (compare(src, VSCODE_EMPTY)) res = emptyObject; - else if (compare(src, VSCODE_SELF)) res = thisArg; - else if (compare(src, CHROME_GET_PROP_FUNC)) { - res = thisArg; - for (var el : JSON.parse(null, (String)args.get(0)).list()) res = Values.getMember(ctx, res, JSON.toJs(el)); - } - else if (compare(src, VSCODE_CALL)) { - var func = (FunctionValue)(args.size() < 1 ? null : args.get(0)); - ws.send(msg.respond(new JSONMap().set("result", serializeObj(ctx, func.call(ctx, thisArg))))); - } - else if (compare(src, VSCODE_AUTOCOMPLETE)) { - var target = args.get(0); - if (target == null) target = thisArg; - res = vscodeAutoSuggest(ctx, target, Values.toString(ctx, args.get(1)), Values.toBoolean(args.get(2))); - } - else { - ws.send(new V8Error("Please use well-known functions with callFunctionOn")); - return; - } - ws.send(msg.respond(new JSONMap().set("result", serializeObj(ctx, res, byValue)))); - } - catch (EngineException e) { ws.send(msg.respond(new JSONMap().set("exceptionDetails", serializeException(ctx, e)))); } - } - - @Override public synchronized void runtimeEnable(V8Message msg) { - ws.send(msg.respond()); - } - - @Override public void onSource(Filename filename, String source, TreeSet locations, SourceMap map) { - int id = nextId(); - var src = new Source(id, filename, source, locations); - - idToSource.put(id, src); - filenameToId.put(filename, id); - - for (var bpcd : idToBptCand.values()) { - if (!bpcd.pattern.matcher(filename.toString()).matches()) continue; - var loc = correctLocation(src, new Location(bpcd.line, bpcd.start, filename)); - var bp = new Breakpoint(nextId(), loc, bpcd.condition); - if (loc == null) continue; - bpcd.resolvedBreakpoints.add(bp); - addBreakpoint(bp); - } - - if (!enabled) pendingSources.add(src); - else sendSource(src); - } - @Override public boolean onInstruction(Context ctx, CodeFrame cf, Instruction instruction, Object returnVal, EngineException error, boolean caught) { - if (!enabled) return false; - - boolean isBreakpointable; - Location loc; - Frame frame; - - synchronized (this) { - frame = codeFrameToFrame.get(cf); - - if (!frame.debugData) return false; - - if (instruction.location != null) frame.updateLoc(ctx.engine.mapToCompiled(instruction.location)); - loc = frame.location; - isBreakpointable = loc != null && (instruction.breakpoint.shouldStepIn()); - - if (error != null && (execptionType == CatchType.ALL || execptionType == CatchType.UNCAUGHT && !caught)) { - pauseException(ctx); - } - else if (loc != null && (state == State.STEPPING_IN || state == State.STEPPING_OVER) && returnVal != Runners.NO_RETURN && stepOutFrame == frame) { - pauseDebug(ctx, null); - } - else if (isBreakpointable && locToBreakpoint.containsKey(loc)) { - var bp = locToBreakpoint.get(loc); - var ok = bp.condition == null ? true : Values.toBoolean(run(currFrame, bp.condition).result); - if (ok) pauseDebug(ctx, locToBreakpoint.get(loc)); - } - else if (isBreakpointable && tmpBreakpts.remove(loc)) pauseDebug(ctx, null); - else if (isBreakpointable && pendingPause) { - pauseDebug(ctx, null); - pendingPause = false; - } - else if (instruction.type == Type.NOP && instruction.match("debug")) pauseDebug(ctx, null); - } - - - while (enabled) { - synchronized (this) { - switch (state) { - case PAUSED_EXCEPTION: - case PAUSED_NORMAL: break; - - case STEPPING_OUT: - case RESUMED: return false; - - case STEPPING_IN: - case STEPPING_OVER: - if (stepOutFrame.frame == frame.frame) { - if (returnVal != Runners.NO_RETURN || error != null) { - state = State.STEPPING_OUT; - continue; - } - else if (stepOutPtr != frame.frame.codePtr) { - if (state == State.STEPPING_IN && instruction.breakpoint.shouldStepIn()) { - pauseDebug(ctx, null); - break; - } - else if (state == State.STEPPING_OVER && instruction.breakpoint.shouldStepOver()) { - pauseDebug(ctx, null); - break; - } - } - } - return false; - } - } - updateNotifier.await(); - } - - return false; - } - @Override public void onFramePush(Context ctx, CodeFrame frame) { - var prevFrame = currFrame; - updateFrames(ctx); - - if (stepOutFrame != null && stepOutFrame.frame == prevFrame.frame && state == State.STEPPING_IN) { - stepOutFrame = currFrame; - } - } - @Override public void onFramePop(Context ctx, CodeFrame frame) { - updateFrames(ctx); - - try { idToFrame.remove(codeFrameToFrame.remove(frame).id); } - catch (NullPointerException e) { } - - if (ctx.frames().size() == 0) { - if (state == State.PAUSED_EXCEPTION || state == State.PAUSED_NORMAL) resume(State.RESUMED); - } - else if (stepOutFrame != null && stepOutFrame.frame == frame && state == State.STEPPING_OUT) { - state = State.STEPPING_IN; - stepOutFrame = currFrame; - } - } - - @Override public synchronized void connect() { - if (!target.attachDebugger(this)) { - ws.send(new V8Error("A debugger is already attached to this engine.")); - } - } - @Override public synchronized void disconnect() { - target.detachDebugger(); - enabled = false; - updateNotifier.next(); - } - - public SimpleDebugger(WebSocket ws, Engine target) { - this.ws = ws; - this.target = target; - } -} +package me.topchetoeu.jscript.engine.debug; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import me.topchetoeu.jscript.Filename; +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.compilation.Instruction.Type; +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.Engine; +import me.topchetoeu.jscript.engine.frame.CodeFrame; +import me.topchetoeu.jscript.engine.frame.Runners; +import me.topchetoeu.jscript.engine.scope.GlobalScope; +import me.topchetoeu.jscript.engine.values.ArrayValue; +import me.topchetoeu.jscript.engine.values.CodeFunction; +import me.topchetoeu.jscript.engine.values.FunctionValue; +import me.topchetoeu.jscript.engine.values.ObjectValue; +import me.topchetoeu.jscript.engine.values.Symbol; +import me.topchetoeu.jscript.engine.values.Values; +import me.topchetoeu.jscript.events.Notifier; +import me.topchetoeu.jscript.exceptions.EngineException; +import me.topchetoeu.jscript.json.JSON; +import me.topchetoeu.jscript.json.JSONElement; +import me.topchetoeu.jscript.json.JSONList; +import me.topchetoeu.jscript.json.JSONMap; +import me.topchetoeu.jscript.mapping.SourceMap; +import me.topchetoeu.jscript.parsing.Parsing; + +// very simple indeed +public class SimpleDebugger implements Debugger { + public static final Set VSCODE_EMPTY = Set.of( + "function(...runtimeArgs){\n let t = 1024; let e = null;\n if(e)try{let r=\"<>\",i=e.call(this,r);if(i!==r)return String(i)}catch(r){return`<>${JSON.stringify([String(r),\"object\"])}`}if(typeof this==\"object\"&&this){let r;for(let i of[Symbol.for(\"debug.description\"),Symbol.for(\"nodejs.util.inspect.custom\")])try{r=this[i]();break}catch{}if(!r&&!String(this.toString).includes(\"[native code]\")&&(r=String(this)),r&&!r.startsWith(\"[object \"))return r.length>=t?r.slice(0,t)+\"\\u2026\":r}\n ;\n\n}", + "function(...runtimeArgs){\n let t = 1024; let e = null;\n let r={},i=\"<>\";if(typeof this!=\"object\"||!this)return r;for(let[n,s]of Object.entries(this)){if(e)try{let o=e.call(s,i);if(o!==i){r[n]=String(o);continue}}catch(o){r[n]=`<>${JSON.stringify([String(o),n])}`;continue}if(typeof s==\"object\"&&s){let o;for(let a of runtimeArgs[0])try{o=s[a]();break}catch{}!o&&!String(s.toString).includes(\"[native code]\")&&(o=String(s)),o&&!o.startsWith(\"[object \")&&(r[n]=o.length>=t?o.slice(0,t)+\"\\u2026\":o)}}return r\n ;\n\n}", + "function(){let t={__proto__:this.__proto__\n},e=Object.getOwnPropertyNames(this);for(let r=0;r>>0;if(String(n>>>0)===i&&n>>>0!==4294967295)continue;let s=Object.getOwnPropertyDescriptor(this,i);s&&Object.defineProperty(t,i,s)}return t}", + "function(){return[Symbol.for(\"debug.description\"),Symbol.for(\"nodejs.util.inspect.custom\")]\n}" + ); + public static final Set VSCODE_SELF = Set.of( + "function(t,e){let r={\n},i=t===-1?0:t,n=e===-1?this.length:t+e;for(let s=i;s{if(p!==\"function\")return n;if(l===\"constructor\")return\"class\";let m=String(f);return m.startsWith(\"class \")||m.includes(\"[native code]\")&&/^[A-Z]/.test(l)?\"class\":r?\"function\":\"method\"\n},o=l=>{switch(typeof l){case\"number\":case\"boolean\":return`${l}`;case\"object\":return l===null?\"null\":l.constructor.name||\"object\";case\"function\":return`fn(${new Array(l.length).fill(\"?\").join(\", \")})`;default:return typeof l}},s=[],a=new Set,u=\"~\",c=t===void 0?this:t;for(;c!=null;c=c.__proto__){u+=\"~\";let l=Object.getOwnPropertyNames(c).filter(p=>p.startsWith(e)&&!p.match(/^\\d+$/));for(let p of l){if(a.has(p))continue;a.add(p);let f=Object.getOwnPropertyDescriptor(c,p),m=n,h;try{let H=c[p];m=i(p,typeof f?.value,H),h=o(H)}catch{}s.push({label:p,sortText:u+p.replace(/^_+/,H=>\"{\".repeat(H.length)),type:m,detail:h})}r=!1}return{result:s,isArray:this instanceof Array}}"; + + private static enum State { + RESUMED, + STEPPING_IN, + STEPPING_OUT, + STEPPING_OVER, + PAUSED_NORMAL, + PAUSED_EXCEPTION, + } + private static enum CatchType { + NONE, + UNCAUGHT, + ALL, + } + private static class Source { + public final int id; + public final Filename filename; + public final String source; + public final TreeSet breakpoints; + + public Source(int id, Filename filename, String source, TreeSet breakpoints) { + this.id = id; + this.filename = filename; + this.source = source; + this.breakpoints = breakpoints; + } + } + private static class Breakpoint { + public final int id; + public final Location location; + public final String condition; + + public Breakpoint(int id, Location location, String condition) { + this.id = id; + this.location = location; + this.condition = condition; + } + } + private static class BreakpointCandidate { + public final int id; + public final String condition; + public final Pattern pattern; + public final int line, start; + public final HashSet resolvedBreakpoints = new HashSet<>(); + + public BreakpointCandidate(int id, Pattern pattern, int line, int start, String condition) { + this.id = id; + this.pattern = pattern; + this.line = line; + this.start = start; + if (condition != null && condition.trim().equals("")) condition = null; + this.condition = condition; + } + } + private class Frame { + public CodeFrame frame; + public CodeFunction func; + public int id; + public ObjectValue local, capture, global, valstack; + public JSONMap serialized; + public Location location; + public boolean debugData = false; + + public void updateLoc(Location loc) { + if (loc == null) return; + this.location = loc; + } + + public Frame(Context ctx, CodeFrame frame, int id) { + this.frame = frame; + this.func = frame.function; + this.id = id; + + this.global = frame.function.environment.global.obj; + this.local = frame.getLocalScope(ctx, true); + this.capture = frame.getCaptureScope(ctx, true); + this.local.setPrototype(ctx, capture); + this.capture.setPrototype(ctx, global); + this.valstack = frame.getValStackScope(ctx); + debugData = true; + + this.serialized = new JSONMap() + .set("callFrameId", id + "") + .set("functionName", func.name) + .set("scopeChain", new JSONList() + .add(new JSONMap().set("type", "local").set("name", "Local Scope").set("object", serializeObj(ctx, local))) + .add(new JSONMap().set("type", "closure").set("name", "Closure").set("object", serializeObj(ctx, capture))) + .add(new JSONMap().set("type", "global").set("name", "Global Scope").set("object", serializeObj(ctx, global))) + .add(new JSONMap().set("type", "other").set("name", "Value Stack").set("object", serializeObj(ctx, valstack))) + ); + } + } + private class ObjRef { + public final ObjectValue obj; + public final Context ctx; + public final HashSet heldGroups = new HashSet<>(); + public boolean held = true; + + public boolean shouldRelease() { + return !held && heldGroups.size() == 0; + } + + public ObjRef(Context ctx, ObjectValue obj) { + this.ctx = ctx; + this.obj = obj; + } + } + + private static class RunResult { + public final Context ctx; + public final Object result; + public final EngineException error; + + public RunResult(Context ctx, Object result, EngineException error) { + this.ctx = ctx; + this.result = result; + this.error = error; + } + } + + public boolean enabled = true; + public CatchType execptionType = CatchType.NONE; + public State state = State.RESUMED; + + public final WebSocket ws; + public final Engine target; + + private ObjectValue emptyObject = new ObjectValue(); + + private HashMap idToBptCand = new HashMap<>(); + + private HashMap idToBreakpoint = new HashMap<>(); + private HashMap locToBreakpoint = new HashMap<>(); + private HashSet tmpBreakpts = new HashSet<>(); + + private HashMap filenameToId = new HashMap<>(); + private HashMap idToSource = new HashMap<>(); + private ArrayList pendingSources = new ArrayList<>(); + + private HashMap idToFrame = new HashMap<>(); + private HashMap codeFrameToFrame = new HashMap<>(); + + private HashMap idToObject = new HashMap<>(); + private HashMap objectToId = new HashMap<>(); + private HashMap> objectGroups = new HashMap<>(); + + private Notifier updateNotifier = new Notifier(); + private boolean pendingPause = false; + + private int nextId = 0; + private Frame stepOutFrame = null, currFrame = null; + private int stepOutPtr = 0; + + private boolean compare(String src, String target) { + if (src.length() != target.length()) return false; + var diff = 0; + var all = 0; + + for (var i = 0; i < src.length(); i++) { + var a = src.charAt(i); + var b = target.charAt(i); + var letter = Parsing.isLetter(a) && Parsing.isLetter(b); + + if (a != b) { + if (letter) diff++; + else return false; + } + + if (letter) all++; + } + + return diff / (float)all < .5f; + } + private boolean compare(String src, Set target) { + for (var el : target) { + if (compare(src, el)) return true; + } + return false; + } + + private int nextId() { + return nextId++; + } + + private synchronized void updateFrames(Context ctx) { + var frame = ctx.peekFrame(); + if (frame == null) return; + + if (!codeFrameToFrame.containsKey(frame)) { + var id = nextId(); + var fr = new Frame(ctx, frame, id); + + idToFrame.put(id, fr); + codeFrameToFrame.put(frame, fr); + } + + currFrame = codeFrameToFrame.get(frame); + } + private JSONList serializeFrames(Context ctx) { + var res = new JSONList(); + var frames = ctx.frames(); + + for (var i = frames.size() - 1; i >= 0; i--) { + var frame = codeFrameToFrame.get(frames.get(i)); + if (frame.location == null) continue; + frame.serialized.set("location", serializeLocation(frame.location)); + if (frame.location != null) res.add(frame.serialized); + } + + return res; + } + + private Location correctLocation(Source source, Location loc) { + var set = source.breakpoints; + + if (set.contains(loc)) return loc; + + var tail = set.tailSet(loc); + if (tail.isEmpty()) return null; + + return tail.first(); + } + private Location deserializeLocation(JSONElement el, boolean correct) { + if (!el.isMap()) throw new RuntimeException("Expected location to be a map."); + var id = Integer.parseInt(el.map().string("scriptId")); + var line = (int)el.map().number("lineNumber") + 1; + var column = (int)el.map().number("columnNumber") + 1; + + if (!idToSource.containsKey(id)) throw new RuntimeException(String.format("The specified source %s doesn't exist.", id)); + + var res = new Location(line, column, idToSource.get(id).filename); + if (correct) res = correctLocation(idToSource.get(id), res); + return res; + } + private JSONMap serializeLocation(Location loc) { + var source = filenameToId.get(loc.filename()); + return new JSONMap() + .set("scriptId", source + "") + .set("lineNumber", loc.line() - 1) + .set("columnNumber", loc.start() - 1); + } + + private Integer objectId(Context ctx, ObjectValue obj) { + if (objectToId.containsKey(obj)) return objectToId.get(obj); + else { + int id = nextId(); + var ref = new ObjRef(ctx, obj); + objectToId.put(obj, id); + idToObject.put(id, ref); + return id; + } + } + private JSONMap serializeObj(Context ctx, Object val, boolean byValue) { + val = Values.normalize(null, val); + + if (val == Values.NULL) { + return new JSONMap() + .set("type", "object") + .set("subtype", "null") + .setNull("value") + .set("description", "null"); + } + + if (val instanceof ObjectValue) { + var obj = (ObjectValue)val; + var id = objectId(ctx, obj); + var type = "object"; + String subtype = null; + String className = null; + + if (obj instanceof FunctionValue) type = "function"; + if (obj instanceof ArrayValue) subtype = "array"; + + try { className = Values.toString(ctx, Values.getMemberPath(ctx, obj, "constructor", "name")); } + catch (Exception e) { } + + var res = new JSONMap() + .set("type", type) + .set("objectId", id + ""); + + if (subtype != null) res.set("subtype", subtype); + if (className != null) { + res.set("className", className); + } + + if (obj instanceof ArrayValue) res.set("description", "Array(" + ((ArrayValue)obj).size() + ")"); + else if (obj instanceof FunctionValue) res.set("description", obj.toString()); + else { + var defaultToString = false; + + try { + defaultToString = + Values.getMember(ctx, obj, "toString") == + Values.getMember(ctx, ctx.environment().proto("object"), "toString"); + } + catch (Exception e) { } + + try { res.set("description", className + (defaultToString ? "" : " { " + Values.toString(ctx, obj) + " }")); } + catch (EngineException e) { res.set("description", className); } + } + + + if (byValue) try { res.put("value", JSON.fromJs(ctx, obj)); } + catch (Exception e) { } + + return res; + } + + if (val == null) return new JSONMap().set("type", "undefined"); + if (val instanceof String) return new JSONMap().set("type", "string").set("value", (String)val); + if (val instanceof Boolean) return new JSONMap().set("type", "boolean").set("value", (Boolean)val); + if (val instanceof Symbol) return new JSONMap().set("type", "symbol").set("description", val.toString()); + if (val instanceof Number) { + var num = (double)(Number)val; + var res = new JSONMap().set("type", "number"); + + if (Double.POSITIVE_INFINITY == num) res.set("unserializableValue", "Infinity"); + else if (Double.NEGATIVE_INFINITY == num) res.set("unserializableValue", "-Infinity"); + else if (Double.doubleToRawLongBits(num) == Double.doubleToRawLongBits(-0d)) res.set("unserializableValue", "-0"); + else if (Double.doubleToRawLongBits(num) == Double.doubleToRawLongBits(0d)) res.set("unserializableValue", "0"); + else if (Double.isNaN(num)) res.set("unserializableValue", "NaN"); + else res.set("value", num); + + return res; + } + + throw new IllegalArgumentException("Unexpected JS object."); + } + private JSONMap serializeObj(Context ctx, Object val) { + return serializeObj(ctx, val, false); + } + private void addObjectGroup(String name, Object val) { + if (val instanceof ObjectValue) { + var obj = (ObjectValue)val; + var id = objectToId.getOrDefault(obj, -1); + if (id < 0) return; + + var ref = idToObject.get(id); + + if (objectGroups.containsKey(name)) objectGroups.get(name).add(ref); + else objectGroups.put(name, new ArrayList<>(List.of(ref))); + + ref.heldGroups.add(name); + } + } + private void releaseGroup(String name) { + var objs = objectGroups.remove(name); + + if (objs != null) for (var obj : objs) { + if (obj.heldGroups.remove(name) && obj.shouldRelease()) { + var id = objectToId.remove(obj.obj); + if (id != null) idToObject.remove(id); + } + } + } + private Object deserializeArgument(JSONMap val) { + if (val.isString("objectId")) return idToObject.get(Integer.parseInt(val.string("objectId"))).obj; + else if (val.isString("unserializableValue")) switch (val.string("unserializableValue")) { + case "NaN": return Double.NaN; + case "-Infinity": return Double.NEGATIVE_INFINITY; + case "Infinity": return Double.POSITIVE_INFINITY; + case "-0": return -0.; + } + var res = val.get("value"); + if (res == null) return null; + else return JSON.toJs(res); + } + + private JSONMap serializeException(Context ctx, EngineException err) { + String text = null; + + try { + text = Values.toString(ctx, err.value); + } + catch (EngineException e) { + text = "[error while stringifying]"; + } + + var res = new JSONMap() + .set("exceptionId", nextId()) + .set("exception", serializeObj(ctx, err.value)) + .set("text", text); + + return res; + } + + private void resume(State state) { + this.state = state; + ws.send(new V8Event("Debugger.resumed", new JSONMap())); + updateNotifier.next(); + } + private void pauseDebug(Context ctx, Breakpoint bp) { + state = State.PAUSED_NORMAL; + var map = new JSONMap() + .set("callFrames", serializeFrames(ctx)) + .set("reason", "debugCommand"); + + if (bp != null) map.set("hitBreakpoints", new JSONList().add(bp.id + "")); + ws.send(new V8Event("Debugger.paused", map)); + } + private void pauseException(Context ctx) { + state = State.PAUSED_EXCEPTION; + var map = new JSONMap() + .set("callFrames", serializeFrames(ctx)) + .set("reason", "exception"); + + ws.send(new V8Event("Debugger.paused", map)); + } + + private void sendSource(Source src) { + ws.send(new V8Event("Debugger.scriptParsed", new JSONMap() + .set("scriptId", src.id + "") + .set("hash", src.source.hashCode()) + .set("url", src.filename + "") + )); + } + + private void addBreakpoint(Breakpoint bpt) { + idToBreakpoint.put(bpt.id, bpt); + locToBreakpoint.put(bpt.location, bpt); + + ws.send(new V8Event("Debugger.breakpointResolved", new JSONMap() + .set("breakpointId", bpt.id) + .set("location", serializeLocation(bpt.location)) + )); + } + + private RunResult run(Frame codeFrame, String code) { + if (codeFrame == null) return new RunResult(null, code, new EngineException("Invalid code frame!")); + var engine = new Engine(false); + var env = codeFrame.func.environment.fork(); + + env.global = new GlobalScope(codeFrame.local); + + var ctx = new Context(engine).pushEnv(env); + var awaiter = engine.pushMsg(false, ctx, new Filename("jscript", "eval"), code, codeFrame.frame.thisArg, codeFrame.frame.args); + + engine.run(true); + + try { return new RunResult(ctx, awaiter.await(), null); } + catch (EngineException e) { return new RunResult(ctx, null, e); } + } + + private ObjectValue vscodeAutoSuggest(Context ctx, Object target, String query, boolean variable) { + var res = new ArrayValue(); + var passed = new HashSet(); + var tildas = "~"; + if (target == null) target = ctx.environment().getGlobal(); + + for (var proto = target; proto != null && proto != Values.NULL; proto = Values.getPrototype(ctx, proto)) { + for (var el : Values.getMembers(ctx, proto, true, true)) { + var strKey = Values.toString(ctx, el); + if (passed.contains(strKey)) continue; + passed.add(strKey); + + var val = Values.getMember(ctx, Values.getMemberDescriptor(ctx, proto, el), "value"); + var desc = new ObjectValue(); + var sortText = ""; + if (strKey.startsWith(query)) sortText += "0@"; + else if (strKey.toLowerCase().startsWith(query.toLowerCase())) sortText += "1@"; + else if (strKey.contains(query)) sortText += "2@"; + else if (strKey.toLowerCase().contains(query.toLowerCase())) sortText += "3@"; + else sortText += "4@"; + sortText += tildas + strKey; + + desc.defineProperty(ctx, "label", strKey); + desc.defineProperty(ctx, "sortText", sortText); + + if (val instanceof FunctionValue) { + if (strKey.equals("constructor")) desc.defineProperty(ctx, "type", "name"); + else desc.defineProperty(ctx, "type", variable ? "function" : "method"); + } + else desc.defineProperty(ctx, "type", variable ? "variable" : "property"); + + switch (Values.type(val)) { + case "number": + case "boolean": + desc.defineProperty(ctx, "detail", Values.toString(ctx, val)); + break; + case "object": + if (val == Values.NULL) desc.defineProperty(ctx, "detail", "null"); + else try { + desc.defineProperty(ctx, "detail", Values.getMemberPath(ctx, target, "constructor", "name")); + } + catch (IllegalArgumentException e) { + desc.defineProperty(ctx, "detail", "object"); + } + break; + case "function": { + var type = "fn("; + for (var i = 0; i < ((FunctionValue)val).length; i++) { + if (i != 0) type += ","; + type += "?"; + } + type += ")"; + desc.defineProperty(ctx, "detail", type); + break; + } + default: + desc.defineProperty(ctx, "type", Values.type(val)); + break; + } + + res.set(ctx, res.size(), desc); + } + + tildas += "~"; + variable = true; + } + + var resObj = new ObjectValue(); + resObj.defineProperty(ctx, "result", res); + resObj.defineProperty(ctx, "isArray", target instanceof ArrayValue); + return resObj; + } + + @Override public synchronized void enable(V8Message msg) { + enabled = true; + ws.send(msg.respond()); + + for (var el : pendingSources) sendSource(el); + pendingSources.clear(); + + updateNotifier.next(); + } + @Override public synchronized void disable(V8Message msg) { + enabled = false; + ws.send(msg.respond()); + updateNotifier.next(); + } + + @Override public synchronized void getScriptSource(V8Message msg) { + int id = Integer.parseInt(msg.params.string("scriptId")); + ws.send(msg.respond(new JSONMap().set("scriptSource", idToSource.get(id).source))); + } + @Override public synchronized void getPossibleBreakpoints(V8Message msg) { + var src = idToSource.get(Integer.parseInt(msg.params.map("start").string("scriptId"))); + var start = deserializeLocation(msg.params.get("start"), false); + var end = msg.params.isMap("end") ? deserializeLocation(msg.params.get("end"), false) : null; + + var res = new JSONList(); + + for (var loc : src.breakpoints.tailSet(start, true)) { + if (end != null && loc.compareTo(end) > 0) break; + res.add(serializeLocation(loc)); + } + + ws.send(msg.respond(new JSONMap().set("locations", res))); + } + + @Override public synchronized void pause(V8Message msg) { + pendingPause = true; + ws.send(msg.respond()); + } + @Override public synchronized void resume(V8Message msg) { + resume(State.RESUMED); + ws.send(msg.respond(new JSONMap())); + } + + @Override public synchronized void setBreakpointByUrl(V8Message msg) { + var line = (int)msg.params.number("lineNumber") + 1; + var col = (int)msg.params.number("columnNumber", 0) + 1; + var cond = msg.params.string("condition", "").trim(); + + if (cond.equals("")) cond = null; + if (cond != null) cond = "(" + cond + ")"; + + Pattern regex; + + if (msg.params.isString("url")) regex = Pattern.compile(Pattern.quote(msg.params.string("url"))); + else regex = Pattern.compile(msg.params.string("urlRegex")); + + var bpcd = new BreakpointCandidate(nextId(), regex, line, col, cond); + idToBptCand.put(bpcd.id, bpcd); + + var locs = new JSONList(); + + for (var src : idToSource.values()) { + if (regex.matcher(src.filename.toString()).matches()) { + var loc = correctLocation(src, new Location(line, col, src.filename)); + if (loc == null) continue; + var bp = new Breakpoint(nextId(), loc, bpcd.condition); + + bpcd.resolvedBreakpoints.add(bp); + locs.add(serializeLocation(loc)); + addBreakpoint(bp); + } + } + + ws.send(msg.respond(new JSONMap() + .set("breakpointId", bpcd.id + "") + .set("locations", locs) + )); + } + @Override public synchronized void removeBreakpoint(V8Message msg) { + var id = Integer.parseInt(msg.params.string("breakpointId")); + + if (idToBptCand.containsKey(id)) { + var bpcd = idToBptCand.get(id); + for (var bp : bpcd.resolvedBreakpoints) { + idToBreakpoint.remove(bp.id); + locToBreakpoint.remove(bp.location); + } + idToBptCand.remove(id); + } + else if (idToBreakpoint.containsKey(id)) { + var bp = idToBreakpoint.remove(id); + locToBreakpoint.remove(bp.location); + } + ws.send(msg.respond()); + } + @Override public synchronized void continueToLocation(V8Message msg) { + var loc = deserializeLocation(msg.params.get("location"), true); + + tmpBreakpts.add(loc); + + resume(State.RESUMED); + ws.send(msg.respond()); + } + + @Override public synchronized void setPauseOnExceptions(V8Message msg) { + switch (msg.params.string("state")) { + case "none": execptionType = CatchType.NONE; break; + case "all": execptionType = CatchType.ALL; break; + case "uncaught": execptionType = CatchType.UNCAUGHT; break; + default: + ws.send(new V8Error("Invalid exception pause type.")); + return; + } + + ws.send(msg.respond()); + } + + @Override public synchronized void stepInto(V8Message msg) { + if (state == State.RESUMED) ws.send(new V8Error("Debugger is resumed.")); + else { + stepOutFrame = currFrame; + stepOutPtr = currFrame.frame.codePtr; + resume(State.STEPPING_IN); + ws.send(msg.respond()); + } + } + @Override public synchronized void stepOut(V8Message msg) { + if (state == State.RESUMED) ws.send(new V8Error("Debugger is resumed.")); + else { + stepOutFrame = currFrame; + stepOutPtr = currFrame.frame.codePtr; + resume(State.STEPPING_OUT); + ws.send(msg.respond()); + } + } + @Override public synchronized void stepOver(V8Message msg) { + if (state == State.RESUMED) ws.send(new V8Error("Debugger is resumed.")); + else { + stepOutFrame = currFrame; + stepOutPtr = currFrame.frame.codePtr; + resume(State.STEPPING_OVER); + ws.send(msg.respond()); + } + } + + @Override public synchronized void evaluateOnCallFrame(V8Message msg) { + var cfId = Integer.parseInt(msg.params.string("callFrameId")); + var expr = msg.params.string("expression"); + var group = msg.params.string("objectGroup", null); + + var cf = idToFrame.get(cfId); + var res = run(cf, expr); + + if (group != null) addObjectGroup(group, res.result); + + if (res.error != null) ws.send(msg.respond(new JSONMap().set("exceptionDetails", serializeException(res.ctx, res.error)))); + else ws.send(msg.respond(new JSONMap().set("result", serializeObj(res.ctx, res.result)))); + } + + @Override public synchronized void releaseObjectGroup(V8Message msg) { + var group = msg.params.string("objectGroup"); + releaseGroup(group); + ws.send(msg.respond()); + } + @Override public synchronized void releaseObject(V8Message msg) { + var id = Integer.parseInt(msg.params.string("objectId")); + var ref = idToObject.get(id); + ref.held = false; + + if (ref.shouldRelease()) { + objectToId.remove(ref.obj); + idToObject.remove(id); + } + + ws.send(msg.respond()); + } + @Override public synchronized void getProperties(V8Message msg) { + var ref = idToObject.get(Integer.parseInt(msg.params.string("objectId"))); + var obj = ref.obj; + + var res = new JSONList(); + var ctx = ref.ctx; + + if (obj != emptyObject && obj != null) { + for (var key : obj.keys(true)) { + var propDesc = new JSONMap(); + + if (obj.properties.containsKey(key)) { + var prop = obj.properties.get(key); + + propDesc.set("name", Values.toString(ctx, key)); + if (prop.getter != null) propDesc.set("get", serializeObj(ctx, prop.getter)); + if (prop.setter != null) propDesc.set("set", serializeObj(ctx, prop.setter)); + propDesc.set("enumerable", obj.memberEnumerable(key)); + propDesc.set("configurable", obj.memberConfigurable(key)); + propDesc.set("isOwn", true); + res.add(propDesc); + } + else { + propDesc.set("name", Values.toString(ctx, key)); + propDesc.set("value", serializeObj(ctx, obj.getMember(ctx, key))); + propDesc.set("writable", obj.memberWritable(key)); + propDesc.set("enumerable", obj.memberEnumerable(key)); + propDesc.set("configurable", obj.memberConfigurable(key)); + propDesc.set("isOwn", true); + res.add(propDesc); + } + } + + var proto = obj.getPrototype(ctx); + + var protoDesc = new JSONMap(); + protoDesc.set("name", "__proto__"); + protoDesc.set("value", serializeObj(ctx, proto == null ? Values.NULL : proto)); + protoDesc.set("writable", true); + protoDesc.set("enumerable", false); + protoDesc.set("configurable", false); + protoDesc.set("isOwn", true); + res.add(protoDesc); + } + + ws.send(msg.respond(new JSONMap().set("result", res))); + } + @Override public synchronized void callFunctionOn(V8Message msg) { + var src = msg.params.string("functionDeclaration"); + var args = msg.params + .list("arguments", new JSONList()) + .stream() + .map(v -> v.map()) + .map(this::deserializeArgument) + .collect(Collectors.toList()); + var byValue = msg.params.bool("returnByValue", false); + + var thisArgRef = idToObject.get(Integer.parseInt(msg.params.string("objectId"))); + var thisArg = thisArgRef.obj; + var ctx = thisArgRef.ctx; + + while (true) { + var start = src.lastIndexOf("//# sourceURL="); + if (start < 0) break; + var end = src.indexOf("\n", start); + if (end < 0) src = src.substring(0, start); + else src = src.substring(0, start) + src.substring(end + 1); + } + + try { + Object res = null; + if (compare(src, VSCODE_EMPTY)) res = emptyObject; + else if (compare(src, VSCODE_SELF)) res = thisArg; + else if (compare(src, CHROME_GET_PROP_FUNC)) { + res = thisArg; + for (var el : JSON.parse(null, (String)args.get(0)).list()) res = Values.getMember(ctx, res, JSON.toJs(el)); + } + else if (compare(src, VSCODE_CALL)) { + var func = (FunctionValue)(args.size() < 1 ? null : args.get(0)); + ws.send(msg.respond(new JSONMap().set("result", serializeObj(ctx, func.call(ctx, thisArg))))); + } + else if (compare(src, VSCODE_AUTOCOMPLETE)) { + var target = args.get(0); + if (target == null) target = thisArg; + res = vscodeAutoSuggest(ctx, target, Values.toString(ctx, args.get(1)), Values.toBoolean(args.get(2))); + } + else { + ws.send(new V8Error("Please use well-known functions with callFunctionOn")); + return; + } + ws.send(msg.respond(new JSONMap().set("result", serializeObj(ctx, res, byValue)))); + } + catch (EngineException e) { ws.send(msg.respond(new JSONMap().set("exceptionDetails", serializeException(ctx, e)))); } + } + + @Override public synchronized void runtimeEnable(V8Message msg) { + ws.send(msg.respond()); + } + + @Override public void onSource(Filename filename, String source, TreeSet locations, SourceMap map) { + int id = nextId(); + var src = new Source(id, filename, source, locations); + + idToSource.put(id, src); + filenameToId.put(filename, id); + + for (var bpcd : idToBptCand.values()) { + if (!bpcd.pattern.matcher(filename.toString()).matches()) continue; + var loc = correctLocation(src, new Location(bpcd.line, bpcd.start, filename)); + var bp = new Breakpoint(nextId(), loc, bpcd.condition); + if (loc == null) continue; + bpcd.resolvedBreakpoints.add(bp); + addBreakpoint(bp); + } + + if (!enabled) pendingSources.add(src); + else sendSource(src); + } + @Override public boolean onInstruction(Context ctx, CodeFrame cf, Instruction instruction, Object returnVal, EngineException error, boolean caught) { + if (!enabled) return false; + + boolean isBreakpointable; + Location loc; + Frame frame; + + synchronized (this) { + frame = codeFrameToFrame.get(cf); + + if (!frame.debugData) return false; + + if (instruction.location != null) frame.updateLoc(ctx.engine.mapToCompiled(instruction.location)); + loc = frame.location; + isBreakpointable = loc != null && (instruction.breakpoint.shouldStepIn()); + + if (error != null && (execptionType == CatchType.ALL || execptionType == CatchType.UNCAUGHT && !caught)) { + pauseException(ctx); + } + else if (loc != null && (state == State.STEPPING_IN || state == State.STEPPING_OVER) && returnVal != Runners.NO_RETURN && stepOutFrame == frame) { + pauseDebug(ctx, null); + } + else if (isBreakpointable && locToBreakpoint.containsKey(loc)) { + var bp = locToBreakpoint.get(loc); + var ok = bp.condition == null ? true : Values.toBoolean(run(currFrame, bp.condition).result); + if (ok) pauseDebug(ctx, locToBreakpoint.get(loc)); + } + else if (isBreakpointable && tmpBreakpts.remove(loc)) pauseDebug(ctx, null); + else if (isBreakpointable && pendingPause) { + pauseDebug(ctx, null); + pendingPause = false; + } + else if (instruction.type == Type.NOP && instruction.match("debug")) pauseDebug(ctx, null); + } + + + while (enabled) { + synchronized (this) { + switch (state) { + case PAUSED_EXCEPTION: + case PAUSED_NORMAL: break; + + case STEPPING_OUT: + case RESUMED: return false; + + case STEPPING_IN: + case STEPPING_OVER: + if (stepOutFrame.frame == frame.frame) { + if (returnVal != Runners.NO_RETURN || error != null) { + state = State.STEPPING_OUT; + continue; + } + else if (stepOutPtr != frame.frame.codePtr) { + if (state == State.STEPPING_IN && instruction.breakpoint.shouldStepIn()) { + pauseDebug(ctx, null); + break; + } + else if (state == State.STEPPING_OVER && instruction.breakpoint.shouldStepOver()) { + pauseDebug(ctx, null); + break; + } + } + } + return false; + } + } + updateNotifier.await(); + } + + return false; + } + @Override public void onFramePush(Context ctx, CodeFrame frame) { + var prevFrame = currFrame; + updateFrames(ctx); + + if (stepOutFrame != null && stepOutFrame.frame == prevFrame.frame && state == State.STEPPING_IN) { + stepOutFrame = currFrame; + } + } + @Override public void onFramePop(Context ctx, CodeFrame frame) { + updateFrames(ctx); + + try { idToFrame.remove(codeFrameToFrame.remove(frame).id); } + catch (NullPointerException e) { } + + if (ctx.frames().size() == 0) { + if (state == State.PAUSED_EXCEPTION || state == State.PAUSED_NORMAL) resume(State.RESUMED); + } + else if (stepOutFrame != null && stepOutFrame.frame == frame && state == State.STEPPING_OUT) { + state = State.STEPPING_IN; + stepOutFrame = currFrame; + } + } + + @Override public synchronized void connect() { + if (!target.attachDebugger(this)) { + ws.send(new V8Error("A debugger is already attached to this engine.")); + } + } + @Override public synchronized void disconnect() { + target.detachDebugger(); + enabled = false; + updateNotifier.next(); + } + + public SimpleDebugger(WebSocket ws, Engine target) { + this.ws = ws; + this.target = target; + } +} diff --git a/src/me/topchetoeu/jscript/engine/frame/CodeFrame.java b/src/me/topchetoeu/jscript/engine/frame/CodeFrame.java index 5b3e701..fe60b3d 100644 --- a/src/me/topchetoeu/jscript/engine/frame/CodeFrame.java +++ b/src/me/topchetoeu/jscript/engine/frame/CodeFrame.java @@ -1,317 +1,317 @@ -package me.topchetoeu.jscript.engine.frame; - -import java.util.List; -import java.util.Stack; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.scope.LocalScope; -import me.topchetoeu.jscript.engine.scope.ValueVariable; -import me.topchetoeu.jscript.engine.values.ArrayValue; -import me.topchetoeu.jscript.engine.values.CodeFunction; -import me.topchetoeu.jscript.engine.values.ObjectValue; -import me.topchetoeu.jscript.engine.values.ScopeValue; -import me.topchetoeu.jscript.engine.values.Values; -import me.topchetoeu.jscript.exceptions.EngineException; -import me.topchetoeu.jscript.exceptions.InterruptException; - -public class CodeFrame { - public static enum TryState { - TRY, - CATCH, - FINALLY, - } - - public static class TryCtx { - public final int start, end, catchStart, finallyStart; - public final int restoreStackPtr; - public final TryState state; - public final EngineException error; - public final PendingResult result; - - public boolean hasCatch() { return catchStart >= 0; } - public boolean hasFinally() { return finallyStart >= 0; } - - public boolean inBounds(int ptr) { - return ptr >= start && ptr < end; - } - - public TryCtx _catch(EngineException e) { - if (error != null) e.setCause(error); - return new TryCtx(TryState.CATCH, e, result, restoreStackPtr, start, end, -1, finallyStart); - } - public TryCtx _finally(PendingResult res) { - return new TryCtx(TryState.FINALLY, error, res, restoreStackPtr, start, end, -1, -1); - } - - public TryCtx(TryState state, EngineException err, PendingResult res, int stackPtr, int start, int end, int catchStart, int finallyStart) { - this.catchStart = catchStart; - this.finallyStart = finallyStart; - this.restoreStackPtr = stackPtr; - this.result = res == null ? PendingResult.ofNone() : res; - this.state = state; - this.start = start; - this.end = end; - this.error = err; - } - } - - private static class PendingResult { - public final boolean isReturn, isJump, isThrow; - public final Object value; - public final EngineException error; - public final int ptr; - public final Instruction instruction; - - private PendingResult(Instruction instr, boolean isReturn, boolean isJump, boolean isThrow, Object value, EngineException error, int ptr) { - this.instruction = instr; - this.isReturn = isReturn; - this.isJump = isJump; - this.isThrow = isThrow; - this.value = value; - this.error = error; - this.ptr = ptr; - } - - public static PendingResult ofNone() { - return new PendingResult(null, false, false, false, null, null, 0); - } - public static PendingResult ofReturn(Object value, Instruction instr) { - return new PendingResult(instr, true, false, false, value, null, 0); - } - public static PendingResult ofThrow(EngineException error, Instruction instr) { - return new PendingResult(instr, false, false, true, null, error, 0); - } - public static PendingResult ofJump(int codePtr, Instruction instr) { - return new PendingResult(instr, false, true, false, null, null, codePtr); - } - } - - public final LocalScope scope; - public final Object thisArg; - public final Object[] args; - public final Stack tryStack = new Stack<>(); - public final CodeFunction function; - public Object[] stack = new Object[32]; - public int stackPtr = 0; - public int codePtr = 0; - public boolean jumpFlag = false, popTryFlag = false; - private Location prevLoc = null; - - public ObjectValue getLocalScope(Context ctx, boolean props) { - var names = new String[scope.locals.length]; - - for (int i = 0; i < scope.locals.length; i++) { - var name = "local_" + (i - 2); - - if (i == 0) name = "this"; - else if (i == 1) name = "arguments"; - else if (i < function.localNames.length) name = function.localNames[i]; - - names[i] = name; - } - - return new ScopeValue(scope.locals, names); - } - public ObjectValue getCaptureScope(Context ctx, boolean props) { - var names = new String[scope.captures.length]; - - for (int i = 0; i < scope.captures.length; i++) { - var name = "capture_" + (i - 2); - if (i < function.captureNames.length) name = function.captureNames[i]; - names[i] = name; - } - - return new ScopeValue(scope.captures, names); - } - public ObjectValue getValStackScope(Context ctx) { - return new ObjectValue() { - @Override - protected Object getField(Context ctx, Object key) { - var i = (int)Values.toNumber(ctx, key); - if (i < 0 || i >= stackPtr) return null; - else return stack[i]; - } - @Override - protected boolean hasField(Context ctx, Object key) { - return true; - } - @Override - public List keys(boolean includeNonEnumerable) { - var res = super.keys(includeNonEnumerable); - for (var i = 0; i < stackPtr; i++) res.add(i); - return res; - } - }; - } - - public void addTry(int start, int end, int catchStart, int finallyStart) { - var err = tryStack.empty() ? null : tryStack.peek().error; - var res = new TryCtx(TryState.TRY, err, null, stackPtr, start, end, catchStart, finallyStart); - - tryStack.add(res); - } - - public Object peek() { - return peek(0); - } - public Object peek(int offset) { - if (stackPtr <= offset) return null; - else return stack[stackPtr - 1 - offset]; - } - public Object pop() { - if (stackPtr == 0) return null; - return stack[--stackPtr]; - } - public Object[] take(int n) { - int srcI = stackPtr - n; - if (srcI < 0) srcI = 0; - - int dstI = n + srcI - stackPtr; - int copyN = stackPtr - srcI; - - Object[] res = new Object[n]; - System.arraycopy(stack, srcI, res, dstI, copyN); - stackPtr -= copyN; - - return res; - } - public void push(Context ctx, Object val) { - if (stack.length <= stackPtr) { - var newStack = new Object[stack.length * 2]; - System.arraycopy(stack, 0, newStack, 0, stack.length); - stack = newStack; - } - stack[stackPtr++] = Values.normalize(ctx, val); - } - - public Object next(Context ctx, Object value, Object returnValue, EngineException error) { - if (value != Runners.NO_RETURN) push(ctx, value); - - Instruction instr = null; - if (codePtr >= 0 && codePtr < function.body.length) instr = function.body[codePtr]; - - if (returnValue == Runners.NO_RETURN && error == null) { - try { - if (Thread.currentThread().isInterrupted()) throw new InterruptException(); - - if (instr == null) returnValue = null; - else { - // System.out.println(instr + "@" + instr.location); - ctx.engine.onInstruction(ctx, this, instr, Runners.NO_RETURN, null, false); - - if (instr.location != null) prevLoc = instr.location; - - try { - this.jumpFlag = this.popTryFlag = false; - returnValue = Runners.exec(ctx, instr, this); - } - catch (EngineException e) { - error = e.add(ctx, function.name, prevLoc); - } - } - } - catch (EngineException e) { error = e; } - } - - while (!tryStack.empty()) { - var tryCtx = tryStack.peek(); - TryCtx newCtx = null; - - if (error != null) { - if (tryCtx.hasCatch()) newCtx = tryCtx._catch(error); - else if (tryCtx.hasFinally()) newCtx = tryCtx._finally(PendingResult.ofThrow(error, instr)); - } - else if (returnValue != Runners.NO_RETURN) { - if (tryCtx.hasFinally()) newCtx = tryCtx._finally(PendingResult.ofReturn(returnValue, instr)); - } - else if (jumpFlag && !tryCtx.inBounds(codePtr)) { - if (tryCtx.hasFinally()) newCtx = tryCtx._finally(PendingResult.ofJump(codePtr, instr)); - } - else if (!this.popTryFlag) newCtx = tryCtx; - - if (newCtx != null) { - if (newCtx != tryCtx) { - switch (newCtx.state) { - case CATCH: - if (tryCtx.state != TryState.CATCH) scope.catchVars.add(new ValueVariable(false, error.value)); - codePtr = tryCtx.catchStart; - stackPtr = tryCtx.restoreStackPtr; - break; - case FINALLY: - if (tryCtx.state == TryState.CATCH) scope.catchVars.remove(scope.catchVars.size() - 1); - codePtr = tryCtx.finallyStart; - stackPtr = tryCtx.restoreStackPtr; - default: - } - - tryStack.pop(); - tryStack.push(newCtx); - } - error = null; - returnValue = Runners.NO_RETURN; - break; - } - else { - if (tryCtx.state == TryState.CATCH) scope.catchVars.remove(scope.catchVars.size() - 1); - - if (tryCtx.state != TryState.FINALLY && tryCtx.hasFinally()) { - codePtr = tryCtx.finallyStart; - stackPtr = tryCtx.restoreStackPtr; - tryStack.pop(); - tryStack.push(tryCtx._finally(null)); - break; - } - else { - tryStack.pop(); - codePtr = tryCtx.end; - if (tryCtx.result.instruction != null) instr = tryCtx.result.instruction; - if (tryCtx.result.isJump) { - codePtr = tryCtx.result.ptr; - jumpFlag = true; - } - if (tryCtx.result.isReturn) returnValue = tryCtx.result.value; - if (tryCtx.result.isThrow) { - error = tryCtx.result.error; - } - if (error != null) error.setCause(tryCtx.error); - continue; - } - } - } - - if (error != null) { - var caught = false; - - for (var frame : ctx.frames()) { - for (var tryCtx : frame.tryStack) { - if (tryCtx.state == TryState.TRY) caught = true; - } - } - - ctx.engine.onInstruction(ctx, this, instr, null, error, caught); - throw error; - } - if (returnValue != Runners.NO_RETURN) { - ctx.engine.onInstruction(ctx, this, instr, returnValue, null, false); - return returnValue; - } - - return Runners.NO_RETURN; - } - - public CodeFrame(Context ctx, Object thisArg, Object[] args, CodeFunction func) { - this.args = args.clone(); - this.scope = new LocalScope(func.localsN, func.captures); - this.scope.get(0).set(null, thisArg); - var argsObj = new ArrayValue(); - for (var i = 0; i < args.length; i++) { - argsObj.set(ctx, i, args[i]); - } - this.scope.get(1).value = argsObj; - - this.thisArg = thisArg; - this.function = func; - } -} +package me.topchetoeu.jscript.engine.frame; + +import java.util.List; +import java.util.Stack; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.scope.LocalScope; +import me.topchetoeu.jscript.engine.scope.ValueVariable; +import me.topchetoeu.jscript.engine.values.ArrayValue; +import me.topchetoeu.jscript.engine.values.CodeFunction; +import me.topchetoeu.jscript.engine.values.ObjectValue; +import me.topchetoeu.jscript.engine.values.ScopeValue; +import me.topchetoeu.jscript.engine.values.Values; +import me.topchetoeu.jscript.exceptions.EngineException; +import me.topchetoeu.jscript.exceptions.InterruptException; + +public class CodeFrame { + public static enum TryState { + TRY, + CATCH, + FINALLY, + } + + public static class TryCtx { + public final int start, end, catchStart, finallyStart; + public final int restoreStackPtr; + public final TryState state; + public final EngineException error; + public final PendingResult result; + + public boolean hasCatch() { return catchStart >= 0; } + public boolean hasFinally() { return finallyStart >= 0; } + + public boolean inBounds(int ptr) { + return ptr >= start && ptr < end; + } + + public TryCtx _catch(EngineException e) { + if (error != null) e.setCause(error); + return new TryCtx(TryState.CATCH, e, result, restoreStackPtr, start, end, -1, finallyStart); + } + public TryCtx _finally(PendingResult res) { + return new TryCtx(TryState.FINALLY, error, res, restoreStackPtr, start, end, -1, -1); + } + + public TryCtx(TryState state, EngineException err, PendingResult res, int stackPtr, int start, int end, int catchStart, int finallyStart) { + this.catchStart = catchStart; + this.finallyStart = finallyStart; + this.restoreStackPtr = stackPtr; + this.result = res == null ? PendingResult.ofNone() : res; + this.state = state; + this.start = start; + this.end = end; + this.error = err; + } + } + + private static class PendingResult { + public final boolean isReturn, isJump, isThrow; + public final Object value; + public final EngineException error; + public final int ptr; + public final Instruction instruction; + + private PendingResult(Instruction instr, boolean isReturn, boolean isJump, boolean isThrow, Object value, EngineException error, int ptr) { + this.instruction = instr; + this.isReturn = isReturn; + this.isJump = isJump; + this.isThrow = isThrow; + this.value = value; + this.error = error; + this.ptr = ptr; + } + + public static PendingResult ofNone() { + return new PendingResult(null, false, false, false, null, null, 0); + } + public static PendingResult ofReturn(Object value, Instruction instr) { + return new PendingResult(instr, true, false, false, value, null, 0); + } + public static PendingResult ofThrow(EngineException error, Instruction instr) { + return new PendingResult(instr, false, false, true, null, error, 0); + } + public static PendingResult ofJump(int codePtr, Instruction instr) { + return new PendingResult(instr, false, true, false, null, null, codePtr); + } + } + + public final LocalScope scope; + public final Object thisArg; + public final Object[] args; + public final Stack tryStack = new Stack<>(); + public final CodeFunction function; + public Object[] stack = new Object[32]; + public int stackPtr = 0; + public int codePtr = 0; + public boolean jumpFlag = false, popTryFlag = false; + private Location prevLoc = null; + + public ObjectValue getLocalScope(Context ctx, boolean props) { + var names = new String[scope.locals.length]; + + for (int i = 0; i < scope.locals.length; i++) { + var name = "local_" + (i - 2); + + if (i == 0) name = "this"; + else if (i == 1) name = "arguments"; + else if (i < function.localNames.length) name = function.localNames[i]; + + names[i] = name; + } + + return new ScopeValue(scope.locals, names); + } + public ObjectValue getCaptureScope(Context ctx, boolean props) { + var names = new String[scope.captures.length]; + + for (int i = 0; i < scope.captures.length; i++) { + var name = "capture_" + (i - 2); + if (i < function.captureNames.length) name = function.captureNames[i]; + names[i] = name; + } + + return new ScopeValue(scope.captures, names); + } + public ObjectValue getValStackScope(Context ctx) { + return new ObjectValue() { + @Override + protected Object getField(Context ctx, Object key) { + var i = (int)Values.toNumber(ctx, key); + if (i < 0 || i >= stackPtr) return null; + else return stack[i]; + } + @Override + protected boolean hasField(Context ctx, Object key) { + return true; + } + @Override + public List keys(boolean includeNonEnumerable) { + var res = super.keys(includeNonEnumerable); + for (var i = 0; i < stackPtr; i++) res.add(i); + return res; + } + }; + } + + public void addTry(int start, int end, int catchStart, int finallyStart) { + var err = tryStack.empty() ? null : tryStack.peek().error; + var res = new TryCtx(TryState.TRY, err, null, stackPtr, start, end, catchStart, finallyStart); + + tryStack.add(res); + } + + public Object peek() { + return peek(0); + } + public Object peek(int offset) { + if (stackPtr <= offset) return null; + else return stack[stackPtr - 1 - offset]; + } + public Object pop() { + if (stackPtr == 0) return null; + return stack[--stackPtr]; + } + public Object[] take(int n) { + int srcI = stackPtr - n; + if (srcI < 0) srcI = 0; + + int dstI = n + srcI - stackPtr; + int copyN = stackPtr - srcI; + + Object[] res = new Object[n]; + System.arraycopy(stack, srcI, res, dstI, copyN); + stackPtr -= copyN; + + return res; + } + public void push(Context ctx, Object val) { + if (stack.length <= stackPtr) { + var newStack = new Object[stack.length * 2]; + System.arraycopy(stack, 0, newStack, 0, stack.length); + stack = newStack; + } + stack[stackPtr++] = Values.normalize(ctx, val); + } + + public Object next(Context ctx, Object value, Object returnValue, EngineException error) { + if (value != Runners.NO_RETURN) push(ctx, value); + + Instruction instr = null; + if (codePtr >= 0 && codePtr < function.body.length) instr = function.body[codePtr]; + + if (returnValue == Runners.NO_RETURN && error == null) { + try { + if (Thread.currentThread().isInterrupted()) throw new InterruptException(); + + if (instr == null) returnValue = null; + else { + // System.out.println(instr + "@" + instr.location); + ctx.engine.onInstruction(ctx, this, instr, Runners.NO_RETURN, null, false); + + if (instr.location != null) prevLoc = instr.location; + + try { + this.jumpFlag = this.popTryFlag = false; + returnValue = Runners.exec(ctx, instr, this); + } + catch (EngineException e) { + error = e.add(ctx, function.name, prevLoc); + } + } + } + catch (EngineException e) { error = e; } + } + + while (!tryStack.empty()) { + var tryCtx = tryStack.peek(); + TryCtx newCtx = null; + + if (error != null) { + if (tryCtx.hasCatch()) newCtx = tryCtx._catch(error); + else if (tryCtx.hasFinally()) newCtx = tryCtx._finally(PendingResult.ofThrow(error, instr)); + } + else if (returnValue != Runners.NO_RETURN) { + if (tryCtx.hasFinally()) newCtx = tryCtx._finally(PendingResult.ofReturn(returnValue, instr)); + } + else if (jumpFlag && !tryCtx.inBounds(codePtr)) { + if (tryCtx.hasFinally()) newCtx = tryCtx._finally(PendingResult.ofJump(codePtr, instr)); + } + else if (!this.popTryFlag) newCtx = tryCtx; + + if (newCtx != null) { + if (newCtx != tryCtx) { + switch (newCtx.state) { + case CATCH: + if (tryCtx.state != TryState.CATCH) scope.catchVars.add(new ValueVariable(false, error.value)); + codePtr = tryCtx.catchStart; + stackPtr = tryCtx.restoreStackPtr; + break; + case FINALLY: + if (tryCtx.state == TryState.CATCH) scope.catchVars.remove(scope.catchVars.size() - 1); + codePtr = tryCtx.finallyStart; + stackPtr = tryCtx.restoreStackPtr; + default: + } + + tryStack.pop(); + tryStack.push(newCtx); + } + error = null; + returnValue = Runners.NO_RETURN; + break; + } + else { + if (tryCtx.state == TryState.CATCH) scope.catchVars.remove(scope.catchVars.size() - 1); + + if (tryCtx.state != TryState.FINALLY && tryCtx.hasFinally()) { + codePtr = tryCtx.finallyStart; + stackPtr = tryCtx.restoreStackPtr; + tryStack.pop(); + tryStack.push(tryCtx._finally(null)); + break; + } + else { + tryStack.pop(); + codePtr = tryCtx.end; + if (tryCtx.result.instruction != null) instr = tryCtx.result.instruction; + if (tryCtx.result.isJump) { + codePtr = tryCtx.result.ptr; + jumpFlag = true; + } + if (tryCtx.result.isReturn) returnValue = tryCtx.result.value; + if (tryCtx.result.isThrow) { + error = tryCtx.result.error; + } + if (error != null) error.setCause(tryCtx.error); + continue; + } + } + } + + if (error != null) { + var caught = false; + + for (var frame : ctx.frames()) { + for (var tryCtx : frame.tryStack) { + if (tryCtx.state == TryState.TRY) caught = true; + } + } + + ctx.engine.onInstruction(ctx, this, instr, null, error, caught); + throw error; + } + if (returnValue != Runners.NO_RETURN) { + ctx.engine.onInstruction(ctx, this, instr, returnValue, null, false); + return returnValue; + } + + return Runners.NO_RETURN; + } + + public CodeFrame(Context ctx, Object thisArg, Object[] args, CodeFunction func) { + this.args = args.clone(); + this.scope = new LocalScope(func.localsN, func.captures); + this.scope.get(0).set(null, thisArg); + var argsObj = new ArrayValue(); + for (var i = 0; i < args.length; i++) { + argsObj.set(ctx, i, args[i]); + } + this.scope.get(1).value = argsObj; + + this.thisArg = thisArg; + this.function = func; + } +} diff --git a/src/me/topchetoeu/jscript/engine/frame/ConvertHint.java b/src/me/topchetoeu/jscript/engine/frame/ConvertHint.java index dcea46c..a9b425b 100644 --- a/src/me/topchetoeu/jscript/engine/frame/ConvertHint.java +++ b/src/me/topchetoeu/jscript/engine/frame/ConvertHint.java @@ -1,6 +1,6 @@ -package me.topchetoeu.jscript.engine.frame; - -public enum ConvertHint { - TOSTRING, - VALUEOF, +package me.topchetoeu.jscript.engine.frame; + +public enum ConvertHint { + TOSTRING, + VALUEOF, } \ No newline at end of file diff --git a/src/me/topchetoeu/jscript/engine/frame/InstructionResult.java b/src/me/topchetoeu/jscript/engine/frame/InstructionResult.java index 32e5caf..c6d0be5 100644 --- a/src/me/topchetoeu/jscript/engine/frame/InstructionResult.java +++ b/src/me/topchetoeu/jscript/engine/frame/InstructionResult.java @@ -1,9 +1,9 @@ -package me.topchetoeu.jscript.engine.frame; - -public class InstructionResult { - public final Object value; - - public InstructionResult(Object value) { - this.value = value; - } -} +package me.topchetoeu.jscript.engine.frame; + +public class InstructionResult { + public final Object value; + + public InstructionResult(Object value) { + this.value = value; + } +} diff --git a/src/me/topchetoeu/jscript/engine/frame/Runners.java b/src/me/topchetoeu/jscript/engine/frame/Runners.java index f2564fb..d889a20 100644 --- a/src/me/topchetoeu/jscript/engine/frame/Runners.java +++ b/src/me/topchetoeu/jscript/engine/frame/Runners.java @@ -1,350 +1,350 @@ -package me.topchetoeu.jscript.engine.frame; - -import java.util.Collections; - -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.Engine; -import me.topchetoeu.jscript.engine.Operation; -import me.topchetoeu.jscript.engine.scope.ValueVariable; -import me.topchetoeu.jscript.engine.values.ArrayValue; -import me.topchetoeu.jscript.engine.values.CodeFunction; -import me.topchetoeu.jscript.engine.values.ObjectValue; -import me.topchetoeu.jscript.engine.values.Symbol; -import me.topchetoeu.jscript.engine.values.Values; -import me.topchetoeu.jscript.exceptions.EngineException; - -public class Runners { - public static final Object NO_RETURN = new Object(); - - public static Object execReturn(Context ctx, Instruction instr, CodeFrame frame) { - return frame.pop(); - } - public static Object execThrow(Context ctx, Instruction instr, CodeFrame frame) { - throw new EngineException(frame.pop()); - } - public static Object execThrowSyntax(Context ctx, Instruction instr, CodeFrame frame) { - throw EngineException.ofSyntax((String)instr.get(0)); - } - - public static Object execCall(Context ctx, Instruction instr, CodeFrame frame) { - var callArgs = frame.take(instr.get(0)); - var func = frame.pop(); - var thisArg = frame.pop(); - - frame.push(ctx, Values.call(ctx, func, thisArg, callArgs)); - - frame.codePtr++; - return NO_RETURN; - } - public static Object execCallNew(Context ctx, Instruction instr, CodeFrame frame) { - var callArgs = frame.take(instr.get(0)); - var funcObj = frame.pop(); - - frame.push(ctx, Values.callNew(ctx, funcObj, callArgs)); - - frame.codePtr++; - return NO_RETURN; - } - - public static Object execMakeVar(Context ctx, Instruction instr, CodeFrame frame) { - var name = (String)instr.get(0); - ctx.environment().global.define(name); - frame.codePtr++; - return NO_RETURN; - } - public static Object execDefProp(Context ctx, Instruction instr, CodeFrame frame) { - var setter = frame.pop(); - var getter = frame.pop(); - var name = frame.pop(); - var obj = frame.pop(); - - if (getter != null && !Values.isFunction(getter)) throw EngineException.ofType("Getter must be a function or undefined."); - if (setter != null && !Values.isFunction(setter)) throw EngineException.ofType("Setter must be a function or undefined."); - if (!Values.isObject(obj)) throw EngineException.ofType("Property apply target must be an object."); - Values.object(obj).defineProperty(ctx, name, Values.function(getter), Values.function(setter), false, false); - - frame.push(ctx, obj); - frame.codePtr++; - return NO_RETURN; - } - public static Object execInstanceof(Context ctx, Instruction instr, CodeFrame frame) { - var type = frame.pop(); - var obj = frame.pop(); - - if (!Values.isPrimitive(type)) { - var proto = Values.getMember(ctx, type, "prototype"); - frame.push(ctx, Values.isInstanceOf(ctx, obj, proto)); - } - else { - frame.push(ctx, false); - } - - frame.codePtr++; - return NO_RETURN; - } - public static Object execKeys(Context ctx, Instruction instr, CodeFrame frame) { - var val = frame.pop(); - - var members = Values.getMembers(ctx, val, false, false); - Collections.reverse(members); - - frame.push(ctx, null); - - for (var el : members) { - if (el instanceof Symbol) continue; - var obj = new ObjectValue(); - obj.defineProperty(ctx, "value", el); - frame.push(ctx, obj); - } - - frame.codePtr++; - return NO_RETURN; - } - - public static Object execTryStart(Context ctx, Instruction instr, CodeFrame frame) { - int start = frame.codePtr + 1; - int catchStart = (int)instr.get(0); - int finallyStart = (int)instr.get(1); - if (finallyStart >= 0) finallyStart += start; - if (catchStart >= 0) catchStart += start; - int end = (int)instr.get(2) + start; - frame.addTry(start, end, catchStart, finallyStart); - frame.codePtr++; - return NO_RETURN; - } - public static Object execTryEnd(Context ctx, Instruction instr, CodeFrame frame) { - frame.popTryFlag = true; - return NO_RETURN; - } - - public static Object execDup(Context ctx, Instruction instr, CodeFrame frame) { - int count = instr.get(0); - - for (var i = 0; i < count; i++) { - frame.push(ctx, frame.peek(count - 1)); - } - - frame.codePtr++; - return NO_RETURN; - } - public static Object execLoadUndefined(Context ctx, Instruction instr, CodeFrame frame) { - frame.push(ctx, null); - frame.codePtr++; - return NO_RETURN; - } - public static Object execLoadValue(Context ctx, Instruction instr, CodeFrame frame) { - frame.push(ctx, instr.get(0)); - frame.codePtr++; - return NO_RETURN; - } - public static Object execLoadVar(Context ctx, Instruction instr, CodeFrame frame) { - var i = instr.get(0); - - if (i instanceof String) frame.push(ctx, ctx.environment().global.get(ctx, (String)i)); - else frame.push(ctx, frame.scope.get((int)i).get(ctx)); - - frame.codePtr++; - return NO_RETURN; - } - public static Object execLoadObj(Context ctx, Instruction instr, CodeFrame frame) { - frame.push(ctx, new ObjectValue()); - frame.codePtr++; - return NO_RETURN; - } - public static Object execLoadGlob(Context ctx, Instruction instr, CodeFrame frame) { - frame.push(ctx, ctx.environment().global.obj); - frame.codePtr++; - return NO_RETURN; - } - public static Object execLoadArr(Context ctx, Instruction instr, CodeFrame frame) { - var res = new ArrayValue(); - res.setSize(instr.get(0)); - frame.push(ctx, res); - frame.codePtr++; - return NO_RETURN; - } - public static Object execLoadFunc(Context ctx, Instruction instr, CodeFrame frame) { - long id = (Long)instr.get(0); - var captures = new ValueVariable[instr.params.length - 1]; - - for (var i = 1; i < instr.params.length; i++) { - captures[i - 1] = frame.scope.get(instr.get(i)); - } - - var func = new CodeFunction(ctx.environment(), "", Engine.functions.get(id), captures); - - frame.push(ctx, func); - - frame.codePtr++; - return NO_RETURN; - } - public static Object execLoadMember(Context ctx, Instruction instr, CodeFrame frame) { - var key = frame.pop(); - var obj = frame.pop(); - - try { - frame.push(ctx, Values.getMember(ctx, obj, key)); - } - catch (IllegalArgumentException e) { - throw EngineException.ofType(e.getMessage()); - } - frame.codePtr++; - return NO_RETURN; - } - public static Object execLoadKeyMember(Context ctx, Instruction instr, CodeFrame frame) { - frame.push(ctx, instr.get(0)); - return execLoadMember(ctx, instr, frame); - } - public static Object execLoadRegEx(Context ctx, Instruction instr, CodeFrame frame) { - frame.push(ctx, ctx.environment().regexConstructor.call(ctx, null, instr.get(0), instr.get(1))); - frame.codePtr++; - return NO_RETURN; - } - - public static Object execDiscard(Context ctx, Instruction instr, CodeFrame frame) { - frame.pop(); - frame.codePtr++; - return NO_RETURN; - } - public static Object execStoreMember(Context ctx, Instruction instr, CodeFrame frame) { - var val = frame.pop(); - var key = frame.pop(); - var obj = frame.pop(); - - if (!Values.setMember(ctx, obj, key, val)) throw EngineException.ofSyntax("Can't set member '" + key + "'."); - if ((boolean)instr.get(0)) frame.push(ctx, val); - frame.codePtr++; - return NO_RETURN; - } - public static Object execStoreVar(Context ctx, Instruction instr, CodeFrame frame) { - var val = (boolean)instr.get(1) ? frame.peek() : frame.pop(); - var i = instr.get(0); - - if (i instanceof String) ctx.environment().global.set(ctx, (String)i, val); - else frame.scope.get((int)i).set(ctx, val); - - frame.codePtr++; - return NO_RETURN; - } - public static Object execStoreSelfFunc(Context ctx, Instruction instr, CodeFrame frame) { - frame.scope.locals[(int)instr.get(0)].set(ctx, frame.function); - frame.codePtr++; - return NO_RETURN; - } - - public static Object execJmp(Context ctx, Instruction instr, CodeFrame frame) { - frame.codePtr += (int)instr.get(0); - frame.jumpFlag = true; - return NO_RETURN; - } - public static Object execJmpIf(Context ctx, Instruction instr, CodeFrame frame) { - if (Values.toBoolean(frame.pop())) { - frame.codePtr += (int)instr.get(0); - frame.jumpFlag = true; - } - else frame.codePtr ++; - return NO_RETURN; - } - public static Object execJmpIfNot(Context ctx, Instruction instr, CodeFrame frame) { - if (Values.not(frame.pop())) { - frame.codePtr += (int)instr.get(0); - frame.jumpFlag = true; - } - else frame.codePtr ++; - return NO_RETURN; - } - - public static Object execIn(Context ctx, Instruction instr, CodeFrame frame) { - var obj = frame.pop(); - var index = frame.pop(); - - frame.push(ctx, Values.hasMember(ctx, obj, index, false)); - frame.codePtr++; - return NO_RETURN; - } - public static Object execTypeof(Context ctx, Instruction instr, CodeFrame frame) { - String name = instr.get(0); - Object obj; - - if (name != null) { - if (ctx.environment().global.has(ctx, name)) { - obj = ctx.environment().global.get(ctx, name); - } - else obj = null; - } - else obj = frame.pop(); - - frame.push(ctx, Values.type(obj)); - - frame.codePtr++; - return NO_RETURN; - } - public static Object execNop(Context ctx, Instruction instr, CodeFrame frame) { - frame.codePtr++; - return NO_RETURN; - } - - public static Object execDelete(Context ctx, Instruction instr, CodeFrame frame) { - var key = frame.pop(); - var val = frame.pop(); - - if (!Values.deleteMember(ctx, val, key)) throw EngineException.ofSyntax("Can't delete member '" + key + "'."); - frame.codePtr++; - return NO_RETURN; - } - - public static Object execOperation(Context ctx, Instruction instr, CodeFrame frame) { - Operation op = instr.get(0); - var args = new Object[op.operands]; - - for (var i = op.operands - 1; i >= 0; i--) args[i] = frame.pop(); - - frame.push(ctx, Values.operation(ctx, op, args)); - frame.codePtr++; - return NO_RETURN; - } - - public static Object exec(Context ctx, Instruction instr, CodeFrame frame) { - switch (instr.type) { - case NOP: return execNop(ctx, instr, frame); - case RETURN: return execReturn(ctx, instr, frame); - case THROW: return execThrow(ctx, instr, frame); - case THROW_SYNTAX: return execThrowSyntax(ctx, instr, frame); - case CALL: return execCall(ctx, instr, frame); - case CALL_NEW: return execCallNew(ctx, instr, frame); - case TRY_START: return execTryStart(ctx, instr, frame); - case TRY_END: return execTryEnd(ctx, instr, frame); - - case DUP: return execDup(ctx, instr, frame); - case LOAD_VALUE: return execLoadValue(ctx, instr, frame); - case LOAD_VAR: return execLoadVar(ctx, instr, frame); - case LOAD_OBJ: return execLoadObj(ctx, instr, frame); - case LOAD_ARR: return execLoadArr(ctx, instr, frame); - case LOAD_FUNC: return execLoadFunc(ctx, instr, frame); - case LOAD_MEMBER: return execLoadMember(ctx, instr, frame); - case LOAD_VAL_MEMBER: return execLoadKeyMember(ctx, instr, frame); - case LOAD_REGEX: return execLoadRegEx(ctx, instr, frame); - case LOAD_GLOB: return execLoadGlob(ctx, instr, frame); - - case DISCARD: return execDiscard(ctx, instr, frame); - case STORE_MEMBER: return execStoreMember(ctx, instr, frame); - case STORE_VAR: return execStoreVar(ctx, instr, frame); - case STORE_SELF_FUNC: return execStoreSelfFunc(ctx, instr, frame); - case MAKE_VAR: return execMakeVar(ctx, instr, frame); - - case KEYS: return execKeys(ctx, instr, frame); - case DEF_PROP: return execDefProp(ctx, instr, frame); - case TYPEOF: return execTypeof(ctx, instr, frame); - case DELETE: return execDelete(ctx, instr, frame); - - case JMP: return execJmp(ctx, instr, frame); - case JMP_IF: return execJmpIf(ctx, instr, frame); - case JMP_IFN: return execJmpIfNot(ctx, instr, frame); - - case OPERATION: return execOperation(ctx, instr, frame); - - default: throw EngineException.ofSyntax("Invalid instruction " + instr.type.name() + "."); - } - } -} +package me.topchetoeu.jscript.engine.frame; + +import java.util.Collections; + +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.Engine; +import me.topchetoeu.jscript.engine.Operation; +import me.topchetoeu.jscript.engine.scope.ValueVariable; +import me.topchetoeu.jscript.engine.values.ArrayValue; +import me.topchetoeu.jscript.engine.values.CodeFunction; +import me.topchetoeu.jscript.engine.values.ObjectValue; +import me.topchetoeu.jscript.engine.values.Symbol; +import me.topchetoeu.jscript.engine.values.Values; +import me.topchetoeu.jscript.exceptions.EngineException; + +public class Runners { + public static final Object NO_RETURN = new Object(); + + public static Object execReturn(Context ctx, Instruction instr, CodeFrame frame) { + return frame.pop(); + } + public static Object execThrow(Context ctx, Instruction instr, CodeFrame frame) { + throw new EngineException(frame.pop()); + } + public static Object execThrowSyntax(Context ctx, Instruction instr, CodeFrame frame) { + throw EngineException.ofSyntax((String)instr.get(0)); + } + + public static Object execCall(Context ctx, Instruction instr, CodeFrame frame) { + var callArgs = frame.take(instr.get(0)); + var func = frame.pop(); + var thisArg = frame.pop(); + + frame.push(ctx, Values.call(ctx, func, thisArg, callArgs)); + + frame.codePtr++; + return NO_RETURN; + } + public static Object execCallNew(Context ctx, Instruction instr, CodeFrame frame) { + var callArgs = frame.take(instr.get(0)); + var funcObj = frame.pop(); + + frame.push(ctx, Values.callNew(ctx, funcObj, callArgs)); + + frame.codePtr++; + return NO_RETURN; + } + + public static Object execMakeVar(Context ctx, Instruction instr, CodeFrame frame) { + var name = (String)instr.get(0); + ctx.environment().global.define(name); + frame.codePtr++; + return NO_RETURN; + } + public static Object execDefProp(Context ctx, Instruction instr, CodeFrame frame) { + var setter = frame.pop(); + var getter = frame.pop(); + var name = frame.pop(); + var obj = frame.pop(); + + if (getter != null && !Values.isFunction(getter)) throw EngineException.ofType("Getter must be a function or undefined."); + if (setter != null && !Values.isFunction(setter)) throw EngineException.ofType("Setter must be a function or undefined."); + if (!Values.isObject(obj)) throw EngineException.ofType("Property apply target must be an object."); + Values.object(obj).defineProperty(ctx, name, Values.function(getter), Values.function(setter), false, false); + + frame.push(ctx, obj); + frame.codePtr++; + return NO_RETURN; + } + public static Object execInstanceof(Context ctx, Instruction instr, CodeFrame frame) { + var type = frame.pop(); + var obj = frame.pop(); + + if (!Values.isPrimitive(type)) { + var proto = Values.getMember(ctx, type, "prototype"); + frame.push(ctx, Values.isInstanceOf(ctx, obj, proto)); + } + else { + frame.push(ctx, false); + } + + frame.codePtr++; + return NO_RETURN; + } + public static Object execKeys(Context ctx, Instruction instr, CodeFrame frame) { + var val = frame.pop(); + + var members = Values.getMembers(ctx, val, false, false); + Collections.reverse(members); + + frame.push(ctx, null); + + for (var el : members) { + if (el instanceof Symbol) continue; + var obj = new ObjectValue(); + obj.defineProperty(ctx, "value", el); + frame.push(ctx, obj); + } + + frame.codePtr++; + return NO_RETURN; + } + + public static Object execTryStart(Context ctx, Instruction instr, CodeFrame frame) { + int start = frame.codePtr + 1; + int catchStart = (int)instr.get(0); + int finallyStart = (int)instr.get(1); + if (finallyStart >= 0) finallyStart += start; + if (catchStart >= 0) catchStart += start; + int end = (int)instr.get(2) + start; + frame.addTry(start, end, catchStart, finallyStart); + frame.codePtr++; + return NO_RETURN; + } + public static Object execTryEnd(Context ctx, Instruction instr, CodeFrame frame) { + frame.popTryFlag = true; + return NO_RETURN; + } + + public static Object execDup(Context ctx, Instruction instr, CodeFrame frame) { + int count = instr.get(0); + + for (var i = 0; i < count; i++) { + frame.push(ctx, frame.peek(count - 1)); + } + + frame.codePtr++; + return NO_RETURN; + } + public static Object execLoadUndefined(Context ctx, Instruction instr, CodeFrame frame) { + frame.push(ctx, null); + frame.codePtr++; + return NO_RETURN; + } + public static Object execLoadValue(Context ctx, Instruction instr, CodeFrame frame) { + frame.push(ctx, instr.get(0)); + frame.codePtr++; + return NO_RETURN; + } + public static Object execLoadVar(Context ctx, Instruction instr, CodeFrame frame) { + var i = instr.get(0); + + if (i instanceof String) frame.push(ctx, ctx.environment().global.get(ctx, (String)i)); + else frame.push(ctx, frame.scope.get((int)i).get(ctx)); + + frame.codePtr++; + return NO_RETURN; + } + public static Object execLoadObj(Context ctx, Instruction instr, CodeFrame frame) { + frame.push(ctx, new ObjectValue()); + frame.codePtr++; + return NO_RETURN; + } + public static Object execLoadGlob(Context ctx, Instruction instr, CodeFrame frame) { + frame.push(ctx, ctx.environment().global.obj); + frame.codePtr++; + return NO_RETURN; + } + public static Object execLoadArr(Context ctx, Instruction instr, CodeFrame frame) { + var res = new ArrayValue(); + res.setSize(instr.get(0)); + frame.push(ctx, res); + frame.codePtr++; + return NO_RETURN; + } + public static Object execLoadFunc(Context ctx, Instruction instr, CodeFrame frame) { + long id = (Long)instr.get(0); + var captures = new ValueVariable[instr.params.length - 1]; + + for (var i = 1; i < instr.params.length; i++) { + captures[i - 1] = frame.scope.get(instr.get(i)); + } + + var func = new CodeFunction(ctx.environment(), "", Engine.functions.get(id), captures); + + frame.push(ctx, func); + + frame.codePtr++; + return NO_RETURN; + } + public static Object execLoadMember(Context ctx, Instruction instr, CodeFrame frame) { + var key = frame.pop(); + var obj = frame.pop(); + + try { + frame.push(ctx, Values.getMember(ctx, obj, key)); + } + catch (IllegalArgumentException e) { + throw EngineException.ofType(e.getMessage()); + } + frame.codePtr++; + return NO_RETURN; + } + public static Object execLoadKeyMember(Context ctx, Instruction instr, CodeFrame frame) { + frame.push(ctx, instr.get(0)); + return execLoadMember(ctx, instr, frame); + } + public static Object execLoadRegEx(Context ctx, Instruction instr, CodeFrame frame) { + frame.push(ctx, ctx.environment().regexConstructor.call(ctx, null, instr.get(0), instr.get(1))); + frame.codePtr++; + return NO_RETURN; + } + + public static Object execDiscard(Context ctx, Instruction instr, CodeFrame frame) { + frame.pop(); + frame.codePtr++; + return NO_RETURN; + } + public static Object execStoreMember(Context ctx, Instruction instr, CodeFrame frame) { + var val = frame.pop(); + var key = frame.pop(); + var obj = frame.pop(); + + if (!Values.setMember(ctx, obj, key, val)) throw EngineException.ofSyntax("Can't set member '" + key + "'."); + if ((boolean)instr.get(0)) frame.push(ctx, val); + frame.codePtr++; + return NO_RETURN; + } + public static Object execStoreVar(Context ctx, Instruction instr, CodeFrame frame) { + var val = (boolean)instr.get(1) ? frame.peek() : frame.pop(); + var i = instr.get(0); + + if (i instanceof String) ctx.environment().global.set(ctx, (String)i, val); + else frame.scope.get((int)i).set(ctx, val); + + frame.codePtr++; + return NO_RETURN; + } + public static Object execStoreSelfFunc(Context ctx, Instruction instr, CodeFrame frame) { + frame.scope.locals[(int)instr.get(0)].set(ctx, frame.function); + frame.codePtr++; + return NO_RETURN; + } + + public static Object execJmp(Context ctx, Instruction instr, CodeFrame frame) { + frame.codePtr += (int)instr.get(0); + frame.jumpFlag = true; + return NO_RETURN; + } + public static Object execJmpIf(Context ctx, Instruction instr, CodeFrame frame) { + if (Values.toBoolean(frame.pop())) { + frame.codePtr += (int)instr.get(0); + frame.jumpFlag = true; + } + else frame.codePtr ++; + return NO_RETURN; + } + public static Object execJmpIfNot(Context ctx, Instruction instr, CodeFrame frame) { + if (Values.not(frame.pop())) { + frame.codePtr += (int)instr.get(0); + frame.jumpFlag = true; + } + else frame.codePtr ++; + return NO_RETURN; + } + + public static Object execIn(Context ctx, Instruction instr, CodeFrame frame) { + var obj = frame.pop(); + var index = frame.pop(); + + frame.push(ctx, Values.hasMember(ctx, obj, index, false)); + frame.codePtr++; + return NO_RETURN; + } + public static Object execTypeof(Context ctx, Instruction instr, CodeFrame frame) { + String name = instr.get(0); + Object obj; + + if (name != null) { + if (ctx.environment().global.has(ctx, name)) { + obj = ctx.environment().global.get(ctx, name); + } + else obj = null; + } + else obj = frame.pop(); + + frame.push(ctx, Values.type(obj)); + + frame.codePtr++; + return NO_RETURN; + } + public static Object execNop(Context ctx, Instruction instr, CodeFrame frame) { + frame.codePtr++; + return NO_RETURN; + } + + public static Object execDelete(Context ctx, Instruction instr, CodeFrame frame) { + var key = frame.pop(); + var val = frame.pop(); + + if (!Values.deleteMember(ctx, val, key)) throw EngineException.ofSyntax("Can't delete member '" + key + "'."); + frame.codePtr++; + return NO_RETURN; + } + + public static Object execOperation(Context ctx, Instruction instr, CodeFrame frame) { + Operation op = instr.get(0); + var args = new Object[op.operands]; + + for (var i = op.operands - 1; i >= 0; i--) args[i] = frame.pop(); + + frame.push(ctx, Values.operation(ctx, op, args)); + frame.codePtr++; + return NO_RETURN; + } + + public static Object exec(Context ctx, Instruction instr, CodeFrame frame) { + switch (instr.type) { + case NOP: return execNop(ctx, instr, frame); + case RETURN: return execReturn(ctx, instr, frame); + case THROW: return execThrow(ctx, instr, frame); + case THROW_SYNTAX: return execThrowSyntax(ctx, instr, frame); + case CALL: return execCall(ctx, instr, frame); + case CALL_NEW: return execCallNew(ctx, instr, frame); + case TRY_START: return execTryStart(ctx, instr, frame); + case TRY_END: return execTryEnd(ctx, instr, frame); + + case DUP: return execDup(ctx, instr, frame); + case LOAD_VALUE: return execLoadValue(ctx, instr, frame); + case LOAD_VAR: return execLoadVar(ctx, instr, frame); + case LOAD_OBJ: return execLoadObj(ctx, instr, frame); + case LOAD_ARR: return execLoadArr(ctx, instr, frame); + case LOAD_FUNC: return execLoadFunc(ctx, instr, frame); + case LOAD_MEMBER: return execLoadMember(ctx, instr, frame); + case LOAD_VAL_MEMBER: return execLoadKeyMember(ctx, instr, frame); + case LOAD_REGEX: return execLoadRegEx(ctx, instr, frame); + case LOAD_GLOB: return execLoadGlob(ctx, instr, frame); + + case DISCARD: return execDiscard(ctx, instr, frame); + case STORE_MEMBER: return execStoreMember(ctx, instr, frame); + case STORE_VAR: return execStoreVar(ctx, instr, frame); + case STORE_SELF_FUNC: return execStoreSelfFunc(ctx, instr, frame); + case MAKE_VAR: return execMakeVar(ctx, instr, frame); + + case KEYS: return execKeys(ctx, instr, frame); + case DEF_PROP: return execDefProp(ctx, instr, frame); + case TYPEOF: return execTypeof(ctx, instr, frame); + case DELETE: return execDelete(ctx, instr, frame); + + case JMP: return execJmp(ctx, instr, frame); + case JMP_IF: return execJmpIf(ctx, instr, frame); + case JMP_IFN: return execJmpIfNot(ctx, instr, frame); + + case OPERATION: return execOperation(ctx, instr, frame); + + default: throw EngineException.ofSyntax("Invalid instruction " + instr.type.name() + "."); + } + } +} diff --git a/src/me/topchetoeu/jscript/engine/scope/GlobalScope.java b/src/me/topchetoeu/jscript/engine/scope/GlobalScope.java index f1ab188..3590362 100644 --- a/src/me/topchetoeu/jscript/engine/scope/GlobalScope.java +++ b/src/me/topchetoeu/jscript/engine/scope/GlobalScope.java @@ -1,78 +1,78 @@ -package me.topchetoeu.jscript.engine.scope; - -import java.util.HashSet; -import java.util.Set; - -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.values.FunctionValue; -import me.topchetoeu.jscript.engine.values.NativeFunction; -import me.topchetoeu.jscript.engine.values.ObjectValue; -import me.topchetoeu.jscript.exceptions.EngineException; - -public class GlobalScope implements ScopeRecord { - public final ObjectValue obj; - - public boolean has(Context ctx, String name) { - return obj.hasMember(ctx, name, false); - } - public Object getKey(String name) { - return name; - } - - public GlobalScope globalChild() { - var obj = new ObjectValue(); - obj.setPrototype(null, this.obj); - return new GlobalScope(obj); - } - public LocalScopeRecord child() { - return new LocalScopeRecord(); - } - - public Object define(String name) { - if (obj.hasMember(null, name, true)) return name; - obj.defineProperty(null, name, null); - return name; - } - public void define(String name, Variable val) { - obj.defineProperty(null, name, - new NativeFunction("get " + name, (ctx, th, a) -> val.get(ctx)), - new NativeFunction("set " + name, (ctx, th, args) -> { val.set(ctx, args.length > 0 ? args[0] : null); return null; }), - true, true - ); - } - public void define(Context ctx, String name, boolean readonly, Object val) { - obj.defineProperty(ctx, name, val, readonly, true, true); - } - public void define(String ...names) { - for (var n : names) define(n); - } - public void define(boolean readonly, FunctionValue val) { - define(null, val.name, readonly, val); - } - - public Object get(Context ctx, String name) { - if (!obj.hasMember(ctx, name, false)) throw EngineException.ofSyntax("The variable '" + name + "' doesn't exist."); - else return obj.getMember(ctx, name); - } - public void set(Context ctx, String name, Object val) { - if (!obj.hasMember(ctx, name, false)) throw EngineException.ofSyntax("The variable '" + name + "' doesn't exist."); - if (!obj.setMember(ctx, name, val, false)) throw EngineException.ofSyntax("The global '" + name + "' is readonly."); - } - - public Set keys() { - var res = new HashSet(); - - for (var key : keys()) { - if (key instanceof String) res.add((String)key); - } - - return res; - } - - public GlobalScope() { - this.obj = new ObjectValue(); - } - public GlobalScope(ObjectValue val) { - this.obj = val; - } -} +package me.topchetoeu.jscript.engine.scope; + +import java.util.HashSet; +import java.util.Set; + +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.values.FunctionValue; +import me.topchetoeu.jscript.engine.values.NativeFunction; +import me.topchetoeu.jscript.engine.values.ObjectValue; +import me.topchetoeu.jscript.exceptions.EngineException; + +public class GlobalScope implements ScopeRecord { + public final ObjectValue obj; + + public boolean has(Context ctx, String name) { + return obj.hasMember(ctx, name, false); + } + public Object getKey(String name) { + return name; + } + + public GlobalScope globalChild() { + var obj = new ObjectValue(); + obj.setPrototype(null, this.obj); + return new GlobalScope(obj); + } + public LocalScopeRecord child() { + return new LocalScopeRecord(); + } + + public Object define(String name) { + if (obj.hasMember(null, name, true)) return name; + obj.defineProperty(null, name, null); + return name; + } + public void define(String name, Variable val) { + obj.defineProperty(null, name, + new NativeFunction("get " + name, (ctx, th, a) -> val.get(ctx)), + new NativeFunction("set " + name, (ctx, th, args) -> { val.set(ctx, args.length > 0 ? args[0] : null); return null; }), + true, true + ); + } + public void define(Context ctx, String name, boolean readonly, Object val) { + obj.defineProperty(ctx, name, val, readonly, true, true); + } + public void define(String ...names) { + for (var n : names) define(n); + } + public void define(boolean readonly, FunctionValue val) { + define(null, val.name, readonly, val); + } + + public Object get(Context ctx, String name) { + if (!obj.hasMember(ctx, name, false)) throw EngineException.ofSyntax("The variable '" + name + "' doesn't exist."); + else return obj.getMember(ctx, name); + } + public void set(Context ctx, String name, Object val) { + if (!obj.hasMember(ctx, name, false)) throw EngineException.ofSyntax("The variable '" + name + "' doesn't exist."); + if (!obj.setMember(ctx, name, val, false)) throw EngineException.ofSyntax("The global '" + name + "' is readonly."); + } + + public Set keys() { + var res = new HashSet(); + + for (var key : keys()) { + if (key instanceof String) res.add((String)key); + } + + return res; + } + + public GlobalScope() { + this.obj = new ObjectValue(); + } + public GlobalScope(ObjectValue val) { + this.obj = val; + } +} diff --git a/src/me/topchetoeu/jscript/engine/scope/LocalScope.java b/src/me/topchetoeu/jscript/engine/scope/LocalScope.java index 41b484b..2ed3075 100644 --- a/src/me/topchetoeu/jscript/engine/scope/LocalScope.java +++ b/src/me/topchetoeu/jscript/engine/scope/LocalScope.java @@ -1,29 +1,29 @@ -package me.topchetoeu.jscript.engine.scope; - -import java.util.ArrayList; - -public class LocalScope { - public final ValueVariable[] captures; - public final ValueVariable[] locals; - public final ArrayList catchVars = new ArrayList<>(); - - public ValueVariable get(int i) { - if (i >= locals.length) return catchVars.get(i - locals.length); - if (i >= 0) return locals[i]; - else return captures[~i]; - } - - - public int size() { - return captures.length + locals.length; - } - - public LocalScope(int n, ValueVariable[] captures) { - locals = new ValueVariable[n]; - this.captures = captures; - - for (int i = 0; i < n; i++) { - locals[i] = new ValueVariable(false, null); - } - } -} +package me.topchetoeu.jscript.engine.scope; + +import java.util.ArrayList; + +public class LocalScope { + public final ValueVariable[] captures; + public final ValueVariable[] locals; + public final ArrayList catchVars = new ArrayList<>(); + + public ValueVariable get(int i) { + if (i >= locals.length) return catchVars.get(i - locals.length); + if (i >= 0) return locals[i]; + else return captures[~i]; + } + + + public int size() { + return captures.length + locals.length; + } + + public LocalScope(int n, ValueVariable[] captures) { + locals = new ValueVariable[n]; + this.captures = captures; + + for (int i = 0; i < n; i++) { + locals[i] = new ValueVariable(false, null); + } + } +} diff --git a/src/me/topchetoeu/jscript/engine/scope/LocalScopeRecord.java b/src/me/topchetoeu/jscript/engine/scope/LocalScopeRecord.java index d1c65e4..e1889ee 100644 --- a/src/me/topchetoeu/jscript/engine/scope/LocalScopeRecord.java +++ b/src/me/topchetoeu/jscript/engine/scope/LocalScopeRecord.java @@ -1,77 +1,77 @@ -package me.topchetoeu.jscript.engine.scope; - -import java.util.ArrayList; - -public class LocalScopeRecord implements ScopeRecord { - public final LocalScopeRecord parent; - - private final ArrayList captures = new ArrayList<>(); - private final ArrayList locals = new ArrayList<>(); - - public String[] captures() { - return captures.toArray(String[]::new); - } - public String[] locals() { - return locals.toArray(String[]::new); - } - - public LocalScopeRecord child() { - return new LocalScopeRecord(this); - } - - public int localsCount() { - return locals.size(); - } - public int capturesCount() { - return captures.size(); - } - - public int[] getCaptures() { - var buff = new int[captures.size()]; - var i = 0; - - for (var name : captures) { - var index = parent.getKey(name); - if (index instanceof Integer) buff[i++] = (int)index; - } - - var res = new int[i]; - System.arraycopy(buff, 0, res, 0, i); - - return res; - } - - public Object getKey(String name) { - var capI = captures.indexOf(name); - var locI = locals.lastIndexOf(name); - if (locI >= 0) return locI; - if (capI >= 0) return ~capI; - if (parent != null) { - var res = parent.getKey(name); - if (res != null && res instanceof Integer) { - captures.add(name); - return -captures.size(); - } - } - - return name; - } - public Object define(String name, boolean force) { - if (!force && locals.contains(name)) return locals.indexOf(name); - locals.add(name); - return locals.size() - 1; - } - public Object define(String name) { - return define(name, false); - } - public void undefine() { - locals.remove(locals.size() - 1); - } - - public LocalScopeRecord() { - this.parent = null; - } - public LocalScopeRecord(LocalScopeRecord parent) { - this.parent = parent; - } -} +package me.topchetoeu.jscript.engine.scope; + +import java.util.ArrayList; + +public class LocalScopeRecord implements ScopeRecord { + public final LocalScopeRecord parent; + + private final ArrayList captures = new ArrayList<>(); + private final ArrayList locals = new ArrayList<>(); + + public String[] captures() { + return captures.toArray(String[]::new); + } + public String[] locals() { + return locals.toArray(String[]::new); + } + + public LocalScopeRecord child() { + return new LocalScopeRecord(this); + } + + public int localsCount() { + return locals.size(); + } + public int capturesCount() { + return captures.size(); + } + + public int[] getCaptures() { + var buff = new int[captures.size()]; + var i = 0; + + for (var name : captures) { + var index = parent.getKey(name); + if (index instanceof Integer) buff[i++] = (int)index; + } + + var res = new int[i]; + System.arraycopy(buff, 0, res, 0, i); + + return res; + } + + public Object getKey(String name) { + var capI = captures.indexOf(name); + var locI = locals.lastIndexOf(name); + if (locI >= 0) return locI; + if (capI >= 0) return ~capI; + if (parent != null) { + var res = parent.getKey(name); + if (res != null && res instanceof Integer) { + captures.add(name); + return -captures.size(); + } + } + + return name; + } + public Object define(String name, boolean force) { + if (!force && locals.contains(name)) return locals.indexOf(name); + locals.add(name); + return locals.size() - 1; + } + public Object define(String name) { + return define(name, false); + } + public void undefine() { + locals.remove(locals.size() - 1); + } + + public LocalScopeRecord() { + this.parent = null; + } + public LocalScopeRecord(LocalScopeRecord parent) { + this.parent = parent; + } +} diff --git a/src/me/topchetoeu/jscript/engine/scope/ScopeRecord.java b/src/me/topchetoeu/jscript/engine/scope/ScopeRecord.java index fe4d5d3..88c0c93 100644 --- a/src/me/topchetoeu/jscript/engine/scope/ScopeRecord.java +++ b/src/me/topchetoeu/jscript/engine/scope/ScopeRecord.java @@ -1,7 +1,7 @@ -package me.topchetoeu.jscript.engine.scope; - -public interface ScopeRecord { - public Object getKey(String name); - public Object define(String name); - public LocalScopeRecord child(); -} +package me.topchetoeu.jscript.engine.scope; + +public interface ScopeRecord { + public Object getKey(String name); + public Object define(String name); + public LocalScopeRecord child(); +} diff --git a/src/me/topchetoeu/jscript/engine/scope/ValueVariable.java b/src/me/topchetoeu/jscript/engine/scope/ValueVariable.java index 8a6797c..bf25b0d 100644 --- a/src/me/topchetoeu/jscript/engine/scope/ValueVariable.java +++ b/src/me/topchetoeu/jscript/engine/scope/ValueVariable.java @@ -1,28 +1,28 @@ -package me.topchetoeu.jscript.engine.scope; - -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.values.Values; - -public class ValueVariable implements Variable { - public boolean readonly; - public Object value; - - @Override - public boolean readonly() { return readonly; } - - @Override - public Object get(Context ctx) { - return value; - } - - @Override - public void set(Context ctx, Object val) { - if (readonly) return; - this.value = Values.normalize(ctx, val); - } - - public ValueVariable(boolean readonly, Object val) { - this.readonly = readonly; - this.value = val; - } -} +package me.topchetoeu.jscript.engine.scope; + +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.values.Values; + +public class ValueVariable implements Variable { + public boolean readonly; + public Object value; + + @Override + public boolean readonly() { return readonly; } + + @Override + public Object get(Context ctx) { + return value; + } + + @Override + public void set(Context ctx, Object val) { + if (readonly) return; + this.value = Values.normalize(ctx, val); + } + + public ValueVariable(boolean readonly, Object val) { + this.readonly = readonly; + this.value = val; + } +} diff --git a/src/me/topchetoeu/jscript/engine/scope/Variable.java b/src/me/topchetoeu/jscript/engine/scope/Variable.java index 8715bd0..f211609 100644 --- a/src/me/topchetoeu/jscript/engine/scope/Variable.java +++ b/src/me/topchetoeu/jscript/engine/scope/Variable.java @@ -1,9 +1,9 @@ -package me.topchetoeu.jscript.engine.scope; - -import me.topchetoeu.jscript.engine.Context; - -public interface Variable { - Object get(Context ctx); - default boolean readonly() { return true; } - default void set(Context ctx, Object val) { } -} +package me.topchetoeu.jscript.engine.scope; + +import me.topchetoeu.jscript.engine.Context; + +public interface Variable { + Object get(Context ctx); + default boolean readonly() { return true; } + default void set(Context ctx, Object val) { } +} diff --git a/src/me/topchetoeu/jscript/engine/values/ArrayValue.java b/src/me/topchetoeu/jscript/engine/values/ArrayValue.java index 539fdf0..7a99b76 100644 --- a/src/me/topchetoeu/jscript/engine/values/ArrayValue.java +++ b/src/me/topchetoeu/jscript/engine/values/ArrayValue.java @@ -1,220 +1,220 @@ -package me.topchetoeu.jscript.engine.values; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; - -import me.topchetoeu.jscript.engine.Context; - -// TODO: Make methods generic -public class ArrayValue extends ObjectValue implements Iterable { - private static final Object UNDEFINED = new Object(); - private Object[] values; - private int size; - - private Object[] alloc(int index) { - index++; - if (index < values.length) return values; - if (index < values.length * 2) index = values.length * 2; - - var arr = new Object[index]; - System.arraycopy(values, 0, arr, 0, values.length); - return arr; - } - - public int size() { return size; } - public boolean setSize(int val) { - if (val < 0) return false; - if (size > val) shrink(size - val); - else { - values = alloc(val); - size = val; - } - return true; - } - - public Object get(int i) { - if (i < 0 || i >= size) return null; - var res = values[i]; - if (res == UNDEFINED) return null; - else return res; - } - public void set(Context ctx, int i, Object val) { - if (i < 0) return; - - values = alloc(i); - - val = Values.normalize(ctx, val); - if (val == null) val = UNDEFINED; - values[i] = val; - if (i >= size) size = i + 1; - } - public boolean has(int i) { - return i >= 0 && i < size && values[i] != null; - } - public void remove(int i) { - if (i < 0 || i >= values.length) return; - values[i] = null; - } - public void shrink(int n) { - if (n >= values.length) { - values = new Object[16]; - size = 0; - } - else { - for (int i = 0; i < n; i++) { - values[--size] = null; - } - } - } - - public Object[] toArray() { - Object[] res = new Object[size]; - copyTo(res, 0, 0, size); - return res; - } - public void copyTo(Object[] arr, int sourceStart, int destStart, int count) { - for (var i = 0; i < count; i++) { - if (i + sourceStart < 0 || i + sourceStart >= size) arr[i + destStart] = null; - if (values[i + sourceStart] == UNDEFINED) arr[i + destStart] = null; - else arr[i + sourceStart] = values[i + destStart]; - } - } - public void copyTo(Context ctx, ArrayValue arr, int sourceStart, int destStart, int count) { - // Iterate in reverse to reallocate at most once - for (var i = count - 1; i >= 0; i--) { - if (i + sourceStart < 0 || i + sourceStart >= size) arr.remove(i + destStart); - if (values[i + sourceStart] == UNDEFINED) arr.set(ctx, i + destStart, null); - else if (values[i + sourceStart] == null) arr.remove(i + destStart); - else arr.set(ctx, i + destStart, values[i + sourceStart]); - } - } - - public void copyFrom(Context ctx, Object[] arr, int sourceStart, int destStart, int count) { - for (var i = 0; i < count; i++) { - set(ctx, i + destStart, arr[i + sourceStart]); - } - } - - public void move(int srcI, int dstI, int n) { - values = alloc(dstI + n); - - System.arraycopy(values, srcI, values, dstI, n); - - if (dstI + n >= size) size = dstI + n; - } - - public void sort(Comparator comparator) { - Arrays.sort(values, 0, size, (a, b) -> { - var _a = 0; - var _b = 0; - - if (a == UNDEFINED) _a = 1; - if (a == null) _a = 2; - - if (b == UNDEFINED) _b = 1; - if (b == null) _b = 2; - - if (_a != 0 || _b != 0) return Integer.compare(_a, _b); - - return comparator.compare(a, b); - }); - } - - @Override - protected Object getField(Context ctx, Object key) { - if (key instanceof Number) { - var i = ((Number)key).doubleValue(); - if (i >= 0 && i - Math.floor(i) == 0) { - return get((int)i); - } - } - - return super.getField(ctx, key); - } - @Override - protected boolean setField(Context ctx, Object key, Object val) { - if (key instanceof Number) { - var i = Values.number(key); - if (i >= 0 && i - Math.floor(i) == 0) { - set(ctx, (int)i, val); - return true; - } - } - - return super.setField(ctx, key, val); - } - @Override - protected boolean hasField(Context ctx, Object key) { - if (key instanceof Number) { - var i = Values.number(key); - if (i >= 0 && i - Math.floor(i) == 0) { - return has((int)i); - } - } - - return super.hasField(ctx, key); - } - @Override - protected void deleteField(Context ctx, Object key) { - if (key instanceof Number) { - var i = Values.number(key); - if (i >= 0 && i - Math.floor(i) == 0) { - remove((int)i); - return; - } - } - - super.deleteField(ctx, key); - } - - @Override - public List keys(boolean includeNonEnumerable) { - var res = super.keys(includeNonEnumerable); - for (var i = 0; i < size(); i++) { - if (has(i)) res.add(i); - } - return res; - } - - @Override - public Iterator iterator() { - return new Iterator() { - private int i = 0; - - @Override - public boolean hasNext() { - return i < size(); - } - @Override - public Object next() { - if (!hasNext()) return null; - return get(i++); - } - }; - } - - public ArrayValue() { - super(PlaceholderProto.ARRAY); - values = new Object[16]; - size = 0; - } - public ArrayValue(int cap) { - super(PlaceholderProto.ARRAY); - values = new Object[cap]; - size = 0; - } - public ArrayValue(Context ctx, Object ...values) { - this(); - this.values = new Object[values.length]; - size = values.length; - - for (var i = 0; i < size; i++) this.values[i] = Values.normalize(ctx, values[i]); - } - - public static ArrayValue of(Context ctx, Collection values) { - return new ArrayValue(ctx, values.toArray(Object[]::new)); - } -} +package me.topchetoeu.jscript.engine.values; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; + +import me.topchetoeu.jscript.engine.Context; + +// TODO: Make methods generic +public class ArrayValue extends ObjectValue implements Iterable { + private static final Object UNDEFINED = new Object(); + private Object[] values; + private int size; + + private Object[] alloc(int index) { + index++; + if (index < values.length) return values; + if (index < values.length * 2) index = values.length * 2; + + var arr = new Object[index]; + System.arraycopy(values, 0, arr, 0, values.length); + return arr; + } + + public int size() { return size; } + public boolean setSize(int val) { + if (val < 0) return false; + if (size > val) shrink(size - val); + else { + values = alloc(val); + size = val; + } + return true; + } + + public Object get(int i) { + if (i < 0 || i >= size) return null; + var res = values[i]; + if (res == UNDEFINED) return null; + else return res; + } + public void set(Context ctx, int i, Object val) { + if (i < 0) return; + + values = alloc(i); + + val = Values.normalize(ctx, val); + if (val == null) val = UNDEFINED; + values[i] = val; + if (i >= size) size = i + 1; + } + public boolean has(int i) { + return i >= 0 && i < size && values[i] != null; + } + public void remove(int i) { + if (i < 0 || i >= values.length) return; + values[i] = null; + } + public void shrink(int n) { + if (n >= values.length) { + values = new Object[16]; + size = 0; + } + else { + for (int i = 0; i < n; i++) { + values[--size] = null; + } + } + } + + public Object[] toArray() { + Object[] res = new Object[size]; + copyTo(res, 0, 0, size); + return res; + } + public void copyTo(Object[] arr, int sourceStart, int destStart, int count) { + for (var i = 0; i < count; i++) { + if (i + sourceStart < 0 || i + sourceStart >= size) arr[i + destStart] = null; + if (values[i + sourceStart] == UNDEFINED) arr[i + destStart] = null; + else arr[i + sourceStart] = values[i + destStart]; + } + } + public void copyTo(Context ctx, ArrayValue arr, int sourceStart, int destStart, int count) { + // Iterate in reverse to reallocate at most once + for (var i = count - 1; i >= 0; i--) { + if (i + sourceStart < 0 || i + sourceStart >= size) arr.remove(i + destStart); + if (values[i + sourceStart] == UNDEFINED) arr.set(ctx, i + destStart, null); + else if (values[i + sourceStart] == null) arr.remove(i + destStart); + else arr.set(ctx, i + destStart, values[i + sourceStart]); + } + } + + public void copyFrom(Context ctx, Object[] arr, int sourceStart, int destStart, int count) { + for (var i = 0; i < count; i++) { + set(ctx, i + destStart, arr[i + sourceStart]); + } + } + + public void move(int srcI, int dstI, int n) { + values = alloc(dstI + n); + + System.arraycopy(values, srcI, values, dstI, n); + + if (dstI + n >= size) size = dstI + n; + } + + public void sort(Comparator comparator) { + Arrays.sort(values, 0, size, (a, b) -> { + var _a = 0; + var _b = 0; + + if (a == UNDEFINED) _a = 1; + if (a == null) _a = 2; + + if (b == UNDEFINED) _b = 1; + if (b == null) _b = 2; + + if (_a != 0 || _b != 0) return Integer.compare(_a, _b); + + return comparator.compare(a, b); + }); + } + + @Override + protected Object getField(Context ctx, Object key) { + if (key instanceof Number) { + var i = ((Number)key).doubleValue(); + if (i >= 0 && i - Math.floor(i) == 0) { + return get((int)i); + } + } + + return super.getField(ctx, key); + } + @Override + protected boolean setField(Context ctx, Object key, Object val) { + if (key instanceof Number) { + var i = Values.number(key); + if (i >= 0 && i - Math.floor(i) == 0) { + set(ctx, (int)i, val); + return true; + } + } + + return super.setField(ctx, key, val); + } + @Override + protected boolean hasField(Context ctx, Object key) { + if (key instanceof Number) { + var i = Values.number(key); + if (i >= 0 && i - Math.floor(i) == 0) { + return has((int)i); + } + } + + return super.hasField(ctx, key); + } + @Override + protected void deleteField(Context ctx, Object key) { + if (key instanceof Number) { + var i = Values.number(key); + if (i >= 0 && i - Math.floor(i) == 0) { + remove((int)i); + return; + } + } + + super.deleteField(ctx, key); + } + + @Override + public List keys(boolean includeNonEnumerable) { + var res = super.keys(includeNonEnumerable); + for (var i = 0; i < size(); i++) { + if (has(i)) res.add(i); + } + return res; + } + + @Override + public Iterator iterator() { + return new Iterator() { + private int i = 0; + + @Override + public boolean hasNext() { + return i < size(); + } + @Override + public Object next() { + if (!hasNext()) return null; + return get(i++); + } + }; + } + + public ArrayValue() { + super(PlaceholderProto.ARRAY); + values = new Object[16]; + size = 0; + } + public ArrayValue(int cap) { + super(PlaceholderProto.ARRAY); + values = new Object[cap]; + size = 0; + } + public ArrayValue(Context ctx, Object ...values) { + this(); + this.values = new Object[values.length]; + size = values.length; + + for (var i = 0; i < size; i++) this.values[i] = Values.normalize(ctx, values[i]); + } + + public static ArrayValue of(Context ctx, Collection values) { + return new ArrayValue(ctx, values.toArray(Object[]::new)); + } +} diff --git a/src/me/topchetoeu/jscript/engine/values/CodeFunction.java b/src/me/topchetoeu/jscript/engine/values/CodeFunction.java index 313dbc3..d506b81 100644 --- a/src/me/topchetoeu/jscript/engine/values/CodeFunction.java +++ b/src/me/topchetoeu/jscript/engine/values/CodeFunction.java @@ -1,57 +1,57 @@ -package me.topchetoeu.jscript.engine.values; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.FunctionBody; -import me.topchetoeu.jscript.compilation.Instruction; -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.Environment; -import me.topchetoeu.jscript.engine.frame.CodeFrame; -import me.topchetoeu.jscript.engine.frame.Runners; -import me.topchetoeu.jscript.engine.scope.ValueVariable; - -public class CodeFunction extends FunctionValue { - public final int localsN; - public final Instruction[] body; - public final String[] captureNames, localNames; - public final ValueVariable[] captures; - public Environment environment; - - public Location loc() { - for (var instr : body) { - if (instr.location != null) return instr.location; - } - return null; - } - public String readable() { - var loc = loc(); - if (loc == null) return name; - else if (name.equals("")) return loc.toString(); - else return name + "@" + loc; - } - - @Override - public Object call(Context ctx, Object thisArg, Object ...args) { - var frame = new CodeFrame(ctx, thisArg, args, this); - try { - ctx.pushFrame(frame); - - while (true) { - var res = frame.next(ctx, Runners.NO_RETURN, Runners.NO_RETURN, null); - if (res != Runners.NO_RETURN) return res; - } - } - finally { - ctx.popFrame(frame); - } - } - - public CodeFunction(Environment environment, String name, FunctionBody body, ValueVariable... captures) { - super(name, body.argsN); - this.captures = captures; - this.captureNames = body.captureNames; - this.localNames = body.localNames; - this.environment = environment; - this.localsN = body.localsN; - this.body = body.instructions; - } -} +package me.topchetoeu.jscript.engine.values; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.FunctionBody; +import me.topchetoeu.jscript.compilation.Instruction; +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.Environment; +import me.topchetoeu.jscript.engine.frame.CodeFrame; +import me.topchetoeu.jscript.engine.frame.Runners; +import me.topchetoeu.jscript.engine.scope.ValueVariable; + +public class CodeFunction extends FunctionValue { + public final int localsN; + public final Instruction[] body; + public final String[] captureNames, localNames; + public final ValueVariable[] captures; + public Environment environment; + + public Location loc() { + for (var instr : body) { + if (instr.location != null) return instr.location; + } + return null; + } + public String readable() { + var loc = loc(); + if (loc == null) return name; + else if (name.equals("")) return loc.toString(); + else return name + "@" + loc; + } + + @Override + public Object call(Context ctx, Object thisArg, Object ...args) { + var frame = new CodeFrame(ctx, thisArg, args, this); + try { + ctx.pushFrame(frame); + + while (true) { + var res = frame.next(ctx, Runners.NO_RETURN, Runners.NO_RETURN, null); + if (res != Runners.NO_RETURN) return res; + } + } + finally { + ctx.popFrame(frame); + } + } + + public CodeFunction(Environment environment, String name, FunctionBody body, ValueVariable... captures) { + super(name, body.argsN); + this.captures = captures; + this.captureNames = body.captureNames; + this.localNames = body.localNames; + this.environment = environment; + this.localsN = body.localsN; + this.body = body.instructions; + } +} diff --git a/src/me/topchetoeu/jscript/engine/values/FunctionValue.java b/src/me/topchetoeu/jscript/engine/values/FunctionValue.java index 4506cb0..fcf6aa7 100644 --- a/src/me/topchetoeu/jscript/engine/values/FunctionValue.java +++ b/src/me/topchetoeu/jscript/engine/values/FunctionValue.java @@ -1,70 +1,70 @@ -package me.topchetoeu.jscript.engine.values; - -import java.util.List; - -import me.topchetoeu.jscript.engine.Context; - -public abstract class FunctionValue extends ObjectValue { - public String name = ""; - public boolean special = false; - public int length; - - @Override - public String toString() { - return String.format("function %s(...)", name); - } - - public abstract Object call(Context ctx, Object thisArg, Object ...args); - public Object call(Context ctx) { - return call(ctx, null); - } - - @Override - protected Object getField(Context ctx, Object key) { - if ("name".equals(key)) return name; - if ("length".equals(key)) return length; - return super.getField(ctx, key); - } - @Override - protected boolean setField(Context ctx, Object key, Object val) { - if ("name".equals(key)) name = Values.toString(ctx, val); - else if ("length".equals(key)) length = (int)Values.toNumber(ctx, val); - else return super.setField(ctx, key, val); - return true; - } - @Override - protected boolean hasField(Context ctx, Object key) { - if ("name".equals(key)) return true; - if ("length".equals(key)) return true; - return super.hasField(ctx, key); - } - - @Override - public List keys(boolean includeNonEnumerable) { - var res = super.keys(includeNonEnumerable); - if (includeNonEnumerable) { - res.add("name"); - res.add("length"); - } - return res; - } - - public FunctionValue(String name, int length) { - super(PlaceholderProto.FUNCTION); - - if (name == null) name = ""; - this.length = length; - this.name = name; - - nonConfigurableSet.add("name"); - nonEnumerableSet.add("name"); - nonWritableSet.add("length"); - nonConfigurableSet.add("length"); - nonEnumerableSet.add("length"); - - var proto = new ObjectValue(); - proto.defineProperty(null, "constructor", this, true, false, false); - this.defineProperty(null, "prototype", proto, true, false, false); - } -} - +package me.topchetoeu.jscript.engine.values; + +import java.util.List; + +import me.topchetoeu.jscript.engine.Context; + +public abstract class FunctionValue extends ObjectValue { + public String name = ""; + public boolean special = false; + public int length; + + @Override + public String toString() { + return String.format("function %s(...)", name); + } + + public abstract Object call(Context ctx, Object thisArg, Object ...args); + public Object call(Context ctx) { + return call(ctx, null); + } + + @Override + protected Object getField(Context ctx, Object key) { + if ("name".equals(key)) return name; + if ("length".equals(key)) return length; + return super.getField(ctx, key); + } + @Override + protected boolean setField(Context ctx, Object key, Object val) { + if ("name".equals(key)) name = Values.toString(ctx, val); + else if ("length".equals(key)) length = (int)Values.toNumber(ctx, val); + else return super.setField(ctx, key, val); + return true; + } + @Override + protected boolean hasField(Context ctx, Object key) { + if ("name".equals(key)) return true; + if ("length".equals(key)) return true; + return super.hasField(ctx, key); + } + + @Override + public List keys(boolean includeNonEnumerable) { + var res = super.keys(includeNonEnumerable); + if (includeNonEnumerable) { + res.add("name"); + res.add("length"); + } + return res; + } + + public FunctionValue(String name, int length) { + super(PlaceholderProto.FUNCTION); + + if (name == null) name = ""; + this.length = length; + this.name = name; + + nonConfigurableSet.add("name"); + nonEnumerableSet.add("name"); + nonWritableSet.add("length"); + nonConfigurableSet.add("length"); + nonEnumerableSet.add("length"); + + var proto = new ObjectValue(); + proto.defineProperty(null, "constructor", this, true, false, false); + this.defineProperty(null, "prototype", proto, true, false, false); + } +} + diff --git a/src/me/topchetoeu/jscript/engine/values/NativeFunction.java b/src/me/topchetoeu/jscript/engine/values/NativeFunction.java index c9b3def..64bd502 100644 --- a/src/me/topchetoeu/jscript/engine/values/NativeFunction.java +++ b/src/me/topchetoeu/jscript/engine/values/NativeFunction.java @@ -1,25 +1,25 @@ -package me.topchetoeu.jscript.engine.values; - -import me.topchetoeu.jscript.engine.Context; - -public class NativeFunction extends FunctionValue { - public static interface NativeFunctionRunner { - Object run(Context ctx, Object thisArg, Object[] args); - } - - public final NativeFunctionRunner action; - - @Override - public Object call(Context ctx, Object thisArg, Object ...args) { - return action.run(ctx, thisArg, args); - } - - public NativeFunction(String name, NativeFunctionRunner action) { - super(name, 0); - this.action = action; - } - public NativeFunction(NativeFunctionRunner action) { - super("", 0); - this.action = action; - } -} +package me.topchetoeu.jscript.engine.values; + +import me.topchetoeu.jscript.engine.Context; + +public class NativeFunction extends FunctionValue { + public static interface NativeFunctionRunner { + Object run(Context ctx, Object thisArg, Object[] args); + } + + public final NativeFunctionRunner action; + + @Override + public Object call(Context ctx, Object thisArg, Object ...args) { + return action.run(ctx, thisArg, args); + } + + public NativeFunction(String name, NativeFunctionRunner action) { + super(name, 0); + this.action = action; + } + public NativeFunction(NativeFunctionRunner action) { + super("", 0); + this.action = action; + } +} diff --git a/src/me/topchetoeu/jscript/engine/values/NativeWrapper.java b/src/me/topchetoeu/jscript/engine/values/NativeWrapper.java index cda9881..f0b847c 100644 --- a/src/me/topchetoeu/jscript/engine/values/NativeWrapper.java +++ b/src/me/topchetoeu/jscript/engine/values/NativeWrapper.java @@ -1,32 +1,32 @@ -package me.topchetoeu.jscript.engine.values; - -import me.topchetoeu.jscript.engine.Context; - -public class NativeWrapper extends ObjectValue { - private static final Object NATIVE_PROTO = new Object(); - public final Object wrapped; - - @Override - public ObjectValue getPrototype(Context ctx) { - if (prototype == NATIVE_PROTO) return ctx.environment().wrappers.getProto(wrapped.getClass()); - else return super.getPrototype(ctx); - } - - @Override - public String toString() { - return wrapped.toString(); - } - @Override - public boolean equals(Object obj) { - return wrapped.equals(obj); - } - @Override - public int hashCode() { - return wrapped.hashCode(); - } - - public NativeWrapper(Object wrapped) { - this.wrapped = wrapped; - prototype = NATIVE_PROTO; - } -} +package me.topchetoeu.jscript.engine.values; + +import me.topchetoeu.jscript.engine.Context; + +public class NativeWrapper extends ObjectValue { + private static final Object NATIVE_PROTO = new Object(); + public final Object wrapped; + + @Override + public ObjectValue getPrototype(Context ctx) { + if (prototype == NATIVE_PROTO) return ctx.environment().wrappers.getProto(wrapped.getClass()); + else return super.getPrototype(ctx); + } + + @Override + public String toString() { + return wrapped.toString(); + } + @Override + public boolean equals(Object obj) { + return wrapped.equals(obj); + } + @Override + public int hashCode() { + return wrapped.hashCode(); + } + + public NativeWrapper(Object wrapped) { + this.wrapped = wrapped; + prototype = NATIVE_PROTO; + } +} diff --git a/src/me/topchetoeu/jscript/engine/values/ObjectValue.java b/src/me/topchetoeu/jscript/engine/values/ObjectValue.java index 9bbc3ef..7cb4bae 100644 --- a/src/me/topchetoeu/jscript/engine/values/ObjectValue.java +++ b/src/me/topchetoeu/jscript/engine/values/ObjectValue.java @@ -1,344 +1,344 @@ -package me.topchetoeu.jscript.engine.values; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; - -import me.topchetoeu.jscript.engine.Context; - -public class ObjectValue { - public static enum PlaceholderProto { - NONE, - OBJECT, - ARRAY, - FUNCTION, - ERROR, - SYNTAX_ERROR, - TYPE_ERROR, - RANGE_ERROR, - } - public static enum State { - NORMAL, - NO_EXTENSIONS, - SEALED, - FROZEN, - } - - public static class Property { - public final FunctionValue getter; - public final FunctionValue setter; - - public Property(FunctionValue getter, FunctionValue setter) { - this.getter = getter; - this.setter = setter; - } - } - - private static final Object OBJ_PROTO = new Object(); - private static final Object ARR_PROTO = new Object(); - private static final Object FUNC_PROTO = new Object(); - private static final Object ERR_PROTO = new Object(); - private static final Object SYNTAX_ERR_PROTO = new Object(); - private static final Object TYPE_ERR_PROTO = new Object(); - private static final Object RANGE_ERR_PROTO = new Object(); - - protected Object prototype; - - public State state = State.NORMAL; - public LinkedHashMap values = new LinkedHashMap<>(); - public LinkedHashMap properties = new LinkedHashMap<>(); - public LinkedHashSet nonWritableSet = new LinkedHashSet<>(); - public LinkedHashSet nonConfigurableSet = new LinkedHashSet<>(); - public LinkedHashSet nonEnumerableSet = new LinkedHashSet<>(); - - public final boolean memberWritable(Object key) { - if (state == State.FROZEN) return false; - return !values.containsKey(key) || !nonWritableSet.contains(key); - } - public final boolean memberConfigurable(Object key) { - if (state == State.SEALED || state == State.FROZEN) return false; - return !nonConfigurableSet.contains(key); - } - public final boolean memberEnumerable(Object key) { - return !nonEnumerableSet.contains(key); - } - public final boolean extensible() { - return state == State.NORMAL; - } - - public final void preventExtensions() { - if (state == State.NORMAL) state = State.NO_EXTENSIONS; - } - public final void seal() { - if (state == State.NORMAL || state == State.NO_EXTENSIONS) state = State.SEALED; - } - public final void freeze() { - state = State.FROZEN; - } - - public final boolean defineProperty(Context ctx, Object key, Object val, boolean writable, boolean configurable, boolean enumerable) { - key = Values.normalize(ctx, key); val = Values.normalize(ctx, val); - boolean reconfigured = - writable != memberWritable(key) || - configurable != memberConfigurable(key) || - enumerable != memberEnumerable(key); - - if (!reconfigured) { - if (!memberWritable(key)) { - var a = values.get(key); - var b = val; - if (a == null || b == null) return a == null && b == null; - return a == b || a.equals(b); - } - values.put(key, val); - return true; - } - - if ( - properties.containsKey(key) && - values.get(key) == val && - !reconfigured - ) return true; - - if (!extensible() && !values.containsKey(key) && !properties.containsKey(key)) return false; - if (!memberConfigurable(key)) return false; - - nonWritableSet.remove(key); - nonEnumerableSet.remove(key); - properties.remove(key); - values.remove(key); - - if (!writable) nonWritableSet.add(key); - if (!configurable) nonConfigurableSet.add(key); - if (!enumerable) nonEnumerableSet.add(key); - - values.put(key, val); - return true; - } - public final boolean defineProperty(Context ctx, Object key, Object val) { - return defineProperty(ctx, key, val, true, true, true); - } - public final boolean defineProperty(Context ctx, Object key, FunctionValue getter, FunctionValue setter, boolean configurable, boolean enumerable) { - key = Values.normalize(ctx, key); - if ( - properties.containsKey(key) && - properties.get(key).getter == getter && - properties.get(key).setter == setter && - !configurable == nonConfigurableSet.contains(key) && - !enumerable == nonEnumerableSet.contains(key) - ) return true; - if (!extensible() && !values.containsKey(key) && !properties.containsKey(key)) return false; - if (!memberConfigurable(key)) return false; - - nonWritableSet.remove(key); - nonEnumerableSet.remove(key); - properties.remove(key); - values.remove(key); - - if (!configurable) nonConfigurableSet.add(key); - if (!enumerable) nonEnumerableSet.add(key); - - properties.put(key, new Property(getter, setter)); - return true; - } - - public ObjectValue getPrototype(Context ctx) { - try { - if (prototype == OBJ_PROTO) return ctx.environment().proto("object"); - if (prototype == ARR_PROTO) return ctx.environment().proto("array"); - if (prototype == FUNC_PROTO) return ctx.environment().proto("function"); - if (prototype == ERR_PROTO) return ctx.environment().proto("error"); - if (prototype == RANGE_ERR_PROTO) return ctx.environment().proto("rangeErr"); - if (prototype == SYNTAX_ERR_PROTO) return ctx.environment().proto("syntaxErr"); - if (prototype == TYPE_ERR_PROTO) return ctx.environment().proto("typeErr"); - } - catch (NullPointerException e) { return null; } - - return (ObjectValue)prototype; - } - public final boolean setPrototype(Context ctx, Object val) { - val = Values.normalize(ctx, val); - - if (!extensible()) return false; - if (val == null || val == Values.NULL) { - prototype = null; - return true; - } - else if (Values.isObject(val)) { - var obj = Values.object(val); - - if (ctx != null && ctx.environment() != null) { - if (obj == ctx.environment().proto("object")) prototype = OBJ_PROTO; - else if (obj == ctx.environment().proto("array")) prototype = ARR_PROTO; - else if (obj == ctx.environment().proto("function")) prototype = FUNC_PROTO; - else if (obj == ctx.environment().proto("error")) prototype = ERR_PROTO; - else if (obj == ctx.environment().proto("syntaxErr")) prototype = SYNTAX_ERR_PROTO; - else if (obj == ctx.environment().proto("typeErr")) prototype = TYPE_ERR_PROTO; - else if (obj == ctx.environment().proto("rangeErr")) prototype = RANGE_ERR_PROTO; - else prototype = obj; - } - else prototype = obj; - - return true; - } - return false; - } - public final boolean setPrototype(PlaceholderProto val) { - if (!extensible()) return false; - switch (val) { - case OBJECT: prototype = OBJ_PROTO; break; - case FUNCTION: prototype = FUNC_PROTO; break; - case ARRAY: prototype = ARR_PROTO; break; - case ERROR: prototype = ERR_PROTO; break; - case SYNTAX_ERROR: prototype = SYNTAX_ERR_PROTO; break; - case TYPE_ERROR: prototype = TYPE_ERR_PROTO; break; - case RANGE_ERROR: prototype = RANGE_ERR_PROTO; break; - case NONE: prototype = null; break; - } - return true; - } - - protected Property getProperty(Context ctx, Object key) { - if (properties.containsKey(key)) return properties.get(key); - var proto = getPrototype(ctx); - if (proto != null) return proto.getProperty(ctx, key); - else return null; - } - protected Object getField(Context ctx, Object key) { - if (values.containsKey(key)) return values.get(key); - var proto = getPrototype(ctx); - if (proto != null) return proto.getField(ctx, key); - else return null; - } - protected boolean setField(Context ctx, Object key, Object val) { - if (val instanceof FunctionValue && ((FunctionValue)val).name.equals("")) { - ((FunctionValue)val).name = Values.toString(ctx, key); - } - - values.put(key, val); - return true; - } - protected void deleteField(Context ctx, Object key) { - values.remove(key); - } - protected boolean hasField(Context ctx, Object key) { - return values.containsKey(key); - } - - public final Object getMember(Context ctx, Object key, Object thisArg) { - key = Values.normalize(ctx, key); - - if ("__proto__".equals(key)) { - var res = getPrototype(ctx); - return res == null ? Values.NULL : res; - } - - var prop = getProperty(ctx, key); - - if (prop != null) { - if (prop.getter == null) return null; - else return prop.getter.call(ctx, Values.normalize(ctx, thisArg)); - } - else return getField(ctx, key); - } - public final Object getMember(Context ctx, Object key) { - return getMember(ctx, key, this); - } - - public final boolean setMember(Context ctx, Object key, Object val, Object thisArg, boolean onlyProps) { - key = Values.normalize(ctx, key); val = Values.normalize(ctx, val); - - var prop = getProperty(ctx, key); - if (prop != null) { - if (prop.setter == null) return false; - prop.setter.call(ctx, Values.normalize(ctx, thisArg), val); - return true; - } - else if (onlyProps) return false; - else if (!extensible() && !values.containsKey(key)) return false; - else if (key == null) { - values.put(key, val); - return true; - } - else if ("__proto__".equals(key)) return setPrototype(ctx, val); - else if (nonWritableSet.contains(key)) return false; - else return setField(ctx, key, val); - } - public final boolean setMember(Context ctx, Object key, Object val, boolean onlyProps) { - return setMember(ctx, Values.normalize(ctx, key), Values.normalize(ctx, val), this, onlyProps); - } - - public final boolean hasMember(Context ctx, Object key, boolean own) { - key = Values.normalize(ctx, key); - - if (key != null && "__proto__".equals(key)) return true; - if (hasField(ctx, key)) return true; - if (properties.containsKey(key)) return true; - if (own) return false; - var proto = getPrototype(ctx); - return proto != null && proto.hasMember(ctx, key, own); - } - public final boolean deleteMember(Context ctx, Object key) { - key = Values.normalize(ctx, key); - - if (!memberConfigurable(key)) return false; - properties.remove(key); - nonWritableSet.remove(key); - nonEnumerableSet.remove(key); - deleteField(ctx, key); - return true; - } - - public final ObjectValue getMemberDescriptor(Context ctx, Object key) { - key = Values.normalize(ctx, key); - - var prop = properties.get(key); - var res = new ObjectValue(); - - res.defineProperty(ctx, "configurable", memberConfigurable(key)); - res.defineProperty(ctx, "enumerable", memberEnumerable(key)); - - if (prop != null) { - res.defineProperty(ctx, "get", prop.getter); - res.defineProperty(ctx, "set", prop.setter); - } - else if (hasField(ctx, key)) { - res.defineProperty(ctx, "value", values.get(key)); - res.defineProperty(ctx, "writable", memberWritable(key)); - } - else return null; - return res; - } - - public List keys(boolean includeNonEnumerable) { - var res = new ArrayList(); - - for (var key : values.keySet()) { - if (nonEnumerableSet.contains(key) && !includeNonEnumerable) continue; - res.add(key); - } - for (var key : properties.keySet()) { - if (nonEnumerableSet.contains(key) && !includeNonEnumerable) continue; - res.add(key); - } - - return res; - } - - public ObjectValue(Context ctx, Map values) { - this(PlaceholderProto.OBJECT); - for (var el : values.entrySet()) { - defineProperty(ctx, el.getKey(), el.getValue()); - } - } - public ObjectValue(PlaceholderProto proto) { - nonConfigurableSet.add("__proto__"); - nonEnumerableSet.add("__proto__"); - setPrototype(proto); - } - public ObjectValue() { - this(PlaceholderProto.OBJECT); - } -} +package me.topchetoeu.jscript.engine.values; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; + +import me.topchetoeu.jscript.engine.Context; + +public class ObjectValue { + public static enum PlaceholderProto { + NONE, + OBJECT, + ARRAY, + FUNCTION, + ERROR, + SYNTAX_ERROR, + TYPE_ERROR, + RANGE_ERROR, + } + public static enum State { + NORMAL, + NO_EXTENSIONS, + SEALED, + FROZEN, + } + + public static class Property { + public final FunctionValue getter; + public final FunctionValue setter; + + public Property(FunctionValue getter, FunctionValue setter) { + this.getter = getter; + this.setter = setter; + } + } + + private static final Object OBJ_PROTO = new Object(); + private static final Object ARR_PROTO = new Object(); + private static final Object FUNC_PROTO = new Object(); + private static final Object ERR_PROTO = new Object(); + private static final Object SYNTAX_ERR_PROTO = new Object(); + private static final Object TYPE_ERR_PROTO = new Object(); + private static final Object RANGE_ERR_PROTO = new Object(); + + protected Object prototype; + + public State state = State.NORMAL; + public LinkedHashMap values = new LinkedHashMap<>(); + public LinkedHashMap properties = new LinkedHashMap<>(); + public LinkedHashSet nonWritableSet = new LinkedHashSet<>(); + public LinkedHashSet nonConfigurableSet = new LinkedHashSet<>(); + public LinkedHashSet nonEnumerableSet = new LinkedHashSet<>(); + + public final boolean memberWritable(Object key) { + if (state == State.FROZEN) return false; + return !values.containsKey(key) || !nonWritableSet.contains(key); + } + public final boolean memberConfigurable(Object key) { + if (state == State.SEALED || state == State.FROZEN) return false; + return !nonConfigurableSet.contains(key); + } + public final boolean memberEnumerable(Object key) { + return !nonEnumerableSet.contains(key); + } + public final boolean extensible() { + return state == State.NORMAL; + } + + public final void preventExtensions() { + if (state == State.NORMAL) state = State.NO_EXTENSIONS; + } + public final void seal() { + if (state == State.NORMAL || state == State.NO_EXTENSIONS) state = State.SEALED; + } + public final void freeze() { + state = State.FROZEN; + } + + public final boolean defineProperty(Context ctx, Object key, Object val, boolean writable, boolean configurable, boolean enumerable) { + key = Values.normalize(ctx, key); val = Values.normalize(ctx, val); + boolean reconfigured = + writable != memberWritable(key) || + configurable != memberConfigurable(key) || + enumerable != memberEnumerable(key); + + if (!reconfigured) { + if (!memberWritable(key)) { + var a = values.get(key); + var b = val; + if (a == null || b == null) return a == null && b == null; + return a == b || a.equals(b); + } + values.put(key, val); + return true; + } + + if ( + properties.containsKey(key) && + values.get(key) == val && + !reconfigured + ) return true; + + if (!extensible() && !values.containsKey(key) && !properties.containsKey(key)) return false; + if (!memberConfigurable(key)) return false; + + nonWritableSet.remove(key); + nonEnumerableSet.remove(key); + properties.remove(key); + values.remove(key); + + if (!writable) nonWritableSet.add(key); + if (!configurable) nonConfigurableSet.add(key); + if (!enumerable) nonEnumerableSet.add(key); + + values.put(key, val); + return true; + } + public final boolean defineProperty(Context ctx, Object key, Object val) { + return defineProperty(ctx, key, val, true, true, true); + } + public final boolean defineProperty(Context ctx, Object key, FunctionValue getter, FunctionValue setter, boolean configurable, boolean enumerable) { + key = Values.normalize(ctx, key); + if ( + properties.containsKey(key) && + properties.get(key).getter == getter && + properties.get(key).setter == setter && + !configurable == nonConfigurableSet.contains(key) && + !enumerable == nonEnumerableSet.contains(key) + ) return true; + if (!extensible() && !values.containsKey(key) && !properties.containsKey(key)) return false; + if (!memberConfigurable(key)) return false; + + nonWritableSet.remove(key); + nonEnumerableSet.remove(key); + properties.remove(key); + values.remove(key); + + if (!configurable) nonConfigurableSet.add(key); + if (!enumerable) nonEnumerableSet.add(key); + + properties.put(key, new Property(getter, setter)); + return true; + } + + public ObjectValue getPrototype(Context ctx) { + try { + if (prototype == OBJ_PROTO) return ctx.environment().proto("object"); + if (prototype == ARR_PROTO) return ctx.environment().proto("array"); + if (prototype == FUNC_PROTO) return ctx.environment().proto("function"); + if (prototype == ERR_PROTO) return ctx.environment().proto("error"); + if (prototype == RANGE_ERR_PROTO) return ctx.environment().proto("rangeErr"); + if (prototype == SYNTAX_ERR_PROTO) return ctx.environment().proto("syntaxErr"); + if (prototype == TYPE_ERR_PROTO) return ctx.environment().proto("typeErr"); + } + catch (NullPointerException e) { return null; } + + return (ObjectValue)prototype; + } + public final boolean setPrototype(Context ctx, Object val) { + val = Values.normalize(ctx, val); + + if (!extensible()) return false; + if (val == null || val == Values.NULL) { + prototype = null; + return true; + } + else if (Values.isObject(val)) { + var obj = Values.object(val); + + if (ctx != null && ctx.environment() != null) { + if (obj == ctx.environment().proto("object")) prototype = OBJ_PROTO; + else if (obj == ctx.environment().proto("array")) prototype = ARR_PROTO; + else if (obj == ctx.environment().proto("function")) prototype = FUNC_PROTO; + else if (obj == ctx.environment().proto("error")) prototype = ERR_PROTO; + else if (obj == ctx.environment().proto("syntaxErr")) prototype = SYNTAX_ERR_PROTO; + else if (obj == ctx.environment().proto("typeErr")) prototype = TYPE_ERR_PROTO; + else if (obj == ctx.environment().proto("rangeErr")) prototype = RANGE_ERR_PROTO; + else prototype = obj; + } + else prototype = obj; + + return true; + } + return false; + } + public final boolean setPrototype(PlaceholderProto val) { + if (!extensible()) return false; + switch (val) { + case OBJECT: prototype = OBJ_PROTO; break; + case FUNCTION: prototype = FUNC_PROTO; break; + case ARRAY: prototype = ARR_PROTO; break; + case ERROR: prototype = ERR_PROTO; break; + case SYNTAX_ERROR: prototype = SYNTAX_ERR_PROTO; break; + case TYPE_ERROR: prototype = TYPE_ERR_PROTO; break; + case RANGE_ERROR: prototype = RANGE_ERR_PROTO; break; + case NONE: prototype = null; break; + } + return true; + } + + protected Property getProperty(Context ctx, Object key) { + if (properties.containsKey(key)) return properties.get(key); + var proto = getPrototype(ctx); + if (proto != null) return proto.getProperty(ctx, key); + else return null; + } + protected Object getField(Context ctx, Object key) { + if (values.containsKey(key)) return values.get(key); + var proto = getPrototype(ctx); + if (proto != null) return proto.getField(ctx, key); + else return null; + } + protected boolean setField(Context ctx, Object key, Object val) { + if (val instanceof FunctionValue && ((FunctionValue)val).name.equals("")) { + ((FunctionValue)val).name = Values.toString(ctx, key); + } + + values.put(key, val); + return true; + } + protected void deleteField(Context ctx, Object key) { + values.remove(key); + } + protected boolean hasField(Context ctx, Object key) { + return values.containsKey(key); + } + + public final Object getMember(Context ctx, Object key, Object thisArg) { + key = Values.normalize(ctx, key); + + if ("__proto__".equals(key)) { + var res = getPrototype(ctx); + return res == null ? Values.NULL : res; + } + + var prop = getProperty(ctx, key); + + if (prop != null) { + if (prop.getter == null) return null; + else return prop.getter.call(ctx, Values.normalize(ctx, thisArg)); + } + else return getField(ctx, key); + } + public final Object getMember(Context ctx, Object key) { + return getMember(ctx, key, this); + } + + public final boolean setMember(Context ctx, Object key, Object val, Object thisArg, boolean onlyProps) { + key = Values.normalize(ctx, key); val = Values.normalize(ctx, val); + + var prop = getProperty(ctx, key); + if (prop != null) { + if (prop.setter == null) return false; + prop.setter.call(ctx, Values.normalize(ctx, thisArg), val); + return true; + } + else if (onlyProps) return false; + else if (!extensible() && !values.containsKey(key)) return false; + else if (key == null) { + values.put(key, val); + return true; + } + else if ("__proto__".equals(key)) return setPrototype(ctx, val); + else if (nonWritableSet.contains(key)) return false; + else return setField(ctx, key, val); + } + public final boolean setMember(Context ctx, Object key, Object val, boolean onlyProps) { + return setMember(ctx, Values.normalize(ctx, key), Values.normalize(ctx, val), this, onlyProps); + } + + public final boolean hasMember(Context ctx, Object key, boolean own) { + key = Values.normalize(ctx, key); + + if (key != null && "__proto__".equals(key)) return true; + if (hasField(ctx, key)) return true; + if (properties.containsKey(key)) return true; + if (own) return false; + var proto = getPrototype(ctx); + return proto != null && proto.hasMember(ctx, key, own); + } + public final boolean deleteMember(Context ctx, Object key) { + key = Values.normalize(ctx, key); + + if (!memberConfigurable(key)) return false; + properties.remove(key); + nonWritableSet.remove(key); + nonEnumerableSet.remove(key); + deleteField(ctx, key); + return true; + } + + public final ObjectValue getMemberDescriptor(Context ctx, Object key) { + key = Values.normalize(ctx, key); + + var prop = properties.get(key); + var res = new ObjectValue(); + + res.defineProperty(ctx, "configurable", memberConfigurable(key)); + res.defineProperty(ctx, "enumerable", memberEnumerable(key)); + + if (prop != null) { + res.defineProperty(ctx, "get", prop.getter); + res.defineProperty(ctx, "set", prop.setter); + } + else if (hasField(ctx, key)) { + res.defineProperty(ctx, "value", values.get(key)); + res.defineProperty(ctx, "writable", memberWritable(key)); + } + else return null; + return res; + } + + public List keys(boolean includeNonEnumerable) { + var res = new ArrayList(); + + for (var key : values.keySet()) { + if (nonEnumerableSet.contains(key) && !includeNonEnumerable) continue; + res.add(key); + } + for (var key : properties.keySet()) { + if (nonEnumerableSet.contains(key) && !includeNonEnumerable) continue; + res.add(key); + } + + return res; + } + + public ObjectValue(Context ctx, Map values) { + this(PlaceholderProto.OBJECT); + for (var el : values.entrySet()) { + defineProperty(ctx, el.getKey(), el.getValue()); + } + } + public ObjectValue(PlaceholderProto proto) { + nonConfigurableSet.add("__proto__"); + nonEnumerableSet.add("__proto__"); + setPrototype(proto); + } + public ObjectValue() { + this(PlaceholderProto.OBJECT); + } +} diff --git a/src/me/topchetoeu/jscript/engine/values/ScopeValue.java b/src/me/topchetoeu/jscript/engine/values/ScopeValue.java index 95c3583..fa6b846 100644 --- a/src/me/topchetoeu/jscript/engine/values/ScopeValue.java +++ b/src/me/topchetoeu/jscript/engine/values/ScopeValue.java @@ -1,54 +1,54 @@ -package me.topchetoeu.jscript.engine.values; - -import java.util.HashMap; -import java.util.List; - -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.scope.ValueVariable; - -public class ScopeValue extends ObjectValue { - public final ValueVariable[] variables; - public final HashMap names = new HashMap<>(); - - @Override - protected Object getField(Context ctx, Object key) { - if (names.containsKey(key)) return variables[names.get(key)].get(ctx); - return super.getField(ctx, key); - } - @Override - protected boolean setField(Context ctx, Object key, Object val) { - if (names.containsKey(key)) { - variables[names.get(key)].set(ctx, val); - return true; - } - - var proto = getPrototype(ctx); - if (proto != null && proto.hasField(ctx, key) && proto.setField(ctx, key, val)) return true; - - return super.setField(ctx, key, val); - } - @Override - protected void deleteField(Context ctx, Object key) { - if (names.containsKey(key)) return; - super.deleteField(ctx, key); - } - @Override - protected boolean hasField(Context ctx, Object key) { - if (names.containsKey(key)) return true; - return super.hasField(ctx, key); - } - @Override - public List keys(boolean includeNonEnumerable) { - var res = super.keys(includeNonEnumerable); - res.addAll(names.keySet()); - return res; - } - - public ScopeValue(ValueVariable[] variables, String[] names) { - this.variables = variables; - for (var i = 0; i < names.length && i < variables.length; i++) { - this.names.put(names[i], i); - this.nonConfigurableSet.add(names[i]); - } - } -} +package me.topchetoeu.jscript.engine.values; + +import java.util.HashMap; +import java.util.List; + +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.scope.ValueVariable; + +public class ScopeValue extends ObjectValue { + public final ValueVariable[] variables; + public final HashMap names = new HashMap<>(); + + @Override + protected Object getField(Context ctx, Object key) { + if (names.containsKey(key)) return variables[names.get(key)].get(ctx); + return super.getField(ctx, key); + } + @Override + protected boolean setField(Context ctx, Object key, Object val) { + if (names.containsKey(key)) { + variables[names.get(key)].set(ctx, val); + return true; + } + + var proto = getPrototype(ctx); + if (proto != null && proto.hasField(ctx, key) && proto.setField(ctx, key, val)) return true; + + return super.setField(ctx, key, val); + } + @Override + protected void deleteField(Context ctx, Object key) { + if (names.containsKey(key)) return; + super.deleteField(ctx, key); + } + @Override + protected boolean hasField(Context ctx, Object key) { + if (names.containsKey(key)) return true; + return super.hasField(ctx, key); + } + @Override + public List keys(boolean includeNonEnumerable) { + var res = super.keys(includeNonEnumerable); + res.addAll(names.keySet()); + return res; + } + + public ScopeValue(ValueVariable[] variables, String[] names) { + this.variables = variables; + for (var i = 0; i < names.length && i < variables.length; i++) { + this.names.put(names[i], i); + this.nonConfigurableSet.add(names[i]); + } + } +} diff --git a/src/me/topchetoeu/jscript/engine/values/Symbol.java b/src/me/topchetoeu/jscript/engine/values/Symbol.java index 116ae0b..b24d8f1 100644 --- a/src/me/topchetoeu/jscript/engine/values/Symbol.java +++ b/src/me/topchetoeu/jscript/engine/values/Symbol.java @@ -1,15 +1,15 @@ -package me.topchetoeu.jscript.engine.values; - -public final class Symbol { - public final String value; - - public Symbol(String value) { - this.value = value; - } - - @Override - public String toString() { - if (value == null) return "Symbol"; - else return "@@" + value; - } -} +package me.topchetoeu.jscript.engine.values; + +public final class Symbol { + public final String value; + + public Symbol(String value) { + this.value = value; + } + + @Override + public String toString() { + if (value == null) return "Symbol"; + else return "@@" + value; + } +} diff --git a/src/me/topchetoeu/jscript/events/Awaitable.java b/src/me/topchetoeu/jscript/events/Awaitable.java index 8f2d9ec..cb0b58a 100644 --- a/src/me/topchetoeu/jscript/events/Awaitable.java +++ b/src/me/topchetoeu/jscript/events/Awaitable.java @@ -1,25 +1,25 @@ -package me.topchetoeu.jscript.events; - -import me.topchetoeu.jscript.exceptions.InterruptException; - -public interface Awaitable { - T await() throws FinishedException; - - default Observable toObservable() { - return sub -> { - var thread = new Thread(() -> { - try { - sub.next(await()); - sub.finish(); - } - catch (InterruptException | FinishedException e) { sub.finish(); } - catch (RuntimeException e) { - sub.error(e); - } - }, "Awaiter"); - thread.start(); - - return () -> thread.interrupt(); - }; - } -} +package me.topchetoeu.jscript.events; + +import me.topchetoeu.jscript.exceptions.InterruptException; + +public interface Awaitable { + T await() throws FinishedException; + + default Observable toObservable() { + return sub -> { + var thread = new Thread(() -> { + try { + sub.next(await()); + sub.finish(); + } + catch (InterruptException | FinishedException e) { sub.finish(); } + catch (RuntimeException e) { + sub.error(e); + } + }, "Awaiter"); + thread.start(); + + return () -> thread.interrupt(); + }; + } +} diff --git a/src/me/topchetoeu/jscript/events/DataNotifier.java b/src/me/topchetoeu/jscript/events/DataNotifier.java index cfcff15..63f1376 100644 --- a/src/me/topchetoeu/jscript/events/DataNotifier.java +++ b/src/me/topchetoeu/jscript/events/DataNotifier.java @@ -1,34 +1,34 @@ -package me.topchetoeu.jscript.events; - -public class DataNotifier implements Awaitable { - private Notifier notifier = new Notifier(); - private boolean isErr; - private T val; - private RuntimeException err; - - public void error(RuntimeException t) { - err = t; - isErr = true; - notifier.next(); - } - public void error(Throwable t) { - error(new RuntimeException(t)); - } - public void next(T val) { - this.val = val; - isErr = false; - notifier.next(); - } - public T await() { - notifier.await(); - - try { - if (isErr) throw err; - else return val; - } - finally { - this.err = null; - this.val = null; - } - } -} +package me.topchetoeu.jscript.events; + +public class DataNotifier implements Awaitable { + private Notifier notifier = new Notifier(); + private boolean isErr; + private T val; + private RuntimeException err; + + public void error(RuntimeException t) { + err = t; + isErr = true; + notifier.next(); + } + public void error(Throwable t) { + error(new RuntimeException(t)); + } + public void next(T val) { + this.val = val; + isErr = false; + notifier.next(); + } + public T await() { + notifier.await(); + + try { + if (isErr) throw err; + else return val; + } + finally { + this.err = null; + this.val = null; + } + } +} diff --git a/src/me/topchetoeu/jscript/events/Event.java b/src/me/topchetoeu/jscript/events/Event.java index 512083a..225d7ec 100644 --- a/src/me/topchetoeu/jscript/events/Event.java +++ b/src/me/topchetoeu/jscript/events/Event.java @@ -1,49 +1,49 @@ -package me.topchetoeu.jscript.events; - -import java.util.HashSet; - -public class Event implements Observer, Observable { - private HashSet> handlers = new HashSet<>(); - - public Handle on(Observer handler) { - if (handlers == null) { - handler.finish(); - return () -> {}; - } - - handlers.add(handler); - return () -> { - if (handlers == null) return; - handlers.remove(handler); - }; - } - - public boolean isFinished() { - return handlers == null; - } - - public void next(T value) { - if (handlers == null) throw new IllegalStateException("Cannot use a finished event."); - for (var handler : handlers) { - handler.next(value); - } - } - public void error(RuntimeException value) { - if (handlers == null) throw new IllegalStateException("Cannot use a finished event."); - for (var handler : handlers) { - handler.error(value); - } - - handlers.clear(); - handlers = null; - } - public void finish() { - if (handlers == null) throw new IllegalStateException("Cannot use a finished event."); - for (var handler : handlers) { - handler.finish(); - } - - handlers.clear(); - handlers = null; - } -} +package me.topchetoeu.jscript.events; + +import java.util.HashSet; + +public class Event implements Observer, Observable { + private HashSet> handlers = new HashSet<>(); + + public Handle on(Observer handler) { + if (handlers == null) { + handler.finish(); + return () -> {}; + } + + handlers.add(handler); + return () -> { + if (handlers == null) return; + handlers.remove(handler); + }; + } + + public boolean isFinished() { + return handlers == null; + } + + public void next(T value) { + if (handlers == null) throw new IllegalStateException("Cannot use a finished event."); + for (var handler : handlers) { + handler.next(value); + } + } + public void error(RuntimeException value) { + if (handlers == null) throw new IllegalStateException("Cannot use a finished event."); + for (var handler : handlers) { + handler.error(value); + } + + handlers.clear(); + handlers = null; + } + public void finish() { + if (handlers == null) throw new IllegalStateException("Cannot use a finished event."); + for (var handler : handlers) { + handler.finish(); + } + + handlers.clear(); + handlers = null; + } +} diff --git a/src/me/topchetoeu/jscript/events/FinishedException.java b/src/me/topchetoeu/jscript/events/FinishedException.java index 75d8d34..569aecb 100644 --- a/src/me/topchetoeu/jscript/events/FinishedException.java +++ b/src/me/topchetoeu/jscript/events/FinishedException.java @@ -1,7 +1,7 @@ -package me.topchetoeu.jscript.events; - -public class FinishedException extends RuntimeException { - public FinishedException() { - super("The observable has ended."); - } -} +package me.topchetoeu.jscript.events; + +public class FinishedException extends RuntimeException { + public FinishedException() { + super("The observable has ended."); + } +} diff --git a/src/me/topchetoeu/jscript/events/Handle.java b/src/me/topchetoeu/jscript/events/Handle.java index b098f6a..4b0edf2 100644 --- a/src/me/topchetoeu/jscript/events/Handle.java +++ b/src/me/topchetoeu/jscript/events/Handle.java @@ -1,5 +1,5 @@ -package me.topchetoeu.jscript.events; - -public interface Handle { - void free(); +package me.topchetoeu.jscript.events; + +public interface Handle { + void free(); } \ No newline at end of file diff --git a/src/me/topchetoeu/jscript/events/Notifier.java b/src/me/topchetoeu/jscript/events/Notifier.java index 96dbee8..26b2bc9 100644 --- a/src/me/topchetoeu/jscript/events/Notifier.java +++ b/src/me/topchetoeu/jscript/events/Notifier.java @@ -1,19 +1,19 @@ -package me.topchetoeu.jscript.events; - -import me.topchetoeu.jscript.exceptions.InterruptException; - -public class Notifier { - private boolean ok = false; - - public synchronized void next() { - ok = true; - notifyAll(); - } - public synchronized void await() { - try { - while (!ok) wait(); - ok = false; - } - catch (InterruptedException e) { throw new InterruptException(e); } - } -} +package me.topchetoeu.jscript.events; + +import me.topchetoeu.jscript.exceptions.InterruptException; + +public class Notifier { + private boolean ok = false; + + public synchronized void next() { + ok = true; + notifyAll(); + } + public synchronized void await() { + try { + while (!ok) wait(); + ok = false; + } + catch (InterruptedException e) { throw new InterruptException(e); } + } +} diff --git a/src/me/topchetoeu/jscript/events/Observable.java b/src/me/topchetoeu/jscript/events/Observable.java index ea926fe..cc72a41 100644 --- a/src/me/topchetoeu/jscript/events/Observable.java +++ b/src/me/topchetoeu/jscript/events/Observable.java @@ -1,75 +1,75 @@ -package me.topchetoeu.jscript.events; - -public interface Observable { - Handle on(Observer val); - - default Handle once(Observer observer) { - // Java is fucking retarded - var unhandler = new Handle[1]; - var shouldUnsub = new boolean[1]; - - unhandler[0] = on(new Observer<>() { - public void next(T data) { - observer.next(data); - if (unhandler[0] == null) shouldUnsub[0] = true; - else unhandler[0].free(); - } - public void error(RuntimeException err) { - observer.error(err); - if (unhandler[0] == null) shouldUnsub[0] = true; - else unhandler[0].free(); - } - public void finish() { - observer.finish(); - if (unhandler[0] == null) shouldUnsub[0] = true; - else unhandler[0].free(); - } - }); - - if (shouldUnsub[0]) { - unhandler[0].free(); - return () -> {}; - } - else return unhandler[0]; - } - @SuppressWarnings("unchecked") - default Awaitable toAwaitable() { - return () -> { - var notifier = new Notifier(); - var valRef = new Object[1]; - var isErrRef = new boolean[1]; - - once(new Observer<>() { - public void next(T data) { - valRef[0] = data; - notifier.next(); - } - public void error(RuntimeException err) { - isErrRef[0] = true; - valRef[0] = err; - notifier.next(); - } - public void finish() { - isErrRef[0] = true; - valRef[0] = new FinishedException(); - notifier.next(); - } - }); - - notifier.await(); - - if (isErrRef[0]) throw (RuntimeException)valRef[0]; - else return (T)valRef[0]; - }; - } - default Observable encapsulate() { - return val -> on(val); - } - - default Observable pipe(Pipe pipe) { - return sub -> on(pipe.apply(sub)); - } - default WarmObservable warmUp() { - return new WarmObservable<>(this); - } -} +package me.topchetoeu.jscript.events; + +public interface Observable { + Handle on(Observer val); + + default Handle once(Observer observer) { + // Java is fucking retarded + var unhandler = new Handle[1]; + var shouldUnsub = new boolean[1]; + + unhandler[0] = on(new Observer<>() { + public void next(T data) { + observer.next(data); + if (unhandler[0] == null) shouldUnsub[0] = true; + else unhandler[0].free(); + } + public void error(RuntimeException err) { + observer.error(err); + if (unhandler[0] == null) shouldUnsub[0] = true; + else unhandler[0].free(); + } + public void finish() { + observer.finish(); + if (unhandler[0] == null) shouldUnsub[0] = true; + else unhandler[0].free(); + } + }); + + if (shouldUnsub[0]) { + unhandler[0].free(); + return () -> {}; + } + else return unhandler[0]; + } + @SuppressWarnings("unchecked") + default Awaitable toAwaitable() { + return () -> { + var notifier = new Notifier(); + var valRef = new Object[1]; + var isErrRef = new boolean[1]; + + once(new Observer<>() { + public void next(T data) { + valRef[0] = data; + notifier.next(); + } + public void error(RuntimeException err) { + isErrRef[0] = true; + valRef[0] = err; + notifier.next(); + } + public void finish() { + isErrRef[0] = true; + valRef[0] = new FinishedException(); + notifier.next(); + } + }); + + notifier.await(); + + if (isErrRef[0]) throw (RuntimeException)valRef[0]; + else return (T)valRef[0]; + }; + } + default Observable encapsulate() { + return val -> on(val); + } + + default Observable pipe(Pipe pipe) { + return sub -> on(pipe.apply(sub)); + } + default WarmObservable warmUp() { + return new WarmObservable<>(this); + } +} diff --git a/src/me/topchetoeu/jscript/events/Observer.java b/src/me/topchetoeu/jscript/events/Observer.java index 9c49e1e..a687c05 100644 --- a/src/me/topchetoeu/jscript/events/Observer.java +++ b/src/me/topchetoeu/jscript/events/Observer.java @@ -1,7 +1,7 @@ -package me.topchetoeu.jscript.events; - -public interface Observer { - public void next(T data); - public default void error(RuntimeException err) {} - public default void finish() { } +package me.topchetoeu.jscript.events; + +public interface Observer { + public void next(T data); + public default void error(RuntimeException err) {} + public default void finish() { } } \ No newline at end of file diff --git a/src/me/topchetoeu/jscript/events/Pipe.java b/src/me/topchetoeu/jscript/events/Pipe.java index 4916ec5..3199142 100644 --- a/src/me/topchetoeu/jscript/events/Pipe.java +++ b/src/me/topchetoeu/jscript/events/Pipe.java @@ -1,59 +1,59 @@ -package me.topchetoeu.jscript.events; - -public interface Pipe { - Observer apply(Observer obs); - // void next(T val, Observer target); - // default void error(RuntimeException err, Observer target) { - // target.error(err); - // } - // default void finish(Observer target) { - // target.finish(); - // } - - public static interface MapFunc { - T2 map(T1 val); - } - - public static Pipe map(MapFunc func) { - return o -> val -> o.next(func.map(val)); - } - public static Pipe filter(MapFunc func) { - return o -> val -> { - if (func.map(val)) o.next(val); - }; - } - public static Pipe skip(int n) { - var i = new int[1]; - - return target -> val -> { - if (i[0] >= n) target.next(val); - else i[0]++; - }; - } - public static Pipe limit(int n) { - return target -> new Observer() { - private int i; - - public void next(T val) { - if (i >= n) target.finish(); - else { - target.next(val); - i++; - } - } - public void error(RuntimeException err) { - if (i < n) target.error(err); - } - public void finish() { - if (i < n) target.finish(); - } - }; - } - public static Pipe first() { - return limit(1); - } - - public static Pipe, T> merge() { - return target -> val -> val.on(target); - } +package me.topchetoeu.jscript.events; + +public interface Pipe { + Observer apply(Observer obs); + // void next(T val, Observer target); + // default void error(RuntimeException err, Observer target) { + // target.error(err); + // } + // default void finish(Observer target) { + // target.finish(); + // } + + public static interface MapFunc { + T2 map(T1 val); + } + + public static Pipe map(MapFunc func) { + return o -> val -> o.next(func.map(val)); + } + public static Pipe filter(MapFunc func) { + return o -> val -> { + if (func.map(val)) o.next(val); + }; + } + public static Pipe skip(int n) { + var i = new int[1]; + + return target -> val -> { + if (i[0] >= n) target.next(val); + else i[0]++; + }; + } + public static Pipe limit(int n) { + return target -> new Observer() { + private int i; + + public void next(T val) { + if (i >= n) target.finish(); + else { + target.next(val); + i++; + } + } + public void error(RuntimeException err) { + if (i < n) target.error(err); + } + public void finish() { + if (i < n) target.finish(); + } + }; + } + public static Pipe first() { + return limit(1); + } + + public static Pipe, T> merge() { + return target -> val -> val.on(target); + } } \ No newline at end of file diff --git a/src/me/topchetoeu/jscript/events/WarmObservable.java b/src/me/topchetoeu/jscript/events/WarmObservable.java index 133d772..1d98cd7 100644 --- a/src/me/topchetoeu/jscript/events/WarmObservable.java +++ b/src/me/topchetoeu/jscript/events/WarmObservable.java @@ -1,46 +1,46 @@ -package me.topchetoeu.jscript.events; - -import java.util.HashSet; - -public class WarmObservable implements Observable, Handle { - private HashSet> observers = new HashSet<>(); - private Handle handle; - - @Override - public Handle on(Observer val) { - if (observers == null) return () -> {}; - observers.add(val); - return () -> observers.remove(val); - } - - @Override - public void free() { - if (observers == null) return; - handle.free(); - handle = null; - observers = null; - } - - public WarmObservable(Observable observable) { - observable.on(new Observer<>() { - public void next(T data) { - for (var obs : observers) obs.next(data); - } - public void error(RuntimeException err) { - for (var obs : observers) obs.error(err); - handle = null; - observers = null; - } - public void finish() { - for (var obs : observers) obs.finish(); - handle = null; - observers = null; - } - }); - } - - @Override - public WarmObservable warmUp() { - return this; - } -} +package me.topchetoeu.jscript.events; + +import java.util.HashSet; + +public class WarmObservable implements Observable, Handle { + private HashSet> observers = new HashSet<>(); + private Handle handle; + + @Override + public Handle on(Observer val) { + if (observers == null) return () -> {}; + observers.add(val); + return () -> observers.remove(val); + } + + @Override + public void free() { + if (observers == null) return; + handle.free(); + handle = null; + observers = null; + } + + public WarmObservable(Observable observable) { + observable.on(new Observer<>() { + public void next(T data) { + for (var obs : observers) obs.next(data); + } + public void error(RuntimeException err) { + for (var obs : observers) obs.error(err); + handle = null; + observers = null; + } + public void finish() { + for (var obs : observers) obs.finish(); + handle = null; + observers = null; + } + }); + } + + @Override + public WarmObservable warmUp() { + return this; + } +} diff --git a/src/me/topchetoeu/jscript/exceptions/EngineException.java b/src/me/topchetoeu/jscript/exceptions/EngineException.java index cb82bb1..8976ace 100644 --- a/src/me/topchetoeu/jscript/exceptions/EngineException.java +++ b/src/me/topchetoeu/jscript/exceptions/EngineException.java @@ -1,117 +1,117 @@ -package me.topchetoeu.jscript.exceptions; - -import java.util.ArrayList; -import java.util.List; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.Engine; -import me.topchetoeu.jscript.engine.Environment; -import me.topchetoeu.jscript.engine.values.ObjectValue; -import me.topchetoeu.jscript.engine.values.Values; -import me.topchetoeu.jscript.engine.values.ObjectValue.PlaceholderProto; - -public class EngineException extends RuntimeException { - public static class StackElement { - public final Location location; - public final String function; - public final Context ctx; - - public boolean visible() { - return ctx == null || ctx.environment() == null || ctx.environment().stackVisible; - } - public String toString() { - var res = ""; - var loc = location; - - if (loc != null && ctx != null && ctx.engine != null) loc = ctx.engine.mapToCompiled(loc); - - if (loc != null) res += "at " + loc.toString() + " "; - if (function != null && !function.equals("")) res += "in " + function + " "; - - return res.trim(); - } - - public StackElement(Context ctx, Location location, String function) { - if (function != null) function = function.trim(); - if (function.equals("")) function = null; - - if (ctx == null) this.ctx = null; - else this.ctx = new Context(ctx.engine).pushEnv(ctx.environment()); - this.location = location; - this.function = function; - } - } - - public final Object value; - public EngineException cause; - public Environment env = null; - public Engine engine = null; - public final List stackTrace = new ArrayList<>(); - - public EngineException add(Context ctx, String name, Location location) { - var el = new StackElement(ctx, location, name); - if (el.function == null && el.location == null) return this; - setCtx(ctx.environment(), ctx.engine); - stackTrace.add(el); - return this; - } - public EngineException setCause(EngineException cause) { - this.cause = cause; - return this; - } - public EngineException setCtx(Environment env, Engine engine) { - if (this.env == null) this.env = env; - if (this.engine == null) this.engine = engine; - return this; - } - - public String toString(Context ctx) { - var ss = new StringBuilder(); - try { - ss.append(Values.toString(ctx, value)).append('\n'); - } - catch (EngineException e) { - ss.append("[Error while stringifying]\n"); - } - for (var line : stackTrace) { - if (line.visible()) ss.append(" ").append(line.toString()).append("\n"); - } - if (cause != null) ss.append("Caused by ").append(cause.toString(ctx)).append('\n'); - ss.deleteCharAt(ss.length() - 1); - return ss.toString(); - } - - private static Object err(String name, String msg, PlaceholderProto proto) { - var res = new ObjectValue(proto); - if (name != null) res.defineProperty(null, "name", name); - res.defineProperty(null, "message", msg); - return res; - } - - public EngineException(Object error) { - super(error == null ? "null" : error.toString()); - - this.value = error; - this.cause = null; - } - - public static EngineException ofError(String name, String msg) { - return new EngineException(err(name, msg, PlaceholderProto.ERROR)); - } - public static EngineException ofError(String msg) { - return new EngineException(err(null, msg, PlaceholderProto.ERROR)); - } - public static EngineException ofSyntax(SyntaxException e) { - return new EngineException(err(null, e.msg, PlaceholderProto.SYNTAX_ERROR)).add(null, null, e.loc); - } - public static EngineException ofSyntax(String msg) { - return new EngineException(err(null, msg, PlaceholderProto.SYNTAX_ERROR)); - } - public static EngineException ofType(String msg) { - return new EngineException(err(null, msg, PlaceholderProto.TYPE_ERROR)); - } - public static EngineException ofRange(String msg) { - return new EngineException(err(null, msg, PlaceholderProto.RANGE_ERROR)); - } -} +package me.topchetoeu.jscript.exceptions; + +import java.util.ArrayList; +import java.util.List; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.Engine; +import me.topchetoeu.jscript.engine.Environment; +import me.topchetoeu.jscript.engine.values.ObjectValue; +import me.topchetoeu.jscript.engine.values.Values; +import me.topchetoeu.jscript.engine.values.ObjectValue.PlaceholderProto; + +public class EngineException extends RuntimeException { + public static class StackElement { + public final Location location; + public final String function; + public final Context ctx; + + public boolean visible() { + return ctx == null || ctx.environment() == null || ctx.environment().stackVisible; + } + public String toString() { + var res = ""; + var loc = location; + + if (loc != null && ctx != null && ctx.engine != null) loc = ctx.engine.mapToCompiled(loc); + + if (loc != null) res += "at " + loc.toString() + " "; + if (function != null && !function.equals("")) res += "in " + function + " "; + + return res.trim(); + } + + public StackElement(Context ctx, Location location, String function) { + if (function != null) function = function.trim(); + if (function.equals("")) function = null; + + if (ctx == null) this.ctx = null; + else this.ctx = new Context(ctx.engine).pushEnv(ctx.environment()); + this.location = location; + this.function = function; + } + } + + public final Object value; + public EngineException cause; + public Environment env = null; + public Engine engine = null; + public final List stackTrace = new ArrayList<>(); + + public EngineException add(Context ctx, String name, Location location) { + var el = new StackElement(ctx, location, name); + if (el.function == null && el.location == null) return this; + setCtx(ctx.environment(), ctx.engine); + stackTrace.add(el); + return this; + } + public EngineException setCause(EngineException cause) { + this.cause = cause; + return this; + } + public EngineException setCtx(Environment env, Engine engine) { + if (this.env == null) this.env = env; + if (this.engine == null) this.engine = engine; + return this; + } + + public String toString(Context ctx) { + var ss = new StringBuilder(); + try { + ss.append(Values.toString(ctx, value)).append('\n'); + } + catch (EngineException e) { + ss.append("[Error while stringifying]\n"); + } + for (var line : stackTrace) { + if (line.visible()) ss.append(" ").append(line.toString()).append("\n"); + } + if (cause != null) ss.append("Caused by ").append(cause.toString(ctx)).append('\n'); + ss.deleteCharAt(ss.length() - 1); + return ss.toString(); + } + + private static Object err(String name, String msg, PlaceholderProto proto) { + var res = new ObjectValue(proto); + if (name != null) res.defineProperty(null, "name", name); + res.defineProperty(null, "message", msg); + return res; + } + + public EngineException(Object error) { + super(error == null ? "null" : error.toString()); + + this.value = error; + this.cause = null; + } + + public static EngineException ofError(String name, String msg) { + return new EngineException(err(name, msg, PlaceholderProto.ERROR)); + } + public static EngineException ofError(String msg) { + return new EngineException(err(null, msg, PlaceholderProto.ERROR)); + } + public static EngineException ofSyntax(SyntaxException e) { + return new EngineException(err(null, e.msg, PlaceholderProto.SYNTAX_ERROR)).add(null, null, e.loc); + } + public static EngineException ofSyntax(String msg) { + return new EngineException(err(null, msg, PlaceholderProto.SYNTAX_ERROR)); + } + public static EngineException ofType(String msg) { + return new EngineException(err(null, msg, PlaceholderProto.TYPE_ERROR)); + } + public static EngineException ofRange(String msg) { + return new EngineException(err(null, msg, PlaceholderProto.RANGE_ERROR)); + } +} diff --git a/src/me/topchetoeu/jscript/exceptions/SyntaxException.java b/src/me/topchetoeu/jscript/exceptions/SyntaxException.java index 98d8d0b..3348cc8 100644 --- a/src/me/topchetoeu/jscript/exceptions/SyntaxException.java +++ b/src/me/topchetoeu/jscript/exceptions/SyntaxException.java @@ -1,14 +1,14 @@ -package me.topchetoeu.jscript.exceptions; - -import me.topchetoeu.jscript.Location; - -public class SyntaxException extends RuntimeException { - public final Location loc; - public final String msg; - - public SyntaxException(Location loc, String msg) { - super(String.format("Syntax error (at %s): %s", loc, msg)); - this.loc = loc; - this.msg = msg; - } +package me.topchetoeu.jscript.exceptions; + +import me.topchetoeu.jscript.Location; + +public class SyntaxException extends RuntimeException { + public final Location loc; + public final String msg; + + public SyntaxException(Location loc, String msg) { + super(String.format("Syntax error (at %s): %s", loc, msg)); + this.loc = loc; + this.msg = msg; + } } \ No newline at end of file diff --git a/src/me/topchetoeu/jscript/filesystem/MemoryFile.java b/src/me/topchetoeu/jscript/filesystem/MemoryFile.java index bea8a0b..7fd4afc 100644 --- a/src/me/topchetoeu/jscript/filesystem/MemoryFile.java +++ b/src/me/topchetoeu/jscript/filesystem/MemoryFile.java @@ -1,67 +1,67 @@ -package me.topchetoeu.jscript.filesystem; - -import me.topchetoeu.jscript.Buffer; -import me.topchetoeu.jscript.filesystem.FilesystemException.FSCode; - -public class MemoryFile implements File { - private int ptr; - private Mode mode; - private Buffer data; - private String filename; - - public Buffer data() { return data; } - - @Override - public int read(byte[] buff) { - if (data == null || !mode.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); - var res = data.read(ptr, buff); - ptr += res; - return res; - } - @Override - public void write(byte[] buff) { - if (data == null || !mode.writable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_RW); - - data.write(ptr, buff); - ptr += buff.length; - } - - @Override - public long getPtr() { - if (data == null || !mode.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); - return ptr; - } - @Override - public void setPtr(long offset, int pos) { - if (data == null || !mode.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); - - if (pos == 0) ptr = (int)offset; - else if (pos == 1) ptr += (int)offset; - else if (pos == 2) ptr = data.length() - (int)offset; - } - - @Override - public void close() { - mode = Mode.NONE; - ptr = 0; - } - @Override - public Mode mode() { - if (data == null) return Mode.NONE; - return mode; - } - - public MemoryFile(String filename, Buffer buff, Mode mode) { - this.filename = filename; - this.data = buff; - this.mode = mode; - } - - public static MemoryFile fromFileList(String filename, java.io.File[] list) { - var res = new StringBuilder(); - - for (var el : list) res.append(el.getName()).append('\n'); - - return new MemoryFile(filename, new Buffer(res.toString().getBytes()), Mode.READ); - } -} +package me.topchetoeu.jscript.filesystem; + +import me.topchetoeu.jscript.Buffer; +import me.topchetoeu.jscript.filesystem.FilesystemException.FSCode; + +public class MemoryFile implements File { + private int ptr; + private Mode mode; + private Buffer data; + private String filename; + + public Buffer data() { return data; } + + @Override + public int read(byte[] buff) { + if (data == null || !mode.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); + var res = data.read(ptr, buff); + ptr += res; + return res; + } + @Override + public void write(byte[] buff) { + if (data == null || !mode.writable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_RW); + + data.write(ptr, buff); + ptr += buff.length; + } + + @Override + public long getPtr() { + if (data == null || !mode.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); + return ptr; + } + @Override + public void setPtr(long offset, int pos) { + if (data == null || !mode.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); + + if (pos == 0) ptr = (int)offset; + else if (pos == 1) ptr += (int)offset; + else if (pos == 2) ptr = data.length() - (int)offset; + } + + @Override + public void close() { + mode = Mode.NONE; + ptr = 0; + } + @Override + public Mode mode() { + if (data == null) return Mode.NONE; + return mode; + } + + public MemoryFile(String filename, Buffer buff, Mode mode) { + this.filename = filename; + this.data = buff; + this.mode = mode; + } + + public static MemoryFile fromFileList(String filename, java.io.File[] list) { + var res = new StringBuilder(); + + for (var el : list) res.append(el.getName()).append('\n'); + + return new MemoryFile(filename, new Buffer(res.toString().getBytes()), Mode.READ); + } +} diff --git a/src/me/topchetoeu/jscript/filesystem/MemoryFilesystem.java b/src/me/topchetoeu/jscript/filesystem/MemoryFilesystem.java index a54fcfe..3b65ebb 100644 --- a/src/me/topchetoeu/jscript/filesystem/MemoryFilesystem.java +++ b/src/me/topchetoeu/jscript/filesystem/MemoryFilesystem.java @@ -1,90 +1,90 @@ -package me.topchetoeu.jscript.filesystem; - -import java.nio.file.Path; -import java.util.HashMap; -import java.util.HashSet; - -import me.topchetoeu.jscript.Buffer; -import me.topchetoeu.jscript.filesystem.FilesystemException.FSCode; - -public class MemoryFilesystem implements Filesystem { - public final Mode mode; - private HashMap files = new HashMap<>(); - private HashSet folders = new HashSet<>(); - - private Path getPath(String name) { - return Path.of("/" + name.replace("\\", "/")).normalize(); - } - - @Override - public void create(String path, EntryType type) { - var _path = getPath(path); - - switch (type) { - case FILE: - if (!folders.contains(_path.getParent())) throw new FilesystemException(path, FSCode.DOESNT_EXIST); - if (folders.contains(_path) || files.containsKey(_path)) throw new FilesystemException(path, FSCode.ALREADY_EXISTS); - if (folders.contains(_path)) throw new FilesystemException(path, FSCode.ALREADY_EXISTS); - files.put(_path, new Buffer()); - break; - case FOLDER: - if (!folders.contains(_path.getParent())) throw new FilesystemException(path, FSCode.DOESNT_EXIST); - if (folders.contains(_path) || files.containsKey(_path)) throw new FilesystemException(path, FSCode.ALREADY_EXISTS); - folders.add(_path); - break; - default: - case NONE: - if (!folders.remove(_path) && files.remove(_path) == null) throw new FilesystemException(path, FSCode.DOESNT_EXIST); - } - } - - @Override - public File open(String path, Mode perms) { - var _path = getPath(path); - var pcount = _path.getNameCount(); - - if (files.containsKey(_path)) return new MemoryFile(path, files.get(_path), perms); - else if (folders.contains(_path)) { - var res = new StringBuilder(); - for (var folder : folders) { - if (pcount + 1 != folder.getNameCount()) continue; - if (!folder.startsWith(_path)) continue; - res.append(folder.toFile().getName()).append('\n'); - } - for (var file : files.keySet()) { - if (pcount + 1 != file.getNameCount()) continue; - if (!file.startsWith(_path)) continue; - res.append(file.toFile().getName()).append('\n'); - } - return new MemoryFile(path, new Buffer(res.toString().getBytes()), perms.intersect(Mode.READ)); - } - else throw new FilesystemException(path, FSCode.DOESNT_EXIST); - } - - @Override - public FileStat stat(String path) { - var _path = getPath(path); - - if (files.containsKey(_path)) return new FileStat(mode, EntryType.FILE); - else if (folders.contains(_path)) return new FileStat(mode, EntryType.FOLDER); - else throw new FilesystemException(path, FSCode.DOESNT_EXIST); - } - - public MemoryFilesystem put(String path, byte[] data) { - var _path = getPath(path); - var _curr = "/"; - - for (var seg : _path) { - create(_curr, EntryType.FOLDER); - _curr += seg + "/"; - } - - files.put(_path, new Buffer(data)); - return this; - } - - public MemoryFilesystem(Mode mode) { - this.mode = mode; - folders.add(Path.of("/")); - } -} +package me.topchetoeu.jscript.filesystem; + +import java.nio.file.Path; +import java.util.HashMap; +import java.util.HashSet; + +import me.topchetoeu.jscript.Buffer; +import me.topchetoeu.jscript.filesystem.FilesystemException.FSCode; + +public class MemoryFilesystem implements Filesystem { + public final Mode mode; + private HashMap files = new HashMap<>(); + private HashSet folders = new HashSet<>(); + + private Path getPath(String name) { + return Path.of("/" + name.replace("\\", "/")).normalize(); + } + + @Override + public void create(String path, EntryType type) { + var _path = getPath(path); + + switch (type) { + case FILE: + if (!folders.contains(_path.getParent())) throw new FilesystemException(path, FSCode.DOESNT_EXIST); + if (folders.contains(_path) || files.containsKey(_path)) throw new FilesystemException(path, FSCode.ALREADY_EXISTS); + if (folders.contains(_path)) throw new FilesystemException(path, FSCode.ALREADY_EXISTS); + files.put(_path, new Buffer()); + break; + case FOLDER: + if (!folders.contains(_path.getParent())) throw new FilesystemException(path, FSCode.DOESNT_EXIST); + if (folders.contains(_path) || files.containsKey(_path)) throw new FilesystemException(path, FSCode.ALREADY_EXISTS); + folders.add(_path); + break; + default: + case NONE: + if (!folders.remove(_path) && files.remove(_path) == null) throw new FilesystemException(path, FSCode.DOESNT_EXIST); + } + } + + @Override + public File open(String path, Mode perms) { + var _path = getPath(path); + var pcount = _path.getNameCount(); + + if (files.containsKey(_path)) return new MemoryFile(path, files.get(_path), perms); + else if (folders.contains(_path)) { + var res = new StringBuilder(); + for (var folder : folders) { + if (pcount + 1 != folder.getNameCount()) continue; + if (!folder.startsWith(_path)) continue; + res.append(folder.toFile().getName()).append('\n'); + } + for (var file : files.keySet()) { + if (pcount + 1 != file.getNameCount()) continue; + if (!file.startsWith(_path)) continue; + res.append(file.toFile().getName()).append('\n'); + } + return new MemoryFile(path, new Buffer(res.toString().getBytes()), perms.intersect(Mode.READ)); + } + else throw new FilesystemException(path, FSCode.DOESNT_EXIST); + } + + @Override + public FileStat stat(String path) { + var _path = getPath(path); + + if (files.containsKey(_path)) return new FileStat(mode, EntryType.FILE); + else if (folders.contains(_path)) return new FileStat(mode, EntryType.FOLDER); + else throw new FilesystemException(path, FSCode.DOESNT_EXIST); + } + + public MemoryFilesystem put(String path, byte[] data) { + var _path = getPath(path); + var _curr = "/"; + + for (var seg : _path) { + create(_curr, EntryType.FOLDER); + _curr += seg + "/"; + } + + files.put(_path, new Buffer(data)); + return this; + } + + public MemoryFilesystem(Mode mode) { + this.mode = mode; + folders.add(Path.of("/")); + } +} diff --git a/src/me/topchetoeu/jscript/interop/Native.java b/src/me/topchetoeu/jscript/interop/Native.java index b0465a6..0448c2d 100644 --- a/src/me/topchetoeu/jscript/interop/Native.java +++ b/src/me/topchetoeu/jscript/interop/Native.java @@ -1,13 +1,13 @@ -package me.topchetoeu.jscript.interop; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.TYPE }) -@Retention(RetentionPolicy.RUNTIME) -public @interface Native { - public String value() default ""; - public boolean thisArg() default false; -} +package me.topchetoeu.jscript.interop; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +public @interface Native { + public String value() default ""; + public boolean thisArg() default false; +} diff --git a/src/me/topchetoeu/jscript/interop/NativeGetter.java b/src/me/topchetoeu/jscript/interop/NativeGetter.java index 7a625ad..d7704c2 100644 --- a/src/me/topchetoeu/jscript/interop/NativeGetter.java +++ b/src/me/topchetoeu/jscript/interop/NativeGetter.java @@ -1,13 +1,13 @@ -package me.topchetoeu.jscript.interop; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target({ ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) -public @interface NativeGetter { - public String value() default ""; - public boolean thisArg() default false; -} +package me.topchetoeu.jscript.interop; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface NativeGetter { + public String value() default ""; + public boolean thisArg() default false; +} diff --git a/src/me/topchetoeu/jscript/interop/NativeSetter.java b/src/me/topchetoeu/jscript/interop/NativeSetter.java index 225eccb..f74c7a7 100644 --- a/src/me/topchetoeu/jscript/interop/NativeSetter.java +++ b/src/me/topchetoeu/jscript/interop/NativeSetter.java @@ -1,13 +1,13 @@ -package me.topchetoeu.jscript.interop; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target({ ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) -public @interface NativeSetter { - public String value() default ""; - public boolean thisArg() default false; -} +package me.topchetoeu.jscript.interop; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface NativeSetter { + public String value() default ""; + public boolean thisArg() default false; +} diff --git a/src/me/topchetoeu/jscript/interop/OverloadFunction.java b/src/me/topchetoeu/jscript/interop/OverloadFunction.java index ac6bcfd..c896d1b 100644 --- a/src/me/topchetoeu/jscript/interop/OverloadFunction.java +++ b/src/me/topchetoeu/jscript/interop/OverloadFunction.java @@ -1,127 +1,127 @@ -package me.topchetoeu.jscript.interop; - -import java.lang.reflect.Array; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.values.FunctionValue; -import me.topchetoeu.jscript.engine.values.NativeWrapper; -import me.topchetoeu.jscript.engine.values.Values; -import me.topchetoeu.jscript.exceptions.ConvertException; -import me.topchetoeu.jscript.exceptions.EngineException; -import me.topchetoeu.jscript.exceptions.InterruptException; - -public class OverloadFunction extends FunctionValue { - public final List overloads = new ArrayList<>(); - - public Object call(Context ctx, Object thisArg, Object ...args) { - loop: for (var overload : overloads) { - Object[] newArgs = new Object[overload.params.length]; - - boolean consumesEngine = overload.params.length > 0 && overload.params[0] == Context.class; - int start = (consumesEngine ? 1 : 0) + (overload.passThis ? 1 : 0); - int end = overload.params.length - (overload.variadic ? 1 : 0); - - for (var i = start; i < end; i++) { - Object val; - - if (i - start >= args.length) val = null; - else val = args[i - start]; - - try { - newArgs[i] = Values.convert(ctx, val, overload.params[i]); - } - catch (ConvertException e) { - if (overloads.size() > 1) continue loop; - else throw EngineException.ofType(String.format("Argument %d can't be converted from %s to %s", i - start, e.source, e.target)); - } - } - - if (overload.variadic) { - var type = overload.params[overload.params.length - 1].getComponentType(); - var n = Math.max(args.length - end + start, 0); - Object varArg = Array.newInstance(type, n); - - for (var i = 0; i < n; i++) { - try { - Array.set(varArg, i, Values.convert(ctx, args[i + end - start], type)); - } - catch (ConvertException e) { - if (overloads.size() > 1) continue loop; - else throw EngineException.ofType(String.format("Element in variadic argument can't be converted from %s to %s", e.source, e.target)); - } - } - - newArgs[newArgs.length - 1] = varArg; - } - - var thisArgType = overload.passThis ? overload.params[consumesEngine ? 1 : 0] : overload.thisArg; - Object _this; - - try { - _this = thisArgType == null ? null : Values.convert(ctx, thisArg, thisArgType); - } - catch (ConvertException e) { - if (overloads.size() > 1) continue loop; - else throw EngineException.ofType(String.format("This argument can't be converted from %s to %s", e.source, e.target)); - } - - if (consumesEngine) newArgs[0] = ctx; - if (overload.passThis) { - newArgs[consumesEngine ? 1 : 0] = _this; - _this = null; - } - - try { - return Values.normalize(ctx, overload.runner.run(ctx, _this, newArgs)); - } - catch (InstantiationException e) { throw EngineException.ofError("The class may not be instantiated."); } - catch (IllegalAccessException | IllegalArgumentException e) { continue; } - catch (InvocationTargetException e) { - var loc = Location.INTERNAL; - if (e.getTargetException() instanceof EngineException) { - throw ((EngineException)e.getTargetException()).add(ctx, name, loc); - } - else if (e.getTargetException() instanceof NullPointerException) { - e.printStackTrace(); - throw EngineException.ofType("Unexpected value of 'undefined'.").add(ctx, name, loc); - } - else if (e.getTargetException() instanceof InterruptException || e.getTargetException() instanceof InterruptedException) { - throw new InterruptException(); - } - else { - var target = e.getTargetException(); - var targetClass = target.getClass(); - var err = new NativeWrapper(e.getTargetException()); - - err.defineProperty(ctx, "message", target.getMessage()); - err.defineProperty(ctx, "name", NativeWrapperProvider.getName(targetClass)); - - throw new EngineException(err).add(ctx, name, loc); - } - } - catch (ReflectiveOperationException e) { - throw EngineException.ofError(e.getMessage()).add(ctx, name, Location.INTERNAL); - } - } - - throw EngineException.ofType("No overload found for native method."); - } - - public OverloadFunction add(Overload overload) { - this.overloads.add(overload); - return this; - } - - public OverloadFunction(String name) { - super(name, 0); - } - - public static OverloadFunction of(String name, Overload overload) { - if (overload == null) return null; - else return new OverloadFunction(name).add(overload); - } -} +package me.topchetoeu.jscript.interop; + +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.values.FunctionValue; +import me.topchetoeu.jscript.engine.values.NativeWrapper; +import me.topchetoeu.jscript.engine.values.Values; +import me.topchetoeu.jscript.exceptions.ConvertException; +import me.topchetoeu.jscript.exceptions.EngineException; +import me.topchetoeu.jscript.exceptions.InterruptException; + +public class OverloadFunction extends FunctionValue { + public final List overloads = new ArrayList<>(); + + public Object call(Context ctx, Object thisArg, Object ...args) { + loop: for (var overload : overloads) { + Object[] newArgs = new Object[overload.params.length]; + + boolean consumesEngine = overload.params.length > 0 && overload.params[0] == Context.class; + int start = (consumesEngine ? 1 : 0) + (overload.passThis ? 1 : 0); + int end = overload.params.length - (overload.variadic ? 1 : 0); + + for (var i = start; i < end; i++) { + Object val; + + if (i - start >= args.length) val = null; + else val = args[i - start]; + + try { + newArgs[i] = Values.convert(ctx, val, overload.params[i]); + } + catch (ConvertException e) { + if (overloads.size() > 1) continue loop; + else throw EngineException.ofType(String.format("Argument %d can't be converted from %s to %s", i - start, e.source, e.target)); + } + } + + if (overload.variadic) { + var type = overload.params[overload.params.length - 1].getComponentType(); + var n = Math.max(args.length - end + start, 0); + Object varArg = Array.newInstance(type, n); + + for (var i = 0; i < n; i++) { + try { + Array.set(varArg, i, Values.convert(ctx, args[i + end - start], type)); + } + catch (ConvertException e) { + if (overloads.size() > 1) continue loop; + else throw EngineException.ofType(String.format("Element in variadic argument can't be converted from %s to %s", e.source, e.target)); + } + } + + newArgs[newArgs.length - 1] = varArg; + } + + var thisArgType = overload.passThis ? overload.params[consumesEngine ? 1 : 0] : overload.thisArg; + Object _this; + + try { + _this = thisArgType == null ? null : Values.convert(ctx, thisArg, thisArgType); + } + catch (ConvertException e) { + if (overloads.size() > 1) continue loop; + else throw EngineException.ofType(String.format("This argument can't be converted from %s to %s", e.source, e.target)); + } + + if (consumesEngine) newArgs[0] = ctx; + if (overload.passThis) { + newArgs[consumesEngine ? 1 : 0] = _this; + _this = null; + } + + try { + return Values.normalize(ctx, overload.runner.run(ctx, _this, newArgs)); + } + catch (InstantiationException e) { throw EngineException.ofError("The class may not be instantiated."); } + catch (IllegalAccessException | IllegalArgumentException e) { continue; } + catch (InvocationTargetException e) { + var loc = Location.INTERNAL; + if (e.getTargetException() instanceof EngineException) { + throw ((EngineException)e.getTargetException()).add(ctx, name, loc); + } + else if (e.getTargetException() instanceof NullPointerException) { + e.printStackTrace(); + throw EngineException.ofType("Unexpected value of 'undefined'.").add(ctx, name, loc); + } + else if (e.getTargetException() instanceof InterruptException || e.getTargetException() instanceof InterruptedException) { + throw new InterruptException(); + } + else { + var target = e.getTargetException(); + var targetClass = target.getClass(); + var err = new NativeWrapper(e.getTargetException()); + + err.defineProperty(ctx, "message", target.getMessage()); + err.defineProperty(ctx, "name", NativeWrapperProvider.getName(targetClass)); + + throw new EngineException(err).add(ctx, name, loc); + } + } + catch (ReflectiveOperationException e) { + throw EngineException.ofError(e.getMessage()).add(ctx, name, Location.INTERNAL); + } + } + + throw EngineException.ofType("No overload found for native method."); + } + + public OverloadFunction add(Overload overload) { + this.overloads.add(overload); + return this; + } + + public OverloadFunction(String name) { + super(name, 0); + } + + public static OverloadFunction of(String name, Overload overload) { + if (overload == null) return null; + else return new OverloadFunction(name).add(overload); + } +} diff --git a/src/me/topchetoeu/jscript/json/JSON.java b/src/me/topchetoeu/jscript/json/JSON.java index fcf6355..5f9c685 100644 --- a/src/me/topchetoeu/jscript/json/JSON.java +++ b/src/me/topchetoeu/jscript/json/JSON.java @@ -1,243 +1,243 @@ -package me.topchetoeu.jscript.json; - -import java.util.HashSet; -import java.util.List; -import java.util.stream.Collectors; - -import me.topchetoeu.jscript.Filename; -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.values.ArrayValue; -import me.topchetoeu.jscript.engine.values.ObjectValue; -import me.topchetoeu.jscript.engine.values.Values; -import me.topchetoeu.jscript.exceptions.EngineException; -import me.topchetoeu.jscript.exceptions.SyntaxException; -import me.topchetoeu.jscript.parsing.Operator; -import me.topchetoeu.jscript.parsing.ParseRes; -import me.topchetoeu.jscript.parsing.Parsing; -import me.topchetoeu.jscript.parsing.Token; - -public class JSON { - public static Object toJs(JSONElement val) { - if (val.isBoolean()) return val.bool(); - if (val.isString()) return val.string(); - if (val.isNumber()) return val.number(); - if (val.isList()) return ArrayValue.of(null, val.list().stream().map(JSON::toJs).collect(Collectors.toList())); - if (val.isMap()) { - var res = new ObjectValue(); - for (var el : val.map().entrySet()) { - res.defineProperty(null, el.getKey(), toJs(el.getValue())); - } - return res; - } - if (val.isNull()) return Values.NULL; - return null; - } - private static JSONElement fromJs(Context ctx, Object val, HashSet prev) { - if (val instanceof Boolean) return JSONElement.bool((boolean)val); - if (val instanceof Number) return JSONElement.number(((Number)val).doubleValue()); - if (val instanceof String) return JSONElement.string((String)val); - if (val == Values.NULL) return JSONElement.NULL; - if (val instanceof ArrayValue) { - if (prev.contains(val)) throw new EngineException("Circular dependency in JSON."); - prev.add(val); - - var res = new JSONList(); - - for (var el : ((ArrayValue)val).toArray()) { - var jsonEl = fromJs(ctx, el, prev); - if (jsonEl == null) jsonEl = JSONElement.NULL; - res.add(jsonEl); - } - - prev.remove(val); - return JSONElement.of(res); - } - if (val instanceof ObjectValue) { - if (prev.contains(val)) throw new EngineException("Circular dependency in JSON."); - prev.add(val); - - var res = new JSONMap(); - - for (var el : ((ObjectValue)val).keys(false)) { - var jsonEl = fromJs(ctx, ((ObjectValue)val).getMember(ctx, el), prev); - if (jsonEl == null) continue; - if (el instanceof String || el instanceof Number) res.put(el.toString(), jsonEl); - } - - prev.remove(val); - return JSONElement.of(res); - } - if (val == null) return null; - return null; - } - public static JSONElement fromJs(Context ctx, Object val) { - return fromJs(ctx, val, new HashSet<>()); - } - - public static ParseRes parseIdentifier(List tokens, int i) { - return Parsing.parseIdentifier(tokens, i); - } - public static ParseRes parseString(Filename filename, List tokens, int i) { - var res = Parsing.parseString(filename, tokens, i); - if (res.isSuccess()) return ParseRes.res((String)res.result.value, res.n); - else return res.transform(); - } - public static ParseRes parseNumber(Filename filename, List tokens, int i) { - var minus = Parsing.isOperator(tokens, i, Operator.SUBTRACT); - if (minus) i++; - - var res = Parsing.parseNumber(filename, tokens, i); - if (res.isSuccess()) return ParseRes.res((minus ? -1 : 1) * (Double)res.result.value, res.n + (minus ? 1 : 0)); - else return res.transform(); - } - public static ParseRes parseBool(Filename filename, List tokens, int i) { - var id = parseIdentifier(tokens, i); - - if (!id.isSuccess()) return ParseRes.failed(); - else if (id.result.equals("true")) return ParseRes.res(true, 1); - else if (id.result.equals("false")) return ParseRes.res(false, 1); - else return ParseRes.failed(); - } - - public static ParseRes parseValue(Filename filename, List tokens, int i) { - return ParseRes.any( - parseString(filename, tokens, i), - parseNumber(filename, tokens, i), - parseBool(filename, tokens, i), - parseMap(filename, tokens, i), - parseList(filename, tokens, i) - ); - } - - public static ParseRes parseMap(Filename filename, List tokens, int i) { - int n = 0; - if (!Parsing.isOperator(tokens, i + n++, Operator.BRACE_OPEN)) return ParseRes.failed(); - - var values = new JSONMap(); - - while (true) { - if (Parsing.isOperator(tokens, i + n, Operator.BRACE_CLOSE)) { - n++; - break; - } - - var name = ParseRes.any( - parseIdentifier(tokens, i + n), - parseString(filename, tokens, i + n), - parseNumber(filename, tokens, i + n) - ); - if (!name.isSuccess()) return ParseRes.error(Parsing.getLoc(filename, tokens, i + n), "Expected an index.", name); - else n += name.n; - - if (!Parsing.isOperator(tokens, i + n, Operator.COLON)) { - return ParseRes.error(Parsing.getLoc(filename, tokens, i + n), "Expected a colon.", name); - } - n++; - - var res = parseValue(filename, tokens, i + n); - if (!res.isSuccess()) return ParseRes.error(Parsing.getLoc(filename, tokens, i + n), "Expected a list element.", res); - else n += res.n; - - values.put(name.result.toString(), JSONElement.of(res.result)); - - if (Parsing.isOperator(tokens, i + n, Operator.COMMA)) n++; - else if (Parsing.isOperator(tokens, i + n, Operator.BRACE_CLOSE)) { - n++; - break; - } - } - - return ParseRes.res(values, n); - } - public static ParseRes parseList(Filename filename, List tokens, int i) { - int n = 0; - if (!Parsing.isOperator(tokens, i + n++, Operator.BRACKET_OPEN)) return ParseRes.failed(); - - var values = new JSONList(); - - while (true) { - if (Parsing.isOperator(tokens, i + n, Operator.BRACKET_CLOSE)) { - n++; - break; - } - - var res = parseValue(filename, tokens, i + n); - if (!res.isSuccess()) return ParseRes.error(Parsing.getLoc(filename, tokens, i + n), "Expected a list element.", res); - else n += res.n; - - values.add(JSONElement.of(res.result)); - - if (Parsing.isOperator(tokens, i + n, Operator.COMMA)) n++; - else if (Parsing.isOperator(tokens, i + n, Operator.BRACKET_CLOSE)) { - n++; - break; - } - } - - return ParseRes.res(values, n); - } - public static JSONElement parse(Filename filename, String raw) { - if (filename == null) filename = new Filename("jscript", "json"); - var res = parseValue(filename, Parsing.tokenize(filename, raw), 0); - if (res.isFailed()) throw new SyntaxException(null, "Invalid JSON given."); - else if (res.isError()) throw new SyntaxException(null, res.error); - else return JSONElement.of(res.result); - } - - public static String stringify(JSONElement el) { - if (el.isNumber()) return Double.toString(el.number()); - if (el.isBoolean()) return el.bool() ? "true" : "false"; - if (el.isNull()) return "null"; - if (el.isString()) { - var res = new StringBuilder("\""); - var alphabet = "0123456789ABCDEF".toCharArray(); - - for (var c : el.string().toCharArray()) { - if (c < 32 || c >= 127) { - res - .append("\\u") - .append(alphabet[(c >> 12) & 0xF]) - .append(alphabet[(c >> 8) & 0xF]) - .append(alphabet[(c >> 4) & 0xF]) - .append(alphabet[(c >> 0) & 0xF]); - } - else if (c == '\\') - res.append("\\\\"); - else if (c == '"') - res.append("\\\""); - else res.append(c); - } - - return res.append('"').toString(); - } - if (el.isList()) { - var res = new StringBuilder().append("["); - for (int i = 0; i < el.list().size(); i++) { - if (i != 0) res.append(","); - res.append(stringify(el.list().get(i))); - } - res.append("]"); - return res.toString(); - } - if (el.isMap()) { - var res = new StringBuilder().append("{"); - var entries = el.map().entrySet().stream().collect(Collectors.toList()); - - for (int i = 0; i < entries.size(); i++) { - if (i != 0) res.append(","); - res.append(stringify(JSONElement.string(entries.get(i).getKey()))); - res.append(":"); - res.append(stringify(entries.get(i).getValue())); - } - res.append("}"); - return res.toString(); - } - return null; - } - public static String stringify(JSONMap map) { - return stringify(JSONElement.of(map)); - } - public static String stringify(JSONList list) { - return stringify(JSONElement.of(list)); - } -} +package me.topchetoeu.jscript.json; + +import java.util.HashSet; +import java.util.List; +import java.util.stream.Collectors; + +import me.topchetoeu.jscript.Filename; +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.values.ArrayValue; +import me.topchetoeu.jscript.engine.values.ObjectValue; +import me.topchetoeu.jscript.engine.values.Values; +import me.topchetoeu.jscript.exceptions.EngineException; +import me.topchetoeu.jscript.exceptions.SyntaxException; +import me.topchetoeu.jscript.parsing.Operator; +import me.topchetoeu.jscript.parsing.ParseRes; +import me.topchetoeu.jscript.parsing.Parsing; +import me.topchetoeu.jscript.parsing.Token; + +public class JSON { + public static Object toJs(JSONElement val) { + if (val.isBoolean()) return val.bool(); + if (val.isString()) return val.string(); + if (val.isNumber()) return val.number(); + if (val.isList()) return ArrayValue.of(null, val.list().stream().map(JSON::toJs).collect(Collectors.toList())); + if (val.isMap()) { + var res = new ObjectValue(); + for (var el : val.map().entrySet()) { + res.defineProperty(null, el.getKey(), toJs(el.getValue())); + } + return res; + } + if (val.isNull()) return Values.NULL; + return null; + } + private static JSONElement fromJs(Context ctx, Object val, HashSet prev) { + if (val instanceof Boolean) return JSONElement.bool((boolean)val); + if (val instanceof Number) return JSONElement.number(((Number)val).doubleValue()); + if (val instanceof String) return JSONElement.string((String)val); + if (val == Values.NULL) return JSONElement.NULL; + if (val instanceof ArrayValue) { + if (prev.contains(val)) throw new EngineException("Circular dependency in JSON."); + prev.add(val); + + var res = new JSONList(); + + for (var el : ((ArrayValue)val).toArray()) { + var jsonEl = fromJs(ctx, el, prev); + if (jsonEl == null) jsonEl = JSONElement.NULL; + res.add(jsonEl); + } + + prev.remove(val); + return JSONElement.of(res); + } + if (val instanceof ObjectValue) { + if (prev.contains(val)) throw new EngineException("Circular dependency in JSON."); + prev.add(val); + + var res = new JSONMap(); + + for (var el : ((ObjectValue)val).keys(false)) { + var jsonEl = fromJs(ctx, ((ObjectValue)val).getMember(ctx, el), prev); + if (jsonEl == null) continue; + if (el instanceof String || el instanceof Number) res.put(el.toString(), jsonEl); + } + + prev.remove(val); + return JSONElement.of(res); + } + if (val == null) return null; + return null; + } + public static JSONElement fromJs(Context ctx, Object val) { + return fromJs(ctx, val, new HashSet<>()); + } + + public static ParseRes parseIdentifier(List tokens, int i) { + return Parsing.parseIdentifier(tokens, i); + } + public static ParseRes parseString(Filename filename, List tokens, int i) { + var res = Parsing.parseString(filename, tokens, i); + if (res.isSuccess()) return ParseRes.res((String)res.result.value, res.n); + else return res.transform(); + } + public static ParseRes parseNumber(Filename filename, List tokens, int i) { + var minus = Parsing.isOperator(tokens, i, Operator.SUBTRACT); + if (minus) i++; + + var res = Parsing.parseNumber(filename, tokens, i); + if (res.isSuccess()) return ParseRes.res((minus ? -1 : 1) * (Double)res.result.value, res.n + (minus ? 1 : 0)); + else return res.transform(); + } + public static ParseRes parseBool(Filename filename, List tokens, int i) { + var id = parseIdentifier(tokens, i); + + if (!id.isSuccess()) return ParseRes.failed(); + else if (id.result.equals("true")) return ParseRes.res(true, 1); + else if (id.result.equals("false")) return ParseRes.res(false, 1); + else return ParseRes.failed(); + } + + public static ParseRes parseValue(Filename filename, List tokens, int i) { + return ParseRes.any( + parseString(filename, tokens, i), + parseNumber(filename, tokens, i), + parseBool(filename, tokens, i), + parseMap(filename, tokens, i), + parseList(filename, tokens, i) + ); + } + + public static ParseRes parseMap(Filename filename, List tokens, int i) { + int n = 0; + if (!Parsing.isOperator(tokens, i + n++, Operator.BRACE_OPEN)) return ParseRes.failed(); + + var values = new JSONMap(); + + while (true) { + if (Parsing.isOperator(tokens, i + n, Operator.BRACE_CLOSE)) { + n++; + break; + } + + var name = ParseRes.any( + parseIdentifier(tokens, i + n), + parseString(filename, tokens, i + n), + parseNumber(filename, tokens, i + n) + ); + if (!name.isSuccess()) return ParseRes.error(Parsing.getLoc(filename, tokens, i + n), "Expected an index.", name); + else n += name.n; + + if (!Parsing.isOperator(tokens, i + n, Operator.COLON)) { + return ParseRes.error(Parsing.getLoc(filename, tokens, i + n), "Expected a colon.", name); + } + n++; + + var res = parseValue(filename, tokens, i + n); + if (!res.isSuccess()) return ParseRes.error(Parsing.getLoc(filename, tokens, i + n), "Expected a list element.", res); + else n += res.n; + + values.put(name.result.toString(), JSONElement.of(res.result)); + + if (Parsing.isOperator(tokens, i + n, Operator.COMMA)) n++; + else if (Parsing.isOperator(tokens, i + n, Operator.BRACE_CLOSE)) { + n++; + break; + } + } + + return ParseRes.res(values, n); + } + public static ParseRes parseList(Filename filename, List tokens, int i) { + int n = 0; + if (!Parsing.isOperator(tokens, i + n++, Operator.BRACKET_OPEN)) return ParseRes.failed(); + + var values = new JSONList(); + + while (true) { + if (Parsing.isOperator(tokens, i + n, Operator.BRACKET_CLOSE)) { + n++; + break; + } + + var res = parseValue(filename, tokens, i + n); + if (!res.isSuccess()) return ParseRes.error(Parsing.getLoc(filename, tokens, i + n), "Expected a list element.", res); + else n += res.n; + + values.add(JSONElement.of(res.result)); + + if (Parsing.isOperator(tokens, i + n, Operator.COMMA)) n++; + else if (Parsing.isOperator(tokens, i + n, Operator.BRACKET_CLOSE)) { + n++; + break; + } + } + + return ParseRes.res(values, n); + } + public static JSONElement parse(Filename filename, String raw) { + if (filename == null) filename = new Filename("jscript", "json"); + var res = parseValue(filename, Parsing.tokenize(filename, raw), 0); + if (res.isFailed()) throw new SyntaxException(null, "Invalid JSON given."); + else if (res.isError()) throw new SyntaxException(null, res.error); + else return JSONElement.of(res.result); + } + + public static String stringify(JSONElement el) { + if (el.isNumber()) return Double.toString(el.number()); + if (el.isBoolean()) return el.bool() ? "true" : "false"; + if (el.isNull()) return "null"; + if (el.isString()) { + var res = new StringBuilder("\""); + var alphabet = "0123456789ABCDEF".toCharArray(); + + for (var c : el.string().toCharArray()) { + if (c < 32 || c >= 127) { + res + .append("\\u") + .append(alphabet[(c >> 12) & 0xF]) + .append(alphabet[(c >> 8) & 0xF]) + .append(alphabet[(c >> 4) & 0xF]) + .append(alphabet[(c >> 0) & 0xF]); + } + else if (c == '\\') + res.append("\\\\"); + else if (c == '"') + res.append("\\\""); + else res.append(c); + } + + return res.append('"').toString(); + } + if (el.isList()) { + var res = new StringBuilder().append("["); + for (int i = 0; i < el.list().size(); i++) { + if (i != 0) res.append(","); + res.append(stringify(el.list().get(i))); + } + res.append("]"); + return res.toString(); + } + if (el.isMap()) { + var res = new StringBuilder().append("{"); + var entries = el.map().entrySet().stream().collect(Collectors.toList()); + + for (int i = 0; i < entries.size(); i++) { + if (i != 0) res.append(","); + res.append(stringify(JSONElement.string(entries.get(i).getKey()))); + res.append(":"); + res.append(stringify(entries.get(i).getValue())); + } + res.append("}"); + return res.toString(); + } + return null; + } + public static String stringify(JSONMap map) { + return stringify(JSONElement.of(map)); + } + public static String stringify(JSONList list) { + return stringify(JSONElement.of(list)); + } +} diff --git a/src/me/topchetoeu/jscript/json/JSONElement.java b/src/me/topchetoeu/jscript/json/JSONElement.java index 8e03c7f..f2bcc38 100644 --- a/src/me/topchetoeu/jscript/json/JSONElement.java +++ b/src/me/topchetoeu/jscript/json/JSONElement.java @@ -1,88 +1,88 @@ -package me.topchetoeu.jscript.json; - -public class JSONElement { - public static enum Type { - STRING, - NUMBER, - BOOLEAN, - NULL, - LIST, - MAP, - } - - public static final JSONElement NULL = new JSONElement(Type.NULL, null); - - public static JSONElement map(JSONMap val) { - return new JSONElement(Type.MAP, val); - } - public static JSONElement list(JSONList val) { - return new JSONElement(Type.LIST, val); - } - public static JSONElement string(String val) { - return new JSONElement(Type.STRING, val); - } - public static JSONElement number(double val) { - return new JSONElement(Type.NUMBER, val); - } - public static JSONElement bool(boolean val) { - return new JSONElement(Type.BOOLEAN, val); - } - - public static JSONElement of(Object val) { - if (val instanceof JSONMap) return map((JSONMap)val); - else if (val instanceof JSONList) return list((JSONList)val); - else if (val instanceof String) return string((String)val); - else if (val instanceof Boolean) return bool((Boolean)val); - else if (val instanceof Number) return number(((Number)val).doubleValue()); - else if (val == null) return NULL; - else throw new IllegalArgumentException("val must be: String, Boolean, Number, JSONList or JSONMap."); - } - - public final Type type; - private final Object value; - - public boolean isMap() { return type == Type.MAP; } - public boolean isList() { return type == Type.LIST; } - public boolean isString() { return type == Type.STRING; } - public boolean isNumber() { return type == Type.NUMBER; } - public boolean isBoolean() { return type == Type.BOOLEAN; } - public boolean isNull() { return type == Type.NULL; } - - public JSONMap map() { - if (!isMap()) throw new IllegalStateException("Element is not a map."); - return (JSONMap)value; - } - public JSONList list() { - if (!isList()) throw new IllegalStateException("Element is not a map."); - return (JSONList)value; - } - public String string() { - if (!isString()) throw new IllegalStateException("Element is not a string."); - return (String)value; - } - public double number() { - if (!isNumber()) throw new IllegalStateException("Element is not a number."); - return (double)value; - } - public boolean bool() { - if (!isBoolean()) throw new IllegalStateException("Element is not a boolean."); - return (boolean)value; - } - - @Override - public String toString() { - if (isMap()) return "{...}"; - if (isList()) return "[...]"; - if (isString()) return (String)value; - if (isString()) return (String)value; - if (isNumber()) return (double)value + ""; - if (isBoolean()) return (boolean)value + ""; - if (isNull()) return "null"; - return ""; - } - - private JSONElement(Type type, Object val) { - this.type = type; - this.value = val; - } -} +package me.topchetoeu.jscript.json; + +public class JSONElement { + public static enum Type { + STRING, + NUMBER, + BOOLEAN, + NULL, + LIST, + MAP, + } + + public static final JSONElement NULL = new JSONElement(Type.NULL, null); + + public static JSONElement map(JSONMap val) { + return new JSONElement(Type.MAP, val); + } + public static JSONElement list(JSONList val) { + return new JSONElement(Type.LIST, val); + } + public static JSONElement string(String val) { + return new JSONElement(Type.STRING, val); + } + public static JSONElement number(double val) { + return new JSONElement(Type.NUMBER, val); + } + public static JSONElement bool(boolean val) { + return new JSONElement(Type.BOOLEAN, val); + } + + public static JSONElement of(Object val) { + if (val instanceof JSONMap) return map((JSONMap)val); + else if (val instanceof JSONList) return list((JSONList)val); + else if (val instanceof String) return string((String)val); + else if (val instanceof Boolean) return bool((Boolean)val); + else if (val instanceof Number) return number(((Number)val).doubleValue()); + else if (val == null) return NULL; + else throw new IllegalArgumentException("val must be: String, Boolean, Number, JSONList or JSONMap."); + } + + public final Type type; + private final Object value; + + public boolean isMap() { return type == Type.MAP; } + public boolean isList() { return type == Type.LIST; } + public boolean isString() { return type == Type.STRING; } + public boolean isNumber() { return type == Type.NUMBER; } + public boolean isBoolean() { return type == Type.BOOLEAN; } + public boolean isNull() { return type == Type.NULL; } + + public JSONMap map() { + if (!isMap()) throw new IllegalStateException("Element is not a map."); + return (JSONMap)value; + } + public JSONList list() { + if (!isList()) throw new IllegalStateException("Element is not a map."); + return (JSONList)value; + } + public String string() { + if (!isString()) throw new IllegalStateException("Element is not a string."); + return (String)value; + } + public double number() { + if (!isNumber()) throw new IllegalStateException("Element is not a number."); + return (double)value; + } + public boolean bool() { + if (!isBoolean()) throw new IllegalStateException("Element is not a boolean."); + return (boolean)value; + } + + @Override + public String toString() { + if (isMap()) return "{...}"; + if (isList()) return "[...]"; + if (isString()) return (String)value; + if (isString()) return (String)value; + if (isNumber()) return (double)value + ""; + if (isBoolean()) return (boolean)value + ""; + if (isNull()) return "null"; + return ""; + } + + private JSONElement(Type type, Object val) { + this.type = type; + this.value = val; + } +} diff --git a/src/me/topchetoeu/jscript/json/JSONList.java b/src/me/topchetoeu/jscript/json/JSONList.java index 214ca40..6acca3d 100644 --- a/src/me/topchetoeu/jscript/json/JSONList.java +++ b/src/me/topchetoeu/jscript/json/JSONList.java @@ -1,26 +1,26 @@ -package me.topchetoeu.jscript.json; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -public class JSONList extends ArrayList { - public JSONList() {} - public JSONList(JSONElement ...els) { - super(List.of(els)); - } - public JSONList(Collection els) { - super(els); - } - - public JSONList addNull() { this.add(JSONElement.NULL); return this; } - public JSONList add(String val) { this.add(JSONElement.of(val)); return this; } - public JSONList add(double val) { this.add(JSONElement.of(val)); return this; } - public JSONList add(boolean val) { this.add(JSONElement.of(val)); return this; } - public JSONList add(Map val) { this.add(JSONElement.of(val)); return this; } - public JSONList add(Collection val) { this.add(JSONElement.of(val)); return this; } - public JSONList add(JSONMap val) { this.add(JSONElement.of(val)); return this; } - public JSONList add(JSONList val) { this.add(JSONElement.of(val)); return this; } - -} +package me.topchetoeu.jscript.json; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +public class JSONList extends ArrayList { + public JSONList() {} + public JSONList(JSONElement ...els) { + super(List.of(els)); + } + public JSONList(Collection els) { + super(els); + } + + public JSONList addNull() { this.add(JSONElement.NULL); return this; } + public JSONList add(String val) { this.add(JSONElement.of(val)); return this; } + public JSONList add(double val) { this.add(JSONElement.of(val)); return this; } + public JSONList add(boolean val) { this.add(JSONElement.of(val)); return this; } + public JSONList add(Map val) { this.add(JSONElement.of(val)); return this; } + public JSONList add(Collection val) { this.add(JSONElement.of(val)); return this; } + public JSONList add(JSONMap val) { this.add(JSONElement.of(val)); return this; } + public JSONList add(JSONList val) { this.add(JSONElement.of(val)); return this; } + +} diff --git a/src/me/topchetoeu/jscript/json/JSONMap.java b/src/me/topchetoeu/jscript/json/JSONMap.java index dc6d845..c5e00f2 100644 --- a/src/me/topchetoeu/jscript/json/JSONMap.java +++ b/src/me/topchetoeu/jscript/json/JSONMap.java @@ -1,150 +1,150 @@ -package me.topchetoeu.jscript.json; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -public class JSONMap implements Map { - private Map elements = new HashMap<>(); - - public JSONElement get(String path) { - var curr = this; - var segs = path.split("\\."); - var i = 0; - - while (true) { - var tmp = curr.elements.get(segs[i++]); - if (i == segs.length) return tmp; - if (!tmp.isMap()) return null; - curr = tmp.map(); - } - } - - public boolean isMap(String path) { - var el = get(path); - return el != null && el.isMap(); - } - public boolean isList(String path) { - var el = get(path); - return el != null && el.isList(); - } - public boolean isString(String path) { - var el = get(path); - return el != null && el.isString(); - } - public boolean isNumber(String path) { - var el = get(path); - return el != null && el.isNumber(); - } - public boolean isBoolean(String path) { - var el = get(path); - return el != null && el.isBoolean(); - } - public boolean isNull(String path) { - var el = get(path); - return el != null && el.isNull(); - } - public boolean contains(String path) { - return get(path) != null; - } - - public JSONMap map(String path) { - var el = get(path); - if (el == null) throw new RuntimeException(String.format("'%s' doesn't exist.", path)); - return el.map(); - } - public JSONMap map(String path, JSONMap defaultVal) { - var el = get(path); - if (el == null) return defaultVal; - if (el.isMap()) return el.map(); - return defaultVal; - } - - public JSONList list(String path) { - var el = get(path); - if (el == null) throw new RuntimeException(String.format("'%s' doesn't exist.", path)); - return el.list(); - } - public JSONList list(String path, JSONList defaultVal) { - var el = get(path); - if (el == null) return defaultVal; - if (el.isList()) return el.list(); - return defaultVal; - } - - public String string(String path) { - var el = get(path); - if (el == null) throw new RuntimeException(String.format("'%s' doesn't exist.", path)); - return el.string(); - } - public String string(String path, String defaultVal) { - var el = get(path); - if (el == null) return defaultVal; - if (el.isString()) return el.string(); - return defaultVal; - } - - public double number(String path) { - var el = get(path); - if (el == null) throw new RuntimeException(String.format("'%s' doesn't exist.", path)); - return el.number(); - } - public double number(String path, double defaultVal) { - var el = get(path); - if (el == null) return defaultVal; - if (el.isNumber()) return el.number(); - return defaultVal; - } - - public boolean bool(String path) { - var el = get(path); - if (el == null) throw new RuntimeException(String.format("'%s' doesn't exist.", path)); - return el.bool(); - } - public boolean bool(String path, boolean defaultVal) { - var el = get(path); - if (el == null) return defaultVal; - if (el.isBoolean()) return el.bool(); - return defaultVal; - } - - public JSONMap setNull(String key) { elements.put(key, JSONElement.NULL); return this; } - public JSONMap set(String key, String val) { elements.put(key, JSONElement.of(val)); return this; } - public JSONMap set(String key, double val) { elements.put(key, JSONElement.of(val)); return this; } - public JSONMap set(String key, boolean val) { elements.put(key, JSONElement.of(val)); return this; } - public JSONMap set(String key, Map val) { elements.put(key, JSONElement.of(val)); return this; } - public JSONMap set(String key, Collection val) { elements.put(key, JSONElement.of(val)); return this; } - - @Override - public int size() { return elements.size(); } - @Override - public boolean isEmpty() { return elements.isEmpty(); } - @Override - public boolean containsKey(Object key) { return elements.containsKey(key); } - @Override - public boolean containsValue(Object value) { return elements.containsValue(value); } - @Override - public JSONElement get(Object key) { return elements.get(key); } - @Override - public JSONElement put(String key, JSONElement value) { return elements.put(key, value); } - @Override - public JSONElement remove(Object key) { return elements.remove(key); } - @Override - public void putAll(Map m) { elements.putAll(m); } - - @Override - public void clear() { elements.clear(); } - - @Override - public Set keySet() { return elements.keySet(); } - @Override - public Collection values() { return elements.values(); } - @Override - public Set> entrySet() { return elements.entrySet(); } - - public JSONMap() { } - public JSONMap(Map els) { - this.elements = new HashMap<>(els); - } -} +package me.topchetoeu.jscript.json; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +public class JSONMap implements Map { + private Map elements = new HashMap<>(); + + public JSONElement get(String path) { + var curr = this; + var segs = path.split("\\."); + var i = 0; + + while (true) { + var tmp = curr.elements.get(segs[i++]); + if (i == segs.length) return tmp; + if (!tmp.isMap()) return null; + curr = tmp.map(); + } + } + + public boolean isMap(String path) { + var el = get(path); + return el != null && el.isMap(); + } + public boolean isList(String path) { + var el = get(path); + return el != null && el.isList(); + } + public boolean isString(String path) { + var el = get(path); + return el != null && el.isString(); + } + public boolean isNumber(String path) { + var el = get(path); + return el != null && el.isNumber(); + } + public boolean isBoolean(String path) { + var el = get(path); + return el != null && el.isBoolean(); + } + public boolean isNull(String path) { + var el = get(path); + return el != null && el.isNull(); + } + public boolean contains(String path) { + return get(path) != null; + } + + public JSONMap map(String path) { + var el = get(path); + if (el == null) throw new RuntimeException(String.format("'%s' doesn't exist.", path)); + return el.map(); + } + public JSONMap map(String path, JSONMap defaultVal) { + var el = get(path); + if (el == null) return defaultVal; + if (el.isMap()) return el.map(); + return defaultVal; + } + + public JSONList list(String path) { + var el = get(path); + if (el == null) throw new RuntimeException(String.format("'%s' doesn't exist.", path)); + return el.list(); + } + public JSONList list(String path, JSONList defaultVal) { + var el = get(path); + if (el == null) return defaultVal; + if (el.isList()) return el.list(); + return defaultVal; + } + + public String string(String path) { + var el = get(path); + if (el == null) throw new RuntimeException(String.format("'%s' doesn't exist.", path)); + return el.string(); + } + public String string(String path, String defaultVal) { + var el = get(path); + if (el == null) return defaultVal; + if (el.isString()) return el.string(); + return defaultVal; + } + + public double number(String path) { + var el = get(path); + if (el == null) throw new RuntimeException(String.format("'%s' doesn't exist.", path)); + return el.number(); + } + public double number(String path, double defaultVal) { + var el = get(path); + if (el == null) return defaultVal; + if (el.isNumber()) return el.number(); + return defaultVal; + } + + public boolean bool(String path) { + var el = get(path); + if (el == null) throw new RuntimeException(String.format("'%s' doesn't exist.", path)); + return el.bool(); + } + public boolean bool(String path, boolean defaultVal) { + var el = get(path); + if (el == null) return defaultVal; + if (el.isBoolean()) return el.bool(); + return defaultVal; + } + + public JSONMap setNull(String key) { elements.put(key, JSONElement.NULL); return this; } + public JSONMap set(String key, String val) { elements.put(key, JSONElement.of(val)); return this; } + public JSONMap set(String key, double val) { elements.put(key, JSONElement.of(val)); return this; } + public JSONMap set(String key, boolean val) { elements.put(key, JSONElement.of(val)); return this; } + public JSONMap set(String key, Map val) { elements.put(key, JSONElement.of(val)); return this; } + public JSONMap set(String key, Collection val) { elements.put(key, JSONElement.of(val)); return this; } + + @Override + public int size() { return elements.size(); } + @Override + public boolean isEmpty() { return elements.isEmpty(); } + @Override + public boolean containsKey(Object key) { return elements.containsKey(key); } + @Override + public boolean containsValue(Object value) { return elements.containsValue(value); } + @Override + public JSONElement get(Object key) { return elements.get(key); } + @Override + public JSONElement put(String key, JSONElement value) { return elements.put(key, value); } + @Override + public JSONElement remove(Object key) { return elements.remove(key); } + @Override + public void putAll(Map m) { elements.putAll(m); } + + @Override + public void clear() { elements.clear(); } + + @Override + public Set keySet() { return elements.keySet(); } + @Override + public Collection values() { return elements.values(); } + @Override + public Set> entrySet() { return elements.entrySet(); } + + public JSONMap() { } + public JSONMap(Map els) { + this.elements = new HashMap<>(els); + } +} diff --git a/src/me/topchetoeu/jscript/lib/MapLib.java b/src/me/topchetoeu/jscript/lib/MapLib.java index c731dd5..b9d72ff 100644 --- a/src/me/topchetoeu/jscript/lib/MapLib.java +++ b/src/me/topchetoeu/jscript/lib/MapLib.java @@ -1,78 +1,78 @@ -package me.topchetoeu.jscript.lib; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.stream.Collectors; - -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.values.ArrayValue; -import me.topchetoeu.jscript.engine.values.FunctionValue; -import me.topchetoeu.jscript.engine.values.ObjectValue; -import me.topchetoeu.jscript.engine.values.Values; -import me.topchetoeu.jscript.interop.Native; -import me.topchetoeu.jscript.interop.NativeGetter; - -@Native("Map") public class MapLib { - private LinkedHashMap map = new LinkedHashMap<>(); - - @Native("@@Symbol.typeName") public final String name = "Map"; - @Native("@@Symbol.iterator") public ObjectValue iterator(Context ctx) { - return this.entries(ctx); - } - - @Native public void clear() { - map.clear(); - } - @Native public boolean delete(Object key) { - if (map.containsKey(key)) { - map.remove(key); - return true; - } - return false; - } - - @Native public ObjectValue entries(Context ctx) { - return ArrayValue.of(ctx, map - .entrySet() - .stream() - .map(v -> new ArrayValue(ctx, v.getKey(), v.getValue())) - .collect(Collectors.toList()) - ); - } - @Native public ObjectValue keys(Context ctx) { - return ArrayValue.of(ctx, map.keySet()); - } - @Native public ObjectValue values(Context ctx) { - return ArrayValue.of(ctx, map.values()); - } - - @Native public Object get(Object key) { - return map.get(key); - } - @Native public MapLib set(Object key, Object val) { - map.put(key, val); - return this; - } - @Native public boolean has(Object key) { - return map.containsKey(key); - } - - @NativeGetter public int size() { - return map.size(); - } - - @Native public void forEach(Context ctx, FunctionValue func, Object thisArg) { - var keys = new ArrayList<>(map.keySet()); - - for (var el : keys) func.call(ctx, thisArg, map.get(el), el,this); - } - - @Native public MapLib(Context ctx, Object iterable) { - for (var el : Values.fromJSIterator(ctx, iterable)) { - try { - set(Values.getMember(ctx, el, 0), Values.getMember(ctx, el, 1)); - } - catch (IllegalArgumentException e) { } - } - } -} +package me.topchetoeu.jscript.lib; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.stream.Collectors; + +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.values.ArrayValue; +import me.topchetoeu.jscript.engine.values.FunctionValue; +import me.topchetoeu.jscript.engine.values.ObjectValue; +import me.topchetoeu.jscript.engine.values.Values; +import me.topchetoeu.jscript.interop.Native; +import me.topchetoeu.jscript.interop.NativeGetter; + +@Native("Map") public class MapLib { + private LinkedHashMap map = new LinkedHashMap<>(); + + @Native("@@Symbol.typeName") public final String name = "Map"; + @Native("@@Symbol.iterator") public ObjectValue iterator(Context ctx) { + return this.entries(ctx); + } + + @Native public void clear() { + map.clear(); + } + @Native public boolean delete(Object key) { + if (map.containsKey(key)) { + map.remove(key); + return true; + } + return false; + } + + @Native public ObjectValue entries(Context ctx) { + return ArrayValue.of(ctx, map + .entrySet() + .stream() + .map(v -> new ArrayValue(ctx, v.getKey(), v.getValue())) + .collect(Collectors.toList()) + ); + } + @Native public ObjectValue keys(Context ctx) { + return ArrayValue.of(ctx, map.keySet()); + } + @Native public ObjectValue values(Context ctx) { + return ArrayValue.of(ctx, map.values()); + } + + @Native public Object get(Object key) { + return map.get(key); + } + @Native public MapLib set(Object key, Object val) { + map.put(key, val); + return this; + } + @Native public boolean has(Object key) { + return map.containsKey(key); + } + + @NativeGetter public int size() { + return map.size(); + } + + @Native public void forEach(Context ctx, FunctionValue func, Object thisArg) { + var keys = new ArrayList<>(map.keySet()); + + for (var el : keys) func.call(ctx, thisArg, map.get(el), el,this); + } + + @Native public MapLib(Context ctx, Object iterable) { + for (var el : Values.fromJSIterator(ctx, iterable)) { + try { + set(Values.getMember(ctx, el, 0), Values.getMember(ctx, el, 1)); + } + catch (IllegalArgumentException e) { } + } + } +} diff --git a/src/me/topchetoeu/jscript/lib/PromiseLib.java b/src/me/topchetoeu/jscript/lib/PromiseLib.java index 7ffb708..6e76872 100644 --- a/src/me/topchetoeu/jscript/lib/PromiseLib.java +++ b/src/me/topchetoeu/jscript/lib/PromiseLib.java @@ -1,367 +1,367 @@ -package me.topchetoeu.jscript.lib; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.values.ArrayValue; -import me.topchetoeu.jscript.engine.values.FunctionValue; -import me.topchetoeu.jscript.engine.values.NativeFunction; -import me.topchetoeu.jscript.engine.values.NativeWrapper; -import me.topchetoeu.jscript.engine.values.ObjectValue; -import me.topchetoeu.jscript.engine.values.Values; -import me.topchetoeu.jscript.exceptions.EngineException; -import me.topchetoeu.jscript.interop.Native; - -@Native("Promise") public class PromiseLib { - public static interface PromiseRunner { - Object run(); - } - private static class Handle { - public final Context ctx; - public final FunctionValue fulfilled; - public final FunctionValue rejected; - - public Handle(Context ctx, FunctionValue fulfilled, FunctionValue rejected) { - this.ctx = ctx; - this.fulfilled = fulfilled; - this.rejected = rejected; - } - } - - @Native("resolve") - public static PromiseLib ofResolved(Context ctx, Object val) { - var res = new PromiseLib(); - res.fulfill(ctx, val); - return res; - } - @Native("reject") - public static PromiseLib ofRejected(Context ctx, Object val) { - var res = new PromiseLib(); - res.reject(ctx, val); - return res; - } - - @Native public static PromiseLib any(Context ctx, Object _promises) { - if (!Values.isArray(_promises)) throw EngineException.ofType("Expected argument for any to be an array."); - var promises = Values.array(_promises); - if (promises.size() == 0) return ofResolved(ctx, new ArrayValue()); - var n = new int[] { promises.size() }; - var res = new PromiseLib(); - - var errors = new ArrayValue(); - - for (var i = 0; i < promises.size(); i++) { - var index = i; - var val = promises.get(i); - then(ctx, val, - new NativeFunction(null, (e, th, args) -> { res.fulfill(e, args[0]); return null; }), - new NativeFunction(null, (e, th, args) -> { - errors.set(ctx, index, args[0]); - n[0]--; - if (n[0] <= 0) res.reject(e, errors); - return null; - }) - ); - } - - return res; - } - @Native public static PromiseLib race(Context ctx, Object _promises) { - if (!Values.isArray(_promises)) throw EngineException.ofType("Expected argument for any to be an array."); - var promises = Values.array(_promises); - if (promises.size() == 0) return ofResolved(ctx, new ArrayValue()); - var res = new PromiseLib(); - - for (var i = 0; i < promises.size(); i++) { - var val = promises.get(i); - then(ctx, val, - new NativeFunction(null, (e, th, args) -> { res.fulfill(e, args[0]); return null; }), - new NativeFunction(null, (e, th, args) -> { res.reject(e, args[0]); return null; }) - ); - } - - return res; - } - @Native public static PromiseLib all(Context ctx, Object _promises) { - if (!Values.isArray(_promises)) throw EngineException.ofType("Expected argument for any to be an array."); - var promises = Values.array(_promises); - if (promises.size() == 0) return ofResolved(ctx, new ArrayValue()); - var n = new int[] { promises.size() }; - var res = new PromiseLib(); - - var result = new ArrayValue(); - - for (var i = 0; i < promises.size(); i++) { - var index = i; - var val = promises.get(i); - then(ctx, val, - new NativeFunction(null, (e, th, args) -> { - result.set(ctx, index, args[0]); - n[0]--; - if (n[0] <= 0) res.fulfill(e, result); - return null; - }), - new NativeFunction(null, (e, th, args) -> { res.reject(e, args[0]); return null; }) - ); - } - - if (n[0] <= 0) res.fulfill(ctx, result); - - return res; - } - @Native public static PromiseLib allSettled(Context ctx, Object _promises) { - if (!Values.isArray(_promises)) throw EngineException.ofType("Expected argument for any to be an array."); - var promises = Values.array(_promises); - if (promises.size() == 0) return ofResolved(ctx, new ArrayValue()); - var n = new int[] { promises.size() }; - var res = new PromiseLib(); - - var result = new ArrayValue(); - - for (var i = 0; i < promises.size(); i++) { - var index = i; - var val = promises.get(i); - then(ctx, val, - new NativeFunction(null, (e, th, args) -> { - result.set(ctx, index, new ObjectValue(ctx, Map.of( - "status", "fulfilled", - "value", args[0] - ))); - n[0]--; - if (n[0] <= 0) res.fulfill(e, result); - return null; - }), - new NativeFunction(null, (e, th, args) -> { - result.set(ctx, index, new ObjectValue(ctx, Map.of( - "status", "rejected", - "reason", args[0] - ))); - n[0]--; - if (n[0] <= 0) res.fulfill(e, result); - return null; - }) - ); - } - - if (n[0] <= 0) res.fulfill(ctx, result); - - return res; - } - - /** - * Thread safe - you can call this from anywhere - * HOWEVER, it's strongly recommended to use this only in javascript - */ - @Native(thisArg=true) public static Object then(Context ctx, Object _thisArg, Object _onFulfill, Object _onReject) { - var onFulfill = _onFulfill instanceof FunctionValue ? ((FunctionValue)_onFulfill) : null; - var onReject = _onReject instanceof FunctionValue ? ((FunctionValue)_onReject) : null; - - var res = new PromiseLib(); - - var fulfill = onFulfill == null ? new NativeFunction((_ctx, _0, _args) -> _args.length > 0 ? _args[0] : null) : (FunctionValue)onFulfill; - var reject = onReject == null ? new NativeFunction((_ctx, _0, _args) -> { - throw new EngineException(_args.length > 0 ? _args[0] : null); - }) : (FunctionValue)onReject; - - var thisArg = _thisArg instanceof NativeWrapper && ((NativeWrapper)_thisArg).wrapped instanceof PromiseLib ? - ((NativeWrapper)_thisArg).wrapped : - _thisArg; - - var fulfillHandle = new NativeFunction(null, (_ctx, th, a) -> { - try { res.fulfill(ctx, Values.convert(ctx, fulfill.call(ctx, null, a[0]), Object.class)); } - catch (EngineException err) { res.reject(ctx, err.value); } - return null; - }); - var rejectHandle = new NativeFunction(null, (_ctx, th, a) -> { - try { res.fulfill(ctx, reject.call(ctx, null, a[0])); } - catch (EngineException err) { res.reject(ctx, err.value); } - if (thisArg instanceof PromiseLib) ((PromiseLib)thisArg).handled = true; - return null; - }); - - if (thisArg instanceof PromiseLib) ((PromiseLib)thisArg).handle(ctx, fulfillHandle, rejectHandle); - else { - Object next; - try { next = Values.getMember(ctx, thisArg, "then"); } - catch (IllegalArgumentException e) { next = null; } - - try { - if (next instanceof FunctionValue) ((FunctionValue)next).call(ctx, thisArg, fulfillHandle, rejectHandle); - else res.fulfill(ctx, fulfill.call(ctx, null, thisArg)); - } - catch (EngineException err) { - res.reject(ctx, fulfill.call(ctx, null, err.value)); - } - } - - return res; - } - /** - * Thread safe - you can call this from anywhere - * HOWEVER, it's strongly recommended to use this only in javascript - */ - @Native(value="catch", thisArg=true) public static Object _catch(Context ctx, Object thisArg, Object _onReject) { - return then(ctx, thisArg, null, _onReject); - } - /** - * Thread safe - you can call this from anywhere - * HOWEVER, it's strongly recommended to use this only in javascript - */ - @Native(value="finally", thisArg=true) public static Object _finally(Context ctx, Object thisArg, Object _handle) { - return then(ctx, thisArg, - new NativeFunction(null, (e, th, _args) -> { - if (_handle instanceof FunctionValue) ((FunctionValue)_handle).call(ctx); - return _args.length > 0 ? _args[0] : null; - }), - new NativeFunction(null, (e, th, _args) -> { - if (_handle instanceof FunctionValue) ((FunctionValue)_handle).call(ctx); - throw new EngineException(_args.length > 0 ? _args[0] : null); - }) - ); - } - - private List handles = new ArrayList<>(); - - private static final int STATE_PENDING = 0; - private static final int STATE_FULFILLED = 1; - private static final int STATE_REJECTED = 2; - - private int state = STATE_PENDING; - private boolean handled = false; - private Object val; - - public synchronized void fulfill(Context ctx, Object val) { - if (this.state != STATE_PENDING) return; - - if (val instanceof PromiseLib) ((PromiseLib)val).handle(ctx, - new NativeFunction(null, (e, th, a) -> { this.fulfill(ctx, a[0]); return null; }), - new NativeFunction(null, (e, th, a) -> { this.reject(ctx, a[0]); return null; }) - ); - else { - Object then; - try { then = Values.getMember(ctx, val, "then"); } - catch (IllegalArgumentException e) { then = null; } - - try { - if (then instanceof FunctionValue) ((FunctionValue)then).call(ctx, val, - new NativeFunction((e, _thisArg, a) -> { this.fulfill(ctx, a.length > 0 ? a[0] : null); return null; }), - new NativeFunction((e, _thisArg, a) -> { this.reject(ctx, a.length > 0 ? a[0] : null); return null; }) - ); - else { - this.val = val; - this.state = STATE_FULFILLED; - - ctx.engine.pushMsg(true, ctx, new NativeFunction((_ctx, _thisArg, _args) -> { - for (var handle : handles) { - handle.fulfilled.call(handle.ctx, null, val); - } - handles = null; - return null; - }), null); - } - } - catch (EngineException err) { - this.reject(ctx, err.value); - } - } - } - public synchronized void reject(Context ctx, Object val) { - if (this.state != STATE_PENDING) return; - - if (val instanceof PromiseLib) ((PromiseLib)val).handle(ctx, - new NativeFunction(null, (e, th, a) -> { this.reject(ctx, a[0]); return null; }), - new NativeFunction(null, (e, th, a) -> { this.reject(ctx, a[0]); return null; }) - ); - else { - Object then; - try { then = Values.getMember(ctx, val, "then"); } - catch (IllegalArgumentException e) { then = null; } - - try { - if (then instanceof FunctionValue) ((FunctionValue)then).call(ctx, val, - new NativeFunction((e, _thisArg, a) -> { this.reject(ctx, a.length > 0 ? a[0] : null); return null; }), - new NativeFunction((e, _thisArg, a) -> { this.reject(ctx, a.length > 0 ? a[0] : null); return null; }) - ); - else { - this.val = val; - this.state = STATE_REJECTED; - - ctx.engine.pushMsg(true, ctx, new NativeFunction((_ctx, _thisArg, _args) -> { - for (var handle : handles) handle.rejected.call(handle.ctx, null, val); - if (!handled) { - Values.printError(new EngineException(val).setCtx(ctx.environment(), ctx.engine), "(in promise)"); - } - handles = null; - return null; - }), null); - } - } - catch (EngineException err) { - this.reject(ctx, err.value); - } - } - } - - private void handle(Context ctx, FunctionValue fulfill, FunctionValue reject) { - if (state == STATE_FULFILLED) ctx.engine.pushMsg(true, ctx, fulfill, null, val); - else if (state == STATE_REJECTED) { - ctx.engine.pushMsg(true, ctx, reject, null, val); - handled = true; - } - else handles.add(new Handle(ctx, fulfill, reject)); - } - - @Override @Native public String toString() { - if (state == STATE_PENDING) return "Promise (pending)"; - else if (state == STATE_FULFILLED) return "Promise (fulfilled)"; - else return "Promise (rejected)"; - } - - /** - * NOT THREAD SAFE - must be called from the engine executor thread - */ - @Native public PromiseLib(Context ctx, FunctionValue func) { - if (!(func instanceof FunctionValue)) throw EngineException.ofType("A function must be passed to the promise constructor."); - try { - func.call( - ctx, null, - new NativeFunction(null, (e, th, args) -> { - fulfill(e, args.length > 0 ? args[0] : null); - return null; - }), - new NativeFunction(null, (e, th, args) -> { - reject(e, args.length > 0 ? args[0] : null); - return null; - }) - ); - } - catch (EngineException e) { - reject(ctx, e.value); - } - } - - private PromiseLib(int state, Object val) { - this.state = state; - this.val = val; - } - public PromiseLib() { - this(STATE_PENDING, null); - } - - public static PromiseLib await(Context ctx, PromiseRunner runner) { - var res = new PromiseLib(); - - new Thread(() -> { - try { - res.fulfill(ctx, runner.run()); - } - catch (EngineException e) { - res.reject(ctx, e.value); - } - }, "Promisifier").start(); - - return res; - } -} +package me.topchetoeu.jscript.lib; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.values.ArrayValue; +import me.topchetoeu.jscript.engine.values.FunctionValue; +import me.topchetoeu.jscript.engine.values.NativeFunction; +import me.topchetoeu.jscript.engine.values.NativeWrapper; +import me.topchetoeu.jscript.engine.values.ObjectValue; +import me.topchetoeu.jscript.engine.values.Values; +import me.topchetoeu.jscript.exceptions.EngineException; +import me.topchetoeu.jscript.interop.Native; + +@Native("Promise") public class PromiseLib { + public static interface PromiseRunner { + Object run(); + } + private static class Handle { + public final Context ctx; + public final FunctionValue fulfilled; + public final FunctionValue rejected; + + public Handle(Context ctx, FunctionValue fulfilled, FunctionValue rejected) { + this.ctx = ctx; + this.fulfilled = fulfilled; + this.rejected = rejected; + } + } + + @Native("resolve") + public static PromiseLib ofResolved(Context ctx, Object val) { + var res = new PromiseLib(); + res.fulfill(ctx, val); + return res; + } + @Native("reject") + public static PromiseLib ofRejected(Context ctx, Object val) { + var res = new PromiseLib(); + res.reject(ctx, val); + return res; + } + + @Native public static PromiseLib any(Context ctx, Object _promises) { + if (!Values.isArray(_promises)) throw EngineException.ofType("Expected argument for any to be an array."); + var promises = Values.array(_promises); + if (promises.size() == 0) return ofResolved(ctx, new ArrayValue()); + var n = new int[] { promises.size() }; + var res = new PromiseLib(); + + var errors = new ArrayValue(); + + for (var i = 0; i < promises.size(); i++) { + var index = i; + var val = promises.get(i); + then(ctx, val, + new NativeFunction(null, (e, th, args) -> { res.fulfill(e, args[0]); return null; }), + new NativeFunction(null, (e, th, args) -> { + errors.set(ctx, index, args[0]); + n[0]--; + if (n[0] <= 0) res.reject(e, errors); + return null; + }) + ); + } + + return res; + } + @Native public static PromiseLib race(Context ctx, Object _promises) { + if (!Values.isArray(_promises)) throw EngineException.ofType("Expected argument for any to be an array."); + var promises = Values.array(_promises); + if (promises.size() == 0) return ofResolved(ctx, new ArrayValue()); + var res = new PromiseLib(); + + for (var i = 0; i < promises.size(); i++) { + var val = promises.get(i); + then(ctx, val, + new NativeFunction(null, (e, th, args) -> { res.fulfill(e, args[0]); return null; }), + new NativeFunction(null, (e, th, args) -> { res.reject(e, args[0]); return null; }) + ); + } + + return res; + } + @Native public static PromiseLib all(Context ctx, Object _promises) { + if (!Values.isArray(_promises)) throw EngineException.ofType("Expected argument for any to be an array."); + var promises = Values.array(_promises); + if (promises.size() == 0) return ofResolved(ctx, new ArrayValue()); + var n = new int[] { promises.size() }; + var res = new PromiseLib(); + + var result = new ArrayValue(); + + for (var i = 0; i < promises.size(); i++) { + var index = i; + var val = promises.get(i); + then(ctx, val, + new NativeFunction(null, (e, th, args) -> { + result.set(ctx, index, args[0]); + n[0]--; + if (n[0] <= 0) res.fulfill(e, result); + return null; + }), + new NativeFunction(null, (e, th, args) -> { res.reject(e, args[0]); return null; }) + ); + } + + if (n[0] <= 0) res.fulfill(ctx, result); + + return res; + } + @Native public static PromiseLib allSettled(Context ctx, Object _promises) { + if (!Values.isArray(_promises)) throw EngineException.ofType("Expected argument for any to be an array."); + var promises = Values.array(_promises); + if (promises.size() == 0) return ofResolved(ctx, new ArrayValue()); + var n = new int[] { promises.size() }; + var res = new PromiseLib(); + + var result = new ArrayValue(); + + for (var i = 0; i < promises.size(); i++) { + var index = i; + var val = promises.get(i); + then(ctx, val, + new NativeFunction(null, (e, th, args) -> { + result.set(ctx, index, new ObjectValue(ctx, Map.of( + "status", "fulfilled", + "value", args[0] + ))); + n[0]--; + if (n[0] <= 0) res.fulfill(e, result); + return null; + }), + new NativeFunction(null, (e, th, args) -> { + result.set(ctx, index, new ObjectValue(ctx, Map.of( + "status", "rejected", + "reason", args[0] + ))); + n[0]--; + if (n[0] <= 0) res.fulfill(e, result); + return null; + }) + ); + } + + if (n[0] <= 0) res.fulfill(ctx, result); + + return res; + } + + /** + * Thread safe - you can call this from anywhere + * HOWEVER, it's strongly recommended to use this only in javascript + */ + @Native(thisArg=true) public static Object then(Context ctx, Object _thisArg, Object _onFulfill, Object _onReject) { + var onFulfill = _onFulfill instanceof FunctionValue ? ((FunctionValue)_onFulfill) : null; + var onReject = _onReject instanceof FunctionValue ? ((FunctionValue)_onReject) : null; + + var res = new PromiseLib(); + + var fulfill = onFulfill == null ? new NativeFunction((_ctx, _0, _args) -> _args.length > 0 ? _args[0] : null) : (FunctionValue)onFulfill; + var reject = onReject == null ? new NativeFunction((_ctx, _0, _args) -> { + throw new EngineException(_args.length > 0 ? _args[0] : null); + }) : (FunctionValue)onReject; + + var thisArg = _thisArg instanceof NativeWrapper && ((NativeWrapper)_thisArg).wrapped instanceof PromiseLib ? + ((NativeWrapper)_thisArg).wrapped : + _thisArg; + + var fulfillHandle = new NativeFunction(null, (_ctx, th, a) -> { + try { res.fulfill(ctx, Values.convert(ctx, fulfill.call(ctx, null, a[0]), Object.class)); } + catch (EngineException err) { res.reject(ctx, err.value); } + return null; + }); + var rejectHandle = new NativeFunction(null, (_ctx, th, a) -> { + try { res.fulfill(ctx, reject.call(ctx, null, a[0])); } + catch (EngineException err) { res.reject(ctx, err.value); } + if (thisArg instanceof PromiseLib) ((PromiseLib)thisArg).handled = true; + return null; + }); + + if (thisArg instanceof PromiseLib) ((PromiseLib)thisArg).handle(ctx, fulfillHandle, rejectHandle); + else { + Object next; + try { next = Values.getMember(ctx, thisArg, "then"); } + catch (IllegalArgumentException e) { next = null; } + + try { + if (next instanceof FunctionValue) ((FunctionValue)next).call(ctx, thisArg, fulfillHandle, rejectHandle); + else res.fulfill(ctx, fulfill.call(ctx, null, thisArg)); + } + catch (EngineException err) { + res.reject(ctx, fulfill.call(ctx, null, err.value)); + } + } + + return res; + } + /** + * Thread safe - you can call this from anywhere + * HOWEVER, it's strongly recommended to use this only in javascript + */ + @Native(value="catch", thisArg=true) public static Object _catch(Context ctx, Object thisArg, Object _onReject) { + return then(ctx, thisArg, null, _onReject); + } + /** + * Thread safe - you can call this from anywhere + * HOWEVER, it's strongly recommended to use this only in javascript + */ + @Native(value="finally", thisArg=true) public static Object _finally(Context ctx, Object thisArg, Object _handle) { + return then(ctx, thisArg, + new NativeFunction(null, (e, th, _args) -> { + if (_handle instanceof FunctionValue) ((FunctionValue)_handle).call(ctx); + return _args.length > 0 ? _args[0] : null; + }), + new NativeFunction(null, (e, th, _args) -> { + if (_handle instanceof FunctionValue) ((FunctionValue)_handle).call(ctx); + throw new EngineException(_args.length > 0 ? _args[0] : null); + }) + ); + } + + private List handles = new ArrayList<>(); + + private static final int STATE_PENDING = 0; + private static final int STATE_FULFILLED = 1; + private static final int STATE_REJECTED = 2; + + private int state = STATE_PENDING; + private boolean handled = false; + private Object val; + + public synchronized void fulfill(Context ctx, Object val) { + if (this.state != STATE_PENDING) return; + + if (val instanceof PromiseLib) ((PromiseLib)val).handle(ctx, + new NativeFunction(null, (e, th, a) -> { this.fulfill(ctx, a[0]); return null; }), + new NativeFunction(null, (e, th, a) -> { this.reject(ctx, a[0]); return null; }) + ); + else { + Object then; + try { then = Values.getMember(ctx, val, "then"); } + catch (IllegalArgumentException e) { then = null; } + + try { + if (then instanceof FunctionValue) ((FunctionValue)then).call(ctx, val, + new NativeFunction((e, _thisArg, a) -> { this.fulfill(ctx, a.length > 0 ? a[0] : null); return null; }), + new NativeFunction((e, _thisArg, a) -> { this.reject(ctx, a.length > 0 ? a[0] : null); return null; }) + ); + else { + this.val = val; + this.state = STATE_FULFILLED; + + ctx.engine.pushMsg(true, ctx, new NativeFunction((_ctx, _thisArg, _args) -> { + for (var handle : handles) { + handle.fulfilled.call(handle.ctx, null, val); + } + handles = null; + return null; + }), null); + } + } + catch (EngineException err) { + this.reject(ctx, err.value); + } + } + } + public synchronized void reject(Context ctx, Object val) { + if (this.state != STATE_PENDING) return; + + if (val instanceof PromiseLib) ((PromiseLib)val).handle(ctx, + new NativeFunction(null, (e, th, a) -> { this.reject(ctx, a[0]); return null; }), + new NativeFunction(null, (e, th, a) -> { this.reject(ctx, a[0]); return null; }) + ); + else { + Object then; + try { then = Values.getMember(ctx, val, "then"); } + catch (IllegalArgumentException e) { then = null; } + + try { + if (then instanceof FunctionValue) ((FunctionValue)then).call(ctx, val, + new NativeFunction((e, _thisArg, a) -> { this.reject(ctx, a.length > 0 ? a[0] : null); return null; }), + new NativeFunction((e, _thisArg, a) -> { this.reject(ctx, a.length > 0 ? a[0] : null); return null; }) + ); + else { + this.val = val; + this.state = STATE_REJECTED; + + ctx.engine.pushMsg(true, ctx, new NativeFunction((_ctx, _thisArg, _args) -> { + for (var handle : handles) handle.rejected.call(handle.ctx, null, val); + if (!handled) { + Values.printError(new EngineException(val).setCtx(ctx.environment(), ctx.engine), "(in promise)"); + } + handles = null; + return null; + }), null); + } + } + catch (EngineException err) { + this.reject(ctx, err.value); + } + } + } + + private void handle(Context ctx, FunctionValue fulfill, FunctionValue reject) { + if (state == STATE_FULFILLED) ctx.engine.pushMsg(true, ctx, fulfill, null, val); + else if (state == STATE_REJECTED) { + ctx.engine.pushMsg(true, ctx, reject, null, val); + handled = true; + } + else handles.add(new Handle(ctx, fulfill, reject)); + } + + @Override @Native public String toString() { + if (state == STATE_PENDING) return "Promise (pending)"; + else if (state == STATE_FULFILLED) return "Promise (fulfilled)"; + else return "Promise (rejected)"; + } + + /** + * NOT THREAD SAFE - must be called from the engine executor thread + */ + @Native public PromiseLib(Context ctx, FunctionValue func) { + if (!(func instanceof FunctionValue)) throw EngineException.ofType("A function must be passed to the promise constructor."); + try { + func.call( + ctx, null, + new NativeFunction(null, (e, th, args) -> { + fulfill(e, args.length > 0 ? args[0] : null); + return null; + }), + new NativeFunction(null, (e, th, args) -> { + reject(e, args.length > 0 ? args[0] : null); + return null; + }) + ); + } + catch (EngineException e) { + reject(ctx, e.value); + } + } + + private PromiseLib(int state, Object val) { + this.state = state; + this.val = val; + } + public PromiseLib() { + this(STATE_PENDING, null); + } + + public static PromiseLib await(Context ctx, PromiseRunner runner) { + var res = new PromiseLib(); + + new Thread(() -> { + try { + res.fulfill(ctx, runner.run()); + } + catch (EngineException e) { + res.reject(ctx, e.value); + } + }, "Promisifier").start(); + + return res; + } +} diff --git a/src/me/topchetoeu/jscript/lib/SetLib.java b/src/me/topchetoeu/jscript/lib/SetLib.java index 27856dc..2cc35c2 100644 --- a/src/me/topchetoeu/jscript/lib/SetLib.java +++ b/src/me/topchetoeu/jscript/lib/SetLib.java @@ -1,60 +1,60 @@ -package me.topchetoeu.jscript.lib; - -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.stream.Collectors; - -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.values.ArrayValue; -import me.topchetoeu.jscript.engine.values.FunctionValue; -import me.topchetoeu.jscript.engine.values.ObjectValue; -import me.topchetoeu.jscript.engine.values.Values; -import me.topchetoeu.jscript.interop.Native; -import me.topchetoeu.jscript.interop.NativeGetter; - -@Native("Set") public class SetLib { - private LinkedHashSet set = new LinkedHashSet<>(); - - @Native("@@Symbol.typeName") public final String name = "Set"; - @Native("@@Symbol.iterator") public ObjectValue iterator(Context ctx) { - return this.values(ctx); - } - - @Native public ObjectValue entries(Context ctx) { - return ArrayValue.of(ctx, set.stream().map(v -> new ArrayValue(ctx, v, v)).collect(Collectors.toList())); - } - @Native public ObjectValue keys(Context ctx) { - return ArrayValue.of(ctx, set); - } - @Native public ObjectValue values(Context ctx) { - return ArrayValue.of(ctx, set); - } - - @Native public Object add(Object key) { - return set.add(key); - } - @Native public boolean delete(Object key) { - return set.remove(key); - } - @Native public boolean has(Object key) { - return set.contains(key); - } - - @Native public void clear() { - set.clear(); - } - - @NativeGetter public int size() { - return set.size(); - } - - @Native public void forEach(Context ctx, FunctionValue func, Object thisArg) { - var keys = new ArrayList<>(set); - - for (var el : keys) func.call(ctx, thisArg, el, el, this); - } - - @Native public SetLib(Context ctx, Object iterable) { - for (var el : Values.fromJSIterator(ctx, iterable)) add(el); - } -} +package me.topchetoeu.jscript.lib; + +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.stream.Collectors; + +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.values.ArrayValue; +import me.topchetoeu.jscript.engine.values.FunctionValue; +import me.topchetoeu.jscript.engine.values.ObjectValue; +import me.topchetoeu.jscript.engine.values.Values; +import me.topchetoeu.jscript.interop.Native; +import me.topchetoeu.jscript.interop.NativeGetter; + +@Native("Set") public class SetLib { + private LinkedHashSet set = new LinkedHashSet<>(); + + @Native("@@Symbol.typeName") public final String name = "Set"; + @Native("@@Symbol.iterator") public ObjectValue iterator(Context ctx) { + return this.values(ctx); + } + + @Native public ObjectValue entries(Context ctx) { + return ArrayValue.of(ctx, set.stream().map(v -> new ArrayValue(ctx, v, v)).collect(Collectors.toList())); + } + @Native public ObjectValue keys(Context ctx) { + return ArrayValue.of(ctx, set); + } + @Native public ObjectValue values(Context ctx) { + return ArrayValue.of(ctx, set); + } + + @Native public Object add(Object key) { + return set.add(key); + } + @Native public boolean delete(Object key) { + return set.remove(key); + } + @Native public boolean has(Object key) { + return set.contains(key); + } + + @Native public void clear() { + set.clear(); + } + + @NativeGetter public int size() { + return set.size(); + } + + @Native public void forEach(Context ctx, FunctionValue func, Object thisArg) { + var keys = new ArrayList<>(set); + + for (var el : keys) func.call(ctx, thisArg, el, el, this); + } + + @Native public SetLib(Context ctx, Object iterable) { + for (var el : Values.fromJSIterator(ctx, iterable)) add(el); + } +} diff --git a/src/me/topchetoeu/jscript/parsing/Operator.java b/src/me/topchetoeu/jscript/parsing/Operator.java index 7037516..61187d4 100644 --- a/src/me/topchetoeu/jscript/parsing/Operator.java +++ b/src/me/topchetoeu/jscript/parsing/Operator.java @@ -1,113 +1,113 @@ -package me.topchetoeu.jscript.parsing; - -import java.util.HashMap; -import java.util.Map; - -import me.topchetoeu.jscript.engine.Operation; - -public enum Operator { - MULTIPLY("*", Operation.MULTIPLY, 13), - DIVIDE("/", Operation.DIVIDE, 12), - MODULO("%", Operation.MODULO, 12), - SUBTRACT("-", Operation.SUBTRACT, 11), - ADD("+", Operation.ADD, 11), - SHIFT_RIGHT(">>", Operation.SHIFT_RIGHT, 10), - SHIFT_LEFT("<<", Operation.SHIFT_LEFT, 10), - USHIFT_RIGHT(">>>", Operation.USHIFT_RIGHT, 10), - GREATER(">", Operation.GREATER, 9), - LESS("<", Operation.LESS, 9), - GREATER_EQUALS(">=", Operation.GREATER_EQUALS, 9), - LESS_EQUALS("<=", Operation.LESS_EQUALS, 9), - NOT_EQUALS("!=", Operation.LOOSE_NOT_EQUALS, 8), - LOOSE_NOT_EQUALS("!==", Operation.NOT_EQUALS, 8), - EQUALS("==", Operation.LOOSE_EQUALS, 8), - LOOSE_EQUALS("===", Operation.EQUALS, 8), - AND("&", Operation.AND, 7), - XOR("^", Operation.XOR, 6), - OR("|", Operation.OR, 5), - LAZY_AND("&&", 4), - LAZY_OR("||", 3), - ASSIGN_SHIFT_LEFT("<<=", 2, true), - ASSIGN_SHIFT_RIGHT(">>=", 2, true), - ASSIGN_USHIFT_RIGHT(">>>=", 2, true), - ASSIGN_AND("&=", 2, true), - ASSIGN_OR("|=", 2, true), - ASSIGN_XOR("^=", 2, true), - ASSIGN_MODULO("%=", 2, true), - ASSIGN_DIVIDE("/=", 2, true), - ASSIGN_MULTIPLY("*=", 2, true), - ASSIGN_SUBTRACT("-=", 2, true), - ASSIGN_ADD("+=", 2, true), - ASSIGN("=", 2, true), - SEMICOLON(";"), - COLON(":"), - PAREN_OPEN("("), - PAREN_CLOSE(")"), - BRACKET_OPEN("["), - BRACKET_CLOSE("]"), - BRACE_OPEN("{"), - BRACE_CLOSE("}"), - DOT("."), - COMMA(","), - NOT("!"), - QUESTION("?"), - INVERSE("~"), - INCREASE("++"), - DECREASE("--"); - - public final String value; - public final Operation operation; - public final int precedence; - public final boolean reverse; - private static final Map ops = new HashMap<>(); - - static { - for (var el : Operator.values()) { - ops.put(el.value, el); - } - } - - public boolean isAssign() { return precedence == 2; } - - public static Operator parse(String val) { - return ops.get(val); - } - - private Operator() { - this.value = null; - this.operation = null; - this.precedence = -1; - this.reverse = false; - } - private Operator(String value) { - this. value = value; - this.operation = null; - this.precedence = -1; - this.reverse = false; - } - private Operator(String value, int precedence) { - this. value = value; - this.operation = null; - this.precedence = precedence; - this.reverse = false; - } - private Operator(String value, int precedence, boolean reverse) { - this. value = value; - this.operation = null; - this.precedence = precedence; - this.reverse = reverse; - } - - private Operator(String value, Operation funcName, int precedence) { - this. value = value; - this.operation = funcName; - this.precedence = precedence; - this.reverse = false; - } - private Operator(String value, Operation funcName, int precedence, boolean reverse) { - this.value = value; - this.operation = funcName; - this.precedence = precedence; - this.reverse = reverse; - } +package me.topchetoeu.jscript.parsing; + +import java.util.HashMap; +import java.util.Map; + +import me.topchetoeu.jscript.engine.Operation; + +public enum Operator { + MULTIPLY("*", Operation.MULTIPLY, 13), + DIVIDE("/", Operation.DIVIDE, 12), + MODULO("%", Operation.MODULO, 12), + SUBTRACT("-", Operation.SUBTRACT, 11), + ADD("+", Operation.ADD, 11), + SHIFT_RIGHT(">>", Operation.SHIFT_RIGHT, 10), + SHIFT_LEFT("<<", Operation.SHIFT_LEFT, 10), + USHIFT_RIGHT(">>>", Operation.USHIFT_RIGHT, 10), + GREATER(">", Operation.GREATER, 9), + LESS("<", Operation.LESS, 9), + GREATER_EQUALS(">=", Operation.GREATER_EQUALS, 9), + LESS_EQUALS("<=", Operation.LESS_EQUALS, 9), + NOT_EQUALS("!=", Operation.LOOSE_NOT_EQUALS, 8), + LOOSE_NOT_EQUALS("!==", Operation.NOT_EQUALS, 8), + EQUALS("==", Operation.LOOSE_EQUALS, 8), + LOOSE_EQUALS("===", Operation.EQUALS, 8), + AND("&", Operation.AND, 7), + XOR("^", Operation.XOR, 6), + OR("|", Operation.OR, 5), + LAZY_AND("&&", 4), + LAZY_OR("||", 3), + ASSIGN_SHIFT_LEFT("<<=", 2, true), + ASSIGN_SHIFT_RIGHT(">>=", 2, true), + ASSIGN_USHIFT_RIGHT(">>>=", 2, true), + ASSIGN_AND("&=", 2, true), + ASSIGN_OR("|=", 2, true), + ASSIGN_XOR("^=", 2, true), + ASSIGN_MODULO("%=", 2, true), + ASSIGN_DIVIDE("/=", 2, true), + ASSIGN_MULTIPLY("*=", 2, true), + ASSIGN_SUBTRACT("-=", 2, true), + ASSIGN_ADD("+=", 2, true), + ASSIGN("=", 2, true), + SEMICOLON(";"), + COLON(":"), + PAREN_OPEN("("), + PAREN_CLOSE(")"), + BRACKET_OPEN("["), + BRACKET_CLOSE("]"), + BRACE_OPEN("{"), + BRACE_CLOSE("}"), + DOT("."), + COMMA(","), + NOT("!"), + QUESTION("?"), + INVERSE("~"), + INCREASE("++"), + DECREASE("--"); + + public final String value; + public final Operation operation; + public final int precedence; + public final boolean reverse; + private static final Map ops = new HashMap<>(); + + static { + for (var el : Operator.values()) { + ops.put(el.value, el); + } + } + + public boolean isAssign() { return precedence == 2; } + + public static Operator parse(String val) { + return ops.get(val); + } + + private Operator() { + this.value = null; + this.operation = null; + this.precedence = -1; + this.reverse = false; + } + private Operator(String value) { + this. value = value; + this.operation = null; + this.precedence = -1; + this.reverse = false; + } + private Operator(String value, int precedence) { + this. value = value; + this.operation = null; + this.precedence = precedence; + this.reverse = false; + } + private Operator(String value, int precedence, boolean reverse) { + this. value = value; + this.operation = null; + this.precedence = precedence; + this.reverse = reverse; + } + + private Operator(String value, Operation funcName, int precedence) { + this. value = value; + this.operation = funcName; + this.precedence = precedence; + this.reverse = false; + } + private Operator(String value, Operation funcName, int precedence, boolean reverse) { + this.value = value; + this.operation = funcName; + this.precedence = precedence; + this.reverse = reverse; + } } \ No newline at end of file diff --git a/src/me/topchetoeu/jscript/parsing/ParseRes.java b/src/me/topchetoeu/jscript/parsing/ParseRes.java index 1b8e2d0..0d79c03 100644 --- a/src/me/topchetoeu/jscript/parsing/ParseRes.java +++ b/src/me/topchetoeu/jscript/parsing/ParseRes.java @@ -1,97 +1,97 @@ -package me.topchetoeu.jscript.parsing; - -import java.util.List; -import java.util.Map; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.parsing.Parsing.Parser; - -public class ParseRes { - public static enum State { - SUCCESS, - FAILED, - ERROR; - - public boolean isSuccess() { return this == SUCCESS; } - public boolean isFailed() { return this == FAILED; } - public boolean isError() { return this == ERROR; } - } - - public final ParseRes.State state; - public final String error; - public final T result; - public final int n; - - private ParseRes(ParseRes.State state, String error, T result, int readN) { - this.result = result; - this.n = readN; - this.state = state; - this.error = error; - } - - public ParseRes setN(int i) { - if (!state.isSuccess()) return this; - return new ParseRes<>(state, null, result, i); - } - public ParseRes addN(int i) { - if (!state.isSuccess()) return this; - return new ParseRes<>(state, null, result, this.n + i); - } - public ParseRes transform() { - if (isSuccess()) throw new RuntimeException("Can't transform a ParseRes that hasn't failed."); - return new ParseRes<>(state, error, null, 0); - } - public TestRes toTest() { - if (isSuccess()) return TestRes.res(n); - else if (isError()) return TestRes.error(null, error); - else return TestRes.failed(); - } - - public boolean isSuccess() { return state.isSuccess(); } - public boolean isFailed() { return state.isFailed(); } - public boolean isError() { return state.isError(); } - - public static ParseRes failed() { - return new ParseRes(State.FAILED, null, null, 0); - } - public static ParseRes error(Location loc, String error) { - if (loc != null) error = loc + ": " + error; - return new ParseRes<>(State.ERROR, error, null, 0); - } - public static ParseRes error(Location loc, String error, ParseRes other) { - if (loc != null) error = loc + ": " + error; - if (!other.isError()) return new ParseRes<>(State.ERROR, error, null, 0); - return new ParseRes<>(State.ERROR, other.error, null, 0); - } - public static ParseRes res(T val, int i) { - return new ParseRes<>(State.SUCCESS, null, val, i); - } - - @SafeVarargs - public static ParseRes any(ParseRes ...parsers) { - ParseRes best = null; - ParseRes error = ParseRes.failed(); - - for (var parser : parsers) { - if (parser.isSuccess()) { - if (best == null || best.n < parser.n) best = parser; - } - else if (parser.isError() && error.isFailed()) error = parser.transform(); - } - - if (best != null) return best; - else return error; - } - @SafeVarargs - public static ParseRes first(String filename, List tokens, Map> named, Parser ...parsers) { - ParseRes error = ParseRes.failed(); - - for (var parser : parsers) { - var res = parser.parse(null, tokens, 0); - if (res.isSuccess()) return res; - else if (res.isError() && error.isFailed()) error = res.transform(); - } - - return error; - } +package me.topchetoeu.jscript.parsing; + +import java.util.List; +import java.util.Map; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.parsing.Parsing.Parser; + +public class ParseRes { + public static enum State { + SUCCESS, + FAILED, + ERROR; + + public boolean isSuccess() { return this == SUCCESS; } + public boolean isFailed() { return this == FAILED; } + public boolean isError() { return this == ERROR; } + } + + public final ParseRes.State state; + public final String error; + public final T result; + public final int n; + + private ParseRes(ParseRes.State state, String error, T result, int readN) { + this.result = result; + this.n = readN; + this.state = state; + this.error = error; + } + + public ParseRes setN(int i) { + if (!state.isSuccess()) return this; + return new ParseRes<>(state, null, result, i); + } + public ParseRes addN(int i) { + if (!state.isSuccess()) return this; + return new ParseRes<>(state, null, result, this.n + i); + } + public ParseRes transform() { + if (isSuccess()) throw new RuntimeException("Can't transform a ParseRes that hasn't failed."); + return new ParseRes<>(state, error, null, 0); + } + public TestRes toTest() { + if (isSuccess()) return TestRes.res(n); + else if (isError()) return TestRes.error(null, error); + else return TestRes.failed(); + } + + public boolean isSuccess() { return state.isSuccess(); } + public boolean isFailed() { return state.isFailed(); } + public boolean isError() { return state.isError(); } + + public static ParseRes failed() { + return new ParseRes(State.FAILED, null, null, 0); + } + public static ParseRes error(Location loc, String error) { + if (loc != null) error = loc + ": " + error; + return new ParseRes<>(State.ERROR, error, null, 0); + } + public static ParseRes error(Location loc, String error, ParseRes other) { + if (loc != null) error = loc + ": " + error; + if (!other.isError()) return new ParseRes<>(State.ERROR, error, null, 0); + return new ParseRes<>(State.ERROR, other.error, null, 0); + } + public static ParseRes res(T val, int i) { + return new ParseRes<>(State.SUCCESS, null, val, i); + } + + @SafeVarargs + public static ParseRes any(ParseRes ...parsers) { + ParseRes best = null; + ParseRes error = ParseRes.failed(); + + for (var parser : parsers) { + if (parser.isSuccess()) { + if (best == null || best.n < parser.n) best = parser; + } + else if (parser.isError() && error.isFailed()) error = parser.transform(); + } + + if (best != null) return best; + else return error; + } + @SafeVarargs + public static ParseRes first(String filename, List tokens, Map> named, Parser ...parsers) { + ParseRes error = ParseRes.failed(); + + for (var parser : parsers) { + var res = parser.parse(null, tokens, 0); + if (res.isSuccess()) return res; + else if (res.isError() && error.isFailed()) error = res.transform(); + } + + return error; + } } \ No newline at end of file diff --git a/src/me/topchetoeu/jscript/parsing/Parsing.java b/src/me/topchetoeu/jscript/parsing/Parsing.java index e0fb24e..8226029 100644 --- a/src/me/topchetoeu/jscript/parsing/Parsing.java +++ b/src/me/topchetoeu/jscript/parsing/Parsing.java @@ -1,1903 +1,1903 @@ -package me.topchetoeu.jscript.parsing; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.TreeSet; - -import me.topchetoeu.jscript.Filename; -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.compilation.*; -import me.topchetoeu.jscript.compilation.VariableDeclareStatement.Pair; -import me.topchetoeu.jscript.compilation.control.*; -import me.topchetoeu.jscript.compilation.control.SwitchStatement.SwitchCase; -import me.topchetoeu.jscript.compilation.values.*; -import me.topchetoeu.jscript.engine.Environment; -import me.topchetoeu.jscript.engine.Operation; -import me.topchetoeu.jscript.engine.scope.LocalScopeRecord; -import me.topchetoeu.jscript.engine.values.Values; -import me.topchetoeu.jscript.exceptions.SyntaxException; -import me.topchetoeu.jscript.parsing.ParseRes.State; - -// TODO: this has to be rewritten -public class Parsing { - public static interface Parser { - ParseRes parse(Filename filename, List tokens, int i); - } - - private static class ObjProp { - public final Object name; - public final String access; - public final FunctionStatement func; - - public ObjProp(Object name, String access, FunctionStatement func) { - this.name = name; - this.access = access; - this.func = func; - } - } - - public static final HashMap> functions = new HashMap<>(); - - private static final HashSet reserved = new HashSet(); - static { - reserved.add("true"); - reserved.add("false"); - reserved.add("void"); - reserved.add("null"); - reserved.add("this"); - reserved.add("if"); - reserved.add("else"); - reserved.add("try"); - reserved.add("catch"); - reserved.add("finally"); - reserved.add("for"); - reserved.add("do"); - reserved.add("while"); - reserved.add("switch"); - reserved.add("case"); - reserved.add("default"); - reserved.add("new"); - reserved.add("function"); - reserved.add("var"); - reserved.add("return"); - reserved.add("throw"); - reserved.add("typeof"); - reserved.add("delete"); - reserved.add("break"); - reserved.add("continue"); - reserved.add("debugger"); - reserved.add("implements"); - reserved.add("interface"); - reserved.add("package"); - reserved.add("private"); - reserved.add("protected"); - reserved.add("public"); - reserved.add("static"); - // Although ES5 allow these, we will comply to ES6 here - reserved.add("const"); - reserved.add("let"); - // These are allowed too, however our parser considers them keywords - reserved.add("undefined"); - reserved.add("arguments"); - reserved.add("globalThis"); - reserved.add("window"); - reserved.add("self"); - // We allow yield and await, because they're part of the custom async and generator functions - } - - public static boolean isDigit(char c) { - return c >= '0' && c <= '9'; - } - public static boolean isWhitespace(char c) { - return isAny(c, " \t\r\n"); - } - public static boolean isLetter(char c) { - return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); - } - public static boolean isAlphanumeric(char c) { - return isLetter(c) || isDigit(c); - } - public static boolean isAny(char c, String alphabet) { - return alphabet.contains(Character.toString(c)); - } - - private static final int CURR_NONE = 0; - private static final int CURR_NUMBER = 1; - private static final int CURR_FLOAT = 11; - private static final int CURR_SCIENTIFIC_NOT = 12; - private static final int CURR_NEG_SCIENTIFIC_NOT = 13; - private static final int CURR_HEX = 14; - private static final int CURR_STRING = 2; - private static final int CURR_LITERAL = 3; - private static final int CURR_OPERATOR = 4; - private static final int CURR_REGEX = 6; - private static final int CURR_REGEX_FLAGS = 7; - private static final int CURR_MULTI_COMMENT = 8; - private static final int CURR_SINGLE_COMMENT = 9; - - private static void addToken(StringBuilder currToken, int currStage, int line, int lastStart, Filename filename, List tokens) { - var res = currToken.toString(); - - switch (currStage) { - case CURR_STRING: tokens.add(new RawToken(res, TokenType.STRING, line, lastStart)); break; - case CURR_REGEX_FLAGS: tokens.add(new RawToken(res, TokenType.REGEX, line, lastStart)); break; - case CURR_NUMBER: - case CURR_HEX: - case CURR_NEG_SCIENTIFIC_NOT: - case CURR_SCIENTIFIC_NOT: - case CURR_FLOAT: - tokens.add(new RawToken(res, TokenType.NUMBER, line, lastStart)); break; - case CURR_LITERAL: tokens.add(new RawToken(res, TokenType.LITERAL, line, lastStart)); break; - case CURR_OPERATOR: tokens.add(new RawToken(res, TokenType.OPERATOR, line, lastStart)); break; - } - - currToken.delete(0, currToken.length()); - } - - // This method is so long because we're tokenizing the string using an iterative approach - // instead of a recursive descent parser. This is mainly done for performance reasons. - private static ArrayList splitTokens(Filename filename, String raw) { - var tokens = new ArrayList(); - var currToken = new StringBuilder(64); - - // Those are state variables, and will be reset every time a token has ended parsing - boolean lastEscape = false, inBrackets = false; - - int line = 1, start = 1, lastStart = 1, parenI = 0; - var loc = new Location(line, lastStart, filename); - int currStage = CURR_NONE; - - // when we want to continue parsing a token, we will execute continue;, which will skip - // the token end logic - loop: for (int i = 0; i < raw.length(); i++) { - char c = raw.charAt(i); - - start++; - - switch (currStage) { - case CURR_STRING: - currToken.append(c); - - if (!lastEscape) { - if (c == '\n') throw new SyntaxException(loc, "Can't have a multiline string."); - else if (c == '\\') { - lastEscape = true; - continue; - } - else if (c != currToken.charAt(0)) continue; - } - else { - lastEscape = false; - continue; - } - break; - case CURR_REGEX: - currToken.append(c); - if (!lastEscape) { - if (c == '\\') lastEscape = true; - if (c == '/' & parenI == 0 & !inBrackets) { - currStage = CURR_REGEX_FLAGS; - continue; - } - if (c == '[') inBrackets = true; - if (c == ']') inBrackets = false; - if (c == '(' && !inBrackets) parenI++; - if (c == ')' && !inBrackets) parenI--; - } - else lastEscape = false; - continue; - case CURR_REGEX_FLAGS: - if (isAny(c, "dgimsuy")) { - currToken.append(c); - continue; - } - i--; start--; - break; - case CURR_NUMBER: - if (c == '.') currStage = CURR_FLOAT; - else if (c == 'e' || c == 'E') currStage = CURR_SCIENTIFIC_NOT; - else if ((c == 'x' || c == 'X') && currToken.toString().equals("0")) currStage = CURR_HEX; - else if (!isDigit(c)) { - i--; start--; - break; - } - currToken.append(c); - continue; - case CURR_FLOAT: - if (c == 'e' || c == 'E') currStage = CURR_SCIENTIFIC_NOT; - else if (!isDigit(c)) { - i--; start--; - break; - } - currToken.append(c); - continue; - case CURR_SCIENTIFIC_NOT: - if (c == '-') currStage = CURR_NEG_SCIENTIFIC_NOT; - else if (!isDigit(c)) { - i--; start--; - break; - } - currToken.append(c); - continue; - case CURR_NEG_SCIENTIFIC_NOT: - if (isDigit(c)) currToken.append(c); - else { - i--; start--; - break; - } - continue; - case CURR_HEX: - if (isDigit(c) || isAny(c, "ABCDEFabcdef")) currToken.append(c); - else { - i--; start--; - break; - } - continue; - case CURR_SINGLE_COMMENT: - currToken.delete(0, currToken.length()); - if (c != '\n') continue; - else { - line++; - start = 1; - } - break; - case CURR_MULTI_COMMENT: - if (c == '\n') line++; - if (!(currToken.charAt(0) == '*' && c == '/')) { - currToken.delete(0, currToken.length()); - currToken.append(c); - continue; - } - break; - case CURR_LITERAL: - if (isAlphanumeric(c) || c == '_' || c == '$') { - currToken.append(c); - continue; - } - else { i--; start--; } - break; - case CURR_OPERATOR: { - // here we do several things: - // - detect a comment - // - detect a regular expression - // - detect a float number (.xxxx) - // - read an operator greedily - - // this variable keeps track of whether we're still reading an operator - boolean ok = false; - if (currToken.length() == 1) { - // double operators - if (currToken.charAt(0) == c && isAny(c, "&|=+-<>")) ok = true; - // assignments - else if (c == '=' && isAny(currToken.charAt(0), "&|^+-/*%!<>")) ok = true; - // detect float numbers - else if (isDigit(c) && currToken.charAt(0) == '.') { - currStage = CURR_FLOAT; - currToken.append(c); - continue; - } - else if (currToken.charAt(0) == '/') { - // single line comments - if (c == '/') { - currStage = CURR_SINGLE_COMMENT; - continue; - } - // multiline comments - else if (c == '*') { - currStage = CURR_MULTI_COMMENT; - continue; - } - // regular expressions - else { - // regular expressions must be in the start of a file, or be followed by a - // newline, or an operator - // this is because of expressions like 1 / 2 / 3 (/ 2 /) will get recognized as regex - // still, the closing paren must be ignored, because in an expression, we can't have a value, following a paren - var prevToken = tokens.size() == 0 ? null : tokens.get(tokens.size() - 1); - if (tokens.size() == 0 || ( - prevToken.line < line || - prevToken.type == TokenType.OPERATOR && !prevToken.value.equals(")") || - prevToken.value.equals("return") || - prevToken.value.equals("throe") - )) { - // we look for a second / on the same line - // if we don't find one, we determine the current operator - // to be a division - for (int j = i; j < raw.length(); j++) { - if (raw.charAt(j) == '/') { - i--; start--; - currStage = CURR_REGEX; - continue loop; - } - if (raw.charAt(j) == '\n') break; - } - } - } - } - } - if (currToken.length() == 2) { - var a = currToken.charAt(0); - var b = currToken.charAt(1); - if (( - a == '=' && b == '=' || - a == '!' && b == '=' || - a == '<' && b == '<' || - a == '>' && b == '>' || - a == '>' && b == '>' - ) && c == '=') ok = true; - if (a == '>' && b == '>' && c == '>') ok = true; - } - if ( - currToken.length() == 3 && - currToken.charAt(0) == '>' && - currToken.charAt(1) == '>' && - currToken.charAt(2) == '>' && - c == '=' - ) ok = true; - - if (ok) { - currToken.append(c); - continue; - } - else { i--; start--; } - break; - } - default: - // here we detect what type of token we're reading - if (isAny(c, " \t\n\r")) { - if (c == '\n') { - line++; - start = 1; - } - } - else if (isDigit(c)) { - currToken.append(c); - currStage = CURR_NUMBER; - continue; - } - else if (isAlphanumeric(c) || c == '_' || c == '$') { - currToken.append(c); - currStage = CURR_LITERAL; - continue; - } - else if (isAny(c, "+-/*%=!&|^(){}[];.,<>!:~?")) { - currToken.append(c); - currStage = CURR_OPERATOR; - continue; - } - else if (c == '"' || c == '\'') { - currToken.append(c); - currStage = CURR_STRING; - continue; - } - else throw new SyntaxException(new Location(line, start, filename), String.format("Unrecognized character %s.", c)); - } - - // if we got here, we know that we have encountered the end of a token - addToken(currToken, currStage, line, lastStart, filename, tokens); - lastEscape = inBrackets = false; - currStage = CURR_NONE; - lastStart = start; - } - - // here, we save a leftover token (if any) - switch (currStage) { - case CURR_STRING: throw new SyntaxException(new Location(line, start, filename), "Unterminated string literal."); - case CURR_REGEX: throw new SyntaxException(new Location(line, start, filename), "Incomplete regex."); - } - addToken(currToken, currStage, line, lastStart, filename, tokens); - - return tokens; - } - - public static int fromHex(char c) { - if (c >= 'A' && c <= 'F') return c - 'A' + 10; - if (c >= 'a' && c <= 'f') return c - 'a' + 10; - if (c >= '0' && c <= '9') return c - '0'; - return -1; - } - - private static String parseString(Location loc, String literal) { - var res = new StringBuilder(); - - for (var i = 1; i < literal.length() - 1; i++) { - if (literal.charAt(i) == '\\') { - char c = literal.charAt(++i); - if (c == 'b') res.append('\b'); - else if (c == 't') res.append('\t'); - else if (c == 'n') res.append('\n'); - else if (c == 'f') res.append('\f'); - else if (c == 'r') res.append('\r'); - else if (c == '0') { - if (i + 1 >= literal.length()) res.append((char)0); - c = literal.charAt(i + 1); - if (c >= '0' && c <= '9') throw new SyntaxException(loc.add(i), "Octal escape sequences not allowed."); - res.append((char)0); - } - else if (c >= '1' && c <= '9') { - throw new SyntaxException(loc.add(i), "Octal escape sequences not allowed."); - } - else if (c == 'x') { - var newC = 0; - i++; - for (var j = 0; j < 2; j++) { - if (i >= literal.length()) throw new SyntaxException(loc.add(i), "Incomplete unicode escape sequence."); - int val = fromHex(literal.charAt(i++)); - if (val == -1) throw new SyntaxException(loc.add(i + 1), "Invalid character in unicode escape sequence."); - newC = (newC << 4) | val; - } - i--; - - res.append((char)newC); - } - else if (c == 'u') { - var newC = 0; - i++; - for (var j = 0; j < 4; j++) { - if (i >= literal.length()) throw new SyntaxException(loc.add(i), "Incomplete unicode escape sequence."); - int val = fromHex(literal.charAt(i++)); - if (val == -1) throw new SyntaxException(loc.add(i + 1), "Invalid character in unicode escape sequence."); - newC = (newC << 4) | val; - } - i--; - - res.append((char)newC); - } - else res.append(c); - } - else res.append(literal.charAt(i)); - } - - return res.toString(); - } - private static String parseRegex(Location loc, String literal) { - var res = new StringBuilder(); - - int end = literal.lastIndexOf('/'); - - for (var i = 1; i < end; i++) { - if (literal.charAt(i) == '\\') { - char c = literal.charAt(++i); - if (c == 'b') res.append('\b'); - else if (c == 't') res.append('\t'); - else if (c == 'n') res.append('\n'); - else if (c == 'f') res.append('\f'); - else if (c == 'r') res.append('\r'); - else if (c == '0') { - if (i + 1 >= literal.length()) res.append((char)0); - c = literal.charAt(i + 1); - if (c >= '0' && c <= '9') throw new SyntaxException(loc.add(i), "Octal escape sequences not allowed."); - res.append((char)0); - } - else if (c >= '1' && c <= '9') { - res.append((char)(c - '0')); - i++; - } - else if (c == 'x') { - var newC = 0; - i++; - for (var j = 0; j < 2; j++) { - if (i >= literal.length()) throw new SyntaxException(loc.add(i), "Incomplete unicode escape sequence."); - int val = fromHex(literal.charAt(i++)); - if (val == -1) throw new SyntaxException(loc.add(i + 1), "Invalid character in unicode escape sequence."); - newC = (newC << 4) | val; - } - i--; - - res.append((char)newC); - } - else if (c == 'u') { - var newC = 0; - i++; - for (var j = 0; j < 4; j++) { - if (i >= literal.length()) throw new SyntaxException(loc.add(i), "Incomplete unicode escape sequence."); - int val = fromHex(literal.charAt(i++)); - if (val == -1) throw new SyntaxException(loc.add(i + 1), "Invalid character in unicode escape sequence."); - newC = (newC << 4) | val; - } - i--; - - res.append((char)newC); - } - else res.append("\\" + c); - } - else res.append(literal.charAt(i)); - } - - return '/' + res.toString() + literal.substring(end); - } - - private static double parseHex(String literal) { - double res = 0; - - for (int i = 2; i < literal.length(); i++) { - res *= 16; - int dig = fromHex(literal.charAt(i)); - res += dig; - } - - return res; - } - - public static Double parseNumber(boolean octals, String value) { - if (value.startsWith("0x") || value.startsWith("0X")) { - if (value.length() == 2) return null; - return parseHex(value); - } - if (value.endsWith("e") || value.endsWith("E") || value.endsWith("-")) return null; - - int i = 0; - double res = 0, dotDivisor = 1; - boolean e = false, dot = false; - int exponent = 0; - - for (; i < value.length(); i++) { - char c = value.charAt(i); - if (c == '.') { dot = true; break; } - if (c == 'e') { e = true; break; } - if (!isDigit(c)) break; - - res = res * 10 + c - '0'; - } - - if (dot) for (i++; i < value.length(); i++) { - char c = value.charAt(i); - if (c == 'e') { e = true; break; } - if (!isDigit(c)) break; - - res += (c - '0') / (dotDivisor *= 10); - } - - if (e) for (i++; i < value.length(); i++) { - char c = value.charAt(i); - if (!isDigit(c)) break; - exponent = 10 * exponent + c - '0'; - } - - if (exponent < 0) for (int j = 0; j < -exponent; j++) res /= 10; - else for (int j = 0; j < exponent; j++) res *= 10; - - return res; - } - private static double parseNumber(Location loc, String value) { - var res = parseNumber(false, value); - if (res == null) throw new SyntaxException(loc, "Invalid number format."); - else return res; - } - - private static List parseTokens(Filename filename, Collection tokens) { - var res = new ArrayList(); - - for (var el : tokens) { - var loc = new Location(el.line, el.start, filename); - switch (el.type) { - case LITERAL: res.add(Token.identifier(el.line, el.start, el.value)); break; - case NUMBER: res.add(Token.number(el.line, el.start, parseNumber(loc, el.value))); break; - case STRING: res.add(Token.string(el.line, el.start, parseString(loc, el.value))); break; - case REGEX: res.add(Token.regex(el.line, el.start, parseRegex(loc, el.value))); break; - case OPERATOR: - Operator op = Operator.parse(el.value); - if (op == null) throw new SyntaxException(loc, String.format("Unrecognized operator '%s'.", el.value)); - res.add(Token.operator(el.line, el.start, op)); - break; - } - } - - return res; - } - - public static List tokenize(Filename filename, String raw) { - return parseTokens(filename, splitTokens(filename, raw)); - } - - public static Location getLoc(Filename filename, List tokens, int i) { - if (tokens.size() == 0 || tokens.size() == 0) return new Location(1, 1, filename); - if (i >= tokens.size()) i = tokens.size() - 1; - return new Location(tokens.get(i).line, tokens.get(i).start, filename); - } - public static int getLines(List tokens) { - if (tokens.size() == 0) return 1; - return tokens.get(tokens.size() - 1).line; - } - - public static ParseRes parseIdentifier(List tokens, int i) { - try { - if (tokens.get(i).isIdentifier()) { - return ParseRes.res(tokens.get(i).identifier(), 1); - } - else return ParseRes.failed(); - } - catch (IndexOutOfBoundsException e) { - return ParseRes.failed(); - } - } - public static ParseRes parseOperator(List tokens, int i) { - try { - if (tokens.get(i).isOperator()) { - return ParseRes.res(tokens.get(i).operator(), 1); - } - else return ParseRes.failed(); - } - catch (IndexOutOfBoundsException e) { - return ParseRes.failed(); - } - } - - public static boolean isIdentifier(List tokens, int i, String lit) { - try { - if (tokens.get(i).isIdentifier(lit)) { - return true; - } - else return false; - } - catch (IndexOutOfBoundsException e) { - return false; - } - } - public static boolean isOperator(List tokens, int i, Operator op) { - try { - if (tokens.get(i).isOperator(op)) { - return true; - } - else return false; - } - catch (IndexOutOfBoundsException e) { - return false; - } - } - public static boolean isStatementEnd(List tokens, int i) { - if (isOperator(tokens, i, Operator.SEMICOLON)) return true; - if (isOperator(tokens, i, Operator.BRACE_CLOSE)) return true; - if (i < 0) return false; - if (i >= tokens.size()) return true; - return getLoc(null, tokens, i).line() > getLoc(null, tokens, i - 1).line(); - } - public static boolean checkVarName(String name) { - return !reserved.contains(name); - } - - public static ParseRes parseString(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - try { - if (tokens.get(i).isString()) { - return ParseRes.res(new ConstantStatement(loc, tokens.get(i).string()), 1); - } - else return ParseRes.failed(); - } - catch (IndexOutOfBoundsException e) { - return ParseRes.failed(); - } - } - public static ParseRes parseNumber(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - try { - if (tokens.get(i).isNumber()) { - return ParseRes.res(new ConstantStatement(loc, tokens.get(i).number()), 1); - } - else return ParseRes.failed(); - } - catch (IndexOutOfBoundsException e) { - return ParseRes.failed(); - } - - } - public static ParseRes parseRegex(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - try { - if (tokens.get(i).isRegex()) { - var val = tokens.get(i).regex(); - var index = val.lastIndexOf('/'); - var first = val.substring(1, index); - var second = val.substring(index + 1); - return ParseRes.res(new RegexStatement(loc, first, second), 1); - } - else return ParseRes.failed(); - } - catch (IndexOutOfBoundsException e) { - return ParseRes.failed(); - } - } - - public static ParseRes parseArray(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - if (!isOperator(tokens, i + n++, Operator.BRACKET_OPEN)) return ParseRes.failed(); - - var values = new ArrayList(); - - // Java allows labels, so me uses labels - loop: while (true) { - if (isOperator(tokens, i + n, Operator.BRACKET_CLOSE)) { - n++; - break; - } - - while (isOperator(tokens, i + n, Operator.COMMA)) { - n++; - values.add(null); - if (isOperator(tokens, i + n, Operator.BRACKET_CLOSE)) { - n++; - break loop; - } - } - - var res = parseValue(filename, tokens, i + n, 2); - if (!res.isSuccess()) return ParseRes.error(loc, "Expected an array element.", res); - else n += res.n; - - values.add(res.result); - - if (isOperator(tokens, i + n, Operator.COMMA)) n++; - else if (isOperator(tokens, i + n, Operator.BRACKET_CLOSE)) { - n++; - break; - } - } - - return ParseRes.res(new ArrayStatement(loc, values.toArray(Statement[]::new)), n); - } - - public static ParseRes> parseParamList(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a parameter list."); - - var args = new ArrayList(); - - if (isOperator(tokens, i + n, Operator.PAREN_CLOSE)) { - n++; - } - else { - while (true) { - var argRes = parseIdentifier(tokens, i + n); - if (argRes.isSuccess()) { - args.add(argRes.result); - n++; - if (isOperator(tokens, i + n, Operator.COMMA)) { - n++; - } - if (isOperator(tokens, i + n, Operator.PAREN_CLOSE)) { - n++; - break; - } - } - else return ParseRes.error(loc, "Expected an argument, comma or a closing brace."); - } - } - - return ParseRes.res(args, n); - } - - public static ParseRes parsePropName(Filename filename, List tokens, int i) { - var idRes = parseIdentifier(tokens, i); - if (idRes.isSuccess()) return ParseRes.res(idRes.result, 1); - var strRes = parseString(null, tokens, i); - if (strRes.isSuccess()) return ParseRes.res(strRes.result.value, 1); - var numRes = parseNumber(null, tokens, i); - if (numRes.isSuccess()) return ParseRes.res(numRes.result.value, 1); - - return ParseRes.failed(); - } - public static ParseRes parseObjectProp(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - var accessRes = parseIdentifier(tokens, i + n++); - if (!accessRes.isSuccess()) return ParseRes.failed(); - var access = accessRes.result; - if (!access.equals("get") && !access.equals("set")) return ParseRes.failed(); - - var nameRes = parsePropName(filename, tokens, i + n); - if (!nameRes.isSuccess()) return ParseRes.error(loc, "Expected a property name after '" + access + "'."); - var name = nameRes.result; - n += nameRes.n; - - var argsRes = parseParamList(filename, tokens, i + n); - if (!argsRes.isSuccess()) return ParseRes.error(loc, "Expected an argument list.", argsRes); - n += argsRes.n; - - var res = parseCompound(filename, tokens, i + n); - if (!res.isSuccess()) return ParseRes.error(loc, "Expected a compound statement for property accessor.", res); - n += res.n; - - var end = getLoc(filename, tokens, i + n - 1); - - return ParseRes.res(new ObjProp( - name, access, - new FunctionStatement(loc, end, access + " " + name.toString(), argsRes.result.toArray(String[]::new), false, res.result) - ), n); - } - public static ParseRes parseObject(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - if (!isOperator(tokens, i + n++, Operator.BRACE_OPEN)) return ParseRes.failed(); - - var values = new LinkedHashMap(); - var getters = new LinkedHashMap(); - var setters = new LinkedHashMap(); - - if (isOperator(tokens, i + n, Operator.BRACE_CLOSE)) { - n++; - return ParseRes.res(new ObjectStatement(loc, values, getters, setters), n); - } - - while (true) { - var propRes = parseObjectProp(filename, tokens, i + n); - - if (propRes.isSuccess()) { - n += propRes.n; - if (propRes.result.access.equals("set")) { - setters.put(propRes.result.name, propRes.result.func); - } - else { - getters.put(propRes.result.name, propRes.result.func); - } - } - else { - var nameRes = parsePropName(filename, tokens, i + n); - if (!nameRes.isSuccess()) return ParseRes.error(loc, "Expected a field name.", propRes); - n += nameRes.n; - - if (!isOperator(tokens, i + n++, Operator.COLON)) return ParseRes.error(loc, "Expected a colon."); - - var valRes = parseValue(filename, tokens, i + n, 2); - if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value in array list.", valRes); - n += valRes.n; - - values.put(nameRes.result, valRes.result); - } - - if (isOperator(tokens, i + n, Operator.COMMA)) { - n++; - if (isOperator(tokens, i + n, Operator.BRACE_CLOSE)) { - n++; - break; - } - continue; - } - else if (isOperator(tokens, i + n, Operator.BRACE_CLOSE)) { - n++; - break; - } - else ParseRes.error(loc, "Expected a comma or a closing brace."); - } - - return ParseRes.res(new ObjectStatement(loc, values, getters, setters), n); - } - public static ParseRes parseNew(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - var n = 0; - if (!isIdentifier(tokens, i + n++, "new")) return ParseRes.failed(); - - var valRes = parseValue(filename, tokens, i + n, 18); - n += valRes.n; - if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after 'new' keyword.", valRes); - var callRes = parseCall(filename, tokens, i + n, valRes.result, 0); - n += callRes.n; - if (callRes.isError()) return callRes.transform(); - else if (callRes.isFailed()) return ParseRes.res(new CallStatement(loc, true, valRes.result), n); - var call = (CallStatement)callRes.result; - - return ParseRes.res(new CallStatement(loc, true, call.func, call.args), n); - } - public static ParseRes parseTypeof(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - var n = 0; - if (!isIdentifier(tokens, i + n++, "typeof")) return ParseRes.failed(); - - var valRes = parseValue(filename, tokens, i + n, 15); - if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after 'typeof' keyword.", valRes); - n += valRes.n; - - return ParseRes.res(new TypeofStatement(loc, valRes.result), n); - } - public static ParseRes parseVoid(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - var n = 0; - if (!isIdentifier(tokens, i + n++, "void")) return ParseRes.failed(); - - var valRes = parseValue(filename, tokens, i + n, 14); - if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after 'void' keyword.", valRes); - n += valRes.n; - - return ParseRes.res(new DiscardStatement(loc, valRes.result), n); - } - public static ParseRes parseDelete(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - if (!isIdentifier(tokens, i + n++, "delete")) return ParseRes.failed(); - - var valRes = parseValue(filename, tokens, i + n, 15); - if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after 'delete'.", valRes); - n += valRes.n; - - if (valRes.result instanceof IndexStatement) { - var index = (IndexStatement)valRes.result; - return ParseRes.res(new DeleteStatement(loc, index.index, index.object), n); - } - else if (valRes.result instanceof VariableStatement) { - return ParseRes.error(loc, "A variable may not be deleted."); - } - else { - return ParseRes.res(new ConstantStatement(loc, true), n); - } - } - - public static ParseRes parseFunction(Filename filename, List tokens, int i, boolean statement) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - if (!isIdentifier(tokens, i + n++, "function")) return ParseRes.failed(); - - var nameRes = parseIdentifier(tokens, i + n); - if (!nameRes.isSuccess() && statement) return ParseRes.error(loc, "A statement function requires a name, one is not present."); - var name = nameRes.result; - n += nameRes.n; - - if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a parameter list."); - - var args = new ArrayList(); - - if (isOperator(tokens, i + n, Operator.PAREN_CLOSE)) { - n++; - } - else { - while (true) { - var argRes = parseIdentifier(tokens, i + n); - if (argRes.isSuccess()) { - args.add(argRes.result); - n++; - if (isOperator(tokens, i + n, Operator.COMMA)) { - n++; - } - if (isOperator(tokens, i + n, Operator.PAREN_CLOSE)) { - n++; - break; - } - } - else return ParseRes.error(loc, "Expected an argument, comma or a closing brace."); - } - } - - var res = parseCompound(filename, tokens, i + n); - n += res.n; - var end = getLoc(filename, tokens, i + n - 1); - - if (res.isSuccess()) return ParseRes.res(new FunctionStatement(loc, end, name, args.toArray(String[]::new), statement, res.result), n); - else return ParseRes.error(loc, "Expected a compound statement for function.", res); - } - - public static ParseRes parseUnary(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - var opState = parseOperator(tokens, i + n++); - if (!opState.isSuccess()) return ParseRes.failed(); - var op = opState.result; - - Operation operation = null; - - if (op == Operator.ADD) operation = Operation.POS; - else if (op == Operator.SUBTRACT) operation = Operation.NEG; - else if (op == Operator.INVERSE) operation = Operation.INVERSE; - else if (op == Operator.NOT) operation = Operation.NOT; - else return ParseRes.failed(); - - var res = parseValue(filename, tokens, n + i, 14); - - if (res.isSuccess()) return ParseRes.res(new OperationStatement(loc, operation, res.result), n + res.n); - else return ParseRes.error(loc, String.format("Expected a value after the unary operator '%s'.", op.value), res); - } - public static ParseRes parsePrefixChange(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - var opState = parseOperator(tokens, i + n++); - if (!opState.isSuccess()) return ParseRes.failed(); - - int change = 0; - - if (opState.result == Operator.INCREASE) change = 1; - else if (opState.result == Operator.DECREASE) change = -1; - else return ParseRes.failed(); - - var res = parseValue(filename, tokens, i + n, 15); - if (!(res.result instanceof AssignableStatement)) return ParseRes.error(loc, "Expected assignable value after prefix operator."); - return ParseRes.res(new ChangeStatement(loc, (AssignableStatement)res.result, change, false), n + res.n); - } - public static ParseRes parseParens(Filename filename, List tokens, int i) { - int n = 0; - if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.failed(); - - var res = parseValue(filename, tokens, i + n, 0); - if (!res.isSuccess()) return res; - n += res.n; - - if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.failed(); - - return ParseRes.res(res.result, n); - } - @SuppressWarnings("all") - public static ParseRes parseSimple(Filename filename, List tokens, int i, boolean statement) { - var res = new ArrayList<>(); - - if (!statement) { - res.add(parseObject(filename, tokens, i)); - res.add(parseFunction(filename, tokens, i, false)); - } - - res.addAll(List.of( - parseVariable(filename, tokens, i), - parseLiteral(filename, tokens, i), - parseString(filename, tokens, i), - parseRegex(filename, tokens, i), - parseNumber(filename, tokens, i), - parseUnary(filename, tokens, i), - parseArray(filename, tokens, i), - parsePrefixChange(filename, tokens, i), - parseParens(filename, tokens, i), - parseNew(filename, tokens, i), - parseTypeof(filename, tokens, i), - parseVoid(filename, tokens, i), - parseDelete(filename, tokens, i) - )); - - return ParseRes.any(res.toArray(ParseRes[]::new)); - } - - public static ParseRes parseVariable(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - var literal = parseIdentifier(tokens, i); - - if (!literal.isSuccess()) return ParseRes.failed(); - - if (!checkVarName(literal.result)) { - if (literal.result.equals("await")) return ParseRes.error(loc, "'await' expressions are not supported."); - if (literal.result.equals("const")) return ParseRes.error(loc, "'const' declarations are not supported."); - if (literal.result.equals("let")) return ParseRes.error(loc, "'let' declarations are not supported."); - return ParseRes.error(loc, String.format("Unexpected identifier '%s'.", literal.result)); - } - - return ParseRes.res(new VariableStatement(loc, literal.result), 1); - } - public static ParseRes parseLiteral(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - var id = parseIdentifier(tokens, i); - if (!id.isSuccess()) return id.transform(); - - if (id.result.equals("true")) { - return ParseRes.res(new ConstantStatement(loc, true), 1); - } - if (id.result.equals("false")) { - return ParseRes.res(new ConstantStatement(loc, false), 1); - } - if (id.result.equals("undefined")) { - return ParseRes.res(new ConstantStatement(loc, null), 1); - } - if (id.result.equals("null")) { - return ParseRes.res(new ConstantStatement(loc, Values.NULL), 1); - } - if (id.result.equals("this")) { - return ParseRes.res(new VariableIndexStatement(loc, 0), 1); - } - if (id.result.equals("arguments")) { - return ParseRes.res(new VariableIndexStatement(loc, 1), 1); - } - if (id.result.equals("globalThis") || id.result.equals("window") || id.result.equals("self")) { - return ParseRes.res(new GlobalThisStatement(loc), 1); - } - return ParseRes.failed(); - } - public static ParseRes parseMember(Filename filename, List tokens, int i, Statement prev, int precedence) { - var loc = getLoc(filename, tokens, i); - var n = 0; - - if (precedence > 18) return ParseRes.failed(); - - if (!isOperator(tokens, i + n++, Operator.DOT)) return ParseRes.failed(); - - var literal = parseIdentifier(tokens, i + n++); - if (!literal.isSuccess()) return ParseRes.error(loc, "Expected an identifier after member access."); - - return ParseRes.res(new IndexStatement(loc, prev, new ConstantStatement(loc, literal.result)), n); - } - public static ParseRes parseIndex(Filename filename, List tokens, int i, Statement prev, int precedence) { - var loc = getLoc(filename, tokens, i); - var n = 0; - - if (precedence > 18) return ParseRes.failed(); - - if (!isOperator(tokens, i + n++, Operator.BRACKET_OPEN)) return ParseRes.failed(); - - var valRes = parseValue(filename, tokens, i + n, 0); - if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value in index expression.", valRes); - n += valRes.n; - - if (!isOperator(tokens, i + n++, Operator.BRACKET_CLOSE)) return ParseRes.error(loc, "Expected a closing bracket."); - - return ParseRes.res(new IndexStatement(loc, prev, valRes.result), n); - } - public static ParseRes parseAssign(Filename filename, List tokens, int i, Statement prev, int precedence) { - var loc = getLoc(filename, tokens, i); - int n = 0 ; - - if (precedence > 2) return ParseRes.failed(); - - var opRes = parseOperator(tokens, i + n++); - if (opRes.state != State.SUCCESS) return ParseRes.failed(); - - var op = opRes.result; - if (!op.isAssign()) return ParseRes.failed(); - - if (!(prev instanceof AssignableStatement)) { - return ParseRes.error(loc, "Invalid expression on left hand side of assign operator."); - } - - var res = parseValue(filename, tokens, i + n, 2); - if (!res.isSuccess()) return ParseRes.error(loc, String.format("Expected value after assignment operator '%s'.", op.value), res); - n += res.n; - - Operation operation = null; - - if (op == Operator.ASSIGN_ADD) operation = Operation.ADD; - if (op == Operator.ASSIGN_SUBTRACT) operation = Operation.SUBTRACT; - if (op == Operator.ASSIGN_MULTIPLY) operation = Operation.MULTIPLY; - if (op == Operator.ASSIGN_DIVIDE) operation = Operation.DIVIDE; - if (op == Operator.ASSIGN_MODULO) operation = Operation.MODULO; - if (op == Operator.ASSIGN_OR) operation = Operation.OR; - if (op == Operator.ASSIGN_XOR) operation = Operation.XOR; - if (op == Operator.ASSIGN_AND) operation = Operation.AND; - if (op == Operator.ASSIGN_SHIFT_LEFT) operation = Operation.SHIFT_LEFT; - if (op == Operator.ASSIGN_SHIFT_RIGHT) operation = Operation.SHIFT_RIGHT; - if (op == Operator.ASSIGN_USHIFT_RIGHT) operation = Operation.USHIFT_RIGHT; - - return ParseRes.res(((AssignableStatement)prev).toAssign(res.result, operation), n); - } - public static ParseRes parseCall(Filename filename, List tokens, int i, Statement prev, int precedence) { - var loc = getLoc(filename, tokens, i); - var n = 0; - - if (precedence > 17) return ParseRes.failed(); - if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.failed(); - - var args = new ArrayList(); - boolean prevArg = false; - - while (true) { - var argRes = parseValue(filename, tokens, i + n, 2); - if (argRes.isSuccess()) { - args.add(argRes.result); - n += argRes.n; - prevArg = true; - } - else if (argRes.isError()) return argRes.transform(); - else if (isOperator(tokens, i + n, Operator.COMMA)) { - if (!prevArg) args.add(null); - prevArg = false; - n++; - } - else if (isOperator(tokens, i + n, Operator.PAREN_CLOSE)) { - n++; - break; - } - else return ParseRes.failed(); - } - - return ParseRes.res(new CallStatement(loc, false, prev, args.toArray(Statement[]::new)), n); - } - public static ParseRes parsePostfixChange(Filename filename, List tokens, int i, Statement prev, int precedence) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - if (precedence > 15) return ParseRes.failed(); - - var opState = parseOperator(tokens, i + n++); - if (!opState.isSuccess()) return ParseRes.failed(); - - int change = 0; - - if (opState.result == Operator.INCREASE) change = 1; - else if (opState.result == Operator.DECREASE) change = -1; - else return ParseRes.failed(); - - if (!(prev instanceof AssignableStatement)) return ParseRes.error(loc, "Expected assignable value before suffix operator."); - return ParseRes.res(new ChangeStatement(loc, (AssignableStatement)prev, change, true), n); - } - public static ParseRes parseInstanceof(Filename filename, List tokens, int i, Statement prev, int precedence) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - if (precedence > 9) return ParseRes.failed(); - if (!isIdentifier(tokens, i + n++, "instanceof")) return ParseRes.failed(); - - var valRes = parseValue(filename, tokens, i + n, 10); - if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after 'instanceof'.", valRes); - n += valRes.n; - - return ParseRes.res(new OperationStatement(loc, Operation.INSTANCEOF, prev, valRes.result), n); - } - public static ParseRes parseIn(Filename filename, List tokens, int i, Statement prev, int precedence) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - if (precedence > 9) return ParseRes.failed(); - if (!isIdentifier(tokens, i + n++, "in")) return ParseRes.failed(); - - var valRes = parseValue(filename, tokens, i + n, 10); - if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after 'in'.", valRes); - n += valRes.n; - - return ParseRes.res(new OperationStatement(loc, Operation.IN, prev, valRes.result), n); - } - public static ParseRes parseComma(Filename filename, List tokens, int i, Statement prev, int precedence) { - var loc = getLoc(filename, tokens, i); - var n = 0; - - if (precedence > 1) return ParseRes.failed(); - if (!isOperator(tokens, i + n++, Operator.COMMA)) return ParseRes.failed(); - - var res = parseValue(filename, tokens, i + n, 2); - if (!res.isSuccess()) return ParseRes.error(loc, "Expected a value after the comma.", res); - n += res.n; - - return ParseRes.res(new CompoundStatement(loc, false, prev, res.result), n); - } - public static ParseRes parseTernary(Filename filename, List tokens, int i, Statement prev, int precedence) { - var loc = getLoc(filename, tokens, i); - var n = 0; - - if (precedence > 2) return ParseRes.failed(); - if (!isOperator(tokens, i + n++, Operator.QUESTION)) return ParseRes.failed(); - - var a = parseValue(filename, tokens, i + n, 2); - if (!a.isSuccess()) return ParseRes.error(loc, "Expected a value after the ternary operator.", a); - n += a.n; - - if (!isOperator(tokens, i + n++, Operator.COLON)) return ParseRes.failed(); - - var b = parseValue(filename, tokens, i + n, 2); - if (!b.isSuccess()) return ParseRes.error(loc, "Expected a second value after the ternary operator.", b); - n += b.n; - - return ParseRes.res(new IfStatement(loc, prev, a.result, b.result), n); - } - public static ParseRes parseOperator(Filename filename, List tokens, int i, Statement prev, int precedence) { - var loc = getLoc(filename, tokens, i); - var n = 0; - - var opRes = parseOperator(tokens, i + n++); - if (!opRes.isSuccess()) return ParseRes.failed(); - var op = opRes.result; - - if (op.precedence < precedence) return ParseRes.failed(); - if (op.isAssign()) return parseAssign(filename, tokens, i + n - 1, prev, precedence); - - var res = parseValue(filename, tokens, i + n, op.precedence + (op.reverse ? 0 : 1)); - if (!res.isSuccess()) return ParseRes.error(loc, String.format("Expected a value after the '%s' operator.", op.value), res); - n += res.n; - - if (op == Operator.LAZY_AND) { - return ParseRes.res(new LazyAndStatement(loc, prev, res.result), n); - } - if (op == Operator.LAZY_OR) { - return ParseRes.res(new LazyOrStatement(loc, prev, res.result), n); - } - - return ParseRes.res(new OperationStatement(loc, op.operation, prev, res.result), n); - } - - public static ParseRes parseValue(Filename filename, List tokens, int i, int precedence, boolean statement) { - Statement prev = null; - int n = 0; - - while (true) { - if (prev == null) { - var res = parseSimple(filename, tokens, i + n, statement); - if (res.isSuccess()) { - n += res.n; - prev = res.result; - } - else if (res.isError()) return res.transform(); - else break; - } - else { - var res = ParseRes.any( - parseOperator(filename, tokens, i + n, prev, precedence), - parseMember(filename, tokens, i + n, prev, precedence), - parseIndex(filename, tokens, i + n, prev, precedence), - parseCall(filename, tokens, i + n, prev, precedence), - parsePostfixChange(filename, tokens, i + n, prev, precedence), - parseInstanceof(filename, tokens, i + n, prev, precedence), - parseIn(filename, tokens, i + n, prev, precedence), - parseComma(filename, tokens, i + n, prev, precedence), - parseTernary(filename, tokens, i + n, prev, precedence) - ); - - if (res.isSuccess()) { - n += res.n; - prev = res.result; - continue; - } - else if (res.isError()) return res.transform(); - - break; - } - } - - if (prev == null) return ParseRes.failed(); - else return ParseRes.res(prev, n); - } - public static ParseRes parseValue(Filename filename, List tokens, int i, int precedence) { - return parseValue(filename, tokens, i, precedence, false); - } - - public static ParseRes parseValueStatement(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - var valRes = parseValue(filename, tokens, i, 0, true); - if (!valRes.isSuccess()) return valRes.transform(); - - valRes.result.setLoc(loc); - var res = ParseRes.res(valRes.result, valRes.n); - - if (isStatementEnd(tokens, i + res.n)) { - if (isOperator(tokens, i + res.n, Operator.SEMICOLON)) return res.addN(1); - else return res; - } - else if (isIdentifier(tokens, i, "const") || isIdentifier(tokens, i, "let")) { - return ParseRes.error(getLoc(filename, tokens, i), "Detected the usage of 'const'/'let'. Please, use 'var' instead."); - } - else return ParseRes.error(getLoc(filename, tokens, i), "Expected an end of statement.", res); - } - public static ParseRes parseVariableDeclare(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - if (!isIdentifier(tokens, i + n++, "var")) return ParseRes.failed(); - - var res = new ArrayList(); - - if (isStatementEnd(tokens, i + n)) { - if (isOperator(tokens, i + n, Operator.SEMICOLON)) return ParseRes.res(new VariableDeclareStatement(loc, res), 2); - else return ParseRes.res(new VariableDeclareStatement(loc, res), 1); - } - - while (true) { - var nameLoc = getLoc(filename, tokens, i + n); - var nameRes = parseIdentifier(tokens, i + n++); - if (!nameRes.isSuccess()) return ParseRes.error(loc, "Expected a variable name."); - - if (!checkVarName(nameRes.result)) { - return ParseRes.error(loc, String.format("Unexpected identifier '%s'.", nameRes.result)); - } - - Statement val = null; - - if (isOperator(tokens, i + n, Operator.ASSIGN)) { - n++; - var valRes = parseValue(filename, tokens, i + n, 2); - if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after '='.", valRes); - n += valRes.n; - val = valRes.result; - } - - res.add(new Pair(nameRes.result, val, nameLoc)); - - if (isOperator(tokens, i + n, Operator.COMMA)) { - n++; - continue; - } - else if (isStatementEnd(tokens, i + n)) { - if (isOperator(tokens, i + n, Operator.SEMICOLON)) return ParseRes.res(new VariableDeclareStatement(loc, res), n + 1); - else return ParseRes.res(new VariableDeclareStatement(loc, res), n); - } - else return ParseRes.error(loc, "Expected a comma or end of statement."); - } - } - - public static ParseRes parseReturn(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - if (!isIdentifier(tokens, i + n++, "return")) return ParseRes.failed(); - - if (isStatementEnd(tokens, i + n)) { - if (isOperator(tokens, i + n, Operator.SEMICOLON)) return ParseRes.res(new ReturnStatement(loc, null), 2); - else return ParseRes.res(new ReturnStatement(loc, null), 1); - } - - var valRes = parseValue(filename, tokens, i + n, 0); - n += valRes.n; - if (valRes.isError()) return ParseRes.error(loc, "Expected a return value.", valRes); - - var res = ParseRes.res(new ReturnStatement(loc, valRes.result), n); - - if (isStatementEnd(tokens, i + n)) { - if (isOperator(tokens, i + n, Operator.SEMICOLON)) return res.addN(1); - else return res; - } - else - return ParseRes.error(getLoc(filename, tokens, i), "Expected an end of statement.", valRes); - } - public static ParseRes parseThrow(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - if (!isIdentifier(tokens, i + n++, "throw")) return ParseRes.failed(); - - var valRes = parseValue(filename, tokens, i + n, 0); - n += valRes.n; - if (valRes.isError()) return ParseRes.error(loc, "Expected a throw value.", valRes); - - var res = ParseRes.res(new ThrowStatement(loc, valRes.result), n); - - if (isStatementEnd(tokens, i + n)) { - if (isOperator(tokens, i + n, Operator.SEMICOLON)) return res.addN(1); - else return res; - } - else return ParseRes.error(getLoc(filename, tokens, i), "Expected an end of statement.", valRes); - } - - public static ParseRes parseBreak(Filename filename, List tokens, int i) { - if (!isIdentifier(tokens, i, "break")) return ParseRes.failed(); - - if (isStatementEnd(tokens, i + 1)) { - if (isOperator(tokens, i + 1, Operator.SEMICOLON)) return ParseRes.res(new BreakStatement(getLoc(filename, tokens, i), null), 2); - else return ParseRes.res(new BreakStatement(getLoc(filename, tokens, i), null), 1); - } - - var labelRes = parseIdentifier(tokens, i + 1); - if (labelRes.isFailed()) return ParseRes.error(getLoc(filename, tokens, i), "Expected a label name or an end of statement."); - var label = labelRes.result; - - if (isStatementEnd(tokens, i + 2)) { - if (isOperator(tokens, i + 2, Operator.SEMICOLON)) return ParseRes.res(new BreakStatement(getLoc(filename, tokens, i), label), 3); - else return ParseRes.res(new BreakStatement(getLoc(filename, tokens, i), label), 2); - } - else return ParseRes.error(getLoc(filename, tokens, i), "Expected an end of statement."); - } - public static ParseRes parseContinue(Filename filename, List tokens, int i) { - if (!isIdentifier(tokens, i, "continue")) return ParseRes.failed(); - - if (isStatementEnd(tokens, i + 1)) { - if (isOperator(tokens, i + 1, Operator.SEMICOLON)) return ParseRes.res(new ContinueStatement(getLoc(filename, tokens, i), null), 2); - else return ParseRes.res(new ContinueStatement(getLoc(filename, tokens, i), null), 1); - } - - var labelRes = parseIdentifier(tokens, i + 1); - if (labelRes.isFailed()) return ParseRes.error(getLoc(filename, tokens, i), "Expected a label name or an end of statement."); - var label = labelRes.result; - - if (isStatementEnd(tokens, i + 2)) { - if (isOperator(tokens, i + 2, Operator.SEMICOLON)) return ParseRes.res(new ContinueStatement(getLoc(filename, tokens, i), label), 3); - else return ParseRes.res(new ContinueStatement(getLoc(filename, tokens, i), label), 2); - } - else return ParseRes.error(getLoc(filename, tokens, i), "Expected an end of statement."); - } - public static ParseRes parseDebug(Filename filename, List tokens, int i) { - if (!isIdentifier(tokens, i, "debugger")) return ParseRes.failed(); - - if (isStatementEnd(tokens, i + 1)) { - if (isOperator(tokens, i + 1, Operator.SEMICOLON)) return ParseRes.res(new DebugStatement(getLoc(filename, tokens, i)), 2); - else return ParseRes.res(new DebugStatement(getLoc(filename, tokens, i)), 1); - } - else return ParseRes.error(getLoc(filename, tokens, i), "Expected an end of statement."); - } - - public static ParseRes parseCompound(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - if (!isOperator(tokens, i + n++, Operator.BRACE_OPEN)) return ParseRes.failed(); - - var statements = new ArrayList(); - - while (true) { - if (isOperator(tokens, i + n, Operator.BRACE_CLOSE)) { - n++; - break; - } - if (isOperator(tokens, i + n, Operator.SEMICOLON)) { - n++; - continue; - } - - var res = parseStatement(filename, tokens, i + n); - if (!res.isSuccess()) { - return ParseRes.error(getLoc(filename, tokens, i), "Expected a statement.", res); - } - n += res.n; - - statements.add(res.result); - } - - return ParseRes.res(new CompoundStatement(loc, true, statements.toArray(Statement[]::new)).setEnd(getLoc(filename, tokens, i + n - 1)), n); - } - public static ParseRes parseLabel(List tokens, int i) { - int n = 0; - - var nameRes = parseIdentifier(tokens, i + n++); - if (!isOperator(tokens, i + n++, Operator.COLON)) return ParseRes.failed(); - - return ParseRes.res(nameRes.result, n); - } - public static ParseRes parseIf(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - if (!isIdentifier(tokens, i + n++, "if")) return ParseRes.failed(); - if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a open paren after 'if'."); - - var condRes = parseValue(filename, tokens, i + n, 0); - if (!condRes.isSuccess()) return ParseRes.error(loc, "Expected an if condition.", condRes); - n += condRes.n; - - if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.error(loc, "Expected a closing paren after if condition."); - - var res = parseStatement(filename, tokens, i + n); - if (!res.isSuccess()) return ParseRes.error(loc, "Expected an if body.", res); - n += res.n; - - if (!isIdentifier(tokens, i + n, "else")) return ParseRes.res(new IfStatement(loc, condRes.result, res.result, null), n); - n++; - - var elseRes = parseStatement(filename, tokens, i + n); - if (!elseRes.isSuccess()) return ParseRes.error(loc, "Expected an else body.", elseRes); - n += elseRes.n; - - return ParseRes.res(new IfStatement(loc, condRes.result, res.result, elseRes.result), n); - } - public static ParseRes parseWhile(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - var labelRes = parseLabel(tokens, i + n); - n += labelRes.n; - - if (!isIdentifier(tokens, i + n++, "while")) return ParseRes.failed(); - if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a open paren after 'while'."); - - var condRes = parseValue(filename, tokens, i + n, 0); - if (!condRes.isSuccess()) return ParseRes.error(loc, "Expected a while condition.", condRes); - n += condRes.n; - - if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.error(loc, "Expected a closing paren after while condition."); - - var res = parseStatement(filename, tokens, i + n); - if (!res.isSuccess()) return ParseRes.error(loc, "Expected a while body.", res); - n += res.n; - - return ParseRes.res(new WhileStatement(loc, labelRes.result, condRes.result, res.result), n); - } - public static ParseRes parseSwitchCase(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - if (!isIdentifier(tokens, i + n++, "case")) return ParseRes.failed(); - - var valRes = parseValue(filename, tokens, i + n, 0); - if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after 'case'.", valRes); - n += valRes.n; - - if (!isOperator(tokens, i + n++, Operator.COLON)) return ParseRes.error(loc, "Expected colons after 'case' value."); - - return ParseRes.res(valRes.result, n); - } - public static ParseRes parseDefaultCase(List tokens, int i) { - if (!isIdentifier(tokens, i, "default")) return ParseRes.failed(); - if (!isOperator(tokens, i + 1, Operator.COLON)) return ParseRes.error(getLoc(null, tokens, i), "Expected colons after 'default'."); - - return ParseRes.res(null, 2); - } - public static ParseRes parseSwitch(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - if (!isIdentifier(tokens, i + n++, "switch")) return ParseRes.failed(); - if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a open paren after 'switch'."); - - var valRes = parseValue(filename, tokens, i + n, 0); - if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a switch value.", valRes); - n += valRes.n; - - if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.error(loc, "Expected a closing paren after switch value."); - if (!isOperator(tokens, i + n++, Operator.BRACE_OPEN)) return ParseRes.error(loc, "Expected an opening brace after switch value."); - - var statements = new ArrayList(); - var cases = new ArrayList(); - var defaultI = -1; - - while (true) { - if (isOperator(tokens, i + n, Operator.BRACE_CLOSE)) { - n++; - break; - } - if (isOperator(tokens, i + n, Operator.SEMICOLON)) { - n++; - continue; - } - - var defaultRes = parseDefaultCase(tokens, i + n); - var caseRes = parseSwitchCase(filename, tokens, i + n); - - if (defaultRes.isSuccess()) { - defaultI = statements.size(); - n += defaultRes.n; - } - else if (caseRes.isSuccess()) { - cases.add(new SwitchCase(caseRes.result, statements.size())); - n += caseRes.n; - } - else if (defaultRes.isError()) return defaultRes.transform(); - else if (caseRes.isError()) return defaultRes.transform(); - else { - var res = ParseRes.any( - parseStatement(filename, tokens, i + n), - parseCompound(filename, tokens, i + n) - ); - if (!res.isSuccess()) { - return ParseRes.error(getLoc(filename, tokens, i), "Expected a statement.", res); - } - n += res.n; - statements.add(res.result); - } - } - - return ParseRes.res(new SwitchStatement( - loc, valRes.result, defaultI, - cases.toArray(SwitchCase[]::new), - statements.toArray(Statement[]::new) - ), n); - } - public static ParseRes parseDoWhile(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - var labelRes = parseLabel(tokens, i + n); - n += labelRes.n; - - if (!isIdentifier(tokens, i + n++, "do")) return ParseRes.failed(); - var bodyRes = parseStatement(filename, tokens, i + n); - if (!bodyRes.isSuccess()) return ParseRes.error(loc, "Expected a do-while body.", bodyRes); - n += bodyRes.n; - - if (!isIdentifier(tokens, i + n++, "while")) return ParseRes.error(loc, "Expected 'while' keyword."); - if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a open paren after 'while'."); - - var condRes = parseValue(filename, tokens, i + n, 0); - if (!condRes.isSuccess()) return ParseRes.error(loc, "Expected a while condition.", condRes); - n += condRes.n; - - if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.error(loc, "Expected a closing paren after while condition."); - - var res = ParseRes.res(new DoWhileStatement(loc, labelRes.result, condRes.result, bodyRes.result), n); - - if (isStatementEnd(tokens, i + n)) { - if (isOperator(tokens, i + n, Operator.SEMICOLON)) return res.addN(1); - else return res; - } - else return ParseRes.error(getLoc(filename, tokens, i), "Expected a semicolon."); - } - public static ParseRes parseFor(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - var labelRes = parseLabel(tokens, i + n); - n += labelRes.n; - - if (!isIdentifier(tokens, i + n++, "for")) return ParseRes.failed(); - if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a open paren after 'for'."); - - Statement decl, cond, inc; - - if (isOperator(tokens, i + n, Operator.SEMICOLON)) { - n++; - decl = new CompoundStatement(loc, false); - } - else { - var declRes = ParseRes.any( - parseVariableDeclare(filename, tokens, i + n), - parseValueStatement(filename, tokens, i + n) - ); - if (!declRes.isSuccess()) return ParseRes.error(loc, "Expected a declaration or an expression.", declRes); - n += declRes.n; - decl = declRes.result; - } - - if (isOperator(tokens, i + n, Operator.SEMICOLON)) { - n++; - cond = new ConstantStatement(loc, 1); - } - else { - var condRes = parseValue(filename, tokens, i + n, 0); - if (!condRes.isSuccess()) return ParseRes.error(loc, "Expected a condition.", condRes); - n += condRes.n; - if (!isOperator(tokens, i + n++, Operator.SEMICOLON)) return ParseRes.error(loc, "Expected a semicolon.", condRes); - cond = condRes.result; - } - - if (isOperator(tokens, i + n, Operator.PAREN_CLOSE)) { - n++; - inc = new CompoundStatement(loc, false); - } - else { - var incRes = parseValue(filename, tokens, i + n, 0); - if (!incRes.isSuccess()) return ParseRes.error(loc, "Expected a condition.", incRes); - n += incRes.n; - inc = incRes.result; - if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.error(loc, "Expected a closing paren after for."); - } - - - var res = parseStatement(filename, tokens, i + n); - if (!res.isSuccess()) return ParseRes.error(loc, "Expected a for body.", res); - n += res.n; - - return ParseRes.res(new ForStatement(loc, labelRes.result, decl, cond, inc, res.result), n); - } - public static ParseRes parseForIn(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - var labelRes = parseLabel(tokens, i + n); - var isDecl = false; - n += labelRes.n; - - if (!isIdentifier(tokens, i + n++, "for")) return ParseRes.failed(); - if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a open paren after 'for'."); - - if (isIdentifier(tokens, i + n, "var")) { - isDecl = true; - n++; - } - - var nameRes = parseIdentifier(tokens, i + n); - if (!nameRes.isSuccess()) return ParseRes.error(loc, "Expected a variable name for 'for' loop."); - var nameLoc = getLoc(filename, tokens, i + n); - n += nameRes.n; - - Statement varVal = null; - - if (isOperator(tokens, i + n, Operator.ASSIGN)) { - n++; - - var valRes = parseValue(filename, tokens, i + n, 2); - if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after '='.", valRes); - n += nameRes.n; - - varVal = valRes.result; - } - - if (!isIdentifier(tokens, i + n++, "in")) { - if (varVal == null) { - if (nameRes.result.equals("const")) return ParseRes.error(loc, "'const' declarations are not supported."); - else if (nameRes.result.equals("let")) return ParseRes.error(loc, "'let' declarations are not supported."); - } - return ParseRes.error(loc, "Expected 'in' keyword after variable declaration."); - } - - var objRes = parseValue(filename, tokens, i + n, 0); - if (!objRes.isSuccess()) return ParseRes.error(loc, "Expected a value.", objRes); - n += objRes.n; - - if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.error(loc, "Expected a closing paren after for."); - - - var bodyRes = parseStatement(filename, tokens, i + n); - if (!bodyRes.isSuccess()) return ParseRes.error(loc, "Expected a for body.", bodyRes); - n += bodyRes.n; - - return ParseRes.res(new ForInStatement(loc, nameLoc, labelRes.result, isDecl, nameRes.result, varVal, objRes.result, bodyRes.result), n); - } - public static ParseRes parseCatch(Filename filename, List tokens, int i) { - var loc = getLoc(filename, tokens, i); - int n = 0; - - if (!isIdentifier(tokens, i + n++, "try")) return ParseRes.failed(); - - var res = parseStatement(filename, tokens, i + n); - if (!res.isSuccess()) return ParseRes.error(loc, "Expected an if body.", res); - n += res.n; - - String name = null; - Statement catchBody = null, finallyBody = null; - - - if (isIdentifier(tokens, i + n, "catch")) { - n++; - if (isOperator(tokens, i + n, Operator.PAREN_OPEN)) { - n++; - var nameRes = parseIdentifier(tokens, i + n++); - if (!nameRes.isSuccess()) return ParseRes.error(loc, "Expected a catch variable name."); - name = nameRes.result; - if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.error(loc, "Expected a closing paren after catch variable name."); - } - - var catchRes = parseStatement(filename, tokens, i + n); - if (!catchRes.isSuccess()) return ParseRes.error(loc, "Expected a catch body.", catchRes); - n += catchRes.n; - catchBody = catchRes.result; - } - - if (isIdentifier(tokens, i + n, "finally")) { - n++; - var finallyRes = parseStatement(filename, tokens, i + n); - if (!finallyRes.isSuccess()) return ParseRes.error(loc, "Expected a finally body.", finallyRes); - n += finallyRes.n; - finallyBody = finallyRes.result; - } - - return ParseRes.res(new TryStatement(loc, res.result, catchBody, finallyBody, name), n); - } - - public static ParseRes parseStatement(Filename filename, List tokens, int i) { - if (isOperator(tokens, i, Operator.SEMICOLON)) return ParseRes.res(new CompoundStatement(getLoc(filename, tokens, i), false), 1); - if (isIdentifier(tokens, i, "with")) return ParseRes.error(getLoc(filename, tokens, i), "'with' statements are not allowed."); - return ParseRes.any( - parseVariableDeclare(filename, tokens, i), - parseReturn(filename, tokens, i), - parseThrow(filename, tokens, i), - parseContinue(filename, tokens, i), - parseBreak(filename, tokens, i), - parseDebug(filename, tokens, i), - parseIf(filename, tokens, i), - parseWhile(filename, tokens, i), - parseSwitch(filename, tokens, i), - parseFor(filename, tokens, i), - parseForIn(filename, tokens, i), - parseDoWhile(filename, tokens, i), - parseCatch(filename, tokens, i), - parseCompound(filename, tokens, i), - parseFunction(filename, tokens, i, true), - parseValueStatement(filename, tokens, i) - ); - } - - public static Statement[] parse(Filename filename, String raw) { - var tokens = tokenize(filename, raw); - var list = new ArrayList(); - int i = 0; - - while (true) { - if (i >= tokens.size()) break; - - var res = Parsing.parseStatement(filename, tokens, i); - - if (res.isError()) throw new SyntaxException(getLoc(filename, tokens, i), res.error); - else if (res.isFailed()) throw new SyntaxException(getLoc(filename, tokens, i), "Unexpected syntax."); - - i += res.n; - - list.add(res.result); - } - - return list.toArray(Statement[]::new); - } - - public static CompileTarget compile(Environment environment, Statement ...statements) { - var subscope = new LocalScopeRecord(); - var target = new CompileTarget(new HashMap<>(), new TreeSet<>()); - var stm = new CompoundStatement(null, true, statements); - - subscope.define("this"); - subscope.define("arguments"); - - try { - stm.compile(target, subscope, true); - FunctionStatement.checkBreakAndCont(target, 0); - } - catch (SyntaxException e) { - target.target.clear(); - target.add(Instruction.throwSyntax(e.loc, e)); - } - - target.add(Instruction.ret(stm.loc())); - target.functions.put(0l, new FunctionBody(subscope.localsCount(), 0, target.array(), subscope.captures(), subscope.locals())); - - return target; - } - public static CompileTarget compile(Environment environment, Filename filename, String raw) { - try { return compile(environment, parse(filename, raw)); } - catch (SyntaxException e) { return compile(environment, new ThrowSyntaxStatement(e)); } - } -} +package me.topchetoeu.jscript.parsing; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.TreeSet; + +import me.topchetoeu.jscript.Filename; +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.compilation.*; +import me.topchetoeu.jscript.compilation.VariableDeclareStatement.Pair; +import me.topchetoeu.jscript.compilation.control.*; +import me.topchetoeu.jscript.compilation.control.SwitchStatement.SwitchCase; +import me.topchetoeu.jscript.compilation.values.*; +import me.topchetoeu.jscript.engine.Environment; +import me.topchetoeu.jscript.engine.Operation; +import me.topchetoeu.jscript.engine.scope.LocalScopeRecord; +import me.topchetoeu.jscript.engine.values.Values; +import me.topchetoeu.jscript.exceptions.SyntaxException; +import me.topchetoeu.jscript.parsing.ParseRes.State; + +// TODO: this has to be rewritten +public class Parsing { + public static interface Parser { + ParseRes parse(Filename filename, List tokens, int i); + } + + private static class ObjProp { + public final Object name; + public final String access; + public final FunctionStatement func; + + public ObjProp(Object name, String access, FunctionStatement func) { + this.name = name; + this.access = access; + this.func = func; + } + } + + public static final HashMap> functions = new HashMap<>(); + + private static final HashSet reserved = new HashSet(); + static { + reserved.add("true"); + reserved.add("false"); + reserved.add("void"); + reserved.add("null"); + reserved.add("this"); + reserved.add("if"); + reserved.add("else"); + reserved.add("try"); + reserved.add("catch"); + reserved.add("finally"); + reserved.add("for"); + reserved.add("do"); + reserved.add("while"); + reserved.add("switch"); + reserved.add("case"); + reserved.add("default"); + reserved.add("new"); + reserved.add("function"); + reserved.add("var"); + reserved.add("return"); + reserved.add("throw"); + reserved.add("typeof"); + reserved.add("delete"); + reserved.add("break"); + reserved.add("continue"); + reserved.add("debugger"); + reserved.add("implements"); + reserved.add("interface"); + reserved.add("package"); + reserved.add("private"); + reserved.add("protected"); + reserved.add("public"); + reserved.add("static"); + // Although ES5 allow these, we will comply to ES6 here + reserved.add("const"); + reserved.add("let"); + // These are allowed too, however our parser considers them keywords + reserved.add("undefined"); + reserved.add("arguments"); + reserved.add("globalThis"); + reserved.add("window"); + reserved.add("self"); + // We allow yield and await, because they're part of the custom async and generator functions + } + + public static boolean isDigit(char c) { + return c >= '0' && c <= '9'; + } + public static boolean isWhitespace(char c) { + return isAny(c, " \t\r\n"); + } + public static boolean isLetter(char c) { + return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); + } + public static boolean isAlphanumeric(char c) { + return isLetter(c) || isDigit(c); + } + public static boolean isAny(char c, String alphabet) { + return alphabet.contains(Character.toString(c)); + } + + private static final int CURR_NONE = 0; + private static final int CURR_NUMBER = 1; + private static final int CURR_FLOAT = 11; + private static final int CURR_SCIENTIFIC_NOT = 12; + private static final int CURR_NEG_SCIENTIFIC_NOT = 13; + private static final int CURR_HEX = 14; + private static final int CURR_STRING = 2; + private static final int CURR_LITERAL = 3; + private static final int CURR_OPERATOR = 4; + private static final int CURR_REGEX = 6; + private static final int CURR_REGEX_FLAGS = 7; + private static final int CURR_MULTI_COMMENT = 8; + private static final int CURR_SINGLE_COMMENT = 9; + + private static void addToken(StringBuilder currToken, int currStage, int line, int lastStart, Filename filename, List tokens) { + var res = currToken.toString(); + + switch (currStage) { + case CURR_STRING: tokens.add(new RawToken(res, TokenType.STRING, line, lastStart)); break; + case CURR_REGEX_FLAGS: tokens.add(new RawToken(res, TokenType.REGEX, line, lastStart)); break; + case CURR_NUMBER: + case CURR_HEX: + case CURR_NEG_SCIENTIFIC_NOT: + case CURR_SCIENTIFIC_NOT: + case CURR_FLOAT: + tokens.add(new RawToken(res, TokenType.NUMBER, line, lastStart)); break; + case CURR_LITERAL: tokens.add(new RawToken(res, TokenType.LITERAL, line, lastStart)); break; + case CURR_OPERATOR: tokens.add(new RawToken(res, TokenType.OPERATOR, line, lastStart)); break; + } + + currToken.delete(0, currToken.length()); + } + + // This method is so long because we're tokenizing the string using an iterative approach + // instead of a recursive descent parser. This is mainly done for performance reasons. + private static ArrayList splitTokens(Filename filename, String raw) { + var tokens = new ArrayList(); + var currToken = new StringBuilder(64); + + // Those are state variables, and will be reset every time a token has ended parsing + boolean lastEscape = false, inBrackets = false; + + int line = 1, start = 1, lastStart = 1, parenI = 0; + var loc = new Location(line, lastStart, filename); + int currStage = CURR_NONE; + + // when we want to continue parsing a token, we will execute continue;, which will skip + // the token end logic + loop: for (int i = 0; i < raw.length(); i++) { + char c = raw.charAt(i); + + start++; + + switch (currStage) { + case CURR_STRING: + currToken.append(c); + + if (!lastEscape) { + if (c == '\n') throw new SyntaxException(loc, "Can't have a multiline string."); + else if (c == '\\') { + lastEscape = true; + continue; + } + else if (c != currToken.charAt(0)) continue; + } + else { + lastEscape = false; + continue; + } + break; + case CURR_REGEX: + currToken.append(c); + if (!lastEscape) { + if (c == '\\') lastEscape = true; + if (c == '/' & parenI == 0 & !inBrackets) { + currStage = CURR_REGEX_FLAGS; + continue; + } + if (c == '[') inBrackets = true; + if (c == ']') inBrackets = false; + if (c == '(' && !inBrackets) parenI++; + if (c == ')' && !inBrackets) parenI--; + } + else lastEscape = false; + continue; + case CURR_REGEX_FLAGS: + if (isAny(c, "dgimsuy")) { + currToken.append(c); + continue; + } + i--; start--; + break; + case CURR_NUMBER: + if (c == '.') currStage = CURR_FLOAT; + else if (c == 'e' || c == 'E') currStage = CURR_SCIENTIFIC_NOT; + else if ((c == 'x' || c == 'X') && currToken.toString().equals("0")) currStage = CURR_HEX; + else if (!isDigit(c)) { + i--; start--; + break; + } + currToken.append(c); + continue; + case CURR_FLOAT: + if (c == 'e' || c == 'E') currStage = CURR_SCIENTIFIC_NOT; + else if (!isDigit(c)) { + i--; start--; + break; + } + currToken.append(c); + continue; + case CURR_SCIENTIFIC_NOT: + if (c == '-') currStage = CURR_NEG_SCIENTIFIC_NOT; + else if (!isDigit(c)) { + i--; start--; + break; + } + currToken.append(c); + continue; + case CURR_NEG_SCIENTIFIC_NOT: + if (isDigit(c)) currToken.append(c); + else { + i--; start--; + break; + } + continue; + case CURR_HEX: + if (isDigit(c) || isAny(c, "ABCDEFabcdef")) currToken.append(c); + else { + i--; start--; + break; + } + continue; + case CURR_SINGLE_COMMENT: + currToken.delete(0, currToken.length()); + if (c != '\n') continue; + else { + line++; + start = 1; + } + break; + case CURR_MULTI_COMMENT: + if (c == '\n') line++; + if (!(currToken.charAt(0) == '*' && c == '/')) { + currToken.delete(0, currToken.length()); + currToken.append(c); + continue; + } + break; + case CURR_LITERAL: + if (isAlphanumeric(c) || c == '_' || c == '$') { + currToken.append(c); + continue; + } + else { i--; start--; } + break; + case CURR_OPERATOR: { + // here we do several things: + // - detect a comment + // - detect a regular expression + // - detect a float number (.xxxx) + // - read an operator greedily + + // this variable keeps track of whether we're still reading an operator + boolean ok = false; + if (currToken.length() == 1) { + // double operators + if (currToken.charAt(0) == c && isAny(c, "&|=+-<>")) ok = true; + // assignments + else if (c == '=' && isAny(currToken.charAt(0), "&|^+-/*%!<>")) ok = true; + // detect float numbers + else if (isDigit(c) && currToken.charAt(0) == '.') { + currStage = CURR_FLOAT; + currToken.append(c); + continue; + } + else if (currToken.charAt(0) == '/') { + // single line comments + if (c == '/') { + currStage = CURR_SINGLE_COMMENT; + continue; + } + // multiline comments + else if (c == '*') { + currStage = CURR_MULTI_COMMENT; + continue; + } + // regular expressions + else { + // regular expressions must be in the start of a file, or be followed by a + // newline, or an operator + // this is because of expressions like 1 / 2 / 3 (/ 2 /) will get recognized as regex + // still, the closing paren must be ignored, because in an expression, we can't have a value, following a paren + var prevToken = tokens.size() == 0 ? null : tokens.get(tokens.size() - 1); + if (tokens.size() == 0 || ( + prevToken.line < line || + prevToken.type == TokenType.OPERATOR && !prevToken.value.equals(")") || + prevToken.value.equals("return") || + prevToken.value.equals("throe") + )) { + // we look for a second / on the same line + // if we don't find one, we determine the current operator + // to be a division + for (int j = i; j < raw.length(); j++) { + if (raw.charAt(j) == '/') { + i--; start--; + currStage = CURR_REGEX; + continue loop; + } + if (raw.charAt(j) == '\n') break; + } + } + } + } + } + if (currToken.length() == 2) { + var a = currToken.charAt(0); + var b = currToken.charAt(1); + if (( + a == '=' && b == '=' || + a == '!' && b == '=' || + a == '<' && b == '<' || + a == '>' && b == '>' || + a == '>' && b == '>' + ) && c == '=') ok = true; + if (a == '>' && b == '>' && c == '>') ok = true; + } + if ( + currToken.length() == 3 && + currToken.charAt(0) == '>' && + currToken.charAt(1) == '>' && + currToken.charAt(2) == '>' && + c == '=' + ) ok = true; + + if (ok) { + currToken.append(c); + continue; + } + else { i--; start--; } + break; + } + default: + // here we detect what type of token we're reading + if (isAny(c, " \t\n\r")) { + if (c == '\n') { + line++; + start = 1; + } + } + else if (isDigit(c)) { + currToken.append(c); + currStage = CURR_NUMBER; + continue; + } + else if (isAlphanumeric(c) || c == '_' || c == '$') { + currToken.append(c); + currStage = CURR_LITERAL; + continue; + } + else if (isAny(c, "+-/*%=!&|^(){}[];.,<>!:~?")) { + currToken.append(c); + currStage = CURR_OPERATOR; + continue; + } + else if (c == '"' || c == '\'') { + currToken.append(c); + currStage = CURR_STRING; + continue; + } + else throw new SyntaxException(new Location(line, start, filename), String.format("Unrecognized character %s.", c)); + } + + // if we got here, we know that we have encountered the end of a token + addToken(currToken, currStage, line, lastStart, filename, tokens); + lastEscape = inBrackets = false; + currStage = CURR_NONE; + lastStart = start; + } + + // here, we save a leftover token (if any) + switch (currStage) { + case CURR_STRING: throw new SyntaxException(new Location(line, start, filename), "Unterminated string literal."); + case CURR_REGEX: throw new SyntaxException(new Location(line, start, filename), "Incomplete regex."); + } + addToken(currToken, currStage, line, lastStart, filename, tokens); + + return tokens; + } + + public static int fromHex(char c) { + if (c >= 'A' && c <= 'F') return c - 'A' + 10; + if (c >= 'a' && c <= 'f') return c - 'a' + 10; + if (c >= '0' && c <= '9') return c - '0'; + return -1; + } + + private static String parseString(Location loc, String literal) { + var res = new StringBuilder(); + + for (var i = 1; i < literal.length() - 1; i++) { + if (literal.charAt(i) == '\\') { + char c = literal.charAt(++i); + if (c == 'b') res.append('\b'); + else if (c == 't') res.append('\t'); + else if (c == 'n') res.append('\n'); + else if (c == 'f') res.append('\f'); + else if (c == 'r') res.append('\r'); + else if (c == '0') { + if (i + 1 >= literal.length()) res.append((char)0); + c = literal.charAt(i + 1); + if (c >= '0' && c <= '9') throw new SyntaxException(loc.add(i), "Octal escape sequences not allowed."); + res.append((char)0); + } + else if (c >= '1' && c <= '9') { + throw new SyntaxException(loc.add(i), "Octal escape sequences not allowed."); + } + else if (c == 'x') { + var newC = 0; + i++; + for (var j = 0; j < 2; j++) { + if (i >= literal.length()) throw new SyntaxException(loc.add(i), "Incomplete unicode escape sequence."); + int val = fromHex(literal.charAt(i++)); + if (val == -1) throw new SyntaxException(loc.add(i + 1), "Invalid character in unicode escape sequence."); + newC = (newC << 4) | val; + } + i--; + + res.append((char)newC); + } + else if (c == 'u') { + var newC = 0; + i++; + for (var j = 0; j < 4; j++) { + if (i >= literal.length()) throw new SyntaxException(loc.add(i), "Incomplete unicode escape sequence."); + int val = fromHex(literal.charAt(i++)); + if (val == -1) throw new SyntaxException(loc.add(i + 1), "Invalid character in unicode escape sequence."); + newC = (newC << 4) | val; + } + i--; + + res.append((char)newC); + } + else res.append(c); + } + else res.append(literal.charAt(i)); + } + + return res.toString(); + } + private static String parseRegex(Location loc, String literal) { + var res = new StringBuilder(); + + int end = literal.lastIndexOf('/'); + + for (var i = 1; i < end; i++) { + if (literal.charAt(i) == '\\') { + char c = literal.charAt(++i); + if (c == 'b') res.append('\b'); + else if (c == 't') res.append('\t'); + else if (c == 'n') res.append('\n'); + else if (c == 'f') res.append('\f'); + else if (c == 'r') res.append('\r'); + else if (c == '0') { + if (i + 1 >= literal.length()) res.append((char)0); + c = literal.charAt(i + 1); + if (c >= '0' && c <= '9') throw new SyntaxException(loc.add(i), "Octal escape sequences not allowed."); + res.append((char)0); + } + else if (c >= '1' && c <= '9') { + res.append((char)(c - '0')); + i++; + } + else if (c == 'x') { + var newC = 0; + i++; + for (var j = 0; j < 2; j++) { + if (i >= literal.length()) throw new SyntaxException(loc.add(i), "Incomplete unicode escape sequence."); + int val = fromHex(literal.charAt(i++)); + if (val == -1) throw new SyntaxException(loc.add(i + 1), "Invalid character in unicode escape sequence."); + newC = (newC << 4) | val; + } + i--; + + res.append((char)newC); + } + else if (c == 'u') { + var newC = 0; + i++; + for (var j = 0; j < 4; j++) { + if (i >= literal.length()) throw new SyntaxException(loc.add(i), "Incomplete unicode escape sequence."); + int val = fromHex(literal.charAt(i++)); + if (val == -1) throw new SyntaxException(loc.add(i + 1), "Invalid character in unicode escape sequence."); + newC = (newC << 4) | val; + } + i--; + + res.append((char)newC); + } + else res.append("\\" + c); + } + else res.append(literal.charAt(i)); + } + + return '/' + res.toString() + literal.substring(end); + } + + private static double parseHex(String literal) { + double res = 0; + + for (int i = 2; i < literal.length(); i++) { + res *= 16; + int dig = fromHex(literal.charAt(i)); + res += dig; + } + + return res; + } + + public static Double parseNumber(boolean octals, String value) { + if (value.startsWith("0x") || value.startsWith("0X")) { + if (value.length() == 2) return null; + return parseHex(value); + } + if (value.endsWith("e") || value.endsWith("E") || value.endsWith("-")) return null; + + int i = 0; + double res = 0, dotDivisor = 1; + boolean e = false, dot = false; + int exponent = 0; + + for (; i < value.length(); i++) { + char c = value.charAt(i); + if (c == '.') { dot = true; break; } + if (c == 'e') { e = true; break; } + if (!isDigit(c)) break; + + res = res * 10 + c - '0'; + } + + if (dot) for (i++; i < value.length(); i++) { + char c = value.charAt(i); + if (c == 'e') { e = true; break; } + if (!isDigit(c)) break; + + res += (c - '0') / (dotDivisor *= 10); + } + + if (e) for (i++; i < value.length(); i++) { + char c = value.charAt(i); + if (!isDigit(c)) break; + exponent = 10 * exponent + c - '0'; + } + + if (exponent < 0) for (int j = 0; j < -exponent; j++) res /= 10; + else for (int j = 0; j < exponent; j++) res *= 10; + + return res; + } + private static double parseNumber(Location loc, String value) { + var res = parseNumber(false, value); + if (res == null) throw new SyntaxException(loc, "Invalid number format."); + else return res; + } + + private static List parseTokens(Filename filename, Collection tokens) { + var res = new ArrayList(); + + for (var el : tokens) { + var loc = new Location(el.line, el.start, filename); + switch (el.type) { + case LITERAL: res.add(Token.identifier(el.line, el.start, el.value)); break; + case NUMBER: res.add(Token.number(el.line, el.start, parseNumber(loc, el.value))); break; + case STRING: res.add(Token.string(el.line, el.start, parseString(loc, el.value))); break; + case REGEX: res.add(Token.regex(el.line, el.start, parseRegex(loc, el.value))); break; + case OPERATOR: + Operator op = Operator.parse(el.value); + if (op == null) throw new SyntaxException(loc, String.format("Unrecognized operator '%s'.", el.value)); + res.add(Token.operator(el.line, el.start, op)); + break; + } + } + + return res; + } + + public static List tokenize(Filename filename, String raw) { + return parseTokens(filename, splitTokens(filename, raw)); + } + + public static Location getLoc(Filename filename, List tokens, int i) { + if (tokens.size() == 0 || tokens.size() == 0) return new Location(1, 1, filename); + if (i >= tokens.size()) i = tokens.size() - 1; + return new Location(tokens.get(i).line, tokens.get(i).start, filename); + } + public static int getLines(List tokens) { + if (tokens.size() == 0) return 1; + return tokens.get(tokens.size() - 1).line; + } + + public static ParseRes parseIdentifier(List tokens, int i) { + try { + if (tokens.get(i).isIdentifier()) { + return ParseRes.res(tokens.get(i).identifier(), 1); + } + else return ParseRes.failed(); + } + catch (IndexOutOfBoundsException e) { + return ParseRes.failed(); + } + } + public static ParseRes parseOperator(List tokens, int i) { + try { + if (tokens.get(i).isOperator()) { + return ParseRes.res(tokens.get(i).operator(), 1); + } + else return ParseRes.failed(); + } + catch (IndexOutOfBoundsException e) { + return ParseRes.failed(); + } + } + + public static boolean isIdentifier(List tokens, int i, String lit) { + try { + if (tokens.get(i).isIdentifier(lit)) { + return true; + } + else return false; + } + catch (IndexOutOfBoundsException e) { + return false; + } + } + public static boolean isOperator(List tokens, int i, Operator op) { + try { + if (tokens.get(i).isOperator(op)) { + return true; + } + else return false; + } + catch (IndexOutOfBoundsException e) { + return false; + } + } + public static boolean isStatementEnd(List tokens, int i) { + if (isOperator(tokens, i, Operator.SEMICOLON)) return true; + if (isOperator(tokens, i, Operator.BRACE_CLOSE)) return true; + if (i < 0) return false; + if (i >= tokens.size()) return true; + return getLoc(null, tokens, i).line() > getLoc(null, tokens, i - 1).line(); + } + public static boolean checkVarName(String name) { + return !reserved.contains(name); + } + + public static ParseRes parseString(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + try { + if (tokens.get(i).isString()) { + return ParseRes.res(new ConstantStatement(loc, tokens.get(i).string()), 1); + } + else return ParseRes.failed(); + } + catch (IndexOutOfBoundsException e) { + return ParseRes.failed(); + } + } + public static ParseRes parseNumber(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + try { + if (tokens.get(i).isNumber()) { + return ParseRes.res(new ConstantStatement(loc, tokens.get(i).number()), 1); + } + else return ParseRes.failed(); + } + catch (IndexOutOfBoundsException e) { + return ParseRes.failed(); + } + + } + public static ParseRes parseRegex(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + try { + if (tokens.get(i).isRegex()) { + var val = tokens.get(i).regex(); + var index = val.lastIndexOf('/'); + var first = val.substring(1, index); + var second = val.substring(index + 1); + return ParseRes.res(new RegexStatement(loc, first, second), 1); + } + else return ParseRes.failed(); + } + catch (IndexOutOfBoundsException e) { + return ParseRes.failed(); + } + } + + public static ParseRes parseArray(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + if (!isOperator(tokens, i + n++, Operator.BRACKET_OPEN)) return ParseRes.failed(); + + var values = new ArrayList(); + + // Java allows labels, so me uses labels + loop: while (true) { + if (isOperator(tokens, i + n, Operator.BRACKET_CLOSE)) { + n++; + break; + } + + while (isOperator(tokens, i + n, Operator.COMMA)) { + n++; + values.add(null); + if (isOperator(tokens, i + n, Operator.BRACKET_CLOSE)) { + n++; + break loop; + } + } + + var res = parseValue(filename, tokens, i + n, 2); + if (!res.isSuccess()) return ParseRes.error(loc, "Expected an array element.", res); + else n += res.n; + + values.add(res.result); + + if (isOperator(tokens, i + n, Operator.COMMA)) n++; + else if (isOperator(tokens, i + n, Operator.BRACKET_CLOSE)) { + n++; + break; + } + } + + return ParseRes.res(new ArrayStatement(loc, values.toArray(Statement[]::new)), n); + } + + public static ParseRes> parseParamList(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a parameter list."); + + var args = new ArrayList(); + + if (isOperator(tokens, i + n, Operator.PAREN_CLOSE)) { + n++; + } + else { + while (true) { + var argRes = parseIdentifier(tokens, i + n); + if (argRes.isSuccess()) { + args.add(argRes.result); + n++; + if (isOperator(tokens, i + n, Operator.COMMA)) { + n++; + } + if (isOperator(tokens, i + n, Operator.PAREN_CLOSE)) { + n++; + break; + } + } + else return ParseRes.error(loc, "Expected an argument, comma or a closing brace."); + } + } + + return ParseRes.res(args, n); + } + + public static ParseRes parsePropName(Filename filename, List tokens, int i) { + var idRes = parseIdentifier(tokens, i); + if (idRes.isSuccess()) return ParseRes.res(idRes.result, 1); + var strRes = parseString(null, tokens, i); + if (strRes.isSuccess()) return ParseRes.res(strRes.result.value, 1); + var numRes = parseNumber(null, tokens, i); + if (numRes.isSuccess()) return ParseRes.res(numRes.result.value, 1); + + return ParseRes.failed(); + } + public static ParseRes parseObjectProp(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + var accessRes = parseIdentifier(tokens, i + n++); + if (!accessRes.isSuccess()) return ParseRes.failed(); + var access = accessRes.result; + if (!access.equals("get") && !access.equals("set")) return ParseRes.failed(); + + var nameRes = parsePropName(filename, tokens, i + n); + if (!nameRes.isSuccess()) return ParseRes.error(loc, "Expected a property name after '" + access + "'."); + var name = nameRes.result; + n += nameRes.n; + + var argsRes = parseParamList(filename, tokens, i + n); + if (!argsRes.isSuccess()) return ParseRes.error(loc, "Expected an argument list.", argsRes); + n += argsRes.n; + + var res = parseCompound(filename, tokens, i + n); + if (!res.isSuccess()) return ParseRes.error(loc, "Expected a compound statement for property accessor.", res); + n += res.n; + + var end = getLoc(filename, tokens, i + n - 1); + + return ParseRes.res(new ObjProp( + name, access, + new FunctionStatement(loc, end, access + " " + name.toString(), argsRes.result.toArray(String[]::new), false, res.result) + ), n); + } + public static ParseRes parseObject(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + if (!isOperator(tokens, i + n++, Operator.BRACE_OPEN)) return ParseRes.failed(); + + var values = new LinkedHashMap(); + var getters = new LinkedHashMap(); + var setters = new LinkedHashMap(); + + if (isOperator(tokens, i + n, Operator.BRACE_CLOSE)) { + n++; + return ParseRes.res(new ObjectStatement(loc, values, getters, setters), n); + } + + while (true) { + var propRes = parseObjectProp(filename, tokens, i + n); + + if (propRes.isSuccess()) { + n += propRes.n; + if (propRes.result.access.equals("set")) { + setters.put(propRes.result.name, propRes.result.func); + } + else { + getters.put(propRes.result.name, propRes.result.func); + } + } + else { + var nameRes = parsePropName(filename, tokens, i + n); + if (!nameRes.isSuccess()) return ParseRes.error(loc, "Expected a field name.", propRes); + n += nameRes.n; + + if (!isOperator(tokens, i + n++, Operator.COLON)) return ParseRes.error(loc, "Expected a colon."); + + var valRes = parseValue(filename, tokens, i + n, 2); + if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value in array list.", valRes); + n += valRes.n; + + values.put(nameRes.result, valRes.result); + } + + if (isOperator(tokens, i + n, Operator.COMMA)) { + n++; + if (isOperator(tokens, i + n, Operator.BRACE_CLOSE)) { + n++; + break; + } + continue; + } + else if (isOperator(tokens, i + n, Operator.BRACE_CLOSE)) { + n++; + break; + } + else ParseRes.error(loc, "Expected a comma or a closing brace."); + } + + return ParseRes.res(new ObjectStatement(loc, values, getters, setters), n); + } + public static ParseRes parseNew(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + var n = 0; + if (!isIdentifier(tokens, i + n++, "new")) return ParseRes.failed(); + + var valRes = parseValue(filename, tokens, i + n, 18); + n += valRes.n; + if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after 'new' keyword.", valRes); + var callRes = parseCall(filename, tokens, i + n, valRes.result, 0); + n += callRes.n; + if (callRes.isError()) return callRes.transform(); + else if (callRes.isFailed()) return ParseRes.res(new CallStatement(loc, true, valRes.result), n); + var call = (CallStatement)callRes.result; + + return ParseRes.res(new CallStatement(loc, true, call.func, call.args), n); + } + public static ParseRes parseTypeof(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + var n = 0; + if (!isIdentifier(tokens, i + n++, "typeof")) return ParseRes.failed(); + + var valRes = parseValue(filename, tokens, i + n, 15); + if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after 'typeof' keyword.", valRes); + n += valRes.n; + + return ParseRes.res(new TypeofStatement(loc, valRes.result), n); + } + public static ParseRes parseVoid(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + var n = 0; + if (!isIdentifier(tokens, i + n++, "void")) return ParseRes.failed(); + + var valRes = parseValue(filename, tokens, i + n, 14); + if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after 'void' keyword.", valRes); + n += valRes.n; + + return ParseRes.res(new DiscardStatement(loc, valRes.result), n); + } + public static ParseRes parseDelete(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + if (!isIdentifier(tokens, i + n++, "delete")) return ParseRes.failed(); + + var valRes = parseValue(filename, tokens, i + n, 15); + if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after 'delete'.", valRes); + n += valRes.n; + + if (valRes.result instanceof IndexStatement) { + var index = (IndexStatement)valRes.result; + return ParseRes.res(new DeleteStatement(loc, index.index, index.object), n); + } + else if (valRes.result instanceof VariableStatement) { + return ParseRes.error(loc, "A variable may not be deleted."); + } + else { + return ParseRes.res(new ConstantStatement(loc, true), n); + } + } + + public static ParseRes parseFunction(Filename filename, List tokens, int i, boolean statement) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + if (!isIdentifier(tokens, i + n++, "function")) return ParseRes.failed(); + + var nameRes = parseIdentifier(tokens, i + n); + if (!nameRes.isSuccess() && statement) return ParseRes.error(loc, "A statement function requires a name, one is not present."); + var name = nameRes.result; + n += nameRes.n; + + if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a parameter list."); + + var args = new ArrayList(); + + if (isOperator(tokens, i + n, Operator.PAREN_CLOSE)) { + n++; + } + else { + while (true) { + var argRes = parseIdentifier(tokens, i + n); + if (argRes.isSuccess()) { + args.add(argRes.result); + n++; + if (isOperator(tokens, i + n, Operator.COMMA)) { + n++; + } + if (isOperator(tokens, i + n, Operator.PAREN_CLOSE)) { + n++; + break; + } + } + else return ParseRes.error(loc, "Expected an argument, comma or a closing brace."); + } + } + + var res = parseCompound(filename, tokens, i + n); + n += res.n; + var end = getLoc(filename, tokens, i + n - 1); + + if (res.isSuccess()) return ParseRes.res(new FunctionStatement(loc, end, name, args.toArray(String[]::new), statement, res.result), n); + else return ParseRes.error(loc, "Expected a compound statement for function.", res); + } + + public static ParseRes parseUnary(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + var opState = parseOperator(tokens, i + n++); + if (!opState.isSuccess()) return ParseRes.failed(); + var op = opState.result; + + Operation operation = null; + + if (op == Operator.ADD) operation = Operation.POS; + else if (op == Operator.SUBTRACT) operation = Operation.NEG; + else if (op == Operator.INVERSE) operation = Operation.INVERSE; + else if (op == Operator.NOT) operation = Operation.NOT; + else return ParseRes.failed(); + + var res = parseValue(filename, tokens, n + i, 14); + + if (res.isSuccess()) return ParseRes.res(new OperationStatement(loc, operation, res.result), n + res.n); + else return ParseRes.error(loc, String.format("Expected a value after the unary operator '%s'.", op.value), res); + } + public static ParseRes parsePrefixChange(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + var opState = parseOperator(tokens, i + n++); + if (!opState.isSuccess()) return ParseRes.failed(); + + int change = 0; + + if (opState.result == Operator.INCREASE) change = 1; + else if (opState.result == Operator.DECREASE) change = -1; + else return ParseRes.failed(); + + var res = parseValue(filename, tokens, i + n, 15); + if (!(res.result instanceof AssignableStatement)) return ParseRes.error(loc, "Expected assignable value after prefix operator."); + return ParseRes.res(new ChangeStatement(loc, (AssignableStatement)res.result, change, false), n + res.n); + } + public static ParseRes parseParens(Filename filename, List tokens, int i) { + int n = 0; + if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.failed(); + + var res = parseValue(filename, tokens, i + n, 0); + if (!res.isSuccess()) return res; + n += res.n; + + if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.failed(); + + return ParseRes.res(res.result, n); + } + @SuppressWarnings("all") + public static ParseRes parseSimple(Filename filename, List tokens, int i, boolean statement) { + var res = new ArrayList<>(); + + if (!statement) { + res.add(parseObject(filename, tokens, i)); + res.add(parseFunction(filename, tokens, i, false)); + } + + res.addAll(List.of( + parseVariable(filename, tokens, i), + parseLiteral(filename, tokens, i), + parseString(filename, tokens, i), + parseRegex(filename, tokens, i), + parseNumber(filename, tokens, i), + parseUnary(filename, tokens, i), + parseArray(filename, tokens, i), + parsePrefixChange(filename, tokens, i), + parseParens(filename, tokens, i), + parseNew(filename, tokens, i), + parseTypeof(filename, tokens, i), + parseVoid(filename, tokens, i), + parseDelete(filename, tokens, i) + )); + + return ParseRes.any(res.toArray(ParseRes[]::new)); + } + + public static ParseRes parseVariable(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + var literal = parseIdentifier(tokens, i); + + if (!literal.isSuccess()) return ParseRes.failed(); + + if (!checkVarName(literal.result)) { + if (literal.result.equals("await")) return ParseRes.error(loc, "'await' expressions are not supported."); + if (literal.result.equals("const")) return ParseRes.error(loc, "'const' declarations are not supported."); + if (literal.result.equals("let")) return ParseRes.error(loc, "'let' declarations are not supported."); + return ParseRes.error(loc, String.format("Unexpected identifier '%s'.", literal.result)); + } + + return ParseRes.res(new VariableStatement(loc, literal.result), 1); + } + public static ParseRes parseLiteral(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + var id = parseIdentifier(tokens, i); + if (!id.isSuccess()) return id.transform(); + + if (id.result.equals("true")) { + return ParseRes.res(new ConstantStatement(loc, true), 1); + } + if (id.result.equals("false")) { + return ParseRes.res(new ConstantStatement(loc, false), 1); + } + if (id.result.equals("undefined")) { + return ParseRes.res(new ConstantStatement(loc, null), 1); + } + if (id.result.equals("null")) { + return ParseRes.res(new ConstantStatement(loc, Values.NULL), 1); + } + if (id.result.equals("this")) { + return ParseRes.res(new VariableIndexStatement(loc, 0), 1); + } + if (id.result.equals("arguments")) { + return ParseRes.res(new VariableIndexStatement(loc, 1), 1); + } + if (id.result.equals("globalThis") || id.result.equals("window") || id.result.equals("self")) { + return ParseRes.res(new GlobalThisStatement(loc), 1); + } + return ParseRes.failed(); + } + public static ParseRes parseMember(Filename filename, List tokens, int i, Statement prev, int precedence) { + var loc = getLoc(filename, tokens, i); + var n = 0; + + if (precedence > 18) return ParseRes.failed(); + + if (!isOperator(tokens, i + n++, Operator.DOT)) return ParseRes.failed(); + + var literal = parseIdentifier(tokens, i + n++); + if (!literal.isSuccess()) return ParseRes.error(loc, "Expected an identifier after member access."); + + return ParseRes.res(new IndexStatement(loc, prev, new ConstantStatement(loc, literal.result)), n); + } + public static ParseRes parseIndex(Filename filename, List tokens, int i, Statement prev, int precedence) { + var loc = getLoc(filename, tokens, i); + var n = 0; + + if (precedence > 18) return ParseRes.failed(); + + if (!isOperator(tokens, i + n++, Operator.BRACKET_OPEN)) return ParseRes.failed(); + + var valRes = parseValue(filename, tokens, i + n, 0); + if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value in index expression.", valRes); + n += valRes.n; + + if (!isOperator(tokens, i + n++, Operator.BRACKET_CLOSE)) return ParseRes.error(loc, "Expected a closing bracket."); + + return ParseRes.res(new IndexStatement(loc, prev, valRes.result), n); + } + public static ParseRes parseAssign(Filename filename, List tokens, int i, Statement prev, int precedence) { + var loc = getLoc(filename, tokens, i); + int n = 0 ; + + if (precedence > 2) return ParseRes.failed(); + + var opRes = parseOperator(tokens, i + n++); + if (opRes.state != State.SUCCESS) return ParseRes.failed(); + + var op = opRes.result; + if (!op.isAssign()) return ParseRes.failed(); + + if (!(prev instanceof AssignableStatement)) { + return ParseRes.error(loc, "Invalid expression on left hand side of assign operator."); + } + + var res = parseValue(filename, tokens, i + n, 2); + if (!res.isSuccess()) return ParseRes.error(loc, String.format("Expected value after assignment operator '%s'.", op.value), res); + n += res.n; + + Operation operation = null; + + if (op == Operator.ASSIGN_ADD) operation = Operation.ADD; + if (op == Operator.ASSIGN_SUBTRACT) operation = Operation.SUBTRACT; + if (op == Operator.ASSIGN_MULTIPLY) operation = Operation.MULTIPLY; + if (op == Operator.ASSIGN_DIVIDE) operation = Operation.DIVIDE; + if (op == Operator.ASSIGN_MODULO) operation = Operation.MODULO; + if (op == Operator.ASSIGN_OR) operation = Operation.OR; + if (op == Operator.ASSIGN_XOR) operation = Operation.XOR; + if (op == Operator.ASSIGN_AND) operation = Operation.AND; + if (op == Operator.ASSIGN_SHIFT_LEFT) operation = Operation.SHIFT_LEFT; + if (op == Operator.ASSIGN_SHIFT_RIGHT) operation = Operation.SHIFT_RIGHT; + if (op == Operator.ASSIGN_USHIFT_RIGHT) operation = Operation.USHIFT_RIGHT; + + return ParseRes.res(((AssignableStatement)prev).toAssign(res.result, operation), n); + } + public static ParseRes parseCall(Filename filename, List tokens, int i, Statement prev, int precedence) { + var loc = getLoc(filename, tokens, i); + var n = 0; + + if (precedence > 17) return ParseRes.failed(); + if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.failed(); + + var args = new ArrayList(); + boolean prevArg = false; + + while (true) { + var argRes = parseValue(filename, tokens, i + n, 2); + if (argRes.isSuccess()) { + args.add(argRes.result); + n += argRes.n; + prevArg = true; + } + else if (argRes.isError()) return argRes.transform(); + else if (isOperator(tokens, i + n, Operator.COMMA)) { + if (!prevArg) args.add(null); + prevArg = false; + n++; + } + else if (isOperator(tokens, i + n, Operator.PAREN_CLOSE)) { + n++; + break; + } + else return ParseRes.failed(); + } + + return ParseRes.res(new CallStatement(loc, false, prev, args.toArray(Statement[]::new)), n); + } + public static ParseRes parsePostfixChange(Filename filename, List tokens, int i, Statement prev, int precedence) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + if (precedence > 15) return ParseRes.failed(); + + var opState = parseOperator(tokens, i + n++); + if (!opState.isSuccess()) return ParseRes.failed(); + + int change = 0; + + if (opState.result == Operator.INCREASE) change = 1; + else if (opState.result == Operator.DECREASE) change = -1; + else return ParseRes.failed(); + + if (!(prev instanceof AssignableStatement)) return ParseRes.error(loc, "Expected assignable value before suffix operator."); + return ParseRes.res(new ChangeStatement(loc, (AssignableStatement)prev, change, true), n); + } + public static ParseRes parseInstanceof(Filename filename, List tokens, int i, Statement prev, int precedence) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + if (precedence > 9) return ParseRes.failed(); + if (!isIdentifier(tokens, i + n++, "instanceof")) return ParseRes.failed(); + + var valRes = parseValue(filename, tokens, i + n, 10); + if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after 'instanceof'.", valRes); + n += valRes.n; + + return ParseRes.res(new OperationStatement(loc, Operation.INSTANCEOF, prev, valRes.result), n); + } + public static ParseRes parseIn(Filename filename, List tokens, int i, Statement prev, int precedence) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + if (precedence > 9) return ParseRes.failed(); + if (!isIdentifier(tokens, i + n++, "in")) return ParseRes.failed(); + + var valRes = parseValue(filename, tokens, i + n, 10); + if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after 'in'.", valRes); + n += valRes.n; + + return ParseRes.res(new OperationStatement(loc, Operation.IN, prev, valRes.result), n); + } + public static ParseRes parseComma(Filename filename, List tokens, int i, Statement prev, int precedence) { + var loc = getLoc(filename, tokens, i); + var n = 0; + + if (precedence > 1) return ParseRes.failed(); + if (!isOperator(tokens, i + n++, Operator.COMMA)) return ParseRes.failed(); + + var res = parseValue(filename, tokens, i + n, 2); + if (!res.isSuccess()) return ParseRes.error(loc, "Expected a value after the comma.", res); + n += res.n; + + return ParseRes.res(new CompoundStatement(loc, false, prev, res.result), n); + } + public static ParseRes parseTernary(Filename filename, List tokens, int i, Statement prev, int precedence) { + var loc = getLoc(filename, tokens, i); + var n = 0; + + if (precedence > 2) return ParseRes.failed(); + if (!isOperator(tokens, i + n++, Operator.QUESTION)) return ParseRes.failed(); + + var a = parseValue(filename, tokens, i + n, 2); + if (!a.isSuccess()) return ParseRes.error(loc, "Expected a value after the ternary operator.", a); + n += a.n; + + if (!isOperator(tokens, i + n++, Operator.COLON)) return ParseRes.failed(); + + var b = parseValue(filename, tokens, i + n, 2); + if (!b.isSuccess()) return ParseRes.error(loc, "Expected a second value after the ternary operator.", b); + n += b.n; + + return ParseRes.res(new IfStatement(loc, prev, a.result, b.result), n); + } + public static ParseRes parseOperator(Filename filename, List tokens, int i, Statement prev, int precedence) { + var loc = getLoc(filename, tokens, i); + var n = 0; + + var opRes = parseOperator(tokens, i + n++); + if (!opRes.isSuccess()) return ParseRes.failed(); + var op = opRes.result; + + if (op.precedence < precedence) return ParseRes.failed(); + if (op.isAssign()) return parseAssign(filename, tokens, i + n - 1, prev, precedence); + + var res = parseValue(filename, tokens, i + n, op.precedence + (op.reverse ? 0 : 1)); + if (!res.isSuccess()) return ParseRes.error(loc, String.format("Expected a value after the '%s' operator.", op.value), res); + n += res.n; + + if (op == Operator.LAZY_AND) { + return ParseRes.res(new LazyAndStatement(loc, prev, res.result), n); + } + if (op == Operator.LAZY_OR) { + return ParseRes.res(new LazyOrStatement(loc, prev, res.result), n); + } + + return ParseRes.res(new OperationStatement(loc, op.operation, prev, res.result), n); + } + + public static ParseRes parseValue(Filename filename, List tokens, int i, int precedence, boolean statement) { + Statement prev = null; + int n = 0; + + while (true) { + if (prev == null) { + var res = parseSimple(filename, tokens, i + n, statement); + if (res.isSuccess()) { + n += res.n; + prev = res.result; + } + else if (res.isError()) return res.transform(); + else break; + } + else { + var res = ParseRes.any( + parseOperator(filename, tokens, i + n, prev, precedence), + parseMember(filename, tokens, i + n, prev, precedence), + parseIndex(filename, tokens, i + n, prev, precedence), + parseCall(filename, tokens, i + n, prev, precedence), + parsePostfixChange(filename, tokens, i + n, prev, precedence), + parseInstanceof(filename, tokens, i + n, prev, precedence), + parseIn(filename, tokens, i + n, prev, precedence), + parseComma(filename, tokens, i + n, prev, precedence), + parseTernary(filename, tokens, i + n, prev, precedence) + ); + + if (res.isSuccess()) { + n += res.n; + prev = res.result; + continue; + } + else if (res.isError()) return res.transform(); + + break; + } + } + + if (prev == null) return ParseRes.failed(); + else return ParseRes.res(prev, n); + } + public static ParseRes parseValue(Filename filename, List tokens, int i, int precedence) { + return parseValue(filename, tokens, i, precedence, false); + } + + public static ParseRes parseValueStatement(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + var valRes = parseValue(filename, tokens, i, 0, true); + if (!valRes.isSuccess()) return valRes.transform(); + + valRes.result.setLoc(loc); + var res = ParseRes.res(valRes.result, valRes.n); + + if (isStatementEnd(tokens, i + res.n)) { + if (isOperator(tokens, i + res.n, Operator.SEMICOLON)) return res.addN(1); + else return res; + } + else if (isIdentifier(tokens, i, "const") || isIdentifier(tokens, i, "let")) { + return ParseRes.error(getLoc(filename, tokens, i), "Detected the usage of 'const'/'let'. Please, use 'var' instead."); + } + else return ParseRes.error(getLoc(filename, tokens, i), "Expected an end of statement.", res); + } + public static ParseRes parseVariableDeclare(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + if (!isIdentifier(tokens, i + n++, "var")) return ParseRes.failed(); + + var res = new ArrayList(); + + if (isStatementEnd(tokens, i + n)) { + if (isOperator(tokens, i + n, Operator.SEMICOLON)) return ParseRes.res(new VariableDeclareStatement(loc, res), 2); + else return ParseRes.res(new VariableDeclareStatement(loc, res), 1); + } + + while (true) { + var nameLoc = getLoc(filename, tokens, i + n); + var nameRes = parseIdentifier(tokens, i + n++); + if (!nameRes.isSuccess()) return ParseRes.error(loc, "Expected a variable name."); + + if (!checkVarName(nameRes.result)) { + return ParseRes.error(loc, String.format("Unexpected identifier '%s'.", nameRes.result)); + } + + Statement val = null; + + if (isOperator(tokens, i + n, Operator.ASSIGN)) { + n++; + var valRes = parseValue(filename, tokens, i + n, 2); + if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after '='.", valRes); + n += valRes.n; + val = valRes.result; + } + + res.add(new Pair(nameRes.result, val, nameLoc)); + + if (isOperator(tokens, i + n, Operator.COMMA)) { + n++; + continue; + } + else if (isStatementEnd(tokens, i + n)) { + if (isOperator(tokens, i + n, Operator.SEMICOLON)) return ParseRes.res(new VariableDeclareStatement(loc, res), n + 1); + else return ParseRes.res(new VariableDeclareStatement(loc, res), n); + } + else return ParseRes.error(loc, "Expected a comma or end of statement."); + } + } + + public static ParseRes parseReturn(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + if (!isIdentifier(tokens, i + n++, "return")) return ParseRes.failed(); + + if (isStatementEnd(tokens, i + n)) { + if (isOperator(tokens, i + n, Operator.SEMICOLON)) return ParseRes.res(new ReturnStatement(loc, null), 2); + else return ParseRes.res(new ReturnStatement(loc, null), 1); + } + + var valRes = parseValue(filename, tokens, i + n, 0); + n += valRes.n; + if (valRes.isError()) return ParseRes.error(loc, "Expected a return value.", valRes); + + var res = ParseRes.res(new ReturnStatement(loc, valRes.result), n); + + if (isStatementEnd(tokens, i + n)) { + if (isOperator(tokens, i + n, Operator.SEMICOLON)) return res.addN(1); + else return res; + } + else + return ParseRes.error(getLoc(filename, tokens, i), "Expected an end of statement.", valRes); + } + public static ParseRes parseThrow(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + if (!isIdentifier(tokens, i + n++, "throw")) return ParseRes.failed(); + + var valRes = parseValue(filename, tokens, i + n, 0); + n += valRes.n; + if (valRes.isError()) return ParseRes.error(loc, "Expected a throw value.", valRes); + + var res = ParseRes.res(new ThrowStatement(loc, valRes.result), n); + + if (isStatementEnd(tokens, i + n)) { + if (isOperator(tokens, i + n, Operator.SEMICOLON)) return res.addN(1); + else return res; + } + else return ParseRes.error(getLoc(filename, tokens, i), "Expected an end of statement.", valRes); + } + + public static ParseRes parseBreak(Filename filename, List tokens, int i) { + if (!isIdentifier(tokens, i, "break")) return ParseRes.failed(); + + if (isStatementEnd(tokens, i + 1)) { + if (isOperator(tokens, i + 1, Operator.SEMICOLON)) return ParseRes.res(new BreakStatement(getLoc(filename, tokens, i), null), 2); + else return ParseRes.res(new BreakStatement(getLoc(filename, tokens, i), null), 1); + } + + var labelRes = parseIdentifier(tokens, i + 1); + if (labelRes.isFailed()) return ParseRes.error(getLoc(filename, tokens, i), "Expected a label name or an end of statement."); + var label = labelRes.result; + + if (isStatementEnd(tokens, i + 2)) { + if (isOperator(tokens, i + 2, Operator.SEMICOLON)) return ParseRes.res(new BreakStatement(getLoc(filename, tokens, i), label), 3); + else return ParseRes.res(new BreakStatement(getLoc(filename, tokens, i), label), 2); + } + else return ParseRes.error(getLoc(filename, tokens, i), "Expected an end of statement."); + } + public static ParseRes parseContinue(Filename filename, List tokens, int i) { + if (!isIdentifier(tokens, i, "continue")) return ParseRes.failed(); + + if (isStatementEnd(tokens, i + 1)) { + if (isOperator(tokens, i + 1, Operator.SEMICOLON)) return ParseRes.res(new ContinueStatement(getLoc(filename, tokens, i), null), 2); + else return ParseRes.res(new ContinueStatement(getLoc(filename, tokens, i), null), 1); + } + + var labelRes = parseIdentifier(tokens, i + 1); + if (labelRes.isFailed()) return ParseRes.error(getLoc(filename, tokens, i), "Expected a label name or an end of statement."); + var label = labelRes.result; + + if (isStatementEnd(tokens, i + 2)) { + if (isOperator(tokens, i + 2, Operator.SEMICOLON)) return ParseRes.res(new ContinueStatement(getLoc(filename, tokens, i), label), 3); + else return ParseRes.res(new ContinueStatement(getLoc(filename, tokens, i), label), 2); + } + else return ParseRes.error(getLoc(filename, tokens, i), "Expected an end of statement."); + } + public static ParseRes parseDebug(Filename filename, List tokens, int i) { + if (!isIdentifier(tokens, i, "debugger")) return ParseRes.failed(); + + if (isStatementEnd(tokens, i + 1)) { + if (isOperator(tokens, i + 1, Operator.SEMICOLON)) return ParseRes.res(new DebugStatement(getLoc(filename, tokens, i)), 2); + else return ParseRes.res(new DebugStatement(getLoc(filename, tokens, i)), 1); + } + else return ParseRes.error(getLoc(filename, tokens, i), "Expected an end of statement."); + } + + public static ParseRes parseCompound(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + if (!isOperator(tokens, i + n++, Operator.BRACE_OPEN)) return ParseRes.failed(); + + var statements = new ArrayList(); + + while (true) { + if (isOperator(tokens, i + n, Operator.BRACE_CLOSE)) { + n++; + break; + } + if (isOperator(tokens, i + n, Operator.SEMICOLON)) { + n++; + continue; + } + + var res = parseStatement(filename, tokens, i + n); + if (!res.isSuccess()) { + return ParseRes.error(getLoc(filename, tokens, i), "Expected a statement.", res); + } + n += res.n; + + statements.add(res.result); + } + + return ParseRes.res(new CompoundStatement(loc, true, statements.toArray(Statement[]::new)).setEnd(getLoc(filename, tokens, i + n - 1)), n); + } + public static ParseRes parseLabel(List tokens, int i) { + int n = 0; + + var nameRes = parseIdentifier(tokens, i + n++); + if (!isOperator(tokens, i + n++, Operator.COLON)) return ParseRes.failed(); + + return ParseRes.res(nameRes.result, n); + } + public static ParseRes parseIf(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + if (!isIdentifier(tokens, i + n++, "if")) return ParseRes.failed(); + if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a open paren after 'if'."); + + var condRes = parseValue(filename, tokens, i + n, 0); + if (!condRes.isSuccess()) return ParseRes.error(loc, "Expected an if condition.", condRes); + n += condRes.n; + + if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.error(loc, "Expected a closing paren after if condition."); + + var res = parseStatement(filename, tokens, i + n); + if (!res.isSuccess()) return ParseRes.error(loc, "Expected an if body.", res); + n += res.n; + + if (!isIdentifier(tokens, i + n, "else")) return ParseRes.res(new IfStatement(loc, condRes.result, res.result, null), n); + n++; + + var elseRes = parseStatement(filename, tokens, i + n); + if (!elseRes.isSuccess()) return ParseRes.error(loc, "Expected an else body.", elseRes); + n += elseRes.n; + + return ParseRes.res(new IfStatement(loc, condRes.result, res.result, elseRes.result), n); + } + public static ParseRes parseWhile(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + var labelRes = parseLabel(tokens, i + n); + n += labelRes.n; + + if (!isIdentifier(tokens, i + n++, "while")) return ParseRes.failed(); + if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a open paren after 'while'."); + + var condRes = parseValue(filename, tokens, i + n, 0); + if (!condRes.isSuccess()) return ParseRes.error(loc, "Expected a while condition.", condRes); + n += condRes.n; + + if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.error(loc, "Expected a closing paren after while condition."); + + var res = parseStatement(filename, tokens, i + n); + if (!res.isSuccess()) return ParseRes.error(loc, "Expected a while body.", res); + n += res.n; + + return ParseRes.res(new WhileStatement(loc, labelRes.result, condRes.result, res.result), n); + } + public static ParseRes parseSwitchCase(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + if (!isIdentifier(tokens, i + n++, "case")) return ParseRes.failed(); + + var valRes = parseValue(filename, tokens, i + n, 0); + if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after 'case'.", valRes); + n += valRes.n; + + if (!isOperator(tokens, i + n++, Operator.COLON)) return ParseRes.error(loc, "Expected colons after 'case' value."); + + return ParseRes.res(valRes.result, n); + } + public static ParseRes parseDefaultCase(List tokens, int i) { + if (!isIdentifier(tokens, i, "default")) return ParseRes.failed(); + if (!isOperator(tokens, i + 1, Operator.COLON)) return ParseRes.error(getLoc(null, tokens, i), "Expected colons after 'default'."); + + return ParseRes.res(null, 2); + } + public static ParseRes parseSwitch(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + if (!isIdentifier(tokens, i + n++, "switch")) return ParseRes.failed(); + if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a open paren after 'switch'."); + + var valRes = parseValue(filename, tokens, i + n, 0); + if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a switch value.", valRes); + n += valRes.n; + + if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.error(loc, "Expected a closing paren after switch value."); + if (!isOperator(tokens, i + n++, Operator.BRACE_OPEN)) return ParseRes.error(loc, "Expected an opening brace after switch value."); + + var statements = new ArrayList(); + var cases = new ArrayList(); + var defaultI = -1; + + while (true) { + if (isOperator(tokens, i + n, Operator.BRACE_CLOSE)) { + n++; + break; + } + if (isOperator(tokens, i + n, Operator.SEMICOLON)) { + n++; + continue; + } + + var defaultRes = parseDefaultCase(tokens, i + n); + var caseRes = parseSwitchCase(filename, tokens, i + n); + + if (defaultRes.isSuccess()) { + defaultI = statements.size(); + n += defaultRes.n; + } + else if (caseRes.isSuccess()) { + cases.add(new SwitchCase(caseRes.result, statements.size())); + n += caseRes.n; + } + else if (defaultRes.isError()) return defaultRes.transform(); + else if (caseRes.isError()) return defaultRes.transform(); + else { + var res = ParseRes.any( + parseStatement(filename, tokens, i + n), + parseCompound(filename, tokens, i + n) + ); + if (!res.isSuccess()) { + return ParseRes.error(getLoc(filename, tokens, i), "Expected a statement.", res); + } + n += res.n; + statements.add(res.result); + } + } + + return ParseRes.res(new SwitchStatement( + loc, valRes.result, defaultI, + cases.toArray(SwitchCase[]::new), + statements.toArray(Statement[]::new) + ), n); + } + public static ParseRes parseDoWhile(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + var labelRes = parseLabel(tokens, i + n); + n += labelRes.n; + + if (!isIdentifier(tokens, i + n++, "do")) return ParseRes.failed(); + var bodyRes = parseStatement(filename, tokens, i + n); + if (!bodyRes.isSuccess()) return ParseRes.error(loc, "Expected a do-while body.", bodyRes); + n += bodyRes.n; + + if (!isIdentifier(tokens, i + n++, "while")) return ParseRes.error(loc, "Expected 'while' keyword."); + if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a open paren after 'while'."); + + var condRes = parseValue(filename, tokens, i + n, 0); + if (!condRes.isSuccess()) return ParseRes.error(loc, "Expected a while condition.", condRes); + n += condRes.n; + + if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.error(loc, "Expected a closing paren after while condition."); + + var res = ParseRes.res(new DoWhileStatement(loc, labelRes.result, condRes.result, bodyRes.result), n); + + if (isStatementEnd(tokens, i + n)) { + if (isOperator(tokens, i + n, Operator.SEMICOLON)) return res.addN(1); + else return res; + } + else return ParseRes.error(getLoc(filename, tokens, i), "Expected a semicolon."); + } + public static ParseRes parseFor(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + var labelRes = parseLabel(tokens, i + n); + n += labelRes.n; + + if (!isIdentifier(tokens, i + n++, "for")) return ParseRes.failed(); + if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a open paren after 'for'."); + + Statement decl, cond, inc; + + if (isOperator(tokens, i + n, Operator.SEMICOLON)) { + n++; + decl = new CompoundStatement(loc, false); + } + else { + var declRes = ParseRes.any( + parseVariableDeclare(filename, tokens, i + n), + parseValueStatement(filename, tokens, i + n) + ); + if (!declRes.isSuccess()) return ParseRes.error(loc, "Expected a declaration or an expression.", declRes); + n += declRes.n; + decl = declRes.result; + } + + if (isOperator(tokens, i + n, Operator.SEMICOLON)) { + n++; + cond = new ConstantStatement(loc, 1); + } + else { + var condRes = parseValue(filename, tokens, i + n, 0); + if (!condRes.isSuccess()) return ParseRes.error(loc, "Expected a condition.", condRes); + n += condRes.n; + if (!isOperator(tokens, i + n++, Operator.SEMICOLON)) return ParseRes.error(loc, "Expected a semicolon.", condRes); + cond = condRes.result; + } + + if (isOperator(tokens, i + n, Operator.PAREN_CLOSE)) { + n++; + inc = new CompoundStatement(loc, false); + } + else { + var incRes = parseValue(filename, tokens, i + n, 0); + if (!incRes.isSuccess()) return ParseRes.error(loc, "Expected a condition.", incRes); + n += incRes.n; + inc = incRes.result; + if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.error(loc, "Expected a closing paren after for."); + } + + + var res = parseStatement(filename, tokens, i + n); + if (!res.isSuccess()) return ParseRes.error(loc, "Expected a for body.", res); + n += res.n; + + return ParseRes.res(new ForStatement(loc, labelRes.result, decl, cond, inc, res.result), n); + } + public static ParseRes parseForIn(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + var labelRes = parseLabel(tokens, i + n); + var isDecl = false; + n += labelRes.n; + + if (!isIdentifier(tokens, i + n++, "for")) return ParseRes.failed(); + if (!isOperator(tokens, i + n++, Operator.PAREN_OPEN)) return ParseRes.error(loc, "Expected a open paren after 'for'."); + + if (isIdentifier(tokens, i + n, "var")) { + isDecl = true; + n++; + } + + var nameRes = parseIdentifier(tokens, i + n); + if (!nameRes.isSuccess()) return ParseRes.error(loc, "Expected a variable name for 'for' loop."); + var nameLoc = getLoc(filename, tokens, i + n); + n += nameRes.n; + + Statement varVal = null; + + if (isOperator(tokens, i + n, Operator.ASSIGN)) { + n++; + + var valRes = parseValue(filename, tokens, i + n, 2); + if (!valRes.isSuccess()) return ParseRes.error(loc, "Expected a value after '='.", valRes); + n += nameRes.n; + + varVal = valRes.result; + } + + if (!isIdentifier(tokens, i + n++, "in")) { + if (varVal == null) { + if (nameRes.result.equals("const")) return ParseRes.error(loc, "'const' declarations are not supported."); + else if (nameRes.result.equals("let")) return ParseRes.error(loc, "'let' declarations are not supported."); + } + return ParseRes.error(loc, "Expected 'in' keyword after variable declaration."); + } + + var objRes = parseValue(filename, tokens, i + n, 0); + if (!objRes.isSuccess()) return ParseRes.error(loc, "Expected a value.", objRes); + n += objRes.n; + + if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.error(loc, "Expected a closing paren after for."); + + + var bodyRes = parseStatement(filename, tokens, i + n); + if (!bodyRes.isSuccess()) return ParseRes.error(loc, "Expected a for body.", bodyRes); + n += bodyRes.n; + + return ParseRes.res(new ForInStatement(loc, nameLoc, labelRes.result, isDecl, nameRes.result, varVal, objRes.result, bodyRes.result), n); + } + public static ParseRes parseCatch(Filename filename, List tokens, int i) { + var loc = getLoc(filename, tokens, i); + int n = 0; + + if (!isIdentifier(tokens, i + n++, "try")) return ParseRes.failed(); + + var res = parseStatement(filename, tokens, i + n); + if (!res.isSuccess()) return ParseRes.error(loc, "Expected an if body.", res); + n += res.n; + + String name = null; + Statement catchBody = null, finallyBody = null; + + + if (isIdentifier(tokens, i + n, "catch")) { + n++; + if (isOperator(tokens, i + n, Operator.PAREN_OPEN)) { + n++; + var nameRes = parseIdentifier(tokens, i + n++); + if (!nameRes.isSuccess()) return ParseRes.error(loc, "Expected a catch variable name."); + name = nameRes.result; + if (!isOperator(tokens, i + n++, Operator.PAREN_CLOSE)) return ParseRes.error(loc, "Expected a closing paren after catch variable name."); + } + + var catchRes = parseStatement(filename, tokens, i + n); + if (!catchRes.isSuccess()) return ParseRes.error(loc, "Expected a catch body.", catchRes); + n += catchRes.n; + catchBody = catchRes.result; + } + + if (isIdentifier(tokens, i + n, "finally")) { + n++; + var finallyRes = parseStatement(filename, tokens, i + n); + if (!finallyRes.isSuccess()) return ParseRes.error(loc, "Expected a finally body.", finallyRes); + n += finallyRes.n; + finallyBody = finallyRes.result; + } + + return ParseRes.res(new TryStatement(loc, res.result, catchBody, finallyBody, name), n); + } + + public static ParseRes parseStatement(Filename filename, List tokens, int i) { + if (isOperator(tokens, i, Operator.SEMICOLON)) return ParseRes.res(new CompoundStatement(getLoc(filename, tokens, i), false), 1); + if (isIdentifier(tokens, i, "with")) return ParseRes.error(getLoc(filename, tokens, i), "'with' statements are not allowed."); + return ParseRes.any( + parseVariableDeclare(filename, tokens, i), + parseReturn(filename, tokens, i), + parseThrow(filename, tokens, i), + parseContinue(filename, tokens, i), + parseBreak(filename, tokens, i), + parseDebug(filename, tokens, i), + parseIf(filename, tokens, i), + parseWhile(filename, tokens, i), + parseSwitch(filename, tokens, i), + parseFor(filename, tokens, i), + parseForIn(filename, tokens, i), + parseDoWhile(filename, tokens, i), + parseCatch(filename, tokens, i), + parseCompound(filename, tokens, i), + parseFunction(filename, tokens, i, true), + parseValueStatement(filename, tokens, i) + ); + } + + public static Statement[] parse(Filename filename, String raw) { + var tokens = tokenize(filename, raw); + var list = new ArrayList(); + int i = 0; + + while (true) { + if (i >= tokens.size()) break; + + var res = Parsing.parseStatement(filename, tokens, i); + + if (res.isError()) throw new SyntaxException(getLoc(filename, tokens, i), res.error); + else if (res.isFailed()) throw new SyntaxException(getLoc(filename, tokens, i), "Unexpected syntax."); + + i += res.n; + + list.add(res.result); + } + + return list.toArray(Statement[]::new); + } + + public static CompileTarget compile(Environment environment, Statement ...statements) { + var subscope = new LocalScopeRecord(); + var target = new CompileTarget(new HashMap<>(), new TreeSet<>()); + var stm = new CompoundStatement(null, true, statements); + + subscope.define("this"); + subscope.define("arguments"); + + try { + stm.compile(target, subscope, true); + FunctionStatement.checkBreakAndCont(target, 0); + } + catch (SyntaxException e) { + target.target.clear(); + target.add(Instruction.throwSyntax(e.loc, e)); + } + + target.add(Instruction.ret(stm.loc())); + target.functions.put(0l, new FunctionBody(subscope.localsCount(), 0, target.array(), subscope.captures(), subscope.locals())); + + return target; + } + public static CompileTarget compile(Environment environment, Filename filename, String raw) { + try { return compile(environment, parse(filename, raw)); } + catch (SyntaxException e) { return compile(environment, new ThrowSyntaxStatement(e)); } + } +} diff --git a/src/me/topchetoeu/jscript/parsing/RawToken.java b/src/me/topchetoeu/jscript/parsing/RawToken.java index f105b7d..22b4791 100644 --- a/src/me/topchetoeu/jscript/parsing/RawToken.java +++ b/src/me/topchetoeu/jscript/parsing/RawToken.java @@ -1,15 +1,15 @@ -package me.topchetoeu.jscript.parsing; - -public class RawToken { - public final String value; - public final TokenType type; - public final int line; - public final int start; - - public RawToken(String value, TokenType type, int line, int start) { - this.value = value; - this.type = type; - this.line = line; - this.start = start; - } +package me.topchetoeu.jscript.parsing; + +public class RawToken { + public final String value; + public final TokenType type; + public final int line; + public final int start; + + public RawToken(String value, TokenType type, int line, int start) { + this.value = value; + this.type = type; + this.line = line; + this.start = start; + } } \ No newline at end of file diff --git a/src/me/topchetoeu/jscript/parsing/TestRes.java b/src/me/topchetoeu/jscript/parsing/TestRes.java index a72fe97..659c581 100644 --- a/src/me/topchetoeu/jscript/parsing/TestRes.java +++ b/src/me/topchetoeu/jscript/parsing/TestRes.java @@ -1,45 +1,45 @@ -package me.topchetoeu.jscript.parsing; - -import me.topchetoeu.jscript.Location; -import me.topchetoeu.jscript.parsing.ParseRes.State; - -public class TestRes { - public final State state; - public final String error; - public final int i; - - private TestRes(ParseRes.State state, String error, int i) { - this.i = i; - this.state = state; - this.error = error; - } - - public TestRes add(int n) { - return new TestRes(state, null, this.i + n); - } - public ParseRes transform() { - if (isSuccess()) throw new RuntimeException("Can't transform a TestRes that hasn't failed."); - else if (isError()) return ParseRes.error(null, error); - else return ParseRes.failed(); - } - - public boolean isSuccess() { return state.isSuccess(); } - public boolean isFailed() { return state.isFailed(); } - public boolean isError() { return state.isError(); } - - public static TestRes failed() { - return new TestRes(State.FAILED, null, 0); - } - public static TestRes error(Location loc, String error) { - if (loc != null) error = loc + ": " + error; - return new TestRes(State.ERROR, error, 0); - } - public static TestRes error(Location loc, String error, TestRes other) { - if (loc != null) error = loc + ": " + error; - if (!other.isError()) return new TestRes(State.ERROR, error, 0); - return new TestRes(State.ERROR, other.error, 0); - } - public static TestRes res(int i) { - return new TestRes(State.SUCCESS, null, i); - } +package me.topchetoeu.jscript.parsing; + +import me.topchetoeu.jscript.Location; +import me.topchetoeu.jscript.parsing.ParseRes.State; + +public class TestRes { + public final State state; + public final String error; + public final int i; + + private TestRes(ParseRes.State state, String error, int i) { + this.i = i; + this.state = state; + this.error = error; + } + + public TestRes add(int n) { + return new TestRes(state, null, this.i + n); + } + public ParseRes transform() { + if (isSuccess()) throw new RuntimeException("Can't transform a TestRes that hasn't failed."); + else if (isError()) return ParseRes.error(null, error); + else return ParseRes.failed(); + } + + public boolean isSuccess() { return state.isSuccess(); } + public boolean isFailed() { return state.isFailed(); } + public boolean isError() { return state.isError(); } + + public static TestRes failed() { + return new TestRes(State.FAILED, null, 0); + } + public static TestRes error(Location loc, String error) { + if (loc != null) error = loc + ": " + error; + return new TestRes(State.ERROR, error, 0); + } + public static TestRes error(Location loc, String error, TestRes other) { + if (loc != null) error = loc + ": " + error; + if (!other.isError()) return new TestRes(State.ERROR, error, 0); + return new TestRes(State.ERROR, other.error, 0); + } + public static TestRes res(int i) { + return new TestRes(State.SUCCESS, null, i); + } } \ No newline at end of file diff --git a/src/me/topchetoeu/jscript/parsing/Token.java b/src/me/topchetoeu/jscript/parsing/Token.java index c614632..9c1a8cf 100644 --- a/src/me/topchetoeu/jscript/parsing/Token.java +++ b/src/me/topchetoeu/jscript/parsing/Token.java @@ -1,55 +1,55 @@ -package me.topchetoeu.jscript.parsing; - -public class Token { - public final Object value; - public final boolean isString; - public final boolean isRegex; - public final int line; - public final int start; - - private Token(int line, int start, Object value, boolean isString, boolean isRegex) { - this.value = value; - this.line = line; - this.start = start; - this.isString = isString; - this.isRegex = isRegex; - } - private Token(int line, int start, Object value) { - this.value = value; - this.line = line; - this.start = start; - this.isString = false; - this.isRegex = false; - } - - public boolean isString() { return isString; } - public boolean isRegex() { return isRegex; } - public boolean isNumber() { return value instanceof Number; } - public boolean isIdentifier() { return !isString && !isRegex && value instanceof String; } - public boolean isOperator() { return value instanceof Operator; } - - public boolean isIdentifier(String lit) { return !isString && !isRegex && value.equals(lit); } - public boolean isOperator(Operator op) { return value.equals(op); } - - public String string() { return (String)value; } - public String regex() { return (String)value; } - public double number() { return (double)value; } - public String identifier() { return (String)value; } - public Operator operator() { return (Operator)value; } - - public static Token regex(int line, int start, String val) { - return new Token(line, start, val, false, true); - } - public static Token string(int line, int start, String val) { - return new Token(line, start, val, true, false); - } - public static Token number(int line, int start, double val) { - return new Token(line, start, val); - } - public static Token identifier(int line, int start, String val) { - return new Token(line, start, val); - } - public static Token operator(int line, int start, Operator val) { - return new Token(line, start, val); - } +package me.topchetoeu.jscript.parsing; + +public class Token { + public final Object value; + public final boolean isString; + public final boolean isRegex; + public final int line; + public final int start; + + private Token(int line, int start, Object value, boolean isString, boolean isRegex) { + this.value = value; + this.line = line; + this.start = start; + this.isString = isString; + this.isRegex = isRegex; + } + private Token(int line, int start, Object value) { + this.value = value; + this.line = line; + this.start = start; + this.isString = false; + this.isRegex = false; + } + + public boolean isString() { return isString; } + public boolean isRegex() { return isRegex; } + public boolean isNumber() { return value instanceof Number; } + public boolean isIdentifier() { return !isString && !isRegex && value instanceof String; } + public boolean isOperator() { return value instanceof Operator; } + + public boolean isIdentifier(String lit) { return !isString && !isRegex && value.equals(lit); } + public boolean isOperator(Operator op) { return value.equals(op); } + + public String string() { return (String)value; } + public String regex() { return (String)value; } + public double number() { return (double)value; } + public String identifier() { return (String)value; } + public Operator operator() { return (Operator)value; } + + public static Token regex(int line, int start, String val) { + return new Token(line, start, val, false, true); + } + public static Token string(int line, int start, String val) { + return new Token(line, start, val, true, false); + } + public static Token number(int line, int start, double val) { + return new Token(line, start, val); + } + public static Token identifier(int line, int start, String val) { + return new Token(line, start, val); + } + public static Token operator(int line, int start, Operator val) { + return new Token(line, start, val); + } } \ No newline at end of file diff --git a/src/me/topchetoeu/jscript/parsing/TokenType.java b/src/me/topchetoeu/jscript/parsing/TokenType.java index 6cdfdfa..78a10a6 100644 --- a/src/me/topchetoeu/jscript/parsing/TokenType.java +++ b/src/me/topchetoeu/jscript/parsing/TokenType.java @@ -1,9 +1,9 @@ -package me.topchetoeu.jscript.parsing; - -enum TokenType { - REGEX, - STRING, - NUMBER, - LITERAL, - OPERATOR, +package me.topchetoeu.jscript.parsing; + +enum TokenType { + REGEX, + STRING, + NUMBER, + LITERAL, + OPERATOR, } \ No newline at end of file From d3571d6ee28b7938f2cd7030bb2b31ab1c86db18 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Fri, 22 Dec 2023 10:46:30 +0200 Subject: [PATCH 02/20] fix: make .gitignore more restrictive --- .gitignore | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 87e4e4d..a256983 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,15 @@ -.vscode -.gradle -.ignore -/out -/build -/bin -/dst -/*.js -!/build.js -/dead-code -/Metadata.java \ No newline at end of file +* + +!/src +!/src/**/* + +!/tests +!/tests/**/* + +!/.github +!/.github/**/* + +!/.gitignore +!/build.js +!/LICENSE +!/README.md From cad4f34b51b99a94aa691795764903af879f6514 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:08:20 +0200 Subject: [PATCH 03/20] fix: use correct env declarations in bootstrap.js --- src/assets/js/bootstrap.js | 226 ++++++++++++++++++------------------- 1 file changed, 113 insertions(+), 113 deletions(-) diff --git a/src/assets/js/bootstrap.js b/src/assets/js/bootstrap.js index 74f854d..6417077 100644 --- a/src/assets/js/bootstrap.js +++ b/src/assets/js/bootstrap.js @@ -1,113 +1,113 @@ -(function (ts, env, libs) { - var src = '', version = 0; - var lib = libs.concat([ - 'declare function exit(): never;', - 'declare function go(): any;', - 'declare function getTsDeclarations(): string[];' - ]).join(''); - var libSnapshot = ts.ScriptSnapshot.fromString(lib); - var environments = {}; - var declSnapshots = []; - - var settings = { - outDir: "/out", - declarationDir: "/out", - target: ts.ScriptTarget.ES5, - lib: [ ], - module: ts.ModuleKind.None, - declaration: true, - stripInternal: true, - downlevelIteration: true, - forceConsistentCasingInFileNames: true, - experimentalDecorators: true, - strict: true, - sourceMap: true, - }; - - var reg = ts.createDocumentRegistry(); - var service = ts.createLanguageService({ - getCurrentDirectory: function() { return "/"; }, - getDefaultLibFileName: function() { return "/lib.d.ts"; }, - getScriptFileNames: function() { - var res = [ "/src.ts", "/lib.d.ts" ]; - for (var i = 0; i < declSnapshots.length; i++) res.push("/glob." + (i + 1) + ".d.ts"); - return res; - }, - getCompilationSettings: function () { return settings; }, - fileExists: function(filename) { return filename === "/lib.d.ts" || filename === "/src.ts" || filename === "/glob.d.ts"; }, - - getScriptSnapshot: function(filename) { - if (filename === "/lib.d.ts") return libSnapshot; - if (filename === "/src.ts") return ts.ScriptSnapshot.fromString(src); - - var index = /\/glob\.(\d+)\.d\.ts/g.exec(filename); - if (index && index[1] && (index = Number(index[1])) && index > 0 && index <= declSnapshots.length) { - return declSnapshots[index - 1]; - } - - throw new Error("File '" + filename + "' doesn't exist."); - }, - getScriptVersion: function (filename) { - if (filename === "/lib.d.ts" || filename.startsWith("/glob.")) return 0; - else return version; - }, - }, reg); - - service.getEmitOutput("/lib.d.ts"); - log("Loaded libraries!"); - - var oldCompile = env.compile; - - function compile(code, filename, env) { - src = code; - version++; - - if (!environments[env.id]) environments[env.id] = [] - declSnapshots = environments[env.id]; - var emit = service.getEmitOutput("/src.ts"); - - var diagnostics = [] - .concat(service.getCompilerOptionsDiagnostics()) - .concat(service.getSyntacticDiagnostics("/src.ts")) - .concat(service.getSemanticDiagnostics("/src.ts")) - .map(function (diagnostic) { - var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"); - if (diagnostic.file) { - var pos = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); - var file = diagnostic.file.fileName.substring(1); - if (file === "src.ts") file = filename; - return file + ":" + (pos.line + 1) + ":" + (pos.character + 1) + ": " + message; - } - else return message; - }); - - if (diagnostics.length > 0) { - throw new SyntaxError(diagnostics.join("\n")); - } - - var map = JSON.parse(emit.outputFiles[0].text); - var result = emit.outputFiles[1].text; - var declaration = emit.outputFiles[2].text; - - var compiled = oldCompile(result, filename, env); - - return { - function: function () { - var val = compiled.function.apply(this, arguments); - if (declaration !== '') declSnapshots.push(ts.ScriptSnapshot.fromString(declaration)); - return val; - }, - breakpoints: compiled.breakpoints, - mapChain: compiled.mapChain.concat(map.mappings), - }; - } - - function apply(env) { - env.compile = compile; - env.global.getTsDeclarations = function() { - return environments[env.id]; - } - } - - apply(env); -})(arguments[0], arguments[1], arguments[2]); +(function (ts, env, libs) { + var src = '', version = 0; + var lib = libs.concat([ + 'declare function exit(): never;', + 'declare function go(): any;', + 'declare function getTsDeclarations(): string[];' + ]).join(''); + var libSnapshot = ts.ScriptSnapshot.fromString(lib); + var environments = {}; + var declSnapshots = []; + + var settings = { + outDir: "/out", + declarationDir: "/out", + target: ts.ScriptTarget.ES5, + lib: [ ], + module: ts.ModuleKind.None, + declaration: true, + stripInternal: true, + downlevelIteration: true, + forceConsistentCasingInFileNames: true, + experimentalDecorators: true, + strict: true, + sourceMap: true, + }; + + var reg = ts.createDocumentRegistry(); + var service = ts.createLanguageService({ + getCurrentDirectory: function() { return "/"; }, + getDefaultLibFileName: function() { return "/lib.d.ts"; }, + getScriptFileNames: function() { + var res = [ "/src.ts", "/lib.d.ts" ]; + for (var i = 0; i < declSnapshots.length; i++) res.push("/glob." + (i + 1) + ".d.ts"); + return res; + }, + getCompilationSettings: function () { return settings; }, + fileExists: function(filename) { return filename === "/lib.d.ts" || filename === "/src.ts" || filename === "/glob.d.ts"; }, + + getScriptSnapshot: function(filename) { + if (filename === "/lib.d.ts") return libSnapshot; + if (filename === "/src.ts") return ts.ScriptSnapshot.fromString(src); + + var index = /\/glob\.(\d+)\.d\.ts/g.exec(filename); + if (index && index[1] && (index = Number(index[1])) && index > 0 && index <= declSnapshots.length) { + return declSnapshots[index - 1]; + } + + throw new Error("File '" + filename + "' doesn't exist."); + }, + getScriptVersion: function (filename) { + if (filename === "/lib.d.ts" || filename.startsWith("/glob.")) return 0; + else return version; + }, + }, reg); + + service.getEmitOutput("/lib.d.ts"); + log("Loaded libraries!"); + + var oldCompile = env.compile; + + function compile(code, filename, env) { + src = code; + version++; + + if (!environments[env.id]) environments[env.id] = [] + var decls = declSnapshots = environments[env.id]; + var emit = service.getEmitOutput("/src.ts"); + + var diagnostics = [] + .concat(service.getCompilerOptionsDiagnostics()) + .concat(service.getSyntacticDiagnostics("/src.ts")) + .concat(service.getSemanticDiagnostics("/src.ts")) + .map(function (diagnostic) { + var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"); + if (diagnostic.file) { + var pos = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + var file = diagnostic.file.fileName.substring(1); + if (file === "src.ts") file = filename; + return file + ":" + (pos.line + 1) + ":" + (pos.character + 1) + ": " + message; + } + else return message; + }); + + if (diagnostics.length > 0) { + throw new SyntaxError(diagnostics.join("\n")); + } + + var map = JSON.parse(emit.outputFiles[0].text); + var result = emit.outputFiles[1].text; + var declaration = emit.outputFiles[2].text; + + var compiled = oldCompile(result, filename, env); + + return { + function: function () { + var val = compiled.function.apply(this, arguments); + if (declaration !== '') decls.push(ts.ScriptSnapshot.fromString(declaration)); + return val; + }, + breakpoints: compiled.breakpoints, + mapChain: compiled.mapChain.concat(map.mappings), + }; + } + + function apply(env) { + env.compile = compile; + env.global.getTsDeclarations = function() { + return environments[env.id]; + } + } + + apply(env); +})(arguments[0], arguments[1], arguments[2]); From 93973c12b1e68c51ce199dc8fd682a9ebbd560a8 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:10:03 +0200 Subject: [PATCH 04/20] fix: change default return type to void for generators --- src/assets/js/lib.d.ts | 1236 ++++++++++++++++++++-------------------- 1 file changed, 618 insertions(+), 618 deletions(-) diff --git a/src/assets/js/lib.d.ts b/src/assets/js/lib.d.ts index b843aba..72b9d1f 100644 --- a/src/assets/js/lib.d.ts +++ b/src/assets/js/lib.d.ts @@ -1,618 +1,618 @@ -type PropertyDescriptor = { - value: any; - writable?: boolean; - enumerable?: boolean; - configurable?: boolean; -} | { - get?(this: ThisT): T; - set(this: ThisT, val: T): void; - enumerable?: boolean; - configurable?: boolean; -} | { - get(this: ThisT): T; - set?(this: ThisT, val: T): void; - enumerable?: boolean; - configurable?: boolean; -}; -type Exclude = T extends U ? never : T; -type Extract = T extends U ? T : never; -type Record = { [x in KeyT]: ValT } -type ReplaceFunc = (match: string, ...args: any[]) => string; - -type PromiseResult = { type: 'fulfilled'; value: T; } | { type: 'rejected'; reason: any; } - -// wippidy-wine, this code is now mine :D -type Awaited = - T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode - T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped - F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument - Awaited : // recursively unwrap the value - never : // the argument to `then` was not callable - T; - -type IteratorYieldResult = - { done?: false; } & - (TReturn extends undefined ? { value?: undefined; } : { value: TReturn; }); - -type IteratorReturnResult = - { done: true } & - (TReturn extends undefined ? { value?: undefined; } : { value: TReturn; }); - -type IteratorResult = IteratorYieldResult | IteratorReturnResult; - -interface Thenable { - then(onFulfilled?: (val: T) => NextT, onRejected?: (err: any) => NextT): Promise>; -} - -interface RegExpResultIndices extends Array<[number, number]> { - groups?: { [name: string]: [number, number]; }; -} -interface RegExpResult extends Array { - groups?: { [name: string]: string; }; - index: number; - input: string; - indices?: RegExpResultIndices; - escape(raw: string, flags: string): RegExp; -} - -interface Matcher { - [Symbol.match](target: string): RegExpResult | string[] | null; - [Symbol.matchAll](target: string): IterableIterator; -} -interface Splitter { - [Symbol.split](target: string, limit?: number, sensible?: boolean): string[]; -} -interface Replacer { - [Symbol.replace](target: string, replacement: string | ReplaceFunc): string; -} -interface Searcher { - [Symbol.search](target: string, reverse?: boolean, start?: number): number; -} - -type FlatArray = { - "done": Arr, - "recur": Arr extends Array - ? FlatArray - : Arr -}[Depth extends -1 ? "done" : "recur"]; - -interface IArguments { - [i: number]: any; - length: number; -} - -interface Iterator { - next(...args: [] | [TNext]): IteratorResult; - return?(value?: TReturn): IteratorResult; - throw?(e?: any): IteratorResult; -} -interface Iterable { - [Symbol.iterator](): Iterator; -} -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface AsyncIterator { - next(...args: [] | [TNext]): Promise>; - return?(value?: TReturn | Thenable): Promise>; - throw?(e?: any): Promise>; -} -interface AsyncIterable { - [Symbol.asyncIterator](): AsyncIterator; -} -interface AsyncIterableIterator extends AsyncIterator { - [Symbol.asyncIterator](): AsyncIterableIterator; -} - -interface Generator extends Iterator { - [Symbol.iterator](): Generator; - return(value: TReturn): IteratorResult; - throw(e: any): IteratorResult; -} -interface GeneratorFunction { - new (...args: any[]): Generator; - (...args: any[]): Generator; - readonly length: number; - readonly name: string; - readonly prototype: Generator; -} - -interface AsyncGenerator extends AsyncIterator { - return(value: TReturn | Thenable): Promise>; - throw(e: any): Promise>; - [Symbol.asyncIterator](): AsyncGenerator; -} -interface AsyncGeneratorFunction { - new (...args: any[]): AsyncGenerator; - (...args: any[]): AsyncGenerator; - readonly length: number; - readonly name: string; - readonly prototype: AsyncGenerator; -} - - -interface MathObject { - readonly E: number; - readonly PI: number; - readonly SQRT2: number; - readonly SQRT1_2: number; - readonly LN2: number; - readonly LN10: number; - readonly LOG2E: number; - readonly LOG10E: number; - - asin(x: number): number; - acos(x: number): number; - atan(x: number): number; - atan2(y: number, x: number): number; - asinh(x: number): number; - acosh(x: number): number; - atanh(x: number): number; - sin(x: number): number; - cos(x: number): number; - tan(x: number): number; - sinh(x: number): number; - cosh(x: number): number; - tanh(x: number): number; - sqrt(x: number): number; - cbrt(x: number): number; - hypot(...vals: number[]): number; - imul(a: number, b: number): number; - exp(x: number): number; - expm1(x: number): number; - pow(x: number, y: number): number; - log(x: number): number; - log10(x: number): number; - log1p(x: number): number; - log2(x: number): number; - ceil(x: number): number; - floor(x: number): number; - round(x: number): number; - fround(x: number): number; - trunc(x: number): number; - abs(x: number): number; - max(...vals: number[]): number; - min(...vals: number[]): number; - sign(x: number): number; - random(): number; - clz32(x: number): number; -} - -interface Array extends IterableIterator { - [i: number]: T; - - length: number; - - toString(): string; - // toLocaleString(): string; - join(separator?: string): string; - fill(val: T, start?: number, end?: number): T[]; - pop(): T | undefined; - push(...items: T[]): number; - concat(...items: (T | T[])[]): T[]; - concat(...items: (T | T[])[]): T[]; - join(separator?: string): string; - reverse(): T[]; - shift(): T | undefined; - slice(start?: number, end?: number): T[]; - sort(compareFn?: (a: T, b: T) => number): this; - splice(start: number, deleteCount?: number | undefined, ...items: T[]): T[]; - unshift(...items: T[]): number; - indexOf(searchElement: T, fromIndex?: number): number; - lastIndexOf(searchElement: T, fromIndex?: number): number; - every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; - some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - includes(el: any, start?: number): boolean; - - map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; - find(predicate: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; - findIndex(predicate: (value: T, index: number, array: T[]) => boolean, thisArg?: any): number; - findLast(predicate: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; - findLastIndex(predicate: (value: T, index: number, array: T[]) => boolean, thisArg?: any): number; - - flat(depth?: D): FlatArray; - flatMap(func: (val: T, i: number, arr: T[]) => T | T[], thisAarg?: any): FlatArray; - sort(func?: (a: T, b: T) => number): this; - - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - entries(): IterableIterator<[number, T]>; - values(): IterableIterator; - keys(): IterableIterator; -} -interface ArrayConstructor { - new (arrayLength?: number): T[]; - new (...items: T[]): T[]; - (arrayLength?: number): T[]; - (...items: T[]): T[]; - isArray(arg: any): arg is any[]; - prototype: Array; -} - -interface Boolean { - toString(): string; - valueOf(): boolean; -} -interface BooleanConstructor { - (val: any): boolean; - new (val: any): Boolean; - prototype: Boolean; -} - -interface Error { - name: string; - message: string; - stack: string[]; - toString(): string; -} -interface ErrorConstructor { - (msg?: any): Error; - new (msg?: any): Error; - prototype: Error; -} - -interface TypeErrorConstructor extends ErrorConstructor { - (msg?: any): TypeError; - new (msg?: any): TypeError; - prototype: Error; -} -interface TypeError extends Error { - name: 'TypeError'; -} - -interface RangeErrorConstructor extends ErrorConstructor { - (msg?: any): RangeError; - new (msg?: any): RangeError; - prototype: Error; -} -interface RangeError extends Error { - name: 'RangeError'; -} - -interface SyntaxErrorConstructor extends ErrorConstructor { - (msg?: any): RangeError; - new (msg?: any): RangeError; - prototype: Error; -} -interface SyntaxError extends Error { - name: 'SyntaxError'; -} - -interface Function { - apply(this: Function, thisArg: any, argArray?: any): any; - call(this: Function, thisArg: any, ...argArray: any[]): any; - bind(this: Function, thisArg: any, ...argArray: any[]): Function; - - toString(): string; - - prototype: any; - readonly length: number; - name: string; -} -interface CallableFunction extends Function { - (...args: any[]): any; - apply(this: (this: ThisArg, ...args: Args) => RetT, thisArg: ThisArg, argArray?: Args): RetT; - call(this: (this: ThisArg, ...args: Args) => RetT, thisArg: ThisArg, ...argArray: Args): RetT; - bind(this: (this: ThisArg, ...args: [ ...Args, ...Rest ]) => RetT, thisArg: ThisArg, ...argArray: Args): (this: void, ...args: Rest) => RetT; -} -interface NewableFunction extends Function { - new(...args: any[]): any; - apply(this: new (...args: Args) => RetT, thisArg: any, argArray?: Args): RetT; - call(this: new (...args: Args) => RetT, thisArg: any, ...argArray: Args): RetT; - bind(this: new (...args: Args) => RetT, thisArg: any, ...argArray: Args): new (...args: Args) => RetT; -} -interface FunctionConstructor extends Function { - (...args: string[]): (...args: any[]) => any; - new (...args: string[]): (...args: any[]) => any; - prototype: Function; - async( - func: (await: (val: T) => Awaited) => (...args: ArgsT) => RetT - ): (...args: ArgsT) => Promise; - asyncGenerator( - func: (await: (val: T) => Awaited, _yield: (val: T) => void) => (...args: ArgsT) => RetT - ): (...args: ArgsT) => AsyncGenerator; - generator( - func: (_yield: (val: T) => TNext) => (...args: ArgsT) => RetT - ): (...args: ArgsT) => Generator; -} - -interface Number { - toString(): string; - valueOf(): number; -} -interface NumberConstructor { - (val: any): number; - new (val: any): Number; - prototype: Number; - parseInt(val: unknown): number; - parseFloat(val: unknown): number; -} - -interface Object { - constructor: NewableFunction; - [Symbol.typeName]: string; - - valueOf(): this; - toString(): string; - hasOwnProperty(key: any): boolean; -} -interface ObjectConstructor { - (arg: string): String; - (arg: number): Number; - (arg: boolean): Boolean; - (arg?: undefined | null): {}; - (arg: T): T; - - new (arg: string): String; - new (arg: number): Number; - new (arg: boolean): Boolean; - new (arg?: undefined | null): {}; - new (arg: T): T; - - prototype: Object; - - assign(target: T, ...src: object[]): T; - create(proto: T, props?: { [key: string]: PropertyDescriptor }): T; - - keys(obj: T, onlyString?: true): (keyof T)[]; - keys(obj: T, onlyString: false): any[]; - entries(obj: T, onlyString?: true): [keyof T, T[keyof T]][]; - entries(obj: T, onlyString: false): [any, any][]; - values(obj: T, onlyString?: true): (T[keyof T])[]; - values(obj: T, onlyString: false): any[]; - - fromEntries(entries: Iterable<[any, any]>): object; - - defineProperty(obj: ThisT, key: any, desc: PropertyDescriptor): ThisT; - defineProperties(obj: ThisT, desc: { [key: string]: PropertyDescriptor }): ThisT; - - getOwnPropertyNames(obj: T): (keyof T)[]; - getOwnPropertySymbols(obj: T): (keyof T)[]; - hasOwn(obj: T, key: KeyT): boolean; - - getOwnPropertyDescriptor(obj: T, key: KeyT): PropertyDescriptor; - getOwnPropertyDescriptors(obj: T): { [x in keyof T]: PropertyDescriptor }; - - getPrototypeOf(obj: any): object | null; - setPrototypeOf(obj: T, proto: object | null): T; - - preventExtensions(obj: T): T; - seal(obj: T): T; - freeze(obj: T): T; - - isExtensible(obj: object): boolean; - isSealed(obj: object): boolean; - isFrozen(obj: object): boolean; -} - -interface String { - [i: number]: string; - - toString(): string; - valueOf(): string; - - charAt(pos: number): string; - charCodeAt(pos: number): number; - substring(start?: number, end?: number): string; - slice(start?: number, end?: number): string; - substr(start?: number, length?: number): string; - - startsWith(str: string, pos?: number): string; - endsWith(str: string, pos?: number): string; - - replace(pattern: string | Replacer, val: string | ReplaceFunc): string; - replaceAll(pattern: string | Replacer, val: string | ReplaceFunc): string; - - match(pattern: string | Matcher): RegExpResult | string[] | null; - matchAll(pattern: string | Matcher): IterableIterator; - - split(pattern: string | Splitter, limit?: number, sensible?: boolean): string; - - concat(...others: string[]): string; - indexOf(term: string | Searcher, start?: number): number; - lastIndexOf(term: string | Searcher, start?: number): number; - - toLowerCase(): string; - toUpperCase(): string; - - trim(): string; - - includes(term: string, start?: number): boolean; - - length: number; -} -interface StringConstructor { - (val: any): string; - new (val: any): String; - - fromCharCode(val: number): string; - - prototype: String; -} - -interface Symbol { - valueOf(): symbol; -} -interface SymbolConstructor { - (val?: any): symbol; - new(...args: any[]): never; - prototype: Symbol; - for(key: string): symbol; - keyFor(sym: symbol): string; - - readonly typeName: unique symbol; - readonly match: unique symbol; - readonly matchAll: unique symbol; - readonly split: unique symbol; - readonly replace: unique symbol; - readonly search: unique symbol; - readonly iterator: unique symbol; - readonly asyncIterator: unique symbol; -} - - -interface Promise extends Thenable { - catch(func: (err: unknown) => ResT): Promise; - finally(func: () => void): Promise; - constructor: PromiseConstructor; -} -interface PromiseConstructorLike { - new (func: (res: (val: T) => void, rej: (err: unknown) => void) => void): Thenable>; -} -interface PromiseConstructor extends PromiseConstructorLike { - prototype: Promise; - - new (func: (res: (val: T) => void, rej: (err: unknown) => void) => void): Promise>; - resolve(val: T): Promise>; - reject(val: any): Promise; - - isAwaitable(val: unknown): val is Thenable; - any(promises: T[]): Promise>; - race(promises: (Promise|T)[]): Promise; - all(promises: T): Promise<{ [Key in keyof T]: Awaited }>; - allSettled(...promises: T): Promise<[...{ [P in keyof T]: PromiseResult>}]>; -} - -interface FileStat { - type: 'file' | 'folder'; - mode: 'r' | 'rw'; -} -interface File { - readonly pointer: Promise; - readonly length: Promise; - readonly mode: Promise<'' | 'r' | 'rw'>; - - read(n: number): Promise; - write(buff: number[]): Promise; - close(): Promise; - setPointer(val: number): Promise; -} -interface Filesystem { - open(path: string, mode: 'r' | 'rw'): Promise; - ls(path: string): AsyncIterableIterator; - mkdir(path: string): Promise; - mkfile(path: string): Promise; - rm(path: string, recursive?: boolean): Promise; - stat(path: string): Promise; - exists(path: string): Promise; -} - -interface Encoding { - encode(val: string): number[]; - decode(val: number[]): string; -} - -declare var String: StringConstructor; -//@ts-ignore -declare const arguments: IArguments; -declare var NaN: number; -declare var Infinity: number; - -declare var setTimeout: (handle: (...args: [ ...T, ...any[] ]) => void, delay?: number, ...args: T) => number; -declare var setInterval: (handle: (...args: [ ...T, ...any[] ]) => void, delay?: number, ...args: T) => number; - -declare var clearTimeout: (id: number) => void; -declare var clearInterval: (id: number) => void; - -declare var parseInt: typeof Number.parseInt; -declare var parseFloat: typeof Number.parseFloat; - -declare function log(...vals: any[]): void; - -declare var Array: ArrayConstructor; -declare var Boolean: BooleanConstructor; -declare var Promise: PromiseConstructor; -declare var Function: FunctionConstructor; -declare var Number: NumberConstructor; -declare var Object: ObjectConstructor; -declare var Symbol: SymbolConstructor; -declare var Promise: PromiseConstructor; -declare var Math: MathObject; -declare var Encoding: Encoding; -declare var Filesystem: Filesystem; - -declare var Error: ErrorConstructor; -declare var RangeError: RangeErrorConstructor; -declare var TypeError: TypeErrorConstructor; -declare var SyntaxError: SyntaxErrorConstructor; -declare var self: typeof globalThis; - -declare class Map { - public [Symbol.iterator](): IterableIterator<[KeyT, ValueT]>; - - public clear(): void; - public delete(key: KeyT): boolean; - - public entries(): IterableIterator<[KeyT, ValueT]>; - public keys(): IterableIterator; - public values(): IterableIterator; - - public get(key: KeyT): ValueT; - public set(key: KeyT, val: ValueT): this; - public has(key: KeyT): boolean; - - public get size(): number; - - public forEach(func: (key: KeyT, val: ValueT, map: Map) => void, thisArg?: any): void; - - public constructor(); -} -declare class Set { - public [Symbol.iterator](): IterableIterator; - - public entries(): IterableIterator<[T, T]>; - public keys(): IterableIterator; - public values(): IterableIterator; - - public clear(): void; - - public add(val: T): this; - public delete(val: T): boolean; - public has(key: T): boolean; - - public get size(): number; - - public forEach(func: (key: T, set: Set) => void, thisArg?: any): void; - - public constructor(); -} - -declare class RegExp implements Matcher, Splitter, Replacer, Searcher { - static escape(raw: any, flags?: string): RegExp; - - prototype: RegExp; - - exec(val: string): RegExpResult | null; - test(val: string): boolean; - toString(): string; - - [Symbol.match](target: string): RegExpResult | string[] | null; - [Symbol.matchAll](target: string): IterableIterator; - [Symbol.split](target: string, limit?: number, sensible?: boolean): string[]; - [Symbol.replace](target: string, replacement: string | ReplaceFunc): string; - [Symbol.search](target: string, reverse?: boolean, start?: number): number; - - readonly dotAll: boolean; - readonly global: boolean; - readonly hasIndices: boolean; - readonly ignoreCase: boolean; - readonly multiline: boolean; - readonly sticky: boolean; - readonly unicode: boolean; - - readonly source: string; - readonly flags: string; - - lastIndex: number; - - constructor(pattern?: string, flags?: string); - constructor(pattern?: RegExp, flags?: string); -} +type PropertyDescriptor = { + value: any; + writable?: boolean; + enumerable?: boolean; + configurable?: boolean; +} | { + get?(this: ThisT): T; + set(this: ThisT, val: T): void; + enumerable?: boolean; + configurable?: boolean; +} | { + get(this: ThisT): T; + set?(this: ThisT, val: T): void; + enumerable?: boolean; + configurable?: boolean; +}; +type Exclude = T extends U ? never : T; +type Extract = T extends U ? T : never; +type Record = { [x in KeyT]: ValT } +type ReplaceFunc = (match: string, ...args: any[]) => string; + +type PromiseResult = { type: 'fulfilled'; value: T; } | { type: 'rejected'; reason: any; } + +// wippidy-wine, this code is now mine :D +type Awaited = + T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode + T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped + F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument + Awaited : // recursively unwrap the value + never : // the argument to `then` was not callable + T; + +type IteratorYieldResult = + { done?: false; } & + (TReturn extends undefined ? { value?: undefined; } : { value: TReturn; }); + +type IteratorReturnResult = + { done: true } & + (TReturn extends undefined ? { value?: undefined; } : { value: TReturn; }); + +type IteratorResult = IteratorYieldResult | IteratorReturnResult; + +interface Thenable { + then(onFulfilled?: (val: T) => NextT, onRejected?: (err: any) => NextT): Promise>; +} + +interface RegExpResultIndices extends Array<[number, number]> { + groups?: { [name: string]: [number, number]; }; +} +interface RegExpResult extends Array { + groups?: { [name: string]: string; }; + index: number; + input: string; + indices?: RegExpResultIndices; + escape(raw: string, flags: string): RegExp; +} + +interface Matcher { + [Symbol.match](target: string): RegExpResult | string[] | null; + [Symbol.matchAll](target: string): IterableIterator; +} +interface Splitter { + [Symbol.split](target: string, limit?: number, sensible?: boolean): string[]; +} +interface Replacer { + [Symbol.replace](target: string, replacement: string | ReplaceFunc): string; +} +interface Searcher { + [Symbol.search](target: string, reverse?: boolean, start?: number): number; +} + +type FlatArray = { + "done": Arr, + "recur": Arr extends Array + ? FlatArray + : Arr +}[Depth extends -1 ? "done" : "recur"]; + +interface IArguments { + [i: number]: any; + length: number; +} + +interface Iterator { + next(...args: [] | [TNext]): IteratorResult; + return?(value?: TReturn): IteratorResult; + throw?(e?: any): IteratorResult; +} +interface Iterable { + [Symbol.iterator](): Iterator; +} +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface AsyncIterator { + next(...args: [] | [TNext]): Promise>; + return?(value?: TReturn | Thenable): Promise>; + throw?(e?: any): Promise>; +} +interface AsyncIterable { + [Symbol.asyncIterator](): AsyncIterator; +} +interface AsyncIterableIterator extends AsyncIterator { + [Symbol.asyncIterator](): AsyncIterableIterator; +} + +interface Generator extends Iterator { + [Symbol.iterator](): Generator; + return(value: TReturn): IteratorResult; + throw(e: any): IteratorResult; +} +interface GeneratorFunction { + new (...args: any[]): Generator; + (...args: any[]): Generator; + readonly length: number; + readonly name: string; + readonly prototype: Generator; +} + +interface AsyncGenerator extends AsyncIterator { + return(value: TReturn | Thenable): Promise>; + throw(e: any): Promise>; + [Symbol.asyncIterator](): AsyncGenerator; +} +interface AsyncGeneratorFunction { + new (...args: any[]): AsyncGenerator; + (...args: any[]): AsyncGenerator; + readonly length: number; + readonly name: string; + readonly prototype: AsyncGenerator; +} + + +interface MathObject { + readonly E: number; + readonly PI: number; + readonly SQRT2: number; + readonly SQRT1_2: number; + readonly LN2: number; + readonly LN10: number; + readonly LOG2E: number; + readonly LOG10E: number; + + asin(x: number): number; + acos(x: number): number; + atan(x: number): number; + atan2(y: number, x: number): number; + asinh(x: number): number; + acosh(x: number): number; + atanh(x: number): number; + sin(x: number): number; + cos(x: number): number; + tan(x: number): number; + sinh(x: number): number; + cosh(x: number): number; + tanh(x: number): number; + sqrt(x: number): number; + cbrt(x: number): number; + hypot(...vals: number[]): number; + imul(a: number, b: number): number; + exp(x: number): number; + expm1(x: number): number; + pow(x: number, y: number): number; + log(x: number): number; + log10(x: number): number; + log1p(x: number): number; + log2(x: number): number; + ceil(x: number): number; + floor(x: number): number; + round(x: number): number; + fround(x: number): number; + trunc(x: number): number; + abs(x: number): number; + max(...vals: number[]): number; + min(...vals: number[]): number; + sign(x: number): number; + random(): number; + clz32(x: number): number; +} + +interface Array extends IterableIterator { + [i: number]: T; + + length: number; + + toString(): string; + // toLocaleString(): string; + join(separator?: string): string; + fill(val: T, start?: number, end?: number): T[]; + pop(): T | undefined; + push(...items: T[]): number; + concat(...items: (T | T[])[]): T[]; + concat(...items: (T | T[])[]): T[]; + join(separator?: string): string; + reverse(): T[]; + shift(): T | undefined; + slice(start?: number, end?: number): T[]; + sort(compareFn?: (a: T, b: T) => number): this; + splice(start: number, deleteCount?: number | undefined, ...items: T[]): T[]; + unshift(...items: T[]): number; + indexOf(searchElement: T, fromIndex?: number): number; + lastIndexOf(searchElement: T, fromIndex?: number): number; + every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; + some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + includes(el: any, start?: number): boolean; + + map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; + find(predicate: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; + findIndex(predicate: (value: T, index: number, array: T[]) => boolean, thisArg?: any): number; + findLast(predicate: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; + findLastIndex(predicate: (value: T, index: number, array: T[]) => boolean, thisArg?: any): number; + + flat(depth?: D): FlatArray; + flatMap(func: (val: T, i: number, arr: T[]) => T | T[], thisAarg?: any): FlatArray; + sort(func?: (a: T, b: T) => number): this; + + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + entries(): IterableIterator<[number, T]>; + values(): IterableIterator; + keys(): IterableIterator; +} +interface ArrayConstructor { + new (arrayLength?: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): arg is any[]; + prototype: Array; +} + +interface Boolean { + toString(): string; + valueOf(): boolean; +} +interface BooleanConstructor { + (val: any): boolean; + new (val: any): Boolean; + prototype: Boolean; +} + +interface Error { + name: string; + message: string; + stack: string[]; + toString(): string; +} +interface ErrorConstructor { + (msg?: any): Error; + new (msg?: any): Error; + prototype: Error; +} + +interface TypeErrorConstructor extends ErrorConstructor { + (msg?: any): TypeError; + new (msg?: any): TypeError; + prototype: Error; +} +interface TypeError extends Error { + name: 'TypeError'; +} + +interface RangeErrorConstructor extends ErrorConstructor { + (msg?: any): RangeError; + new (msg?: any): RangeError; + prototype: Error; +} +interface RangeError extends Error { + name: 'RangeError'; +} + +interface SyntaxErrorConstructor extends ErrorConstructor { + (msg?: any): RangeError; + new (msg?: any): RangeError; + prototype: Error; +} +interface SyntaxError extends Error { + name: 'SyntaxError'; +} + +interface Function { + apply(this: Function, thisArg: any, argArray?: any): any; + call(this: Function, thisArg: any, ...argArray: any[]): any; + bind(this: Function, thisArg: any, ...argArray: any[]): Function; + + toString(): string; + + prototype: any; + readonly length: number; + name: string; +} +interface CallableFunction extends Function { + (...args: any[]): any; + apply(this: (this: ThisArg, ...args: Args) => RetT, thisArg: ThisArg, argArray?: Args): RetT; + call(this: (this: ThisArg, ...args: Args) => RetT, thisArg: ThisArg, ...argArray: Args): RetT; + bind(this: (this: ThisArg, ...args: [ ...Args, ...Rest ]) => RetT, thisArg: ThisArg, ...argArray: Args): (this: void, ...args: Rest) => RetT; +} +interface NewableFunction extends Function { + new(...args: any[]): any; + apply(this: new (...args: Args) => RetT, thisArg: any, argArray?: Args): RetT; + call(this: new (...args: Args) => RetT, thisArg: any, ...argArray: Args): RetT; + bind(this: new (...args: Args) => RetT, thisArg: any, ...argArray: Args): new (...args: Args) => RetT; +} +interface FunctionConstructor extends Function { + (...args: string[]): (...args: any[]) => any; + new (...args: string[]): (...args: any[]) => any; + prototype: Function; + async( + func: (await: (val: T) => Awaited) => (...args: ArgsT) => RetT + ): (...args: ArgsT) => Promise; + asyncGenerator( + func: (await: (val: T) => Awaited, _yield: (val: T) => void) => (...args: ArgsT) => RetT + ): (...args: ArgsT) => AsyncGenerator; + generator( + func: (_yield: (val: T) => TNext) => (...args: ArgsT) => RetT + ): (...args: ArgsT) => Generator; +} + +interface Number { + toString(): string; + valueOf(): number; +} +interface NumberConstructor { + (val: any): number; + new (val: any): Number; + prototype: Number; + parseInt(val: unknown): number; + parseFloat(val: unknown): number; +} + +interface Object { + constructor: NewableFunction; + [Symbol.typeName]: string; + + valueOf(): this; + toString(): string; + hasOwnProperty(key: any): boolean; +} +interface ObjectConstructor { + (arg: string): String; + (arg: number): Number; + (arg: boolean): Boolean; + (arg?: undefined | null): {}; + (arg: T): T; + + new (arg: string): String; + new (arg: number): Number; + new (arg: boolean): Boolean; + new (arg?: undefined | null): {}; + new (arg: T): T; + + prototype: Object; + + assign(target: T, ...src: object[]): T; + create(proto: T, props?: { [key: string]: PropertyDescriptor }): T; + + keys(obj: T, onlyString?: true): (keyof T)[]; + keys(obj: T, onlyString: false): any[]; + entries(obj: T, onlyString?: true): [keyof T, T[keyof T]][]; + entries(obj: T, onlyString: false): [any, any][]; + values(obj: T, onlyString?: true): (T[keyof T])[]; + values(obj: T, onlyString: false): any[]; + + fromEntries(entries: Iterable<[any, any]>): object; + + defineProperty(obj: ThisT, key: any, desc: PropertyDescriptor): ThisT; + defineProperties(obj: ThisT, desc: { [key: string]: PropertyDescriptor }): ThisT; + + getOwnPropertyNames(obj: T): (keyof T)[]; + getOwnPropertySymbols(obj: T): (keyof T)[]; + hasOwn(obj: T, key: KeyT): boolean; + + getOwnPropertyDescriptor(obj: T, key: KeyT): PropertyDescriptor; + getOwnPropertyDescriptors(obj: T): { [x in keyof T]: PropertyDescriptor }; + + getPrototypeOf(obj: any): object | null; + setPrototypeOf(obj: T, proto: object | null): T; + + preventExtensions(obj: T): T; + seal(obj: T): T; + freeze(obj: T): T; + + isExtensible(obj: object): boolean; + isSealed(obj: object): boolean; + isFrozen(obj: object): boolean; +} + +interface String { + [i: number]: string; + + toString(): string; + valueOf(): string; + + charAt(pos: number): string; + charCodeAt(pos: number): number; + substring(start?: number, end?: number): string; + slice(start?: number, end?: number): string; + substr(start?: number, length?: number): string; + + startsWith(str: string, pos?: number): string; + endsWith(str: string, pos?: number): string; + + replace(pattern: string | Replacer, val: string | ReplaceFunc): string; + replaceAll(pattern: string | Replacer, val: string | ReplaceFunc): string; + + match(pattern: string | Matcher): RegExpResult | string[] | null; + matchAll(pattern: string | Matcher): IterableIterator; + + split(pattern: string | Splitter, limit?: number, sensible?: boolean): string; + + concat(...others: string[]): string; + indexOf(term: string | Searcher, start?: number): number; + lastIndexOf(term: string | Searcher, start?: number): number; + + toLowerCase(): string; + toUpperCase(): string; + + trim(): string; + + includes(term: string, start?: number): boolean; + + length: number; +} +interface StringConstructor { + (val: any): string; + new (val: any): String; + + fromCharCode(val: number): string; + + prototype: String; +} + +interface Symbol { + valueOf(): symbol; +} +interface SymbolConstructor { + (val?: any): symbol; + new(...args: any[]): never; + prototype: Symbol; + for(key: string): symbol; + keyFor(sym: symbol): string; + + readonly typeName: unique symbol; + readonly match: unique symbol; + readonly matchAll: unique symbol; + readonly split: unique symbol; + readonly replace: unique symbol; + readonly search: unique symbol; + readonly iterator: unique symbol; + readonly asyncIterator: unique symbol; +} + + +interface Promise extends Thenable { + catch(func: (err: unknown) => ResT): Promise; + finally(func: () => void): Promise; + constructor: PromiseConstructor; +} +interface PromiseConstructorLike { + new (func: (res: (val: T) => void, rej: (err: unknown) => void) => void): Thenable>; +} +interface PromiseConstructor extends PromiseConstructorLike { + prototype: Promise; + + new (func: (res: (val: T) => void, rej: (err: unknown) => void) => void): Promise>; + resolve(val: T): Promise>; + reject(val: any): Promise; + + isAwaitable(val: unknown): val is Thenable; + any(promises: T[]): Promise>; + race(promises: (Promise|T)[]): Promise; + all(promises: T): Promise<{ [Key in keyof T]: Awaited }>; + allSettled(...promises: T): Promise<[...{ [P in keyof T]: PromiseResult>}]>; +} + +interface FileStat { + type: 'file' | 'folder'; + mode: 'r' | 'rw'; +} +interface File { + readonly pointer: Promise; + readonly length: Promise; + readonly mode: Promise<'' | 'r' | 'rw'>; + + read(n: number): Promise; + write(buff: number[]): Promise; + close(): Promise; + setPointer(val: number): Promise; +} +interface Filesystem { + open(path: string, mode: 'r' | 'rw'): Promise; + ls(path: string): AsyncIterableIterator; + mkdir(path: string): Promise; + mkfile(path: string): Promise; + rm(path: string, recursive?: boolean): Promise; + stat(path: string): Promise; + exists(path: string): Promise; +} + +interface Encoding { + encode(val: string): number[]; + decode(val: number[]): string; +} + +declare var String: StringConstructor; +//@ts-ignore +declare const arguments: IArguments; +declare var NaN: number; +declare var Infinity: number; + +declare var setTimeout: (handle: (...args: [ ...T, ...any[] ]) => void, delay?: number, ...args: T) => number; +declare var setInterval: (handle: (...args: [ ...T, ...any[] ]) => void, delay?: number, ...args: T) => number; + +declare var clearTimeout: (id: number) => void; +declare var clearInterval: (id: number) => void; + +declare var parseInt: typeof Number.parseInt; +declare var parseFloat: typeof Number.parseFloat; + +declare function log(...vals: any[]): void; + +declare var Array: ArrayConstructor; +declare var Boolean: BooleanConstructor; +declare var Promise: PromiseConstructor; +declare var Function: FunctionConstructor; +declare var Number: NumberConstructor; +declare var Object: ObjectConstructor; +declare var Symbol: SymbolConstructor; +declare var Promise: PromiseConstructor; +declare var Math: MathObject; +declare var Encoding: Encoding; +declare var Filesystem: Filesystem; + +declare var Error: ErrorConstructor; +declare var RangeError: RangeErrorConstructor; +declare var TypeError: TypeErrorConstructor; +declare var SyntaxError: SyntaxErrorConstructor; +declare var self: typeof globalThis; + +declare class Map { + public [Symbol.iterator](): IterableIterator<[KeyT, ValueT]>; + + public clear(): void; + public delete(key: KeyT): boolean; + + public entries(): IterableIterator<[KeyT, ValueT]>; + public keys(): IterableIterator; + public values(): IterableIterator; + + public get(key: KeyT): ValueT; + public set(key: KeyT, val: ValueT): this; + public has(key: KeyT): boolean; + + public get size(): number; + + public forEach(func: (key: KeyT, val: ValueT, map: Map) => void, thisArg?: any): void; + + public constructor(); +} +declare class Set { + public [Symbol.iterator](): IterableIterator; + + public entries(): IterableIterator<[T, T]>; + public keys(): IterableIterator; + public values(): IterableIterator; + + public clear(): void; + + public add(val: T): this; + public delete(val: T): boolean; + public has(key: T): boolean; + + public get size(): number; + + public forEach(func: (key: T, set: Set) => void, thisArg?: any): void; + + public constructor(); +} + +declare class RegExp implements Matcher, Splitter, Replacer, Searcher { + static escape(raw: any, flags?: string): RegExp; + + prototype: RegExp; + + exec(val: string): RegExpResult | null; + test(val: string): boolean; + toString(): string; + + [Symbol.match](target: string): RegExpResult | string[] | null; + [Symbol.matchAll](target: string): IterableIterator; + [Symbol.split](target: string, limit?: number, sensible?: boolean): string[]; + [Symbol.replace](target: string, replacement: string | ReplaceFunc): string; + [Symbol.search](target: string, reverse?: boolean, start?: number): number; + + readonly dotAll: boolean; + readonly global: boolean; + readonly hasIndices: boolean; + readonly ignoreCase: boolean; + readonly multiline: boolean; + readonly sticky: boolean; + readonly unicode: boolean; + + readonly source: string; + readonly flags: string; + + lastIndex: number; + + constructor(pattern?: string, flags?: string); + constructor(pattern?: RegExp, flags?: string); +} From 078d7ed95f065727faed427ffe98a7afd5560682 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:26:42 +0200 Subject: [PATCH 05/20] refactor: improve Engine API --- src/me/topchetoeu/jscript/Main.java | 338 +++++++------- src/me/topchetoeu/jscript/engine/Context.java | 3 +- src/me/topchetoeu/jscript/engine/Engine.java | 8 +- .../jscript/engine/Environment.java | 4 +- .../jscript/engine/debug/SimpleDebugger.java | 2 +- src/me/topchetoeu/jscript/lib/Internals.java | 442 +++++++++--------- src/me/topchetoeu/jscript/lib/PromiseLib.java | 8 +- 7 files changed, 402 insertions(+), 403 deletions(-) diff --git a/src/me/topchetoeu/jscript/Main.java b/src/me/topchetoeu/jscript/Main.java index 2143316..db9211c 100644 --- a/src/me/topchetoeu/jscript/Main.java +++ b/src/me/topchetoeu/jscript/Main.java @@ -1,170 +1,168 @@ -package me.topchetoeu.jscript; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.nio.file.Files; -import java.nio.file.Path; - -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.Engine; -import me.topchetoeu.jscript.engine.Environment; -import me.topchetoeu.jscript.engine.debug.DebugServer; -import me.topchetoeu.jscript.engine.debug.SimpleDebugger; -import me.topchetoeu.jscript.engine.values.ArrayValue; -import me.topchetoeu.jscript.engine.values.NativeFunction; -import me.topchetoeu.jscript.engine.values.ObjectValue; -import me.topchetoeu.jscript.engine.values.Values; -import me.topchetoeu.jscript.events.Observer; -import me.topchetoeu.jscript.exceptions.EngineException; -import me.topchetoeu.jscript.exceptions.InterruptException; -import me.topchetoeu.jscript.exceptions.SyntaxException; -import me.topchetoeu.jscript.filesystem.MemoryFilesystem; -import me.topchetoeu.jscript.filesystem.Mode; -import me.topchetoeu.jscript.filesystem.PhysicalFilesystem; -import me.topchetoeu.jscript.lib.Internals; - -public class Main { - public static class Printer implements Observer { - public void next(Object data) { - Values.printValue(null, data); - System.out.println(); - } - - public void error(RuntimeException err) { - Values.printError(err, null); - } - - public void finish() { - engineTask.interrupt(); - } - } - - static Thread engineTask, debugTask; - static Engine engine = new Engine(true); - static DebugServer debugServer = new DebugServer(); - static Environment environment = new Environment(null, null, null); - - static int j = 0; - static boolean exited = false; - static String[] args; - - private static void reader() { - try { - for (var arg : args) { - try { - if (arg.equals("--ts")) initTypescript(); - else { - var file = Path.of(arg); - var raw = Files.readString(file); - var res = engine.pushMsg( - false, new Context(engine, environment), - Filename.fromFile(file.toFile()), - raw, null - ).await(); - Values.printValue(null, res); - System.out.println(); - } - } - catch (EngineException e) { Values.printError(e, null); } - } - for (var i = 0; ; i++) { - try { - var raw = Reading.read(); - - if (raw == null) break; - var res = engine.pushMsg( - false, new Context(engine, environment), - new Filename("jscript", "repl/" + i + ".js"), - raw, null - ).await(); - Values.printValue(null, res); - System.out.println(); - } - catch (EngineException e) { Values.printError(e, null); } - catch (SyntaxException e) { Values.printError(e, null); } - } - } - catch (IOException e) { - System.out.println(e.toString()); - exited = true; - } - catch (RuntimeException ex) { - if (!exited) { - System.out.println("Internal error ocurred:"); - ex.printStackTrace(); - } - } - if (exited) { - debugTask.interrupt(); - engineTask.interrupt(); - } - } - - private static void initEnv() { - environment = Internals.apply(environment); - - environment.global.define(false, new NativeFunction("exit", (_ctx, th, args) -> { - exited = true; - throw new InterruptException(); - })); - environment.global.define(false, new NativeFunction("go", (_ctx, th, args) -> { - try { - var f = Path.of("do.js"); - var func = _ctx.compile(new Filename("do", "do/" + j++ + ".js"), new String(Files.readAllBytes(f))); - return func.call(_ctx); - } - catch (IOException e) { - throw new EngineException("Couldn't open do.js"); - } - })); - - environment.filesystem.protocols.put("temp", new MemoryFilesystem(Mode.READ_WRITE)); - environment.filesystem.protocols.put("file", new PhysicalFilesystem(Path.of(".").toAbsolutePath())); - } - private static void initEngine() { - debugServer.targets.put("target", (ws, req) -> new SimpleDebugger(ws, engine)); - engineTask = engine.start(); - debugTask = debugServer.start(new InetSocketAddress("127.0.0.1", 9229), true); - } - private static void initTypescript() { - try { - var tsEnv = Internals.apply(new Environment(null, null, null)); - tsEnv.stackVisible = false; - tsEnv.global.define(null, "module", false, new ObjectValue()); - var bsEnv = Internals.apply(new Environment(null, null, null)); - bsEnv.stackVisible = false; - - engine.pushMsg( - false, new Context(engine, tsEnv), - new Filename("jscript", "ts.js"), - Reading.resourceToString("js/ts.js"), null - ).await(); - System.out.println("Loaded typescript!"); - - var ctx = new Context(engine, bsEnv); - - engine.pushMsg( - false, ctx, - new Filename("jscript", "bootstrap.js"), Reading.resourceToString("js/bootstrap.js"), null, - tsEnv.global.get(ctx, "ts"), environment, new ArrayValue(null, Reading.resourceToString("js/lib.d.ts")) - ).await(); - } - catch (EngineException e) { - Values.printError(e, "(while initializing TS)"); - } - } - - public static void main(String args[]) { - System.out.println(String.format("Running %s v%s by %s", Metadata.name(), Metadata.version(), Metadata.author())); - - Main.args = args; - var reader = new Thread(Main::reader); - - initEnv(); - initEngine(); - - reader.setDaemon(true); - reader.setName("STD Reader"); - reader.start(); - } -} +package me.topchetoeu.jscript; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.nio.file.Files; +import java.nio.file.Path; + +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.Engine; +import me.topchetoeu.jscript.engine.Environment; +import me.topchetoeu.jscript.engine.debug.DebugServer; +import me.topchetoeu.jscript.engine.debug.SimpleDebugger; +import me.topchetoeu.jscript.engine.values.ArrayValue; +import me.topchetoeu.jscript.engine.values.NativeFunction; +import me.topchetoeu.jscript.engine.values.ObjectValue; +import me.topchetoeu.jscript.engine.values.Values; +import me.topchetoeu.jscript.events.Observer; +import me.topchetoeu.jscript.exceptions.EngineException; +import me.topchetoeu.jscript.exceptions.InterruptException; +import me.topchetoeu.jscript.exceptions.SyntaxException; +import me.topchetoeu.jscript.filesystem.MemoryFilesystem; +import me.topchetoeu.jscript.filesystem.Mode; +import me.topchetoeu.jscript.filesystem.PhysicalFilesystem; +import me.topchetoeu.jscript.lib.Internals; + +public class Main { + public static class Printer implements Observer { + public void next(Object data) { + Values.printValue(null, data); + System.out.println(); + } + + public void error(RuntimeException err) { + Values.printError(err, null); + } + + public void finish() { + engineTask.interrupt(); + } + } + + static Thread engineTask, debugTask; + static Engine engine = new Engine(true); + static DebugServer debugServer = new DebugServer(); + static Environment environment = new Environment(null, null, null); + + static int j = 0; + static boolean exited = false; + static String[] args; + + private static void reader() { + try { + for (var arg : args) { + try { + if (arg.equals("--ts")) initTypescript(); + else { + var file = Path.of(arg); + var raw = Files.readString(file); + var res = engine.pushMsg( + false, environment, + Filename.fromFile(file.toFile()), + raw, null + ).await(); + Values.printValue(null, res); + System.out.println(); + } + } + catch (EngineException e) { Values.printError(e, null); } + } + for (var i = 0; ; i++) { + try { + var raw = Reading.read(); + + if (raw == null) break; + var res = engine.pushMsg( + false, environment, + new Filename("jscript", "repl/" + i + ".js"), + raw, null + ).await(); + Values.printValue(null, res); + System.out.println(); + } + catch (EngineException e) { Values.printError(e, null); } + catch (SyntaxException e) { Values.printError(e, null); } + } + } + catch (IOException e) { + System.out.println(e.toString()); + exited = true; + } + catch (RuntimeException ex) { + if (!exited) { + System.out.println("Internal error ocurred:"); + ex.printStackTrace(); + } + } + if (exited) { + debugTask.interrupt(); + engineTask.interrupt(); + } + } + + private static void initEnv() { + environment = Internals.apply(environment); + + environment.global.define(false, new NativeFunction("exit", (_ctx, th, args) -> { + exited = true; + throw new InterruptException(); + })); + environment.global.define(false, new NativeFunction("go", (_ctx, th, args) -> { + try { + var f = Path.of("do.js"); + var func = _ctx.compile(new Filename("do", "do/" + j++ + ".js"), new String(Files.readAllBytes(f))); + return func.call(_ctx); + } + catch (IOException e) { + throw new EngineException("Couldn't open do.js"); + } + })); + + environment.filesystem.protocols.put("temp", new MemoryFilesystem(Mode.READ_WRITE)); + environment.filesystem.protocols.put("file", new PhysicalFilesystem(Path.of(".").toAbsolutePath())); + } + private static void initEngine() { + debugServer.targets.put("target", (ws, req) -> new SimpleDebugger(ws, engine)); + engineTask = engine.start(); + debugTask = debugServer.start(new InetSocketAddress("127.0.0.1", 9229), true); + } + private static void initTypescript() { + try { + var tsEnv = Internals.apply(new Environment(null, null, null)); + tsEnv.stackVisible = false; + tsEnv.global.define(null, "module", false, new ObjectValue()); + var bsEnv = Internals.apply(new Environment(null, null, null)); + bsEnv.stackVisible = false; + + engine.pushMsg( + false, tsEnv, + new Filename("jscript", "ts.js"), + Reading.resourceToString("js/ts.js"), null + ).await(); + System.out.println("Loaded typescript!"); + + engine.pushMsg( + false, bsEnv, + new Filename("jscript", "bootstrap.js"), Reading.resourceToString("js/bootstrap.js"), null, + tsEnv.global.get(new Context(engine, bsEnv), "ts"), environment, new ArrayValue(null, Reading.resourceToString("js/lib.d.ts")) + ).await(); + } + catch (EngineException e) { + Values.printError(e, "(while initializing TS)"); + } + } + + public static void main(String args[]) { + System.out.println(String.format("Running %s v%s by %s", Metadata.name(), Metadata.version(), Metadata.author())); + + Main.args = args; + var reader = new Thread(Main::reader); + + initEnv(); + initEngine(); + + reader.setDaemon(true); + reader.setName("STD Reader"); + reader.start(); + } +} diff --git a/src/me/topchetoeu/jscript/engine/Context.java b/src/me/topchetoeu/jscript/engine/Context.java index 0a0ecab..3872541 100644 --- a/src/me/topchetoeu/jscript/engine/Context.java +++ b/src/me/topchetoeu/jscript/engine/Context.java @@ -119,7 +119,6 @@ public class Context { } public Context(Engine engine, Environment env) { this(engine); - this.pushEnv(env); - + if (env != null) this.pushEnv(env); } } diff --git a/src/me/topchetoeu/jscript/engine/Engine.java b/src/me/topchetoeu/jscript/engine/Engine.java index 320585e..50ff0d3 100644 --- a/src/me/topchetoeu/jscript/engine/Engine.java +++ b/src/me/topchetoeu/jscript/engine/Engine.java @@ -141,13 +141,13 @@ public class Engine implements DebugController { return this.thread != null; } - public Awaitable pushMsg(boolean micro, Context ctx, FunctionValue func, Object thisArg, Object ...args) { - var msg = new Task(ctx == null ? new Context(this) : ctx, func, thisArg, args, micro); + public Awaitable pushMsg(boolean micro, Environment env, FunctionValue func, Object thisArg, Object ...args) { + var msg = new Task(new Context(this, env), func, thisArg, args, micro); tasks.add(msg); return msg.notifier; } - public Awaitable pushMsg(boolean micro, Context ctx, Filename filename, String raw, Object thisArg, Object ...args) { - return pushMsg(micro, ctx, new UncompiledFunction(filename, raw), thisArg, args); + public Awaitable pushMsg(boolean micro, Environment env, Filename filename, String raw, Object thisArg, Object ...args) { + return pushMsg(micro, env, new UncompiledFunction(filename, raw), thisArg, args); } @Override diff --git a/src/me/topchetoeu/jscript/engine/Environment.java b/src/me/topchetoeu/jscript/engine/Environment.java index f55c165..da6a868 100644 --- a/src/me/topchetoeu/jscript/engine/Environment.java +++ b/src/me/topchetoeu/jscript/engine/Environment.java @@ -53,7 +53,6 @@ public class Environment implements PermissionsProvider { res.defineProperty(ctx, "function", target.func(env)); res.defineProperty(ctx, "mapChain", new ArrayValue()); - if (isDebug) { res.defineProperty(ctx, "breakpoints", ArrayValue.of(ctx, target.breakpoints.stream().map(Location::toString).collect(Collectors.toList()))); } @@ -128,4 +127,7 @@ public class Environment implements PermissionsProvider { this.wrappers = nativeConverter; this.global = global; } + public Environment() { + this(null, null, null); + } } diff --git a/src/me/topchetoeu/jscript/engine/debug/SimpleDebugger.java b/src/me/topchetoeu/jscript/engine/debug/SimpleDebugger.java index 136096f..d2989b3 100644 --- a/src/me/topchetoeu/jscript/engine/debug/SimpleDebugger.java +++ b/src/me/topchetoeu/jscript/engine/debug/SimpleDebugger.java @@ -483,7 +483,7 @@ public class SimpleDebugger implements Debugger { env.global = new GlobalScope(codeFrame.local); var ctx = new Context(engine).pushEnv(env); - var awaiter = engine.pushMsg(false, ctx, new Filename("jscript", "eval"), code, codeFrame.frame.thisArg, codeFrame.frame.args); + var awaiter = engine.pushMsg(false, ctx.environment(), new Filename("jscript", "eval"), code, codeFrame.frame.thisArg, codeFrame.frame.args); engine.run(true); diff --git a/src/me/topchetoeu/jscript/lib/Internals.java b/src/me/topchetoeu/jscript/lib/Internals.java index 5a199a1..2bc6a26 100644 --- a/src/me/topchetoeu/jscript/lib/Internals.java +++ b/src/me/topchetoeu/jscript/lib/Internals.java @@ -1,221 +1,221 @@ -package me.topchetoeu.jscript.lib; - -import java.io.IOException; -import java.util.HashMap; - -import me.topchetoeu.jscript.Buffer; -import me.topchetoeu.jscript.Reading; -import me.topchetoeu.jscript.engine.Context; -import me.topchetoeu.jscript.engine.DataKey; -import me.topchetoeu.jscript.engine.Environment; -import me.topchetoeu.jscript.engine.scope.GlobalScope; -import me.topchetoeu.jscript.engine.values.FunctionValue; -import me.topchetoeu.jscript.engine.values.Values; -import me.topchetoeu.jscript.exceptions.EngineException; -import me.topchetoeu.jscript.interop.Native; -import me.topchetoeu.jscript.interop.NativeGetter; -import me.topchetoeu.jscript.parsing.Parsing; - -public class Internals { - private static final DataKey> THREADS = new DataKey<>(); - private static final DataKey I = new DataKey<>(); - - - @Native public static Object log(Context ctx, Object ...args) { - for (var arg : args) { - Values.printValue(ctx, arg); - System.out.print(" "); - } - System.out.println(); - - if (args.length == 0) return null; - else return args[0]; - } - @Native public static String readline(Context ctx) { - try { - return Reading.read(); - } - catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - @Native public static int setTimeout(Context ctx, FunctionValue func, int delay, Object ...args) { - var thread = new Thread(() -> { - var ms = (long)delay; - var ns = (int)((delay - ms) * 10000000); - - try { - Thread.sleep(ms, ns); - } - catch (InterruptedException e) { return; } - - ctx.engine.pushMsg(false, ctx, func, null, args); - }); - thread.start(); - - int i = ctx.environment().data.increase(I, 1, 0); - var threads = ctx.environment().data.get(THREADS, new HashMap<>()); - threads.put(++i, thread); - return i; - } - @Native public static int setInterval(Context ctx, FunctionValue func, int delay, Object ...args) { - var thread = new Thread(() -> { - var ms = (long)delay; - var ns = (int)((delay - ms) * 10000000); - - while (true) { - try { - Thread.sleep(ms, ns); - } - catch (InterruptedException e) { return; } - - ctx.engine.pushMsg(false, ctx, func, null, args); - } - }); - thread.start(); - - int i = ctx.environment().data.increase(I, 1, 0); - var threads = ctx.environment().data.get(THREADS, new HashMap<>()); - threads.put(++i, thread); - return i; - } - - @Native public static void clearTimeout(Context ctx, int i) { - var threads = ctx.environment().data.get(THREADS, new HashMap<>()); - - var thread = threads.remove(i); - if (thread != null) thread.interrupt(); - } - @Native public static void clearInterval(Context ctx, int i) { - clearTimeout(ctx, i); - } - - @Native public static double parseInt(Context ctx, String val) { - return NumberLib.parseInt(ctx, val); - } - @Native public static double parseFloat(Context ctx, String val) { - return NumberLib.parseFloat(ctx, val); - } - - @Native public static boolean isNaN(Context ctx, double val) { - return NumberLib.isNaN(ctx, val); - } - @Native public static boolean isFinite(Context ctx, double val) { - return NumberLib.isFinite(ctx, val); - } - @Native public static boolean isInfinite(Context ctx, double val) { - return NumberLib.isInfinite(ctx, val); - } - - @NativeGetter public static double NaN(Context ctx) { - return Double.NaN; - } - @NativeGetter public static double Infinity(Context ctx) { - return Double.POSITIVE_INFINITY; - } - private static final String HEX = "0123456789ABCDEF"; - - private static String encodeUriAny(String str, String keepAlphabet) { - if (str == null) str = "undefined"; - - var bytes = str.getBytes(); - var sb = new StringBuilder(bytes.length); - - for (byte c : bytes) { - if (Parsing.isAlphanumeric((char)c) || Parsing.isAny((char)c, keepAlphabet)) sb.append((char)c); - else { - sb.append('%'); - sb.append(HEX.charAt(c / 16)); - sb.append(HEX.charAt(c % 16)); - } - } - - return sb.toString(); - } - private static String decodeUriAny(String str, String keepAlphabet) { - if (str == null) str = "undefined"; - - var res = new Buffer(); - var bytes = str.getBytes(); - - for (var i = 0; i < bytes.length; i++) { - var c = bytes[i]; - if (c == '%') { - if (i >= bytes.length - 2) throw EngineException.ofError("URIError", "URI malformed."); - var b = Parsing.fromHex((char)bytes[i + 1]) * 16 | Parsing.fromHex((char)bytes[i + 2]); - if (!Parsing.isAny((char)b, keepAlphabet)) { - i += 2; - res.append((byte)b); - continue; - } - } - res.append(c); - } - - return new String(res.data()); - } - - @Native public static String encodeURIComponent(String str) { - return encodeUriAny(str, ".-_!~*'()"); - } - @Native public static String decodeURIComponent(String str) { - return decodeUriAny(str, ""); - } - @Native public static String encodeURI(String str) { - return encodeUriAny(str, ";,/?:@&=+$#.-_!~*'()"); - } - @Native public static String decodeURI(String str) { - return decodeUriAny(str, ",/?:@&=+$#."); - } - - public static Environment apply(Environment env) { - var wp = env.wrappers; - var glob = env.global = new GlobalScope(wp.getNamespace(Internals.class)); - - glob.define(null, "Math", false, wp.getNamespace(MathLib.class)); - glob.define(null, "JSON", false, wp.getNamespace(JSONLib.class)); - glob.define(null, "Encoding", false, wp.getNamespace(EncodingLib.class)); - glob.define(null, "Filesystem", false, wp.getNamespace(FilesystemLib.class)); - - glob.define(false, wp.getConstr(DateLib.class)); - glob.define(false, wp.getConstr(ObjectLib.class)); - glob.define(false, wp.getConstr(FunctionLib.class)); - glob.define(false, wp.getConstr(ArrayLib.class)); - - glob.define(false, wp.getConstr(BooleanLib.class)); - glob.define(false, wp.getConstr(NumberLib.class)); - glob.define(false, wp.getConstr(StringLib.class)); - glob.define(false, wp.getConstr(SymbolLib.class)); - - glob.define(false, wp.getConstr(PromiseLib.class)); - glob.define(false, wp.getConstr(RegExpLib.class)); - glob.define(false, wp.getConstr(MapLib.class)); - glob.define(false, wp.getConstr(SetLib.class)); - - glob.define(false, wp.getConstr(ErrorLib.class)); - glob.define(false, wp.getConstr(SyntaxErrorLib.class)); - glob.define(false, wp.getConstr(TypeErrorLib.class)); - glob.define(false, wp.getConstr(RangeErrorLib.class)); - - env.setProto("object", wp.getProto(ObjectLib.class)); - env.setProto("function", wp.getProto(FunctionLib.class)); - env.setProto("array", wp.getProto(ArrayLib.class)); - - env.setProto("bool", wp.getProto(BooleanLib.class)); - env.setProto("number", wp.getProto(NumberLib.class)); - env.setProto("string", wp.getProto(StringLib.class)); - env.setProto("symbol", wp.getProto(SymbolLib.class)); - - env.setProto("error", wp.getProto(ErrorLib.class)); - env.setProto("syntaxErr", wp.getProto(SyntaxErrorLib.class)); - env.setProto("typeErr", wp.getProto(TypeErrorLib.class)); - env.setProto("rangeErr", wp.getProto(RangeErrorLib.class)); - - wp.getProto(ObjectLib.class).setPrototype(null, null); - env.regexConstructor = wp.getConstr(RegExpLib.class); - - return env; - } -} +package me.topchetoeu.jscript.lib; + +import java.io.IOException; +import java.util.HashMap; + +import me.topchetoeu.jscript.Buffer; +import me.topchetoeu.jscript.Reading; +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.DataKey; +import me.topchetoeu.jscript.engine.Environment; +import me.topchetoeu.jscript.engine.scope.GlobalScope; +import me.topchetoeu.jscript.engine.values.FunctionValue; +import me.topchetoeu.jscript.engine.values.Values; +import me.topchetoeu.jscript.exceptions.EngineException; +import me.topchetoeu.jscript.interop.Native; +import me.topchetoeu.jscript.interop.NativeGetter; +import me.topchetoeu.jscript.parsing.Parsing; + +public class Internals { + private static final DataKey> THREADS = new DataKey<>(); + private static final DataKey I = new DataKey<>(); + + + @Native public static Object log(Context ctx, Object ...args) { + for (var arg : args) { + Values.printValue(ctx, arg); + System.out.print(" "); + } + System.out.println(); + + if (args.length == 0) return null; + else return args[0]; + } + @Native public static String readline(Context ctx) { + try { + return Reading.read(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + @Native public static int setTimeout(Context ctx, FunctionValue func, int delay, Object ...args) { + var thread = new Thread(() -> { + var ms = (long)delay; + var ns = (int)((delay - ms) * 10000000); + + try { + Thread.sleep(ms, ns); + } + catch (InterruptedException e) { return; } + + ctx.engine.pushMsg(false, ctx.environment(), func, null, args); + }); + thread.start(); + + int i = ctx.environment().data.increase(I, 1, 0); + var threads = ctx.environment().data.get(THREADS, new HashMap<>()); + threads.put(++i, thread); + return i; + } + @Native public static int setInterval(Context ctx, FunctionValue func, int delay, Object ...args) { + var thread = new Thread(() -> { + var ms = (long)delay; + var ns = (int)((delay - ms) * 10000000); + + while (true) { + try { + Thread.sleep(ms, ns); + } + catch (InterruptedException e) { return; } + + ctx.engine.pushMsg(false, ctx.environment(), func, null, args); + } + }); + thread.start(); + + int i = ctx.environment().data.increase(I, 1, 0); + var threads = ctx.environment().data.get(THREADS, new HashMap<>()); + threads.put(++i, thread); + return i; + } + + @Native public static void clearTimeout(Context ctx, int i) { + var threads = ctx.environment().data.get(THREADS, new HashMap<>()); + + var thread = threads.remove(i); + if (thread != null) thread.interrupt(); + } + @Native public static void clearInterval(Context ctx, int i) { + clearTimeout(ctx, i); + } + + @Native public static double parseInt(Context ctx, String val) { + return NumberLib.parseInt(ctx, val); + } + @Native public static double parseFloat(Context ctx, String val) { + return NumberLib.parseFloat(ctx, val); + } + + @Native public static boolean isNaN(Context ctx, double val) { + return NumberLib.isNaN(ctx, val); + } + @Native public static boolean isFinite(Context ctx, double val) { + return NumberLib.isFinite(ctx, val); + } + @Native public static boolean isInfinite(Context ctx, double val) { + return NumberLib.isInfinite(ctx, val); + } + + @NativeGetter public static double NaN(Context ctx) { + return Double.NaN; + } + @NativeGetter public static double Infinity(Context ctx) { + return Double.POSITIVE_INFINITY; + } + private static final String HEX = "0123456789ABCDEF"; + + private static String encodeUriAny(String str, String keepAlphabet) { + if (str == null) str = "undefined"; + + var bytes = str.getBytes(); + var sb = new StringBuilder(bytes.length); + + for (byte c : bytes) { + if (Parsing.isAlphanumeric((char)c) || Parsing.isAny((char)c, keepAlphabet)) sb.append((char)c); + else { + sb.append('%'); + sb.append(HEX.charAt(c / 16)); + sb.append(HEX.charAt(c % 16)); + } + } + + return sb.toString(); + } + private static String decodeUriAny(String str, String keepAlphabet) { + if (str == null) str = "undefined"; + + var res = new Buffer(); + var bytes = str.getBytes(); + + for (var i = 0; i < bytes.length; i++) { + var c = bytes[i]; + if (c == '%') { + if (i >= bytes.length - 2) throw EngineException.ofError("URIError", "URI malformed."); + var b = Parsing.fromHex((char)bytes[i + 1]) * 16 | Parsing.fromHex((char)bytes[i + 2]); + if (!Parsing.isAny((char)b, keepAlphabet)) { + i += 2; + res.append((byte)b); + continue; + } + } + res.append(c); + } + + return new String(res.data()); + } + + @Native public static String encodeURIComponent(String str) { + return encodeUriAny(str, ".-_!~*'()"); + } + @Native public static String decodeURIComponent(String str) { + return decodeUriAny(str, ""); + } + @Native public static String encodeURI(String str) { + return encodeUriAny(str, ";,/?:@&=+$#.-_!~*'()"); + } + @Native public static String decodeURI(String str) { + return decodeUriAny(str, ",/?:@&=+$#."); + } + + public static Environment apply(Environment env) { + var wp = env.wrappers; + var glob = env.global = new GlobalScope(wp.getNamespace(Internals.class)); + + glob.define(null, "Math", false, wp.getNamespace(MathLib.class)); + glob.define(null, "JSON", false, wp.getNamespace(JSONLib.class)); + glob.define(null, "Encoding", false, wp.getNamespace(EncodingLib.class)); + glob.define(null, "Filesystem", false, wp.getNamespace(FilesystemLib.class)); + + glob.define(false, wp.getConstr(DateLib.class)); + glob.define(false, wp.getConstr(ObjectLib.class)); + glob.define(false, wp.getConstr(FunctionLib.class)); + glob.define(false, wp.getConstr(ArrayLib.class)); + + glob.define(false, wp.getConstr(BooleanLib.class)); + glob.define(false, wp.getConstr(NumberLib.class)); + glob.define(false, wp.getConstr(StringLib.class)); + glob.define(false, wp.getConstr(SymbolLib.class)); + + glob.define(false, wp.getConstr(PromiseLib.class)); + glob.define(false, wp.getConstr(RegExpLib.class)); + glob.define(false, wp.getConstr(MapLib.class)); + glob.define(false, wp.getConstr(SetLib.class)); + + glob.define(false, wp.getConstr(ErrorLib.class)); + glob.define(false, wp.getConstr(SyntaxErrorLib.class)); + glob.define(false, wp.getConstr(TypeErrorLib.class)); + glob.define(false, wp.getConstr(RangeErrorLib.class)); + + env.setProto("object", wp.getProto(ObjectLib.class)); + env.setProto("function", wp.getProto(FunctionLib.class)); + env.setProto("array", wp.getProto(ArrayLib.class)); + + env.setProto("bool", wp.getProto(BooleanLib.class)); + env.setProto("number", wp.getProto(NumberLib.class)); + env.setProto("string", wp.getProto(StringLib.class)); + env.setProto("symbol", wp.getProto(SymbolLib.class)); + + env.setProto("error", wp.getProto(ErrorLib.class)); + env.setProto("syntaxErr", wp.getProto(SyntaxErrorLib.class)); + env.setProto("typeErr", wp.getProto(TypeErrorLib.class)); + env.setProto("rangeErr", wp.getProto(RangeErrorLib.class)); + + wp.getProto(ObjectLib.class).setPrototype(null, null); + env.regexConstructor = wp.getConstr(RegExpLib.class); + + return env; + } +} diff --git a/src/me/topchetoeu/jscript/lib/PromiseLib.java b/src/me/topchetoeu/jscript/lib/PromiseLib.java index 6e76872..66f5191 100644 --- a/src/me/topchetoeu/jscript/lib/PromiseLib.java +++ b/src/me/topchetoeu/jscript/lib/PromiseLib.java @@ -253,7 +253,7 @@ import me.topchetoeu.jscript.interop.Native; this.val = val; this.state = STATE_FULFILLED; - ctx.engine.pushMsg(true, ctx, new NativeFunction((_ctx, _thisArg, _args) -> { + ctx.engine.pushMsg(true, ctx.environment(), new NativeFunction((_ctx, _thisArg, _args) -> { for (var handle : handles) { handle.fulfilled.call(handle.ctx, null, val); } @@ -288,7 +288,7 @@ import me.topchetoeu.jscript.interop.Native; this.val = val; this.state = STATE_REJECTED; - ctx.engine.pushMsg(true, ctx, new NativeFunction((_ctx, _thisArg, _args) -> { + ctx.engine.pushMsg(true, ctx.environment(), new NativeFunction((_ctx, _thisArg, _args) -> { for (var handle : handles) handle.rejected.call(handle.ctx, null, val); if (!handled) { Values.printError(new EngineException(val).setCtx(ctx.environment(), ctx.engine), "(in promise)"); @@ -305,9 +305,9 @@ import me.topchetoeu.jscript.interop.Native; } private void handle(Context ctx, FunctionValue fulfill, FunctionValue reject) { - if (state == STATE_FULFILLED) ctx.engine.pushMsg(true, ctx, fulfill, null, val); + if (state == STATE_FULFILLED) ctx.engine.pushMsg(true, ctx.environment(), fulfill, null, val); else if (state == STATE_REJECTED) { - ctx.engine.pushMsg(true, ctx, reject, null, val); + ctx.engine.pushMsg(true, ctx.environment(), reject, null, val); handled = true; } else handles.add(new Handle(ctx, fulfill, reject)); From 1b2068a274587d81f2b5d2da3fba81f79f63eb9c Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:27:00 +0200 Subject: [PATCH 06/20] fix: never-ending try-catch issues --- src/me/topchetoeu/jscript/engine/frame/CodeFrame.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/me/topchetoeu/jscript/engine/frame/CodeFrame.java b/src/me/topchetoeu/jscript/engine/frame/CodeFrame.java index fe60b3d..e4411ce 100644 --- a/src/me/topchetoeu/jscript/engine/frame/CodeFrame.java +++ b/src/me/topchetoeu/jscript/engine/frame/CodeFrame.java @@ -254,6 +254,7 @@ public class CodeFrame { break; } else { + popTryFlag = false; if (tryCtx.state == TryState.CATCH) scope.catchVars.remove(scope.catchVars.size() - 1); if (tryCtx.state != TryState.FINALLY && tryCtx.hasFinally()) { From 7a301eba8f94024538b05f5ae4108de76da70379 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:27:27 +0200 Subject: [PATCH 07/20] fix: some stupid mistakes in FS --- .../topchetoeu/jscript/filesystem/File.java | 80 +++++++++---------- .../jscript/filesystem/PhysicalFile.java | 6 +- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/me/topchetoeu/jscript/filesystem/File.java b/src/me/topchetoeu/jscript/filesystem/File.java index 6e7f24a..f6e625a 100644 --- a/src/me/topchetoeu/jscript/filesystem/File.java +++ b/src/me/topchetoeu/jscript/filesystem/File.java @@ -1,41 +1,41 @@ -package me.topchetoeu.jscript.filesystem; - -import me.topchetoeu.jscript.Buffer; - -public interface File { - int read(byte[] buff); - void write(byte[] buff); - long getPtr(); - void setPtr(long offset, int pos); - void close(); - Mode mode(); - - default String readToString() { - setPtr(0, 2); - long len = getPtr(); - if (len < 0) return null; - - setPtr(0, 0); - - byte[] res = new byte[(int)len]; - read(res); - - return new String(res); - } - default String readLine() { - var res = new Buffer(); - var buff = new byte[1]; - - while (true) { - if (read(buff) == 0) { - if (res.length() == 0) return null; - else break; - } - - if (buff[0] == '\n') break; - - res.write(res.length(), buff); - } - return new String(res.data()); - } +package me.topchetoeu.jscript.filesystem; + +import me.topchetoeu.jscript.Buffer; + +public interface File { + int read(byte[] buff); + void write(byte[] buff); + long getPtr(); + void setPtr(long offset, int pos); + void close(); + Mode mode(); + + default String readToString() { + setPtr(0, 2); + long len = getPtr(); + if (len < 0) return null; + + setPtr(0, 0); + + byte[] res = new byte[(int)len]; + len = read(res); + + return new String(res); + } + default String readLine() { + var res = new Buffer(); + var buff = new byte[1]; + + while (true) { + if (read(buff) == 0) { + if (res.length() == 0) return null; + else break; + } + + if (buff[0] == '\n') break; + + res.write(res.length(), buff); + } + return new String(res.data()); + } } \ No newline at end of file diff --git a/src/me/topchetoeu/jscript/filesystem/PhysicalFile.java b/src/me/topchetoeu/jscript/filesystem/PhysicalFile.java index 5fba05e..0514e0e 100644 --- a/src/me/topchetoeu/jscript/filesystem/PhysicalFile.java +++ b/src/me/topchetoeu/jscript/filesystem/PhysicalFile.java @@ -35,9 +35,9 @@ public class PhysicalFile implements File { if (file == null || !perms.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); try { - if (pos == 1) pos += file.getFilePointer(); - else if (pos == 2) pos += file.length(); - file.seek(pos); + if (pos == 1) offset += file.getFilePointer(); + else if (pos == 2) offset += file.length(); + file.seek(offset); } catch (IOException e) { throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); } } From 797585f53959e109327a91d0692cc06bfa374d8e Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:28:12 +0200 Subject: [PATCH 08/20] feat: implement some stdlib functions --- src/me/topchetoeu/jscript/lib/StringLib.java | 21 +++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/me/topchetoeu/jscript/lib/StringLib.java b/src/me/topchetoeu/jscript/lib/StringLib.java index eaee54b..23a5359 100644 --- a/src/me/topchetoeu/jscript/lib/StringLib.java +++ b/src/me/topchetoeu/jscript/lib/StringLib.java @@ -57,19 +57,16 @@ import me.topchetoeu.jscript.interop.NativeGetter; @Native(thisArg = true) public static String charAt(Context ctx, Object thisArg, int i) { return passThis(ctx, "charAt", thisArg).charAt(i) + ""; } - // @Native(thisArg = true) public static int charCodeAt(Context ctx, Object thisArg, int i) { - // return passThis(ctx, "charCodeAt", thisArg).charAt(i); - // } - // @Native(thisArg = true) public static String charAt(Context ctx, Object thisArg, int i) { - // var str = passThis(ctx, "charAt", thisArg); - // if (i < 0 || i >= str.length()) return ""; - // else return str.charAt(i) + ""; - // } @Native(thisArg = true) public static double charCodeAt(Context ctx, Object thisArg, int i) { var str = passThis(ctx, "charCodeAt", thisArg); if (i < 0 || i >= str.length()) return Double.NaN; else return str.charAt(i); } + @Native(thisArg = true) public static double codePointAt(Context ctx, Object thisArg, int i) { + var str = passThis(ctx, "codePointAt", thisArg); + if (i < 0 || i >= str.length()) return Double.NaN; + else return str.codePointAt(i); + } @Native(thisArg = true) public static boolean startsWith(Context ctx, Object thisArg, String term, int pos) { return passThis(ctx, "startsWith", thisArg).startsWith(term, pos); @@ -105,7 +102,7 @@ import me.topchetoeu.jscript.interop.NativeGetter; } @Native(thisArg = true) public static boolean includes(Context ctx, Object thisArg, Object term, int pos) { - return lastIndexOf(ctx, passThis(ctx, "includes", thisArg), term, pos) >= 0; + return indexOf(ctx, passThis(ctx, "includes", thisArg), term, pos) >= 0; } @Native(thisArg = true) public static String replace(Context ctx, Object thisArg, Object term, Object replacement) { @@ -238,6 +235,12 @@ import me.topchetoeu.jscript.interop.NativeGetter; @Native(thisArg = true) public static String trim(Context ctx, Object thisArg) { return passThis(ctx, "trim", thisArg).trim(); } + @Native(thisArg = true) public static String trimStart(Context ctx, Object thisArg) { + return passThis(ctx, "trimStart", thisArg).replaceAll("^\\s+", ""); + } + @Native(thisArg = true) public static String trimEnd(Context ctx, Object thisArg) { + return passThis(ctx, "trimEnd", thisArg).replaceAll("\\s+$", ""); + } @NativeConstructor(thisArg = true) public static Object constructor(Context ctx, Object thisArg, Object val) { val = Values.toString(ctx, val); From 3d275c52c036e0e821bc5a2e8e23875047ab226b Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:30:31 +0200 Subject: [PATCH 09/20] refactor: fix code to not result in compile warning --- src/me/topchetoeu/jscript/parsing/ParseRes.java | 3 +++ src/me/topchetoeu/jscript/parsing/Parsing.java | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/me/topchetoeu/jscript/parsing/ParseRes.java b/src/me/topchetoeu/jscript/parsing/ParseRes.java index 0d79c03..e69f04e 100644 --- a/src/me/topchetoeu/jscript/parsing/ParseRes.java +++ b/src/me/topchetoeu/jscript/parsing/ParseRes.java @@ -69,6 +69,9 @@ public class ParseRes { @SafeVarargs public static ParseRes any(ParseRes ...parsers) { + return any(List.of(parsers)); + } + public static ParseRes any(List> parsers) { ParseRes best = null; ParseRes error = ParseRes.failed(); diff --git a/src/me/topchetoeu/jscript/parsing/Parsing.java b/src/me/topchetoeu/jscript/parsing/Parsing.java index 8226029..6131677 100644 --- a/src/me/topchetoeu/jscript/parsing/Parsing.java +++ b/src/me/topchetoeu/jscript/parsing/Parsing.java @@ -216,8 +216,10 @@ public class Parsing { currToken.append(c); continue; case CURR_SCIENTIFIC_NOT: - if (c == '-') currStage = CURR_NEG_SCIENTIFIC_NOT; - else if (!isDigit(c)) { + if (c == '-') { + if (currToken.toString().endsWith("e")) currStage = CURR_NEG_SCIENTIFIC_NOT; + } + if (currStage == CURR_SCIENTIFIC_NOT && !isDigit(c)) { i--; start--; break; } @@ -565,7 +567,8 @@ public class Parsing { } private static double parseNumber(Location loc, String value) { var res = parseNumber(false, value); - if (res == null) throw new SyntaxException(loc, "Invalid number format."); + if (res == null) + throw new SyntaxException(loc, "Invalid number format."); else return res; } @@ -1022,9 +1025,8 @@ public class Parsing { return ParseRes.res(res.result, n); } - @SuppressWarnings("all") public static ParseRes parseSimple(Filename filename, List tokens, int i, boolean statement) { - var res = new ArrayList<>(); + var res = new ArrayList>(); if (!statement) { res.add(parseObject(filename, tokens, i)); @@ -1047,7 +1049,7 @@ public class Parsing { parseDelete(filename, tokens, i) )); - return ParseRes.any(res.toArray(ParseRes[]::new)); + return ParseRes.any(res); } public static ParseRes parseVariable(Filename filename, List tokens, int i) { From 90da2db1fb4499d8241b30e0136f8105cd4e15d3 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:30:48 +0200 Subject: [PATCH 10/20] fix: error now is not null-prototyped --- src/me/topchetoeu/jscript/interop/NativeWrapperProvider.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/me/topchetoeu/jscript/interop/NativeWrapperProvider.java b/src/me/topchetoeu/jscript/interop/NativeWrapperProvider.java index f3045b7..0d02d9b 100644 --- a/src/me/topchetoeu/jscript/interop/NativeWrapperProvider.java +++ b/src/me/topchetoeu/jscript/interop/NativeWrapperProvider.java @@ -267,14 +267,12 @@ public class NativeWrapperProvider implements WrappersProvider { else return null; })); proto.defineProperty(null, "name", new NativeFunction("name", (ctx, thisArg, args) -> getName(thisArg.getClass()))); + proto.defineProperty(null, "toString", new NativeFunction("toString", (ctx, thisArg, args) -> thisArg.toString())); var constr = makeConstructor(null, Throwable.class); proto.defineProperty(null, "constructor", constr, true, false, false); constr.defineProperty(null, "prototype", proto, true, false, false); - proto.setPrototype(null, getProto(Object.class)); - constr.setPrototype(null, getConstr(Object.class)); - setProto(Throwable.class, proto); setConstr(Throwable.class, constr); } From 82a09e88654ebc102b46ef0186b45bf89622e7fb Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:31:33 +0200 Subject: [PATCH 11/20] fix: some config files cleanup --- .gitattributes | 1 + .gitignore | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..5378fe0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* -text \ No newline at end of file diff --git a/.gitignore b/.gitignore index a256983..096f357 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ !/src !/src/**/* +/src/assets/js/ts.js + !/tests !/tests/**/* @@ -10,6 +12,7 @@ !/.github/**/* !/.gitignore +!/.gitattributes !/build.js !/LICENSE !/README.md From 562f1f9425269244ae739babe96b72fa5f5921f9 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:31:50 +0200 Subject: [PATCH 12/20] fix: remove major mistakes in README --- README.md | 44 ++++++++++++++------------------------------ 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index fc95741..c073e12 100644 --- a/README.md +++ b/README.md @@ -2,44 +2,28 @@ **NOTE: This had nothing to do with Microsoft's dialect of EcmaScript** -**WARNING: Currently, this code is mostly undocumented. Proceed with caution and a psychiatrist.** +**WARNING: Currently, this code is undocumented. Proceed with caution and a psychiatrist.** JScript is an engine, capable of running EcmaScript 5, written entirely in Java. This engine has been developed with the goal of being easy to integrate with your preexisting codebase, **THE GOAL OF THIS ENGINE IS NOT PERFORMANCE**. My crude experiments show that this engine is 50x-100x slower than V8, which, although bad, is acceptable for most simple scripting purposes. Note that although the codebase has a Main class, this isn't meant to be a standalone program, but instead a library for running JavaScript code. ## Example -The following will create a REPL using the engine as a backend. Not that this won't properly log errors. I recommend checking out the implementation in `Main.main`: +The following is going to execute a simple javascript statement: ```java -var engine = new Engine(true /* false if you dont want debugging */); -var env = new Environment(null, null, null); -var debugger = new DebugServer(); - -// Create one target for the engine and start debugging server -debugger.targets.put("target", (socket, req) -> new SimpleDebugger(socket, engine)); -debugger.start(new InetSocketAddress("127.0.0.1", 9229), true); +var engine = new Engine(false); +// Initialize a standard environment, with implementations of most basic standard libraries (Object, Array, Symbol, etc.) +var env = Internals.apply(new Environment()); // Queue code to load internal libraries and start engine -engine.pushMsg(false, null, new Internals().getApplier(env)); -engine.start(); +var awaitable = engine.pushMsg(false, env, new Filename("tmp", "eval"), "10 + Math.sqrt(5 / 3)", null); +// Run the engine on the same thread, until the event loop runs empty +engine.run(true); -while (true) { - try { - var raw = Reading.read(); - if (raw == null) break; - - // Push a message to the engine with the raw REPL code - var res = engine.pushMsg( - false, new Context(engine).pushEnv(env), - new Filename("jscript", "repl.js"), raw, null - ).await(); - - Values.printValue(null, res); - } - catch (EngineException e) { Values.printError(e, ""); } - catch (SyntaxException ex) { - System.out.println("Syntax error:" + ex.msg); - } - catch (IOException e) { } -} +// Get our result +System.out.println(awaitable.await()); ``` + +## NOTE: + +To setup the typescript bundle in your sources, run `node build.js init-ts`. This will download the latest version of typescript, minify it, and add it to your src/assets folder. If you are going to work with the `node build.js debug|release` command, this is not a necessary step. From 031f78ebf1032833685874be54098235fa918638 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:32:37 +0200 Subject: [PATCH 13/20] fix: don't include ts's code in repo anymore --- build.js | 126 ++++++++++++++++++++++++++++++++++++++------ src/assets/js/ts.js | 18 ------- 2 files changed, 109 insertions(+), 35 deletions(-) delete mode 100644 src/assets/js/ts.js diff --git a/build.js b/build.js index 3d54053..0b47f69 100644 --- a/build.js +++ b/build.js @@ -2,16 +2,8 @@ const { spawn } = require('child_process'); const fs = require('fs/promises'); const pt = require('path'); const { argv, exit } = require('process'); +const { Readable } = require('stream'); -const conf = { - name: "java-jscript", - author: "TopchetoEU", - javahome: "", - version: argv[3] -}; - -if (conf.version.startsWith('refs/tags/')) conf.version = conf.version.substring(10); -if (conf.version.startsWith('v')) conf.version = conf.version.substring(1); async function* find(src, dst, wildcard) { const stat = await fs.stat(src); @@ -36,9 +28,9 @@ async function copy(src, dst, wildcard) { await Promise.all(promises); } -function run(cmd, ...args) { +function run(suppressOutput, cmd, ...args) { return new Promise((res, rej) => { - const proc = spawn(cmd, args, { stdio: 'inherit' }); + const proc = spawn(cmd, args, { stdio: suppressOutput ? 'ignore' : 'inherit' }); proc.once('exit', code => { if (code === 0) res(code); else rej(new Error(`Process ${cmd} exited with code ${code}.`)); @@ -46,7 +38,84 @@ function run(cmd, ...args) { }) } -async function compileJava() { +async function downloadTypescript(outFile) { + try { + // Import the required libraries, without the need of a package.json + console.log('Importing modules...'); + await run(true, 'npm', 'i', 'tar', 'zlib', 'uglify-js'); + await fs.mkdir(pt.dirname(outFile), { recursive: true }); + await fs.mkdir('tmp', { recursive: true }); + + const tar = require('tar'); + const zlib = require('zlib'); + const { minify } = await import('uglify-js'); + + // Download the package.json file of typescript + const packageDesc = await (await fetch('https://registry.npmjs.org/typescript/latest')).json(); + const url = packageDesc.dist.tarball; + + console.log('Extracting typescript...'); + await new Promise(async (res, rej) => Readable.fromWeb((await fetch(url)).body) + .pipe(zlib.createGunzip()) + .pipe(tar.x({ cwd: 'tmp', filter: v => v === 'package/lib/typescript.js' })) + .on('end', res) + .on('error', rej) + ); + + console.log('Compiling typescript to ES5...'); + + const ts = require('./tmp/package/lib/typescript'); + const program = ts.createProgram([ 'tmp/package/lib/typescript.js' ], { + outFile: "tmp/typescript-es5.js", + target: ts.ScriptTarget.ES5, + module: ts.ModuleKind.None, + downlevelIteration: true, + allowJs: true, + }); + program.emit(); + + console.log('Minifying typescript...'); + + const minified = { code: (await fs.readFile('tmp/typescript-es5.js')).toString() }; + // if (minified.error) throw minified.error; + + // Patch unsupported regex syntax + minified.code = minified.code.replaceAll('[-/\\\\^$*+?.()|[\\]{}]', '[-/\\\\^$*+?.()|\\[\\]{}]'); + + const stream = await fs.open(outFile, 'w'); + + // Write typescript's license + await stream.write(new TextEncoder().encode(` +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. + +The following is a minified version of the unmodified Typescript 5.2 +***************************************************************************** */ +`)); + + await stream.write(minified.code); + console.log('Typescript bundling done!'); + } + finally { + // Clean up all stuff left from typescript bundling + await fs.rm('tmp', { recursive: true, force: true }); + await fs.rm('package.json'); + await fs.rm('package-lock.json'); + await fs.rm('node_modules', { recursive: true }); + } +} +async function compileJava(conf) { try { await fs.writeFile('Metadata.java', (await fs.readFile('src/me/topchetoeu/jscript/Metadata.java')).toString() .replace('${VERSION}', conf.version) @@ -57,8 +126,10 @@ async function compileJava() { if (argv[2] === 'debug') args.push('-g'); args.push('-d', 'dst/classes', 'Metadata.java'); + console.log('Compiling java project...'); for await (const path of find('src', undefined, v => v.endsWith('.java') && !v.endsWith('Metadata.java'))) args.push(path); - await run(conf.javahome + 'javac', ...args); + await run(false, conf.javahome + 'javac', ...args); + console.log('Compiled java project!'); } finally { await fs.rm('Metadata.java'); @@ -67,10 +138,31 @@ async function compileJava() { (async () => { try { - try { await fs.rm('dst', { recursive: true }); } catch {} - await copy('src', 'dst/classes', v => !v.endsWith('.java')); - await compileJava(); - await run('jar', '-c', '-f', 'dst/jscript.jar', '-e', 'me.topchetoeu.jscript.Main', '-C', 'dst/classes', '.'); + if (argv[2] === 'init-ts') { + await downloadTypescript('src/assets/js/ts.js'); + } + else { + const conf = { + name: "java-jscript", + author: "TopchetoEU", + javahome: "", + version: argv[3] + }; + + if (conf.version.startsWith('refs/tags/')) conf.version = conf.version.substring(10); + if (conf.version.startsWith('v')) conf.version = conf.version.substring(1); + + try { await fs.rm('dst', { recursive: true }); } catch {} + + await Promise.all([ + downloadTypescript('dst/classes/assets/js/ts.js'), + copy('src', 'dst/classes', v => !v.endsWith('.java')), + compileJava(conf), + ]); + + await run(true, 'jar', '-c', '-f', 'dst/jscript.jar', '-e', 'me.topchetoeu.jscript.Main', '-C', 'dst/classes', '.'); + console.log('Done!'); + } } catch (e) { if (argv[2] === 'debug') throw e; diff --git a/src/assets/js/ts.js b/src/assets/js/ts.js deleted file mode 100644 index 68e4847..0000000 --- a/src/assets/js/ts.js +++ /dev/null @@ -1,18 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. - -The following is a minified version of the unmodified Typescript 5.2 -***************************************************************************** */ - -"use strict";var __makeTemplateObject=this&&this.__makeTemplateObject||function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__extends=this&&this.__extends||function(){var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;ro[0]&&t[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},__read=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,a,i=r.call(e),o=[];try{for(;(void 0===t||0>1);switch(n(r(e[s],s),t)){case-1:i=s+1;break;case 0:return s;case 1:o=s-1}}return~i}function ED(e,t,r,n,a){if(e&&0r.length>>1&&(e=r.length-n,r.copyWithin(0,n),r.length=e,n=0),t},isEmpty:a}}function re(c,u){var e,l=new Map,a=0;function o(){var t,r,n,a,i;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,7,8,9]),t=__values(l.values()),r=t.next(),e.label=1;case 1:return r.done?[3,6]:RD(n=r.value)?[5,__values(n)]:[3,3];case 2:return e.sent(),[3,5];case 3:return[4,n];case 4:e.sent(),e.label=5;case 5:return r=t.next(),[3,1];case 6:return[3,9];case 7:return a=e.sent(),a={error:a},[3,9];case 8:try{r&&!r.done&&(i=t.return)&&i.call(t)}finally{if(a)throw a.error}return[7];case 9:return[2]}})}var d=((e={has:function(e){var t,r,n=c(e);if(!l.has(n))return!1;var a=l.get(n);if(!RD(a))return u(a,e);try{for(var i=__values(a),o=i.next();!o.done;o=i.next()){var s=o.value;if(u(s,e))return!0}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return!1},add:function(e){var t,r=c(e);return l.has(r)?RD(t=l.get(r))?eD(t,e,u)||(t.push(e),a++):u(t=t,e)||(l.set(r,[t,e]),a++):(l.set(r,e),a++),this},delete:function(e){var t=c(e);if(!l.has(t))return!1;var r=l.get(t);if(RD(r)){for(var n=0;nr+o?r+o:t.length),_=a[0]=o,l=1;lo&&(o=_.prefix.length,i=u)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}return i}function XD(e,t){return 0===e.lastIndexOf(t,0)}function QD(e,t){return XD(e,t)?e.substr(t.length):e}function Le(e,t,r){return void 0===r&&(r=ir),XD(r(e),r(t))?e.substring(t.length):void 0}function Re(e,t){var r=e.prefix,e=e.suffix;return t.length>=r.length+e.length&&XD(t,r)&&qD(t,e)}function YD(t,r){return function(e){return t(e)&&r(e)}}function ZD(){for(var s=[],e=0;e=o.level&&(s[i]=o,u[i]=void 0)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},s.shouldAssert=n,s.fail=o,s.failBadSyntaxKind=function e(t,r,n){return o("".concat(r||"Unexpected node.","\r\nNode ").concat(y(t.kind)," was unexpected."),n||e)},s.assert=_,s.assertEqual=function e(t,r,n,a,i){t!==r&&(n=n?a?"".concat(n," ").concat(a):n:"",o("Expected ".concat(t," === ").concat(r,". ").concat(n),i||e))},s.assertLessThan=function e(t,r,n,a){r<=t&&o("Expected ".concat(t," < ").concat(r,". ").concat(n||""),a||e)},s.assertLessThanOrEqual=function e(t,r,n){r= ").concat(r),n||e)},s.assertIsDefined=l,s.checkDefined=function e(t,r,n){return l(t,r,n||e),t},s.assertEachIsDefined=d,s.checkEachDefined=function e(t,r,n){return d(t,r,n||e),t},s.assertNever=a,s.assertEachNode=function e(t,r,n,a){i(1,"assertEachNode")&&_(void 0===r||XN(t,r),n||"Unexpected node.",function(){return"Node array did not pass test '".concat(p(r),"'.")},a||e)},s.assertNode=function e(t,r,n,a){i(1,"assertNode")&&_(void 0!==t&&(void 0===r||r(t)),n||"Unexpected node.",function(){return"Node ".concat(y(null==t?void 0:t.kind)," did not pass test '").concat(p(r),"'.")},a||e)},s.assertNotNode=function e(t,r,n,a){i(1,"assertNotNode")&&_(void 0===t||void 0===r||!r(t),n||"Unexpected node.",function(){return"Node ".concat(y(t.kind)," should not have passed test '").concat(p(r),"'.")},a||e)},s.assertOptionalNode=function e(t,r,n,a){i(1,"assertOptionalNode")&&_(void 0===r||void 0===t||r(t),n||"Unexpected node.",function(){return"Node ".concat(y(null==t?void 0:t.kind)," did not pass test '").concat(p(r),"'.")},a||e)},s.assertOptionalToken=function e(t,r,n,a){i(1,"assertOptionalToken")&&_(void 0===r||void 0===t||t.kind===r,n||"Unexpected node.",function(){return"Node ".concat(y(null==t?void 0:t.kind)," was not a '").concat(y(r),"' token.")},a||e)},s.assertMissingNode=function e(t,r,n){i(1,"assertMissingNode")&&_(void 0===t,r||"Unexpected node.",function(){return"Node ".concat(y(t.kind)," was unexpected'.")},n||e)},s.type=f,s.getFunctionName=p,s.formatSymbol=function(e){return"{ name: ".concat(OA(e.escapedName),"; flags: ").concat(k(e.flags),"; declarations: ").concat(iD(e.declarations,function(e){return y(e.kind)})," }")},s.formatEnum=m;var g=new Map;function y(e){return m(e,Qt,!1)}function v(e){return m(e,Yt,!0)}function h(e){return m(e,Zt,!0)}function x(e){return m(e,fn,!0)}function b(e){return m(e,mn,!0)}function k(e){return m(e,Fr,!0)}function T(e){return m(e,Mr,!0)}function S(e){return m(e,qr,!0)}function w(e){return m(e,Rr,!0)}function C(e){return m(e,fr,!0)}s.formatSyntaxKind=y,s.formatSnippetKind=function(e){return m(e,pn,!1)},s.formatScriptKind=function(e){return m(e,sn,!1)},s.formatNodeFlags=v,s.formatModifierFlags=h,s.formatTransformFlags=x,s.formatEmitFlags=b,s.formatSymbolFlags=k,s.formatTypeFlags=T,s.formatSignatureFlags=S,s.formatObjectFlags=w,s.formatFlowFlags=C,s.formatRelationComparisonResult=function(e){return m(e,lr,!0)},s.formatCheckMode=function(e){return m(e,CC,!0)},s.formatSignatureCheckMode=function(e){return m(e,NC,!0)};var N,D,A=!(s.formatTypeFacts=function(e){return m(e,wC,!0)});function E(e){"__debugFlowFlags"in e||Object.defineProperties(e,{__tsDebuggerDisplay:{value:function(){var e=2&this.flags?"FlowStart":4&this.flags?"FlowBranchLabel":8&this.flags?"FlowLoopLabel":16&this.flags?"FlowAssignment":32&this.flags?"FlowTrueCondition":64&this.flags?"FlowFalseCondition":128&this.flags?"FlowSwitchClause":256&this.flags?"FlowArrayMutation":512&this.flags?"FlowCall":1024&this.flags?"FlowReduceLabel":1&this.flags?"FlowUnreachable":"UnknownFlow",t=-2048&this.flags;return"".concat(e).concat(t?" (".concat(C(t),")"):"")}},__debugFlowFlags:{get:function(){return m(this.flags,fr,!0)}},__debugToString:{value:function(){return O(this)}}})}function F(e){"__tsDebuggerDisplay"in e||Object.defineProperties(e,{__tsDebuggerDisplay:{value:function(e){return e=String(e).replace(/(?:,[\s\w\d_]+:[^,]+)+\]$/,"]"),"NodeArray ".concat(e)}}})}s.attachFlowNodeDebugInfo=function(e){A&&("function"==typeof Object.setPrototypeOf?(N||E(N=Object.create(Object.prototype)),Object.setPrototypeOf(e,N)):E(e))},s.attachNodeArrayDebugInfo=function(e){A&&("function"==typeof Object.setPrototypeOf?(D||F(D=Object.create(Array.prototype)),Object.setPrototypeOf(e,D)):F(e))},s.enableDebugInfo=function(){var t,e;if(!A){var r=new WeakMap,a=new WeakMap;Object.defineProperties(pF.getSymbolConstructor().prototype,{__tsDebuggerDisplay:{value:function(){var e=33554432&this.flags?"TransientSymbol":"Symbol",t=-33554433&this.flags;return"".concat(e," '").concat(RA(this),"'").concat(t?" (".concat(k(t),")"):"")}},__debugFlags:{get:function(){return k(this.flags)}}}),Object.defineProperties(pF.getTypeConstructor().prototype,{__tsDebuggerDisplay:{value:function(){var e=98304&this.flags?"NullableType":384&this.flags?"LiteralType ".concat(JSON.stringify(this.value)):2048&this.flags?"LiteralType ".concat(this.value.negative?"-":"").concat(this.value.base10Value,"n"):8192&this.flags?"UniqueESSymbolType":32&this.flags?"EnumType":67359327&this.flags?"IntrinsicType ".concat(this.intrinsicName):1048576&this.flags?"UnionType":2097152&this.flags?"IntersectionType":4194304&this.flags?"IndexType":8388608&this.flags?"IndexedAccessType":16777216&this.flags?"ConditionalType":33554432&this.flags?"SubstitutionType":262144&this.flags?"TypeParameter":524288&this.flags?3&this.objectFlags?"InterfaceType":4&this.objectFlags?"TypeReference":8&this.objectFlags?"TupleType":16&this.objectFlags?"AnonymousType":32&this.objectFlags?"MappedType":1024&this.objectFlags?"ReverseMappedType":256&this.objectFlags?"EvolvingArrayType":"ObjectType":"Type",t=524288&this.flags?-1344&this.objectFlags:0;return"".concat(e).concat(this.symbol?" '".concat(RA(this.symbol),"'"):"").concat(t?" (".concat(w(t),")"):"")}},__debugFlags:{get:function(){return T(this.flags)}},__debugObjectFlags:{get:function(){return 524288&this.flags?w(this.objectFlags):""}},__debugTypeToString:{value:function(){var e=r.get(this);return void 0===e&&(e=this.checker.typeToString(this),r.set(this,e)),e}}}),Object.defineProperties(pF.getSignatureConstructor().prototype,{__debugFlags:{get:function(){return S(this.flags)}},__debugSignatureToString:{value:function(){var e;return null==(e=this.checker)?void 0:e.signatureToString(this)}}});var n=[pF.getNodeConstructor(),pF.getIdentifierConstructor(),pF.getTokenConstructor(),pF.getSourceFileConstructor()];try{for(var i=__values(n),o=i.next();!o.done;o=i.next()){var s=o.value;ma(s.prototype,"__debugKind")||Object.defineProperties(s.prototype,{__tsDebuggerDisplay:{value:function(){var e=mE(this)?"GeneratedIdentifier":xR(this)?"Identifier '".concat(LA(this),"'"):bR(this)?"PrivateIdentifier '".concat(LA(this),"'"):hR(this)?"StringLiteral ".concat(JSON.stringify(this.text.length<10?this.text:this.text.slice(10)+"...")):gR(this)?"NumericLiteral ".concat(this.text):Vv(this)?"BigIntLiteral ".concat(this.text,"n"):wR(this)?"TypeParameterDeclaration":CR(this)?"ParameterDeclaration":IR(this)?"ConstructorDeclaration":OR(this)?"GetAccessorDeclaration":LR(this)?"SetAccessorDeclaration":MR(this)?"CallSignatureDeclaration":RR(this)?"ConstructSignatureDeclaration":gg(this)?"IndexSignatureDeclaration":jR(this)?"TypePredicateNode":BR(this)?"TypeReferenceNode":JR(this)?"FunctionTypeNode":zR(this)?"ConstructorTypeNode":UR(this)?"TypeQueryNode":VR(this)?"TypeLiteralNode":hg(this)?"ArrayTypeNode":qR(this)?"TupleTypeNode":HR(this)?"OptionalTypeNode":KR(this)?"RestTypeNode":xg(this)?"UnionTypeNode":bg(this)?"IntersectionTypeNode":kg(this)?"ConditionalTypeNode":Tg(this)?"InferTypeNode":GR(this)?"ParenthesizedTypeNode":Sg(this)?"ThisTypeNode":XR(this)?"TypeOperatorNode":QR(this)?"IndexedAccessTypeNode":wg(this)?"MappedTypeNode":YR(this)?"LiteralTypeNode":WR(this)?"NamedTupleMember":ZR(this)?"ImportTypeNode":y(this.kind);return"".concat(e).concat(this.flags?" (".concat(v(this.flags),")"):"")}},__debugKind:{get:function(){return y(this.kind)}},__debugNodeFlags:{get:function(){return v(this.flags)}},__debugModifierFlags:{get:function(){return h(Zd(this))}},__debugTransformFlags:{get:function(){return x(this.transformFlags)}},__debugIsParseTreeNode:{get:function(){return Ro(this)}},__debugEmitFlags:{get:function(){return b(p_(this))}},__debugGetText:{value:function(e){if(jO(this))return"";var t,r,n=a.get(this);return void 0===n&&(n=(r=(t=PA(this))&&CF(t))?__(r,t,e):"",a.set(this,n)),n}}})}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}A=!0}},s.formatVariance=function(e){var t=0==(t=7&e)?"in out":3==t?"[bivariant]":2==t?"in":1==t?"out":4==t?"[independent]":"";return 8&e?t+=" (unmeasurable)":16&e&&(t+=" (unreliable)"),t};var P=(I.prototype.__debugToString=function(){var e;switch(this.kind){case 3:return(null==(e=this.debugInfo)?void 0:e.call(this))||"(function mapper)";case 0:return"".concat(this.source.__debugTypeToString()," -> ").concat(this.target.__debugTypeToString());case 1:return L(this.sources,this.targets||iD(this.sources,function(){return"any"}),function(e,t){return"".concat(e.__debugTypeToString()," -> ").concat("string"==typeof t?t:t.__debugTypeToString())}).join(", ");case 2:return L(this.sources,this.targets,function(e,t){return"".concat(e.__debugTypeToString()," -> ").concat(t().__debugTypeToString())}).join(", ");case 5:case 4:return"m1: ".concat(this.mapper1.__debugToString().split("\n").join("\n "),"\nm2: ").concat(this.mapper2.__debugToString().split("\n").join("\n "));default:return a(this)}},I);function I(){}function O(e){var t,r,n,a=-1;function c(e){return e.id||(e.id=a,a--),e.id}(n={}).lr="─",n.ud="│",n.dr="╭",n.dl="╮",n.ul="╯",n.ur="╰",n.udr="├",n.udl="┤",n.dlr="┬",n.ulr="┴",n.udlr="╫",(n={})[n.None=0]="None",n[n.Up=1]="Up",n[n.Down=2]="Down",n[n.Left=4]="Left",n[n.Right=8]="Right",n[n.UpDown=3]="UpDown",n[n.LeftRight=12]="LeftRight",n[n.UpLeft=5]="UpLeft",n[n.UpRight=9]="UpRight",n[n.DownLeft=6]="DownLeft",n[n.DownRight=10]="DownRight",n[n.UpDownLeft=7]="UpDownLeft",n[n.UpDownRight=11]="UpDownRight",n[n.UpLeftRight=13]="UpLeftRight",n[n.DownLeftRight=14]="DownLeftRight",n[n.UpDownLeftRight=15]="UpDownLeftRight",n[n.NoChildren=16]="NoChildren";var u=2032,o=882,_=Object.create(null),k=[],i=[],e=f(e,new Set);try{for(var s=__values(k),l=s.next();!l.done;l=s.next()){var d=l.value;d.text=function(e,t){var r=function(e){if(2&e)return"Start";if(4&e)return"Branch";if(8&e)return"Loop";if(16&e)return"Assignment";if(32&e)return"True";if(64&e)return"False";if(128&e)return"SwitchClause";if(256&e)return"ArrayMutation";if(512&e)return"Call";if(1024&e)return"ReduceLabel";if(1&e)return"Unreachable";throw new Error}(e.flags);t&&(r="".concat(r,"#").concat(c(e)));if(function(e){return!!(e.flags&o)}(e))e.node&&(r+=" (".concat(m(e.node),")"));else if(128&e.flags){for(var n=[],a=e.clauseStart;at.endLane&&(r=i.endLane)}t.endLane=r}}(e,0),function(){var t,e,r=T.length,n=k.reduce(function(e,t){return Math.max(e,t.lane)},0)+1,a=C(Array(n),""),i=T.map(function(){return Array(n)}),o=T.map(function(){return C(Array(n),0)});try{for(var s=__values(k),c=s.next();!c.done;c=s.next()){for(var u=c.value,_=S(i[u.level][u.lane]=u),l=0;l<_.length;l++){var d=_[l],f=8;d.lane===u.lane&&(f|=4),0=",e.version));dt(t.major)||r.push(dt(t.minor)?ft("<",t.version.increment("major")):dt(t.patch)?ft("<",t.version.increment("minor")):ft("<=",t.version));return!0}(_[1],_[2],c))return}else try{for(var l=(n=void 0,__values(u.split(nt))),d=l.next();!d.done;d=l.next()){var f=d.value,f=ot.exec(h(f));if(!f||!function(e,t,r){var n=lt(t);if(!n)return!1;var a=n.version,t=n.major,i=n.minor,o=n.patch;if(dt(t))"<"!==e&&">"!==e||r.push(ft("<",_r.zero));else switch(e){case"~":r.push(ft(">=",a)),r.push(ft("<",a.increment(dt(i)?"major":"minor")));break;case"^":r.push(ft(">=",a)),r.push(ft("<",a.increment(0=":r.push(dt(i)||dt(o)?ft(e,a.with({prerelease:"0"})):ft(e,a));break;case"<=":case">":r.push(dt(i)?ft("<="===e?"<":">=",a.increment("major").with({prerelease:"0"})):dt(o)?ft("<="===e?"<":">=",a.increment("minor").with({prerelease:"0"})):ft(e,a));break;case"=":case void 0:dt(i)||dt(o)?(r.push(ft(">=",a.with({prerelease:"0"}))),r.push(ft("<",a.increment(dt(i)?"major":"minor").with({prerelease:"0"})))):r.push(ft("=",a));break;default:return!1}return!0}(f[1],f[2],c))return}}catch(e){n={error:e}}finally{try{d&&!d.done&&(a=l.return)&&a.call(l)}finally{if(n)throw n.error}}i.push(c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return i}function lt(e){var t=at.exec(e);if(t){var r=__read(t,6),n=r[1],a=r[2],e=void 0===a?"*":a,t=r[3],a=void 0===t?"*":t,t=r[4],r=r[5];return{version:new _r(dt(n)?0:parseInt(n,10),dt(n)||dt(e)?0:parseInt(e,10),dt(n)||dt(e)||dt(a)?0:parseInt(a,10),t,r),major:n,minor:e,patch:a}}}function dt(e){return"*"===e||"x"===e||"X"===e}function ft(e,t){return{operator:e,operand:t}}function pt(e,t){var r,n;if(0===t.length)return!0;try{for(var a=__values(t),i=a.next();!i.done;i=a.next())if(function(e,t){var r,n;try{for(var a=__values(t),i=a.next();!i.done;i=a.next()){var o=i.value;if(!function(e,t,r){var n=e.compareTo(r);switch(t){case"<":return n<0;case"<=":return n<=0;case">":return 0=":return 0<=n;case"=":return 0===n;default:return rA.assertNever(t)}}(e,o.operator,o.operand))return!1}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return!0}(e,i.value))return!0}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return!1}function mt(e){return iD(e,yt).join(" ")}function yt(e){return"".concat(e.operator).concat(e.operand)}var vt,gt,ht,xt=e({"src/compiler/semver.ts":function(){function i(e,t,r,n,a){var i;void 0===t&&(t=0),void 0===r&&(r=0),void 0===n&&(n=""),void 0===a&&(a=""),"string"==typeof e&&(e=(i=rA.checkDefined(ut(e),"Invalid version")).major,t=i.minor,r=i.patch,n=i.prerelease,a=i.build),rA.assert(0<=e,"Invalid argument: major"),rA.assert(0<=t,"Invalid argument: minor"),rA.assert(0<=r,"Invalid argument: patch");n=n?RD(n)?n:n.split("."):WN,a=a?RD(a)?a:a.split("."):WN;rA.assert(XN(n,function(e){return Xe.test(e)}),"Invalid argument: prerelease"),rA.assert(XN(a,function(e){return Ye.test(e)}),"Invalid argument: build"),this.major=e,this.minor=t,this.patch=r,this.prerelease=n,this.build=a}function r(e){this._alternatives=e?rA.checkDefined(_t(e),"Invalid range spec."):WN}MK(),Ke=/^(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i,Ge=/^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i,Xe=/^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i,Qe=/^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i,Ye=/^[a-z0-9-]+$/i,$e=/^(0|[1-9]\d*)$/,i.tryParse=function(e){e=ut(e);if(e)return new i(e.major,e.minor,e.patch,e.prerelease,e.build)},i.prototype.compareTo=function(e){return this===e?0:void 0===e?1:UD(this.major,e.major)||UD(this.minor,e.minor)||UD(this.patch,e.patch)||function(e,t){if(e===t)return 0;if(0===e.length)return 0===t.length?0:1;if(0===t.length)return-1;for(var r=Math.min(e.length,t.length),n=0;n|>=|=)?\s*([a-z0-9-+.*]+)$/i}});function bt(e,t){return"object"==typeof e&&"number"==typeof e.timeOrigin&&"function"==typeof e.mark&&"function"==typeof e.measure&&"function"==typeof e.now&&"function"==typeof e.clearMarks&&"function"==typeof e.clearMeasures&&"function"==typeof t}function kt(){return vt}var Tt,St,wt,Ct,Nt,Dt,At,Et,Ft,Pt,It=e({"src/compiler/performanceCore.ts":function(){MK(),vt=function(){if("object"==typeof performance&&"function"==typeof PerformanceObserver&&bt(performance,PerformanceObserver))return{shouldWriteNativeEvents:!0,performance:performance,PerformanceObserver:PerformanceObserver}}()||function(){if(We())try{var e=require("perf_hooks"),t=e.performance,e=e.PerformanceObserver;if(bt(t,e))return{shouldWriteNativeEvents:!1,performance:t,PerformanceObserver:e}}catch(e){}}(),gt=null==vt?void 0:vt.performance,ht=gt?function(){return gt.now()}:Date.now||function(){return+new Date}}}),Ot=e({"src/compiler/perfLogger.ts":function(){try{var e=null!==(e=process.env.TS_ETW_MODULE_PATH)&&void 0!==e?e:"./node_modules/@microsoft/typescript-etw";Tt=require(e)}catch(e){Tt=void 0}St=null!=Tt&&Tt.logEvent?Tt:void 0}});function Tn(e,t,r,n){return e?Lt(t,r,n):Nt}function Lt(e,t,r){var n=0;return{enter:function(){1==++n&&nA(t)},exit:function(){0==--n?(nA(r),aA(e,t,r)):n<0&&rA.fail("enter/exit count does not match.")}}}function nA(e){var t;Dt&&(t=null!==(t=Ft.get(e))&&void 0!==t?t:0,Ft.set(e,t+1),Et.set(e,ht()),null!=Ct&&Ct.mark(e),"function"==typeof onProfilerEvent&&onProfilerEvent(e))}function aA(e,t,r){var n,a,i;Dt&&(n=null!==(a=void 0!==r?Et.get(r):void 0)&&void 0!==a?a:ht(),a=null!==(i=void 0!==t?Et.get(t):void 0)&&void 0!==i?i:At,i=Pt.get(e)||0,Pt.set(e,i+(n-a)),null!=Ct&&Ct.measure(e,t,r))}function Mt(e){return Ft.get(e)||0}function Rt(e){return Pt.get(e)||0}function jt(r){Pt.forEach(function(e,t){return r(t,e)})}function Bt(r){Et.forEach(function(e,t){return r(t)})}function Jt(e){void 0!==e?Pt.delete(e):Pt.clear(),null!=Ct&&Ct.clearMeasures(e)}function zt(e){void 0!==e?(Ft.delete(e),Et.delete(e)):(Ft.clear(),Et.clear()),null!=Ct&&Ct.clearMarks(e)}function Ut(){return Dt}function Vt(e){var t;return void 0===e&&(e=zn),Dt||(Dt=!0,(wt=wt||vt)&&(At=wt.performance.timeOrigin,(wt.shouldWriteNativeEvents||null!=(t=null==e?void 0:e.cpuProfilingEnabled)&&t.call(e)||null!=e&&e.debugMode)&&(Ct=wt.performance))),!0}function qt(){Dt&&(Et.clear(),Ft.clear(),Pt.clear(),Ct=void 0,Dt=!1)}var Wt=e({"src/compiler/performance.ts":function(){MK(),Dt=!(Nt={enter:fi,exit:fi}),At=ht(),Et=new Map,Ft=new Map,Pt=new Map}}),Ht={};t(Ht,{clearMarks:function(){return zt},clearMeasures:function(){return Jt},createTimer:function(){return Lt},createTimerIf:function(){return Tn},disable:function(){return qt},enable:function(){return Vt},forEachMark:function(){return Bt},forEachMeasure:function(){return jt},getCount:function(){return Mt},getDuration:function(){return Rt},isEnabled:function(){return Ut},mark:function(){return nA},measure:function(){return aA},nullTimer:function(){return Nt}});var iA,Kt,Gt,Xt,Qt,Yt,Zt,$t,lr,Sn,dr,fr,pr,mr,yr,vr,gr,hr,xr,br,kr,Tr,Sr,wr,Cr,Nr,Dr,Ar,Er,Fr,Pr,Ir,Or,Lr,Mr,Rr,jr,Br,Jr,zr,Ur,Vr,qr,Wr,Hr,Kr,Gr,Xr,Qr,Yr,Zr,$r,en,tn,rn,oA,nn,an,on,sn,cn,un,_n,ln,dn,fn,pn,mn,yn,vn,gn,hn,xn,wn,Cn,Nn,Dn,An=e({"src/compiler/_namespaces/ts.performance.ts":function(){Wt()}}),En=e({"src/compiler/tracing.ts":function(){MK(),An(),function(a){var k,o,i,e,s=0,c=0,u=[],T=[];a.startTracing=function(e,t,r){if(rA.assert(!iA,"Tracing already started"),void 0===k)try{k=require("fs")}catch(e){throw new Error("tracing requires having fs\n(original error: ".concat(e.message||e,")"))}o=e,void(u.length=0)===i&&(i=dA(t,"legend.json")),k.existsSync(t)||k.mkdirSync(t,{recursive:!0});var n="build"===o?".".concat(process.pid,"-").concat(++s):"server"===o?".".concat(process.pid):"",e=dA(t,"trace".concat(n,".json")),n=dA(t,"types".concat(n,".json"));T.push({configFilePath:r,tracePath:e,typesPath:n}),c=k.openSync(e,"w"),iA=a,e={cat:"__metadata",ph:"M",ts:1e3*ht(),pid:1,tid:1},k.writeSync(c,"[\n"+[__assign({name:"process_name",args:{name:"tsc"}},e),__assign({name:"thread_name",args:{name:"Main"}},e),__assign(__assign({name:"TracingStartedInBrowser"},e),{cat:"disabled-by-default-devtools.timeline"})].map(function(e){return JSON.stringify(e)}).join(",\n"))},a.stopTracing=function(){rA.assert(iA,"Tracing is not in progress"),rA.assert(!!u.length==("server"!==o)),k.writeSync(c,"\n]\n"),k.closeSync(c),iA=void 0,u.length?function(e){var t,r,n,a;nA("beginDumpTypes");var i=T[T.length-1].typesPath,o=k.openSync(i,"w"),s=new Map;k.writeSync(o,"[");for(var c=e.length,u=0;ut.length&&qD(e,t)}function _A(e,t){var r,n;try{for(var a=__values(t),i=a.next();!i.done;i=a.next())if(uA(e,i.value))return!0}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return!1}function Ca(e){return 0=t.length&&46===e.charCodeAt(e.length-t.length)){e=e.slice(e.length-t.length);if(r(e,t))return e}}function Pa(e,t,r){if(t)return function(e,t,r){var n,a;if("string"==typeof t)return Fa(e,t,r)||"";try{for(var i=__values(t),o=i.next();!o.done;o=i.next()){var s=Fa(e,o.value,r);if(s)return s}}catch(e){n={error:e}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(n)throw n.error}}return""}(za(e),t,r?sr:cr);r=Ea(e),e=r.lastIndexOf(".");return 0<=e?r.substring(e):""}function Ia(e,t){return void 0===t&&(t=""),e=dA(t,e),t=Aa(r=e),e=r.substring(0,t),(t=r.substring(t).split(ca)).length&&!CD(t)&&t.pop(),__spreadArray([e],__read(t),!1);var r}function Oa(e,t){return 0===e.length?"":(e[0]&&Ua(e[0]))+e.slice(1,t).join(ca)}function La(e){return-1!==e.indexOf("\\")?e.replace(la,ca):e}function Ma(e){if(!dD(e))return[];for(var t=[e[0]],r=1;r type. Did you mean to write 'Promise<{0}>'?"),The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type:ai(1065,1,"The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1065","The return type of an async function or method must be the global Promise type."),In_ambient_enum_declarations_member_initializer_must_be_constant_expression:ai(1066,1,"In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066","In ambient enum declarations member initializer must be constant expression."),Unexpected_token_A_constructor_method_accessor_or_property_was_expected:ai(1068,1,"Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068","Unexpected token. A constructor, method, accessor, or property was expected."),Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces:ai(1069,1,"Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces_1069","Unexpected token. A type parameter name was expected without curly braces."),_0_modifier_cannot_appear_on_a_type_member:ai(1070,1,"_0_modifier_cannot_appear_on_a_type_member_1070","'{0}' modifier cannot appear on a type member."),_0_modifier_cannot_appear_on_an_index_signature:ai(1071,1,"_0_modifier_cannot_appear_on_an_index_signature_1071","'{0}' modifier cannot appear on an index signature."),A_0_modifier_cannot_be_used_with_an_import_declaration:ai(1079,1,"A_0_modifier_cannot_be_used_with_an_import_declaration_1079","A '{0}' modifier cannot be used with an import declaration."),Invalid_reference_directive_syntax:ai(1084,1,"Invalid_reference_directive_syntax_1084","Invalid 'reference' directive syntax."),_0_modifier_cannot_appear_on_a_constructor_declaration:ai(1089,1,"_0_modifier_cannot_appear_on_a_constructor_declaration_1089","'{0}' modifier cannot appear on a constructor declaration."),_0_modifier_cannot_appear_on_a_parameter:ai(1090,1,"_0_modifier_cannot_appear_on_a_parameter_1090","'{0}' modifier cannot appear on a parameter."),Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement:ai(1091,1,"Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091","Only a single variable declaration is allowed in a 'for...in' statement."),Type_parameters_cannot_appear_on_a_constructor_declaration:ai(1092,1,"Type_parameters_cannot_appear_on_a_constructor_declaration_1092","Type parameters cannot appear on a constructor declaration."),Type_annotation_cannot_appear_on_a_constructor_declaration:ai(1093,1,"Type_annotation_cannot_appear_on_a_constructor_declaration_1093","Type annotation cannot appear on a constructor declaration."),An_accessor_cannot_have_type_parameters:ai(1094,1,"An_accessor_cannot_have_type_parameters_1094","An accessor cannot have type parameters."),A_set_accessor_cannot_have_a_return_type_annotation:ai(1095,1,"A_set_accessor_cannot_have_a_return_type_annotation_1095","A 'set' accessor cannot have a return type annotation."),An_index_signature_must_have_exactly_one_parameter:ai(1096,1,"An_index_signature_must_have_exactly_one_parameter_1096","An index signature must have exactly one parameter."),_0_list_cannot_be_empty:ai(1097,1,"_0_list_cannot_be_empty_1097","'{0}' list cannot be empty."),Type_parameter_list_cannot_be_empty:ai(1098,1,"Type_parameter_list_cannot_be_empty_1098","Type parameter list cannot be empty."),Type_argument_list_cannot_be_empty:ai(1099,1,"Type_argument_list_cannot_be_empty_1099","Type argument list cannot be empty."),Invalid_use_of_0_in_strict_mode:ai(1100,1,"Invalid_use_of_0_in_strict_mode_1100","Invalid use of '{0}' in strict mode."),with_statements_are_not_allowed_in_strict_mode:ai(1101,1,"with_statements_are_not_allowed_in_strict_mode_1101","'with' statements are not allowed in strict mode."),delete_cannot_be_called_on_an_identifier_in_strict_mode:ai(1102,1,"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102","'delete' cannot be called on an identifier in strict mode."),for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules:ai(1103,1,"for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1103","'for await' loops are only allowed within async functions and at the top levels of modules."),A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement:ai(1104,1,"A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104","A 'continue' statement can only be used within an enclosing iteration statement."),A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement:ai(1105,1,"A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105","A 'break' statement can only be used within an enclosing iteration or switch statement."),The_left_hand_side_of_a_for_of_statement_may_not_be_async:ai(1106,1,"The_left_hand_side_of_a_for_of_statement_may_not_be_async_1106","The left-hand side of a 'for...of' statement may not be 'async'."),Jump_target_cannot_cross_function_boundary:ai(1107,1,"Jump_target_cannot_cross_function_boundary_1107","Jump target cannot cross function boundary."),A_return_statement_can_only_be_used_within_a_function_body:ai(1108,1,"A_return_statement_can_only_be_used_within_a_function_body_1108","A 'return' statement can only be used within a function body."),Expression_expected:ai(1109,1,"Expression_expected_1109","Expression expected."),Type_expected:ai(1110,1,"Type_expected_1110","Type expected."),Private_field_0_must_be_declared_in_an_enclosing_class:ai(1111,1,"Private_field_0_must_be_declared_in_an_enclosing_class_1111","Private field '{0}' must be declared in an enclosing class."),A_default_clause_cannot_appear_more_than_once_in_a_switch_statement:ai(1113,1,"A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113","A 'default' clause cannot appear more than once in a 'switch' statement."),Duplicate_label_0:ai(1114,1,"Duplicate_label_0_1114","Duplicate label '{0}'."),A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement:ai(1115,1,"A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115","A 'continue' statement can only jump to a label of an enclosing iteration statement."),A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement:ai(1116,1,"A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116","A 'break' statement can only jump to a label of an enclosing statement."),An_object_literal_cannot_have_multiple_properties_with_the_same_name:ai(1117,1,"An_object_literal_cannot_have_multiple_properties_with_the_same_name_1117","An object literal cannot have multiple properties with the same name."),An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name:ai(1118,1,"An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118","An object literal cannot have multiple get/set accessors with the same name."),An_object_literal_cannot_have_property_and_accessor_with_the_same_name:ai(1119,1,"An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119","An object literal cannot have property and accessor with the same name."),An_export_assignment_cannot_have_modifiers:ai(1120,1,"An_export_assignment_cannot_have_modifiers_1120","An export assignment cannot have modifiers."),Octal_literals_are_not_allowed_Use_the_syntax_0:ai(1121,1,"Octal_literals_are_not_allowed_Use_the_syntax_0_1121","Octal literals are not allowed. Use the syntax '{0}'."),Variable_declaration_list_cannot_be_empty:ai(1123,1,"Variable_declaration_list_cannot_be_empty_1123","Variable declaration list cannot be empty."),Digit_expected:ai(1124,1,"Digit_expected_1124","Digit expected."),Hexadecimal_digit_expected:ai(1125,1,"Hexadecimal_digit_expected_1125","Hexadecimal digit expected."),Unexpected_end_of_text:ai(1126,1,"Unexpected_end_of_text_1126","Unexpected end of text."),Invalid_character:ai(1127,1,"Invalid_character_1127","Invalid character."),Declaration_or_statement_expected:ai(1128,1,"Declaration_or_statement_expected_1128","Declaration or statement expected."),Statement_expected:ai(1129,1,"Statement_expected_1129","Statement expected."),case_or_default_expected:ai(1130,1,"case_or_default_expected_1130","'case' or 'default' expected."),Property_or_signature_expected:ai(1131,1,"Property_or_signature_expected_1131","Property or signature expected."),Enum_member_expected:ai(1132,1,"Enum_member_expected_1132","Enum member expected."),Variable_declaration_expected:ai(1134,1,"Variable_declaration_expected_1134","Variable declaration expected."),Argument_expression_expected:ai(1135,1,"Argument_expression_expected_1135","Argument expression expected."),Property_assignment_expected:ai(1136,1,"Property_assignment_expected_1136","Property assignment expected."),Expression_or_comma_expected:ai(1137,1,"Expression_or_comma_expected_1137","Expression or comma expected."),Parameter_declaration_expected:ai(1138,1,"Parameter_declaration_expected_1138","Parameter declaration expected."),Type_parameter_declaration_expected:ai(1139,1,"Type_parameter_declaration_expected_1139","Type parameter declaration expected."),Type_argument_expected:ai(1140,1,"Type_argument_expected_1140","Type argument expected."),String_literal_expected:ai(1141,1,"String_literal_expected_1141","String literal expected."),Line_break_not_permitted_here:ai(1142,1,"Line_break_not_permitted_here_1142","Line break not permitted here."),or_expected:ai(1144,1,"or_expected_1144","'{' or ';' expected."),or_JSX_element_expected:ai(1145,1,"or_JSX_element_expected_1145","'{' or JSX element expected."),Declaration_expected:ai(1146,1,"Declaration_expected_1146","Declaration expected."),Import_declarations_in_a_namespace_cannot_reference_a_module:ai(1147,1,"Import_declarations_in_a_namespace_cannot_reference_a_module_1147","Import declarations in a namespace cannot reference a module."),Cannot_use_imports_exports_or_module_augmentations_when_module_is_none:ai(1148,1,"Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148","Cannot use imports, exports, or module augmentations when '--module' is 'none'."),File_name_0_differs_from_already_included_file_name_1_only_in_casing:ai(1149,1,"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149","File name '{0}' differs from already included file name '{1}' only in casing."),_0_declarations_must_be_initialized:ai(1155,1,"_0_declarations_must_be_initialized_1155","'{0}' declarations must be initialized."),_0_declarations_can_only_be_declared_inside_a_block:ai(1156,1,"_0_declarations_can_only_be_declared_inside_a_block_1156","'{0}' declarations can only be declared inside a block."),Unterminated_template_literal:ai(1160,1,"Unterminated_template_literal_1160","Unterminated template literal."),Unterminated_regular_expression_literal:ai(1161,1,"Unterminated_regular_expression_literal_1161","Unterminated regular expression literal."),An_object_member_cannot_be_declared_optional:ai(1162,1,"An_object_member_cannot_be_declared_optional_1162","An object member cannot be declared optional."),A_yield_expression_is_only_allowed_in_a_generator_body:ai(1163,1,"A_yield_expression_is_only_allowed_in_a_generator_body_1163","A 'yield' expression is only allowed in a generator body."),Computed_property_names_are_not_allowed_in_enums:ai(1164,1,"Computed_property_names_are_not_allowed_in_enums_1164","Computed property names are not allowed in enums."),A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type:ai(1165,1,"A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_t_1165","A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type."),A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_symbol_type:ai(1166,1,"A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_1166","A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type."),A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type:ai(1168,1,"A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_ty_1168","A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type."),A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type:ai(1169,1,"A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_1169","A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type."),A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type:ai(1170,1,"A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type__1170","A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type."),A_comma_expression_is_not_allowed_in_a_computed_property_name:ai(1171,1,"A_comma_expression_is_not_allowed_in_a_computed_property_name_1171","A comma expression is not allowed in a computed property name."),extends_clause_already_seen:ai(1172,1,"extends_clause_already_seen_1172","'extends' clause already seen."),extends_clause_must_precede_implements_clause:ai(1173,1,"extends_clause_must_precede_implements_clause_1173","'extends' clause must precede 'implements' clause."),Classes_can_only_extend_a_single_class:ai(1174,1,"Classes_can_only_extend_a_single_class_1174","Classes can only extend a single class."),implements_clause_already_seen:ai(1175,1,"implements_clause_already_seen_1175","'implements' clause already seen."),Interface_declaration_cannot_have_implements_clause:ai(1176,1,"Interface_declaration_cannot_have_implements_clause_1176","Interface declaration cannot have 'implements' clause."),Binary_digit_expected:ai(1177,1,"Binary_digit_expected_1177","Binary digit expected."),Octal_digit_expected:ai(1178,1,"Octal_digit_expected_1178","Octal digit expected."),Unexpected_token_expected:ai(1179,1,"Unexpected_token_expected_1179","Unexpected token. '{' expected."),Property_destructuring_pattern_expected:ai(1180,1,"Property_destructuring_pattern_expected_1180","Property destructuring pattern expected."),Array_element_destructuring_pattern_expected:ai(1181,1,"Array_element_destructuring_pattern_expected_1181","Array element destructuring pattern expected."),A_destructuring_declaration_must_have_an_initializer:ai(1182,1,"A_destructuring_declaration_must_have_an_initializer_1182","A destructuring declaration must have an initializer."),An_implementation_cannot_be_declared_in_ambient_contexts:ai(1183,1,"An_implementation_cannot_be_declared_in_ambient_contexts_1183","An implementation cannot be declared in ambient contexts."),Modifiers_cannot_appear_here:ai(1184,1,"Modifiers_cannot_appear_here_1184","Modifiers cannot appear here."),Merge_conflict_marker_encountered:ai(1185,1,"Merge_conflict_marker_encountered_1185","Merge conflict marker encountered."),A_rest_element_cannot_have_an_initializer:ai(1186,1,"A_rest_element_cannot_have_an_initializer_1186","A rest element cannot have an initializer."),A_parameter_property_may_not_be_declared_using_a_binding_pattern:ai(1187,1,"A_parameter_property_may_not_be_declared_using_a_binding_pattern_1187","A parameter property may not be declared using a binding pattern."),Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement:ai(1188,1,"Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement_1188","Only a single variable declaration is allowed in a 'for...of' statement."),The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer:ai(1189,1,"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189","The variable declaration of a 'for...in' statement cannot have an initializer."),The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer:ai(1190,1,"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190","The variable declaration of a 'for...of' statement cannot have an initializer."),An_import_declaration_cannot_have_modifiers:ai(1191,1,"An_import_declaration_cannot_have_modifiers_1191","An import declaration cannot have modifiers."),Module_0_has_no_default_export:ai(1192,1,"Module_0_has_no_default_export_1192","Module '{0}' has no default export."),An_export_declaration_cannot_have_modifiers:ai(1193,1,"An_export_declaration_cannot_have_modifiers_1193","An export declaration cannot have modifiers."),Export_declarations_are_not_permitted_in_a_namespace:ai(1194,1,"Export_declarations_are_not_permitted_in_a_namespace_1194","Export declarations are not permitted in a namespace."),export_Asterisk_does_not_re_export_a_default:ai(1195,1,"export_Asterisk_does_not_re_export_a_default_1195","'export *' does not re-export a default."),Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified:ai(1196,1,"Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified_1196","Catch clause variable type annotation must be 'any' or 'unknown' if specified."),Catch_clause_variable_cannot_have_an_initializer:ai(1197,1,"Catch_clause_variable_cannot_have_an_initializer_1197","Catch clause variable cannot have an initializer."),An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive:ai(1198,1,"An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198","An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive."),Unterminated_Unicode_escape_sequence:ai(1199,1,"Unterminated_Unicode_escape_sequence_1199","Unterminated Unicode escape sequence."),Line_terminator_not_permitted_before_arrow:ai(1200,1,"Line_terminator_not_permitted_before_arrow_1200","Line terminator not permitted before arrow."),Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead:ai(1202,1,"Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_1202","Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead."),Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead:ai(1203,1,"Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203","Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead."),Re_exporting_a_type_when_0_is_enabled_requires_using_export_type:ai(1205,1,"Re_exporting_a_type_when_0_is_enabled_requires_using_export_type_1205","Re-exporting a type when '{0}' is enabled requires using 'export type'."),Decorators_are_not_valid_here:ai(1206,1,"Decorators_are_not_valid_here_1206","Decorators are not valid here."),Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name:ai(1207,1,"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207","Decorators cannot be applied to multiple get/set accessors of the same name."),Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0:ai(1209,1,"Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0_1209","Invalid optional chain from new expression. Did you mean to call '{0}()'?"),Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode:ai(1210,1,"Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of__1210","Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of '{0}'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode."),A_class_declaration_without_the_default_modifier_must_have_a_name:ai(1211,1,"A_class_declaration_without_the_default_modifier_must_have_a_name_1211","A class declaration without the 'default' modifier must have a name."),Identifier_expected_0_is_a_reserved_word_in_strict_mode:ai(1212,1,"Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212","Identifier expected. '{0}' is a reserved word in strict mode."),Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode:ai(1213,1,"Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213","Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode."),Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode:ai(1214,1,"Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214","Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode."),Invalid_use_of_0_Modules_are_automatically_in_strict_mode:ai(1215,1,"Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215","Invalid use of '{0}'. Modules are automatically in strict mode."),Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules:ai(1216,1,"Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216","Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules."),Export_assignment_is_not_supported_when_module_flag_is_system:ai(1218,1,"Export_assignment_is_not_supported_when_module_flag_is_system_1218","Export assignment is not supported when '--module' flag is 'system'."),Generators_are_not_allowed_in_an_ambient_context:ai(1221,1,"Generators_are_not_allowed_in_an_ambient_context_1221","Generators are not allowed in an ambient context."),An_overload_signature_cannot_be_declared_as_a_generator:ai(1222,1,"An_overload_signature_cannot_be_declared_as_a_generator_1222","An overload signature cannot be declared as a generator."),_0_tag_already_specified:ai(1223,1,"_0_tag_already_specified_1223","'{0}' tag already specified."),Signature_0_must_be_a_type_predicate:ai(1224,1,"Signature_0_must_be_a_type_predicate_1224","Signature '{0}' must be a type predicate."),Cannot_find_parameter_0:ai(1225,1,"Cannot_find_parameter_0_1225","Cannot find parameter '{0}'."),Type_predicate_0_is_not_assignable_to_1:ai(1226,1,"Type_predicate_0_is_not_assignable_to_1_1226","Type predicate '{0}' is not assignable to '{1}'."),Parameter_0_is_not_in_the_same_position_as_parameter_1:ai(1227,1,"Parameter_0_is_not_in_the_same_position_as_parameter_1_1227","Parameter '{0}' is not in the same position as parameter '{1}'."),A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods:ai(1228,1,"A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods_1228","A type predicate is only allowed in return type position for functions and methods."),A_type_predicate_cannot_reference_a_rest_parameter:ai(1229,1,"A_type_predicate_cannot_reference_a_rest_parameter_1229","A type predicate cannot reference a rest parameter."),A_type_predicate_cannot_reference_element_0_in_a_binding_pattern:ai(1230,1,"A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230","A type predicate cannot reference element '{0}' in a binding pattern."),An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration:ai(1231,1,"An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration_1231","An export assignment must be at the top level of a file or module declaration."),An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module:ai(1232,1,"An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module_1232","An import declaration can only be used at the top level of a namespace or module."),An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module:ai(1233,1,"An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module_1233","An export declaration can only be used at the top level of a namespace or module."),An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file:ai(1234,1,"An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234","An ambient module declaration is only allowed at the top level in a file."),A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module:ai(1235,1,"A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235","A namespace declaration is only allowed at the top level of a namespace or module."),The_return_type_of_a_property_decorator_function_must_be_either_void_or_any:ai(1236,1,"The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236","The return type of a property decorator function must be either 'void' or 'any'."),The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any:ai(1237,1,"The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237","The return type of a parameter decorator function must be either 'void' or 'any'."),Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression:ai(1238,1,"Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238","Unable to resolve signature of class decorator when called as an expression."),Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression:ai(1239,1,"Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239","Unable to resolve signature of parameter decorator when called as an expression."),Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression:ai(1240,1,"Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240","Unable to resolve signature of property decorator when called as an expression."),Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression:ai(1241,1,"Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241","Unable to resolve signature of method decorator when called as an expression."),abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration:ai(1242,1,"abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242","'abstract' modifier can only appear on a class, method, or property declaration."),_0_modifier_cannot_be_used_with_1_modifier:ai(1243,1,"_0_modifier_cannot_be_used_with_1_modifier_1243","'{0}' modifier cannot be used with '{1}' modifier."),Abstract_methods_can_only_appear_within_an_abstract_class:ai(1244,1,"Abstract_methods_can_only_appear_within_an_abstract_class_1244","Abstract methods can only appear within an abstract class."),Method_0_cannot_have_an_implementation_because_it_is_marked_abstract:ai(1245,1,"Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245","Method '{0}' cannot have an implementation because it is marked abstract."),An_interface_property_cannot_have_an_initializer:ai(1246,1,"An_interface_property_cannot_have_an_initializer_1246","An interface property cannot have an initializer."),A_type_literal_property_cannot_have_an_initializer:ai(1247,1,"A_type_literal_property_cannot_have_an_initializer_1247","A type literal property cannot have an initializer."),A_class_member_cannot_have_the_0_keyword:ai(1248,1,"A_class_member_cannot_have_the_0_keyword_1248","A class member cannot have the '{0}' keyword."),A_decorator_can_only_decorate_a_method_implementation_not_an_overload:ai(1249,1,"A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249","A decorator can only decorate a method implementation, not an overload."),Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5:ai(1250,1,"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250","Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'."),Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode:ai(1251,1,"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251","Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode."),Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode:ai(1252,1,"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252","Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode."),Abstract_properties_can_only_appear_within_an_abstract_class:ai(1253,1,"Abstract_properties_can_only_appear_within_an_abstract_class_1253","Abstract properties can only appear within an abstract class."),A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference:ai(1254,1,"A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_refere_1254","A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference."),A_definite_assignment_assertion_is_not_permitted_in_this_context:ai(1255,1,"A_definite_assignment_assertion_is_not_permitted_in_this_context_1255","A definite assignment assertion '!' is not permitted in this context."),A_required_element_cannot_follow_an_optional_element:ai(1257,1,"A_required_element_cannot_follow_an_optional_element_1257","A required element cannot follow an optional element."),A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration:ai(1258,1,"A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration_1258","A default export must be at the top level of a file or module declaration."),Module_0_can_only_be_default_imported_using_the_1_flag:ai(1259,1,"Module_0_can_only_be_default_imported_using_the_1_flag_1259","Module '{0}' can only be default-imported using the '{1}' flag"),Keywords_cannot_contain_escape_characters:ai(1260,1,"Keywords_cannot_contain_escape_characters_1260","Keywords cannot contain escape characters."),Already_included_file_name_0_differs_from_file_name_1_only_in_casing:ai(1261,1,"Already_included_file_name_0_differs_from_file_name_1_only_in_casing_1261","Already included file name '{0}' differs from file name '{1}' only in casing."),Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module:ai(1262,1,"Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module_1262","Identifier expected. '{0}' is a reserved word at the top-level of a module."),Declarations_with_initializers_cannot_also_have_definite_assignment_assertions:ai(1263,1,"Declarations_with_initializers_cannot_also_have_definite_assignment_assertions_1263","Declarations with initializers cannot also have definite assignment assertions."),Declarations_with_definite_assignment_assertions_must_also_have_type_annotations:ai(1264,1,"Declarations_with_definite_assignment_assertions_must_also_have_type_annotations_1264","Declarations with definite assignment assertions must also have type annotations."),A_rest_element_cannot_follow_another_rest_element:ai(1265,1,"A_rest_element_cannot_follow_another_rest_element_1265","A rest element cannot follow another rest element."),An_optional_element_cannot_follow_a_rest_element:ai(1266,1,"An_optional_element_cannot_follow_a_rest_element_1266","An optional element cannot follow a rest element."),Property_0_cannot_have_an_initializer_because_it_is_marked_abstract:ai(1267,1,"Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267","Property '{0}' cannot have an initializer because it is marked abstract."),An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type:ai(1268,1,"An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type_1268","An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type."),Cannot_use_export_import_on_a_type_or_type_only_namespace_when_0_is_enabled:ai(1269,1,"Cannot_use_export_import_on_a_type_or_type_only_namespace_when_0_is_enabled_1269","Cannot use 'export import' on a type or type-only namespace when '{0}' is enabled."),Decorator_function_return_type_0_is_not_assignable_to_type_1:ai(1270,1,"Decorator_function_return_type_0_is_not_assignable_to_type_1_1270","Decorator function return type '{0}' is not assignable to type '{1}'."),Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any:ai(1271,1,"Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any_1271","Decorator function return type is '{0}' but is expected to be 'void' or 'any'."),A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled:ai(1272,1,"A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272","A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."),_0_modifier_cannot_appear_on_a_type_parameter:ai(1273,1,"_0_modifier_cannot_appear_on_a_type_parameter_1273","'{0}' modifier cannot appear on a type parameter"),_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias:ai(1274,1,"_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274","'{0}' modifier can only appear on a type parameter of a class, interface or type alias"),accessor_modifier_can_only_appear_on_a_property_declaration:ai(1275,1,"accessor_modifier_can_only_appear_on_a_property_declaration_1275","'accessor' modifier can only appear on a property declaration."),An_accessor_property_cannot_be_declared_optional:ai(1276,1,"An_accessor_property_cannot_be_declared_optional_1276","An 'accessor' property cannot be declared optional."),_0_modifier_can_only_appear_on_a_type_parameter_of_a_function_method_or_class:ai(1277,1,"_0_modifier_can_only_appear_on_a_type_parameter_of_a_function_method_or_class_1277","'{0}' modifier can only appear on a type parameter of a function, method or class"),The_runtime_will_invoke_the_decorator_with_1_arguments_but_the_decorator_expects_0:ai(1278,1,"The_runtime_will_invoke_the_decorator_with_1_arguments_but_the_decorator_expects_0_1278","The runtime will invoke the decorator with {1} arguments, but the decorator expects {0}."),The_runtime_will_invoke_the_decorator_with_1_arguments_but_the_decorator_expects_at_least_0:ai(1279,1,"The_runtime_will_invoke_the_decorator_with_1_arguments_but_the_decorator_expects_at_least_0_1279","The runtime will invoke the decorator with {1} arguments, but the decorator expects at least {0}."),Namespaces_are_not_allowed_in_global_script_files_when_0_is_enabled_If_this_file_is_not_intended_to_be_a_global_script_set_moduleDetection_to_force_or_add_an_empty_export_statement:ai(1280,1,"Namespaces_are_not_allowed_in_global_script_files_when_0_is_enabled_If_this_file_is_not_intended_to__1280","Namespaces are not allowed in global script files when '{0}' is enabled. If this file is not intended to be a global script, set 'moduleDetection' to 'force' or add an empty 'export {}' statement."),Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead:ai(1281,1,"Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead_1281","Cannot access '{0}' from another file without qualification when '{1}' is enabled. Use '{2}' instead."),An_export_declaration_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type:ai(1282,1,"An_export_declaration_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers__1282","An 'export =' declaration must reference a value when 'verbatimModuleSyntax' is enabled, but '{0}' only refers to a type."),An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration:ai(1283,1,"An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolve_1283","An 'export =' declaration must reference a real value when 'verbatimModuleSyntax' is enabled, but '{0}' resolves to a type-only declaration."),An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type:ai(1284,1,"An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_1284","An 'export default' must reference a value when 'verbatimModuleSyntax' is enabled, but '{0}' only refers to a type."),An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration:ai(1285,1,"An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_1285","An 'export default' must reference a real value when 'verbatimModuleSyntax' is enabled, but '{0}' resolves to a type-only declaration."),ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled:ai(1286,1,"ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286","ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled."),A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled:ai(1287,1,"A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimM_1287","A top-level 'export' modifier cannot be used on value declarations in a CommonJS module when 'verbatimModuleSyntax' is enabled."),An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabled:ai(1288,1,"An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabl_1288","An import alias cannot resolve to a type or type-only declaration when 'verbatimModuleSyntax' is enabled."),with_statements_are_not_allowed_in_an_async_function_block:ai(1300,1,"with_statements_are_not_allowed_in_an_async_function_block_1300","'with' statements are not allowed in an async function block."),await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules:ai(1308,1,"await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308","'await' expressions are only allowed within async functions and at the top levels of modules."),The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level:ai(1309,1,"The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309","The current file is a CommonJS module and cannot use 'await' at the top level."),Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern:ai(1312,1,"Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312","Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),The_body_of_an_if_statement_cannot_be_the_empty_statement:ai(1313,1,"The_body_of_an_if_statement_cannot_be_the_empty_statement_1313","The body of an 'if' statement cannot be the empty statement."),Global_module_exports_may_only_appear_in_module_files:ai(1314,1,"Global_module_exports_may_only_appear_in_module_files_1314","Global module exports may only appear in module files."),Global_module_exports_may_only_appear_in_declaration_files:ai(1315,1,"Global_module_exports_may_only_appear_in_declaration_files_1315","Global module exports may only appear in declaration files."),Global_module_exports_may_only_appear_at_top_level:ai(1316,1,"Global_module_exports_may_only_appear_at_top_level_1316","Global module exports may only appear at top level."),A_parameter_property_cannot_be_declared_using_a_rest_parameter:ai(1317,1,"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317","A parameter property cannot be declared using a rest parameter."),An_abstract_accessor_cannot_have_an_implementation:ai(1318,1,"An_abstract_accessor_cannot_have_an_implementation_1318","An abstract accessor cannot have an implementation."),A_default_export_can_only_be_used_in_an_ECMAScript_style_module:ai(1319,1,"A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319","A default export can only be used in an ECMAScript-style module."),Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member:ai(1320,1,"Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320","Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."),Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member:ai(1321,1,"Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321","Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member:ai(1322,1,"Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322","Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext:ai(1323,1,"Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323","Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'."),Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext:ai(1324,1,"Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nod_1324","Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'."),Argument_of_dynamic_import_cannot_be_spread_element:ai(1325,1,"Argument_of_dynamic_import_cannot_be_spread_element_1325","Argument of dynamic import cannot be spread element."),This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments:ai(1326,1,"This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326","This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),String_literal_with_double_quotes_expected:ai(1327,1,"String_literal_with_double_quotes_expected_1327","String literal with double quotes expected."),Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal:ai(1328,1,"Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328","Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal."),_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0:ai(1329,1,"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329","'{0}' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@{0}()'?"),A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly:ai(1330,1,"A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly_1330","A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'."),A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly:ai(1331,1,"A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly_1331","A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'."),A_variable_whose_type_is_a_unique_symbol_type_must_be_const:ai(1332,1,"A_variable_whose_type_is_a_unique_symbol_type_must_be_const_1332","A variable whose type is a 'unique symbol' type must be 'const'."),unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name:ai(1333,1,"unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name_1333","'unique symbol' types may not be used on a variable declaration with a binding name."),unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement:ai(1334,1,"unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement_1334","'unique symbol' types are only allowed on variables in a variable statement."),unique_symbol_types_are_not_allowed_here:ai(1335,1,"unique_symbol_types_are_not_allowed_here_1335","'unique symbol' types are not allowed here."),An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead:ai(1337,1,"An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_o_1337","An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead."),infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type:ai(1338,1,"infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type_1338","'infer' declarations are only permitted in the 'extends' clause of a conditional type."),Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here:ai(1339,1,"Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339","Module '{0}' does not refer to a value, but is used as a value here."),Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0:ai(1340,1,"Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340","Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),Class_constructor_may_not_be_an_accessor:ai(1341,1,"Class_constructor_may_not_be_an_accessor_1341","Class constructor may not be an accessor."),The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext:ai(1343,1,"The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343","The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),A_label_is_not_allowed_here:ai(1344,1,"A_label_is_not_allowed_here_1344","'A label is not allowed here."),An_expression_of_type_void_cannot_be_tested_for_truthiness:ai(1345,1,"An_expression_of_type_void_cannot_be_tested_for_truthiness_1345","An expression of type 'void' cannot be tested for truthiness."),This_parameter_is_not_allowed_with_use_strict_directive:ai(1346,1,"This_parameter_is_not_allowed_with_use_strict_directive_1346","This parameter is not allowed with 'use strict' directive."),use_strict_directive_cannot_be_used_with_non_simple_parameter_list:ai(1347,1,"use_strict_directive_cannot_be_used_with_non_simple_parameter_list_1347","'use strict' directive cannot be used with non-simple parameter list."),Non_simple_parameter_declared_here:ai(1348,1,"Non_simple_parameter_declared_here_1348","Non-simple parameter declared here."),use_strict_directive_used_here:ai(1349,1,"use_strict_directive_used_here_1349","'use strict' directive used here."),Print_the_final_configuration_instead_of_building:ai(1350,3,"Print_the_final_configuration_instead_of_building_1350","Print the final configuration instead of building."),An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal:ai(1351,1,"An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal_1351","An identifier or keyword cannot immediately follow a numeric literal."),A_bigint_literal_cannot_use_exponential_notation:ai(1352,1,"A_bigint_literal_cannot_use_exponential_notation_1352","A bigint literal cannot use exponential notation."),A_bigint_literal_must_be_an_integer:ai(1353,1,"A_bigint_literal_must_be_an_integer_1353","A bigint literal must be an integer."),readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types:ai(1354,1,"readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354","'readonly' type modifier is only permitted on array and tuple literal types."),A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals:ai(1355,1,"A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355","A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals."),Did_you_mean_to_mark_this_function_as_async:ai(1356,1,"Did_you_mean_to_mark_this_function_as_async_1356","Did you mean to mark this function as 'async'?"),An_enum_member_name_must_be_followed_by_a_or:ai(1357,1,"An_enum_member_name_must_be_followed_by_a_or_1357","An enum member name must be followed by a ',', '=', or '}'."),Tagged_template_expressions_are_not_permitted_in_an_optional_chain:ai(1358,1,"Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358","Tagged template expressions are not permitted in an optional chain."),Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here:ai(1359,1,"Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359","Identifier expected. '{0}' is a reserved word that cannot be used here."),Type_0_does_not_satisfy_the_expected_type_1:ai(1360,1,"Type_0_does_not_satisfy_the_expected_type_1_1360","Type '{0}' does not satisfy the expected type '{1}'."),_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type:ai(1361,1,"_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361","'{0}' cannot be used as a value because it was imported using 'import type'."),_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type:ai(1362,1,"_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362","'{0}' cannot be used as a value because it was exported using 'export type'."),A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both:ai(1363,1,"A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363","A type-only import can specify a default import or named bindings, but not both."),Convert_to_type_only_export:ai(1364,3,"Convert_to_type_only_export_1364","Convert to type-only export"),Convert_all_re_exported_types_to_type_only_exports:ai(1365,3,"Convert_all_re_exported_types_to_type_only_exports_1365","Convert all re-exported types to type-only exports"),Split_into_two_separate_import_declarations:ai(1366,3,"Split_into_two_separate_import_declarations_1366","Split into two separate import declarations"),Split_all_invalid_type_only_imports:ai(1367,3,"Split_all_invalid_type_only_imports_1367","Split all invalid type-only imports"),Class_constructor_may_not_be_a_generator:ai(1368,1,"Class_constructor_may_not_be_a_generator_1368","Class constructor may not be a generator."),Did_you_mean_0:ai(1369,3,"Did_you_mean_0_1369","Did you mean '{0}'?"),This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error:ai(1371,1,"This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371","This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."),await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module:ai(1375,1,"await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375","'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),_0_was_imported_here:ai(1376,3,"_0_was_imported_here_1376","'{0}' was imported here."),_0_was_exported_here:ai(1377,3,"_0_was_exported_here_1377","'{0}' was exported here."),Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher:ai(1378,1,"Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378","Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type:ai(1379,1,"An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379","An import alias cannot reference a declaration that was exported using 'export type'."),An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type:ai(1380,1,"An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380","An import alias cannot reference a declaration that was imported using 'import type'."),Unexpected_token_Did_you_mean_or_rbrace:ai(1381,1,"Unexpected_token_Did_you_mean_or_rbrace_1381","Unexpected token. Did you mean `{'}'}` or `}`?"),Unexpected_token_Did_you_mean_or_gt:ai(1382,1,"Unexpected_token_Did_you_mean_or_gt_1382","Unexpected token. Did you mean `{'>'}` or `>`?"),Function_type_notation_must_be_parenthesized_when_used_in_a_union_type:ai(1385,1,"Function_type_notation_must_be_parenthesized_when_used_in_a_union_type_1385","Function type notation must be parenthesized when used in a union type."),Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type:ai(1386,1,"Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type_1386","Constructor type notation must be parenthesized when used in a union type."),Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type:ai(1387,1,"Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387","Function type notation must be parenthesized when used in an intersection type."),Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type:ai(1388,1,"Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1388","Constructor type notation must be parenthesized when used in an intersection type."),_0_is_not_allowed_as_a_variable_declaration_name:ai(1389,1,"_0_is_not_allowed_as_a_variable_declaration_name_1389","'{0}' is not allowed as a variable declaration name."),_0_is_not_allowed_as_a_parameter_name:ai(1390,1,"_0_is_not_allowed_as_a_parameter_name_1390","'{0}' is not allowed as a parameter name."),An_import_alias_cannot_use_import_type:ai(1392,1,"An_import_alias_cannot_use_import_type_1392","An import alias cannot use 'import type'"),Imported_via_0_from_file_1:ai(1393,3,"Imported_via_0_from_file_1_1393","Imported via {0} from file '{1}'"),Imported_via_0_from_file_1_with_packageId_2:ai(1394,3,"Imported_via_0_from_file_1_with_packageId_2_1394","Imported via {0} from file '{1}' with packageId '{2}'"),Imported_via_0_from_file_1_to_import_importHelpers_as_specified_in_compilerOptions:ai(1395,3,"Imported_via_0_from_file_1_to_import_importHelpers_as_specified_in_compilerOptions_1395","Imported via {0} from file '{1}' to import 'importHelpers' as specified in compilerOptions"),Imported_via_0_from_file_1_with_packageId_2_to_import_importHelpers_as_specified_in_compilerOptions:ai(1396,3,"Imported_via_0_from_file_1_with_packageId_2_to_import_importHelpers_as_specified_in_compilerOptions_1396","Imported via {0} from file '{1}' with packageId '{2}' to import 'importHelpers' as specified in compilerOptions"),Imported_via_0_from_file_1_to_import_jsx_and_jsxs_factory_functions:ai(1397,3,"Imported_via_0_from_file_1_to_import_jsx_and_jsxs_factory_functions_1397","Imported via {0} from file '{1}' to import 'jsx' and 'jsxs' factory functions"),Imported_via_0_from_file_1_with_packageId_2_to_import_jsx_and_jsxs_factory_functions:ai(1398,3,"Imported_via_0_from_file_1_with_packageId_2_to_import_jsx_and_jsxs_factory_functions_1398","Imported via {0} from file '{1}' with packageId '{2}' to import 'jsx' and 'jsxs' factory functions"),File_is_included_via_import_here:ai(1399,3,"File_is_included_via_import_here_1399","File is included via import here."),Referenced_via_0_from_file_1:ai(1400,3,"Referenced_via_0_from_file_1_1400","Referenced via '{0}' from file '{1}'"),File_is_included_via_reference_here:ai(1401,3,"File_is_included_via_reference_here_1401","File is included via reference here."),Type_library_referenced_via_0_from_file_1:ai(1402,3,"Type_library_referenced_via_0_from_file_1_1402","Type library referenced via '{0}' from file '{1}'"),Type_library_referenced_via_0_from_file_1_with_packageId_2:ai(1403,3,"Type_library_referenced_via_0_from_file_1_with_packageId_2_1403","Type library referenced via '{0}' from file '{1}' with packageId '{2}'"),File_is_included_via_type_library_reference_here:ai(1404,3,"File_is_included_via_type_library_reference_here_1404","File is included via type library reference here."),Library_referenced_via_0_from_file_1:ai(1405,3,"Library_referenced_via_0_from_file_1_1405","Library referenced via '{0}' from file '{1}'"),File_is_included_via_library_reference_here:ai(1406,3,"File_is_included_via_library_reference_here_1406","File is included via library reference here."),Matched_by_include_pattern_0_in_1:ai(1407,3,"Matched_by_include_pattern_0_in_1_1407","Matched by include pattern '{0}' in '{1}'"),File_is_matched_by_include_pattern_specified_here:ai(1408,3,"File_is_matched_by_include_pattern_specified_here_1408","File is matched by include pattern specified here."),Part_of_files_list_in_tsconfig_json:ai(1409,3,"Part_of_files_list_in_tsconfig_json_1409","Part of 'files' list in tsconfig.json"),File_is_matched_by_files_list_specified_here:ai(1410,3,"File_is_matched_by_files_list_specified_here_1410","File is matched by 'files' list specified here."),Output_from_referenced_project_0_included_because_1_specified:ai(1411,3,"Output_from_referenced_project_0_included_because_1_specified_1411","Output from referenced project '{0}' included because '{1}' specified"),Output_from_referenced_project_0_included_because_module_is_specified_as_none:ai(1412,3,"Output_from_referenced_project_0_included_because_module_is_specified_as_none_1412","Output from referenced project '{0}' included because '--module' is specified as 'none'"),File_is_output_from_referenced_project_specified_here:ai(1413,3,"File_is_output_from_referenced_project_specified_here_1413","File is output from referenced project specified here."),Source_from_referenced_project_0_included_because_1_specified:ai(1414,3,"Source_from_referenced_project_0_included_because_1_specified_1414","Source from referenced project '{0}' included because '{1}' specified"),Source_from_referenced_project_0_included_because_module_is_specified_as_none:ai(1415,3,"Source_from_referenced_project_0_included_because_module_is_specified_as_none_1415","Source from referenced project '{0}' included because '--module' is specified as 'none'"),File_is_source_from_referenced_project_specified_here:ai(1416,3,"File_is_source_from_referenced_project_specified_here_1416","File is source from referenced project specified here."),Entry_point_of_type_library_0_specified_in_compilerOptions:ai(1417,3,"Entry_point_of_type_library_0_specified_in_compilerOptions_1417","Entry point of type library '{0}' specified in compilerOptions"),Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1:ai(1418,3,"Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1_1418","Entry point of type library '{0}' specified in compilerOptions with packageId '{1}'"),File_is_entry_point_of_type_library_specified_here:ai(1419,3,"File_is_entry_point_of_type_library_specified_here_1419","File is entry point of type library specified here."),Entry_point_for_implicit_type_library_0:ai(1420,3,"Entry_point_for_implicit_type_library_0_1420","Entry point for implicit type library '{0}'"),Entry_point_for_implicit_type_library_0_with_packageId_1:ai(1421,3,"Entry_point_for_implicit_type_library_0_with_packageId_1_1421","Entry point for implicit type library '{0}' with packageId '{1}'"),Library_0_specified_in_compilerOptions:ai(1422,3,"Library_0_specified_in_compilerOptions_1422","Library '{0}' specified in compilerOptions"),File_is_library_specified_here:ai(1423,3,"File_is_library_specified_here_1423","File is library specified here."),Default_library:ai(1424,3,"Default_library_1424","Default library"),Default_library_for_target_0:ai(1425,3,"Default_library_for_target_0_1425","Default library for target '{0}'"),File_is_default_library_for_target_specified_here:ai(1426,3,"File_is_default_library_for_target_specified_here_1426","File is default library for target specified here."),Root_file_specified_for_compilation:ai(1427,3,"Root_file_specified_for_compilation_1427","Root file specified for compilation"),File_is_output_of_project_reference_source_0:ai(1428,3,"File_is_output_of_project_reference_source_0_1428","File is output of project reference source '{0}'"),File_redirects_to_file_0:ai(1429,3,"File_redirects_to_file_0_1429","File redirects to file '{0}'"),The_file_is_in_the_program_because_Colon:ai(1430,3,"The_file_is_in_the_program_because_Colon_1430","The file is in the program because:"),for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module:ai(1431,1,"for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_1431","'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher:ai(1432,1,"Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432","Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters:ai(1433,1,"Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters_1433","Neither decorators nor modifiers may be applied to 'this' parameters."),Unexpected_keyword_or_identifier:ai(1434,1,"Unexpected_keyword_or_identifier_1434","Unexpected keyword or identifier."),Unknown_keyword_or_identifier_Did_you_mean_0:ai(1435,1,"Unknown_keyword_or_identifier_Did_you_mean_0_1435","Unknown keyword or identifier. Did you mean '{0}'?"),Decorators_must_precede_the_name_and_all_keywords_of_property_declarations:ai(1436,1,"Decorators_must_precede_the_name_and_all_keywords_of_property_declarations_1436","Decorators must precede the name and all keywords of property declarations."),Namespace_must_be_given_a_name:ai(1437,1,"Namespace_must_be_given_a_name_1437","Namespace must be given a name."),Interface_must_be_given_a_name:ai(1438,1,"Interface_must_be_given_a_name_1438","Interface must be given a name."),Type_alias_must_be_given_a_name:ai(1439,1,"Type_alias_must_be_given_a_name_1439","Type alias must be given a name."),Variable_declaration_not_allowed_at_this_location:ai(1440,1,"Variable_declaration_not_allowed_at_this_location_1440","Variable declaration not allowed at this location."),Cannot_start_a_function_call_in_a_type_annotation:ai(1441,1,"Cannot_start_a_function_call_in_a_type_annotation_1441","Cannot start a function call in a type annotation."),Expected_for_property_initializer:ai(1442,1,"Expected_for_property_initializer_1442","Expected '=' for property initializer."),Module_declaration_names_may_only_use_or_quoted_strings:ai(1443,1,"Module_declaration_names_may_only_use_or_quoted_strings_1443","Module declaration names may only use ' or \" quoted strings."),_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled:ai(1444,1,"_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedMod_1444","'{0}' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled."),_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled:ai(1446,1,"_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveVa_1446","'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled."),_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_1_is_enabled:ai(1448,1,"_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_1_is_1448","'{0}' resolves to a type-only declaration and must be re-exported using a type-only re-export when '{1}' is enabled."),Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed:ai(1449,3,"Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449","Preserve unused imported values in the JavaScript output that would otherwise be removed."),Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments:ai(1450,3,"Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450","Dynamic imports can only accept a module specifier and an optional assertion as arguments"),Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression:ai(1451,1,"Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451","Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"),resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext:ai(1452,1,"resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452","'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`."),resolution_mode_should_be_either_require_or_import:ai(1453,1,"resolution_mode_should_be_either_require_or_import_1453","`resolution-mode` should be either `require` or `import`."),resolution_mode_can_only_be_set_for_type_only_imports:ai(1454,1,"resolution_mode_can_only_be_set_for_type_only_imports_1454","`resolution-mode` can only be set for type-only imports."),resolution_mode_is_the_only_valid_key_for_type_import_assertions:ai(1455,1,"resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455","`resolution-mode` is the only valid key for type import assertions."),Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require:ai(1456,1,"Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require_1456","Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`."),Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk:ai(1457,3,"Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457","Matched by default include pattern '**/*'"),File_is_ECMAScript_module_because_0_has_field_type_with_value_module:ai(1458,3,"File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458",'File is ECMAScript module because \'{0}\' has field "type" with value "module"'),File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module:ai(1459,3,"File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459",'File is CommonJS module because \'{0}\' has field "type" whose value is not "module"'),File_is_CommonJS_module_because_0_does_not_have_field_type:ai(1460,3,"File_is_CommonJS_module_because_0_does_not_have_field_type_1460","File is CommonJS module because '{0}' does not have field \"type\""),File_is_CommonJS_module_because_package_json_was_not_found:ai(1461,3,"File_is_CommonJS_module_because_package_json_was_not_found_1461","File is CommonJS module because 'package.json' was not found"),The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output:ai(1470,1,"The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470","The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead:ai(1471,1,"Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471","Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead."),catch_or_finally_expected:ai(1472,1,"catch_or_finally_expected_1472","'catch' or 'finally' expected."),An_import_declaration_can_only_be_used_at_the_top_level_of_a_module:ai(1473,1,"An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473","An import declaration can only be used at the top level of a module."),An_export_declaration_can_only_be_used_at_the_top_level_of_a_module:ai(1474,1,"An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474","An export declaration can only be used at the top level of a module."),Control_what_method_is_used_to_detect_module_format_JS_files:ai(1475,3,"Control_what_method_is_used_to_detect_module_format_JS_files_1475","Control what method is used to detect module-format JS files."),auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules:ai(1476,3,"auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476",'"auto": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules.'),An_instantiation_expression_cannot_be_followed_by_a_property_access:ai(1477,1,"An_instantiation_expression_cannot_be_followed_by_a_property_access_1477","An instantiation expression cannot be followed by a property access."),Identifier_or_string_literal_expected:ai(1478,1,"Identifier_or_string_literal_expected_1478","Identifier or string literal expected."),The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead:ai(1479,1,"The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479","The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"{0}\")' call instead."),To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module:ai(1480,3,"To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480",'To convert this file to an ECMAScript module, change its file extension to \'{0}\' or create a local package.json file with `{ "type": "module" }`.'),To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1:ai(1481,3,"To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481","To convert this file to an ECMAScript module, change its file extension to '{0}', or add the field `\"type\": \"module\"` to '{1}'."),To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0:ai(1482,3,"To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482",'To convert this file to an ECMAScript module, add the field `"type": "module"` to \'{0}\'.'),To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module:ai(1483,3,"To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483",'To convert this file to an ECMAScript module, create a local package.json file with `{ "type": "module" }`.'),_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled:ai(1484,1,"_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled_1484","'{0}' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled:ai(1485,1,"_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimMo_1485","'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),Decorator_used_before_export_here:ai(1486,1,"Decorator_used_before_export_here_1486","Decorator used before 'export' here."),Octal_escape_sequences_are_not_allowed_Use_the_syntax_0:ai(1487,1,"Octal_escape_sequences_are_not_allowed_Use_the_syntax_0_1487","Octal escape sequences are not allowed. Use the syntax '{0}'."),Escape_sequence_0_is_not_allowed:ai(1488,1,"Escape_sequence_0_is_not_allowed_1488","Escape sequence '{0}' is not allowed."),Decimals_with_leading_zeros_are_not_allowed:ai(1489,1,"Decimals_with_leading_zeros_are_not_allowed_1489","Decimals with leading zeros are not allowed."),File_appears_to_be_binary:ai(1490,1,"File_appears_to_be_binary_1490","File appears to be binary."),_0_modifier_cannot_appear_on_a_using_declaration:ai(1491,1,"_0_modifier_cannot_appear_on_a_using_declaration_1491","'{0}' modifier cannot appear on a 'using' declaration."),_0_declarations_may_not_have_binding_patterns:ai(1492,1,"_0_declarations_may_not_have_binding_patterns_1492","'{0}' declarations may not have binding patterns."),The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration:ai(1493,1,"The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration_1493","The left-hand side of a 'for...in' statement cannot be a 'using' declaration."),The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration:ai(1494,1,"The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration_1494","The left-hand side of a 'for...in' statement cannot be an 'await using' declaration."),_0_modifier_cannot_appear_on_an_await_using_declaration:ai(1495,1,"_0_modifier_cannot_appear_on_an_await_using_declaration_1495","'{0}' modifier cannot appear on an 'await using' declaration."),The_types_of_0_are_incompatible_between_these_types:ai(2200,1,"The_types_of_0_are_incompatible_between_these_types_2200","The types of '{0}' are incompatible between these types."),The_types_returned_by_0_are_incompatible_between_these_types:ai(2201,1,"The_types_returned_by_0_are_incompatible_between_these_types_2201","The types returned by '{0}' are incompatible between these types."),Call_signature_return_types_0_and_1_are_incompatible:ai(2202,1,"Call_signature_return_types_0_and_1_are_incompatible_2202","Call signature return types '{0}' and '{1}' are incompatible.",void 0,!0),Construct_signature_return_types_0_and_1_are_incompatible:ai(2203,1,"Construct_signature_return_types_0_and_1_are_incompatible_2203","Construct signature return types '{0}' and '{1}' are incompatible.",void 0,!0),Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1:ai(2204,1,"Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2204","Call signatures with no arguments have incompatible return types '{0}' and '{1}'.",void 0,!0),Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1:ai(2205,1,"Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205","Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.",void 0,!0),The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement:ai(2206,1,"The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206","The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement:ai(2207,1,"The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207","The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),This_type_parameter_might_need_an_extends_0_constraint:ai(2208,1,"This_type_parameter_might_need_an_extends_0_constraint_2208","This type parameter might need an `extends {0}` constraint."),The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate:ai(2209,1,"The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209","The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate:ai(2210,1,"The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210","The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),Add_extends_constraint:ai(2211,3,"Add_extends_constraint_2211","Add `extends` constraint."),Add_extends_constraint_to_all_type_parameters:ai(2212,3,"Add_extends_constraint_to_all_type_parameters_2212","Add `extends` constraint to all type parameters"),Duplicate_identifier_0:ai(2300,1,"Duplicate_identifier_0_2300","Duplicate identifier '{0}'."),Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor:ai(2301,1,"Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301","Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),Static_members_cannot_reference_class_type_parameters:ai(2302,1,"Static_members_cannot_reference_class_type_parameters_2302","Static members cannot reference class type parameters."),Circular_definition_of_import_alias_0:ai(2303,1,"Circular_definition_of_import_alias_0_2303","Circular definition of import alias '{0}'."),Cannot_find_name_0:ai(2304,1,"Cannot_find_name_0_2304","Cannot find name '{0}'."),Module_0_has_no_exported_member_1:ai(2305,1,"Module_0_has_no_exported_member_1_2305","Module '{0}' has no exported member '{1}'."),File_0_is_not_a_module:ai(2306,1,"File_0_is_not_a_module_2306","File '{0}' is not a module."),Cannot_find_module_0_or_its_corresponding_type_declarations:ai(2307,1,"Cannot_find_module_0_or_its_corresponding_type_declarations_2307","Cannot find module '{0}' or its corresponding type declarations."),Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity:ai(2308,1,"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308","Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity."),An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements:ai(2309,1,"An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309","An export assignment cannot be used in a module with other exported elements."),Type_0_recursively_references_itself_as_a_base_type:ai(2310,1,"Type_0_recursively_references_itself_as_a_base_type_2310","Type '{0}' recursively references itself as a base type."),Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function:ai(2311,1,"Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function_2311","Cannot find name '{0}'. Did you mean to write this in an async function?"),An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members:ai(2312,1,"An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_me_2312","An interface can only extend an object type or intersection of object types with statically known members."),Type_parameter_0_has_a_circular_constraint:ai(2313,1,"Type_parameter_0_has_a_circular_constraint_2313","Type parameter '{0}' has a circular constraint."),Generic_type_0_requires_1_type_argument_s:ai(2314,1,"Generic_type_0_requires_1_type_argument_s_2314","Generic type '{0}' requires {1} type argument(s)."),Type_0_is_not_generic:ai(2315,1,"Type_0_is_not_generic_2315","Type '{0}' is not generic."),Global_type_0_must_be_a_class_or_interface_type:ai(2316,1,"Global_type_0_must_be_a_class_or_interface_type_2316","Global type '{0}' must be a class or interface type."),Global_type_0_must_have_1_type_parameter_s:ai(2317,1,"Global_type_0_must_have_1_type_parameter_s_2317","Global type '{0}' must have {1} type parameter(s)."),Cannot_find_global_type_0:ai(2318,1,"Cannot_find_global_type_0_2318","Cannot find global type '{0}'."),Named_property_0_of_types_1_and_2_are_not_identical:ai(2319,1,"Named_property_0_of_types_1_and_2_are_not_identical_2319","Named property '{0}' of types '{1}' and '{2}' are not identical."),Interface_0_cannot_simultaneously_extend_types_1_and_2:ai(2320,1,"Interface_0_cannot_simultaneously_extend_types_1_and_2_2320","Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'."),Excessive_stack_depth_comparing_types_0_and_1:ai(2321,1,"Excessive_stack_depth_comparing_types_0_and_1_2321","Excessive stack depth comparing types '{0}' and '{1}'."),Type_0_is_not_assignable_to_type_1:ai(2322,1,"Type_0_is_not_assignable_to_type_1_2322","Type '{0}' is not assignable to type '{1}'."),Cannot_redeclare_exported_variable_0:ai(2323,1,"Cannot_redeclare_exported_variable_0_2323","Cannot redeclare exported variable '{0}'."),Property_0_is_missing_in_type_1:ai(2324,1,"Property_0_is_missing_in_type_1_2324","Property '{0}' is missing in type '{1}'."),Property_0_is_private_in_type_1_but_not_in_type_2:ai(2325,1,"Property_0_is_private_in_type_1_but_not_in_type_2_2325","Property '{0}' is private in type '{1}' but not in type '{2}'."),Types_of_property_0_are_incompatible:ai(2326,1,"Types_of_property_0_are_incompatible_2326","Types of property '{0}' are incompatible."),Property_0_is_optional_in_type_1_but_required_in_type_2:ai(2327,1,"Property_0_is_optional_in_type_1_but_required_in_type_2_2327","Property '{0}' is optional in type '{1}' but required in type '{2}'."),Types_of_parameters_0_and_1_are_incompatible:ai(2328,1,"Types_of_parameters_0_and_1_are_incompatible_2328","Types of parameters '{0}' and '{1}' are incompatible."),Index_signature_for_type_0_is_missing_in_type_1:ai(2329,1,"Index_signature_for_type_0_is_missing_in_type_1_2329","Index signature for type '{0}' is missing in type '{1}'."),_0_and_1_index_signatures_are_incompatible:ai(2330,1,"_0_and_1_index_signatures_are_incompatible_2330","'{0}' and '{1}' index signatures are incompatible."),this_cannot_be_referenced_in_a_module_or_namespace_body:ai(2331,1,"this_cannot_be_referenced_in_a_module_or_namespace_body_2331","'this' cannot be referenced in a module or namespace body."),this_cannot_be_referenced_in_current_location:ai(2332,1,"this_cannot_be_referenced_in_current_location_2332","'this' cannot be referenced in current location."),this_cannot_be_referenced_in_constructor_arguments:ai(2333,1,"this_cannot_be_referenced_in_constructor_arguments_2333","'this' cannot be referenced in constructor arguments."),this_cannot_be_referenced_in_a_static_property_initializer:ai(2334,1,"this_cannot_be_referenced_in_a_static_property_initializer_2334","'this' cannot be referenced in a static property initializer."),super_can_only_be_referenced_in_a_derived_class:ai(2335,1,"super_can_only_be_referenced_in_a_derived_class_2335","'super' can only be referenced in a derived class."),super_cannot_be_referenced_in_constructor_arguments:ai(2336,1,"super_cannot_be_referenced_in_constructor_arguments_2336","'super' cannot be referenced in constructor arguments."),Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors:ai(2337,1,"Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337","Super calls are not permitted outside constructors or in nested functions inside constructors."),super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class:ai(2338,1,"super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_der_2338","'super' property access is permitted only in a constructor, member function, or member accessor of a derived class."),Property_0_does_not_exist_on_type_1:ai(2339,1,"Property_0_does_not_exist_on_type_1_2339","Property '{0}' does not exist on type '{1}'."),Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword:ai(2340,1,"Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340","Only public and protected methods of the base class are accessible via the 'super' keyword."),Property_0_is_private_and_only_accessible_within_class_1:ai(2341,1,"Property_0_is_private_and_only_accessible_within_class_1_2341","Property '{0}' is private and only accessible within class '{1}'."),This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0:ai(2343,1,"This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_ve_2343","This syntax requires an imported helper named '{1}' which does not exist in '{0}'. Consider upgrading your version of '{0}'."),Type_0_does_not_satisfy_the_constraint_1:ai(2344,1,"Type_0_does_not_satisfy_the_constraint_1_2344","Type '{0}' does not satisfy the constraint '{1}'."),Argument_of_type_0_is_not_assignable_to_parameter_of_type_1:ai(2345,1,"Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345","Argument of type '{0}' is not assignable to parameter of type '{1}'."),Untyped_function_calls_may_not_accept_type_arguments:ai(2347,1,"Untyped_function_calls_may_not_accept_type_arguments_2347","Untyped function calls may not accept type arguments."),Value_of_type_0_is_not_callable_Did_you_mean_to_include_new:ai(2348,1,"Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348","Value of type '{0}' is not callable. Did you mean to include 'new'?"),This_expression_is_not_callable:ai(2349,1,"This_expression_is_not_callable_2349","This expression is not callable."),Only_a_void_function_can_be_called_with_the_new_keyword:ai(2350,1,"Only_a_void_function_can_be_called_with_the_new_keyword_2350","Only a void function can be called with the 'new' keyword."),This_expression_is_not_constructable:ai(2351,1,"This_expression_is_not_constructable_2351","This expression is not constructable."),Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first:ai(2352,1,"Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352","Conversion of type '{0}' to type '{1}' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first."),Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1:ai(2353,1,"Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353","Object literal may only specify known properties, and '{0}' does not exist in type '{1}'."),This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found:ai(2354,1,"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354","This syntax requires an imported helper but module '{0}' cannot be found."),A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value:ai(2355,1,"A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value_2355","A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value."),An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type:ai(2356,1,"An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type_2356","An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type."),The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access:ai(2357,1,"The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357","The operand of an increment or decrement operator must be a variable or a property access."),The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter:ai(2358,1,"The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358","The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type:ai(2359,1,"The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359","The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."),The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type:ai(2362,1,"The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362","The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type:ai(2363,1,"The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363","The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access:ai(2364,1,"The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364","The left-hand side of an assignment expression must be a variable or a property access."),Operator_0_cannot_be_applied_to_types_1_and_2:ai(2365,1,"Operator_0_cannot_be_applied_to_types_1_and_2_2365","Operator '{0}' cannot be applied to types '{1}' and '{2}'."),Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined:ai(2366,1,"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366","Function lacks ending return statement and return type does not include 'undefined'."),This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap:ai(2367,1,"This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367","This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."),Type_parameter_name_cannot_be_0:ai(2368,1,"Type_parameter_name_cannot_be_0_2368","Type parameter name cannot be '{0}'."),A_parameter_property_is_only_allowed_in_a_constructor_implementation:ai(2369,1,"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369","A parameter property is only allowed in a constructor implementation."),A_rest_parameter_must_be_of_an_array_type:ai(2370,1,"A_rest_parameter_must_be_of_an_array_type_2370","A rest parameter must be of an array type."),A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation:ai(2371,1,"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371","A parameter initializer is only allowed in a function or constructor implementation."),Parameter_0_cannot_reference_itself:ai(2372,1,"Parameter_0_cannot_reference_itself_2372","Parameter '{0}' cannot reference itself."),Parameter_0_cannot_reference_identifier_1_declared_after_it:ai(2373,1,"Parameter_0_cannot_reference_identifier_1_declared_after_it_2373","Parameter '{0}' cannot reference identifier '{1}' declared after it."),Duplicate_index_signature_for_type_0:ai(2374,1,"Duplicate_index_signature_for_type_0_2374","Duplicate index signature for type '{0}'."),Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties:ai(2375,1,"Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2375","Type '{0}' is not assignable to type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers:ai(2376,1,"A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_2376","A 'super' call must be the first statement in the constructor to refer to 'super' or 'this' when a derived class contains initialized properties, parameter properties, or private identifiers."),Constructors_for_derived_classes_must_contain_a_super_call:ai(2377,1,"Constructors_for_derived_classes_must_contain_a_super_call_2377","Constructors for derived classes must contain a 'super' call."),A_get_accessor_must_return_a_value:ai(2378,1,"A_get_accessor_must_return_a_value_2378","A 'get' accessor must return a value."),Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties:ai(2379,1,"Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379","Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),Overload_signatures_must_all_be_exported_or_non_exported:ai(2383,1,"Overload_signatures_must_all_be_exported_or_non_exported_2383","Overload signatures must all be exported or non-exported."),Overload_signatures_must_all_be_ambient_or_non_ambient:ai(2384,1,"Overload_signatures_must_all_be_ambient_or_non_ambient_2384","Overload signatures must all be ambient or non-ambient."),Overload_signatures_must_all_be_public_private_or_protected:ai(2385,1,"Overload_signatures_must_all_be_public_private_or_protected_2385","Overload signatures must all be public, private or protected."),Overload_signatures_must_all_be_optional_or_required:ai(2386,1,"Overload_signatures_must_all_be_optional_or_required_2386","Overload signatures must all be optional or required."),Function_overload_must_be_static:ai(2387,1,"Function_overload_must_be_static_2387","Function overload must be static."),Function_overload_must_not_be_static:ai(2388,1,"Function_overload_must_not_be_static_2388","Function overload must not be static."),Function_implementation_name_must_be_0:ai(2389,1,"Function_implementation_name_must_be_0_2389","Function implementation name must be '{0}'."),Constructor_implementation_is_missing:ai(2390,1,"Constructor_implementation_is_missing_2390","Constructor implementation is missing."),Function_implementation_is_missing_or_not_immediately_following_the_declaration:ai(2391,1,"Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391","Function implementation is missing or not immediately following the declaration."),Multiple_constructor_implementations_are_not_allowed:ai(2392,1,"Multiple_constructor_implementations_are_not_allowed_2392","Multiple constructor implementations are not allowed."),Duplicate_function_implementation:ai(2393,1,"Duplicate_function_implementation_2393","Duplicate function implementation."),This_overload_signature_is_not_compatible_with_its_implementation_signature:ai(2394,1,"This_overload_signature_is_not_compatible_with_its_implementation_signature_2394","This overload signature is not compatible with its implementation signature."),Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local:ai(2395,1,"Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395","Individual declarations in merged declaration '{0}' must be all exported or all local."),Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters:ai(2396,1,"Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396","Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters."),Declaration_name_conflicts_with_built_in_global_identifier_0:ai(2397,1,"Declaration_name_conflicts_with_built_in_global_identifier_0_2397","Declaration name conflicts with built-in global identifier '{0}'."),constructor_cannot_be_used_as_a_parameter_property_name:ai(2398,1,"constructor_cannot_be_used_as_a_parameter_property_name_2398","'constructor' cannot be used as a parameter property name."),Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference:ai(2399,1,"Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399","Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference."),Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference:ai(2400,1,"Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400","Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference."),A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers:ai(2401,1,"A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_in_2401","A 'super' call must be a root-level statement within a constructor of a derived class that contains initialized properties, parameter properties, or private identifiers."),Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference:ai(2402,1,"Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402","Expression resolves to '_super' that compiler uses to capture base class reference."),Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2:ai(2403,1,"Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403","Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'."),The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation:ai(2404,1,"The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404","The left-hand side of a 'for...in' statement cannot use a type annotation."),The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any:ai(2405,1,"The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405","The left-hand side of a 'for...in' statement must be of type 'string' or 'any'."),The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access:ai(2406,1,"The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406","The left-hand side of a 'for...in' statement must be a variable or a property access."),The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0:ai(2407,1,"The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407","The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'."),Setters_cannot_return_a_value:ai(2408,1,"Setters_cannot_return_a_value_2408","Setters cannot return a value."),Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class:ai(2409,1,"Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409","Return type of constructor signature must be assignable to the instance type of the class."),The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any:ai(2410,1,"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410","The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'."),Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target:ai(2412,1,"Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412","Type '{0}' is not assignable to type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the type of the target."),Property_0_of_type_1_is_not_assignable_to_2_index_type_3:ai(2411,1,"Property_0_of_type_1_is_not_assignable_to_2_index_type_3_2411","Property '{0}' of type '{1}' is not assignable to '{2}' index type '{3}'."),_0_index_type_1_is_not_assignable_to_2_index_type_3:ai(2413,1,"_0_index_type_1_is_not_assignable_to_2_index_type_3_2413","'{0}' index type '{1}' is not assignable to '{2}' index type '{3}'."),Class_name_cannot_be_0:ai(2414,1,"Class_name_cannot_be_0_2414","Class name cannot be '{0}'."),Class_0_incorrectly_extends_base_class_1:ai(2415,1,"Class_0_incorrectly_extends_base_class_1_2415","Class '{0}' incorrectly extends base class '{1}'."),Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2:ai(2416,1,"Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2_2416","Property '{0}' in type '{1}' is not assignable to the same property in base type '{2}'."),Class_static_side_0_incorrectly_extends_base_class_static_side_1:ai(2417,1,"Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417","Class static side '{0}' incorrectly extends base class static side '{1}'."),Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1:ai(2418,1,"Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1_2418","Type of computed property's value is '{0}', which is not assignable to type '{1}'."),Types_of_construct_signatures_are_incompatible:ai(2419,1,"Types_of_construct_signatures_are_incompatible_2419","Types of construct signatures are incompatible."),Class_0_incorrectly_implements_interface_1:ai(2420,1,"Class_0_incorrectly_implements_interface_1_2420","Class '{0}' incorrectly implements interface '{1}'."),A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members:ai(2422,1,"A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_memb_2422","A class can only implement an object type or intersection of object types with statically known members."),Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor:ai(2423,1,"Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423","Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor."),Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function:ai(2425,1,"Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425","Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function."),Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function:ai(2426,1,"Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426","Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function."),Interface_name_cannot_be_0:ai(2427,1,"Interface_name_cannot_be_0_2427","Interface name cannot be '{0}'."),All_declarations_of_0_must_have_identical_type_parameters:ai(2428,1,"All_declarations_of_0_must_have_identical_type_parameters_2428","All declarations of '{0}' must have identical type parameters."),Interface_0_incorrectly_extends_interface_1:ai(2430,1,"Interface_0_incorrectly_extends_interface_1_2430","Interface '{0}' incorrectly extends interface '{1}'."),Enum_name_cannot_be_0:ai(2431,1,"Enum_name_cannot_be_0_2431","Enum name cannot be '{0}'."),In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element:ai(2432,1,"In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432","In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element."),A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged:ai(2433,1,"A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433","A namespace declaration cannot be in a different file from a class or function with which it is merged."),A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged:ai(2434,1,"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434","A namespace declaration cannot be located prior to a class or function with which it is merged."),Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces:ai(2435,1,"Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435","Ambient modules cannot be nested in other modules or namespaces."),Ambient_module_declaration_cannot_specify_relative_module_name:ai(2436,1,"Ambient_module_declaration_cannot_specify_relative_module_name_2436","Ambient module declaration cannot specify relative module name."),Module_0_is_hidden_by_a_local_declaration_with_the_same_name:ai(2437,1,"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437","Module '{0}' is hidden by a local declaration with the same name."),Import_name_cannot_be_0:ai(2438,1,"Import_name_cannot_be_0_2438","Import name cannot be '{0}'."),Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name:ai(2439,1,"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439","Import or export declaration in an ambient module declaration cannot reference module through relative module name."),Import_declaration_conflicts_with_local_declaration_of_0:ai(2440,1,"Import_declaration_conflicts_with_local_declaration_of_0_2440","Import declaration conflicts with local declaration of '{0}'."),Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module:ai(2441,1,"Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441","Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module."),Types_have_separate_declarations_of_a_private_property_0:ai(2442,1,"Types_have_separate_declarations_of_a_private_property_0_2442","Types have separate declarations of a private property '{0}'."),Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2:ai(2443,1,"Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443","Property '{0}' is protected but type '{1}' is not a class derived from '{2}'."),Property_0_is_protected_in_type_1_but_public_in_type_2:ai(2444,1,"Property_0_is_protected_in_type_1_but_public_in_type_2_2444","Property '{0}' is protected in type '{1}' but public in type '{2}'."),Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses:ai(2445,1,"Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses_2445","Property '{0}' is protected and only accessible within class '{1}' and its subclasses."),Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2:ai(2446,1,"Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_cl_2446","Property '{0}' is protected and only accessible through an instance of class '{1}'. This is an instance of class '{2}'."),The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead:ai(2447,1,"The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447","The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead."),Block_scoped_variable_0_used_before_its_declaration:ai(2448,1,"Block_scoped_variable_0_used_before_its_declaration_2448","Block-scoped variable '{0}' used before its declaration."),Class_0_used_before_its_declaration:ai(2449,1,"Class_0_used_before_its_declaration_2449","Class '{0}' used before its declaration."),Enum_0_used_before_its_declaration:ai(2450,1,"Enum_0_used_before_its_declaration_2450","Enum '{0}' used before its declaration."),Cannot_redeclare_block_scoped_variable_0:ai(2451,1,"Cannot_redeclare_block_scoped_variable_0_2451","Cannot redeclare block-scoped variable '{0}'."),An_enum_member_cannot_have_a_numeric_name:ai(2452,1,"An_enum_member_cannot_have_a_numeric_name_2452","An enum member cannot have a numeric name."),Variable_0_is_used_before_being_assigned:ai(2454,1,"Variable_0_is_used_before_being_assigned_2454","Variable '{0}' is used before being assigned."),Type_alias_0_circularly_references_itself:ai(2456,1,"Type_alias_0_circularly_references_itself_2456","Type alias '{0}' circularly references itself."),Type_alias_name_cannot_be_0:ai(2457,1,"Type_alias_name_cannot_be_0_2457","Type alias name cannot be '{0}'."),An_AMD_module_cannot_have_multiple_name_assignments:ai(2458,1,"An_AMD_module_cannot_have_multiple_name_assignments_2458","An AMD module cannot have multiple name assignments."),Module_0_declares_1_locally_but_it_is_not_exported:ai(2459,1,"Module_0_declares_1_locally_but_it_is_not_exported_2459","Module '{0}' declares '{1}' locally, but it is not exported."),Module_0_declares_1_locally_but_it_is_exported_as_2:ai(2460,1,"Module_0_declares_1_locally_but_it_is_exported_as_2_2460","Module '{0}' declares '{1}' locally, but it is exported as '{2}'."),Type_0_is_not_an_array_type:ai(2461,1,"Type_0_is_not_an_array_type_2461","Type '{0}' is not an array type."),A_rest_element_must_be_last_in_a_destructuring_pattern:ai(2462,1,"A_rest_element_must_be_last_in_a_destructuring_pattern_2462","A rest element must be last in a destructuring pattern."),A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature:ai(2463,1,"A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463","A binding pattern parameter cannot be optional in an implementation signature."),A_computed_property_name_must_be_of_type_string_number_symbol_or_any:ai(2464,1,"A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464","A computed property name must be of type 'string', 'number', 'symbol', or 'any'."),this_cannot_be_referenced_in_a_computed_property_name:ai(2465,1,"this_cannot_be_referenced_in_a_computed_property_name_2465","'this' cannot be referenced in a computed property name."),super_cannot_be_referenced_in_a_computed_property_name:ai(2466,1,"super_cannot_be_referenced_in_a_computed_property_name_2466","'super' cannot be referenced in a computed property name."),A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type:ai(2467,1,"A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type_2467","A computed property name cannot reference a type parameter from its containing type."),Cannot_find_global_value_0:ai(2468,1,"Cannot_find_global_value_0_2468","Cannot find global value '{0}'."),The_0_operator_cannot_be_applied_to_type_symbol:ai(2469,1,"The_0_operator_cannot_be_applied_to_type_symbol_2469","The '{0}' operator cannot be applied to type 'symbol'."),Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher:ai(2472,1,"Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472","Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher."),Enum_declarations_must_all_be_const_or_non_const:ai(2473,1,"Enum_declarations_must_all_be_const_or_non_const_2473","Enum declarations must all be const or non-const."),const_enum_member_initializers_must_be_constant_expressions:ai(2474,1,"const_enum_member_initializers_must_be_constant_expressions_2474","const enum member initializers must be constant expressions."),const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query:ai(2475,1,"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475","'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query."),A_const_enum_member_can_only_be_accessed_using_a_string_literal:ai(2476,1,"A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476","A const enum member can only be accessed using a string literal."),const_enum_member_initializer_was_evaluated_to_a_non_finite_value:ai(2477,1,"const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477","'const' enum member initializer was evaluated to a non-finite value."),const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN:ai(2478,1,"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478","'const' enum member initializer was evaluated to disallowed value 'NaN'."),let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations:ai(2480,1,"let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480","'let' is not allowed to be used as a name in 'let' or 'const' declarations."),Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1:ai(2481,1,"Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481","Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'."),The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation:ai(2483,1,"The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483","The left-hand side of a 'for...of' statement cannot use a type annotation."),Export_declaration_conflicts_with_exported_declaration_of_0:ai(2484,1,"Export_declaration_conflicts_with_exported_declaration_of_0_2484","Export declaration conflicts with exported declaration of '{0}'."),The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access:ai(2487,1,"The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487","The left-hand side of a 'for...of' statement must be a variable or a property access."),Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator:ai(2488,1,"Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488","Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator."),An_iterator_must_have_a_next_method:ai(2489,1,"An_iterator_must_have_a_next_method_2489","An iterator must have a 'next()' method."),The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property:ai(2490,1,"The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490","The type returned by the '{0}()' method of an iterator must have a 'value' property."),The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern:ai(2491,1,"The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491","The left-hand side of a 'for...in' statement cannot be a destructuring pattern."),Cannot_redeclare_identifier_0_in_catch_clause:ai(2492,1,"Cannot_redeclare_identifier_0_in_catch_clause_2492","Cannot redeclare identifier '{0}' in catch clause."),Tuple_type_0_of_length_1_has_no_element_at_index_2:ai(2493,1,"Tuple_type_0_of_length_1_has_no_element_at_index_2_2493","Tuple type '{0}' of length '{1}' has no element at index '{2}'."),Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher:ai(2494,1,"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494","Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher."),Type_0_is_not_an_array_type_or_a_string_type:ai(2495,1,"Type_0_is_not_an_array_type_or_a_string_type_2495","Type '{0}' is not an array type or a string type."),The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression:ai(2496,1,"The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_stand_2496","The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression."),This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export:ai(2497,1,"This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497","This module can only be referenced with ECMAScript imports/exports by turning on the '{0}' flag and referencing its default export."),Module_0_uses_export_and_cannot_be_used_with_export_Asterisk:ai(2498,1,"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498","Module '{0}' uses 'export =' and cannot be used with 'export *'."),An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments:ai(2499,1,"An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499","An interface can only extend an identifier/qualified-name with optional type arguments."),A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments:ai(2500,1,"A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments_2500","A class can only implement an identifier/qualified-name with optional type arguments."),A_rest_element_cannot_contain_a_binding_pattern:ai(2501,1,"A_rest_element_cannot_contain_a_binding_pattern_2501","A rest element cannot contain a binding pattern."),_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation:ai(2502,1,"_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502","'{0}' is referenced directly or indirectly in its own type annotation."),Cannot_find_namespace_0:ai(2503,1,"Cannot_find_namespace_0_2503","Cannot find namespace '{0}'."),Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator:ai(2504,1,"Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504","Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator."),A_generator_cannot_have_a_void_type_annotation:ai(2505,1,"A_generator_cannot_have_a_void_type_annotation_2505","A generator cannot have a 'void' type annotation."),_0_is_referenced_directly_or_indirectly_in_its_own_base_expression:ai(2506,1,"_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506","'{0}' is referenced directly or indirectly in its own base expression."),Type_0_is_not_a_constructor_function_type:ai(2507,1,"Type_0_is_not_a_constructor_function_type_2507","Type '{0}' is not a constructor function type."),No_base_constructor_has_the_specified_number_of_type_arguments:ai(2508,1,"No_base_constructor_has_the_specified_number_of_type_arguments_2508","No base constructor has the specified number of type arguments."),Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_known_members:ai(2509,1,"Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_2509","Base constructor return type '{0}' is not an object type or intersection of object types with statically known members."),Base_constructors_must_all_have_the_same_return_type:ai(2510,1,"Base_constructors_must_all_have_the_same_return_type_2510","Base constructors must all have the same return type."),Cannot_create_an_instance_of_an_abstract_class:ai(2511,1,"Cannot_create_an_instance_of_an_abstract_class_2511","Cannot create an instance of an abstract class."),Overload_signatures_must_all_be_abstract_or_non_abstract:ai(2512,1,"Overload_signatures_must_all_be_abstract_or_non_abstract_2512","Overload signatures must all be abstract or non-abstract."),Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression:ai(2513,1,"Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513","Abstract method '{0}' in class '{1}' cannot be accessed via super expression."),A_tuple_type_cannot_be_indexed_with_a_negative_value:ai(2514,1,"A_tuple_type_cannot_be_indexed_with_a_negative_value_2514","A tuple type cannot be indexed with a negative value."),Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2:ai(2515,1,"Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515","Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'."),All_declarations_of_an_abstract_method_must_be_consecutive:ai(2516,1,"All_declarations_of_an_abstract_method_must_be_consecutive_2516","All declarations of an abstract method must be consecutive."),Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type:ai(2517,1,"Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517","Cannot assign an abstract constructor type to a non-abstract constructor type."),A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard:ai(2518,1,"A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518","A 'this'-based type guard is not compatible with a parameter-based type guard."),An_async_iterator_must_have_a_next_method:ai(2519,1,"An_async_iterator_must_have_a_next_method_2519","An async iterator must have a 'next()' method."),Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions:ai(2520,1,"Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520","Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions."),The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method:ai(2522,1,"The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522","The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method."),yield_expressions_cannot_be_used_in_a_parameter_initializer:ai(2523,1,"yield_expressions_cannot_be_used_in_a_parameter_initializer_2523","'yield' expressions cannot be used in a parameter initializer."),await_expressions_cannot_be_used_in_a_parameter_initializer:ai(2524,1,"await_expressions_cannot_be_used_in_a_parameter_initializer_2524","'await' expressions cannot be used in a parameter initializer."),Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value:ai(2525,1,"Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525","Initializer provides no value for this binding element and the binding element has no default value."),A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface:ai(2526,1,"A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526","A 'this' type is available only in a non-static member of a class or interface."),The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary:ai(2527,1,"The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary_2527","The inferred type of '{0}' references an inaccessible '{1}' type. A type annotation is necessary."),A_module_cannot_have_multiple_default_exports:ai(2528,1,"A_module_cannot_have_multiple_default_exports_2528","A module cannot have multiple default exports."),Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions:ai(2529,1,"Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529","Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions."),Property_0_is_incompatible_with_index_signature:ai(2530,1,"Property_0_is_incompatible_with_index_signature_2530","Property '{0}' is incompatible with index signature."),Object_is_possibly_null:ai(2531,1,"Object_is_possibly_null_2531","Object is possibly 'null'."),Object_is_possibly_undefined:ai(2532,1,"Object_is_possibly_undefined_2532","Object is possibly 'undefined'."),Object_is_possibly_null_or_undefined:ai(2533,1,"Object_is_possibly_null_or_undefined_2533","Object is possibly 'null' or 'undefined'."),A_function_returning_never_cannot_have_a_reachable_end_point:ai(2534,1,"A_function_returning_never_cannot_have_a_reachable_end_point_2534","A function returning 'never' cannot have a reachable end point."),Type_0_cannot_be_used_to_index_type_1:ai(2536,1,"Type_0_cannot_be_used_to_index_type_1_2536","Type '{0}' cannot be used to index type '{1}'."),Type_0_has_no_matching_index_signature_for_type_1:ai(2537,1,"Type_0_has_no_matching_index_signature_for_type_1_2537","Type '{0}' has no matching index signature for type '{1}'."),Type_0_cannot_be_used_as_an_index_type:ai(2538,1,"Type_0_cannot_be_used_as_an_index_type_2538","Type '{0}' cannot be used as an index type."),Cannot_assign_to_0_because_it_is_not_a_variable:ai(2539,1,"Cannot_assign_to_0_because_it_is_not_a_variable_2539","Cannot assign to '{0}' because it is not a variable."),Cannot_assign_to_0_because_it_is_a_read_only_property:ai(2540,1,"Cannot_assign_to_0_because_it_is_a_read_only_property_2540","Cannot assign to '{0}' because it is a read-only property."),Index_signature_in_type_0_only_permits_reading:ai(2542,1,"Index_signature_in_type_0_only_permits_reading_2542","Index signature in type '{0}' only permits reading."),Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference:ai(2543,1,"Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543","Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference."),Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference:ai(2544,1,"Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544","Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference."),A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any:ai(2545,1,"A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545","A mixin class must have a constructor with a single rest parameter of type 'any[]'."),The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property:ai(2547,1,"The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_pro_2547","The type returned by the '{0}()' method of an async iterator must be a promise for a type with a 'value' property."),Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator:ai(2548,1,"Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548","Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator."),Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator:ai(2549,1,"Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549","Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator."),Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2_or_later:ai(2550,1,"Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_c_2550","Property '{0}' does not exist on type '{1}'. Do you need to change your target library? Try changing the 'lib' compiler option to '{2}' or later."),Property_0_does_not_exist_on_type_1_Did_you_mean_2:ai(2551,1,"Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551","Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?"),Cannot_find_name_0_Did_you_mean_1:ai(2552,1,"Cannot_find_name_0_Did_you_mean_1_2552","Cannot find name '{0}'. Did you mean '{1}'?"),Computed_values_are_not_permitted_in_an_enum_with_string_valued_members:ai(2553,1,"Computed_values_are_not_permitted_in_an_enum_with_string_valued_members_2553","Computed values are not permitted in an enum with string valued members."),Expected_0_arguments_but_got_1:ai(2554,1,"Expected_0_arguments_but_got_1_2554","Expected {0} arguments, but got {1}."),Expected_at_least_0_arguments_but_got_1:ai(2555,1,"Expected_at_least_0_arguments_but_got_1_2555","Expected at least {0} arguments, but got {1}."),A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter:ai(2556,1,"A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter_2556","A spread argument must either have a tuple type or be passed to a rest parameter."),Expected_0_type_arguments_but_got_1:ai(2558,1,"Expected_0_type_arguments_but_got_1_2558","Expected {0} type arguments, but got {1}."),Type_0_has_no_properties_in_common_with_type_1:ai(2559,1,"Type_0_has_no_properties_in_common_with_type_1_2559","Type '{0}' has no properties in common with type '{1}'."),Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it:ai(2560,1,"Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it_2560","Value of type '{0}' has no properties in common with type '{1}'. Did you mean to call it?"),Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2:ai(2561,1,"Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_writ_2561","Object literal may only specify known properties, but '{0}' does not exist in type '{1}'. Did you mean to write '{2}'?"),Base_class_expressions_cannot_reference_class_type_parameters:ai(2562,1,"Base_class_expressions_cannot_reference_class_type_parameters_2562","Base class expressions cannot reference class type parameters."),The_containing_function_or_module_body_is_too_large_for_control_flow_analysis:ai(2563,1,"The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563","The containing function or module body is too large for control flow analysis."),Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor:ai(2564,1,"Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor_2564","Property '{0}' has no initializer and is not definitely assigned in the constructor."),Property_0_is_used_before_being_assigned:ai(2565,1,"Property_0_is_used_before_being_assigned_2565","Property '{0}' is used before being assigned."),A_rest_element_cannot_have_a_property_name:ai(2566,1,"A_rest_element_cannot_have_a_property_name_2566","A rest element cannot have a property name."),Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations:ai(2567,1,"Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567","Enum declarations can only merge with namespace or other enum declarations."),Property_0_may_not_exist_on_type_1_Did_you_mean_2:ai(2568,1,"Property_0_may_not_exist_on_type_1_Did_you_mean_2_2568","Property '{0}' may not exist on type '{1}'. Did you mean '{2}'?"),Could_not_find_name_0_Did_you_mean_1:ai(2570,1,"Could_not_find_name_0_Did_you_mean_1_2570","Could not find name '{0}'. Did you mean '{1}'?"),Object_is_of_type_unknown:ai(2571,1,"Object_is_of_type_unknown_2571","Object is of type 'unknown'."),A_rest_element_type_must_be_an_array_type:ai(2574,1,"A_rest_element_type_must_be_an_array_type_2574","A rest element type must be an array type."),No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments:ai(2575,1,"No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments_2575","No overload expects {0} arguments, but overloads do exist that expect either {1} or {2} arguments."),Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead:ai(2576,1,"Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead_2576","Property '{0}' does not exist on type '{1}'. Did you mean to access the static member '{2}' instead?"),Return_type_annotation_circularly_references_itself:ai(2577,1,"Return_type_annotation_circularly_references_itself_2577","Return type annotation circularly references itself."),Unused_ts_expect_error_directive:ai(2578,1,"Unused_ts_expect_error_directive_2578","Unused '@ts-expect-error' directive."),Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode:ai(2580,1,"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2580","Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`."),Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery:ai(2581,1,"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2581","Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`."),Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha:ai(2582,1,"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2582","Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`."),Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later:ai(2583,1,"Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2583","Cannot find name '{0}'. Do you need to change your target library? Try changing the 'lib' compiler option to '{1}' or later."),Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom:ai(2584,1,"Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2584","Cannot find name '{0}'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'."),_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later:ai(2585,1,"_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_2585","'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later."),Cannot_assign_to_0_because_it_is_a_constant:ai(2588,1,"Cannot_assign_to_0_because_it_is_a_constant_2588","Cannot assign to '{0}' because it is a constant."),Type_instantiation_is_excessively_deep_and_possibly_infinite:ai(2589,1,"Type_instantiation_is_excessively_deep_and_possibly_infinite_2589","Type instantiation is excessively deep and possibly infinite."),Expression_produces_a_union_type_that_is_too_complex_to_represent:ai(2590,1,"Expression_produces_a_union_type_that_is_too_complex_to_represent_2590","Expression produces a union type that is too complex to represent."),Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig:ai(2591,1,"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591","Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig."),Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig:ai(2592,1,"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2592","Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery` and then add 'jquery' to the types field in your tsconfig."),Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig:ai(2593,1,"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2593","Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add 'jest' or 'mocha' to the types field in your tsconfig."),This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag:ai(2594,1,"This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594","This module is declared with 'export =', and can only be used with a default import when using the '{0}' flag."),_0_can_only_be_imported_by_using_a_default_import:ai(2595,1,"_0_can_only_be_imported_by_using_a_default_import_2595","'{0}' can only be imported by using a default import."),_0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import:ai(2596,1,"_0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import_2596","'{0}' can only be imported by turning on the 'esModuleInterop' flag and using a default import."),_0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import:ai(2597,1,"_0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import_2597","'{0}' can only be imported by using a 'require' call or by using a default import."),_0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import:ai(2598,1,"_0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using__2598","'{0}' can only be imported by using a 'require' call or by turning on the 'esModuleInterop' flag and using a default import."),JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist:ai(2602,1,"JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602","JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),Property_0_in_type_1_is_not_assignable_to_type_2:ai(2603,1,"Property_0_in_type_1_is_not_assignable_to_type_2_2603","Property '{0}' in type '{1}' is not assignable to type '{2}'."),JSX_element_type_0_does_not_have_any_construct_or_call_signatures:ai(2604,1,"JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604","JSX element type '{0}' does not have any construct or call signatures."),Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property:ai(2606,1,"Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606","Property '{0}' of JSX spread attribute is not assignable to target property."),JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property:ai(2607,1,"JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607","JSX element class does not support attributes because it does not have a '{0}' property."),The_global_type_JSX_0_may_not_have_more_than_one_property:ai(2608,1,"The_global_type_JSX_0_may_not_have_more_than_one_property_2608","The global type 'JSX.{0}' may not have more than one property."),JSX_spread_child_must_be_an_array_type:ai(2609,1,"JSX_spread_child_must_be_an_array_type_2609","JSX spread child must be an array type."),_0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property:ai(2610,1,"_0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property_2610","'{0}' is defined as an accessor in class '{1}', but is overridden here in '{2}' as an instance property."),_0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor:ai(2611,1,"_0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor_2611","'{0}' is defined as a property in class '{1}', but is overridden here in '{2}' as an accessor."),Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_add_a_declare_modifier_or_remove_the_redundant_declaration:ai(2612,1,"Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_2612","Property '{0}' will overwrite the base property in '{1}'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration."),Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead:ai(2613,1,"Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead_2613","Module '{0}' has no default export. Did you mean to use 'import { {1} } from {0}' instead?"),Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead:ai(2614,1,"Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead_2614","Module '{0}' has no exported member '{1}'. Did you mean to use 'import {1} from {0}' instead?"),Type_of_property_0_circularly_references_itself_in_mapped_type_1:ai(2615,1,"Type_of_property_0_circularly_references_itself_in_mapped_type_1_2615","Type of property '{0}' circularly references itself in mapped type '{1}'."),_0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import:ai(2616,1,"_0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import_2616","'{0}' can only be imported by using 'import {1} = require({2})' or a default import."),_0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import:ai(2617,1,"_0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_us_2617","'{0}' can only be imported by using 'import {1} = require({2})' or by turning on the 'esModuleInterop' flag and using a default import."),Source_has_0_element_s_but_target_requires_1:ai(2618,1,"Source_has_0_element_s_but_target_requires_1_2618","Source has {0} element(s) but target requires {1}."),Source_has_0_element_s_but_target_allows_only_1:ai(2619,1,"Source_has_0_element_s_but_target_allows_only_1_2619","Source has {0} element(s) but target allows only {1}."),Target_requires_0_element_s_but_source_may_have_fewer:ai(2620,1,"Target_requires_0_element_s_but_source_may_have_fewer_2620","Target requires {0} element(s) but source may have fewer."),Target_allows_only_0_element_s_but_source_may_have_more:ai(2621,1,"Target_allows_only_0_element_s_but_source_may_have_more_2621","Target allows only {0} element(s) but source may have more."),Source_provides_no_match_for_required_element_at_position_0_in_target:ai(2623,1,"Source_provides_no_match_for_required_element_at_position_0_in_target_2623","Source provides no match for required element at position {0} in target."),Source_provides_no_match_for_variadic_element_at_position_0_in_target:ai(2624,1,"Source_provides_no_match_for_variadic_element_at_position_0_in_target_2624","Source provides no match for variadic element at position {0} in target."),Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target:ai(2625,1,"Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target_2625","Variadic element at position {0} in source does not match element at position {1} in target."),Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target:ai(2626,1,"Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target_2626","Type at position {0} in source is not compatible with type at position {1} in target."),Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target:ai(2627,1,"Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target_2627","Type at positions {0} through {1} in source is not compatible with type at position {2} in target."),Cannot_assign_to_0_because_it_is_an_enum:ai(2628,1,"Cannot_assign_to_0_because_it_is_an_enum_2628","Cannot assign to '{0}' because it is an enum."),Cannot_assign_to_0_because_it_is_a_class:ai(2629,1,"Cannot_assign_to_0_because_it_is_a_class_2629","Cannot assign to '{0}' because it is a class."),Cannot_assign_to_0_because_it_is_a_function:ai(2630,1,"Cannot_assign_to_0_because_it_is_a_function_2630","Cannot assign to '{0}' because it is a function."),Cannot_assign_to_0_because_it_is_a_namespace:ai(2631,1,"Cannot_assign_to_0_because_it_is_a_namespace_2631","Cannot assign to '{0}' because it is a namespace."),Cannot_assign_to_0_because_it_is_an_import:ai(2632,1,"Cannot_assign_to_0_because_it_is_an_import_2632","Cannot assign to '{0}' because it is an import."),JSX_property_access_expressions_cannot_include_JSX_namespace_names:ai(2633,1,"JSX_property_access_expressions_cannot_include_JSX_namespace_names_2633","JSX property access expressions cannot include JSX namespace names"),_0_index_signatures_are_incompatible:ai(2634,1,"_0_index_signatures_are_incompatible_2634","'{0}' index signatures are incompatible."),Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable:ai(2635,1,"Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635","Type '{0}' has no signatures for which the type argument list is applicable."),Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation:ai(2636,1,"Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636","Type '{0}' is not assignable to type '{1}' as implied by variance annotation."),Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types:ai(2637,1,"Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637","Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."),Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator:ai(2638,1,"Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638","Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."),React_components_cannot_include_JSX_namespace_names:ai(2639,1,"React_components_cannot_include_JSX_namespace_names_2639","React components cannot include JSX namespace names"),Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity:ai(2649,1,"Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649","Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums:ai(2651,1,"A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651","A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead:ai(2652,1,"Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652","Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1:ai(2653,1,"Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653","Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'."),JSX_expressions_must_have_one_parent_element:ai(2657,1,"JSX_expressions_must_have_one_parent_element_2657","JSX expressions must have one parent element."),Type_0_provides_no_match_for_the_signature_1:ai(2658,1,"Type_0_provides_no_match_for_the_signature_1_2658","Type '{0}' provides no match for the signature '{1}'."),super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher:ai(2659,1,"super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659","'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher."),super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions:ai(2660,1,"super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660","'super' can only be referenced in members of derived classes or object literal expressions."),Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module:ai(2661,1,"Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661","Cannot export '{0}'. Only local declarations can be exported from a module."),Cannot_find_name_0_Did_you_mean_the_static_member_1_0:ai(2662,1,"Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662","Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?"),Cannot_find_name_0_Did_you_mean_the_instance_member_this_0:ai(2663,1,"Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663","Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?"),Invalid_module_name_in_augmentation_module_0_cannot_be_found:ai(2664,1,"Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664","Invalid module name in augmentation, module '{0}' cannot be found."),Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented:ai(2665,1,"Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augm_2665","Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented."),Exports_and_export_assignments_are_not_permitted_in_module_augmentations:ai(2666,1,"Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666","Exports and export assignments are not permitted in module augmentations."),Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module:ai(2667,1,"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667","Imports are not permitted in module augmentations. Consider moving them to the enclosing external module."),export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible:ai(2668,1,"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668","'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible."),Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations:ai(2669,1,"Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669","Augmentations for the global scope can only be directly nested in external modules or ambient module declarations."),Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context:ai(2670,1,"Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670","Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context."),Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity:ai(2671,1,"Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671","Cannot augment module '{0}' because it resolves to a non-module entity."),Cannot_assign_a_0_constructor_type_to_a_1_constructor_type:ai(2672,1,"Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672","Cannot assign a '{0}' constructor type to a '{1}' constructor type."),Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration:ai(2673,1,"Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673","Constructor of class '{0}' is private and only accessible within the class declaration."),Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration:ai(2674,1,"Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674","Constructor of class '{0}' is protected and only accessible within the class declaration."),Cannot_extend_a_class_0_Class_constructor_is_marked_as_private:ai(2675,1,"Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675","Cannot extend a class '{0}'. Class constructor is marked as private."),Accessors_must_both_be_abstract_or_non_abstract:ai(2676,1,"Accessors_must_both_be_abstract_or_non_abstract_2676","Accessors must both be abstract or non-abstract."),A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type:ai(2677,1,"A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677","A type predicate's type must be assignable to its parameter's type."),Type_0_is_not_comparable_to_type_1:ai(2678,1,"Type_0_is_not_comparable_to_type_1_2678","Type '{0}' is not comparable to type '{1}'."),A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void:ai(2679,1,"A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679","A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'."),A_0_parameter_must_be_the_first_parameter:ai(2680,1,"A_0_parameter_must_be_the_first_parameter_2680","A '{0}' parameter must be the first parameter."),A_constructor_cannot_have_a_this_parameter:ai(2681,1,"A_constructor_cannot_have_a_this_parameter_2681","A constructor cannot have a 'this' parameter."),this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation:ai(2683,1,"this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683","'this' implicitly has type 'any' because it does not have a type annotation."),The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1:ai(2684,1,"The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684","The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'."),The_this_types_of_each_signature_are_incompatible:ai(2685,1,"The_this_types_of_each_signature_are_incompatible_2685","The 'this' types of each signature are incompatible."),_0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead:ai(2686,1,"_0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead_2686","'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead."),All_declarations_of_0_must_have_identical_modifiers:ai(2687,1,"All_declarations_of_0_must_have_identical_modifiers_2687","All declarations of '{0}' must have identical modifiers."),Cannot_find_type_definition_file_for_0:ai(2688,1,"Cannot_find_type_definition_file_for_0_2688","Cannot find type definition file for '{0}'."),Cannot_extend_an_interface_0_Did_you_mean_implements:ai(2689,1,"Cannot_extend_an_interface_0_Did_you_mean_implements_2689","Cannot extend an interface '{0}'. Did you mean 'implements'?"),_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0:ai(2690,1,"_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690","'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible:ai(2692,1,"_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692","'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),_0_only_refers_to_a_type_but_is_being_used_as_a_value_here:ai(2693,1,"_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693","'{0}' only refers to a type, but is being used as a value here."),Namespace_0_has_no_exported_member_1:ai(2694,1,"Namespace_0_has_no_exported_member_1_2694","Namespace '{0}' has no exported member '{1}'."),Left_side_of_comma_operator_is_unused_and_has_no_side_effects:ai(2695,1,"Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695","Left side of comma operator is unused and has no side effects.",!0),The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead:ai(2696,1,"The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696","The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?"),An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option:ai(2697,1,"An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697","An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your '--lib' option."),Spread_types_may_only_be_created_from_object_types:ai(2698,1,"Spread_types_may_only_be_created_from_object_types_2698","Spread types may only be created from object types."),Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1:ai(2699,1,"Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699","Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'."),Rest_types_may_only_be_created_from_object_types:ai(2700,1,"Rest_types_may_only_be_created_from_object_types_2700","Rest types may only be created from object types."),The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access:ai(2701,1,"The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701","The target of an object rest assignment must be a variable or a property access."),_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here:ai(2702,1,"_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702","'{0}' only refers to a type, but is being used as a namespace here."),The_operand_of_a_delete_operator_must_be_a_property_reference:ai(2703,1,"The_operand_of_a_delete_operator_must_be_a_property_reference_2703","The operand of a 'delete' operator must be a property reference."),The_operand_of_a_delete_operator_cannot_be_a_read_only_property:ai(2704,1,"The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704","The operand of a 'delete' operator cannot be a read-only property."),An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option:ai(2705,1,"An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705","An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option."),Required_type_parameters_may_not_follow_optional_type_parameters:ai(2706,1,"Required_type_parameters_may_not_follow_optional_type_parameters_2706","Required type parameters may not follow optional type parameters."),Generic_type_0_requires_between_1_and_2_type_arguments:ai(2707,1,"Generic_type_0_requires_between_1_and_2_type_arguments_2707","Generic type '{0}' requires between {1} and {2} type arguments."),Cannot_use_namespace_0_as_a_value:ai(2708,1,"Cannot_use_namespace_0_as_a_value_2708","Cannot use namespace '{0}' as a value."),Cannot_use_namespace_0_as_a_type:ai(2709,1,"Cannot_use_namespace_0_as_a_type_2709","Cannot use namespace '{0}' as a type."),_0_are_specified_twice_The_attribute_named_0_will_be_overwritten:ai(2710,1,"_0_are_specified_twice_The_attribute_named_0_will_be_overwritten_2710","'{0}' are specified twice. The attribute named '{0}' will be overwritten."),A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option:ai(2711,1,"A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES20_2711","A dynamic import call returns a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your '--lib' option."),A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option:ai(2712,1,"A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declarat_2712","A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option."),Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1:ai(2713,1,"Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_p_2713","Cannot access '{0}.{1}' because '{0}' is a type, but not a namespace. Did you mean to retrieve the type of the property '{1}' in '{0}' with '{0}[\"{1}\"]'?"),The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context:ai(2714,1,"The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714","The expression of an export assignment must be an identifier or qualified name in an ambient context."),Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor:ai(2715,1,"Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor_2715","Abstract property '{0}' in class '{1}' cannot be accessed in the constructor."),Type_parameter_0_has_a_circular_default:ai(2716,1,"Type_parameter_0_has_a_circular_default_2716","Type parameter '{0}' has a circular default."),Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2:ai(2717,1,"Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_t_2717","Subsequent property declarations must have the same type. Property '{0}' must be of type '{1}', but here has type '{2}'."),Duplicate_property_0:ai(2718,1,"Duplicate_property_0_2718","Duplicate property '{0}'."),Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated:ai(2719,1,"Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_2719","Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated."),Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass:ai(2720,1,"Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720","Class '{0}' incorrectly implements class '{1}'. Did you mean to extend '{1}' and inherit its members as a subclass?"),Cannot_invoke_an_object_which_is_possibly_null:ai(2721,1,"Cannot_invoke_an_object_which_is_possibly_null_2721","Cannot invoke an object which is possibly 'null'."),Cannot_invoke_an_object_which_is_possibly_undefined:ai(2722,1,"Cannot_invoke_an_object_which_is_possibly_undefined_2722","Cannot invoke an object which is possibly 'undefined'."),Cannot_invoke_an_object_which_is_possibly_null_or_undefined:ai(2723,1,"Cannot_invoke_an_object_which_is_possibly_null_or_undefined_2723","Cannot invoke an object which is possibly 'null' or 'undefined'."),_0_has_no_exported_member_named_1_Did_you_mean_2:ai(2724,1,"_0_has_no_exported_member_named_1_Did_you_mean_2_2724","'{0}' has no exported member named '{1}'. Did you mean '{2}'?"),Class_name_cannot_be_Object_when_targeting_ES5_with_module_0:ai(2725,1,"Class_name_cannot_be_Object_when_targeting_ES5_with_module_0_2725","Class name cannot be 'Object' when targeting ES5 with module {0}."),Cannot_find_lib_definition_for_0:ai(2726,1,"Cannot_find_lib_definition_for_0_2726","Cannot find lib definition for '{0}'."),Cannot_find_lib_definition_for_0_Did_you_mean_1:ai(2727,1,"Cannot_find_lib_definition_for_0_Did_you_mean_1_2727","Cannot find lib definition for '{0}'. Did you mean '{1}'?"),_0_is_declared_here:ai(2728,3,"_0_is_declared_here_2728","'{0}' is declared here."),Property_0_is_used_before_its_initialization:ai(2729,1,"Property_0_is_used_before_its_initialization_2729","Property '{0}' is used before its initialization."),An_arrow_function_cannot_have_a_this_parameter:ai(2730,1,"An_arrow_function_cannot_have_a_this_parameter_2730","An arrow function cannot have a 'this' parameter."),Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String:ai(2731,1,"Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_i_2731","Implicit conversion of a 'symbol' to a 'string' will fail at runtime. Consider wrapping this expression in 'String(...)'."),Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension:ai(2732,1,"Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension_2732","Cannot find module '{0}'. Consider using '--resolveJsonModule' to import module with '.json' extension."),Property_0_was_also_declared_here:ai(2733,1,"Property_0_was_also_declared_here_2733","Property '{0}' was also declared here."),Are_you_missing_a_semicolon:ai(2734,1,"Are_you_missing_a_semicolon_2734","Are you missing a semicolon?"),Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1:ai(2735,1,"Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1_2735","Did you mean for '{0}' to be constrained to type 'new (...args: any[]) => {1}'?"),Operator_0_cannot_be_applied_to_type_1:ai(2736,1,"Operator_0_cannot_be_applied_to_type_1_2736","Operator '{0}' cannot be applied to type '{1}'."),BigInt_literals_are_not_available_when_targeting_lower_than_ES2020:ai(2737,1,"BigInt_literals_are_not_available_when_targeting_lower_than_ES2020_2737","BigInt literals are not available when targeting lower than ES2020."),An_outer_value_of_this_is_shadowed_by_this_container:ai(2738,3,"An_outer_value_of_this_is_shadowed_by_this_container_2738","An outer value of 'this' is shadowed by this container."),Type_0_is_missing_the_following_properties_from_type_1_Colon_2:ai(2739,1,"Type_0_is_missing_the_following_properties_from_type_1_Colon_2_2739","Type '{0}' is missing the following properties from type '{1}': {2}"),Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more:ai(2740,1,"Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more_2740","Type '{0}' is missing the following properties from type '{1}': {2}, and {3} more."),Property_0_is_missing_in_type_1_but_required_in_type_2:ai(2741,1,"Property_0_is_missing_in_type_1_but_required_in_type_2_2741","Property '{0}' is missing in type '{1}' but required in type '{2}'."),The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary:ai(2742,1,"The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_a_2742","The inferred type of '{0}' cannot be named without a reference to '{1}'. This is likely not portable. A type annotation is necessary."),No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments:ai(2743,1,"No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments_2743","No overload expects {0} type arguments, but overloads do exist that expect either {1} or {2} type arguments."),Type_parameter_defaults_can_only_reference_previously_declared_type_parameters:ai(2744,1,"Type_parameter_defaults_can_only_reference_previously_declared_type_parameters_2744","Type parameter defaults can only reference previously declared type parameters."),This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided:ai(2745,1,"This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745","This JSX tag's '{0}' prop expects type '{1}' which requires multiple children, but only a single child was provided."),This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided:ai(2746,1,"This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746","This JSX tag's '{0}' prop expects a single child of type '{1}', but multiple children were provided."),_0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_type_of_1_is_2:ai(2747,1,"_0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_t_2747","'{0}' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of '{1}' is '{2}'."),Cannot_access_ambient_const_enums_when_0_is_enabled:ai(2748,1,"Cannot_access_ambient_const_enums_when_0_is_enabled_2748","Cannot access ambient const enums when '{0}' is enabled."),_0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0:ai(2749,1,"_0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0_2749","'{0}' refers to a value, but is being used as a type here. Did you mean 'typeof {0}'?"),The_implementation_signature_is_declared_here:ai(2750,1,"The_implementation_signature_is_declared_here_2750","The implementation signature is declared here."),Circularity_originates_in_type_at_this_location:ai(2751,1,"Circularity_originates_in_type_at_this_location_2751","Circularity originates in type at this location."),The_first_export_default_is_here:ai(2752,1,"The_first_export_default_is_here_2752","The first export default is here."),Another_export_default_is_here:ai(2753,1,"Another_export_default_is_here_2753","Another export default is here."),super_may_not_use_type_arguments:ai(2754,1,"super_may_not_use_type_arguments_2754","'super' may not use type arguments."),No_constituent_of_type_0_is_callable:ai(2755,1,"No_constituent_of_type_0_is_callable_2755","No constituent of type '{0}' is callable."),Not_all_constituents_of_type_0_are_callable:ai(2756,1,"Not_all_constituents_of_type_0_are_callable_2756","Not all constituents of type '{0}' are callable."),Type_0_has_no_call_signatures:ai(2757,1,"Type_0_has_no_call_signatures_2757","Type '{0}' has no call signatures."),Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_other:ai(2758,1,"Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_2758","Each member of the union type '{0}' has signatures, but none of those signatures are compatible with each other."),No_constituent_of_type_0_is_constructable:ai(2759,1,"No_constituent_of_type_0_is_constructable_2759","No constituent of type '{0}' is constructable."),Not_all_constituents_of_type_0_are_constructable:ai(2760,1,"Not_all_constituents_of_type_0_are_constructable_2760","Not all constituents of type '{0}' are constructable."),Type_0_has_no_construct_signatures:ai(2761,1,"Type_0_has_no_construct_signatures_2761","Type '{0}' has no construct signatures."),Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_with_each_other:ai(2762,1,"Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_2762","Each member of the union type '{0}' has construct signatures, but none of those signatures are compatible with each other."),Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_for_of_will_always_send_0:ai(2763,1,"Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_for_of_will_always_s_2763","Cannot iterate value because the 'next' method of its iterator expects type '{1}', but for-of will always send '{0}'."),Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_spread_will_always_send_0:ai(2764,1,"Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_spread_will_al_2764","Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array spread will always send '{0}'."),Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_destructuring_will_always_send_0:ai(2765,1,"Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_destructuring__2765","Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array destructuring will always send '{0}'."),Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_containing_generator_will_always_send_0:ai(2766,1,"Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_co_2766","Cannot delegate iteration to value because the 'next' method of its iterator expects type '{1}', but the containing generator will always send '{0}'."),The_0_property_of_an_iterator_must_be_a_method:ai(2767,1,"The_0_property_of_an_iterator_must_be_a_method_2767","The '{0}' property of an iterator must be a method."),The_0_property_of_an_async_iterator_must_be_a_method:ai(2768,1,"The_0_property_of_an_async_iterator_must_be_a_method_2768","The '{0}' property of an async iterator must be a method."),No_overload_matches_this_call:ai(2769,1,"No_overload_matches_this_call_2769","No overload matches this call."),The_last_overload_gave_the_following_error:ai(2770,1,"The_last_overload_gave_the_following_error_2770","The last overload gave the following error."),The_last_overload_is_declared_here:ai(2771,1,"The_last_overload_is_declared_here_2771","The last overload is declared here."),Overload_0_of_1_2_gave_the_following_error:ai(2772,1,"Overload_0_of_1_2_gave_the_following_error_2772","Overload {0} of {1}, '{2}', gave the following error."),Did_you_forget_to_use_await:ai(2773,1,"Did_you_forget_to_use_await_2773","Did you forget to use 'await'?"),This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead:ai(2774,1,"This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774","This condition will always return true since this function is always defined. Did you mean to call it instead?"),Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation:ai(2775,1,"Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation_2775","Assertions require every name in the call target to be declared with an explicit type annotation."),Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name:ai(2776,1,"Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name_2776","Assertions require the call target to be an identifier or qualified name."),The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access:ai(2777,1,"The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777","The operand of an increment or decrement operator may not be an optional property access."),The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access:ai(2778,1,"The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access_2778","The target of an object rest assignment may not be an optional property access."),The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access:ai(2779,1,"The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779","The left-hand side of an assignment expression may not be an optional property access."),The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access:ai(2780,1,"The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access_2780","The left-hand side of a 'for...in' statement may not be an optional property access."),The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access:ai(2781,1,"The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access_2781","The left-hand side of a 'for...of' statement may not be an optional property access."),_0_needs_an_explicit_type_annotation:ai(2782,3,"_0_needs_an_explicit_type_annotation_2782","'{0}' needs an explicit type annotation."),_0_is_specified_more_than_once_so_this_usage_will_be_overwritten:ai(2783,1,"_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783","'{0}' is specified more than once, so this usage will be overwritten."),get_and_set_accessors_cannot_declare_this_parameters:ai(2784,1,"get_and_set_accessors_cannot_declare_this_parameters_2784","'get' and 'set' accessors cannot declare 'this' parameters."),This_spread_always_overwrites_this_property:ai(2785,1,"This_spread_always_overwrites_this_property_2785","This spread always overwrites this property."),_0_cannot_be_used_as_a_JSX_component:ai(2786,1,"_0_cannot_be_used_as_a_JSX_component_2786","'{0}' cannot be used as a JSX component."),Its_return_type_0_is_not_a_valid_JSX_element:ai(2787,1,"Its_return_type_0_is_not_a_valid_JSX_element_2787","Its return type '{0}' is not a valid JSX element."),Its_instance_type_0_is_not_a_valid_JSX_element:ai(2788,1,"Its_instance_type_0_is_not_a_valid_JSX_element_2788","Its instance type '{0}' is not a valid JSX element."),Its_element_type_0_is_not_a_valid_JSX_element:ai(2789,1,"Its_element_type_0_is_not_a_valid_JSX_element_2789","Its element type '{0}' is not a valid JSX element."),The_operand_of_a_delete_operator_must_be_optional:ai(2790,1,"The_operand_of_a_delete_operator_must_be_optional_2790","The operand of a 'delete' operator must be optional."),Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later:ai(2791,1,"Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791","Exponentiation cannot be performed on 'bigint' values unless the 'target' option is set to 'es2016' or later."),Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option:ai(2792,1,"Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_t_2792","Cannot find module '{0}'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?"),The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_are_not_externally_visible:ai(2793,1,"The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_2793","The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible."),Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise:ai(2794,1,"Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise_2794","Expected {0} arguments, but got {1}. Did you forget to include 'void' in your type argument to 'Promise'?"),The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types:ai(2795,1,"The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types_2795","The 'intrinsic' keyword can only be used to declare compiler provided intrinsic types."),It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tagged_template_expression_which_cannot_be_invoked:ai(2796,1,"It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tag_2796","It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked."),A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract:ai(2797,1,"A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_2797","A mixin class that extends from a type variable containing an abstract construct signature must also be declared 'abstract'."),The_declaration_was_marked_as_deprecated_here:ai(2798,1,"The_declaration_was_marked_as_deprecated_here_2798","The declaration was marked as deprecated here."),Type_produces_a_tuple_type_that_is_too_large_to_represent:ai(2799,1,"Type_produces_a_tuple_type_that_is_too_large_to_represent_2799","Type produces a tuple type that is too large to represent."),Expression_produces_a_tuple_type_that_is_too_large_to_represent:ai(2800,1,"Expression_produces_a_tuple_type_that_is_too_large_to_represent_2800","Expression produces a tuple type that is too large to represent."),This_condition_will_always_return_true_since_this_0_is_always_defined:ai(2801,1,"This_condition_will_always_return_true_since_this_0_is_always_defined_2801","This condition will always return true since this '{0}' is always defined."),Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher:ai(2802,1,"Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es201_2802","Type '{0}' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher."),Cannot_assign_to_private_method_0_Private_methods_are_not_writable:ai(2803,1,"Cannot_assign_to_private_method_0_Private_methods_are_not_writable_2803","Cannot assign to private method '{0}'. Private methods are not writable."),Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name:ai(2804,1,"Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name_2804","Duplicate identifier '{0}'. Static and instance elements cannot share the same private name."),Private_accessor_was_defined_without_a_getter:ai(2806,1,"Private_accessor_was_defined_without_a_getter_2806","Private accessor was defined without a getter."),This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0:ai(2807,1,"This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807","This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),A_get_accessor_must_be_at_least_as_accessible_as_the_setter:ai(2808,1,"A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808","A get accessor must be at least as accessible as the setter"),Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses:ai(2809,1,"Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809","Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses."),Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments:ai(2810,1,"Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810","Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),Initializer_for_property_0:ai(2811,1,"Initializer_for_property_0_2811","Initializer for property '{0}'"),Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom:ai(2812,1,"Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812","Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),Class_declaration_cannot_implement_overload_list_for_0:ai(2813,1,"Class_declaration_cannot_implement_overload_list_for_0_2813","Class declaration cannot implement overload list for '{0}'."),Function_with_bodies_can_only_merge_with_classes_that_are_ambient:ai(2814,1,"Function_with_bodies_can_only_merge_with_classes_that_are_ambient_2814","Function with bodies can only merge with classes that are ambient."),arguments_cannot_be_referenced_in_property_initializers:ai(2815,1,"arguments_cannot_be_referenced_in_property_initializers_2815","'arguments' cannot be referenced in property initializers."),Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class:ai(2816,1,"Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class_2816","Cannot use 'this' in a static property initializer of a decorated class."),Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block:ai(2817,1,"Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block_2817","Property '{0}' has no initializer and is not definitely assigned in a class static block."),Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers:ai(2818,1,"Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818","Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."),Namespace_name_cannot_be_0:ai(2819,1,"Namespace_name_cannot_be_0_2819","Namespace name cannot be '{0}'."),Type_0_is_not_assignable_to_type_1_Did_you_mean_2:ai(2820,1,"Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820","Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext:ai(2821,1,"Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821","Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),Import_assertions_cannot_be_used_with_type_only_imports_or_exports:ai(2822,1,"Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822","Import assertions cannot be used with type-only imports or exports."),Cannot_find_namespace_0_Did_you_mean_1:ai(2833,1,"Cannot_find_namespace_0_Did_you_mean_1_2833","Cannot find namespace '{0}'. Did you mean '{1}'?"),Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path:ai(2834,1,"Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834","Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path."),Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0:ai(2835,1,"Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835","Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls:ai(2836,1,"Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836","Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),Import_assertion_values_must_be_string_literal_expressions:ai(2837,1,"Import_assertion_values_must_be_string_literal_expressions_2837","Import assertion values must be string literal expressions."),All_declarations_of_0_must_have_identical_constraints:ai(2838,1,"All_declarations_of_0_must_have_identical_constraints_2838","All declarations of '{0}' must have identical constraints."),This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value:ai(2839,1,"This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839","This condition will always return '{0}' since JavaScript compares objects by reference, not value."),An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes:ai(2840,1,"An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_clas_2840","An interface cannot extend a primitive type like '{0}'; an interface can only extend named types and classes"),The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next:ai(2841,1,"The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_2841","The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation:ai(2842,1,"_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842","'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"),We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here:ai(2843,1,"We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843","We can only write a type for '{0}' by adding a type for the entire parameter here."),Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor:ai(2844,1,"Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844","Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),This_condition_will_always_return_0:ai(2845,1,"This_condition_will_always_return_0_2845","This condition will always return '{0}'."),A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead:ai(2846,1,"A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_f_2846","A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file '{0}' instead?"),The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression:ai(2848,1,"The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression_2848","The right-hand side of an 'instanceof' expression must not be an instantiation expression."),Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1:ai(2849,1,"Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1_2849","Target signature provides too few arguments. Expected {0} or more, but got {1}."),The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined:ai(2850,1,"The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_n_2850","The initializer of a 'using' declaration must be either an object with a '[Symbol.dispose]()' method, or be 'null' or 'undefined'."),The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined:ai(2851,1,"The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_2851","The initializer of an 'await using' declaration must be either an object with a '[Symbol.asyncDispose]()' or '[Symbol.dispose]()' method, or be 'null' or 'undefined'."),await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules:ai(2852,1,"await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_2852","'await using' statements are only allowed within async functions and at the top levels of modules."),await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module:ai(2853,1,"await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_th_2853","'await using' statements are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher:ai(2854,1,"Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854","Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),Import_declaration_0_is_using_private_name_1:ai(4e3,1,"Import_declaration_0_is_using_private_name_1_4000","Import declaration '{0}' is using private name '{1}'."),Type_parameter_0_of_exported_class_has_or_is_using_private_name_1:ai(4002,1,"Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002","Type parameter '{0}' of exported class has or is using private name '{1}'."),Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1:ai(4004,1,"Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004","Type parameter '{0}' of exported interface has or is using private name '{1}'."),Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1:ai(4006,1,"Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006","Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."),Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1:ai(4008,1,"Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008","Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'."),Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1:ai(4010,1,"Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010","Type parameter '{0}' of public static method from exported class has or is using private name '{1}'."),Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1:ai(4012,1,"Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012","Type parameter '{0}' of public method from exported class has or is using private name '{1}'."),Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1:ai(4014,1,"Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014","Type parameter '{0}' of method from exported interface has or is using private name '{1}'."),Type_parameter_0_of_exported_function_has_or_is_using_private_name_1:ai(4016,1,"Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016","Type parameter '{0}' of exported function has or is using private name '{1}'."),Implements_clause_of_exported_class_0_has_or_is_using_private_name_1:ai(4019,1,"Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019","Implements clause of exported class '{0}' has or is using private name '{1}'."),extends_clause_of_exported_class_0_has_or_is_using_private_name_1:ai(4020,1,"extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020","'extends' clause of exported class '{0}' has or is using private name '{1}'."),extends_clause_of_exported_class_has_or_is_using_private_name_0:ai(4021,1,"extends_clause_of_exported_class_has_or_is_using_private_name_0_4021","'extends' clause of exported class has or is using private name '{0}'."),extends_clause_of_exported_interface_0_has_or_is_using_private_name_1:ai(4022,1,"extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022","'extends' clause of exported interface '{0}' has or is using private name '{1}'."),Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:ai(4023,1,"Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023","Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named."),Exported_variable_0_has_or_is_using_name_1_from_private_module_2:ai(4024,1,"Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024","Exported variable '{0}' has or is using name '{1}' from private module '{2}'."),Exported_variable_0_has_or_is_using_private_name_1:ai(4025,1,"Exported_variable_0_has_or_is_using_private_name_1_4025","Exported variable '{0}' has or is using private name '{1}'."),Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:ai(4026,1,"Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot__4026","Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:ai(4027,1,"Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027","Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'."),Public_static_property_0_of_exported_class_has_or_is_using_private_name_1:ai(4028,1,"Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028","Public static property '{0}' of exported class has or is using private name '{1}'."),Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:ai(4029,1,"Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_name_4029","Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:ai(4030,1,"Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030","Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'."),Public_property_0_of_exported_class_has_or_is_using_private_name_1:ai(4031,1,"Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031","Public property '{0}' of exported class has or is using private name '{1}'."),Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2:ai(4032,1,"Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032","Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'."),Property_0_of_exported_interface_has_or_is_using_private_name_1:ai(4033,1,"Property_0_of_exported_interface_has_or_is_using_private_name_1_4033","Property '{0}' of exported interface has or is using private name '{1}'."),Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2:ai(4034,1,"Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_mod_4034","Parameter type of public static setter '{0}' from exported class has or is using name '{1}' from private module '{2}'."),Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1:ai(4035,1,"Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1_4035","Parameter type of public static setter '{0}' from exported class has or is using private name '{1}'."),Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2:ai(4036,1,"Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4036","Parameter type of public setter '{0}' from exported class has or is using name '{1}' from private module '{2}'."),Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1:ai(4037,1,"Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1_4037","Parameter type of public setter '{0}' from exported class has or is using private name '{1}'."),Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:ai(4038,1,"Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_modul_4038","Return type of public static getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named."),Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2:ai(4039,1,"Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_4039","Return type of public static getter '{0}' from exported class has or is using name '{1}' from private module '{2}'."),Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1:ai(4040,1,"Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1_4040","Return type of public static getter '{0}' from exported class has or is using private name '{1}'."),Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:ai(4041,1,"Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_4041","Return type of public getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named."),Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2:ai(4042,1,"Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4042","Return type of public getter '{0}' from exported class has or is using name '{1}' from private module '{2}'."),Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1:ai(4043,1,"Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1_4043","Return type of public getter '{0}' from exported class has or is using private name '{1}'."),Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:ai(4044,1,"Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044","Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'."),Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0:ai(4045,1,"Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045","Return type of constructor signature from exported interface has or is using private name '{0}'."),Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:ai(4046,1,"Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046","Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'."),Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0:ai(4047,1,"Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047","Return type of call signature from exported interface has or is using private name '{0}'."),Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:ai(4048,1,"Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048","Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'."),Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0:ai(4049,1,"Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049","Return type of index signature from exported interface has or is using private name '{0}'."),Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:ai(4050,1,"Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module__4050","Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named."),Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1:ai(4051,1,"Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051","Return type of public static method from exported class has or is using name '{0}' from private module '{1}'."),Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0:ai(4052,1,"Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052","Return type of public static method from exported class has or is using private name '{0}'."),Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:ai(4053,1,"Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_c_4053","Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named."),Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1:ai(4054,1,"Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054","Return type of public method from exported class has or is using name '{0}' from private module '{1}'."),Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0:ai(4055,1,"Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055","Return type of public method from exported class has or is using private name '{0}'."),Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1:ai(4056,1,"Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056","Return type of method from exported interface has or is using name '{0}' from private module '{1}'."),Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0:ai(4057,1,"Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057","Return type of method from exported interface has or is using private name '{0}'."),Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:ai(4058,1,"Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named_4058","Return type of exported function has or is using name '{0}' from external module {1} but cannot be named."),Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1:ai(4059,1,"Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059","Return type of exported function has or is using name '{0}' from private module '{1}'."),Return_type_of_exported_function_has_or_is_using_private_name_0:ai(4060,1,"Return_type_of_exported_function_has_or_is_using_private_name_0_4060","Return type of exported function has or is using private name '{0}'."),Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:ai(4061,1,"Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_can_4061","Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named."),Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2:ai(4062,1,"Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062","Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'."),Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1:ai(4063,1,"Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063","Parameter '{0}' of constructor from exported class has or is using private name '{1}'."),Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2:ai(4064,1,"Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064","Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'."),Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1:ai(4065,1,"Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065","Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."),Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2:ai(4066,1,"Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066","Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'."),Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1:ai(4067,1,"Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067","Parameter '{0}' of call signature from exported interface has or is using private name '{1}'."),Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:ai(4068,1,"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module__4068","Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named."),Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2:ai(4069,1,"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069","Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'."),Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1:ai(4070,1,"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070","Parameter '{0}' of public static method from exported class has or is using private name '{1}'."),Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:ai(4071,1,"Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_c_4071","Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named."),Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2:ai(4072,1,"Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072","Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'."),Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1:ai(4073,1,"Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073","Parameter '{0}' of public method from exported class has or is using private name '{1}'."),Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2:ai(4074,1,"Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074","Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'."),Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1:ai(4075,1,"Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075","Parameter '{0}' of method from exported interface has or is using private name '{1}'."),Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:ai(4076,1,"Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4076","Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named."),Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2:ai(4077,1,"Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077","Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'."),Parameter_0_of_exported_function_has_or_is_using_private_name_1:ai(4078,1,"Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078","Parameter '{0}' of exported function has or is using private name '{1}'."),Exported_type_alias_0_has_or_is_using_private_name_1:ai(4081,1,"Exported_type_alias_0_has_or_is_using_private_name_1_4081","Exported type alias '{0}' has or is using private name '{1}'."),Default_export_of_the_module_has_or_is_using_private_name_0:ai(4082,1,"Default_export_of_the_module_has_or_is_using_private_name_0_4082","Default export of the module has or is using private name '{0}'."),Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1:ai(4083,1,"Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083","Type parameter '{0}' of exported type alias has or is using private name '{1}'."),Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2:ai(4084,1,"Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2_4084","Exported type alias '{0}' has or is using private name '{1}' from module {2}."),Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1:ai(4085,1,"Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1_4085","Extends clause for inferred type '{0}' has or is using private name '{1}'."),Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict:ai(4090,1,"Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090","Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."),Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2:ai(4091,1,"Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091","Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1:ai(4092,1,"Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092","Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),Property_0_of_exported_class_expression_may_not_be_private_or_protected:ai(4094,1,"Property_0_of_exported_class_expression_may_not_be_private_or_protected_4094","Property '{0}' of exported class expression may not be private or protected."),Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:ai(4095,1,"Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_4095","Public static method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:ai(4096,1,"Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4096","Public static method '{0}' of exported class has or is using name '{1}' from private module '{2}'."),Public_static_method_0_of_exported_class_has_or_is_using_private_name_1:ai(4097,1,"Public_static_method_0_of_exported_class_has_or_is_using_private_name_1_4097","Public static method '{0}' of exported class has or is using private name '{1}'."),Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:ai(4098,1,"Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4098","Public method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:ai(4099,1,"Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4099","Public method '{0}' of exported class has or is using name '{1}' from private module '{2}'."),Public_method_0_of_exported_class_has_or_is_using_private_name_1:ai(4100,1,"Public_method_0_of_exported_class_has_or_is_using_private_name_1_4100","Public method '{0}' of exported class has or is using private name '{1}'."),Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2:ai(4101,1,"Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101","Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'."),Method_0_of_exported_interface_has_or_is_using_private_name_1:ai(4102,1,"Method_0_of_exported_interface_has_or_is_using_private_name_1_4102","Method '{0}' of exported interface has or is using private name '{1}'."),Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1:ai(4103,1,"Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1_4103","Type parameter '{0}' of exported mapped object type is using private name '{1}'."),The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1:ai(4104,1,"The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1_4104","The type '{0}' is 'readonly' and cannot be assigned to the mutable type '{1}'."),Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter:ai(4105,1,"Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter_4105","Private or protected member '{0}' cannot be accessed on a type parameter."),Parameter_0_of_accessor_has_or_is_using_private_name_1:ai(4106,1,"Parameter_0_of_accessor_has_or_is_using_private_name_1_4106","Parameter '{0}' of accessor has or is using private name '{1}'."),Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2:ai(4107,1,"Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2_4107","Parameter '{0}' of accessor has or is using name '{1}' from private module '{2}'."),Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:ai(4108,1,"Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4108","Parameter '{0}' of accessor has or is using name '{1}' from external module '{2}' but cannot be named."),Type_arguments_for_0_circularly_reference_themselves:ai(4109,1,"Type_arguments_for_0_circularly_reference_themselves_4109","Type arguments for '{0}' circularly reference themselves."),Tuple_type_arguments_circularly_reference_themselves:ai(4110,1,"Tuple_type_arguments_circularly_reference_themselves_4110","Tuple type arguments circularly reference themselves."),Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0:ai(4111,1,"Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111","Property '{0}' comes from an index signature, so it must be accessed with ['{0}']."),This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class:ai(4112,1,"This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another__4112","This member cannot have an 'override' modifier because its containing class '{0}' does not extend another class."),This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0:ai(4113,1,"This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_4113","This member cannot have an 'override' modifier because it is not declared in the base class '{0}'."),This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0:ai(4114,1,"This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114","This member must have an 'override' modifier because it overrides a member in the base class '{0}'."),This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0:ai(4115,1,"This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0_4115","This parameter property must have an 'override' modifier because it overrides a member in base class '{0}'."),This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0:ai(4116,1,"This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116","This member must have an 'override' modifier because it overrides an abstract method that is declared in the base class '{0}'."),This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1:ai(4117,1,"This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you__4117","This member cannot have an 'override' modifier because it is not declared in the base class '{0}'. Did you mean '{1}'?"),The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized:ai(4118,1,"The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized_4118","The type of this node cannot be serialized because its property '{0}' cannot be serialized."),This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0:ai(4119,1,"This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_4119","This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."),This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0:ai(4120,1,"This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120","This parameter property must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."),This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class:ai(4121,1,"This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_4121","This member cannot have a JSDoc comment with an '@override' tag because its containing class '{0}' does not extend another class."),This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0:ai(4122,1,"This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122","This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1:ai(4123,1,"This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123","This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next:ai(4124,1,"Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124","Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next:ai(4125,1,"resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125","'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),The_current_host_does_not_support_the_0_option:ai(5001,1,"The_current_host_does_not_support_the_0_option_5001","The current host does not support the '{0}' option."),Cannot_find_the_common_subdirectory_path_for_the_input_files:ai(5009,1,"Cannot_find_the_common_subdirectory_path_for_the_input_files_5009","Cannot find the common subdirectory path for the input files."),File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0:ai(5010,1,"File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010","File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),Cannot_read_file_0_Colon_1:ai(5012,1,"Cannot_read_file_0_Colon_1_5012","Cannot read file '{0}': {1}."),Failed_to_parse_file_0_Colon_1:ai(5014,1,"Failed_to_parse_file_0_Colon_1_5014","Failed to parse file '{0}': {1}."),Unknown_compiler_option_0:ai(5023,1,"Unknown_compiler_option_0_5023","Unknown compiler option '{0}'."),Compiler_option_0_requires_a_value_of_type_1:ai(5024,1,"Compiler_option_0_requires_a_value_of_type_1_5024","Compiler option '{0}' requires a value of type {1}."),Unknown_compiler_option_0_Did_you_mean_1:ai(5025,1,"Unknown_compiler_option_0_Did_you_mean_1_5025","Unknown compiler option '{0}'. Did you mean '{1}'?"),Could_not_write_file_0_Colon_1:ai(5033,1,"Could_not_write_file_0_Colon_1_5033","Could not write file '{0}': {1}."),Option_project_cannot_be_mixed_with_source_files_on_a_command_line:ai(5042,1,"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042","Option 'project' cannot be mixed with source files on a command line."),Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher:ai(5047,1,"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047","Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher."),Option_0_cannot_be_specified_when_option_target_is_ES3:ai(5048,1,"Option_0_cannot_be_specified_when_option_target_is_ES3_5048","Option '{0}' cannot be specified when option 'target' is 'ES3'."),Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided:ai(5051,1,"Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051","Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided."),Option_0_cannot_be_specified_without_specifying_option_1:ai(5052,1,"Option_0_cannot_be_specified_without_specifying_option_1_5052","Option '{0}' cannot be specified without specifying option '{1}'."),Option_0_cannot_be_specified_with_option_1:ai(5053,1,"Option_0_cannot_be_specified_with_option_1_5053","Option '{0}' cannot be specified with option '{1}'."),A_tsconfig_json_file_is_already_defined_at_Colon_0:ai(5054,1,"A_tsconfig_json_file_is_already_defined_at_Colon_0_5054","A 'tsconfig.json' file is already defined at: '{0}'."),Cannot_write_file_0_because_it_would_overwrite_input_file:ai(5055,1,"Cannot_write_file_0_because_it_would_overwrite_input_file_5055","Cannot write file '{0}' because it would overwrite input file."),Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files:ai(5056,1,"Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056","Cannot write file '{0}' because it would be overwritten by multiple input files."),Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0:ai(5057,1,"Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057","Cannot find a tsconfig.json file at the specified directory: '{0}'."),The_specified_path_does_not_exist_Colon_0:ai(5058,1,"The_specified_path_does_not_exist_Colon_0_5058","The specified path does not exist: '{0}'."),Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier:ai(5059,1,"Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059","Invalid value for '--reactNamespace'. '{0}' is not a valid identifier."),Pattern_0_can_have_at_most_one_Asterisk_character:ai(5061,1,"Pattern_0_can_have_at_most_one_Asterisk_character_5061","Pattern '{0}' can have at most one '*' character."),Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character:ai(5062,1,"Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character_5062","Substitution '{0}' in pattern '{1}' can have at most one '*' character."),Substitutions_for_pattern_0_should_be_an_array:ai(5063,1,"Substitutions_for_pattern_0_should_be_an_array_5063","Substitutions for pattern '{0}' should be an array."),Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2:ai(5064,1,"Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064","Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'."),File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0:ai(5065,1,"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065","File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'."),Substitutions_for_pattern_0_shouldn_t_be_an_empty_array:ai(5066,1,"Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066","Substitutions for pattern '{0}' shouldn't be an empty array."),Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name:ai(5067,1,"Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067","Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name."),Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig:ai(5068,1,"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068","Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig."),Option_0_cannot_be_specified_without_specifying_option_1_or_option_2:ai(5069,1,"Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069","Option '{0}' cannot be specified without specifying option '{1}' or option '{2}'."),Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic:ai(5070,1,"Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic_5070","Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'."),Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext:ai(5071,1,"Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071","Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."),Unknown_build_option_0:ai(5072,1,"Unknown_build_option_0_5072","Unknown build option '{0}'."),Build_option_0_requires_a_value_of_type_1:ai(5073,1,"Build_option_0_requires_a_value_of_type_1_5073","Build option '{0}' requires a value of type {1}."),Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified:ai(5074,1,"Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074","Option '--incremental' can only be specified using tsconfig, emitting to single file or when option '--tsBuildInfoFile' is specified."),_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2:ai(5075,1,"_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_5075","'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'."),_0_and_1_operations_cannot_be_mixed_without_parentheses:ai(5076,1,"_0_and_1_operations_cannot_be_mixed_without_parentheses_5076","'{0}' and '{1}' operations cannot be mixed without parentheses."),Unknown_build_option_0_Did_you_mean_1:ai(5077,1,"Unknown_build_option_0_Did_you_mean_1_5077","Unknown build option '{0}'. Did you mean '{1}'?"),Unknown_watch_option_0:ai(5078,1,"Unknown_watch_option_0_5078","Unknown watch option '{0}'."),Unknown_watch_option_0_Did_you_mean_1:ai(5079,1,"Unknown_watch_option_0_Did_you_mean_1_5079","Unknown watch option '{0}'. Did you mean '{1}'?"),Watch_option_0_requires_a_value_of_type_1:ai(5080,1,"Watch_option_0_requires_a_value_of_type_1_5080","Watch option '{0}' requires a value of type {1}."),Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0:ai(5081,1,"Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0_5081","Cannot find a tsconfig.json file at the current directory: {0}."),_0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1:ai(5082,1,"_0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1_5082","'{0}' could be instantiated with an arbitrary type which could be unrelated to '{1}'."),Cannot_read_file_0:ai(5083,1,"Cannot_read_file_0_5083","Cannot read file '{0}'."),A_tuple_member_cannot_be_both_optional_and_rest:ai(5085,1,"A_tuple_member_cannot_be_both_optional_and_rest_5085","A tuple member cannot be both optional and rest."),A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type:ai(5086,1,"A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_c_5086","A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type."),A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type:ai(5087,1,"A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type_5087","A labeled tuple element is declared as rest with a '...' before the name, rather than before the type."),The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary:ai(5088,1,"The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088","The inferred type of '{0}' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary."),Option_0_cannot_be_specified_when_option_jsx_is_1:ai(5089,1,"Option_0_cannot_be_specified_when_option_jsx_is_1_5089","Option '{0}' cannot be specified when option 'jsx' is '{1}'."),Non_relative_paths_are_not_allowed_when_baseUrl_is_not_set_Did_you_forget_a_leading_Slash:ai(5090,1,"Non_relative_paths_are_not_allowed_when_baseUrl_is_not_set_Did_you_forget_a_leading_Slash_5090","Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?"),Option_preserveConstEnums_cannot_be_disabled_when_0_is_enabled:ai(5091,1,"Option_preserveConstEnums_cannot_be_disabled_when_0_is_enabled_5091","Option 'preserveConstEnums' cannot be disabled when '{0}' is enabled."),The_root_value_of_a_0_file_must_be_an_object:ai(5092,1,"The_root_value_of_a_0_file_must_be_an_object_5092","The root value of a '{0}' file must be an object."),Compiler_option_0_may_only_be_used_with_build:ai(5093,1,"Compiler_option_0_may_only_be_used_with_build_5093","Compiler option '--{0}' may only be used with '--build'."),Compiler_option_0_may_not_be_used_with_build:ai(5094,1,"Compiler_option_0_may_not_be_used_with_build_5094","Compiler option '--{0}' may not be used with '--build'."),Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later:ai(5095,1,"Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later_5095","Option '{0}' can only be used when 'module' is set to 'es2015' or later."),Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set:ai(5096,1,"Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096","Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."),An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled:ai(5097,1,"An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097","An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."),Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler:ai(5098,1,"Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098","Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error:ai(5101,1,"Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprec_5101","Option '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '\"ignoreDeprecations\": \"{2}\"' to silence this error."),Option_0_has_been_removed_Please_remove_it_from_your_configuration:ai(5102,1,"Option_0_has_been_removed_Please_remove_it_from_your_configuration_5102","Option '{0}' has been removed. Please remove it from your configuration."),Invalid_value_for_ignoreDeprecations:ai(5103,1,"Invalid_value_for_ignoreDeprecations_5103","Invalid value for '--ignoreDeprecations'."),Option_0_is_redundant_and_cannot_be_specified_with_option_1:ai(5104,1,"Option_0_is_redundant_and_cannot_be_specified_with_option_1_5104","Option '{0}' is redundant and cannot be specified with option '{1}'."),Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System:ai(5105,1,"Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System_5105","Option 'verbatimModuleSyntax' cannot be used when 'module' is set to 'UMD', 'AMD', or 'System'."),Use_0_instead:ai(5106,3,"Use_0_instead_5106","Use '{0}' instead."),Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error:ai(5107,1,"Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDepr_5107","Option '{0}={1}' is deprecated and will stop functioning in TypeScript {2}. Specify compilerOption '\"ignoreDeprecations\": \"{3}\"' to silence this error."),Option_0_1_has_been_removed_Please_remove_it_from_your_configuration:ai(5108,1,"Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108","Option '{0}={1}' has been removed. Please remove it from your configuration."),Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1:ai(5109,1,"Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1_5109","Option 'moduleResolution' must be set to '{0}' (or left unspecified) when option 'module' is set to '{1}'."),Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1:ai(5110,1,"Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1_5110","Option 'module' must be set to '{0}' when option 'moduleResolution' is set to '{1}'."),Generates_a_sourcemap_for_each_corresponding_d_ts_file:ai(6e3,3,"Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000","Generates a sourcemap for each corresponding '.d.ts' file."),Concatenate_and_emit_output_to_single_file:ai(6001,3,"Concatenate_and_emit_output_to_single_file_6001","Concatenate and emit output to single file."),Generates_corresponding_d_ts_file:ai(6002,3,"Generates_corresponding_d_ts_file_6002","Generates corresponding '.d.ts' file."),Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations:ai(6004,3,"Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004","Specify the location where debugger should locate TypeScript files instead of source locations."),Watch_input_files:ai(6005,3,"Watch_input_files_6005","Watch input files."),Redirect_output_structure_to_the_directory:ai(6006,3,"Redirect_output_structure_to_the_directory_6006","Redirect output structure to the directory."),Do_not_erase_const_enum_declarations_in_generated_code:ai(6007,3,"Do_not_erase_const_enum_declarations_in_generated_code_6007","Do not erase const enum declarations in generated code."),Do_not_emit_outputs_if_any_errors_were_reported:ai(6008,3,"Do_not_emit_outputs_if_any_errors_were_reported_6008","Do not emit outputs if any errors were reported."),Do_not_emit_comments_to_output:ai(6009,3,"Do_not_emit_comments_to_output_6009","Do not emit comments to output."),Do_not_emit_outputs:ai(6010,3,"Do_not_emit_outputs_6010","Do not emit outputs."),Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking:ai(6011,3,"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011","Allow default imports from modules with no default export. This does not affect code emit, just typechecking."),Skip_type_checking_of_declaration_files:ai(6012,3,"Skip_type_checking_of_declaration_files_6012","Skip type checking of declaration files."),Do_not_resolve_the_real_path_of_symlinks:ai(6013,3,"Do_not_resolve_the_real_path_of_symlinks_6013","Do not resolve the real path of symlinks."),Only_emit_d_ts_declaration_files:ai(6014,3,"Only_emit_d_ts_declaration_files_6014","Only emit '.d.ts' declaration files."),Specify_ECMAScript_target_version:ai(6015,3,"Specify_ECMAScript_target_version_6015","Specify ECMAScript target version."),Specify_module_code_generation:ai(6016,3,"Specify_module_code_generation_6016","Specify module code generation."),Print_this_message:ai(6017,3,"Print_this_message_6017","Print this message."),Print_the_compiler_s_version:ai(6019,3,"Print_the_compiler_s_version_6019","Print the compiler's version."),Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json:ai(6020,3,"Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020","Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'."),Syntax_Colon_0:ai(6023,3,"Syntax_Colon_0_6023","Syntax: {0}"),options:ai(6024,3,"options_6024","options"),file:ai(6025,3,"file_6025","file"),Examples_Colon_0:ai(6026,3,"Examples_Colon_0_6026","Examples: {0}"),Options_Colon:ai(6027,3,"Options_Colon_6027","Options:"),Version_0:ai(6029,3,"Version_0_6029","Version {0}"),Insert_command_line_options_and_files_from_a_file:ai(6030,3,"Insert_command_line_options_and_files_from_a_file_6030","Insert command line options and files from a file."),Starting_compilation_in_watch_mode:ai(6031,3,"Starting_compilation_in_watch_mode_6031","Starting compilation in watch mode..."),File_change_detected_Starting_incremental_compilation:ai(6032,3,"File_change_detected_Starting_incremental_compilation_6032","File change detected. Starting incremental compilation..."),KIND:ai(6034,3,"KIND_6034","KIND"),FILE:ai(6035,3,"FILE_6035","FILE"),VERSION:ai(6036,3,"VERSION_6036","VERSION"),LOCATION:ai(6037,3,"LOCATION_6037","LOCATION"),DIRECTORY:ai(6038,3,"DIRECTORY_6038","DIRECTORY"),STRATEGY:ai(6039,3,"STRATEGY_6039","STRATEGY"),FILE_OR_DIRECTORY:ai(6040,3,"FILE_OR_DIRECTORY_6040","FILE OR DIRECTORY"),Errors_Files:ai(6041,3,"Errors_Files_6041","Errors Files"),Generates_corresponding_map_file:ai(6043,3,"Generates_corresponding_map_file_6043","Generates corresponding '.map' file."),Compiler_option_0_expects_an_argument:ai(6044,1,"Compiler_option_0_expects_an_argument_6044","Compiler option '{0}' expects an argument."),Unterminated_quoted_string_in_response_file_0:ai(6045,1,"Unterminated_quoted_string_in_response_file_0_6045","Unterminated quoted string in response file '{0}'."),Argument_for_0_option_must_be_Colon_1:ai(6046,1,"Argument_for_0_option_must_be_Colon_1_6046","Argument for '{0}' option must be: {1}."),Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1:ai(6048,1,"Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048","Locale must be of the form or -. For example '{0}' or '{1}'."),Unable_to_open_file_0:ai(6050,1,"Unable_to_open_file_0_6050","Unable to open file '{0}'."),Corrupted_locale_file_0:ai(6051,1,"Corrupted_locale_file_0_6051","Corrupted locale file {0}."),Raise_error_on_expressions_and_declarations_with_an_implied_any_type:ai(6052,3,"Raise_error_on_expressions_and_declarations_with_an_implied_any_type_6052","Raise error on expressions and declarations with an implied 'any' type."),File_0_not_found:ai(6053,1,"File_0_not_found_6053","File '{0}' not found."),File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1:ai(6054,1,"File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1_6054","File '{0}' has an unsupported extension. The only supported extensions are {1}."),Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures:ai(6055,3,"Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055","Suppress noImplicitAny errors for indexing objects lacking index signatures."),Do_not_emit_declarations_for_code_that_has_an_internal_annotation:ai(6056,3,"Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056","Do not emit declarations for code that has an '@internal' annotation."),Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir:ai(6058,3,"Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058","Specify the root directory of input files. Use to control the output directory structure with --outDir."),File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files:ai(6059,1,"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059","File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files."),Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix:ai(6060,3,"Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060","Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)."),NEWLINE:ai(6061,3,"NEWLINE_6061","NEWLINE"),Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line:ai(6064,1,"Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line_6064","Option '{0}' can only be specified in 'tsconfig.json' file or set to 'null' on command line."),Enables_experimental_support_for_ES7_decorators:ai(6065,3,"Enables_experimental_support_for_ES7_decorators_6065","Enables experimental support for ES7 decorators."),Enables_experimental_support_for_emitting_type_metadata_for_decorators:ai(6066,3,"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066","Enables experimental support for emitting type metadata for decorators."),Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file:ai(6070,3,"Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070","Initializes a TypeScript project and creates a tsconfig.json file."),Successfully_created_a_tsconfig_json_file:ai(6071,3,"Successfully_created_a_tsconfig_json_file_6071","Successfully created a tsconfig.json file."),Suppress_excess_property_checks_for_object_literals:ai(6072,3,"Suppress_excess_property_checks_for_object_literals_6072","Suppress excess property checks for object literals."),Stylize_errors_and_messages_using_color_and_context_experimental:ai(6073,3,"Stylize_errors_and_messages_using_color_and_context_experimental_6073","Stylize errors and messages using color and context (experimental)."),Do_not_report_errors_on_unused_labels:ai(6074,3,"Do_not_report_errors_on_unused_labels_6074","Do not report errors on unused labels."),Report_error_when_not_all_code_paths_in_function_return_a_value:ai(6075,3,"Report_error_when_not_all_code_paths_in_function_return_a_value_6075","Report error when not all code paths in function return a value."),Report_errors_for_fallthrough_cases_in_switch_statement:ai(6076,3,"Report_errors_for_fallthrough_cases_in_switch_statement_6076","Report errors for fallthrough cases in switch statement."),Do_not_report_errors_on_unreachable_code:ai(6077,3,"Do_not_report_errors_on_unreachable_code_6077","Do not report errors on unreachable code."),Disallow_inconsistently_cased_references_to_the_same_file:ai(6078,3,"Disallow_inconsistently_cased_references_to_the_same_file_6078","Disallow inconsistently-cased references to the same file."),Specify_library_files_to_be_included_in_the_compilation:ai(6079,3,"Specify_library_files_to_be_included_in_the_compilation_6079","Specify library files to be included in the compilation."),Specify_JSX_code_generation:ai(6080,3,"Specify_JSX_code_generation_6080","Specify JSX code generation."),File_0_has_an_unsupported_extension_so_skipping_it:ai(6081,3,"File_0_has_an_unsupported_extension_so_skipping_it_6081","File '{0}' has an unsupported extension, so skipping it."),Only_amd_and_system_modules_are_supported_alongside_0:ai(6082,1,"Only_amd_and_system_modules_are_supported_alongside_0_6082","Only 'amd' and 'system' modules are supported alongside --{0}."),Base_directory_to_resolve_non_absolute_module_names:ai(6083,3,"Base_directory_to_resolve_non_absolute_module_names_6083","Base directory to resolve non-absolute module names."),Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit:ai(6084,3,"Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084","[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit"),Enable_tracing_of_the_name_resolution_process:ai(6085,3,"Enable_tracing_of_the_name_resolution_process_6085","Enable tracing of the name resolution process."),Resolving_module_0_from_1:ai(6086,3,"Resolving_module_0_from_1_6086","======== Resolving module '{0}' from '{1}'. ========"),Explicitly_specified_module_resolution_kind_Colon_0:ai(6087,3,"Explicitly_specified_module_resolution_kind_Colon_0_6087","Explicitly specified module resolution kind: '{0}'."),Module_resolution_kind_is_not_specified_using_0:ai(6088,3,"Module_resolution_kind_is_not_specified_using_0_6088","Module resolution kind is not specified, using '{0}'."),Module_name_0_was_successfully_resolved_to_1:ai(6089,3,"Module_name_0_was_successfully_resolved_to_1_6089","======== Module name '{0}' was successfully resolved to '{1}'. ========"),Module_name_0_was_not_resolved:ai(6090,3,"Module_name_0_was_not_resolved_6090","======== Module name '{0}' was not resolved. ========"),paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0:ai(6091,3,"paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091","'paths' option is specified, looking for a pattern to match module name '{0}'."),Module_name_0_matched_pattern_1:ai(6092,3,"Module_name_0_matched_pattern_1_6092","Module name '{0}', matched pattern '{1}'."),Trying_substitution_0_candidate_module_location_Colon_1:ai(6093,3,"Trying_substitution_0_candidate_module_location_Colon_1_6093","Trying substitution '{0}', candidate module location: '{1}'."),Resolving_module_name_0_relative_to_base_url_1_2:ai(6094,3,"Resolving_module_name_0_relative_to_base_url_1_2_6094","Resolving module name '{0}' relative to base url '{1}' - '{2}'."),Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1:ai(6095,3,"Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1_6095","Loading module as file / folder, candidate module location '{0}', target file types: {1}."),File_0_does_not_exist:ai(6096,3,"File_0_does_not_exist_6096","File '{0}' does not exist."),File_0_exists_use_it_as_a_name_resolution_result:ai(6097,3,"File_0_exists_use_it_as_a_name_resolution_result_6097","File '{0}' exists - use it as a name resolution result."),Loading_module_0_from_node_modules_folder_target_file_types_Colon_1:ai(6098,3,"Loading_module_0_from_node_modules_folder_target_file_types_Colon_1_6098","Loading module '{0}' from 'node_modules' folder, target file types: {1}."),Found_package_json_at_0:ai(6099,3,"Found_package_json_at_0_6099","Found 'package.json' at '{0}'."),package_json_does_not_have_a_0_field:ai(6100,3,"package_json_does_not_have_a_0_field_6100","'package.json' does not have a '{0}' field."),package_json_has_0_field_1_that_references_2:ai(6101,3,"package_json_has_0_field_1_that_references_2_6101","'package.json' has '{0}' field '{1}' that references '{2}'."),Allow_javascript_files_to_be_compiled:ai(6102,3,"Allow_javascript_files_to_be_compiled_6102","Allow javascript files to be compiled."),Checking_if_0_is_the_longest_matching_prefix_for_1_2:ai(6104,3,"Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104","Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'."),Expected_type_of_0_field_in_package_json_to_be_1_got_2:ai(6105,3,"Expected_type_of_0_field_in_package_json_to_be_1_got_2_6105","Expected type of '{0}' field in 'package.json' to be '{1}', got '{2}'."),baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1:ai(6106,3,"baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106","'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'."),rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0:ai(6107,3,"rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107","'rootDirs' option is set, using it to resolve relative module name '{0}'."),Longest_matching_prefix_for_0_is_1:ai(6108,3,"Longest_matching_prefix_for_0_is_1_6108","Longest matching prefix for '{0}' is '{1}'."),Loading_0_from_the_root_dir_1_candidate_location_2:ai(6109,3,"Loading_0_from_the_root_dir_1_candidate_location_2_6109","Loading '{0}' from the root dir '{1}', candidate location '{2}'."),Trying_other_entries_in_rootDirs:ai(6110,3,"Trying_other_entries_in_rootDirs_6110","Trying other entries in 'rootDirs'."),Module_resolution_using_rootDirs_has_failed:ai(6111,3,"Module_resolution_using_rootDirs_has_failed_6111","Module resolution using 'rootDirs' has failed."),Do_not_emit_use_strict_directives_in_module_output:ai(6112,3,"Do_not_emit_use_strict_directives_in_module_output_6112","Do not emit 'use strict' directives in module output."),Enable_strict_null_checks:ai(6113,3,"Enable_strict_null_checks_6113","Enable strict null checks."),Unknown_option_excludes_Did_you_mean_exclude:ai(6114,1,"Unknown_option_excludes_Did_you_mean_exclude_6114","Unknown option 'excludes'. Did you mean 'exclude'?"),Raise_error_on_this_expressions_with_an_implied_any_type:ai(6115,3,"Raise_error_on_this_expressions_with_an_implied_any_type_6115","Raise error on 'this' expressions with an implied 'any' type."),Resolving_type_reference_directive_0_containing_file_1_root_directory_2:ai(6116,3,"Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116","======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========"),Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2:ai(6119,3,"Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119","======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========"),Type_reference_directive_0_was_not_resolved:ai(6120,3,"Type_reference_directive_0_was_not_resolved_6120","======== Type reference directive '{0}' was not resolved. ========"),Resolving_with_primary_search_path_0:ai(6121,3,"Resolving_with_primary_search_path_0_6121","Resolving with primary search path '{0}'."),Root_directory_cannot_be_determined_skipping_primary_search_paths:ai(6122,3,"Root_directory_cannot_be_determined_skipping_primary_search_paths_6122","Root directory cannot be determined, skipping primary search paths."),Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set:ai(6123,3,"Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123","======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========"),Type_declaration_files_to_be_included_in_compilation:ai(6124,3,"Type_declaration_files_to_be_included_in_compilation_6124","Type declaration files to be included in compilation."),Looking_up_in_node_modules_folder_initial_location_0:ai(6125,3,"Looking_up_in_node_modules_folder_initial_location_0_6125","Looking up in 'node_modules' folder, initial location '{0}'."),Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder:ai(6126,3,"Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126","Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder."),Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1:ai(6127,3,"Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127","======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========"),Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set:ai(6128,3,"Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128","======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========"),Resolving_real_path_for_0_result_1:ai(6130,3,"Resolving_real_path_for_0_result_1_6130","Resolving real path for '{0}', result '{1}'."),Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system:ai(6131,1,"Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131","Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'."),File_name_0_has_a_1_extension_stripping_it:ai(6132,3,"File_name_0_has_a_1_extension_stripping_it_6132","File name '{0}' has a '{1}' extension - stripping it."),_0_is_declared_but_its_value_is_never_read:ai(6133,1,"_0_is_declared_but_its_value_is_never_read_6133","'{0}' is declared but its value is never read.",!0),Report_errors_on_unused_locals:ai(6134,3,"Report_errors_on_unused_locals_6134","Report errors on unused locals."),Report_errors_on_unused_parameters:ai(6135,3,"Report_errors_on_unused_parameters_6135","Report errors on unused parameters."),The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files:ai(6136,3,"The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136","The maximum dependency depth to search under node_modules and load JavaScript files."),Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1:ai(6137,1,"Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1_6137","Cannot import type declaration files. Consider importing '{0}' instead of '{1}'."),Property_0_is_declared_but_its_value_is_never_read:ai(6138,1,"Property_0_is_declared_but_its_value_is_never_read_6138","Property '{0}' is declared but its value is never read.",!0),Import_emit_helpers_from_tslib:ai(6139,3,"Import_emit_helpers_from_tslib_6139","Import emit helpers from 'tslib'."),Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2:ai(6140,1,"Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140","Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'."),Parse_in_strict_mode_and_emit_use_strict_for_each_source_file:ai(6141,3,"Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141",'Parse in strict mode and emit "use strict" for each source file.'),Module_0_was_resolved_to_1_but_jsx_is_not_set:ai(6142,1,"Module_0_was_resolved_to_1_but_jsx_is_not_set_6142","Module '{0}' was resolved to '{1}', but '--jsx' is not set."),Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1:ai(6144,3,"Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144","Module '{0}' was resolved as locally declared ambient module in file '{1}'."),Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified:ai(6145,3,"Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145","Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified."),Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h:ai(6146,3,"Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146","Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'."),Resolution_for_module_0_was_found_in_cache_from_location_1:ai(6147,3,"Resolution_for_module_0_was_found_in_cache_from_location_1_6147","Resolution for module '{0}' was found in cache from location '{1}'."),Directory_0_does_not_exist_skipping_all_lookups_in_it:ai(6148,3,"Directory_0_does_not_exist_skipping_all_lookups_in_it_6148","Directory '{0}' does not exist, skipping all lookups in it."),Show_diagnostic_information:ai(6149,3,"Show_diagnostic_information_6149","Show diagnostic information."),Show_verbose_diagnostic_information:ai(6150,3,"Show_verbose_diagnostic_information_6150","Show verbose diagnostic information."),Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file:ai(6151,3,"Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151","Emit a single file with source maps instead of having a separate file."),Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set:ai(6152,3,"Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152","Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set."),Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule:ai(6153,3,"Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153","Transpile each file as a separate module (similar to 'ts.transpileModule')."),Print_names_of_generated_files_part_of_the_compilation:ai(6154,3,"Print_names_of_generated_files_part_of_the_compilation_6154","Print names of generated files part of the compilation."),Print_names_of_files_part_of_the_compilation:ai(6155,3,"Print_names_of_files_part_of_the_compilation_6155","Print names of files part of the compilation."),The_locale_used_when_displaying_messages_to_the_user_e_g_en_us:ai(6156,3,"The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156","The locale used when displaying messages to the user (e.g. 'en-us')"),Do_not_generate_custom_helper_functions_like_extends_in_compiled_output:ai(6157,3,"Do_not_generate_custom_helper_functions_like_extends_in_compiled_output_6157","Do not generate custom helper functions like '__extends' in compiled output."),Do_not_include_the_default_library_file_lib_d_ts:ai(6158,3,"Do_not_include_the_default_library_file_lib_d_ts_6158","Do not include the default library file (lib.d.ts)."),Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files:ai(6159,3,"Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files_6159","Do not add triple-slash references or imported modules to the list of compiled files."),Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files:ai(6160,3,"Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160","[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files."),List_of_folders_to_include_type_definitions_from:ai(6161,3,"List_of_folders_to_include_type_definitions_from_6161","List of folders to include type definitions from."),Disable_size_limitations_on_JavaScript_projects:ai(6162,3,"Disable_size_limitations_on_JavaScript_projects_6162","Disable size limitations on JavaScript projects."),The_character_set_of_the_input_files:ai(6163,3,"The_character_set_of_the_input_files_6163","The character set of the input files."),Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1:ai(6164,3,"Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1_6164","Skipping module '{0}' that looks like an absolute URI, target file types: {1}."),Do_not_truncate_error_messages:ai(6165,3,"Do_not_truncate_error_messages_6165","Do not truncate error messages."),Output_directory_for_generated_declaration_files:ai(6166,3,"Output_directory_for_generated_declaration_files_6166","Output directory for generated declaration files."),A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl:ai(6167,3,"A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167","A series of entries which re-map imports to lookup locations relative to the 'baseUrl'."),List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime:ai(6168,3,"List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime_6168","List of root folders whose combined content represents the structure of the project at runtime."),Show_all_compiler_options:ai(6169,3,"Show_all_compiler_options_6169","Show all compiler options."),Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file:ai(6170,3,"Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170","[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file"),Command_line_Options:ai(6171,3,"Command_line_Options_6171","Command-line Options"),Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3:ai(6179,3,"Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179","Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'."),Enable_all_strict_type_checking_options:ai(6180,3,"Enable_all_strict_type_checking_options_6180","Enable all strict type-checking options."),Scoped_package_detected_looking_in_0:ai(6182,3,"Scoped_package_detected_looking_in_0_6182","Scoped package detected, looking in '{0}'"),Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2:ai(6183,3,"Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_6183","Reusing resolution of module '{0}' from '{1}' of old program, it was successfully resolved to '{2}'."),Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3:ai(6184,3,"Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package__6184","Reusing resolution of module '{0}' from '{1}' of old program, it was successfully resolved to '{2}' with Package ID '{3}'."),Enable_strict_checking_of_function_types:ai(6186,3,"Enable_strict_checking_of_function_types_6186","Enable strict checking of function types."),Enable_strict_checking_of_property_initialization_in_classes:ai(6187,3,"Enable_strict_checking_of_property_initialization_in_classes_6187","Enable strict checking of property initialization in classes."),Numeric_separators_are_not_allowed_here:ai(6188,1,"Numeric_separators_are_not_allowed_here_6188","Numeric separators are not allowed here."),Multiple_consecutive_numeric_separators_are_not_permitted:ai(6189,1,"Multiple_consecutive_numeric_separators_are_not_permitted_6189","Multiple consecutive numeric separators are not permitted."),Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen:ai(6191,3,"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191","Whether to keep outdated console output in watch mode instead of clearing the screen."),All_imports_in_import_declaration_are_unused:ai(6192,1,"All_imports_in_import_declaration_are_unused_6192","All imports in import declaration are unused.",!0),Found_1_error_Watching_for_file_changes:ai(6193,3,"Found_1_error_Watching_for_file_changes_6193","Found 1 error. Watching for file changes."),Found_0_errors_Watching_for_file_changes:ai(6194,3,"Found_0_errors_Watching_for_file_changes_6194","Found {0} errors. Watching for file changes."),Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols:ai(6195,3,"Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195","Resolve 'keyof' to string valued property names only (no numbers or symbols)."),_0_is_declared_but_never_used:ai(6196,1,"_0_is_declared_but_never_used_6196","'{0}' is declared but never used.",!0),Include_modules_imported_with_json_extension:ai(6197,3,"Include_modules_imported_with_json_extension_6197","Include modules imported with '.json' extension"),All_destructured_elements_are_unused:ai(6198,1,"All_destructured_elements_are_unused_6198","All destructured elements are unused.",!0),All_variables_are_unused:ai(6199,1,"All_variables_are_unused_6199","All variables are unused.",!0),Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0:ai(6200,1,"Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0_6200","Definitions of the following identifiers conflict with those in another file: {0}"),Conflicts_are_in_this_file:ai(6201,3,"Conflicts_are_in_this_file_6201","Conflicts are in this file."),Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0:ai(6202,1,"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202","Project references may not form a circular graph. Cycle detected: {0}"),_0_was_also_declared_here:ai(6203,3,"_0_was_also_declared_here_6203","'{0}' was also declared here."),and_here:ai(6204,3,"and_here_6204","and here."),All_type_parameters_are_unused:ai(6205,1,"All_type_parameters_are_unused_6205","All type parameters are unused."),package_json_has_a_typesVersions_field_with_version_specific_path_mappings:ai(6206,3,"package_json_has_a_typesVersions_field_with_version_specific_path_mappings_6206","'package.json' has a 'typesVersions' field with version-specific path mappings."),package_json_does_not_have_a_typesVersions_entry_that_matches_version_0:ai(6207,3,"package_json_does_not_have_a_typesVersions_entry_that_matches_version_0_6207","'package.json' does not have a 'typesVersions' entry that matches version '{0}'."),package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2:ai(6208,3,"package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_ma_6208","'package.json' has a 'typesVersions' entry '{0}' that matches compiler version '{1}', looking for a pattern to match module name '{2}'."),package_json_has_a_typesVersions_entry_0_that_is_not_a_valid_semver_range:ai(6209,3,"package_json_has_a_typesVersions_entry_0_that_is_not_a_valid_semver_range_6209","'package.json' has a 'typesVersions' entry '{0}' that is not a valid semver range."),An_argument_for_0_was_not_provided:ai(6210,3,"An_argument_for_0_was_not_provided_6210","An argument for '{0}' was not provided."),An_argument_matching_this_binding_pattern_was_not_provided:ai(6211,3,"An_argument_matching_this_binding_pattern_was_not_provided_6211","An argument matching this binding pattern was not provided."),Did_you_mean_to_call_this_expression:ai(6212,3,"Did_you_mean_to_call_this_expression_6212","Did you mean to call this expression?"),Did_you_mean_to_use_new_with_this_expression:ai(6213,3,"Did_you_mean_to_use_new_with_this_expression_6213","Did you mean to use 'new' with this expression?"),Enable_strict_bind_call_and_apply_methods_on_functions:ai(6214,3,"Enable_strict_bind_call_and_apply_methods_on_functions_6214","Enable strict 'bind', 'call', and 'apply' methods on functions."),Using_compiler_options_of_project_reference_redirect_0:ai(6215,3,"Using_compiler_options_of_project_reference_redirect_0_6215","Using compiler options of project reference redirect '{0}'."),Found_1_error:ai(6216,3,"Found_1_error_6216","Found 1 error."),Found_0_errors:ai(6217,3,"Found_0_errors_6217","Found {0} errors."),Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2:ai(6218,3,"Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2_6218","======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========"),Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3:ai(6219,3,"Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219","======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========"),package_json_had_a_falsy_0_field:ai(6220,3,"package_json_had_a_falsy_0_field_6220","'package.json' had a falsy '{0}' field."),Disable_use_of_source_files_instead_of_declaration_files_from_referenced_projects:ai(6221,3,"Disable_use_of_source_files_instead_of_declaration_files_from_referenced_projects_6221","Disable use of source files instead of declaration files from referenced projects."),Emit_class_fields_with_Define_instead_of_Set:ai(6222,3,"Emit_class_fields_with_Define_instead_of_Set_6222","Emit class fields with Define instead of Set."),Generates_a_CPU_profile:ai(6223,3,"Generates_a_CPU_profile_6223","Generates a CPU profile."),Disable_solution_searching_for_this_project:ai(6224,3,"Disable_solution_searching_for_this_project_6224","Disable solution searching for this project."),Specify_strategy_for_watching_file_Colon_FixedPollingInterval_default_PriorityPollingInterval_DynamicPriorityPolling_FixedChunkSizePolling_UseFsEvents_UseFsEventsOnParentDirectory:ai(6225,3,"Specify_strategy_for_watching_file_Colon_FixedPollingInterval_default_PriorityPollingInterval_Dynami_6225","Specify strategy for watching file: 'FixedPollingInterval' (default), 'PriorityPollingInterval', 'DynamicPriorityPolling', 'FixedChunkSizePolling', 'UseFsEvents', 'UseFsEventsOnParentDirectory'."),Specify_strategy_for_watching_directory_on_platforms_that_don_t_support_recursive_watching_natively_Colon_UseFsEvents_default_FixedPollingInterval_DynamicPriorityPolling_FixedChunkSizePolling:ai(6226,3,"Specify_strategy_for_watching_directory_on_platforms_that_don_t_support_recursive_watching_natively__6226","Specify strategy for watching directory on platforms that don't support recursive watching natively: 'UseFsEvents' (default), 'FixedPollingInterval', 'DynamicPriorityPolling', 'FixedChunkSizePolling'."),Specify_strategy_for_creating_a_polling_watch_when_it_fails_to_create_using_file_system_events_Colon_FixedInterval_default_PriorityInterval_DynamicPriority_FixedChunkSize:ai(6227,3,"Specify_strategy_for_creating_a_polling_watch_when_it_fails_to_create_using_file_system_events_Colon_6227","Specify strategy for creating a polling watch when it fails to create using file system events: 'FixedInterval' (default), 'PriorityInterval', 'DynamicPriority', 'FixedChunkSize'."),Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3:ai(6229,1,"Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3_6229","Tag '{0}' expects at least '{1}' arguments, but the JSX factory '{2}' provides at most '{3}'."),Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line:ai(6230,1,"Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line_6230","Option '{0}' can only be specified in 'tsconfig.json' file or set to 'false' or 'null' on command line."),Could_not_resolve_the_path_0_with_the_extensions_Colon_1:ai(6231,1,"Could_not_resolve_the_path_0_with_the_extensions_Colon_1_6231","Could not resolve the path '{0}' with the extensions: {1}."),Declaration_augments_declaration_in_another_file_This_cannot_be_serialized:ai(6232,1,"Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232","Declaration augments declaration in another file. This cannot be serialized."),This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file:ai(6233,1,"This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233","This is the declaration being augmented. Consider moving the augmenting declaration into the same file."),This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without:ai(6234,1,"This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without_6234","This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?"),Disable_loading_referenced_projects:ai(6235,3,"Disable_loading_referenced_projects_6235","Disable loading referenced projects."),Arguments_for_the_rest_parameter_0_were_not_provided:ai(6236,1,"Arguments_for_the_rest_parameter_0_were_not_provided_6236","Arguments for the rest parameter '{0}' were not provided."),Generates_an_event_trace_and_a_list_of_types:ai(6237,3,"Generates_an_event_trace_and_a_list_of_types_6237","Generates an event trace and a list of types."),Specify_the_module_specifier_to_be_used_to_import_the_jsx_and_jsxs_factory_functions_from_eg_react:ai(6238,1,"Specify_the_module_specifier_to_be_used_to_import_the_jsx_and_jsxs_factory_functions_from_eg_react_6238","Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react"),File_0_exists_according_to_earlier_cached_lookups:ai(6239,3,"File_0_exists_according_to_earlier_cached_lookups_6239","File '{0}' exists according to earlier cached lookups."),File_0_does_not_exist_according_to_earlier_cached_lookups:ai(6240,3,"File_0_does_not_exist_according_to_earlier_cached_lookups_6240","File '{0}' does not exist according to earlier cached lookups."),Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1:ai(6241,3,"Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241","Resolution for type reference directive '{0}' was found in cache from location '{1}'."),Resolving_type_reference_directive_0_containing_file_1:ai(6242,3,"Resolving_type_reference_directive_0_containing_file_1_6242","======== Resolving type reference directive '{0}', containing file '{1}'. ========"),Interpret_optional_property_types_as_written_rather_than_adding_undefined:ai(6243,3,"Interpret_optional_property_types_as_written_rather_than_adding_undefined_6243","Interpret optional property types as written, rather than adding 'undefined'."),Modules:ai(6244,3,"Modules_6244","Modules"),File_Management:ai(6245,3,"File_Management_6245","File Management"),Emit:ai(6246,3,"Emit_6246","Emit"),JavaScript_Support:ai(6247,3,"JavaScript_Support_6247","JavaScript Support"),Type_Checking:ai(6248,3,"Type_Checking_6248","Type Checking"),Editor_Support:ai(6249,3,"Editor_Support_6249","Editor Support"),Watch_and_Build_Modes:ai(6250,3,"Watch_and_Build_Modes_6250","Watch and Build Modes"),Compiler_Diagnostics:ai(6251,3,"Compiler_Diagnostics_6251","Compiler Diagnostics"),Interop_Constraints:ai(6252,3,"Interop_Constraints_6252","Interop Constraints"),Backwards_Compatibility:ai(6253,3,"Backwards_Compatibility_6253","Backwards Compatibility"),Language_and_Environment:ai(6254,3,"Language_and_Environment_6254","Language and Environment"),Projects:ai(6255,3,"Projects_6255","Projects"),Output_Formatting:ai(6256,3,"Output_Formatting_6256","Output Formatting"),Completeness:ai(6257,3,"Completeness_6257","Completeness"),_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file:ai(6258,1,"_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file_6258","'{0}' should be set inside the 'compilerOptions' object of the config json file"),Found_1_error_in_0:ai(6259,3,"Found_1_error_in_0_6259","Found 1 error in {0}"),Found_0_errors_in_the_same_file_starting_at_Colon_1:ai(6260,3,"Found_0_errors_in_the_same_file_starting_at_Colon_1_6260","Found {0} errors in the same file, starting at: {1}"),Found_0_errors_in_1_files:ai(6261,3,"Found_0_errors_in_1_files_6261","Found {0} errors in {1} files."),File_name_0_has_a_1_extension_looking_up_2_instead:ai(6262,3,"File_name_0_has_a_1_extension_looking_up_2_instead_6262","File name '{0}' has a '{1}' extension - looking up '{2}' instead."),Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set:ai(6263,1,"Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set_6263","Module '{0}' was resolved to '{1}', but '--allowArbitraryExtensions' is not set."),Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present:ai(6264,3,"Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present_6264","Enable importing files with any extension, provided a declaration file is present."),Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder:ai(6265,3,"Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_no_6265","Resolving type reference directive for program that specifies custom typeRoots, skipping lookup in 'node_modules' folder."),Option_0_can_only_be_specified_on_command_line:ai(6266,1,"Option_0_can_only_be_specified_on_command_line_6266","Option '{0}' can only be specified on command line."),Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve:ai(6270,3,"Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270","Directory '{0}' has no containing package.json scope. Imports will not resolve."),Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1:ai(6271,3,"Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271","Import specifier '{0}' does not exist in package.json scope at path '{1}'."),Invalid_import_specifier_0_has_no_possible_resolutions:ai(6272,3,"Invalid_import_specifier_0_has_no_possible_resolutions_6272","Invalid import specifier '{0}' has no possible resolutions."),package_json_scope_0_has_no_imports_defined:ai(6273,3,"package_json_scope_0_has_no_imports_defined_6273","package.json scope '{0}' has no imports defined."),package_json_scope_0_explicitly_maps_specifier_1_to_null:ai(6274,3,"package_json_scope_0_explicitly_maps_specifier_1_to_null_6274","package.json scope '{0}' explicitly maps specifier '{1}' to null."),package_json_scope_0_has_invalid_type_for_target_of_specifier_1:ai(6275,3,"package_json_scope_0_has_invalid_type_for_target_of_specifier_1_6275","package.json scope '{0}' has invalid type for target of specifier '{1}'"),Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1:ai(6276,3,"Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6276","Export specifier '{0}' does not exist in package.json scope at path '{1}'."),Resolution_of_non_relative_name_failed_trying_with_modern_Node_resolution_features_disabled_to_see_if_npm_library_needs_configuration_update:ai(6277,3,"Resolution_of_non_relative_name_failed_trying_with_modern_Node_resolution_features_disabled_to_see_i_6277","Resolution of non-relative name failed; trying with modern Node resolution features disabled to see if npm library needs configuration update."),There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The_1_library_may_need_to_update_its_package_json_or_typings:ai(6278,3,"There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The__6278","There are types at '{0}', but this result could not be resolved when respecting package.json \"exports\". The '{1}' library may need to update its package.json or typings."),Enable_project_compilation:ai(6302,3,"Enable_project_compilation_6302","Enable project compilation"),Composite_projects_may_not_disable_declaration_emit:ai(6304,1,"Composite_projects_may_not_disable_declaration_emit_6304","Composite projects may not disable declaration emit."),Output_file_0_has_not_been_built_from_source_file_1:ai(6305,1,"Output_file_0_has_not_been_built_from_source_file_1_6305","Output file '{0}' has not been built from source file '{1}'."),Referenced_project_0_must_have_setting_composite_Colon_true:ai(6306,1,"Referenced_project_0_must_have_setting_composite_Colon_true_6306","Referenced project '{0}' must have setting \"composite\": true."),File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern:ai(6307,1,"File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_includ_6307","File '{0}' is not listed within the file list of project '{1}'. Projects must list all files or use an 'include' pattern."),Cannot_prepend_project_0_because_it_does_not_have_outFile_set:ai(6308,1,"Cannot_prepend_project_0_because_it_does_not_have_outFile_set_6308","Cannot prepend project '{0}' because it does not have 'outFile' set"),Output_file_0_from_project_1_does_not_exist:ai(6309,1,"Output_file_0_from_project_1_does_not_exist_6309","Output file '{0}' from project '{1}' does not exist"),Referenced_project_0_may_not_disable_emit:ai(6310,1,"Referenced_project_0_may_not_disable_emit_6310","Referenced project '{0}' may not disable emit."),Project_0_is_out_of_date_because_output_1_is_older_than_input_2:ai(6350,3,"Project_0_is_out_of_date_because_output_1_is_older_than_input_2_6350","Project '{0}' is out of date because output '{1}' is older than input '{2}'"),Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2:ai(6351,3,"Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351","Project '{0}' is up to date because newest input '{1}' is older than output '{2}'"),Project_0_is_out_of_date_because_output_file_1_does_not_exist:ai(6352,3,"Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352","Project '{0}' is out of date because output file '{1}' does not exist"),Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date:ai(6353,3,"Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353","Project '{0}' is out of date because its dependency '{1}' is out of date"),Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies:ai(6354,3,"Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354","Project '{0}' is up to date with .d.ts files from its dependencies"),Projects_in_this_build_Colon_0:ai(6355,3,"Projects_in_this_build_Colon_0_6355","Projects in this build: {0}"),A_non_dry_build_would_delete_the_following_files_Colon_0:ai(6356,3,"A_non_dry_build_would_delete_the_following_files_Colon_0_6356","A non-dry build would delete the following files: {0}"),A_non_dry_build_would_build_project_0:ai(6357,3,"A_non_dry_build_would_build_project_0_6357","A non-dry build would build project '{0}'"),Building_project_0:ai(6358,3,"Building_project_0_6358","Building project '{0}'..."),Updating_output_timestamps_of_project_0:ai(6359,3,"Updating_output_timestamps_of_project_0_6359","Updating output timestamps of project '{0}'..."),Project_0_is_up_to_date:ai(6361,3,"Project_0_is_up_to_date_6361","Project '{0}' is up to date"),Skipping_build_of_project_0_because_its_dependency_1_has_errors:ai(6362,3,"Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362","Skipping build of project '{0}' because its dependency '{1}' has errors"),Project_0_can_t_be_built_because_its_dependency_1_has_errors:ai(6363,3,"Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363","Project '{0}' can't be built because its dependency '{1}' has errors"),Build_one_or_more_projects_and_their_dependencies_if_out_of_date:ai(6364,3,"Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364","Build one or more projects and their dependencies, if out of date"),Delete_the_outputs_of_all_projects:ai(6365,3,"Delete_the_outputs_of_all_projects_6365","Delete the outputs of all projects."),Show_what_would_be_built_or_deleted_if_specified_with_clean:ai(6367,3,"Show_what_would_be_built_or_deleted_if_specified_with_clean_6367","Show what would be built (or deleted, if specified with '--clean')"),Option_build_must_be_the_first_command_line_argument:ai(6369,1,"Option_build_must_be_the_first_command_line_argument_6369","Option '--build' must be the first command line argument."),Options_0_and_1_cannot_be_combined:ai(6370,1,"Options_0_and_1_cannot_be_combined_6370","Options '{0}' and '{1}' cannot be combined."),Updating_unchanged_output_timestamps_of_project_0:ai(6371,3,"Updating_unchanged_output_timestamps_of_project_0_6371","Updating unchanged output timestamps of project '{0}'..."),Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed:ai(6372,3,"Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372","Project '{0}' is out of date because output of its dependency '{1}' has changed"),Updating_output_of_project_0:ai(6373,3,"Updating_output_of_project_0_6373","Updating output of project '{0}'..."),A_non_dry_build_would_update_timestamps_for_output_of_project_0:ai(6374,3,"A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374","A non-dry build would update timestamps for output of project '{0}'"),A_non_dry_build_would_update_output_of_project_0:ai(6375,3,"A_non_dry_build_would_update_output_of_project_0_6375","A non-dry build would update output of project '{0}'"),Cannot_update_output_of_project_0_because_there_was_error_reading_file_1:ai(6376,3,"Cannot_update_output_of_project_0_because_there_was_error_reading_file_1_6376","Cannot update output of project '{0}' because there was error reading file '{1}'"),Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1:ai(6377,1,"Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1_6377","Cannot write file '{0}' because it will overwrite '.tsbuildinfo' file generated by referenced project '{1}'"),Composite_projects_may_not_disable_incremental_compilation:ai(6379,1,"Composite_projects_may_not_disable_incremental_compilation_6379","Composite projects may not disable incremental compilation."),Specify_file_to_store_incremental_compilation_information:ai(6380,3,"Specify_file_to_store_incremental_compilation_information_6380","Specify file to store incremental compilation information"),Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2:ai(6381,3,"Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381","Project '{0}' is out of date because output for it was generated with version '{1}' that differs with current version '{2}'"),Skipping_build_of_project_0_because_its_dependency_1_was_not_built:ai(6382,3,"Skipping_build_of_project_0_because_its_dependency_1_was_not_built_6382","Skipping build of project '{0}' because its dependency '{1}' was not built"),Project_0_can_t_be_built_because_its_dependency_1_was_not_built:ai(6383,3,"Project_0_can_t_be_built_because_its_dependency_1_was_not_built_6383","Project '{0}' can't be built because its dependency '{1}' was not built"),Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it:ai(6384,3,"Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_di_6384","Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it."),_0_is_deprecated:ai(6385,2,"_0_is_deprecated_6385","'{0}' is deprecated.",void 0,void 0,!0),Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found:ai(6386,3,"Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_nativ_6386","Performance timings for '--diagnostics' or '--extendedDiagnostics' are not available in this session. A native implementation of the Web Performance API could not be found."),The_signature_0_of_1_is_deprecated:ai(6387,2,"The_signature_0_of_1_is_deprecated_6387","The signature '{0}' of '{1}' is deprecated.",void 0,void 0,!0),Project_0_is_being_forcibly_rebuilt:ai(6388,3,"Project_0_is_being_forcibly_rebuilt_6388","Project '{0}' is being forcibly rebuilt"),Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved:ai(6389,3,"Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved_6389","Reusing resolution of module '{0}' from '{1}' of old program, it was not resolved."),Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2:ai(6390,3,"Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved__6390","Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was successfully resolved to '{2}'."),Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3:ai(6391,3,"Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved__6391","Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was successfully resolved to '{2}' with Package ID '{3}'."),Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved:ai(6392,3,"Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved_6392","Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was not resolved."),Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3:ai(6393,3,"Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_6393","Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."),Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4:ai(6394,3,"Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_6394","Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."),Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved:ai(6395,3,"Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved_6395","Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3:ai(6396,3,"Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6396","Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."),Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4:ai(6397,3,"Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6397","Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."),Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved:ai(6398,3,"Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398","Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted:ai(6399,3,"Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399","Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"),Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files:ai(6400,3,"Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400","Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"),Project_0_is_out_of_date_because_there_was_error_reading_file_1:ai(6401,3,"Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401","Project '{0}' is out of date because there was error reading file '{1}'"),Resolving_in_0_mode_with_conditions_1:ai(6402,3,"Resolving_in_0_mode_with_conditions_1_6402","Resolving in {0} mode with conditions {1}."),Matched_0_condition_1:ai(6403,3,"Matched_0_condition_1_6403","Matched '{0}' condition '{1}'."),Using_0_subpath_1_with_target_2:ai(6404,3,"Using_0_subpath_1_with_target_2_6404","Using '{0}' subpath '{1}' with target '{2}'."),Saw_non_matching_condition_0:ai(6405,3,"Saw_non_matching_condition_0_6405","Saw non-matching condition '{0}'."),Project_0_is_out_of_date_because_buildinfo_file_1_indicates_there_is_change_in_compilerOptions:ai(6406,3,"Project_0_is_out_of_date_because_buildinfo_file_1_indicates_there_is_change_in_compilerOptions_6406","Project '{0}' is out of date because buildinfo file '{1}' indicates there is change in compilerOptions"),Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set:ai(6407,3,"Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noE_6407","Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set."),Use_the_package_json_exports_field_when_resolving_package_imports:ai(6408,3,"Use_the_package_json_exports_field_when_resolving_package_imports_6408","Use the package.json 'exports' field when resolving package imports."),Use_the_package_json_imports_field_when_resolving_imports:ai(6409,3,"Use_the_package_json_imports_field_when_resolving_imports_6409","Use the package.json 'imports' field when resolving imports."),Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports:ai(6410,3,"Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports_6410","Conditions to set in addition to the resolver-specific defaults when resolving imports."),true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false:ai(6411,3,"true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false_6411","`true` when 'moduleResolution' is 'node16', 'nodenext', or 'bundler'; otherwise `false`."),Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more:ai(6412,3,"Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_6412","Project '{0}' is out of date because buildinfo file '{1}' indicates that file '{2}' was root file of compilation but not any more."),Entering_conditional_exports:ai(6413,3,"Entering_conditional_exports_6413","Entering conditional exports."),Resolved_under_condition_0:ai(6414,3,"Resolved_under_condition_0_6414","Resolved under condition '{0}'."),Failed_to_resolve_under_condition_0:ai(6415,3,"Failed_to_resolve_under_condition_0_6415","Failed to resolve under condition '{0}'."),Exiting_conditional_exports:ai(6416,3,"Exiting_conditional_exports_6416","Exiting conditional exports."),Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0:ai(6417,3,"Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0_6417","Searching all ancestor node_modules directories for preferred extensions: {0}."),Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0:ai(6418,3,"Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418","Searching all ancestor node_modules directories for fallback extensions: {0}."),The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1:ai(6500,3,"The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500","The expected type comes from property '{0}' which is declared here on type '{1}'"),The_expected_type_comes_from_this_index_signature:ai(6501,3,"The_expected_type_comes_from_this_index_signature_6501","The expected type comes from this index signature."),The_expected_type_comes_from_the_return_type_of_this_signature:ai(6502,3,"The_expected_type_comes_from_the_return_type_of_this_signature_6502","The expected type comes from the return type of this signature."),Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing:ai(6503,3,"Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing_6503","Print names of files that are part of the compilation and then stop processing."),File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option:ai(6504,1,"File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option_6504","File '{0}' is a JavaScript file. Did you mean to enable the 'allowJs' option?"),Print_names_of_files_and_the_reason_they_are_part_of_the_compilation:ai(6505,3,"Print_names_of_files_and_the_reason_they_are_part_of_the_compilation_6505","Print names of files and the reason they are part of the compilation."),Consider_adding_a_declare_modifier_to_this_class:ai(6506,3,"Consider_adding_a_declare_modifier_to_this_class_6506","Consider adding a 'declare' modifier to this class."),Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these_files:ai(6600,3,"Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these__6600","Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files."),Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export:ai(6601,3,"Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export_6601","Allow 'import x from y' when a module doesn't have a default export."),Allow_accessing_UMD_globals_from_modules:ai(6602,3,"Allow_accessing_UMD_globals_from_modules_6602","Allow accessing UMD globals from modules."),Disable_error_reporting_for_unreachable_code:ai(6603,3,"Disable_error_reporting_for_unreachable_code_6603","Disable error reporting for unreachable code."),Disable_error_reporting_for_unused_labels:ai(6604,3,"Disable_error_reporting_for_unused_labels_6604","Disable error reporting for unused labels."),Ensure_use_strict_is_always_emitted:ai(6605,3,"Ensure_use_strict_is_always_emitted_6605","Ensure 'use strict' is always emitted."),Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it:ai(6606,3,"Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_wi_6606","Have recompiles in projects that use 'incremental' and 'watch' mode assume that changes within a file will only affect files directly depending on it."),Specify_the_base_directory_to_resolve_non_relative_module_names:ai(6607,3,"Specify_the_base_directory_to_resolve_non_relative_module_names_6607","Specify the base directory to resolve non-relative module names."),No_longer_supported_In_early_versions_manually_set_the_text_encoding_for_reading_files:ai(6608,3,"No_longer_supported_In_early_versions_manually_set_the_text_encoding_for_reading_files_6608","No longer supported. In early versions, manually set the text encoding for reading files."),Enable_error_reporting_in_type_checked_JavaScript_files:ai(6609,3,"Enable_error_reporting_in_type_checked_JavaScript_files_6609","Enable error reporting in type-checked JavaScript files."),Enable_constraints_that_allow_a_TypeScript_project_to_be_used_with_project_references:ai(6611,3,"Enable_constraints_that_allow_a_TypeScript_project_to_be_used_with_project_references_6611","Enable constraints that allow a TypeScript project to be used with project references."),Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project:ai(6612,3,"Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project_6612","Generate .d.ts files from TypeScript and JavaScript files in your project."),Specify_the_output_directory_for_generated_declaration_files:ai(6613,3,"Specify_the_output_directory_for_generated_declaration_files_6613","Specify the output directory for generated declaration files."),Create_sourcemaps_for_d_ts_files:ai(6614,3,"Create_sourcemaps_for_d_ts_files_6614","Create sourcemaps for d.ts files."),Output_compiler_performance_information_after_building:ai(6615,3,"Output_compiler_performance_information_after_building_6615","Output compiler performance information after building."),Disables_inference_for_type_acquisition_by_looking_at_filenames_in_a_project:ai(6616,3,"Disables_inference_for_type_acquisition_by_looking_at_filenames_in_a_project_6616","Disables inference for type acquisition by looking at filenames in a project."),Reduce_the_number_of_projects_loaded_automatically_by_TypeScript:ai(6617,3,"Reduce_the_number_of_projects_loaded_automatically_by_TypeScript_6617","Reduce the number of projects loaded automatically by TypeScript."),Remove_the_20mb_cap_on_total_source_code_size_for_JavaScript_files_in_the_TypeScript_language_server:ai(6618,3,"Remove_the_20mb_cap_on_total_source_code_size_for_JavaScript_files_in_the_TypeScript_language_server_6618","Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server."),Opt_a_project_out_of_multi_project_reference_checking_when_editing:ai(6619,3,"Opt_a_project_out_of_multi_project_reference_checking_when_editing_6619","Opt a project out of multi-project reference checking when editing."),Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects:ai(6620,3,"Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects_6620","Disable preferring source files instead of declaration files when referencing composite projects."),Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration:ai(6621,3,"Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration_6621","Emit more compliant, but verbose and less performant JavaScript for iteration."),Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files:ai(6622,3,"Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6622","Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files."),Only_output_d_ts_files_and_not_JavaScript_files:ai(6623,3,"Only_output_d_ts_files_and_not_JavaScript_files_6623","Only output d.ts files and not JavaScript files."),Emit_design_type_metadata_for_decorated_declarations_in_source_files:ai(6624,3,"Emit_design_type_metadata_for_decorated_declarations_in_source_files_6624","Emit design-type metadata for decorated declarations in source files."),Disable_the_type_acquisition_for_JavaScript_projects:ai(6625,3,"Disable_the_type_acquisition_for_JavaScript_projects_6625","Disable the type acquisition for JavaScript projects"),Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility:ai(6626,3,"Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheti_6626","Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility."),Filters_results_from_the_include_option:ai(6627,3,"Filters_results_from_the_include_option_6627","Filters results from the `include` option."),Remove_a_list_of_directories_from_the_watch_process:ai(6628,3,"Remove_a_list_of_directories_from_the_watch_process_6628","Remove a list of directories from the watch process."),Remove_a_list_of_files_from_the_watch_mode_s_processing:ai(6629,3,"Remove_a_list_of_files_from_the_watch_mode_s_processing_6629","Remove a list of files from the watch mode's processing."),Enable_experimental_support_for_legacy_experimental_decorators:ai(6630,3,"Enable_experimental_support_for_legacy_experimental_decorators_6630","Enable experimental support for legacy experimental decorators."),Print_files_read_during_the_compilation_including_why_it_was_included:ai(6631,3,"Print_files_read_during_the_compilation_including_why_it_was_included_6631","Print files read during the compilation including why it was included."),Output_more_detailed_compiler_performance_information_after_building:ai(6632,3,"Output_more_detailed_compiler_performance_information_after_building_6632","Output more detailed compiler performance information after building."),Specify_one_or_more_path_or_node_module_references_to_base_configuration_files_from_which_settings_are_inherited:ai(6633,3,"Specify_one_or_more_path_or_node_module_references_to_base_configuration_files_from_which_settings_a_6633","Specify one or more path or node module references to base configuration files from which settings are inherited."),Specify_what_approach_the_watcher_should_use_if_the_system_runs_out_of_native_file_watchers:ai(6634,3,"Specify_what_approach_the_watcher_should_use_if_the_system_runs_out_of_native_file_watchers_6634","Specify what approach the watcher should use if the system runs out of native file watchers."),Include_a_list_of_files_This_does_not_support_glob_patterns_as_opposed_to_include:ai(6635,3,"Include_a_list_of_files_This_does_not_support_glob_patterns_as_opposed_to_include_6635","Include a list of files. This does not support glob patterns, as opposed to `include`."),Build_all_projects_including_those_that_appear_to_be_up_to_date:ai(6636,3,"Build_all_projects_including_those_that_appear_to_be_up_to_date_6636","Build all projects, including those that appear to be up to date."),Ensure_that_casing_is_correct_in_imports:ai(6637,3,"Ensure_that_casing_is_correct_in_imports_6637","Ensure that casing is correct in imports."),Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging:ai(6638,3,"Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging_6638","Emit a v8 CPU profile of the compiler run for debugging."),Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file:ai(6639,3,"Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file_6639","Allow importing helper functions from tslib once per project, instead of including them per-file."),Specify_a_list_of_glob_patterns_that_match_files_to_be_included_in_compilation:ai(6641,3,"Specify_a_list_of_glob_patterns_that_match_files_to_be_included_in_compilation_6641","Specify a list of glob patterns that match files to be included in compilation."),Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects:ai(6642,3,"Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642","Save .tsbuildinfo files to allow for incremental compilation of projects."),Include_sourcemap_files_inside_the_emitted_JavaScript:ai(6643,3,"Include_sourcemap_files_inside_the_emitted_JavaScript_6643","Include sourcemap files inside the emitted JavaScript."),Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript:ai(6644,3,"Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript_6644","Include source code in the sourcemaps inside the emitted JavaScript."),Ensure_that_each_file_can_be_safely_transpiled_without_relying_on_other_imports:ai(6645,3,"Ensure_that_each_file_can_be_safely_transpiled_without_relying_on_other_imports_6645","Ensure that each file can be safely transpiled without relying on other imports."),Specify_what_JSX_code_is_generated:ai(6646,3,"Specify_what_JSX_code_is_generated_6646","Specify what JSX code is generated."),Specify_the_JSX_factory_function_used_when_targeting_React_JSX_emit_e_g_React_createElement_or_h:ai(6647,3,"Specify_the_JSX_factory_function_used_when_targeting_React_JSX_emit_e_g_React_createElement_or_h_6647","Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'."),Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment:ai(6648,3,"Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragme_6648","Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'."),Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk:ai(6649,3,"Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Ast_6649","Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'."),Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option:ai(6650,3,"Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650","Make keyof only return strings instead of string, numbers or symbols. Legacy option."),Specify_a_set_of_bundled_library_declaration_files_that_describe_the_target_runtime_environment:ai(6651,3,"Specify_a_set_of_bundled_library_declaration_files_that_describe_the_target_runtime_environment_6651","Specify a set of bundled library declaration files that describe the target runtime environment."),Print_the_names_of_emitted_files_after_a_compilation:ai(6652,3,"Print_the_names_of_emitted_files_after_a_compilation_6652","Print the names of emitted files after a compilation."),Print_all_of_the_files_read_during_the_compilation:ai(6653,3,"Print_all_of_the_files_read_during_the_compilation_6653","Print all of the files read during the compilation."),Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit:ai(6654,3,"Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit_6654","Set the language of the messaging from TypeScript. This does not affect emit."),Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations:ai(6655,3,"Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6655","Specify the location where debugger should locate map files instead of generated locations."),Specify_the_maximum_folder_depth_used_for_checking_JavaScript_files_from_node_modules_Only_applicable_with_allowJs:ai(6656,3,"Specify_the_maximum_folder_depth_used_for_checking_JavaScript_files_from_node_modules_Only_applicabl_6656","Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'."),Specify_what_module_code_is_generated:ai(6657,3,"Specify_what_module_code_is_generated_6657","Specify what module code is generated."),Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier:ai(6658,3,"Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier_6658","Specify how TypeScript looks up a file from a given module specifier."),Set_the_newline_character_for_emitting_files:ai(6659,3,"Set_the_newline_character_for_emitting_files_6659","Set the newline character for emitting files."),Disable_emitting_files_from_a_compilation:ai(6660,3,"Disable_emitting_files_from_a_compilation_6660","Disable emitting files from a compilation."),Disable_generating_custom_helper_functions_like_extends_in_compiled_output:ai(6661,3,"Disable_generating_custom_helper_functions_like_extends_in_compiled_output_6661","Disable generating custom helper functions like '__extends' in compiled output."),Disable_emitting_files_if_any_type_checking_errors_are_reported:ai(6662,3,"Disable_emitting_files_if_any_type_checking_errors_are_reported_6662","Disable emitting files if any type checking errors are reported."),Disable_truncating_types_in_error_messages:ai(6663,3,"Disable_truncating_types_in_error_messages_6663","Disable truncating types in error messages."),Enable_error_reporting_for_fallthrough_cases_in_switch_statements:ai(6664,3,"Enable_error_reporting_for_fallthrough_cases_in_switch_statements_6664","Enable error reporting for fallthrough cases in switch statements."),Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type:ai(6665,3,"Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type_6665","Enable error reporting for expressions and declarations with an implied 'any' type."),Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier:ai(6666,3,"Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier_6666","Ensure overriding members in derived classes are marked with an override modifier."),Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function:ai(6667,3,"Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function_6667","Enable error reporting for codepaths that do not explicitly return in a function."),Enable_error_reporting_when_this_is_given_the_type_any:ai(6668,3,"Enable_error_reporting_when_this_is_given_the_type_any_6668","Enable error reporting when 'this' is given the type 'any'."),Disable_adding_use_strict_directives_in_emitted_JavaScript_files:ai(6669,3,"Disable_adding_use_strict_directives_in_emitted_JavaScript_files_6669","Disable adding 'use strict' directives in emitted JavaScript files."),Disable_including_any_library_files_including_the_default_lib_d_ts:ai(6670,3,"Disable_including_any_library_files_including_the_default_lib_d_ts_6670","Disable including any library files, including the default lib.d.ts."),Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type:ai(6671,3,"Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type_6671","Enforces using indexed accessors for keys declared using an indexed type."),Disallow_import_s_require_s_or_reference_s_from_expanding_the_number_of_files_TypeScript_should_add_to_a_project:ai(6672,3,"Disallow_import_s_require_s_or_reference_s_from_expanding_the_number_of_files_TypeScript_should_add__6672","Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project."),Disable_strict_checking_of_generic_signatures_in_function_types:ai(6673,3,"Disable_strict_checking_of_generic_signatures_in_function_types_6673","Disable strict checking of generic signatures in function types."),Add_undefined_to_a_type_when_accessed_using_an_index:ai(6674,3,"Add_undefined_to_a_type_when_accessed_using_an_index_6674","Add 'undefined' to a type when accessed using an index."),Enable_error_reporting_when_local_variables_aren_t_read:ai(6675,3,"Enable_error_reporting_when_local_variables_aren_t_read_6675","Enable error reporting when local variables aren't read."),Raise_an_error_when_a_function_parameter_isn_t_read:ai(6676,3,"Raise_an_error_when_a_function_parameter_isn_t_read_6676","Raise an error when a function parameter isn't read."),Deprecated_setting_Use_outFile_instead:ai(6677,3,"Deprecated_setting_Use_outFile_instead_6677","Deprecated setting. Use 'outFile' instead."),Specify_an_output_folder_for_all_emitted_files:ai(6678,3,"Specify_an_output_folder_for_all_emitted_files_6678","Specify an output folder for all emitted files."),Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designates_a_file_that_bundles_all_d_ts_output:ai(6679,3,"Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designa_6679","Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output."),Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations:ai(6680,3,"Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations_6680","Specify a set of entries that re-map imports to additional lookup locations."),Specify_a_list_of_language_service_plugins_to_include:ai(6681,3,"Specify_a_list_of_language_service_plugins_to_include_6681","Specify a list of language service plugins to include."),Disable_erasing_const_enum_declarations_in_generated_code:ai(6682,3,"Disable_erasing_const_enum_declarations_in_generated_code_6682","Disable erasing 'const enum' declarations in generated code."),Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node:ai(6683,3,"Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node_6683","Disable resolving symlinks to their realpath. This correlates to the same flag in node."),Disable_wiping_the_console_in_watch_mode:ai(6684,3,"Disable_wiping_the_console_in_watch_mode_6684","Disable wiping the console in watch mode."),Enable_color_and_formatting_in_TypeScript_s_output_to_make_compiler_errors_easier_to_read:ai(6685,3,"Enable_color_and_formatting_in_TypeScript_s_output_to_make_compiler_errors_easier_to_read_6685","Enable color and formatting in TypeScript's output to make compiler errors easier to read."),Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit:ai(6686,3,"Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit_6686","Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit."),Specify_an_array_of_objects_that_specify_paths_for_projects_Used_in_project_references:ai(6687,3,"Specify_an_array_of_objects_that_specify_paths_for_projects_Used_in_project_references_6687","Specify an array of objects that specify paths for projects. Used in project references."),Disable_emitting_comments:ai(6688,3,"Disable_emitting_comments_6688","Disable emitting comments."),Enable_importing_json_files:ai(6689,3,"Enable_importing_json_files_6689","Enable importing .json files."),Specify_the_root_folder_within_your_source_files:ai(6690,3,"Specify_the_root_folder_within_your_source_files_6690","Specify the root folder within your source files."),Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules:ai(6691,3,"Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules_6691","Allow multiple folders to be treated as one when resolving modules."),Skip_type_checking_d_ts_files_that_are_included_with_TypeScript:ai(6692,3,"Skip_type_checking_d_ts_files_that_are_included_with_TypeScript_6692","Skip type checking .d.ts files that are included with TypeScript."),Skip_type_checking_all_d_ts_files:ai(6693,3,"Skip_type_checking_all_d_ts_files_6693","Skip type checking all .d.ts files."),Create_source_map_files_for_emitted_JavaScript_files:ai(6694,3,"Create_source_map_files_for_emitted_JavaScript_files_6694","Create source map files for emitted JavaScript files."),Specify_the_root_path_for_debuggers_to_find_the_reference_source_code:ai(6695,3,"Specify_the_root_path_for_debuggers_to_find_the_reference_source_code_6695","Specify the root path for debuggers to find the reference source code."),Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function:ai(6697,3,"Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function_6697","Check that the arguments for 'bind', 'call', and 'apply' methods match the original function."),When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible:ai(6698,3,"When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible_6698","When assigning functions, check to ensure parameters and the return values are subtype-compatible."),When_type_checking_take_into_account_null_and_undefined:ai(6699,3,"When_type_checking_take_into_account_null_and_undefined_6699","When type checking, take into account 'null' and 'undefined'."),Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor:ai(6700,3,"Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor_6700","Check for class properties that are declared but not set in the constructor."),Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments:ai(6701,3,"Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments_6701","Disable emitting declarations that have '@internal' in their JSDoc comments."),Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals:ai(6702,3,"Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals_6702","Disable reporting of excess property errors during the creation of object literals."),Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures:ai(6703,3,"Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures_6703","Suppress 'noImplicitAny' errors when indexing objects that lack index signatures."),Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_support_recursive_watching_natively:ai(6704,3,"Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_supp_6704","Synchronously call callbacks and update the state of directory watchers on platforms that don`t support recursive watching natively."),Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations:ai(6705,3,"Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declaratio_6705","Set the JavaScript language version for emitted JavaScript and include compatible library declarations."),Log_paths_used_during_the_moduleResolution_process:ai(6706,3,"Log_paths_used_during_the_moduleResolution_process_6706","Log paths used during the 'moduleResolution' process."),Specify_the_path_to_tsbuildinfo_incremental_compilation_file:ai(6707,3,"Specify_the_path_to_tsbuildinfo_incremental_compilation_file_6707","Specify the path to .tsbuildinfo incremental compilation file."),Specify_options_for_automatic_acquisition_of_declaration_files:ai(6709,3,"Specify_options_for_automatic_acquisition_of_declaration_files_6709","Specify options for automatic acquisition of declaration files."),Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types:ai(6710,3,"Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types_6710","Specify multiple folders that act like './node_modules/@types'."),Specify_type_package_names_to_be_included_without_being_referenced_in_a_source_file:ai(6711,3,"Specify_type_package_names_to_be_included_without_being_referenced_in_a_source_file_6711","Specify type package names to be included without being referenced in a source file."),Emit_ECMAScript_standard_compliant_class_fields:ai(6712,3,"Emit_ECMAScript_standard_compliant_class_fields_6712","Emit ECMAScript-standard-compliant class fields."),Enable_verbose_logging:ai(6713,3,"Enable_verbose_logging_6713","Enable verbose logging."),Specify_how_directories_are_watched_on_systems_that_lack_recursive_file_watching_functionality:ai(6714,3,"Specify_how_directories_are_watched_on_systems_that_lack_recursive_file_watching_functionality_6714","Specify how directories are watched on systems that lack recursive file-watching functionality."),Specify_how_the_TypeScript_watch_mode_works:ai(6715,3,"Specify_how_the_TypeScript_watch_mode_works_6715","Specify how the TypeScript watch mode works."),Require_undeclared_properties_from_index_signatures_to_use_element_accesses:ai(6717,3,"Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717","Require undeclared properties from index signatures to use element accesses."),Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types:ai(6718,3,"Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718","Specify emit/checking behavior for imports that are only used for types."),Default_catch_clause_variables_as_unknown_instead_of_any:ai(6803,3,"Default_catch_clause_variables_as_unknown_instead_of_any_6803","Default catch clause variables as 'unknown' instead of 'any'."),Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting:ai(6804,3,"Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804","Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),one_of_Colon:ai(6900,3,"one_of_Colon_6900","one of:"),one_or_more_Colon:ai(6901,3,"one_or_more_Colon_6901","one or more:"),type_Colon:ai(6902,3,"type_Colon_6902","type:"),default_Colon:ai(6903,3,"default_Colon_6903","default:"),module_system_or_esModuleInterop:ai(6904,3,"module_system_or_esModuleInterop_6904",'module === "system" or esModuleInterop'),false_unless_strict_is_set:ai(6905,3,"false_unless_strict_is_set_6905","`false`, unless `strict` is set"),false_unless_composite_is_set:ai(6906,3,"false_unless_composite_is_set_6906","`false`, unless `composite` is set"),node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified:ai(6907,3,"node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified_6907",'`["node_modules", "bower_components", "jspm_packages"]`, plus the value of `outDir` if one is specified.'),if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk:ai(6908,3,"if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk_6908",'`[]` if `files` is specified, otherwise `["**/*"]`'),true_if_composite_false_otherwise:ai(6909,3,"true_if_composite_false_otherwise_6909","`true` if `composite`, `false` otherwise"),module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node:ai(69010,3,"module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node_69010","module === `AMD` or `UMD` or `System` or `ES6`, then `Classic`, Otherwise `Node`"),Computed_from_the_list_of_input_files:ai(6911,3,"Computed_from_the_list_of_input_files_6911","Computed from the list of input files"),Platform_specific:ai(6912,3,"Platform_specific_6912","Platform specific"),You_can_learn_about_all_of_the_compiler_options_at_0:ai(6913,3,"You_can_learn_about_all_of_the_compiler_options_at_0_6913","You can learn about all of the compiler options at {0}"),Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon:ai(6914,3,"Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_conf_6914","Including --watch, -w will start watching the current project for the file changes. Once set, you can config watch mode with:"),Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0:ai(6915,3,"Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915","Using --build, -b will make tsc behave more like a build orchestrator than a compiler. This is used to trigger building composite projects which you can learn more about at {0}"),COMMON_COMMANDS:ai(6916,3,"COMMON_COMMANDS_6916","COMMON COMMANDS"),ALL_COMPILER_OPTIONS:ai(6917,3,"ALL_COMPILER_OPTIONS_6917","ALL COMPILER OPTIONS"),WATCH_OPTIONS:ai(6918,3,"WATCH_OPTIONS_6918","WATCH OPTIONS"),BUILD_OPTIONS:ai(6919,3,"BUILD_OPTIONS_6919","BUILD OPTIONS"),COMMON_COMPILER_OPTIONS:ai(6920,3,"COMMON_COMPILER_OPTIONS_6920","COMMON COMPILER OPTIONS"),COMMAND_LINE_FLAGS:ai(6921,3,"COMMAND_LINE_FLAGS_6921","COMMAND LINE FLAGS"),tsc_Colon_The_TypeScript_Compiler:ai(6922,3,"tsc_Colon_The_TypeScript_Compiler_6922","tsc: The TypeScript Compiler"),Compiles_the_current_project_tsconfig_json_in_the_working_directory:ai(6923,3,"Compiles_the_current_project_tsconfig_json_in_the_working_directory_6923","Compiles the current project (tsconfig.json in the working directory.)"),Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options:ai(6924,3,"Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options_6924","Ignoring tsconfig.json, compiles the specified files with default compiler options."),Build_a_composite_project_in_the_working_directory:ai(6925,3,"Build_a_composite_project_in_the_working_directory_6925","Build a composite project in the working directory."),Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory:ai(6926,3,"Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory_6926","Creates a tsconfig.json with the recommended settings in the working directory."),Compiles_the_TypeScript_project_located_at_the_specified_path:ai(6927,3,"Compiles_the_TypeScript_project_located_at_the_specified_path_6927","Compiles the TypeScript project located at the specified path."),An_expanded_version_of_this_information_showing_all_possible_compiler_options:ai(6928,3,"An_expanded_version_of_this_information_showing_all_possible_compiler_options_6928","An expanded version of this information, showing all possible compiler options"),Compiles_the_current_project_with_additional_settings:ai(6929,3,"Compiles_the_current_project_with_additional_settings_6929","Compiles the current project, with additional settings."),true_for_ES2022_and_above_including_ESNext:ai(6930,3,"true_for_ES2022_and_above_including_ESNext_6930","`true` for ES2022 and above, including ESNext."),List_of_file_name_suffixes_to_search_when_resolving_a_module:ai(6931,1,"List_of_file_name_suffixes_to_search_when_resolving_a_module_6931","List of file name suffixes to search when resolving a module."),Variable_0_implicitly_has_an_1_type:ai(7005,1,"Variable_0_implicitly_has_an_1_type_7005","Variable '{0}' implicitly has an '{1}' type."),Parameter_0_implicitly_has_an_1_type:ai(7006,1,"Parameter_0_implicitly_has_an_1_type_7006","Parameter '{0}' implicitly has an '{1}' type."),Member_0_implicitly_has_an_1_type:ai(7008,1,"Member_0_implicitly_has_an_1_type_7008","Member '{0}' implicitly has an '{1}' type."),new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type:ai(7009,1,"new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009","'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."),_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type:ai(7010,1,"_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010","'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."),Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type:ai(7011,1,"Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011","Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."),This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation:ai(7012,1,"This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation_7012","This overload implicitly returns the type '{0}' because it lacks a return type annotation."),Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type:ai(7013,1,"Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013","Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."),Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type:ai(7014,1,"Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7014","Function type, which lacks return-type annotation, implicitly has an '{0}' return type."),Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number:ai(7015,1,"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015","Element implicitly has an 'any' type because index expression is not of type 'number'."),Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type:ai(7016,1,"Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type_7016","Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type."),Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature:ai(7017,1,"Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017","Element implicitly has an 'any' type because type '{0}' has no index signature."),Object_literal_s_property_0_implicitly_has_an_1_type:ai(7018,1,"Object_literal_s_property_0_implicitly_has_an_1_type_7018","Object literal's property '{0}' implicitly has an '{1}' type."),Rest_parameter_0_implicitly_has_an_any_type:ai(7019,1,"Rest_parameter_0_implicitly_has_an_any_type_7019","Rest parameter '{0}' implicitly has an 'any[]' type."),Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type:ai(7020,1,"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020","Call signature, which lacks return-type annotation, implicitly has an 'any' return type."),_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer:ai(7022,1,"_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or__7022","'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer."),_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions:ai(7023,1,"_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023","'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions."),Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions:ai(7024,1,"Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024","Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions."),Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation:ai(7025,1,"Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_retu_7025","Generator implicitly has yield type '{0}' because it does not yield any values. Consider supplying a return type annotation."),JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists:ai(7026,1,"JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026","JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists."),Unreachable_code_detected:ai(7027,1,"Unreachable_code_detected_7027","Unreachable code detected.",!0),Unused_label:ai(7028,1,"Unused_label_7028","Unused label.",!0),Fallthrough_case_in_switch:ai(7029,1,"Fallthrough_case_in_switch_7029","Fallthrough case in switch."),Not_all_code_paths_return_a_value:ai(7030,1,"Not_all_code_paths_return_a_value_7030","Not all code paths return a value."),Binding_element_0_implicitly_has_an_1_type:ai(7031,1,"Binding_element_0_implicitly_has_an_1_type_7031","Binding element '{0}' implicitly has an '{1}' type."),Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation:ai(7032,1,"Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation_7032","Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation."),Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation:ai(7033,1,"Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation_7033","Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation."),Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined:ai(7034,1,"Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined_7034","Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined."),Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0:ai(7035,1,"Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare__7035","Try `npm i --save-dev @types/{1}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`"),Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0:ai(7036,1,"Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036","Dynamic import's specifier must be of type 'string', but here has type '{0}'."),Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for_all_imports_Implies_allowSyntheticDefaultImports:ai(7037,3,"Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037","Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'."),Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead:ai(7038,3,"Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cau_7038","Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead."),Mapped_object_type_implicitly_has_an_any_template_type:ai(7039,1,"Mapped_object_type_implicitly_has_an_any_template_type_7039","Mapped object type implicitly has an 'any' template type."),If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1:ai(7040,1,"If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_S_7040","If the '{0}' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/{1}'"),The_containing_arrow_function_captures_the_global_value_of_this:ai(7041,1,"The_containing_arrow_function_captures_the_global_value_of_this_7041","The containing arrow function captures the global value of 'this'."),Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used:ai(7042,1,"Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used_7042","Module '{0}' was resolved to '{1}', but '--resolveJsonModule' is not used."),Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage:ai(7043,2,"Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7043","Variable '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."),Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage:ai(7044,2,"Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7044","Parameter '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."),Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage:ai(7045,2,"Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7045","Member '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."),Variable_0_implicitly_has_type_1_in_some_locations_but_a_better_type_may_be_inferred_from_usage:ai(7046,2,"Variable_0_implicitly_has_type_1_in_some_locations_but_a_better_type_may_be_inferred_from_usage_7046","Variable '{0}' implicitly has type '{1}' in some locations, but a better type may be inferred from usage."),Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage:ai(7047,2,"Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage_7047","Rest parameter '{0}' implicitly has an 'any[]' type, but a better type may be inferred from usage."),Property_0_implicitly_has_type_any_but_a_better_type_for_its_get_accessor_may_be_inferred_from_usage:ai(7048,2,"Property_0_implicitly_has_type_any_but_a_better_type_for_its_get_accessor_may_be_inferred_from_usage_7048","Property '{0}' implicitly has type 'any', but a better type for its get accessor may be inferred from usage."),Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage:ai(7049,2,"Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage_7049","Property '{0}' implicitly has type 'any', but a better type for its set accessor may be inferred from usage."),_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage:ai(7050,2,"_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050","'{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage."),Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1:ai(7051,1,"Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1_7051","Parameter has a name but no type. Did you mean '{0}: {1}'?"),Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1:ai(7052,1,"Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1_7052","Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}'?"),Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1:ai(7053,1,"Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1_7053","Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'."),No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1:ai(7054,1,"No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1_7054","No index signature with a parameter of type '{0}' was found on type '{1}'."),_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type:ai(7055,1,"_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055","'{0}', which lacks return-type annotation, implicitly has an '{1}' yield type."),The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_type_annotation_is_needed:ai(7056,1,"The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_ty_7056","The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."),yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation:ai(7057,1,"yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_t_7057","'yield' expression implicitly results in an 'any' type because its containing generator lacks a return-type annotation."),If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1:ai(7058,1,"If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_decl_7058","If the '{0}' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module '{1}';`"),This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead:ai(7059,1,"This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059","This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint:ai(7060,1,"This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060","This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."),A_mapped_type_may_not_declare_properties_or_methods:ai(7061,1,"A_mapped_type_may_not_declare_properties_or_methods_7061","A mapped type may not declare properties or methods."),You_cannot_rename_this_element:ai(8e3,1,"You_cannot_rename_this_element_8000","You cannot rename this element."),You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library:ai(8001,1,"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001","You cannot rename elements that are defined in the standard TypeScript library."),import_can_only_be_used_in_TypeScript_files:ai(8002,1,"import_can_only_be_used_in_TypeScript_files_8002","'import ... =' can only be used in TypeScript files."),export_can_only_be_used_in_TypeScript_files:ai(8003,1,"export_can_only_be_used_in_TypeScript_files_8003","'export =' can only be used in TypeScript files."),Type_parameter_declarations_can_only_be_used_in_TypeScript_files:ai(8004,1,"Type_parameter_declarations_can_only_be_used_in_TypeScript_files_8004","Type parameter declarations can only be used in TypeScript files."),implements_clauses_can_only_be_used_in_TypeScript_files:ai(8005,1,"implements_clauses_can_only_be_used_in_TypeScript_files_8005","'implements' clauses can only be used in TypeScript files."),_0_declarations_can_only_be_used_in_TypeScript_files:ai(8006,1,"_0_declarations_can_only_be_used_in_TypeScript_files_8006","'{0}' declarations can only be used in TypeScript files."),Type_aliases_can_only_be_used_in_TypeScript_files:ai(8008,1,"Type_aliases_can_only_be_used_in_TypeScript_files_8008","Type aliases can only be used in TypeScript files."),The_0_modifier_can_only_be_used_in_TypeScript_files:ai(8009,1,"The_0_modifier_can_only_be_used_in_TypeScript_files_8009","The '{0}' modifier can only be used in TypeScript files."),Type_annotations_can_only_be_used_in_TypeScript_files:ai(8010,1,"Type_annotations_can_only_be_used_in_TypeScript_files_8010","Type annotations can only be used in TypeScript files."),Type_arguments_can_only_be_used_in_TypeScript_files:ai(8011,1,"Type_arguments_can_only_be_used_in_TypeScript_files_8011","Type arguments can only be used in TypeScript files."),Parameter_modifiers_can_only_be_used_in_TypeScript_files:ai(8012,1,"Parameter_modifiers_can_only_be_used_in_TypeScript_files_8012","Parameter modifiers can only be used in TypeScript files."),Non_null_assertions_can_only_be_used_in_TypeScript_files:ai(8013,1,"Non_null_assertions_can_only_be_used_in_TypeScript_files_8013","Non-null assertions can only be used in TypeScript files."),Type_assertion_expressions_can_only_be_used_in_TypeScript_files:ai(8016,1,"Type_assertion_expressions_can_only_be_used_in_TypeScript_files_8016","Type assertion expressions can only be used in TypeScript files."),Signature_declarations_can_only_be_used_in_TypeScript_files:ai(8017,1,"Signature_declarations_can_only_be_used_in_TypeScript_files_8017","Signature declarations can only be used in TypeScript files."),Report_errors_in_js_files:ai(8019,3,"Report_errors_in_js_files_8019","Report errors in .js files."),JSDoc_types_can_only_be_used_inside_documentation_comments:ai(8020,1,"JSDoc_types_can_only_be_used_inside_documentation_comments_8020","JSDoc types can only be used inside documentation comments."),JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags:ai(8021,1,"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021","JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags."),JSDoc_0_is_not_attached_to_a_class:ai(8022,1,"JSDoc_0_is_not_attached_to_a_class_8022","JSDoc '@{0}' is not attached to a class."),JSDoc_0_1_does_not_match_the_extends_2_clause:ai(8023,1,"JSDoc_0_1_does_not_match_the_extends_2_clause_8023","JSDoc '@{0} {1}' does not match the 'extends {2}' clause."),JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name:ai(8024,1,"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024","JSDoc '@param' tag has name '{0}', but there is no parameter with that name."),Class_declarations_cannot_have_more_than_one_augments_or_extends_tag:ai(8025,1,"Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025","Class declarations cannot have more than one '@augments' or '@extends' tag."),Expected_0_type_arguments_provide_these_with_an_extends_tag:ai(8026,1,"Expected_0_type_arguments_provide_these_with_an_extends_tag_8026","Expected {0} type arguments; provide these with an '@extends' tag."),Expected_0_1_type_arguments_provide_these_with_an_extends_tag:ai(8027,1,"Expected_0_1_type_arguments_provide_these_with_an_extends_tag_8027","Expected {0}-{1} type arguments; provide these with an '@extends' tag."),JSDoc_may_only_appear_in_the_last_parameter_of_a_signature:ai(8028,1,"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028","JSDoc '...' may only appear in the last parameter of a signature."),JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type:ai(8029,1,"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029","JSDoc '@param' tag has name '{0}', but there is no parameter with that name. It would match 'arguments' if it had an array type."),The_type_of_a_function_declaration_must_match_the_function_s_signature:ai(8030,1,"The_type_of_a_function_declaration_must_match_the_function_s_signature_8030","The type of a function declaration must match the function's signature."),You_cannot_rename_a_module_via_a_global_import:ai(8031,1,"You_cannot_rename_a_module_via_a_global_import_8031","You cannot rename a module via a global import."),Qualified_name_0_is_not_allowed_without_a_leading_param_object_1:ai(8032,1,"Qualified_name_0_is_not_allowed_without_a_leading_param_object_1_8032","Qualified name '{0}' is not allowed without a leading '@param {object} {1}'."),A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags:ai(8033,1,"A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags_8033","A JSDoc '@typedef' comment may not contain multiple '@type' tags."),The_tag_was_first_specified_here:ai(8034,1,"The_tag_was_first_specified_here_8034","The tag was first specified here."),You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder:ai(8035,1,"You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035","You cannot rename elements that are defined in a 'node_modules' folder."),You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder:ai(8036,1,"You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036","You cannot rename elements that are defined in another 'node_modules' folder."),Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files:ai(8037,1,"Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037","Type satisfaction expressions can only be used in TypeScript files."),Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export:ai(8038,1,"Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export_8038","Decorators may not appear after 'export' or 'export default' if they also appear before 'export'."),A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag:ai(8039,1,"A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag_8039","A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag"),Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit:ai(9005,1,"Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005","Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit:ai(9006,1,"Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006","Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),JSX_attributes_must_only_be_assigned_a_non_empty_expression:ai(17e3,1,"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000","JSX attributes must only be assigned a non-empty 'expression'."),JSX_elements_cannot_have_multiple_attributes_with_the_same_name:ai(17001,1,"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001","JSX elements cannot have multiple attributes with the same name."),Expected_corresponding_JSX_closing_tag_for_0:ai(17002,1,"Expected_corresponding_JSX_closing_tag_for_0_17002","Expected corresponding JSX closing tag for '{0}'."),Cannot_use_JSX_unless_the_jsx_flag_is_provided:ai(17004,1,"Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004","Cannot use JSX unless the '--jsx' flag is provided."),A_constructor_cannot_contain_a_super_call_when_its_class_extends_null:ai(17005,1,"A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005","A constructor cannot contain a 'super' call when its class extends 'null'."),An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses:ai(17006,1,"An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006","An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."),A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses:ai(17007,1,"A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007","A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."),JSX_element_0_has_no_corresponding_closing_tag:ai(17008,1,"JSX_element_0_has_no_corresponding_closing_tag_17008","JSX element '{0}' has no corresponding closing tag."),super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class:ai(17009,1,"super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009","'super' must be called before accessing 'this' in the constructor of a derived class."),Unknown_type_acquisition_option_0:ai(17010,1,"Unknown_type_acquisition_option_0_17010","Unknown type acquisition option '{0}'."),super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class:ai(17011,1,"super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011","'super' must be called before accessing a property of 'super' in the constructor of a derived class."),_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2:ai(17012,1,"_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012","'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?"),Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor:ai(17013,1,"Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013","Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor."),JSX_fragment_has_no_corresponding_closing_tag:ai(17014,1,"JSX_fragment_has_no_corresponding_closing_tag_17014","JSX fragment has no corresponding closing tag."),Expected_corresponding_closing_tag_for_JSX_fragment:ai(17015,1,"Expected_corresponding_closing_tag_for_JSX_fragment_17015","Expected corresponding closing tag for JSX fragment."),The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option:ai(17016,1,"The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_com_17016","The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option."),An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments:ai(17017,1,"An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments_17017","An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments."),Unknown_type_acquisition_option_0_Did_you_mean_1:ai(17018,1,"Unknown_type_acquisition_option_0_Did_you_mean_1_17018","Unknown type acquisition option '{0}'. Did you mean '{1}'?"),_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1:ai(17019,1,"_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17019","'{0}' at the end of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1:ai(17020,1,"_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17020","'{0}' at the start of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),Circularity_detected_while_resolving_configuration_Colon_0:ai(18e3,1,"Circularity_detected_while_resolving_configuration_Colon_0_18000","Circularity detected while resolving configuration: {0}"),The_files_list_in_config_file_0_is_empty:ai(18002,1,"The_files_list_in_config_file_0_is_empty_18002","The 'files' list in config file '{0}' is empty."),No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2:ai(18003,1,"No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003","No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."),File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module:ai(80001,2,"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001","File is a CommonJS module; it may be converted to an ES module."),This_constructor_function_may_be_converted_to_a_class_declaration:ai(80002,2,"This_constructor_function_may_be_converted_to_a_class_declaration_80002","This constructor function may be converted to a class declaration."),Import_may_be_converted_to_a_default_import:ai(80003,2,"Import_may_be_converted_to_a_default_import_80003","Import may be converted to a default import."),JSDoc_types_may_be_moved_to_TypeScript_types:ai(80004,2,"JSDoc_types_may_be_moved_to_TypeScript_types_80004","JSDoc types may be moved to TypeScript types."),require_call_may_be_converted_to_an_import:ai(80005,2,"require_call_may_be_converted_to_an_import_80005","'require' call may be converted to an import."),This_may_be_converted_to_an_async_function:ai(80006,2,"This_may_be_converted_to_an_async_function_80006","This may be converted to an async function."),await_has_no_effect_on_the_type_of_this_expression:ai(80007,2,"await_has_no_effect_on_the_type_of_this_expression_80007","'await' has no effect on the type of this expression."),Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers:ai(80008,2,"Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accur_80008","Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers."),JSDoc_typedef_may_be_converted_to_TypeScript_type:ai(80009,2,"JSDoc_typedef_may_be_converted_to_TypeScript_type_80009","JSDoc typedef may be converted to TypeScript type."),JSDoc_typedefs_may_be_converted_to_TypeScript_types:ai(80010,2,"JSDoc_typedefs_may_be_converted_to_TypeScript_types_80010","JSDoc typedefs may be converted to TypeScript types."),Add_missing_super_call:ai(90001,3,"Add_missing_super_call_90001","Add missing 'super()' call"),Make_super_call_the_first_statement_in_the_constructor:ai(90002,3,"Make_super_call_the_first_statement_in_the_constructor_90002","Make 'super()' call the first statement in the constructor"),Change_extends_to_implements:ai(90003,3,"Change_extends_to_implements_90003","Change 'extends' to 'implements'"),Remove_unused_declaration_for_Colon_0:ai(90004,3,"Remove_unused_declaration_for_Colon_0_90004","Remove unused declaration for: '{0}'"),Remove_import_from_0:ai(90005,3,"Remove_import_from_0_90005","Remove import from '{0}'"),Implement_interface_0:ai(90006,3,"Implement_interface_0_90006","Implement interface '{0}'"),Implement_inherited_abstract_class:ai(90007,3,"Implement_inherited_abstract_class_90007","Implement inherited abstract class"),Add_0_to_unresolved_variable:ai(90008,3,"Add_0_to_unresolved_variable_90008","Add '{0}.' to unresolved variable"),Remove_variable_statement:ai(90010,3,"Remove_variable_statement_90010","Remove variable statement"),Remove_template_tag:ai(90011,3,"Remove_template_tag_90011","Remove template tag"),Remove_type_parameters:ai(90012,3,"Remove_type_parameters_90012","Remove type parameters"),Import_0_from_1:ai(90013,3,"Import_0_from_1_90013","Import '{0}' from \"{1}\""),Change_0_to_1:ai(90014,3,"Change_0_to_1_90014","Change '{0}' to '{1}'"),Declare_property_0:ai(90016,3,"Declare_property_0_90016","Declare property '{0}'"),Add_index_signature_for_property_0:ai(90017,3,"Add_index_signature_for_property_0_90017","Add index signature for property '{0}'"),Disable_checking_for_this_file:ai(90018,3,"Disable_checking_for_this_file_90018","Disable checking for this file"),Ignore_this_error_message:ai(90019,3,"Ignore_this_error_message_90019","Ignore this error message"),Initialize_property_0_in_the_constructor:ai(90020,3,"Initialize_property_0_in_the_constructor_90020","Initialize property '{0}' in the constructor"),Initialize_static_property_0:ai(90021,3,"Initialize_static_property_0_90021","Initialize static property '{0}'"),Change_spelling_to_0:ai(90022,3,"Change_spelling_to_0_90022","Change spelling to '{0}'"),Declare_method_0:ai(90023,3,"Declare_method_0_90023","Declare method '{0}'"),Declare_static_method_0:ai(90024,3,"Declare_static_method_0_90024","Declare static method '{0}'"),Prefix_0_with_an_underscore:ai(90025,3,"Prefix_0_with_an_underscore_90025","Prefix '{0}' with an underscore"),Rewrite_as_the_indexed_access_type_0:ai(90026,3,"Rewrite_as_the_indexed_access_type_0_90026","Rewrite as the indexed access type '{0}'"),Declare_static_property_0:ai(90027,3,"Declare_static_property_0_90027","Declare static property '{0}'"),Call_decorator_expression:ai(90028,3,"Call_decorator_expression_90028","Call decorator expression"),Add_async_modifier_to_containing_function:ai(90029,3,"Add_async_modifier_to_containing_function_90029","Add async modifier to containing function"),Replace_infer_0_with_unknown:ai(90030,3,"Replace_infer_0_with_unknown_90030","Replace 'infer {0}' with 'unknown'"),Replace_all_unused_infer_with_unknown:ai(90031,3,"Replace_all_unused_infer_with_unknown_90031","Replace all unused 'infer' with 'unknown'"),Add_parameter_name:ai(90034,3,"Add_parameter_name_90034","Add parameter name"),Declare_private_property_0:ai(90035,3,"Declare_private_property_0_90035","Declare private property '{0}'"),Replace_0_with_Promise_1:ai(90036,3,"Replace_0_with_Promise_1_90036","Replace '{0}' with 'Promise<{1}>'"),Fix_all_incorrect_return_type_of_an_async_functions:ai(90037,3,"Fix_all_incorrect_return_type_of_an_async_functions_90037","Fix all incorrect return type of an async functions"),Declare_private_method_0:ai(90038,3,"Declare_private_method_0_90038","Declare private method '{0}'"),Remove_unused_destructuring_declaration:ai(90039,3,"Remove_unused_destructuring_declaration_90039","Remove unused destructuring declaration"),Remove_unused_declarations_for_Colon_0:ai(90041,3,"Remove_unused_declarations_for_Colon_0_90041","Remove unused declarations for: '{0}'"),Declare_a_private_field_named_0:ai(90053,3,"Declare_a_private_field_named_0_90053","Declare a private field named '{0}'."),Includes_imports_of_types_referenced_by_0:ai(90054,3,"Includes_imports_of_types_referenced_by_0_90054","Includes imports of types referenced by '{0}'"),Remove_type_from_import_declaration_from_0:ai(90055,3,"Remove_type_from_import_declaration_from_0_90055","Remove 'type' from import declaration from \"{0}\""),Remove_type_from_import_of_0_from_1:ai(90056,3,"Remove_type_from_import_of_0_from_1_90056","Remove 'type' from import of '{0}' from \"{1}\""),Add_import_from_0:ai(90057,3,"Add_import_from_0_90057",'Add import from "{0}"'),Update_import_from_0:ai(90058,3,"Update_import_from_0_90058",'Update import from "{0}"'),Export_0_from_module_1:ai(90059,3,"Export_0_from_module_1_90059","Export '{0}' from module '{1}'"),Export_all_referenced_locals:ai(90060,3,"Export_all_referenced_locals_90060","Export all referenced locals"),Convert_function_to_an_ES2015_class:ai(95001,3,"Convert_function_to_an_ES2015_class_95001","Convert function to an ES2015 class"),Convert_0_to_1_in_0:ai(95003,3,"Convert_0_to_1_in_0_95003","Convert '{0}' to '{1} in {0}'"),Extract_to_0_in_1:ai(95004,3,"Extract_to_0_in_1_95004","Extract to {0} in {1}"),Extract_function:ai(95005,3,"Extract_function_95005","Extract function"),Extract_constant:ai(95006,3,"Extract_constant_95006","Extract constant"),Extract_to_0_in_enclosing_scope:ai(95007,3,"Extract_to_0_in_enclosing_scope_95007","Extract to {0} in enclosing scope"),Extract_to_0_in_1_scope:ai(95008,3,"Extract_to_0_in_1_scope_95008","Extract to {0} in {1} scope"),Annotate_with_type_from_JSDoc:ai(95009,3,"Annotate_with_type_from_JSDoc_95009","Annotate with type from JSDoc"),Infer_type_of_0_from_usage:ai(95011,3,"Infer_type_of_0_from_usage_95011","Infer type of '{0}' from usage"),Infer_parameter_types_from_usage:ai(95012,3,"Infer_parameter_types_from_usage_95012","Infer parameter types from usage"),Convert_to_default_import:ai(95013,3,"Convert_to_default_import_95013","Convert to default import"),Install_0:ai(95014,3,"Install_0_95014","Install '{0}'"),Replace_import_with_0:ai(95015,3,"Replace_import_with_0_95015","Replace import with '{0}'."),Use_synthetic_default_member:ai(95016,3,"Use_synthetic_default_member_95016","Use synthetic 'default' member."),Convert_to_ES_module:ai(95017,3,"Convert_to_ES_module_95017","Convert to ES module"),Add_undefined_type_to_property_0:ai(95018,3,"Add_undefined_type_to_property_0_95018","Add 'undefined' type to property '{0}'"),Add_initializer_to_property_0:ai(95019,3,"Add_initializer_to_property_0_95019","Add initializer to property '{0}'"),Add_definite_assignment_assertion_to_property_0:ai(95020,3,"Add_definite_assignment_assertion_to_property_0_95020","Add definite assignment assertion to property '{0}'"),Convert_all_type_literals_to_mapped_type:ai(95021,3,"Convert_all_type_literals_to_mapped_type_95021","Convert all type literals to mapped type"),Add_all_missing_members:ai(95022,3,"Add_all_missing_members_95022","Add all missing members"),Infer_all_types_from_usage:ai(95023,3,"Infer_all_types_from_usage_95023","Infer all types from usage"),Delete_all_unused_declarations:ai(95024,3,"Delete_all_unused_declarations_95024","Delete all unused declarations"),Prefix_all_unused_declarations_with_where_possible:ai(95025,3,"Prefix_all_unused_declarations_with_where_possible_95025","Prefix all unused declarations with '_' where possible"),Fix_all_detected_spelling_errors:ai(95026,3,"Fix_all_detected_spelling_errors_95026","Fix all detected spelling errors"),Add_initializers_to_all_uninitialized_properties:ai(95027,3,"Add_initializers_to_all_uninitialized_properties_95027","Add initializers to all uninitialized properties"),Add_definite_assignment_assertions_to_all_uninitialized_properties:ai(95028,3,"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028","Add definite assignment assertions to all uninitialized properties"),Add_undefined_type_to_all_uninitialized_properties:ai(95029,3,"Add_undefined_type_to_all_uninitialized_properties_95029","Add undefined type to all uninitialized properties"),Change_all_jsdoc_style_types_to_TypeScript:ai(95030,3,"Change_all_jsdoc_style_types_to_TypeScript_95030","Change all jsdoc-style types to TypeScript"),Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types:ai(95031,3,"Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031","Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)"),Implement_all_unimplemented_interfaces:ai(95032,3,"Implement_all_unimplemented_interfaces_95032","Implement all unimplemented interfaces"),Install_all_missing_types_packages:ai(95033,3,"Install_all_missing_types_packages_95033","Install all missing types packages"),Rewrite_all_as_indexed_access_types:ai(95034,3,"Rewrite_all_as_indexed_access_types_95034","Rewrite all as indexed access types"),Convert_all_to_default_imports:ai(95035,3,"Convert_all_to_default_imports_95035","Convert all to default imports"),Make_all_super_calls_the_first_statement_in_their_constructor:ai(95036,3,"Make_all_super_calls_the_first_statement_in_their_constructor_95036","Make all 'super()' calls the first statement in their constructor"),Add_qualifier_to_all_unresolved_variables_matching_a_member_name:ai(95037,3,"Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037","Add qualifier to all unresolved variables matching a member name"),Change_all_extended_interfaces_to_implements:ai(95038,3,"Change_all_extended_interfaces_to_implements_95038","Change all extended interfaces to 'implements'"),Add_all_missing_super_calls:ai(95039,3,"Add_all_missing_super_calls_95039","Add all missing super calls"),Implement_all_inherited_abstract_classes:ai(95040,3,"Implement_all_inherited_abstract_classes_95040","Implement all inherited abstract classes"),Add_all_missing_async_modifiers:ai(95041,3,"Add_all_missing_async_modifiers_95041","Add all missing 'async' modifiers"),Add_ts_ignore_to_all_error_messages:ai(95042,3,"Add_ts_ignore_to_all_error_messages_95042","Add '@ts-ignore' to all error messages"),Annotate_everything_with_types_from_JSDoc:ai(95043,3,"Annotate_everything_with_types_from_JSDoc_95043","Annotate everything with types from JSDoc"),Add_to_all_uncalled_decorators:ai(95044,3,"Add_to_all_uncalled_decorators_95044","Add '()' to all uncalled decorators"),Convert_all_constructor_functions_to_classes:ai(95045,3,"Convert_all_constructor_functions_to_classes_95045","Convert all constructor functions to classes"),Generate_get_and_set_accessors:ai(95046,3,"Generate_get_and_set_accessors_95046","Generate 'get' and 'set' accessors"),Convert_require_to_import:ai(95047,3,"Convert_require_to_import_95047","Convert 'require' to 'import'"),Convert_all_require_to_import:ai(95048,3,"Convert_all_require_to_import_95048","Convert all 'require' to 'import'"),Move_to_a_new_file:ai(95049,3,"Move_to_a_new_file_95049","Move to a new file"),Remove_unreachable_code:ai(95050,3,"Remove_unreachable_code_95050","Remove unreachable code"),Remove_all_unreachable_code:ai(95051,3,"Remove_all_unreachable_code_95051","Remove all unreachable code"),Add_missing_typeof:ai(95052,3,"Add_missing_typeof_95052","Add missing 'typeof'"),Remove_unused_label:ai(95053,3,"Remove_unused_label_95053","Remove unused label"),Remove_all_unused_labels:ai(95054,3,"Remove_all_unused_labels_95054","Remove all unused labels"),Convert_0_to_mapped_object_type:ai(95055,3,"Convert_0_to_mapped_object_type_95055","Convert '{0}' to mapped object type"),Convert_namespace_import_to_named_imports:ai(95056,3,"Convert_namespace_import_to_named_imports_95056","Convert namespace import to named imports"),Convert_named_imports_to_namespace_import:ai(95057,3,"Convert_named_imports_to_namespace_import_95057","Convert named imports to namespace import"),Add_or_remove_braces_in_an_arrow_function:ai(95058,3,"Add_or_remove_braces_in_an_arrow_function_95058","Add or remove braces in an arrow function"),Add_braces_to_arrow_function:ai(95059,3,"Add_braces_to_arrow_function_95059","Add braces to arrow function"),Remove_braces_from_arrow_function:ai(95060,3,"Remove_braces_from_arrow_function_95060","Remove braces from arrow function"),Convert_default_export_to_named_export:ai(95061,3,"Convert_default_export_to_named_export_95061","Convert default export to named export"),Convert_named_export_to_default_export:ai(95062,3,"Convert_named_export_to_default_export_95062","Convert named export to default export"),Add_missing_enum_member_0:ai(95063,3,"Add_missing_enum_member_0_95063","Add missing enum member '{0}'"),Add_all_missing_imports:ai(95064,3,"Add_all_missing_imports_95064","Add all missing imports"),Convert_to_async_function:ai(95065,3,"Convert_to_async_function_95065","Convert to async function"),Convert_all_to_async_functions:ai(95066,3,"Convert_all_to_async_functions_95066","Convert all to async functions"),Add_missing_call_parentheses:ai(95067,3,"Add_missing_call_parentheses_95067","Add missing call parentheses"),Add_all_missing_call_parentheses:ai(95068,3,"Add_all_missing_call_parentheses_95068","Add all missing call parentheses"),Add_unknown_conversion_for_non_overlapping_types:ai(95069,3,"Add_unknown_conversion_for_non_overlapping_types_95069","Add 'unknown' conversion for non-overlapping types"),Add_unknown_to_all_conversions_of_non_overlapping_types:ai(95070,3,"Add_unknown_to_all_conversions_of_non_overlapping_types_95070","Add 'unknown' to all conversions of non-overlapping types"),Add_missing_new_operator_to_call:ai(95071,3,"Add_missing_new_operator_to_call_95071","Add missing 'new' operator to call"),Add_missing_new_operator_to_all_calls:ai(95072,3,"Add_missing_new_operator_to_all_calls_95072","Add missing 'new' operator to all calls"),Add_names_to_all_parameters_without_names:ai(95073,3,"Add_names_to_all_parameters_without_names_95073","Add names to all parameters without names"),Enable_the_experimentalDecorators_option_in_your_configuration_file:ai(95074,3,"Enable_the_experimentalDecorators_option_in_your_configuration_file_95074","Enable the 'experimentalDecorators' option in your configuration file"),Convert_parameters_to_destructured_object:ai(95075,3,"Convert_parameters_to_destructured_object_95075","Convert parameters to destructured object"),Extract_type:ai(95077,3,"Extract_type_95077","Extract type"),Extract_to_type_alias:ai(95078,3,"Extract_to_type_alias_95078","Extract to type alias"),Extract_to_typedef:ai(95079,3,"Extract_to_typedef_95079","Extract to typedef"),Infer_this_type_of_0_from_usage:ai(95080,3,"Infer_this_type_of_0_from_usage_95080","Infer 'this' type of '{0}' from usage"),Add_const_to_unresolved_variable:ai(95081,3,"Add_const_to_unresolved_variable_95081","Add 'const' to unresolved variable"),Add_const_to_all_unresolved_variables:ai(95082,3,"Add_const_to_all_unresolved_variables_95082","Add 'const' to all unresolved variables"),Add_await:ai(95083,3,"Add_await_95083","Add 'await'"),Add_await_to_initializer_for_0:ai(95084,3,"Add_await_to_initializer_for_0_95084","Add 'await' to initializer for '{0}'"),Fix_all_expressions_possibly_missing_await:ai(95085,3,"Fix_all_expressions_possibly_missing_await_95085","Fix all expressions possibly missing 'await'"),Remove_unnecessary_await:ai(95086,3,"Remove_unnecessary_await_95086","Remove unnecessary 'await'"),Remove_all_unnecessary_uses_of_await:ai(95087,3,"Remove_all_unnecessary_uses_of_await_95087","Remove all unnecessary uses of 'await'"),Enable_the_jsx_flag_in_your_configuration_file:ai(95088,3,"Enable_the_jsx_flag_in_your_configuration_file_95088","Enable the '--jsx' flag in your configuration file"),Add_await_to_initializers:ai(95089,3,"Add_await_to_initializers_95089","Add 'await' to initializers"),Extract_to_interface:ai(95090,3,"Extract_to_interface_95090","Extract to interface"),Convert_to_a_bigint_numeric_literal:ai(95091,3,"Convert_to_a_bigint_numeric_literal_95091","Convert to a bigint numeric literal"),Convert_all_to_bigint_numeric_literals:ai(95092,3,"Convert_all_to_bigint_numeric_literals_95092","Convert all to bigint numeric literals"),Convert_const_to_let:ai(95093,3,"Convert_const_to_let_95093","Convert 'const' to 'let'"),Prefix_with_declare:ai(95094,3,"Prefix_with_declare_95094","Prefix with 'declare'"),Prefix_all_incorrect_property_declarations_with_declare:ai(95095,3,"Prefix_all_incorrect_property_declarations_with_declare_95095","Prefix all incorrect property declarations with 'declare'"),Convert_to_template_string:ai(95096,3,"Convert_to_template_string_95096","Convert to template string"),Add_export_to_make_this_file_into_a_module:ai(95097,3,"Add_export_to_make_this_file_into_a_module_95097","Add 'export {}' to make this file into a module"),Set_the_target_option_in_your_configuration_file_to_0:ai(95098,3,"Set_the_target_option_in_your_configuration_file_to_0_95098","Set the 'target' option in your configuration file to '{0}'"),Set_the_module_option_in_your_configuration_file_to_0:ai(95099,3,"Set_the_module_option_in_your_configuration_file_to_0_95099","Set the 'module' option in your configuration file to '{0}'"),Convert_invalid_character_to_its_html_entity_code:ai(95100,3,"Convert_invalid_character_to_its_html_entity_code_95100","Convert invalid character to its html entity code"),Convert_all_invalid_characters_to_HTML_entity_code:ai(95101,3,"Convert_all_invalid_characters_to_HTML_entity_code_95101","Convert all invalid characters to HTML entity code"),Convert_all_const_to_let:ai(95102,3,"Convert_all_const_to_let_95102","Convert all 'const' to 'let'"),Convert_function_expression_0_to_arrow_function:ai(95105,3,"Convert_function_expression_0_to_arrow_function_95105","Convert function expression '{0}' to arrow function"),Convert_function_declaration_0_to_arrow_function:ai(95106,3,"Convert_function_declaration_0_to_arrow_function_95106","Convert function declaration '{0}' to arrow function"),Fix_all_implicit_this_errors:ai(95107,3,"Fix_all_implicit_this_errors_95107","Fix all implicit-'this' errors"),Wrap_invalid_character_in_an_expression_container:ai(95108,3,"Wrap_invalid_character_in_an_expression_container_95108","Wrap invalid character in an expression container"),Wrap_all_invalid_characters_in_an_expression_container:ai(95109,3,"Wrap_all_invalid_characters_in_an_expression_container_95109","Wrap all invalid characters in an expression container"),Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file:ai(95110,3,"Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file_95110","Visit https://aka.ms/tsconfig to read more about this file"),Add_a_return_statement:ai(95111,3,"Add_a_return_statement_95111","Add a return statement"),Remove_braces_from_arrow_function_body:ai(95112,3,"Remove_braces_from_arrow_function_body_95112","Remove braces from arrow function body"),Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal:ai(95113,3,"Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal_95113","Wrap the following body with parentheses which should be an object literal"),Add_all_missing_return_statement:ai(95114,3,"Add_all_missing_return_statement_95114","Add all missing return statement"),Remove_braces_from_all_arrow_function_bodies_with_relevant_issues:ai(95115,3,"Remove_braces_from_all_arrow_function_bodies_with_relevant_issues_95115","Remove braces from all arrow function bodies with relevant issues"),Wrap_all_object_literal_with_parentheses:ai(95116,3,"Wrap_all_object_literal_with_parentheses_95116","Wrap all object literal with parentheses"),Move_labeled_tuple_element_modifiers_to_labels:ai(95117,3,"Move_labeled_tuple_element_modifiers_to_labels_95117","Move labeled tuple element modifiers to labels"),Convert_overload_list_to_single_signature:ai(95118,3,"Convert_overload_list_to_single_signature_95118","Convert overload list to single signature"),Generate_get_and_set_accessors_for_all_overriding_properties:ai(95119,3,"Generate_get_and_set_accessors_for_all_overriding_properties_95119","Generate 'get' and 'set' accessors for all overriding properties"),Wrap_in_JSX_fragment:ai(95120,3,"Wrap_in_JSX_fragment_95120","Wrap in JSX fragment"),Wrap_all_unparented_JSX_in_JSX_fragment:ai(95121,3,"Wrap_all_unparented_JSX_in_JSX_fragment_95121","Wrap all unparented JSX in JSX fragment"),Convert_arrow_function_or_function_expression:ai(95122,3,"Convert_arrow_function_or_function_expression_95122","Convert arrow function or function expression"),Convert_to_anonymous_function:ai(95123,3,"Convert_to_anonymous_function_95123","Convert to anonymous function"),Convert_to_named_function:ai(95124,3,"Convert_to_named_function_95124","Convert to named function"),Convert_to_arrow_function:ai(95125,3,"Convert_to_arrow_function_95125","Convert to arrow function"),Remove_parentheses:ai(95126,3,"Remove_parentheses_95126","Remove parentheses"),Could_not_find_a_containing_arrow_function:ai(95127,3,"Could_not_find_a_containing_arrow_function_95127","Could not find a containing arrow function"),Containing_function_is_not_an_arrow_function:ai(95128,3,"Containing_function_is_not_an_arrow_function_95128","Containing function is not an arrow function"),Could_not_find_export_statement:ai(95129,3,"Could_not_find_export_statement_95129","Could not find export statement"),This_file_already_has_a_default_export:ai(95130,3,"This_file_already_has_a_default_export_95130","This file already has a default export"),Could_not_find_import_clause:ai(95131,3,"Could_not_find_import_clause_95131","Could not find import clause"),Could_not_find_namespace_import_or_named_imports:ai(95132,3,"Could_not_find_namespace_import_or_named_imports_95132","Could not find namespace import or named imports"),Selection_is_not_a_valid_type_node:ai(95133,3,"Selection_is_not_a_valid_type_node_95133","Selection is not a valid type node"),No_type_could_be_extracted_from_this_type_node:ai(95134,3,"No_type_could_be_extracted_from_this_type_node_95134","No type could be extracted from this type node"),Could_not_find_property_for_which_to_generate_accessor:ai(95135,3,"Could_not_find_property_for_which_to_generate_accessor_95135","Could not find property for which to generate accessor"),Name_is_not_valid:ai(95136,3,"Name_is_not_valid_95136","Name is not valid"),Can_only_convert_property_with_modifier:ai(95137,3,"Can_only_convert_property_with_modifier_95137","Can only convert property with modifier"),Switch_each_misused_0_to_1:ai(95138,3,"Switch_each_misused_0_to_1_95138","Switch each misused '{0}' to '{1}'"),Convert_to_optional_chain_expression:ai(95139,3,"Convert_to_optional_chain_expression_95139","Convert to optional chain expression"),Could_not_find_convertible_access_expression:ai(95140,3,"Could_not_find_convertible_access_expression_95140","Could not find convertible access expression"),Could_not_find_matching_access_expressions:ai(95141,3,"Could_not_find_matching_access_expressions_95141","Could not find matching access expressions"),Can_only_convert_logical_AND_access_chains:ai(95142,3,"Can_only_convert_logical_AND_access_chains_95142","Can only convert logical AND access chains"),Add_void_to_Promise_resolved_without_a_value:ai(95143,3,"Add_void_to_Promise_resolved_without_a_value_95143","Add 'void' to Promise resolved without a value"),Add_void_to_all_Promises_resolved_without_a_value:ai(95144,3,"Add_void_to_all_Promises_resolved_without_a_value_95144","Add 'void' to all Promises resolved without a value"),Use_element_access_for_0:ai(95145,3,"Use_element_access_for_0_95145","Use element access for '{0}'"),Use_element_access_for_all_undeclared_properties:ai(95146,3,"Use_element_access_for_all_undeclared_properties_95146","Use element access for all undeclared properties."),Delete_all_unused_imports:ai(95147,3,"Delete_all_unused_imports_95147","Delete all unused imports"),Infer_function_return_type:ai(95148,3,"Infer_function_return_type_95148","Infer function return type"),Return_type_must_be_inferred_from_a_function:ai(95149,3,"Return_type_must_be_inferred_from_a_function_95149","Return type must be inferred from a function"),Could_not_determine_function_return_type:ai(95150,3,"Could_not_determine_function_return_type_95150","Could not determine function return type"),Could_not_convert_to_arrow_function:ai(95151,3,"Could_not_convert_to_arrow_function_95151","Could not convert to arrow function"),Could_not_convert_to_named_function:ai(95152,3,"Could_not_convert_to_named_function_95152","Could not convert to named function"),Could_not_convert_to_anonymous_function:ai(95153,3,"Could_not_convert_to_anonymous_function_95153","Could not convert to anonymous function"),Can_only_convert_string_concatenation:ai(95154,3,"Can_only_convert_string_concatenation_95154","Can only convert string concatenation"),Selection_is_not_a_valid_statement_or_statements:ai(95155,3,"Selection_is_not_a_valid_statement_or_statements_95155","Selection is not a valid statement or statements"),Add_missing_function_declaration_0:ai(95156,3,"Add_missing_function_declaration_0_95156","Add missing function declaration '{0}'"),Add_all_missing_function_declarations:ai(95157,3,"Add_all_missing_function_declarations_95157","Add all missing function declarations"),Method_not_implemented:ai(95158,3,"Method_not_implemented_95158","Method not implemented."),Function_not_implemented:ai(95159,3,"Function_not_implemented_95159","Function not implemented."),Add_override_modifier:ai(95160,3,"Add_override_modifier_95160","Add 'override' modifier"),Remove_override_modifier:ai(95161,3,"Remove_override_modifier_95161","Remove 'override' modifier"),Add_all_missing_override_modifiers:ai(95162,3,"Add_all_missing_override_modifiers_95162","Add all missing 'override' modifiers"),Remove_all_unnecessary_override_modifiers:ai(95163,3,"Remove_all_unnecessary_override_modifiers_95163","Remove all unnecessary 'override' modifiers"),Can_only_convert_named_export:ai(95164,3,"Can_only_convert_named_export_95164","Can only convert named export"),Add_missing_properties:ai(95165,3,"Add_missing_properties_95165","Add missing properties"),Add_all_missing_properties:ai(95166,3,"Add_all_missing_properties_95166","Add all missing properties"),Add_missing_attributes:ai(95167,3,"Add_missing_attributes_95167","Add missing attributes"),Add_all_missing_attributes:ai(95168,3,"Add_all_missing_attributes_95168","Add all missing attributes"),Add_undefined_to_optional_property_type:ai(95169,3,"Add_undefined_to_optional_property_type_95169","Add 'undefined' to optional property type"),Convert_named_imports_to_default_import:ai(95170,3,"Convert_named_imports_to_default_import_95170","Convert named imports to default import"),Delete_unused_param_tag_0:ai(95171,3,"Delete_unused_param_tag_0_95171","Delete unused '@param' tag '{0}'"),Delete_all_unused_param_tags:ai(95172,3,"Delete_all_unused_param_tags_95172","Delete all unused '@param' tags"),Rename_param_tag_name_0_to_1:ai(95173,3,"Rename_param_tag_name_0_to_1_95173","Rename '@param' tag name '{0}' to '{1}'"),Use_0:ai(95174,3,"Use_0_95174","Use `{0}`."),Use_Number_isNaN_in_all_conditions:ai(95175,3,"Use_Number_isNaN_in_all_conditions_95175","Use `Number.isNaN` in all conditions."),Convert_typedef_to_TypeScript_type:ai(95176,3,"Convert_typedef_to_TypeScript_type_95176","Convert typedef to TypeScript type."),Convert_all_typedef_to_TypeScript_types:ai(95177,3,"Convert_all_typedef_to_TypeScript_types_95177","Convert all typedef to TypeScript types."),Move_to_file:ai(95178,3,"Move_to_file_95178","Move to file"),Cannot_move_to_file_selected_file_is_invalid:ai(95179,3,"Cannot_move_to_file_selected_file_is_invalid_95179","Cannot move to file, selected file is invalid"),Use_import_type:ai(95180,3,"Use_import_type_95180","Use 'import type'"),Use_type_0:ai(95181,3,"Use_type_0_95181","Use 'type {0}'"),Fix_all_with_type_only_imports:ai(95182,3,"Fix_all_with_type_only_imports_95182","Fix all with type-only imports"),Cannot_move_statements_to_the_selected_file:ai(95183,3,"Cannot_move_statements_to_the_selected_file_95183","Cannot move statements to the selected file"),Inline_variable:ai(95184,3,"Inline_variable_95184","Inline variable"),Could_not_find_variable_to_inline:ai(95185,3,"Could_not_find_variable_to_inline_95185","Could not find variable to inline."),Variables_with_multiple_declarations_cannot_be_inlined:ai(95186,3,"Variables_with_multiple_declarations_cannot_be_inlined_95186","Variables with multiple declarations cannot be inlined."),Add_missing_comma_for_object_member_completion_0:ai(95187,3,"Add_missing_comma_for_object_member_completion_0_95187","Add missing comma for object member completion '{0}'."),No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer:ai(18004,1,"No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004","No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),Classes_may_not_have_a_field_named_constructor:ai(18006,1,"Classes_may_not_have_a_field_named_constructor_18006","Classes may not have a field named 'constructor'."),JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array:ai(18007,1,"JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007","JSX expressions may not use the comma operator. Did you mean to write an array?"),Private_identifiers_cannot_be_used_as_parameters:ai(18009,1,"Private_identifiers_cannot_be_used_as_parameters_18009","Private identifiers cannot be used as parameters."),An_accessibility_modifier_cannot_be_used_with_a_private_identifier:ai(18010,1,"An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010","An accessibility modifier cannot be used with a private identifier."),The_operand_of_a_delete_operator_cannot_be_a_private_identifier:ai(18011,1,"The_operand_of_a_delete_operator_cannot_be_a_private_identifier_18011","The operand of a 'delete' operator cannot be a private identifier."),constructor_is_a_reserved_word:ai(18012,1,"constructor_is_a_reserved_word_18012","'#constructor' is a reserved word."),Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier:ai(18013,1,"Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier_18013","Property '{0}' is not accessible outside class '{1}' because it has a private identifier."),The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_private_identifier_with_the_same_spelling:ai(18014,1,"The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_priv_18014","The property '{0}' cannot be accessed on type '{1}' within this class because it is shadowed by another private identifier with the same spelling."),Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2:ai(18015,1,"Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2_18015","Property '{0}' in type '{1}' refers to a different member that cannot be accessed from within type '{2}'."),Private_identifiers_are_not_allowed_outside_class_bodies:ai(18016,1,"Private_identifiers_are_not_allowed_outside_class_bodies_18016","Private identifiers are not allowed outside class bodies."),The_shadowing_declaration_of_0_is_defined_here:ai(18017,1,"The_shadowing_declaration_of_0_is_defined_here_18017","The shadowing declaration of '{0}' is defined here"),The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here:ai(18018,1,"The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018","The declaration of '{0}' that you probably intended to use is defined here"),_0_modifier_cannot_be_used_with_a_private_identifier:ai(18019,1,"_0_modifier_cannot_be_used_with_a_private_identifier_18019","'{0}' modifier cannot be used with a private identifier."),An_enum_member_cannot_be_named_with_a_private_identifier:ai(18024,1,"An_enum_member_cannot_be_named_with_a_private_identifier_18024","An enum member cannot be named with a private identifier."),can_only_be_used_at_the_start_of_a_file:ai(18026,1,"can_only_be_used_at_the_start_of_a_file_18026","'#!' can only be used at the start of a file."),Compiler_reserves_name_0_when_emitting_private_identifier_downlevel:ai(18027,1,"Compiler_reserves_name_0_when_emitting_private_identifier_downlevel_18027","Compiler reserves name '{0}' when emitting private identifier downlevel."),Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher:ai(18028,1,"Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher_18028","Private identifiers are only available when targeting ECMAScript 2015 and higher."),Private_identifiers_are_not_allowed_in_variable_declarations:ai(18029,1,"Private_identifiers_are_not_allowed_in_variable_declarations_18029","Private identifiers are not allowed in variable declarations."),An_optional_chain_cannot_contain_private_identifiers:ai(18030,1,"An_optional_chain_cannot_contain_private_identifiers_18030","An optional chain cannot contain private identifiers."),The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents:ai(18031,1,"The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituent_18031","The intersection '{0}' was reduced to 'never' because property '{1}' has conflicting types in some constituents."),The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some:ai(18032,1,"The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_pr_18032","The intersection '{0}' was reduced to 'never' because property '{1}' exists in multiple constituents and is private in some."),Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values:ai(18033,1,"Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values_18033","Type '{0}' is not assignable to type '{1}' as required for computed enum member values."),Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compiler_option_is_specified_e_g_Fragment:ai(18034,3,"Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compi_18034","Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'."),Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name:ai(18035,1,"Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name_18035","Invalid value for 'jsxFragmentFactory'. '{0}' is not a valid identifier or qualified-name."),Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator:ai(18036,1,"Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_dec_18036","Class decorators can't be used with static private identifier. Consider removing the experimental decorator."),await_expression_cannot_be_used_inside_a_class_static_block:ai(18037,1,"await_expression_cannot_be_used_inside_a_class_static_block_18037","'await' expression cannot be used inside a class static block."),for_await_loops_cannot_be_used_inside_a_class_static_block:ai(18038,1,"for_await_loops_cannot_be_used_inside_a_class_static_block_18038","'for await' loops cannot be used inside a class static block."),Invalid_use_of_0_It_cannot_be_used_inside_a_class_static_block:ai(18039,1,"Invalid_use_of_0_It_cannot_be_used_inside_a_class_static_block_18039","Invalid use of '{0}'. It cannot be used inside a class static block."),A_return_statement_cannot_be_used_inside_a_class_static_block:ai(18041,1,"A_return_statement_cannot_be_used_inside_a_class_static_block_18041","A 'return' statement cannot be used inside a class static block."),_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation:ai(18042,1,"_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042","'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."),Types_cannot_appear_in_export_declarations_in_JavaScript_files:ai(18043,1,"Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043","Types cannot appear in export declarations in JavaScript files."),_0_is_automatically_exported_here:ai(18044,3,"_0_is_automatically_exported_here_18044","'{0}' is automatically exported here."),Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher:ai(18045,1,"Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045","Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."),_0_is_of_type_unknown:ai(18046,1,"_0_is_of_type_unknown_18046","'{0}' is of type 'unknown'."),_0_is_possibly_null:ai(18047,1,"_0_is_possibly_null_18047","'{0}' is possibly 'null'."),_0_is_possibly_undefined:ai(18048,1,"_0_is_possibly_undefined_18048","'{0}' is possibly 'undefined'."),_0_is_possibly_null_or_undefined:ai(18049,1,"_0_is_possibly_null_or_undefined_18049","'{0}' is possibly 'null' or 'undefined'."),The_value_0_cannot_be_used_here:ai(18050,1,"The_value_0_cannot_be_used_here_18050","The value '{0}' cannot be used here."),Compiler_option_0_cannot_be_given_an_empty_string:ai(18051,1,"Compiler_option_0_cannot_be_given_an_empty_string_18051","Compiler option '{0}' cannot be given an empty string."),Non_abstract_class_0_does_not_implement_all_abstract_members_of_1:ai(18052,1,"Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052","Non-abstract class '{0}' does not implement all abstract members of '{1}'"),Its_type_0_is_not_a_valid_JSX_element_type:ai(18053,1,"Its_type_0_is_not_a_valid_JSX_element_type_18053","Its type '{0}' is not a valid JSX element type."),await_using_statements_cannot_be_used_inside_a_class_static_block:ai(18054,1,"await_using_statements_cannot_be_used_inside_a_class_static_block_18054","'await using' statements cannot be used inside a class static block.")}}});function wi(e){return 80<=e}function Ci(e){return 32===e||80<=e}function Ni(e,t){if(e=e.length)&&(a?t=t<0?0:t>=e.length?e.length-1:t:rA.fail("Bad line number. Line: ".concat(t,", lineStarts.length: ").concat(e.length," , line map is correct? ").concat(void 0!==n?tD(e,Ei(n)):"unknown")));r=e[t]+r;return a?r>e[t+1]?e[t+1]:"string"==typeof n&&r>n.length?n.length:r:(t":32,"<=":33,">=":34,"==":35,"!=":36,"===":37,"!==":38,"=>":39,"+":40,"-":41,"**":43,"*":42,"/":44,"%":45,"++":46,"--":47,"<<":48,">":49,">>>":50,"&":51,"|":52,"^":53,"!":54,"~":55,"&&":56,"||":57,"?":58,"??":61,"?.":29,":":59,"=":64,"+=":65,"-=":66,"*=":67,"**=":68,"/=":69,"%=":70,"<<=":71,">>=":72,">>>=":73,"&=":74,"|=":75,"^=":79,"||=":76,"&&=":77,"??=":78,"@":60,"#":63,"`":62}))),si=[170,170,181,181,186,186,192,214,216,246,248,543,546,563,592,685,688,696,699,705,720,721,736,740,750,750,890,890,902,902,904,906,908,908,910,929,931,974,976,983,986,1011,1024,1153,1164,1220,1223,1224,1227,1228,1232,1269,1272,1273,1329,1366,1369,1369,1377,1415,1488,1514,1520,1522,1569,1594,1600,1610,1649,1747,1749,1749,1765,1766,1786,1788,1808,1808,1810,1836,1920,1957,2309,2361,2365,2365,2384,2384,2392,2401,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2524,2525,2527,2529,2544,2545,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2699,2701,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2784,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2870,2873,2877,2877,2908,2909,2911,2913,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,2997,2999,3001,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3168,3169,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3294,3294,3296,3297,3333,3340,3342,3344,3346,3368,3370,3385,3424,3425,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3760,3762,3763,3773,3773,3776,3780,3782,3782,3804,3805,3840,3840,3904,3911,3913,3946,3976,3979,4096,4129,4131,4135,4137,4138,4176,4181,4256,4293,4304,4342,4352,4441,4447,4514,4520,4601,4608,4614,4616,4678,4680,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4742,4744,4744,4746,4749,4752,4782,4784,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4814,4816,4822,4824,4846,4848,4878,4880,4880,4882,4885,4888,4894,4896,4934,4936,4954,5024,5108,5121,5740,5743,5750,5761,5786,5792,5866,6016,6067,6176,6263,6272,6312,7680,7835,7840,7929,7936,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8319,8319,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8497,8499,8505,8544,8579,12293,12295,12321,12329,12337,12341,12344,12346,12353,12436,12445,12446,12449,12538,12540,12542,12549,12588,12593,12686,12704,12727,13312,19893,19968,40869,40960,42124,44032,55203,63744,64045,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65138,65140,65140,65142,65276,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500],ci=[170,170,181,181,186,186,192,214,216,246,248,543,546,563,592,685,688,696,699,705,720,721,736,740,750,750,768,846,864,866,890,890,902,902,904,906,908,908,910,929,931,974,976,983,986,1011,1024,1153,1155,1158,1164,1220,1223,1224,1227,1228,1232,1269,1272,1273,1329,1366,1369,1369,1377,1415,1425,1441,1443,1465,1467,1469,1471,1471,1473,1474,1476,1476,1488,1514,1520,1522,1569,1594,1600,1621,1632,1641,1648,1747,1749,1756,1759,1768,1770,1773,1776,1788,1808,1836,1840,1866,1920,1968,2305,2307,2309,2361,2364,2381,2384,2388,2392,2403,2406,2415,2433,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2492,2492,2494,2500,2503,2504,2507,2509,2519,2519,2524,2525,2527,2531,2534,2545,2562,2562,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2620,2620,2622,2626,2631,2632,2635,2637,2649,2652,2654,2654,2662,2676,2689,2691,2693,2699,2701,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2748,2757,2759,2761,2763,2765,2768,2768,2784,2784,2790,2799,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2870,2873,2876,2883,2887,2888,2891,2893,2902,2903,2908,2909,2911,2913,2918,2927,2946,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,2997,2999,3001,3006,3010,3014,3016,3018,3021,3031,3031,3047,3055,3073,3075,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3134,3140,3142,3144,3146,3149,3157,3158,3168,3169,3174,3183,3202,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3262,3268,3270,3272,3274,3277,3285,3286,3294,3294,3296,3297,3302,3311,3330,3331,3333,3340,3342,3344,3346,3368,3370,3385,3390,3395,3398,3400,3402,3405,3415,3415,3424,3425,3430,3439,3458,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3530,3530,3535,3540,3542,3542,3544,3551,3570,3571,3585,3642,3648,3662,3664,3673,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3769,3771,3773,3776,3780,3782,3782,3784,3789,3792,3801,3804,3805,3840,3840,3864,3865,3872,3881,3893,3893,3895,3895,3897,3897,3902,3911,3913,3946,3953,3972,3974,3979,3984,3991,3993,4028,4038,4038,4096,4129,4131,4135,4137,4138,4140,4146,4150,4153,4160,4169,4176,4185,4256,4293,4304,4342,4352,4441,4447,4514,4520,4601,4608,4614,4616,4678,4680,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4742,4744,4744,4746,4749,4752,4782,4784,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4814,4816,4822,4824,4846,4848,4878,4880,4880,4882,4885,4888,4894,4896,4934,4936,4954,4969,4977,5024,5108,5121,5740,5743,5750,5761,5786,5792,5866,6016,6099,6112,6121,6160,6169,6176,6263,6272,6313,7680,7835,7840,7929,7936,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8255,8256,8319,8319,8400,8412,8417,8417,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8497,8499,8505,8544,8579,12293,12295,12321,12335,12337,12341,12344,12346,12353,12436,12441,12442,12445,12446,12449,12542,12549,12588,12593,12686,12704,12727,13312,19893,19968,40869,40960,42124,44032,55203,63744,64045,64256,64262,64275,64279,64285,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65056,65059,65075,65076,65101,65103,65136,65138,65140,65140,65142,65276,65296,65305,65313,65338,65343,65343,65345,65370,65381,65470,65474,65479,65482,65487,65490,65495,65498,65500],ui=[170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,890,893,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1319,1329,1366,1369,1369,1377,1415,1488,1514,1520,1522,1568,1610,1646,1647,1649,1747,1749,1749,1765,1766,1774,1775,1786,1788,1791,1791,1808,1808,1810,1839,1869,1957,1969,1969,1994,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,2088,2112,2136,2208,2208,2210,2220,2308,2361,2365,2365,2384,2384,2392,2401,2417,2423,2425,2431,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2544,2545,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2785,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2929,2929,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3024,3024,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3133,3133,3160,3161,3168,3169,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3261,3261,3294,3294,3296,3297,3313,3314,3333,3340,3342,3344,3346,3386,3389,3389,3406,3406,3424,3425,3450,3455,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3760,3762,3763,3773,3773,3776,3780,3782,3782,3804,3807,3840,3840,3904,3911,3913,3948,3976,3980,4096,4138,4159,4159,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,4225,4238,4238,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,5024,5108,5121,5740,5743,5759,5761,5786,5792,5866,5870,5872,5888,5900,5902,5905,5920,5937,5952,5969,5984,5996,5998,6e3,6016,6067,6103,6103,6108,6108,6176,6263,6272,6312,6314,6314,6320,6389,6400,6428,6480,6509,6512,6516,6528,6571,6593,6599,6656,6678,6688,6740,6823,6823,6917,6963,6981,6987,7043,7072,7086,7087,7098,7141,7168,7203,7245,7247,7258,7293,7401,7404,7406,7409,7413,7414,7424,7615,7680,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11502,11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11823,11823,12293,12295,12321,12329,12337,12341,12344,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12589,12593,12686,12704,12730,12784,12799,13312,19893,19968,40908,40960,42124,42192,42237,42240,42508,42512,42527,42538,42539,42560,42606,42623,42647,42656,42735,42775,42783,42786,42888,42891,42894,42896,42899,42912,42922,43e3,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,43250,43255,43259,43259,43274,43301,43312,43334,43360,43388,43396,43442,43471,43471,43520,43560,43584,43586,43588,43595,43616,43638,43642,43642,43648,43695,43697,43697,43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43968,44002,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65140,65142,65276,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500],_i=[170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,768,884,886,887,890,893,902,902,904,906,908,908,910,929,931,1013,1015,1153,1155,1159,1162,1319,1329,1366,1369,1369,1377,1415,1425,1469,1471,1471,1473,1474,1476,1477,1479,1479,1488,1514,1520,1522,1552,1562,1568,1641,1646,1747,1749,1756,1759,1768,1770,1788,1791,1791,1808,1866,1869,1969,1984,2037,2042,2042,2048,2093,2112,2139,2208,2208,2210,2220,2276,2302,2304,2403,2406,2415,2417,2423,2425,2431,2433,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2492,2500,2503,2504,2507,2510,2519,2519,2524,2525,2527,2531,2534,2545,2561,2563,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2620,2620,2622,2626,2631,2632,2635,2637,2641,2641,2649,2652,2654,2654,2662,2677,2689,2691,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2748,2757,2759,2761,2763,2765,2768,2768,2784,2787,2790,2799,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2876,2884,2887,2888,2891,2893,2902,2903,2908,2909,2911,2915,2918,2927,2929,2929,2946,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3006,3010,3014,3016,3018,3021,3024,3024,3031,3031,3046,3055,3073,3075,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3133,3140,3142,3144,3146,3149,3157,3158,3160,3161,3168,3171,3174,3183,3202,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3260,3268,3270,3272,3274,3277,3285,3286,3294,3294,3296,3299,3302,3311,3313,3314,3330,3331,3333,3340,3342,3344,3346,3386,3389,3396,3398,3400,3402,3406,3415,3415,3424,3427,3430,3439,3450,3455,3458,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3530,3530,3535,3540,3542,3542,3544,3551,3570,3571,3585,3642,3648,3662,3664,3673,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3769,3771,3773,3776,3780,3782,3782,3784,3789,3792,3801,3804,3807,3840,3840,3864,3865,3872,3881,3893,3893,3895,3895,3897,3897,3902,3911,3913,3948,3953,3972,3974,3991,3993,4028,4038,4038,4096,4169,4176,4253,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4957,4959,4992,5007,5024,5108,5121,5740,5743,5759,5761,5786,5792,5866,5870,5872,5888,5900,5902,5908,5920,5940,5952,5971,5984,5996,5998,6e3,6002,6003,6016,6099,6103,6103,6108,6109,6112,6121,6155,6157,6160,6169,6176,6263,6272,6314,6320,6389,6400,6428,6432,6443,6448,6459,6470,6509,6512,6516,6528,6571,6576,6601,6608,6617,6656,6683,6688,6750,6752,6780,6783,6793,6800,6809,6823,6823,6912,6987,6992,7001,7019,7027,7040,7155,7168,7223,7232,7241,7245,7293,7376,7378,7380,7414,7424,7654,7676,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8204,8205,8255,8256,8276,8276,8305,8305,8319,8319,8336,8348,8400,8412,8417,8417,8421,8432,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11647,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11744,11775,11823,11823,12293,12295,12321,12335,12337,12341,12344,12348,12353,12438,12441,12442,12445,12447,12449,12538,12540,12543,12549,12589,12593,12686,12704,12730,12784,12799,13312,19893,19968,40908,40960,42124,42192,42237,42240,42508,42512,42539,42560,42607,42612,42621,42623,42647,42655,42737,42775,42783,42786,42888,42891,42894,42896,42899,42912,42922,43e3,43047,43072,43123,43136,43204,43216,43225,43232,43255,43259,43259,43264,43309,43312,43347,43360,43388,43392,43456,43471,43481,43520,43574,43584,43597,43600,43609,43616,43638,43642,43643,43648,43714,43739,43741,43744,43759,43762,43766,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43968,44010,44012,44013,44016,44025,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65024,65039,65056,65062,65075,65076,65101,65103,65136,65140,65142,65276,65296,65305,65313,65338,65343,65343,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500],yi=[65,90,97,122,170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,890,893,895,895,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1327,1329,1366,1369,1369,1376,1416,1488,1514,1519,1522,1568,1610,1646,1647,1649,1747,1749,1749,1765,1766,1774,1775,1786,1788,1791,1791,1808,1808,1810,1839,1869,1957,1969,1969,1994,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,2088,2112,2136,2144,2154,2208,2228,2230,2237,2308,2361,2365,2365,2384,2384,2392,2401,2417,2432,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2544,2545,2556,2556,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2785,2809,2809,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2929,2929,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3024,3024,3077,3084,3086,3088,3090,3112,3114,3129,3133,3133,3160,3162,3168,3169,3200,3200,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3261,3261,3294,3294,3296,3297,3313,3314,3333,3340,3342,3344,3346,3386,3389,3389,3406,3406,3412,3414,3423,3425,3450,3455,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,3713,3714,3716,3716,3718,3722,3724,3747,3749,3749,3751,3760,3762,3763,3773,3773,3776,3780,3782,3782,3804,3807,3840,3840,3904,3911,3913,3948,3976,3980,4096,4138,4159,4159,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,4225,4238,4238,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,5024,5109,5112,5117,5121,5740,5743,5759,5761,5786,5792,5866,5870,5880,5888,5900,5902,5905,5920,5937,5952,5969,5984,5996,5998,6e3,6016,6067,6103,6103,6108,6108,6176,6264,6272,6312,6314,6314,6320,6389,6400,6430,6480,6509,6512,6516,6528,6571,6576,6601,6656,6678,6688,6740,6823,6823,6917,6963,6981,6987,7043,7072,7086,7087,7098,7141,7168,7203,7245,7247,7258,7293,7296,7304,7312,7354,7357,7359,7401,7404,7406,7411,7413,7414,7418,7418,7424,7615,7680,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,8455,8458,8467,8469,8469,8472,8477,8484,8484,8486,8486,8488,8488,8490,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11502,11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,12293,12295,12321,12329,12337,12341,12344,12348,12353,12438,12443,12447,12449,12538,12540,12543,12549,12591,12593,12686,12704,12730,12784,12799,13312,19893,19968,40943,40960,42124,42192,42237,42240,42508,42512,42527,42538,42539,42560,42606,42623,42653,42656,42735,42775,42783,42786,42888,42891,42943,42946,42950,42999,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,43250,43255,43259,43259,43261,43262,43274,43301,43312,43334,43360,43388,43396,43442,43471,43471,43488,43492,43494,43503,43514,43518,43520,43560,43584,43586,43588,43595,43616,43638,43642,43642,43646,43695,43697,43697,43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43824,43866,43868,43879,43888,44002,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65140,65142,65276,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500,65536,65547,65549,65574,65576,65594,65596,65597,65599,65613,65616,65629,65664,65786,65856,65908,66176,66204,66208,66256,66304,66335,66349,66378,66384,66421,66432,66461,66464,66499,66504,66511,66513,66517,66560,66717,66736,66771,66776,66811,66816,66855,66864,66915,67072,67382,67392,67413,67424,67431,67584,67589,67592,67592,67594,67637,67639,67640,67644,67644,67647,67669,67680,67702,67712,67742,67808,67826,67828,67829,67840,67861,67872,67897,67968,68023,68030,68031,68096,68096,68112,68115,68117,68119,68121,68149,68192,68220,68224,68252,68288,68295,68297,68324,68352,68405,68416,68437,68448,68466,68480,68497,68608,68680,68736,68786,68800,68850,68864,68899,69376,69404,69415,69415,69424,69445,69600,69622,69635,69687,69763,69807,69840,69864,69891,69926,69956,69956,69968,70002,70006,70006,70019,70066,70081,70084,70106,70106,70108,70108,70144,70161,70163,70187,70272,70278,70280,70280,70282,70285,70287,70301,70303,70312,70320,70366,70405,70412,70415,70416,70419,70440,70442,70448,70450,70451,70453,70457,70461,70461,70480,70480,70493,70497,70656,70708,70727,70730,70751,70751,70784,70831,70852,70853,70855,70855,71040,71086,71128,71131,71168,71215,71236,71236,71296,71338,71352,71352,71424,71450,71680,71723,71840,71903,71935,71935,72096,72103,72106,72144,72161,72161,72163,72163,72192,72192,72203,72242,72250,72250,72272,72272,72284,72329,72349,72349,72384,72440,72704,72712,72714,72750,72768,72768,72818,72847,72960,72966,72968,72969,72971,73008,73030,73030,73056,73061,73063,73064,73066,73097,73112,73112,73440,73458,73728,74649,74752,74862,74880,75075,77824,78894,82944,83526,92160,92728,92736,92766,92880,92909,92928,92975,92992,92995,93027,93047,93053,93071,93760,93823,93952,94026,94032,94032,94099,94111,94176,94177,94179,94179,94208,100343,100352,101106,110592,110878,110928,110930,110948,110951,110960,111355,113664,113770,113776,113788,113792,113800,113808,113817,119808,119892,119894,119964,119966,119967,119970,119970,119973,119974,119977,119980,119982,119993,119995,119995,119997,120003,120005,120069,120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,120132,120134,120134,120138,120144,120146,120485,120488,120512,120514,120538,120540,120570,120572,120596,120598,120628,120630,120654,120656,120686,120688,120712,120714,120744,120746,120770,120772,120779,123136,123180,123191,123197,123214,123214,123584,123627,124928,125124,125184,125251,125259,125259,126464,126467,126469,126495,126497,126498,126500,126500,126503,126503,126505,126514,126516,126519,126521,126521,126523,126523,126530,126530,126535,126535,126537,126537,126539,126539,126541,126543,126545,126546,126548,126548,126551,126551,126553,126553,126555,126555,126557,126557,126559,126559,126561,126562,126564,126564,126567,126570,126572,126578,126580,126583,126585,126588,126590,126590,126592,126601,126603,126619,126625,126627,126629,126633,126635,126651,131072,173782,173824,177972,177984,178205,178208,183969,183984,191456,194560,195101],vi=[48,57,65,90,95,95,97,122,170,170,181,181,183,183,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,768,884,886,887,890,893,895,895,902,906,908,908,910,929,931,1013,1015,1153,1155,1159,1162,1327,1329,1366,1369,1369,1376,1416,1425,1469,1471,1471,1473,1474,1476,1477,1479,1479,1488,1514,1519,1522,1552,1562,1568,1641,1646,1747,1749,1756,1759,1768,1770,1788,1791,1791,1808,1866,1869,1969,1984,2037,2042,2042,2045,2045,2048,2093,2112,2139,2144,2154,2208,2228,2230,2237,2259,2273,2275,2403,2406,2415,2417,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2492,2500,2503,2504,2507,2510,2519,2519,2524,2525,2527,2531,2534,2545,2556,2556,2558,2558,2561,2563,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2620,2620,2622,2626,2631,2632,2635,2637,2641,2641,2649,2652,2654,2654,2662,2677,2689,2691,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2748,2757,2759,2761,2763,2765,2768,2768,2784,2787,2790,2799,2809,2815,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2876,2884,2887,2888,2891,2893,2902,2903,2908,2909,2911,2915,2918,2927,2929,2929,2946,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3006,3010,3014,3016,3018,3021,3024,3024,3031,3031,3046,3055,3072,3084,3086,3088,3090,3112,3114,3129,3133,3140,3142,3144,3146,3149,3157,3158,3160,3162,3168,3171,3174,3183,3200,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3260,3268,3270,3272,3274,3277,3285,3286,3294,3294,3296,3299,3302,3311,3313,3314,3328,3331,3333,3340,3342,3344,3346,3396,3398,3400,3402,3406,3412,3415,3423,3427,3430,3439,3450,3455,3458,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3530,3530,3535,3540,3542,3542,3544,3551,3558,3567,3570,3571,3585,3642,3648,3662,3664,3673,3713,3714,3716,3716,3718,3722,3724,3747,3749,3749,3751,3773,3776,3780,3782,3782,3784,3789,3792,3801,3804,3807,3840,3840,3864,3865,3872,3881,3893,3893,3895,3895,3897,3897,3902,3911,3913,3948,3953,3972,3974,3991,3993,4028,4038,4038,4096,4169,4176,4253,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4957,4959,4969,4977,4992,5007,5024,5109,5112,5117,5121,5740,5743,5759,5761,5786,5792,5866,5870,5880,5888,5900,5902,5908,5920,5940,5952,5971,5984,5996,5998,6e3,6002,6003,6016,6099,6103,6103,6108,6109,6112,6121,6155,6157,6160,6169,6176,6264,6272,6314,6320,6389,6400,6430,6432,6443,6448,6459,6470,6509,6512,6516,6528,6571,6576,6601,6608,6618,6656,6683,6688,6750,6752,6780,6783,6793,6800,6809,6823,6823,6832,6845,6912,6987,6992,7001,7019,7027,7040,7155,7168,7223,7232,7241,7245,7293,7296,7304,7312,7354,7357,7359,7376,7378,7380,7418,7424,7673,7675,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8255,8256,8276,8276,8305,8305,8319,8319,8336,8348,8400,8412,8417,8417,8421,8432,8450,8450,8455,8455,8458,8467,8469,8469,8472,8477,8484,8484,8486,8486,8488,8488,8490,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11647,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11744,11775,12293,12295,12321,12335,12337,12341,12344,12348,12353,12438,12441,12447,12449,12538,12540,12543,12549,12591,12593,12686,12704,12730,12784,12799,13312,19893,19968,40943,40960,42124,42192,42237,42240,42508,42512,42539,42560,42607,42612,42621,42623,42737,42775,42783,42786,42888,42891,42943,42946,42950,42999,43047,43072,43123,43136,43205,43216,43225,43232,43255,43259,43259,43261,43309,43312,43347,43360,43388,43392,43456,43471,43481,43488,43518,43520,43574,43584,43597,43600,43609,43616,43638,43642,43714,43739,43741,43744,43759,43762,43766,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43824,43866,43868,43879,43888,44010,44012,44013,44016,44025,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65024,65039,65056,65071,65075,65076,65101,65103,65136,65140,65142,65276,65296,65305,65313,65338,65343,65343,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500,65536,65547,65549,65574,65576,65594,65596,65597,65599,65613,65616,65629,65664,65786,65856,65908,66045,66045,66176,66204,66208,66256,66272,66272,66304,66335,66349,66378,66384,66426,66432,66461,66464,66499,66504,66511,66513,66517,66560,66717,66720,66729,66736,66771,66776,66811,66816,66855,66864,66915,67072,67382,67392,67413,67424,67431,67584,67589,67592,67592,67594,67637,67639,67640,67644,67644,67647,67669,67680,67702,67712,67742,67808,67826,67828,67829,67840,67861,67872,67897,67968,68023,68030,68031,68096,68099,68101,68102,68108,68115,68117,68119,68121,68149,68152,68154,68159,68159,68192,68220,68224,68252,68288,68295,68297,68326,68352,68405,68416,68437,68448,68466,68480,68497,68608,68680,68736,68786,68800,68850,68864,68903,68912,68921,69376,69404,69415,69415,69424,69456,69600,69622,69632,69702,69734,69743,69759,69818,69840,69864,69872,69881,69888,69940,69942,69951,69956,69958,69968,70003,70006,70006,70016,70084,70089,70092,70096,70106,70108,70108,70144,70161,70163,70199,70206,70206,70272,70278,70280,70280,70282,70285,70287,70301,70303,70312,70320,70378,70384,70393,70400,70403,70405,70412,70415,70416,70419,70440,70442,70448,70450,70451,70453,70457,70459,70468,70471,70472,70475,70477,70480,70480,70487,70487,70493,70499,70502,70508,70512,70516,70656,70730,70736,70745,70750,70751,70784,70853,70855,70855,70864,70873,71040,71093,71096,71104,71128,71133,71168,71232,71236,71236,71248,71257,71296,71352,71360,71369,71424,71450,71453,71467,71472,71481,71680,71738,71840,71913,71935,71935,72096,72103,72106,72151,72154,72161,72163,72164,72192,72254,72263,72263,72272,72345,72349,72349,72384,72440,72704,72712,72714,72758,72760,72768,72784,72793,72818,72847,72850,72871,72873,72886,72960,72966,72968,72969,72971,73014,73018,73018,73020,73021,73023,73031,73040,73049,73056,73061,73063,73064,73066,73102,73104,73105,73107,73112,73120,73129,73440,73462,73728,74649,74752,74862,74880,75075,77824,78894,82944,83526,92160,92728,92736,92766,92768,92777,92880,92909,92912,92916,92928,92982,92992,92995,93008,93017,93027,93047,93053,93071,93760,93823,93952,94026,94031,94087,94095,94111,94176,94177,94179,94179,94208,100343,100352,101106,110592,110878,110928,110930,110948,110951,110960,111355,113664,113770,113776,113788,113792,113800,113808,113817,113821,113822,119141,119145,119149,119154,119163,119170,119173,119179,119210,119213,119362,119364,119808,119892,119894,119964,119966,119967,119970,119970,119973,119974,119977,119980,119982,119993,119995,119995,119997,120003,120005,120069,120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,120132,120134,120134,120138,120144,120146,120485,120488,120512,120514,120538,120540,120570,120572,120596,120598,120628,120630,120654,120656,120686,120688,120712,120714,120744,120746,120770,120772,120779,120782,120831,121344,121398,121403,121452,121461,121461,121476,121476,121499,121503,121505,121519,122880,122886,122888,122904,122907,122913,122915,122916,122918,122922,123136,123180,123184,123197,123200,123209,123214,123214,123584,123641,124928,125124,125136,125142,125184,125259,125264,125273,126464,126467,126469,126495,126497,126498,126500,126500,126503,126503,126505,126514,126516,126519,126521,126521,126523,126523,126530,126530,126535,126535,126537,126537,126539,126539,126541,126543,126545,126546,126548,126548,126551,126551,126553,126553,126555,126555,126557,126557,126559,126559,126561,126562,126564,126564,126567,126570,126572,126578,126580,126583,126585,126588,126590,126590,126592,126601,126603,126619,126625,126627,126629,126633,126635,126651,131072,173782,173824,177972,177984,178205,178208,183969,183984,191456,194560,195101,917760,917999],gi=/^\/\/\/?\s*@(ts-expect-error|ts-ignore)/,hi=/^(?:\/|\*)*\s*@(ts-expect-error|ts-ignore)/,r=[],oi.forEach(function(e,t){r[e]=t}),yA=r,xi="<<<<<<<".length,bi=/^#!.*/,ki=String.prototype.codePointAt?function(e,t){return e.codePointAt(t)}:function(e,t){var r=e.length;if(!(t<0||r<=t)){var n=e.charCodeAt(t);if(55296<=n&&n<=56319&&t+1=e.start&&t=e.pos&&t<=e.end}function yo(e,t){return t.start>=e.start&&TA(t)<=TA(e)}function vo(e,t){return void 0!==go(e,t)}function go(e,t){t=To(e,t);return t&&0===t.length?void 0:t}function ho(e,t){return bo(e.start,e.length,t.start,t.length)}function xo(e,t,r){return bo(e.start,e.length,t,r)}function bo(e,t,r,n){return r<=e+t&&e<=r+n}function ko(e,t){return t<=TA(e)&&t>=e.start}function To(e,t){var r=Math.max(e.start,t.start),t=Math.min(TA(e),TA(t));return r<=t?wo(r,t):void 0}function So(e,t){if(e<0)throw new Error("start < 0");if(t<0)throw new Error("length < 0");return{start:e,length:t}}function wo(e,t){return So(e,t-e)}function Co(e){return So(e.span.start,e.newLength)}function No(e){return mo(e.span)&&0===e.newLength}function Do(e,t){if(t<0)throw new Error("newLength < 0");return{span:e,newLength:t}}function Ao(e){if(0===e.length)return co;if(1===e.length)return e[0];for(var t=e[0],r=t.span.start,n=TA(t.span),a=r+t.newLength,i=1;i=n.pos,"This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809"),rA.assert(i<=n.end,"This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809")),wo(i,n.end)}function _P(e){return void 0!==(e.externalModuleIndicator||e.commonJsModuleIndicator)}function lP(e){return 6===e.scriptKind}function dP(e){return!!(2048&DA(e))}function fP(e){return!(!(64&DA(e))||CA(e,e.parent))}function L_(e){return 6==(7&AA(e))}function M_(e){return 4==(7&AA(e))}function R_(e){return 2==(7&AA(e))}function j_(e){return 1==(7&AA(e))}function pP(e){return 213===e.kind&&108===e.expression.kind}function mP(e){return 213===e.kind&&102===e.expression.kind}function B_(e){return xj(e)&&102===e.keywordToken&&"meta"===e.name.escapedText}function yP(e){return ZR(e)&&YR(e.argument)&&hR(e.argument.literal)}function J_(e){return 244===e.kind&&11===e.expression.kind}function z_(e){return!!(2097152&p_(e))}function U_(e){return z_(e)&&Fj(e)}function V_(e){return xR(e.name)&&!e.initializer}function q_(e){return z_(e)&&Tj(e)&&XN(e.declarationList.declarations,V_)}function W_(e,t){return 12!==e.kind?$i(t.text,e.pos):void 0}function H_(e,t){return nD(169===e.kind||168===e.kind||218===e.kind||219===e.kind||217===e.kind||260===e.kind||281===e.kind?fD(eo(t,e.pos),$i(t,e.pos)):$i(t,e.pos),function(e){return 42===t.charCodeAt(e.pos+1)&&42===t.charCodeAt(e.pos+2)&&47!==t.charCodeAt(e.pos+3)})}function vP(e){if(182<=e.kind&&e.kind<=205)return!0;switch(e.kind){case 133:case 159:case 150:case 163:case 154:case 136:case 155:case 151:case 157:case 106:case 146:return!0;case 116:return 222!==e.parent.kind;case 233:return nB(e.parent)&&!DL(e);case 168:return 200===e.parent.kind||195===e.parent.kind;case 80:(166===e.parent.kind&&e.parent.right===e||211===e.parent.kind&&e.parent.name===e)&&(e=e.parent),rA.assert(80===e.kind||166===e.kind||211===e.kind,"'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");case 166:case 211:case 110:var t=e.parent;if(186===t.kind)return!1;if(205===t.kind)return!t.isTypeOf;if(182<=t.kind&&t.kind<=205)return!0;switch(t.kind){case 233:return nB(t.parent)&&!DL(t);case 168:case 352:return e===t.constraint;case 172:case 171:case 169:case 260:return e===t.type;case 262:case 218:case 219:case 176:case 174:case 173:case 177:case 178:return e===t.type;case 179:case 180:case 181:case 216:return e===t.type;case 213:case 214:case 215:return eD(t.typeArguments,e)}}return!1}function K_(e,t){for(;e;){if(e.kind===t)return!0;e=e.parent}return!1}function gP(e,r){return function e(t){switch(t.kind){case 253:return r(t);case 269:case 241:case 245:case 246:case 247:case 248:case 249:case 250:case 254:case 255:case 296:case 297:case 256:case 258:case 299:return HB(t,e)}}(e)}function hP(e,n){return function e(t){switch(t.kind){case 229:n(t);var r=t.expression;return void(r&&e(r));case 266:case 264:case 267:case 265:return;default:if(bE(t)){if(t.name&&167===t.name.kind)return void e(t.name.expression)}else vP(t)||HB(t,e)}}(e)}function xP(e){return e&&188===e.kind?e.elementType:e&&183===e.kind?pa(e.typeArguments):void 0}function bP(e){switch(e.kind){case 264:case 263:case 231:case 187:return e.members;case 210:return e.properties}}function kP(e){if(e)switch(e.kind){case 208:case 306:case 169:case 303:case 172:case 171:case 304:case 260:return!0}return!1}function TP(e){return kP(e)||DE(e)}function SP(e){return 261===e.parent.kind&&243===e.parent.parent.kind}function wP(e){return!!cI(e)&&(nj(e.parent)&&mj(e.parent.parent)&&2===NI(e.parent.parent)||CP(e.parent))}function CP(e){return!!cI(e)&&(mj(e)&&1===NI(e))}function NP(e){return(Aj(e)?R_(e)&&xR(e.name)&&SP(e):AR(e)?vL(e)&&dL(e):DR(e)&&vL(e))||CP(e)}function DP(e){switch(e.kind){case 174:case 173:case 176:case 177:case 178:case 262:case 218:return!0}return!1}function G_(e,t){for(;;){if(t&&t(e),256!==e.statement.kind)return e.statement;e=e.statement}}function X_(e){return e&&241===e.kind&&bE(e.parent)}function AP(e){return e&&174===e.kind&&210===e.parent.kind}function EP(e){return!(174!==e.kind&&177!==e.kind&&178!==e.kind||210!==e.parent.kind&&231!==e.parent.kind)}function FP(e){return e&&1===e.kind}function Q_(e){return e&&0===e.kind}function Y_(e,r,n,a){return KN(null==e?void 0:e.properties,function(e){if(iB(e)){var t=E_(e.name);return r===t||a&&a===t?n(e):void 0}})}function Z_(e,t,r){return Y_(e,t,function(e){return rj(e.initializer)?QN(e.initializer.elements,function(e){return hR(e)&&e.text===r}):void 0})}function $_(e){if(e&&e.statements.length)return BD(e.statements[0].expression,nj)}function el(e,t,r){return tl(e,t,function(e){return rj(e.initializer)?QN(e.initializer.elements,function(e){return hR(e)&&e.text===r}):void 0})}function tl(e,t,r){return Y_($_(e),t,r)}function PP(e){return FA(e.parent,bE)}function rl(e){return FA(e.parent,TE)}function IP(e){return FA(e.parent,NE)}function OP(e){return FA(e.parent,function(e){return NE(e)||bE(e)?"quit":PR(e)})}function LP(e){return FA(e.parent,kE)}function MP(e){var t=FA(e.parent,function(e){return NE(e)?"quit":NR(e)});return t&&NE(t.parent)?IP(t.parent):IP(null!=t?t:e)}function RP(e,t,r){for(rA.assert(312!==e.kind);;){if(!(e=e.parent))return rA.fail();switch(e.kind){case 167:if(r&&NE(e.parent.parent))return e;e=e.parent.parent;break;case 170:169===e.parent.kind&&CE(e.parent.parent)?e=e.parent.parent:CE(e.parent)&&(e=e.parent);break;case 219:if(!t)continue;case 262:case 218:case 267:case 175:case 172:case 171:case 174:case 173:case 176:case 177:case 178:case 179:case 180:case 181:case 266:case 312:return e}}}function jP(e){switch(e.kind){case 219:case 262:case 218:case 172:return!0;case 241:switch(e.parent.kind){case 176:case 174:case 177:case 178:return!0;default:return!1}default:return!1}}function BP(e){return xR(e)&&(Pj(e.parent)||Fj(e.parent))&&e.parent.name===e&&(e=e.parent),uB(RP(e,!0,!1))}function JP(e){var t=RP(e,!1,!1);if(t)switch(t.kind){case 176:case 262:case 218:return t}}function zP(e,t){for(;;){if(!(e=e.parent))return;switch(e.kind){case 167:e=e.parent;break;case 262:case 218:case 219:if(!t)continue;case 172:case 171:case 174:case 173:case 176:case 177:case 178:case 175:return e;case 170:169===e.parent.kind&&CE(e.parent.parent)?e=e.parent.parent:CE(e.parent)&&(e=e.parent)}}}function UP(e){if(218===e.kind||219===e.kind){for(var t=e,r=e.parent;217===r.kind;)r=(t=r).parent;if(213===r.kind&&r.expression===t)return r}}function nl(e){return 108===e.kind||VP(e)}function VP(e){var t=e.kind;return(211===t||212===t)&&108===e.expression.kind}function qP(e){var t=e.kind;return(211===t||212===t)&&110===e.expression.kind}function WP(e){return!!e&&Aj(e)&&110===(null==(e=e.initializer)?void 0:e.kind)}function HP(e){return!!e&&(oB(e)||iB(e))&&mj(e.parent.parent)&&64===e.parent.parent.operatorToken.kind&&110===e.parent.parent.right.kind}function KP(e){switch(e.kind){case 183:return e.typeName;case 233:return AL(e.expression)?e.expression:void 0;case 80:case 166:return e}}function GP(e){switch(e.kind){case 215:return e.tag;case 286:case 285:return e.tagName;default:return e.expression}}function XP(e,t,r,n){if(e&&BA(t)&&bR(t.name))return!1;switch(t.kind){case 263:return!0;case 231:return!e;case 172:return void 0!==r&&(e?Pj(r):NE(r)&&!pL(t)&&!mL(t));case 177:case 178:case 174:return void 0!==t.body&&void 0!==r&&(e?Pj:NE)(r);case 169:return e?void 0!==r&&void 0!==r.body&&(176===r.kind||174===r.kind||178===r.kind)&&YO(r)!==t&&void 0!==n&&263===n.kind:!1}return!1}function al(e,t,r,n){return gL(t)&&XP(e,t,r,n)}function il(e,t,r,n){return al(e,t,r,n)||ol(e,t,r)}function ol(t,r,n){switch(r.kind){case 263:return dD(r.members,function(e){return il(t,e,r,n)});case 231:return!t&&dD(r.members,function(e){return il(t,e,r,n)});case 174:case 178:case 176:return dD(r.parameters,function(e){return al(t,e,r,n)});default:return!1}}function QP(e,t){if(al(e,t))return!0;var r=XO(t);return!!r&&ol(e,r,t)}function YP(e,t,r){var n,a,i;if(DE(t)){var o=rL(r.members,t),s=o.firstAccessor,c=o.secondAccessor,o=o.setAccessor,c=gL(s)?s:c&&gL(c)?c:void 0;if(!c||t!==c)return!1;i=null==o?void 0:o.parameters}else FR(t)&&(i=t.parameters);if(al(e,t,r))return!0;if(i)try{for(var u=__values(i),_=u.next();!_.done;_=u.next()){var l=_.value;if(!ZO(l)&&al(e,l,t,r))return!0}}catch(e){n={error:e}}finally{try{_&&!_.done&&(a=u.return)&&a.call(u)}finally{if(n)throw n.error}}return!1}function sl(e){if(e.textSourceNode){switch(e.textSourceNode.kind){case 11:return sl(e.textSourceNode);case 15:return""===e.text}return!1}return""===e.text}function ZP(e){var t=e.parent;return(286===t.kind||285===t.kind||287===t.kind)&&t.tagName===e}function $P(e){switch(e.kind){case 108:case 106:case 112:case 97:case 14:case 209:case 210:case 211:case 212:case 213:case 214:case 215:case 234:case 216:case 238:case 235:case 217:case 218:case 231:case 219:case 222:case 220:case 221:case 224:case 225:case 226:case 227:case 230:case 228:case 232:case 284:case 285:case 288:case 229:case 223:case 236:return!0;case 233:return!nB(e.parent)&&!kB(e.parent);case 166:for(;166===e.parent.kind;)e=e.parent;return 186===e.parent.kind||sF(e.parent)||lB(e.parent)||dB(e.parent)||ZP(e);case 318:for(;dB(e.parent);)e=e.parent;return 186===e.parent.kind||sF(e.parent)||lB(e.parent)||dB(e.parent)||ZP(e);case 81:return mj(e.parent)&&e.parent.left===e&&103===e.parent.operatorToken.kind;case 80:if(186===e.parent.kind||sF(e.parent)||lB(e.parent)||dB(e.parent)||ZP(e))return!0;case 9:case 10:case 11:case 15:case 110:return eI(e);default:return!1}}function eI(e){var t=e.parent;switch(t.kind){case 260:case 169:case 172:case 171:case 306:case 303:case 208:return t.initializer===e;case 244:case 245:case 246:case 247:case 253:case 254:case 255:case 296:case 257:return t.expression===e;case 248:return t.initializer===e&&261!==t.initializer.kind||t.condition===e||t.incrementor===e;case 249:case 250:return t.initializer===e&&261!==t.initializer.kind||t.expression===e;case 216:case 234:case 239:case 167:return e===t.expression;case 170:case 294:case 293:case 305:return!0;case 233:return t.expression===e&&!vP(t);case 304:return t.objectAssignmentInitializer===e;case 238:return e===t.expression;default:return $P(t)}}function tI(e){for(;166===e.kind||80===e.kind;)e=e.parent;return 186===e.kind}function rI(e){return Uj(e)&&!!e.parent.moduleSpecifier}function nI(e){return 271===e.kind&&283===e.moduleReference.kind}function aI(e){return rA.assert(nI(e)),e.moduleReference.expression}function iI(e){return fI(e)&&XL(e.initializer).arguments[0]}function oI(e){return 271===e.kind&&283!==e.moduleReference.kind}function sI(e){return cI(e)}function cl(e){return!cI(e)}function cI(e){return!!e&&!!(524288&e.flags)}function uI(e){return!!e&&!!(134217728&e.flags)}function ul(e){return!lP(e)}function _I(e){return!!e&&!!(16777216&e.flags)}function lI(e){return BR(e)&&xR(e.typeName)&&"Object"===e.typeName.escapedText&&e.typeArguments&&2===e.typeArguments.length&&(154===e.typeArguments[0].kind||150===e.typeArguments[0].kind)}function dI(e,t){if(213!==e.kind)return!1;var r=e.expression,e=e.arguments;if(80!==r.kind||"require"!==r.escapedText)return!1;if(1!==e.length)return!1;e=e[0];return!t||oF(e)}function _l(e){return ll(e,!1)}function fI(e){return ll(e,!0)}function pI(e){return tj(e)&&fI(e.parent.parent)}function ll(e,t){return Aj(e)&&!!e.initializer&&dI(t?XL(e.initializer):e.initializer,!0)}function dl(e){return Tj(e)&&0Aa(t)&&!n(t)&&(e(lA(t),r,n),r(t))}(lA(pi(t)),i,o),a(t,r,n)}}function Ld(e,t){return Li(Ii(e),t)}function Md(e,t){return Li(e,t)}function XO(e){return QN(e.members,function(e){return IR(e)&&FF(e.body)})}function QO(e){if(e&&0>6|192),t.push(63&a|128)):a<65536?(t.push(a>>12|224),t.push(a>>6&63|128),t.push(63&a|128)):a<131072?(t.push(a>>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(63&a|128)):rA.assert(!1,"Unexpected code point")}return t}(e),s=0,c=o.length;s>2,r=(3&o[s])<<4|o[s+1]>>4,n=(15&o[s+1])<<2|o[s+2]>>6,a=63&o[s+2],c<=s+1?n=a=64:c<=s+2&&(a=64),i+=ru.charAt(t)+ru.charAt(r)+ru.charAt(n)+ru.charAt(a),s+=3;return i}function df(e,t){return e&&e.base64encode?e.base64encode(t):lf(t)}function ff(e,t){if(e&&e.base64decode)return e.base64decode(t);for(var r=t.length,n=[],a=0;a>4&3,i=(15&o)<<4|s>>2&15,o=(3&s)<<6|63&c;0==i&&0!==s?n.push(u):0==o&&0!==c?n.push(u,i):n.push(u,i,o),a+=4}return function(e){for(var t="",r=0,n=e.length;rt;)if(!Ri(r.text.charCodeAt(e)))return e}(e,t,r);return Mi(r,null!=n?n:t,e)}function Mf(e,t,r,n){n=xA(r.text,e,!1,n);return Mi(r,e,Math.min(t,n))}function Rf(e){var t=PA(e);if(t)switch(t.parent.kind){case 266:case 267:return t===t.parent.name}return!1}function jf(e){return nD(e.declarations,Bf)}function Bf(e){return Aj(e)&&void 0!==e.initializer}function Jf(e){return e.watch&&ma(e,"watch")}function zf(e){e.close()}function BL(e){return 33554432&e.flags?e.links.checkFlags:0}function JL(e,t){if(void 0===t&&(t=!1),e.valueDeclaration){var r=DA(t&&e.declarations&&QN(e.declarations,LR)||32768&e.flags&&QN(e.declarations,OR)||e.valueDeclaration);return e.parent&&32&e.parent.flags?r:-29&r}if(6&BL(e)){r=e.links.checkFlags;return(1024&r?8:256&r?4:16)|(2048&r?32:0)}return 4194304&e.flags?36:0}function Uf(e,t){return 2097152&e.flags?t.getAliasedSymbol(e):e}function zL(e){return e.exportSymbol?e.exportSymbol.flags|e.flags:e.flags}function UL(e){return 1===Vf(e)}function VL(e){return 0!==Vf(e)}function Vf(e){var t=e.parent;switch(null==t?void 0:t.kind){case 217:return Vf(t);case 225:case 224:var r=t.operator;return 46===r||47===r?2:0;case 226:var r=t.left,n=t.operatorToken;return r===e&&wL(n.kind)?64===n.kind?1:2:0;case 211:return t.name!==e?0:Vf(t);case 303:n=Vf(t.parent);return e===t.name?function(e){switch(e){case 0:return 1;case 1:return 0;case 2:return 2;default:return rA.assertNever(e)}}(n):n;case 304:return e===t.objectAssignmentInitializer?0:Vf(t.parent);case 209:return Vf(t);default:return 0}}function qf(e,t){if(!e||!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(var r in e)if("object"==typeof e[r]){if(!qf(e[r],t[r]))return!1}else if("function"!=typeof e[r]&&e[r]!==t[r])return!1;return!0}function Wf(e,t){e.forEach(t),e.clear()}function Hf(n,a,e){var i=e.onDeleteValue,o=e.onExistingValue;n.forEach(function(e,t){var r=a.get(t);void 0===r?(n.delete(t),i(e,t)):o&&o(e,r,t)})}function Kf(r,e,t){Hf(r,e,t);var n=t.createNewValue;e.forEach(function(e,t){r.has(t)||r.set(t,n(t,e))})}function Gf(e){if(32&e.flags){e=qL(e);return!!e&&_L(e,256)}return!1}function qL(e){return null==(e=e.declarations)?void 0:e.find(NE)}function WL(e){return 138117121&e.flags?e.objectFlags:0}function Xf(e,t){return!!ti(e,function(e){return!!t(e)||void 0})}function HL(e){return!!e&&!!e.declarations&&!!e.declarations[0]&&jj(e.declarations[0])}function Qf(e){e=e.moduleSpecifier;return hR(e)?e.text:PF(e)}function Yf(e){var r;return HB(e,function(e){FF(e)&&(r=e)},function(e){for(var t=e.length-1;0<=t;t--)if(FF(e[t])){r=e[t];break}}),r}function Zf(e,t,r){return void 0===r&&(r=!0),!e.has(t)&&(e.set(t,r),!0)}function $f(e){return NE(e)||Ij(e)||VR(e)}function KL(e){return 182<=e&&e<=205||133===e||159===e||150===e||163===e||151===e||136===e||154===e||155===e||116===e||157===e||146===e||141===e||233===e||319===e||320===e||321===e||322===e||323===e||324===e||325===e}function GL(e){return 211===e.kind||212===e.kind}function ep(e){return 211===e.kind?e.name:(rA.assert(212===e.kind),e.argumentExpression)}function tp(e){switch(e.kind){case"text":case"internal":return!0;default:return!1}}function rp(e){return 275===e.kind||279===e.kind}function XL(e){for(;GL(e);)e=e.expression;return e}function np(e,n){if(GL(e.parent)&&cf(e))return function e(t){if(211===t.kind){var r=n(t.name);if(void 0!==r)return r}else if(212===t.kind){if(!xR(t.argumentExpression)&&!oF(t.argumentExpression))return;var r=n(t.argumentExpression);if(void 0!==r)return r}if(GL(t.expression))return e(t.expression);if(xR(t.expression))return n(t.expression);return}(e.parent)}function ap(e,t){for(;;){switch(e.kind){case 225:e=e.operand;continue;case 226:e=e.left;continue;case 227:e=e.condition;continue;case 215:e=e.tag;continue;case 213:if(t)return e;case 234:case 212:case 211:case 235:case 360:case 238:e=e.expression;continue}return e}}function ip(e,t){this.flags=e,this.escapedName=t,this.declarations=void 0,this.valueDeclaration=void 0,this.id=0,this.mergeId=0,this.parent=void 0,this.members=void 0,this.exports=void 0,this.exportSymbol=void 0,this.constEnumOnlyModule=void 0,this.isReferenced=void 0,this.isAssigned=void 0,this.links=void 0}function op(e,t){this.flags=t,(rA.isDebugging||iA)&&(this.checker=e)}function sp(e,t){this.flags=t,rA.isDebugging&&(this.checker=e)}function cp(e,t,r){this.pos=t,this.end=r,this.kind=e,this.id=0,this.flags=0,this.modifierFlagsCache=0,this.transformFlags=0,this.parent=void 0,this.original=void 0,this.emitNode=void 0}function up(e,t,r){this.pos=t,this.end=r,this.kind=e,this.id=0,this.flags=0,this.transformFlags=0,this.parent=void 0,this.emitNode=void 0}function _p(e,t,r){this.pos=t,this.end=r,this.kind=e,this.id=0,this.flags=0,this.transformFlags=0,this.parent=void 0,this.original=void 0,this.emitNode=void 0}function lp(e,t,r){this.fileName=e,this.text=t,this.skipTrivia=r||function(e){return e}}function dp(e){iu.push(e),e(pF)}function fp(e){Object.assign(pF,e),KN(iu,function(e){return e(pF)})}function pp(e,r,n){return void 0===n&&(n=0),e.replace(/{(\d+)}/g,function(e,t){return""+rA.checkDefined(r[+t+n])})}function mp(e){ou=e}function yp(e){!ou&&e&&(ou=e())}function vp(e){return ou&&ou[e.key]||e.message}function gp(e,t,r,n){P_(void 0,t,r);var a=vp(n);return 4r.next.length)return 1}return 0}(e.messageText,t.messageText)||0}function Tp(e){return 4===e||2===e||1===e||6===e?1:0}function Sp(e){if(2&e.transformFlags)return YE(e)||_h(e)?e:HB(e,Sp)}function wp(e){return e.isDeclarationFile?void 0:Sp(e)}function Cp(e){return!(99!==e.impliedNodeFormat&&!_A(e.fileName,[".cjs",".cts",".mjs",".mts"])||e.isDeclarationFile)||void 0}function Np(e){switch(Dp(e)){case 3:return function(e){e.externalModuleIndicator=lb(e)||!e.isDeclarationFile||void 0};case 1:return function(e){e.externalModuleIndicator=lb(e)};case 2:var t=[lb];4!==e.jsx&&5!==e.jsx||t.push(wp),t.push(Cp);var r=ZD.apply(void 0,__spreadArray([],__read(t),!1));return function(e){e.externalModuleIndicator=r(e)}}}function rM(e){var t;return null!==(t=e.target)&&void 0!==t?t:(100===e.module?9:199===e.module&&99)||1}function nM(e){return"number"==typeof e.module?e.module:2<=rM(e)?5:1}function aM(e){return 5<=e&&e<=99}function iM(e){var t=e.moduleResolution;if(void 0===t)switch(nM(e)){case 1:t=2;break;case 100:t=3;break;case 199:t=99;break;default:t=1}return t}function Dp(e){return e.moduleDetection||(100===nM(e)||199===nM(e)?3:2)}function oM(e){switch(nM(e)){case 1:case 2:case 5:case 6:case 7:case 99:case 100:case 199:return!0;default:return!1}}function sM(e){return!(!e.isolatedModules&&!e.verbatimModuleSyntax)}function Ap(e){return e.verbatimModuleSyntax||e.isolatedModules&&e.preserveValueImports}function Ep(e){return!1===e.allowUnreachableCode}function Fp(e){return!1===e.allowUnusedLabels}function Pp(e){return!(!dM(e)||!e.declarationMap)}function cM(e){if(void 0!==e.esModuleInterop)return e.esModuleInterop;switch(nM(e)){case 100:case 199:return!0}}function uM(e){return void 0!==e.allowSyntheticDefaultImports?e.allowSyntheticDefaultImports:cM(e)||4===nM(e)||100===iM(e)}function Ip(e){return 3<=e&&e<=99||100===e}function _M(e){return!!e.noDtsResolution||100!==iM(e)}function Op(e){var t=iM(e);if(!Ip(t))return!1;if(void 0!==e.resolvePackageJsonExports)return e.resolvePackageJsonExports;switch(t){case 3:case 99:case 100:return!0}return!1}function Lp(e){var t=iM(e);if(!Ip(t))return!1;if(void 0!==e.resolvePackageJsonExports)return e.resolvePackageJsonExports;switch(t){case 3:case 99:case 100:return!0}return!1}function lM(e){return void 0!==e.resolveJsonModule?e.resolveJsonModule:100===iM(e)}function dM(e){return!(!e.declaration&&!e.composite)}function fM(e){return!(!e.preserveConstEnums&&!sM(e))}function Mp(e){return!(!e.incremental&&!e.composite)}function pM(e,t){return void 0===e[t]?!!e.strict:!!e[t]}function Rp(e){return void 0===e.allowJs?!!e.checkJs:e.allowJs}function mM(e){return void 0===e.useDefineForClassFields?9<=rM(e):e.useDefineForClassFields}function yM(e){return!1!==e.useDefineForClassFields&&9<=rM(e)}function jp(e,t){return Ou(t,e,$b)}function Bp(e,t){return Ou(t,e,ek)}function Jp(e,t){return Ou(t,e,tk)}function zp(e,t){return t.strictFlag?pM(e,t.name):e[t.name]}function vM(e){e=e.jsx;return 2===e||4===e||5===e}function gM(e,t){t=null==t?void 0:t.pragmas.get("jsximportsource"),t=RD(t)?t[t.length-1]:t;return 4===e.jsx||5===e.jsx||e.jsxImportSource||t?(null==t?void 0:t.arguments.factory)||e.jsxImportSource||"react":void 0}function hM(e,t){return e?"".concat(e,"/").concat(5===t.jsx?"jsx-dev-runtime":"jsx-runtime"):void 0}function Up(e){for(var t=!1,r=0;r>>4)+(15&i?1:0)),s=a-1,c=0;2<=s;s--,c+=t){var u=c>>>4,_=e.charCodeAt(s),_=(_<=57?_-48:10+_-(_<=70?65:97))<<(15&c);o[u]|=_;_=_>>>16;_&&(o[u+1]|=_)}for(var l="",d=o.length-1,f=!0;f;){for(var p=0,f=!1,u=d;0<=u;u--){var m=p<<16|o[u],y=m/10|0,p=m-10*(o[u]=y);y&&!f&&(d=u,f=!0)}l=p+l}return l}function EM(e){var t=e.negative,e=e.base10Value;return(t&&"0"!==e?"-":"")+e}function Cm(e){if(PM(e,!1))return FM(e)}function FM(e){var t=e.startsWith("-");return{negative:t,base10Value:AM("".concat(t?e.slice(1):e,"n"))}}function PM(e,t){if(""===e)return!1;var r=ao(99,!1),n=!0;r.setOnError(function(){return n=!1}),r.setText(e+"n");var a=r.scan(),i=41===a;i&&(a=r.scan());var o=r.getTokenFlags();return n&&10===a&&r.getTokenEnd()===e.length+1&&!(512&o)&&(!t||e===EM({negative:i,base10Value:AM(r.getTokenValue())}))}function IM(e){return!!(33554432&e.flags)||tI(e)||function(e){if(80!==e.kind)return!1;e=FA(e.parent,function(e){switch(e.kind){case 298:return!0;case 211:case 233:return!1;default:return"quit"}});return 119===(null==e?void 0:e.token)||264===(null==e?void 0:e.parent.kind)}(e)||function(e){for(;80===e.kind||211===e.kind;)e=e.parent;if(167!==e.kind)return!1;if(_L(e.parent,256))return!0;var t=e.parent.parent.kind;return 264===t||187===t}(e)||!($P(e)||xR(e=e)&&oB(e.parent)&&e.parent.name===e)}function OM(e){return BR(e)&&xR(e.typeName)}function LM(e,t){if(void 0===t&&(t=zD),e.length<2)return!0;for(var r=e[0],n=1,a=e.length;n/,Rc=/^(\/\/\/\s*/,jc=/^(\/\/\/\s*/,Bc=/^(\/\/\/\s*/,Jc=/^\/\/\/\s*/,zc=/^(\/\/\/\s*/,Uc=function(e){return e[e.None=0]="None",e[e.Definite=1]="Definite",e[e.Compound=2]="Compound",e}(Uc||{}),Vc=function(e){return e[e.Normal=0]="Normal",e[e.Generator=1]="Generator",e[e.Async=2]="Async",e[e.Invalid=4]="Invalid",e[e.AsyncGenerator=3]="AsyncGenerator",e}(Vc||{}),qc=function(e){return e[e.Left=0]="Left",e[e.Right=1]="Right",e}(qc||{}),Wc=function(e){return e[e.Comma=0]="Comma",e[e.Spread=1]="Spread",e[e.Yield=2]="Yield",e[e.Assignment=3]="Assignment",e[e.Conditional=4]="Conditional",e[e.Coalesce=4]="Coalesce",e[e.LogicalOR=5]="LogicalOR",e[e.LogicalAND=6]="LogicalAND",e[e.BitwiseOR=7]="BitwiseOR",e[e.BitwiseXOR=8]="BitwiseXOR",e[e.BitwiseAND=9]="BitwiseAND",e[e.Equality=10]="Equality",e[e.Relational=11]="Relational",e[e.Shift=12]="Shift",e[e.Additive=13]="Additive",e[e.Multiplicative=14]="Multiplicative",e[e.Exponentiation=15]="Exponentiation",e[e.Unary=16]="Unary",e[e.Update=17]="Update",e[e.LeftHandSide=18]="LeftHandSide",e[e.Member=19]="Member",e[e.Primary=20]="Primary",e[e.Highest=20]="Highest",e[e.Lowest=0]="Lowest",e[e.Invalid=-1]="Invalid",e}(Wc||{}),Hc=/\$\{/g,Kc=/[\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g,Gc=/[\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g,Xc=/\r\n|[\\`\u0000-\u001f\t\v\f\b\r\u2028\u2029\u0085]/g,Qc=new Map(Object.entries({"\t":"\\t","\v":"\\v","\f":"\\f","\b":"\\b","\r":"\\r","\n":"\\n","\\":"\\\\",'"':'\\"',"'":"\\'","`":"\\`","\u2028":"\\u2028","\u2029":"\\u2029","…":"\\u0085","\r\n":"\\r\\n"})),Yc=/[^\u0000-\u007F]/g,Zc=/["\u0000-\u001f\u2028\u2029\u0085]/g,$c=/['\u0000-\u001f\u2028\u2029\u0085]/g,eu=new Map(Object.entries({'"':""","'":"'"})),tu=[""," "],ru="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",nu="\r\n",au="\n",pF={getNodeConstructor:function(){return cp},getTokenConstructor:function(){return up},getIdentifierConstructor:function(){return _p},getPrivateIdentifierConstructor:function(){return cp},getSourceFileConstructor:function(){return cp},getSymbolConstructor:function(){return ip},getTypeConstructor:function(){return op},getSignatureConstructor:function(){return sp},getSourceMapSourceConstructor:function(){return lp}},iu=[],su=/[^\w\s/]/g,cu=[42,63],_u="(?!(".concat((uu=["node_modules","bower_components","jspm_packages"]).join("|"),")(/|$))"),lu={singleAsteriskRegexFragment:"([^./]|(\\.(?!min\\.js$))?)*",doubleAsteriskRegexFragment:"(/".concat(_u,"[^/.][^/]*)*?"),replaceWildcardCharacter:function(e){return $p(e,lu.singleAsteriskRegexFragment)}},du={singleAsteriskRegexFragment:"[^/]*",doubleAsteriskRegexFragment:"(/".concat(_u,"[^/.][^/]*)*?"),replaceWildcardCharacter:function(e){return $p(e,du.singleAsteriskRegexFragment)}},pu={files:lu,directories:du,exclude:fu={singleAsteriskRegexFragment:"[^/]*",doubleAsteriskRegexFragment:"(/.+?)?",replaceWildcardCharacter:function(e){return $p(e,fu.singleAsteriskRegexFragment)}}},yu=sD(mu=[[".ts",".tsx",".d.ts"],[".cts",".d.cts"],[".mts",".d.mts"]]),vu=__spreadArray(__spreadArray([],__read(mu),!1),[[".json"]],!1),gu=[".d.ts",".d.cts",".d.mts",".cts",".mts",".ts",".tsx"],xu=sD(hu=[[".js",".jsx"],[".mjs"],[".cjs"]]),ku=__spreadArray(__spreadArray([],__read(bu=[[".ts",".tsx",".d.ts",".js",".jsx"],[".cts",".d.cts",".cjs"],[".mts",".d.mts",".mjs"]]),!1),[[".json"]],!1),Tu=[".d.ts",".d.cts",".d.mts"],Su=[".ts",".cts",".mts",".tsx"],wu=[".mts",".d.mts",".mjs",".cts",".d.cts",".cjs"],Cu=function(e){return e[e.Minimal=0]="Minimal",e[e.Index=1]="Index",e[e.JsExtension=2]="JsExtension",e[e.TsExtension=3]="TsExtension",e}(Cu||{}),Nu=[".d.ts",".d.mts",".d.cts",".mjs",".mts",".cjs",".cts",".ts",".js",".tsx",".jsx",".json"],Du={files:WN,directories:WN}}});function qm(){var t,r,n,a,i;return{createBaseSourceFileNode:function(e){return new(i=i||pF.getSourceFileConstructor())(e,-1,-1)},createBaseIdentifierNode:function(e){return new(n=n||pF.getIdentifierConstructor())(e,-1,-1)},createBasePrivateIdentifierNode:function(e){return new(a=a||pF.getPrivateIdentifierConstructor())(e,-1,-1)},createBaseTokenNode:function(e){return new(r=r||pF.getTokenConstructor())(e,-1,-1)},createBaseNode:function(e){return new(t=t||pF.getNodeConstructor())(e,-1,-1)}}}var Wm,Hm=e({"src/compiler/factory/baseNodeFactory.ts":function(){MK()}});function Km(a){var r,n;return{getParenthesizeLeftSideOfBinaryForOperator:function(t){r=r||new Map;var e=r.get(t);e||(e=function(e){return o(t,e)},r.set(t,e));return e},getParenthesizeRightSideOfBinaryForOperator:function(t){n=n||new Map;var e=n.get(t);e||(e=function(e){return s(t,void 0,e)},n.set(t,e));return e},parenthesizeLeftSideOfBinary:o,parenthesizeRightSideOfBinary:s,parenthesizeExpressionOfComputedPropertyName:function(e){return OB(e)?a.createParenthesizedExpression(e):e},parenthesizeConditionOfConditionalExpression:function(e){var t=cd(227,58);return 1===UD(od(vs(e)),t)?e:a.createParenthesizedExpression(e)},parenthesizeBranchOfConditionalExpression:function(e){return OB(vs(e))?a.createParenthesizedExpression(e):e},parenthesizeExpressionOfExportDefault:function(e){var t=vs(e),r=OB(t);if(!r)switch(ap(t,!1).kind){case 231:case 218:r=!0}return r?a.createParenthesizedExpression(e):e},parenthesizeExpressionOfNew:function(e){var t=ap(e,!0);switch(t.kind){case 213:return a.createParenthesizedExpression(e);case 214:return t.arguments?e:a.createParenthesizedExpression(e)}return u(e)},parenthesizeLeftSideOfAccess:u,parenthesizeOperandOfPostfixUnary:function(e){return RE(e)?e:UB(a.createParenthesizedExpression(e),e)},parenthesizeOperandOfPrefixUnary:function(e){return sc(e)?e:UB(a.createParenthesizedExpression(e),e)},parenthesizeExpressionsOfCommaDelimitedList:function(e){var t=oD(e,_);return UB(a.createNodeArray(t,e.hasTrailingComma),e)},parenthesizeExpressionForDisallowedComma:_,parenthesizeExpressionOfExpressionStatement:function(e){var t=vs(e);if(oj(t)){var r=t.expression,n=vs(r).kind;if(218===n||219===n){r=a.updateCallExpression(t,UB(a.createParenthesizedExpression(r),r),t.typeArguments,t.arguments);return a.restoreOuterExpressions(e,r,8)}}t=ap(t,!1).kind;return 210!==t&&218!==t?e:UB(a.createParenthesizedExpression(e),e)},parenthesizeConciseBodyOfArrowFunction:function(e){return kj(e)||!OB(e)&&210!==ap(e,!1).kind?e:UB(a.createParenthesizedExpression(e),e)},parenthesizeCheckTypeOfConditionalType:t,parenthesizeExtendsTypeOfConditionalType:function(e){if(194===e.kind)return a.createParenthesizedType(e);return e},parenthesizeConstituentTypesOfUnionType:function(e){return a.createNodeArray(oD(e,l))},parenthesizeConstituentTypeOfUnionType:l,parenthesizeConstituentTypesOfIntersectionType:function(e){return a.createNodeArray(oD(e,d))},parenthesizeConstituentTypeOfIntersectionType:d,parenthesizeOperandOfTypeOperator:f,parenthesizeOperandOfReadonlyTypeOperator:function(e){if(198===e.kind)return a.createParenthesizedType(e);return f(e)},parenthesizeNonArrayTypeOfPostfixType:p,parenthesizeElementTypesOfTupleType:function(e){return a.createNodeArray(oD(e,m))},parenthesizeElementTypeOfTupleType:m,parenthesizeTypeOfOptionalType:function(e){return y(e)?a.createParenthesizedType(e):p(e)},parenthesizeTypeArguments:function(e){if(dD(e))return a.createNodeArray(oD(e,g))},parenthesizeLeadingTypeArgument:v};function c(e){if(Ds((e=vs(e)).kind))return e.kind;if(226!==e.kind||40!==e.operatorToken.kind)return 0;if(void 0!==e.cachedLiteralKind)return e.cachedLiteralKind;var t=c(e.left),t=Ds(t)&&t===c(e.right)?t:0;return e.cachedLiteralKind=t}function i(e,t,r,n){return 217!==vs(t).kind&&function(e,t,r,n){var a=cd(226,e),i=id(226,e),o=vs(t);if(!r&&219===t.kind&&3= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };'}),priority:3,text:'\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);\n };'}),priority:4,text:"\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };"}),priority:2,text:'\n var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }\n var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";\n var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === "accessor") {\n if (result === void 0) continue;\n if (result === null || typeof result !== "object") throw new TypeError("Object expected");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === "field") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n };'}),priority:2,text:"\n var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n };"}),priority:1,text:"\n var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };"}),text:"\n var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }"}),dependencies:[uv],text:'\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume("next", value); }\n function reject(value) { resume("throw", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n };'}),dependencies:[uv],text:'\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i, p;\n return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n };'}),text:'\n var __asyncValues = (this && this.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n };'}),text:'\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === "function")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };'}),priority:5,text:'\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };'}),priority:0,text:'\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n\n return function (d, b) {\n if (typeof b !== "function" && b !== null)\n throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();'}),priority:0,text:'\n var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n };'}),text:'\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };'}),text:"\n var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n };"}),text:'\n var __propKey = (this && this.__propKey) || function (x) {\n return typeof x === "symbol" ? x : "".concat(x);\n };'}),text:'\n var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {\n if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";\n return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });\n };'}),text:'\n var __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n };'}),priority:6,text:'\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError("Generator is already executing.");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };'}),priority:1,text:'\n var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n }) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n }));'}),priority:1,text:'\n var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, "default", { enumerable: true, value: v });\n }) : function(o, v) {\n o["default"] = v;\n });'}),dependencies:[Tv,Sv],priority:2,text:'\n var __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n };'}),text:'\n var __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { "default": mod };\n };'}),dependencies:[Tv],priority:2,text:'\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n };'}),text:'\n var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");\n if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");\n return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);\n };'}),text:'\n var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === "m") throw new TypeError("Private method is not writable");\n if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");\n if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");\n return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n };'}),text:'\n var __classPrivateFieldIn = (this && this.__classPrivateFieldIn) || function(state, receiver) {\n if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use \'in\' operator on non-object");\n return typeof state === "function" ? receiver === state : state.has(receiver);\n };'}),text:'\n var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");\n var dispose;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");\n dispose = value[Symbol.dispose];\n }\n if (typeof dispose !== "function") throw new TypeError("Object not disposable.");\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n };'}),text:'\n var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {\n return function (env) {\n function fail(e) {\n env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;\n env.hasError = true;\n }\n function next() {\n while (env.stack.length) {\n var rec = env.stack.pop();\n try {\n var result = rec.dispose && rec.dispose.call(rec.value);\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n catch (e) {\n fail(e);\n }\n }\n if (env.hasError) throw env.error;\n }\n return next();\n };\n })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;\n });'},Ov={name:"typescript:async-super",scoped:!0,text:Bv(__makeTemplateObject(["\n const "," = name => super[name];"],["\n const "," = name => super[name];"]),"_superIndex")},Lv={name:"typescript:advanced-async-super",scoped:!0,text:Bv(__makeTemplateObject(["\n const "," = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"],["\n const "," = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"]),"_superIndex")}}});function gR(e){return 9===e.kind}function Vv(e){return 10===e.kind}function hR(e){return 11===e.kind}function qv(e){return 12===e.kind}function Wv(e){return 14===e.kind}function Hv(e){return 15===e.kind}function Kv(e){return 16===e.kind}function Gv(e){return 17===e.kind}function Xv(e){return 18===e.kind}function Qv(e){return 26===e.kind}function Yv(e){return 28===e.kind}function Zv(e){return 40===e.kind}function $v(e){return 41===e.kind}function eg(e){return 42===e.kind}function tg(e){return 54===e.kind}function rg(e){return 58===e.kind}function ng(e){return 59===e.kind}function ag(e){return 29===e.kind}function ig(e){return 39===e.kind}function xR(e){return 80===e.kind}function bR(e){return 81===e.kind}function og(e){return 95===e.kind}function sg(e){return 90===e.kind}function cg(e){return 134===e.kind}function ug(e){return 131===e.kind}function _g(e){return 135===e.kind}function lg(e){return 148===e.kind}function dg(e){return 126===e.kind}function fg(e){return 128===e.kind}function pg(e){return 164===e.kind}function mg(e){return 129===e.kind}function yg(e){return 108===e.kind}function kR(e){return 102===e.kind}function vg(e){return 84===e.kind}function TR(e){return 166===e.kind}function SR(e){return 167===e.kind}function wR(e){return 168===e.kind}function CR(e){return 169===e.kind}function NR(e){return 170===e.kind}function DR(e){return 171===e.kind}function AR(e){return 172===e.kind}function ER(e){return 173===e.kind}function FR(e){return 174===e.kind}function PR(e){return 175===e.kind}function IR(e){return 176===e.kind}function OR(e){return 177===e.kind}function LR(e){return 178===e.kind}function MR(e){return 179===e.kind}function RR(e){return 180===e.kind}function gg(e){return 181===e.kind}function jR(e){return 182===e.kind}function BR(e){return 183===e.kind}function JR(e){return 184===e.kind}function zR(e){return 185===e.kind}function UR(e){return 186===e.kind}function VR(e){return 187===e.kind}function hg(e){return 188===e.kind}function qR(e){return 189===e.kind}function WR(e){return 202===e.kind}function HR(e){return 190===e.kind}function KR(e){return 191===e.kind}function xg(e){return 192===e.kind}function bg(e){return 193===e.kind}function kg(e){return 194===e.kind}function Tg(e){return 195===e.kind}function GR(e){return 196===e.kind}function Sg(e){return 197===e.kind}function XR(e){return 198===e.kind}function QR(e){return 199===e.kind}function wg(e){return 200===e.kind}function YR(e){return 201===e.kind}function ZR(e){return 205===e.kind}function Cg(e){return 204===e.kind}function Ng(e){return 203===e.kind}function $R(e){return 206===e.kind}function ej(e){return 207===e.kind}function tj(e){return 208===e.kind}function rj(e){return 209===e.kind}function nj(e){return 210===e.kind}function aj(e){return 211===e.kind}function ij(e){return 212===e.kind}function oj(e){return 213===e.kind}function sj(e){return 214===e.kind}function cj(e){return 215===e.kind}function Dg(e){return 216===e.kind}function uj(e){return 217===e.kind}function _j(e){return 218===e.kind}function lj(e){return 219===e.kind}function Ag(e){return 220===e.kind}function dj(e){return 221===e.kind}function Eg(e){return 222===e.kind}function fj(e){return 223===e.kind}function pj(e){return 224===e.kind}function Fg(e){return 225===e.kind}function mj(e){return 226===e.kind}function Pg(e){return 227===e.kind}function Ig(e){return 228===e.kind}function Og(e){return 229===e.kind}function yj(e){return 230===e.kind}function vj(e){return 231===e.kind}function gj(e){return 232===e.kind}function hj(e){return 233===e.kind}function Lg(e){return 234===e.kind}function Mg(e){return 238===e.kind}function Rg(e){return 235===e.kind}function xj(e){return 236===e.kind}function jg(e){return 237===e.kind}function Bg(e){return 360===e.kind}function Jg(e){return 361===e.kind}function bj(e){return 239===e.kind}function zg(e){return 240===e.kind}function kj(e){return 241===e.kind}function Tj(e){return 243===e.kind}function Ug(e){return 242===e.kind}function Sj(e){return 244===e.kind}function wj(e){return 245===e.kind}function Vg(e){return 246===e.kind}function qg(e){return 247===e.kind}function Cj(e){return 248===e.kind}function Nj(e){return 249===e.kind}function Dj(e){return 250===e.kind}function Wg(e){return 251===e.kind}function Hg(e){return 252===e.kind}function Kg(e){return 253===e.kind}function Gg(e){return 254===e.kind}function Xg(e){return 255===e.kind}function Qg(e){return 256===e.kind}function Yg(e){return 257===e.kind}function Zg(e){return 258===e.kind}function $g(e){return 259===e.kind}function Aj(e){return 260===e.kind}function Ej(e){return 261===e.kind}function Fj(e){return 262===e.kind}function Pj(e){return 263===e.kind}function Ij(e){return 264===e.kind}function Oj(e){return 265===e.kind}function Lj(e){return 266===e.kind}function Mj(e){return 267===e.kind}function Rj(e){return 268===e.kind}function eh(e){return 269===e.kind}function jj(e){return 270===e.kind}function Bj(e){return 271===e.kind}function Jj(e){return 272===e.kind}function zj(e){return 273===e.kind}function th(e){return 302===e.kind}function rh(e){return 300===e.kind}function nh(e){return 301===e.kind}function ah(e){return 274===e.kind}function Uj(e){return 280===e.kind}function ih(e){return 275===e.kind}function Vj(e){return 276===e.kind}function qj(e){return 277===e.kind}function Wj(e){return 278===e.kind}function Hj(e){return 279===e.kind}function Kj(e){return 281===e.kind}function oh(e){return 282===e.kind}function sh(e){return 359===e.kind}function ch(e){return 362===e.kind}function Gj(e){return 283===e.kind}function Xj(e){return 284===e.kind}function Qj(e){return 285===e.kind}function Yj(e){return 286===e.kind}function uh(e){return 287===e.kind}function _h(e){return 288===e.kind}function Zj(e){return 289===e.kind}function lh(e){return 290===e.kind}function $j(e){return 291===e.kind}function eB(e){return 292===e.kind}function tB(e){return 293===e.kind}function dh(e){return 294===e.kind}function rB(e){return 295===e.kind}function fh(e){return 296===e.kind}function ph(e){return 297===e.kind}function nB(e){return 298===e.kind}function aB(e){return 299===e.kind}function iB(e){return 303===e.kind}function oB(e){return 304===e.kind}function sB(e){return 305===e.kind}function cB(e){return 306===e.kind}function mh(e){return 308===e.kind}function uB(e){return 312===e.kind}function yh(e){return 313===e.kind}function vh(e){return 314===e.kind}function _B(e){return 316===e.kind}function lB(e){return 317===e.kind}function dB(e){return 318===e.kind}function gh(e){return 331===e.kind}function hh(e){return 332===e.kind}function xh(e){return 333===e.kind}function fB(e){return 319===e.kind}function pB(e){return 320===e.kind}function mB(e){return 321===e.kind}function yB(e){return 322===e.kind}function vB(e){return 323===e.kind}function gB(e){return 324===e.kind}function hB(e){return 325===e.kind}function bh(e){return 326===e.kind}function kh(e){return 327===e.kind}function xB(e){return 329===e.kind}function bB(e){return 330===e.kind}function kB(e){return 335===e.kind}function Th(e){return 337===e.kind}function Sh(e){return 339===e.kind}function TB(e){return 345===e.kind}function wh(e){return 340===e.kind}function Ch(e){return 341===e.kind}function Nh(e){return 342===e.kind}function Dh(e){return 343===e.kind}function Ah(e){return 344===e.kind}function SB(e){return 346===e.kind}function Eh(e){return 338===e.kind}function Fh(e){return 354===e.kind}function Ph(e){return 347===e.kind}function wB(e){return 348===e.kind}function CB(e){return 349===e.kind}function Ih(e){return 350===e.kind}function NB(e){return 351===e.kind}function DB(e){return 352===e.kind}function AB(e){return 353===e.kind}function Oh(e){return 334===e.kind}function EB(e){return 355===e.kind}function Lh(e){return 336===e.kind}function FB(e){return 357===e.kind}function Mh(e){return 356===e.kind}function Rh(e){return 358===e.kind}var jh,Bh,Jh=e({"src/compiler/factory/nodeTests.ts":function(){MK()}});function PB(e){return e.createExportDeclaration(void 0,!1,e.createNamedExports([]),void 0)}function zh(e,t,r,n){if(SR(r))return UB(e.createElementAccessExpression(t,r.expression),n);r=UB(ps(r)?e.createPropertyAccessExpression(t,r):e.createElementAccessExpression(t,r),r);return Cy(r,128),r}function Uh(e,t){e=WB.createIdentifier(e||"React");return jM(e,PA(t)),e}function Vh(e,t,r){if(TR(t)){var n=Vh(e,t.left,r),a=e.createIdentifier(LA(t.right));return a.escapedText=t.right.escapedText,e.createPropertyAccessExpression(n,a)}return Uh(LA(t),r)}function qh(e,t,r,n){return t?Vh(e,t,n):e.createPropertyAccessExpression(Uh(r,n),"createElement")}function Wh(e,t,r,n,a,i){var o,s,c=[r];if(n&&c.push(n),a&&0_.checkJsDirective.pos)&&(_.checkJsDirective={enabled:"ts-check"===t,end:e.range.end,pos:e.range.pos})});break;case"jsx":case"jsxfrag":case"jsximportsource":case"jsxruntime":return;default:rA.fail("Unhandled pragma kind")}})}function Jb(e,t,r,n){var a,i;n&&(a=n[1].toLowerCase(),(i=Dn[a])&&i.kind&r&&("fail"!==(n=function(e,t){if(!t)return{};if(!e.args)return{};for(var r=h(t).split(/\s+/),n={},a=0;a=t,"Adjusting an element that was entirely before the change range"),rA.assert(e.pos<=r,"Adjusting an element that was entirely after the change range"),rA.assert(e.pos<=e.end);t=Math.min(e.pos,n),n=e.end>=r?e.end+a:Math.min(e.end,n);rA.assert(t<=n),e.parent&&(rA.assertGreaterThanOrEqual(t,e.parent.pos),rA.assertLessThanOrEqual(n,e.parent.end)),MM(e,t,n)}function h(e,t){var r,n;if(t){var a=e.pos,i=function(e){rA.assert(e.pos>=a),a=e.end};if(tF(e))try{for(var o=__values(e.jsDoc),s=o.next();!s.done;s=o.next())i(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}HB(e,i),rA.assert(a<=e.end)}}function x(e,t,r,n){var a=e.text;r&&(rA.assert(a.length-r.span.length+r.newLength===t.length),(n||rA.shouldAssert(3))&&(e=a.substr(0,r.span.start),n=t.substr(0,r.span.start),rA.assert(e===n),a=a.substring(TA(r.span),a.length),t=t.substring(TA(Co(r)),t.length),rA.assert(a===t)))}function b(t){var o=t.statements,s=0;rA.assert(s=e.pos&&i=e.pos&&i=t.pos}),r=0<=e?ZN(o,function(e){return e.start>=n.pos},e):-1;0<=e&&gD(m,o,e,0<=r?r:void 0),qe(function(){var e=b;for(b|=65536,U.resetTokenState(n.pos),Le();1!==q;){var t=U.getTokenFullStart(),r=Jt(0,fa);if(i.push(r),t===U.getTokenFullStart()&&Le(),0<=s){t=a.statements[s];if(r.end===t.pos)break;r.end>t.pos&&(s=l(a.statements,s+1))}}b=e},2),c=0<=s?_(a.statements,s):-1}();return 0<=s&&(r=a.statements[s],gD(i,a.statements,s),0<=(n=ZN(o,function(e){return e.start>=r.pos}))&&gD(m,o,n)),v=e,H.updateSourceFile(a,UB(k(i),a.statements));function u(e){return!(65536&e.flags)&&67108864&e.transformFlags}function _(e,t){for(var r=t;ri.length+2&&XD(e,i))return"".concat(i," ").concat(e.slice(i.length))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return}(r);r?De(n,e.end,mA.Unknown_keyword_or_identifier_Did_you_mean_0,r):0!==q&&De(n,e.end,mA.Unexpected_keyword_or_identifier)}else Ce(mA._0_expected,yA[27])}}function et(e,t,r){q===r?Ce(t):Ce(e,U.getTokenValue())}function tt(e){if(q===e)return Me(),1;rA.assert(Vl(e)),Ce(mA._0_expected,vA(e))}function rt(e,t,r,n){var a;q!==t?(a=Ce(mA._0_expected,vA(t)),r&&a&&SM(a,gp(V,n,1,mA.The_parser_expected_to_find_a_1_to_match_the_0_token_here,vA(e),vA(t)))):Le()}function nt(e){return q===e&&(Le(),!0)}function at(e){if(q===e)return st()}function it(e){if(q===e)return t=Fe(),e=q,Me(),dt(N(e),t);var t}function ot(e,t,r){return at(e)||ft(e,!1,t||mA._0_expected,r||vA(e))}function st(){var e=Fe(),t=q;return Le(),dt(N(t),e)}function ct(){return 27===q||(20===q||1===q||U.hasPrecedingLineBreak())}function ut(){return!!ct()&&(27===q&&Le(),!0)}function _t(){return ut()||Xe(27)}function lt(e,t,r,n){n=k(e,n);return MM(n,t,null!=r?r:U.getTokenFullStart()),n}function dt(e,t,r){return MM(e,t,null!=r?r:U.getTokenFullStart()),b&&(e.flags|=b),$&&($=!1,e.flags|=262144),e}function ft(e,t,r){for(var n=[],a=3;a");var i=H.createParameterDeclaration(void 0,void 0,t,void 0,void 0,void 0);dt(i,t.pos);t=lt([i],i.pos,i.end),i=ot(39),r=dn(!!a,r);return ae(dt(H.createArrowFunction(a,void 0,t,void 0,i,r),e),n)}function un(){if(134===q){if(Le(),U.hasPrecedingLineBreak())return 0;if(21!==q&&30!==q)return 0}var e=q,t=Le();if(21!==e)return rA.assert(30===e),Ge()||87===q?1!==p?2:We(function(){nt(87);var e=Le();if(96===e)switch(Le()){case 64:case 32:case 44:return!1;default:return!0}else if(28===e||64===e)return!0;return!1})?1:0:0;if(22===t)switch(Le()){case 39:case 59:case 19:return 1;default:return 0}if(23===t||19===t)return 2;if(26===t)return 1;if(js(t)&&134!==t&&We(Pt))return 130===Le()?0:1;if(!Ge()&&110!==t)return 0;switch(Le()){case 59:return 1;case 58:return Le(),59===q||28===q||64===q||22===q?1:0;case 28:case 64:case 22:return 2}return 0}function _n(){if(134===q){if(Le(),U.hasPrecedingLineBreak()||39===q)return 0;var e=fn(0);if(!U.hasPrecedingLineBreak()&&80===e.kind&&39===q)return 1}return 0}function ln(e,t){var r,n=Fe(),a=Pe(),i=Ja(),o=dD(i,cg)?2:0,s=ur();if(Xe(21)){if(e)r=pr(o,e);else{var c=pr(o,e);if(!c)return;r=c}if(!Xe(22)&&!e)return}else{if(!e)return;r=Wt()}var u=59===q,o=fr(59,!1);if(!o||e||!function e(t){switch(t.kind){case 183:return EF(t.typeName);case 184:case 185:var r=t.parameters,n=t.type;return!!r.isMissingList||e(n);case 196:return e(t.type);default:return!1}}(o)){for(var _=o;196===(null==_?void 0:_.kind);)_=_.type;c=_&&gB(_);if(e||39===q||!c&&19===q){e=q,c=ot(39),e=39===e||19===e?dn(dD(i,cg),t):vt();if(t||!u||59===q)return ae(dt(H.createArrowFunction(i,s,r,o,c,e),n),a)}}}function dn(e,t){if(19===q)return Kn(e?2:0);if(27!==q&&100!==q&&86!==q&&ia()&&(19===q||100===q||86===q||60===q||!nn()))return Kn(16|(e?2:0));var r=Z;Z=!1;e=(e?ge:he)(function(){return sn(t)});return Z=r,e}function fn(e){var t=Fe();return mn(e,hn(),t)}function pn(e){return 103===e||165===e}function mn(e,t,r){for(;;){je();var n=ud(q);if(!(43===q?e<=n:et&&m.push(i.slice(t-r)),r+=i.length;break;case 1:break e;case 82:e=2,n(U.getTokenValue());break;case 19:e=2;a=U.getTokenFullStart(),i=h(U.getTokenEnd()-1);if(i){f||v(m),y.push(dt(H.createJSDocText(m.join("")),null!=f?f:c,a)),y.push(i),m=[],f=U.getTokenEnd();break}default:e=2,n(U.getTokenText())}2===e?Re(!1):Me()}var o=di(m.join(""));y.length&&o.length&&y.push(dt(H.createJSDocText(o),null!=f?f:c,p));y.length&&w&&rA.assertIsDefined(p,"having parsed tags implies that the end of the comment span should be set");var s=w&<(w,l,d);return dt(H.createJSDocComment(y.length?lt(y,c,p):o.length?o:void 0,s),c,_)});return W=t,e}function v(e){for(;e.length&&("\n"===e[0]||"\r"===e[0]);)e.shift()}function n(){for(;;){if(Me(),1===q)return!0;if(5!==q&&4!==q)return!1}}function C(){if(5!==q&&4!==q||!We(n))for(;5===q||4===q;)Me()}function N(){if((5===q||4===q)&&We(n))return"";for(var e=U.hasPrecedingLineBreak(),t=!1,r="";e&&42===q||5===q||4===q;)r+=U.getTokenText(),4===q?(t=e=!0,r=""):42===q&&(e=!1),Me();return t?r:""}function g(e){rA.assert(60===q);var t=U.getTokenStart();Me();var r,n,a,i,o,s,c,u,_,l,d,f,p,m,y,v,g,h,x,b,k,T=z(void 0),S=N();switch(T.escapedText){case"author":r=function(e,t,r,n){var a=Fe(),i=function(){var e=[],t=!1,r=U.getToken();for(;1!==r&&4!==r;){if(30===r)t=!0;else{if(60===r&&!t)break;if(32===r&&t){e.push(U.getTokenText()),U.resetTokenState(U.getTokenEnd());break}}e.push(U.getTokenText()),r=Me()}return H.createJSDocText(e.join(""))}(),o=U.getTokenFullStart(),n=D(e,o,r,n);n||(o=U.getTokenFullStart());n="string"!=typeof n?lt(fD([dt(i,a,o)],n),a):i.text+n;return dt(H.createJSDocAuthorTag(t,n),e)}(t,T,e,S);break;case"implements":g=t,h=T,x=e,b=S,k=L(),r=dt(H.createJSDocImplementsTag(h,k,D(g,Fe(),x,b)),g);break;case"augments":case"extends":v=t,k=T,x=e,b=S,g=L(),r=dt(H.createJSDocAugmentsTag(k,g,D(v,Fe(),x,b)),v);break;case"class":case"constructor":r=M(t,H.createJSDocClassTag,T,e,S);break;case"public":r=M(t,H.createJSDocPublicTag,T,e,S);break;case"private":r=M(t,H.createJSDocPrivateTag,T,e,S);break;case"protected":r=M(t,H.createJSDocProtectedTag,T,e,S);break;case"readonly":r=M(t,H.createJSDocReadonlyTag,T,e,S);break;case"override":r=M(t,H.createJSDocOverrideTag,T,e,S);break;case"deprecated":ne=!0,r=M(t,H.createJSDocDeprecatedTag,T,e,S);break;case"this":f=t,v=T,p=e,m=S,y=ci(!0),C(),r=dt(H.createJSDocThisTag(v,y,D(f,Fe(),p,m)),f);break;case"enum":d=t,y=T,p=e,m=S,f=ci(!0),C(),r=dt(H.createJSDocEnumTag(y,f,D(d,Fe(),p,m)),d);break;case"arg":case"argument":case"param":return I(t,T,2,e);case"return":case"returns":r=function(e,t,r,n){dD(w,CB)&&De(t.pos,U.getTokenStart(),mA._0_tag_already_specified,OA(t.escapedText));var a=F();return dt(H.createJSDocReturnTag(t,a,D(e,Fe(),r,n)),e)}(t,T,e,S);break;case"template":r=J(t,T,e,S);break;case"type":r=O(t,T,e,S);break;case"typedef":r=function(e,t,r,n){var a=F();N();var i=R();C();var o=A(r);if(!a||P(a.type)){for(var s,c,u=void 0,_=void 0,l=void 0,d=!1;(u=He(function(){return B(1,r)}))&&352!==u.kind;)if(d=!0,351===u.kind){if(_){var f=Ce(mA.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);f&&SM(f,gp(V,0,0,mA.The_tag_was_first_specified_here));break}_=u}else l=vD(l,u);d&&(s=a&&188===a.type.kind,c=H.createJSDocTypeLiteral(l,s),a=_&&_.typeExpression&&!P(_.typeExpression.type)?_.typeExpression:dt(c,e),s=a.end)}s=s||void 0!==o?Fe():(null!==(c=null!=i?i:a)&&void 0!==c?c:t).end,o=o||D(e,s,r,n);return dt(H.createJSDocTypedefTag(t,a,i,o),e,s)}(t,T,e,S);break;case"callback":r=function(e,t,r,n){var a=R();C();var i=A(r),o=j(e,r);i=i||D(e,Fe(),r,n);n=void 0!==i?Fe():o.end;return dt(H.createJSDocCallbackTag(t,o,a,i),e,n)}(t,T,e,S);break;case"overload":r=function(e,t,r,n){C();var a=A(r),i=j(e,r);a=a||D(e,Fe(),r,n);n=void 0!==a?Fe():i.end;return dt(H.createJSDocOverloadTag(t,i,a),e,n)}(t,T,e,S);break;case"satisfies":c=t,u=T,d=e,_=S,l=ci(!1),_=void 0!==d&&void 0!==_?D(c,Fe(),d,_):void 0,r=dt(H.createJSDocSatisfiesTag(u,l,_),c);break;case"see":s=t,u=T,l=e,_=S,c=23===q||We(function(){return 60===Me()&&80<=Me()&&E(U.getTokenValue())})?void 0:ui(),_=void 0!==l&&void 0!==_?D(s,Fe(),l,_):void 0,r=dt(H.createJSDocSeeTag(u,c,_),s);break;case"exception":case"throws":n=t,a=T,s=e,i=S,o=F(),i=D(n,Fe(),s,i),r=dt(H.createJSDocThrowsTag(a,o,i),n);break;default:a=t,o=T,i=e,n=S,r=dt(H.createJSDocUnknownTag(o,D(a,Fe(),i,n)),a)}return r}function D(e,t,r,n){return n||(r+=t-e),A(r,n.slice(r))}function A(t,e){var r,n,a=Fe(),i=[],o=[],s=0;function c(e){n=n||t,i.push(e),t+=e.length}void 0!==e&&(""!==e&&c(e),s=1);var u=q;e:for(;;){switch(u){case 4:s=0,i.push(U.getTokenText()),t=0;break;case 60:U.resetTokenState(U.getTokenEnd()-1);break e;case 1:break e;case 5:rA.assert(2!==s&&3!==s,"whitespace shouldn't come from the scanner while saving comment text");var _=U.getTokenText();void 0!==n&&t+_.length>n&&(i.push(_.slice(n-t)),s=2),t+=_.length;break;case 19:s=2;var l=U.getTokenFullStart(),_=h(U.getTokenEnd()-1);_?(o.push(dt(H.createJSDocText(i.join("")),null!=r?r:a,l)),o.push(_),i=[],r=U.getTokenEnd()):c(U.getTokenText());break;case 62:s=3===s?2:3,c(U.getTokenText());break;case 82:3!==s&&(s=2),c(U.getTokenValue());break;case 42:if(0===s){t+=s=1;break}default:3!==s&&(s=2),c(U.getTokenText())}u=2===s||3===s?Re(3===s):Me()}v(i);e=di(i.join(""));return o.length?(e.length&&o.push(dt(H.createJSDocText(e),null!=r?r:a)),lt(o,a,U.getTokenEnd())):e.length?e:void 0}function h(e){var t=He(x);if(t){Me(),C();var r=Fe(),n=80<=q?Kt(!0):void 0;if(n)for(;81===q;)ze(),Me(),n=dt(H.createJSDocMemberName(n,vt()),r);for(var a=[];20!==q&&4!==q&&1!==q;)a.push(U.getTokenText()),Me();return dt(("link"===t?H.createJSDocLink:"linkcode"===t?H.createJSDocLinkCode:H.createJSDocLinkPlain)(n,a.join("")),e,U.getTokenEnd())}}function x(){if(N(),19===q&&60===Me()&&80<=Me()){var e=U.getTokenValue();if(E(e))return e}}function E(e){return"link"===e||"linkcode"===e||"linkplain"===e}function F(){return N(),19===q?ci():void 0}function b(){var e=k(23);e&&C();var t=k(62),r=function(){var e=z();nt(23)&&Xe(24);for(;nt(25);){var t=z();nt(23)&&Xe(24),e=function(e,t){return dt(H.createQualifiedName(e,t),e.pos)}(e,t)}return e}();return t&&(it(t=62)||(rA.assert(Vl(t)),ft(t,!1,mA._0_expected,vA(t)))),e&&(C(),at(64)&&an(),Xe(24)),{name:r,isBracketed:e}}function P(e){switch(e.kind){case 151:return!0;case 188:return P(e.elementType);default:return BR(e)&&xR(e.typeName)&&"Object"===e.typeName.escapedText&&!e.typeArguments}}function I(e,t,r,n){var a=F(),i=!a;N();var o=b(),s=o.name,c=o.isBracketed,o=N();i&&!We(x)&&(a=F());o=D(e,Fe(),n,o),n=function(e,t,r,n){if(e&&P(e.type)){for(var a=Fe(),i=void 0,o=void 0;i=He(function(){return B(r,n,t)});)348===i.kind||355===i.kind?o=vD(o,i):352===i.kind&&Ae(i.tagName,mA.A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag);if(o){e=dt(H.createJSDocTypeLiteral(o,188===e.type.kind),a);return dt(H.createJSDocTypeExpression(e),a)}}}(a,s,r,n);return n&&(a=n,i=!0),dt(1===r?H.createJSDocPropertyTag(t,s,c,a,i,o):H.createJSDocParameterTag(t,s,c,a,i,o),e)}function O(e,t,r,n){dD(w,NB)&&De(t.pos,U.getTokenStart(),mA._0_tag_already_specified,OA(t.escapedText));var a=ci(!0),n=void 0!==r&&void 0!==n?D(e,Fe(),r,n):void 0;return dt(H.createJSDocTypeTag(t,a,n),e)}function L(){var e=nt(19),t=Fe(),r=function(){var e=Fe(),t=z();for(;nt(25);){var r=z();t=dt(G(t,r),e)}return t}();U.setInJSDocType(!0);var n=Ka();U.setInJSDocType(!1);t=dt(H.createExpressionWithTypeArguments(r,n),t);return e&&Xe(20),t}function M(e,t,r,n,a){return dt(t(r,D(e,Fe(),n,a)),e)}function R(e){var t=U.getTokenStart();if(80<=q){var r=z();if(nt(25)){var n=R(!0);return dt(H.createModuleDeclaration(void 0,r,n,e?8:void 0),t)}return e&&(r.flags|=4096),r}}function j(e,t){var r=function(e){for(var t,r,n=Fe();t=He(function(){return B(4,e)});){if(352===t.kind){Ae(t.tagName,mA.A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag);break}r=vD(r,t)}return lt(r||[],n)}(t),n=He(function(){if(k(60)){var e=g(t);if(e&&349===e.kind)return e}});return dt(H.createJSDocSignature(void 0,r,n),e)}function B(e,t,r){for(var n=!0,a=!1;;)switch(Me()){case 60:if(n){var i=function(e,t){rA.assert(60===q);var r=U.getTokenFullStart();Me();var n,a=z(),i=N();switch(a.escapedText){case"type":return 1===e&&O(r,a);case"prop":case"property":n=1;break;case"arg":case"argument":case"param":n=6;break;case"template":return J(r,a,t,i);default:return!1}return!!(e&n)&&I(r,a,e,t)}(e,t);return!i||348!==i.kind&&355!==i.kind||!r||!xR(i.name)&&function(e,t){for(;!xR(e)||!xR(t);){if(xR(e)||xR(t)||e.right.escapedText!==t.right.escapedText)return;e=e.left,t=t.left}return e.escapedText===t.escapedText}(r,i.name.left)?i:!1}a=!1;break;case 4:a=!(n=!0);break;case 42:a&&(n=!1),a=!0;break;case 80:n=!1;break;case 1:return!1}}function o(){var e=Fe(),t=[];do{C();var r=function(){var e=Fe(),t=k(23);t&&C();var r,n=z(mA.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces);if(t&&(C(),Xe(64),r=pe(16777216,sr),Xe(24)),!EF(n))return dt(H.createTypeParameterDeclaration(void 0,n,void 0,r),e)}()}while(void 0!==r&&t.push(r),N(),k(28));return lt(t,e)}function J(e,t,r,n){var a=19===q?ci():void 0,i=o();return dt(H.createJSDocTemplateTag(t,a,i,D(e,Fe(),r,n)),e)}function k(e){return q===e&&(Me(),!0)}function z(e){if(!(80<=q))return ft(80,!e,e||mA.Identifier_expected);S++;var t=U.getTokenStart(),r=U.getTokenEnd(),n=q,e=pt(U.getTokenValue()),r=dt(K(e,n),t,r);return Me(),r}}(Qe={})[Qe.SourceElements=0]="SourceElements",Qe[Qe.BlockStatements=1]="BlockStatements",Qe[Qe.SwitchClauses=2]="SwitchClauses",Qe[Qe.SwitchClauseStatements=3]="SwitchClauseStatements",Qe[Qe.TypeMembers=4]="TypeMembers",Qe[Qe.ClassMembers=5]="ClassMembers",Qe[Qe.EnumMembers=6]="EnumMembers",Qe[Qe.HeritageClauseElement=7]="HeritageClauseElement",Qe[Qe.VariableDeclarations=8]="VariableDeclarations",Qe[Qe.ObjectBindingElements=9]="ObjectBindingElements",Qe[Qe.ArrayBindingElements=10]="ArrayBindingElements",Qe[Qe.ArgumentExpressions=11]="ArgumentExpressions",Qe[Qe.ObjectLiteralMembers=12]="ObjectLiteralMembers",Qe[Qe.JsxAttributes=13]="JsxAttributes",Qe[Qe.JsxChildren=14]="JsxChildren",Qe[Qe.ArrayLiteralMembers=15]="ArrayLiteralMembers",Qe[Qe.Parameters=16]="Parameters",Qe[Qe.JSDocParameters=17]="JSDocParameters",Qe[Qe.RestProperties=18]="RestProperties",Qe[Qe.TypeParameters=19]="TypeParameters",Qe[Qe.TypeArguments=20]="TypeArguments",Qe[Qe.TupleElementTypes=21]="TupleElementTypes",Qe[Qe.HeritageClauses=22]="HeritageClauses",Qe[Qe.ImportOrExportSpecifiers=23]="ImportOrExportSpecifiers",Qe[Qe.AssertEntries=24]="AssertEntries",Qe[Qe.JSDocComment=25]="JSDocComment",Qe[Qe.Count=26]="Count",(Qe={})[Qe.False=0]="False",Qe[Qe.True=1]="True",Qe[Qe.Unknown=2]="Unknown",(e=Ye=e.JSDocParser||(e.JSDocParser={})).parseJSDocTypeExpressionForTests=function(e,t,r){return te("file.js",e,99,void 0,1),U.setText(e,t,r),q=U.scan(),e=ci(),t=se("file.js",99,1,!1,[],N(1),0,fi),r=hp(m,t),y&&(t.jsDocDiagnostics=hp(y,t)),re(),e?{jsDocTypeExpression:e,diagnostics:r}:void 0},e.parseJSDocTypeExpression=ci,e.parseJSDocNameReference=ui,e.parseIsolatedJSDocComment=function(e,t,r){te("",e,99,void 0,1);var n=pe(16777216,function(){return _i(t,r)}),e=hp(m,{languageVariant:0,text:e});return re(),n?{jsDoc:n,diagnostics:e}:void 0},e.parseJSDocComment=function(e,t,r){var n=q,a=m.length,i=$,o=pe(16777216,function(){return _i(t,r)});return jM(o,e),524288&b&&(y=y||[]).push.apply(y,__spreadArray([],__read(m),!1)),q=n,m.length=a,$=i,o},(e={})[e.BeginningOfLine=0]="BeginningOfLine",e[e.SawAsterisk=1]="SawAsterisk",e[e.SavingComments=2]="SavingComments",e[e.SavingBackticks=3]="SavingBackticks",(e={})[e.Property=1]="Property",e[e.Parameter=2]="Parameter",e[e.CallbackParameter=4]="CallbackParameter"}(rb=rb||{}),(e=nb=nb||{}).updateSourceFile=function(e,t,r,n){if(x(e,t,r,n=n||rA.shouldAssert(2)),No(r))return e;if(0===e.statements.length)return rb.parseSourceFile(e.fileName,t,e.languageVersion,void 0,!0,e.scriptKind,e.setExternalModuleIndicator);var a=e;rA.assert(!a.hasBeenIncrementallyParsed),a.hasBeenIncrementallyParsed=!0,rb.fixupParentReferences(a);var i=e.text,o=b(e),s=function(e,t){for(var r=t.span.start,n=0;0r),!0;if(t.pos>=a.pos&&(a=t),ra.pos&&(a=t)}return a}(e,r);rA.assert(a.pos<=r);a=a.pos;r=Math.max(0,a-1)}var i=wo(r,TA(t.span)),t=t.newLength+(t.span.start-r);return Do(i,t)}(e,r);x(e,t,s,n),rA.assert(s.span.start<=r.span.start),rA.assert(TA(s.span)===TA(r.span)),rA.assert(TA(Co(s))===TA(Co(r)));var c,u,_,l,d,f,p,r=Co(s).length-s.span.length;function m(e){var t,r;if(rA.assert(e.pos<=e.end),e.pos>u)v(e,!1,l,d,f,p);else{var n=e.end;if(c<=n){if(e.intersectsChange=!0,e._children=void 0,g(e,c,u,_,l),HB(e,m,y),tF(e))try{for(var a=__values(e.jsDoc),i=a.next();!i.done;i=a.next())m(i.value)}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}h(e,p)}else rA.assert(nu)v(e,!0,l,d,f,p);else{var n=e.end;if(c<=n){e.intersectsChange=!0,e._children=void 0,g(e,c,u,_,l);try{for(var a=__values(e),i=a.next();!i.done;i=a.next())m(i.value)}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}else rA.assert(nn&&(v(),y={range:{pos:m.pos+a,end:m.end+a},type:y},_=vD(_,y),s&&rA.assert(i.substring(m.pos,m.end)===o.substring(y.range.pos,y.range.end)))}}catch(e){c={error:e}}finally{try{f&&!f.done&&(u=d.return)&&u.call(d)}finally{if(c)throw c.error}}return v(),_;function v(){l||(l=!0,_?t&&_.push.apply(_,__spreadArray([],__read(t),!1)):_=t)}}(e.commentDirectives,o.commentDirectives,s.span.start,TA(s.span),r,i,t,n),o.impliedNodeFormat=e.impliedNodeFormat,o},e.createSyntaxCursor=b,(e={})[e.Value=-1]="Value",ab=new Map,ib=/^\/\/\/\s*<(\S+)\s.*?\/>/im,ob=/^\/\/\/?\s*@([^\s:]+)(.*)\s*$/im}});function Ek(e){var t=new Map,r=new Map;return KN(e,function(e){t.set(e.name.toLowerCase(),e),e.shortName&&r.set(e.shortName,e.name)}),{optionsNameMap:t,shortOptionNames:r}}function Fk(){return uk=uk||Ek(Zb)}function Pk(e){return Ik(e,ZL)}function Ik(t,e){var r=PD(t.type.keys()),r=(t.deprecatedKeys?r.filter(function(e){return!t.deprecatedKeys.has(e)}):r).map(function(e){return"'".concat(e,"'")}).join(", ");return e(mA.Argument_for_0_option_must_be_Colon_1,"--".concat(t.name),r)}function Ok(e,t,r){return jT(e,h(t||""),r)}function Lk(t,e,r){if(void 0===e&&(e=""),!XD(e=h(e),"-")){if("listOrElement"===t.type&&!WD(e,","))return RT(t,e,r);if(""===e)return[];var n=e.split(",");switch(t.element.type){case"number":return uD(n,function(e){return RT(t.element,parseInt(e),r)});case"string":return uD(n,function(e){return RT(t.element,e||"",r)});case"boolean":case"object":return rA.fail("List of ".concat(t.element.type," is not yet supported."));default:return uD(n,function(e){return Ok(t.element,e,r)})}}}function Mk(e){return e.name}function Rk(e,t,r,n,a){if(null!=(i=t.alternateMode)&&i.getOptionsNameMap().optionsNameMap.has(e.toLowerCase()))return LT(a,n,t.alternateMode.diagnostic,e);var i=VD(e,t.optionDeclarations,Mk);return i?LT(a,n,t.unknownDidYouMeanDiagnostic,r||e,i.name):LT(a,n,t.unknownOptionDiagnostic,r||e)}function jk(i,e,o){var s,c={},u=[],_=[];return l(e),{options:c,watchOptions:s,fileNames:u,errors:_};function l(e){for(var t=0;t=t.length)break;var a=n;if(34===t.charCodeAt(a)){for(n++;n "))),{raw:e||nT(o,_)};var n,e=e?function(e,t,r,n,a){ma(e,"excludes")&&a.push(ZL(mA.Unknown_option_excludes_Did_you_mean_exclude));var i=FT(e.compilerOptions,r,a,n),o=IT(e.typeAcquisition,r,a,n),s=function(e,t,r){return OT(eT(),e,t,void 0,vk,r)}(e.watchOptions,r,a);e.compileOnSave=function(e,t,r){if(!ma(e,Ub.name))return!1;r=MT(Ub,e.compileOnSave,t,r);return"boolean"==typeof r&&r}(e,r,a);a=e.extends||""===e.extends?CT(e.extends,t,r,n,a):void 0;return{raw:e,options:i,watchOptions:s,typeAcquisition:o,extendedConfigPath:a}}(e,s,c,t,_):function(o,s,c,u,_){var l,d,f,p,m=ET(u),y=(void 0===wk&&(wk={name:void 0,type:"object",elementOptions:Yk([kk,Tk,Sk,bk,{name:"references",type:"list",element:{name:"references",type:"object"},category:mA.Projects},{name:"files",type:"list",element:{name:"files",type:"string"},category:mA.File_Management},{name:"include",type:"list",element:{name:"include",type:"string"},category:mA.File_Management,defaultValueDescription:mA.if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk},{name:"exclude",type:"list",element:{name:"exclude",type:"string"},category:mA.File_Management,defaultValueDescription:mA.node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified},Ub])}),wk),e=rT(o,_,{rootOptions:y,onPropertySet:function(t,e,r,n,a){a&&a!==bk&&(e=MT(a,e,c,_,r,r.initializer,o));{var i;null!=n&&n.name?a?(i=void 0,n===kk?i=m:n===Tk?i=null!=d?d:d={}:n===Sk?i=null!=l?l:l=PT(u):rA.fail("Unknown option"),i[a.name]=e):t&&null!=n&&n.extraKeyDiagnostics&&(n.elementOptions?_.push(Rk(t,n.extraKeyDiagnostics,void 0,r.name,o)):_.push(F_(o,r.name,n.extraKeyDiagnostics.unknownOptionDiagnostic,t))):n===y&&(a===bk?f=CT(e,s,c,u,_,r,r.initializer,o):a||("excludes"===t&&_.push(F_(o,r.name,mA.Unknown_option_excludes_Did_you_mean_exclude)),QN(Yb,function(e){return e.name===t})&&(p=vD(p,r.name))))}}});l=l||PT(u);p&&e&&void 0===e.compilerOptions&&_.push(F_(o,p[0],mA._0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file,$F(p[0])));return{raw:e,options:m,watchOptions:d,typeAcquisition:l,extendedConfigPath:f}}(o,s,c,t,_);return null!=(t=e.options)&&t.paths&&(e.options.pathsBasePath=c),e.extendedConfigPath&&(u=u.concat([r]),n={options:{}},jD(e.extendedConfigPath)?a(n,e.extendedConfigPath):e.extendedConfigPath.forEach(function(e){return a(n,e)}),!e.raw.include&&n.include&&(e.raw.include=n.include),!e.raw.exclude&&n.exclude&&(e.raw.exclude=n.exclude),!e.raw.files&&n.files&&(e.raw.files=n.files),void 0===e.raw.compileOnSave&&n.compileOnSave&&(e.raw.compileOnSave=n.compileOnSave),o&&n.extendedSourceFiles&&(o.extendedSourceFiles=PD(n.extendedSourceFiles.keys())),e.options=W(n.options,e.options),e.watchOptions=e.watchOptions&&n.watchOptions?W(n.watchOptions,e.watchOptions):e.watchOptions||n.watchOptions),e;function a(t,r){var n,a,e,i=function(e,t,r,n,a,i,o){var s,c,u,_,l,d=r.useCaseSensitiveFileNames?t:or(t);i&&(u=i.get(d))?(_=u.extendedResult,l=u.extendedConfig):((_=Xk(t,function(e){return r.readFile(e)})).parseDiagnostics.length||(l=wT(void 0,_,r,lA(t),Ea(t),n,a,i)),i&&i.set(d,{extendedResult:_,extendedConfig:l}));if(e&&((null!==(e=o.extendedSourceFiles)&&void 0!==e?e:o.extendedSourceFiles=new Set).add(_.fileName),_.extendedSourceFiles))try{for(var f=__values(_.extendedSourceFiles),p=f.next();!p.done;p=f.next()){var m=p.value;o.extendedSourceFiles.add(m)}}catch(e){s={error:e}}finally{try{p&&!p.done&&(c=f.return)&&c.call(f)}finally{if(s)throw s.error}}if(_.parseDiagnostics.length)return void a.push.apply(a,__spreadArray([],__read(_.parseDiagnostics),!1));return l}(o,r,s,u,_,l,t);i&&i.options&&(n=i.raw,(e=function(e){n[e]&&(t[e]=iD(n[e],function(e){return ka(e)?e:dA(a=a||Za(lA(r),c,KD(s.useCaseSensitiveFileNames)),e)}))})("include"),e("exclude"),e("files"),void 0!==n.compileOnSave&&(t.compileOnSave=n.compileOnSave),W(t.options,i.options),t.watchOptions=t.watchOptions&&i.watchOptions?W({},t.watchOptions,i.watchOptions):t.watchOptions||i.watchOptions)}}function CT(e,t,r,n,a,i,o,s){var c,u=n?hT(n,r):r;if(jD(e))c=NT(e,t,u,a,o,s);else if(RD(e)){c=[];for(var _=0;_t.length?-1:t.length>e.length?1:0}function gw(e,t,r,n,a,i,o,s){var c,u,_=hw(e,t,r,n,a,o,s);if(!qD(a,ca)&&-1===a.indexOf("*")&&ma(i,a))return _(m=i[a],"",!1,a);var l=M(nD(G(i),function(e){return-1!==e.indexOf("*")||qD(e,"/")}),vw);try{for(var d=__values(l),f=d.next();!f.done;f=d.next()){var p=f.value;if(16&t.features&&function(e,t){if(qD(e,"*"))return!1;var r=e.indexOf("*");return-1!==r&&(XD(t,e.substring(0,r))&&qD(t,e.substring(r+1)))}(p,a)){var m=i[p],y=p.indexOf("*");return _(m,a.substring(p.substring(0,y).length,a.length-(p.length-1-y)),!0,p)}if(qD(p,"*")&&XD(a,p.substring(0,p.length-1)))return _(m=i[p],a.substring(p.length-1),!0,p);if(XD(a,p))return _(m=i[p],a.substring(p.length),!1,p)}}catch(e){c={error:e}}finally{try{f&&!f.done&&(u=d.return)&&u.call(d)}finally{if(c)throw c.error}}}function hw(B,J,x,b,k,z,T){return function e(t,r,n,a){var i,o,s,c;{if("string"==typeof t){if(!n&&0=i.length+o.length&&XD(u,i)&&qD(u,o)&&m({ending:_,value:u})){u=u.substring(i.length,u.length-o.length);if(!sA(u))return{value:p.replace("*",u)}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}}else if(dD(a,function(e){return 0!==e.ending&&n===e.value})||dD(a,function(e){return 0===e.ending&&n===e.value&&m(e)}))return{value:p}}(i.value);if("object"==typeof o)return o.value}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}function m(e){var t=e.ending,e=e.value;return 0!==t||e===mC(l,[t],f,r)}}function fC(e,t,u,_,l,r,n,d){var f=e.path,e=e.isRedirect,p=t.getCanonicalFileName,t=t.sourceDirectory;if(_.fileExists&&_.readFile){var m=jm(f);if(m){var y=Yw(r,l,u).getAllowedEndingsInPreferredOrder(),a=f,i=!1;if(!n)for(var o=m.packageRootIndex,s=void 0;;){var c=function(e){var t=f.substring(0,e),r=dA(t,"package.json"),n=f,a=!1,i=null==(e=null==(i=_.getPackageJsonInfoCache)?void 0:i.call(_))?void 0:e.getPackageJsonInfo(r);if("object"==typeof i||void 0===i&&_.fileExists(r)){e=(null==i?void 0:i.contents.packageJsonContent)||JSON.parse(_.readFile(r)),i=d||u.impliedNodeFormat;if(Op(l)){r=Aw(t.substring(m.topLevelPackageNameIndex+1)),i=bS(l,99===i),i=e.exports?function n(a,i,o,s,c,u,e){var t,r;if(void 0===e&&(e=0),"string"==typeof c){var _=fA(dA(o,c),void 0),l=cm(i)?pm(i)+gC(i,a):void 0;switch(e){case 0:if(0===pA(i,_)||l&&0===pA(l,_))return{moduleFileToTry:s};break;case 1:if(Ga(_,i)){var d=Ya(_,i,!1);return{moduleFileToTry:fA(dA(dA(s,c),d),void 0)}}break;case 2:var f=_.indexOf("*"),d=_.slice(0,f),f=_.slice(f+1);if(XD(i,d)&&qD(i,f)){var p=i.slice(d.length,i.length-f.length);return{moduleFileToTry:s.replace("*",p)}}if(l&&XD(l,d)&&qD(l,f))return p=l.slice(d.length,l.length-f.length),{moduleFileToTry:s.replace("*",p)}}}else{if(Array.isArray(c))return KN(c,function(e){return n(a,i,o,s,e,u)});if("object"==typeof c&&null!==c){if(mw(c))return KN(G(c),function(e){var t=fA(dA(s,e),void 0),r=qD(e,"/")?1:WD(e,"*")?2:0;return n(a,i,o,t,c[e],u,r)});try{for(var m=__values(G(c)),y=m.next();!y.done;y=m.next()){var v=y.value;if(("default"===v||0<=u.indexOf(v)||xw(u,v))&&(v=c[v],v=n(a,i,o,s,v,u,e)))return v}}catch(e){t={error:e}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(t)throw t.error}}}}}(l,f,t,r,e.exports,i):void 0;if(i){var o=cm(i.moduleFileToTry)?{moduleFileToTry:pm(i.moduleFileToTry)+gC(i.moduleFileToTry,l)}:i;return __assign(__assign({},o),{verbatimFromExports:!0})}if(e.exports)return{moduleFileToTry:f,blockedByExports:!0}}o=e.typesVersions?mS(e.typesVersions):void 0;o&&(void 0===(s=dC(f.slice(t.length+1),o.paths,y,_,l))?a=!0:n=dA(t,s));var s=e.typings||e.types||e.main||"index.js";if(jD(s)&&(!a||!Tm(gm(o.paths),s))){var s=Ja(s,t,p),c=p(n);if(pm(s)===pm(c))return{packageRootPath:t,moduleFileToTry:n};if("module"!==e.type&&!_A(c,wu)&&XD(c,s)&&lA(c)===za(s)&&"index"===pm(Ea(c)))return{packageRootPath:t,moduleFileToTry:n}}}else{c=p(n.substring(m.packageRootIndex+1));if("index.d.ts"===c||"index.js"===c||"index.ts"===c||"index.tsx"===c)return{moduleFileToTry:n,packageRootPath:t}}return{moduleFileToTry:n}}(o),v=c.moduleFileToTry,g=c.packageRootPath,h=c.blockedByExports,c=c.verbatimFromExports;if(1!==iM(l)){if(h)return;if(c)return v}if(g){a=g,i=!0;break}if(s=s||v,-1===(o=f.indexOf(ca,o+1))){a=mC(s,y,l,_);break}}if(!e||i){n=_.getGlobalTypingsCacheLocation&&_.getGlobalTypingsCacheLocation(),e=p(a.substring(0,m.topLevelNodeModulesIndex));if(XD(t,e)||n&&XD(p(n),e)){n=a.substring(m.topLevelPackageNameIndex+1),e=Aw(n);return 1===iM(l)&&e===n?void 0:e}}}}}function pC(t,e,r){return uD(e,function(e){e=hC(t,e,r);return void 0!==e&&xC(e)?void 0:e})}function mC(e,t,r,n){if(_A(e,[".json",".mjs",".cjs"]))return e;var a=pm(e);if(e===a)return e;var i=t.indexOf(2),o=t.indexOf(3);if(_A(e,[".mts",".cts"])&&-1!==o&&o"+e.moduleSpecifier.text:">"});if(i.length!==n.length)try{for(var o=__values(i),s=o.next();!s.done;s=o.next())!function(t){1(1&e.flags?fF:dF))}function K(e,t){var r=t.flags,e=function(e,T){k&&k.throwIfCancellationRequested&&k.throwIfCancellationRequested();var t=8388608&T.flags;if(T.flags&=-8388609,!e)return 262144&T.flags?(T.approximateLength+=3,uR.createKeywordTypeNode(133)):void(T.encounteredError=!0);536870912&T.flags||(e=n_(e));if(1&e.flags)return e.aliasSymbol?uR.createTypeReferenceNode(function e(t){var r=uR.createIdentifier(OA(t.escapedName));return t.parent?uR.createQualifiedName(e(t.parent),r):r}(e.aliasSymbol),Y(e.aliasTypeArguments,T)):e===ft?pR(uR.createKeywordTypeNode(133),3,"unresolved"):(T.approximateLength+=3,uR.createKeywordTypeNode(e===mt?141:133));if(2&e.flags)return uR.createKeywordTypeNode(159);if(4&e.flags)return T.approximateLength+=6,uR.createKeywordTypeNode(154);if(8&e.flags)return T.approximateLength+=6,uR.createKeywordTypeNode(150);if(64&e.flags)return T.approximateLength+=6,uR.createKeywordTypeNode(163);if(16&e.flags&&!e.aliasSymbol)return T.approximateLength+=7,uR.createKeywordTypeNode(136);if(1056&e.flags){if(8&e.symbol.flags){var r=go(e.symbol),n=de(r,T,788968);if(Pc(r)===e)return n;r=RA(e.symbol);return bA(r,0)?x(n,uR.createTypeReferenceNode(r,void 0)):ZR(n)?(n.isTypeOf=!0,uR.createIndexedAccessTypeNode(n,uR.createLiteralTypeNode(uR.createStringLiteral(r)))):BR(n)?uR.createIndexedAccessTypeNode(uR.createTypeQueryNode(n.typeName),uR.createLiteralTypeNode(uR.createStringLiteral(r))):rA.fail("Unhandled type node kind returned from `symbolToTypeNode`.")}return de(e.symbol,T,788968)}if(128&e.flags)return T.approximateLength+=e.value.length+2,uR.createLiteralTypeNode(lR(uR.createStringLiteral(e.value,!!(268435456&T.flags)),16777216));if(256&e.flags){r=e.value;return T.approximateLength+=(""+r).length,uR.createLiteralTypeNode(r<0?uR.createPrefixUnaryExpression(41,uR.createNumericLiteral(-r)):uR.createNumericLiteral(r))}if(2048&e.flags)return T.approximateLength+=EM(e.value).length+1,uR.createLiteralTypeNode(uR.createBigIntLiteral(e.value));if(512&e.flags)return T.approximateLength+=e.intrinsicName.length,uR.createLiteralTypeNode("true"===e.intrinsicName?uR.createTrue():uR.createFalse());if(8192&e.flags){if(!(1048576&T.flags)){if(Uo(e.symbol,T.enclosingDeclaration))return T.approximateLength+=6,de(e.symbol,T,111551);T.tracker.reportInaccessibleUniqueSymbolError&&T.tracker.reportInaccessibleUniqueSymbolError()}return T.approximateLength+=13,uR.createTypeOperatorNode(158,uR.createKeywordTypeNode(155))}if(16384&e.flags)return T.approximateLength+=4,uR.createKeywordTypeNode(116);if(32768&e.flags)return T.approximateLength+=9,uR.createKeywordTypeNode(157);if(65536&e.flags)return T.approximateLength+=4,uR.createLiteralTypeNode(uR.createNull());if(131072&e.flags)return T.approximateLength+=5,uR.createKeywordTypeNode(146);if(4096&e.flags)return T.approximateLength+=6,uR.createKeywordTypeNode(155);if(67108864&e.flags)return T.approximateLength+=6,uR.createKeywordTypeNode(151);if(HM(e))return 4194304&T.flags&&(T.encounteredError||32768&T.flags||(T.encounteredError=!0),null!=(i=(o=T.tracker).reportInaccessibleThisError)&&i.call(o)),T.approximateLength+=4,uR.createThisTypeNode();if(!t&&e.aliasSymbol&&(16384&T.flags||zo(e.aliasSymbol,T.enclosingDeclaration))){var a=Y(e.aliasTypeArguments,T);return!Po(e.aliasSymbol.escapedName)||32&e.aliasSymbol.flags?1===HN(a)&&e.aliasSymbol===kr.symbol?uR.createArrayTypeNode(a[0]):de(e.aliasSymbol,T,788968,a):uR.createTypeReferenceNode(uR.createIdentifier(""),a)}var i=WL(e);if(4&i)return rA.assert(!!(524288&e.flags)),e.node?v(e,h):h(e);if(262144&e.flags||3&i){if(262144&e.flags&&eD(T.inferTypeParameters,e)){T.approximateLength+=RA(e.symbol).length+6;var o=void 0,t=Mu(e);return t&&((a=tl(e,!0))&&Tp(t,a)||(T.approximateLength+=9,o=t&&K(t,T))),uR.createInferTypeNode(ne(e,T,o))}if(4&T.flags&&262144&e.flags&&!zo(e.symbol,T.enclosingDeclaration)){var s=fe(e,T);return T.approximateLength+=LA(s).length,uR.createTypeReferenceNode(uR.createIdentifier(LA(s)),void 0)}if(e.symbol)return de(e.symbol,T,788968);s=(e===dr||e===fr)&&S&&S.symbol?(e===fr?"sub-":"super-")+RA(S.symbol):"?";return uR.createTypeReferenceNode(uR.createIdentifier(s),void 0)}1048576&e.flags&&e.origin&&(e=e.origin);if(3145728&e.flags){s=1048576&e.flags?function(e){for(var t=[],r=0,n=0;n=D_(t.target.typeParameters)}function be(e){return ci(e).fakeScopeForSignatureDeclaration?e.parent:e}function ke(t,e,r,n,a,i){if(!hs(e)&&n){var o=he(r,be(n));if(o&&!TE(o)&&!OR(o)){n=nL(o);if(function(e,t,r){e=Uf(e);if(e===r)return!0;if(CR(t)&&t.questionToken)return Cv(r,524288)===e;return!1}(n,o,e)&&xe(n,e)){var s=Se(t,n,a,i);if(s)return s}}}s=t.flags;8192&e.flags&&e.symbol===r&&(!t.enclosingDeclaration||dD(r.declarations,function(e){return CF(e)===CF(t.enclosingDeclaration)}))&&(t.flags|=1048576);e=K(e,t);return t.flags=s,e}function Te(e,t,r){var n=!1,a=EL(e);if(cI(e)&&(SI(a)||CI(a.parent)||TR(a.parent)&&wI(a.parent.left)&&SI(a.parent.right)))return{introducesError:n=!0,node:e};a=Yi(a,67108863,!0,!0);if(a&&(0!==qo(a,t.enclosingDeclaration,67108863,!1).accessibility?n=!0:(t.tracker.trackSymbol(a,t.enclosingDeclaration,67108863),null!=r&&r(a)),xR(e))){r=Pc(a),t=262144&a.flags&&!zo(r.symbol,t.enclosingDeclaration)?fe(r,t):uR.cloneNode(e);return t.symbol=a,{introducesError:n,node:lR(_R(t,e),16777216)}}return{introducesError:n,node:e}}function Se(c,e,u,_){k&&k.throwIfCancellationRequested&&k.throwIfCancellationRequested();var l=!1,d=CF(e),t=TJ(e,function n(a){if(fB(a)||326===a.kind)return uR.createKeywordTypeNode(133);if(pB(a))return uR.createKeywordTypeNode(159);if(mB(a))return uR.createUnionTypeNode([TJ(a.type,n,FE),uR.createLiteralTypeNode(uR.createNull())]);if(vB(a))return uR.createUnionTypeNode([TJ(a.type,n,FE),uR.createKeywordTypeNode(157)]);if(yB(a))return TJ(a.type,n);if(hB(a))return uR.createArrayTypeNode(TJ(a.type,n,FE));if(xB(a))return uR.createTypeLiteralNode(iD(a.jsDocPropertyTags,function(e){var t=xR(e.name)?e.name:e.name.right,r=vs(Uf(a),t.escapedText),r=r&&e.typeExpression&&Uf(e.typeExpression.type)!==r?K(r,c):void 0;return uR.createPropertySignature(void 0,t,e.isBracketed||e.typeExpression&&vB(e.typeExpression.type)?uR.createToken(58):void 0,r||e.typeExpression&&TJ(e.typeExpression.type,n,FE)||uR.createKeywordTypeNode(133))}));if(BR(a)&&xR(a.typeName)&&""===a.typeName.escapedText)return _R(uR.createKeywordTypeNode(133),a);if((hj(a)||BR(a))&&lI(a))return uR.createTypeLiteralNode([uR.createIndexSignature(void 0,[uR.createParameterDeclaration(void 0,void 0,"x",void 0,TJ(a.typeArguments[0],n,FE))],TJ(a.typeArguments[1],n,FE))]);if(gB(a)){var r;return zI(a)?uR.createConstructorTypeNode(void 0,SJ(a.typeParameters,n,wR),uD(a.parameters,function(e,t){return e.name&&xR(e.name)&&"new"===e.name.escapedText?void(r=e.type):uR.createParameterDeclaration(void 0,i(e),o(e,t),e.questionToken,TJ(e.type,n,FE),void 0)}),TJ(r||a.type,n,FE)||uR.createKeywordTypeNode(133)):uR.createFunctionTypeNode(SJ(a.typeParameters,n,wR),iD(a.parameters,function(e,t){return uR.createParameterDeclaration(void 0,i(e),o(e,t),e.questionToken,TJ(e.type,n,FE),void 0)}),TJ(a.type,n,FE)||uR.createKeywordTypeNode(133))}if(BR(a)&&_I(a)&&(!xe(a,Uf(a))||wl(a)||it===vl(a,788968,!0)))return _R(K(Uf(a),c),a);if(yP(a)){var e=ci(a).resolvedSymbol;return!_I(a)||!e||(a.isTypeOf||788968&e.flags)&&HN(a.typeArguments)>=D_(mc(e))?uR.updateImportTypeNode(a,uR.updateLiteralTypeNode(a.argument,s(a,a.argument.literal)),a.assertions,a.qualifier,SJ(a.typeArguments,n,FE),a.isTypeOf):_R(K(Uf(a),c),a)}if(hE(a)||AL(a)){var t=Te(a,c,u),e=t.introducesError,t=t.node;if(l=l||e,t!==a)return t}d&&qR(a)&&gA(d,a.pos).line===gA(d,a.end).line&&lR(a,1);return wJ(a,n,iU);function i(e){return e.dotDotDotToken||(e.type&&hB(e.type)?uR.createToken(26):void 0)}function o(e,t){return e.name&&xR(e.name)&&"this"===e.name.escapedText?"this":i(e)?"args":"arg".concat(t)}function s(e,t){if(_){if(c.tracker&&c.tracker.moduleResolverHost){var e=lN(e);if(e){var r=KD(!!O.useCaseSensitiveFileNames),r={getCanonicalFileName:r,getCurrentDirectory:function(){return c.tracker.moduleResolverHost.getCurrentDirectory()},getCommonSourceDirectory:function(){return c.tracker.moduleResolverHost.getCommonSourceDirectory()}},r=KO(r,e);return uR.createStringLiteral(r)}}}else c.tracker&&c.tracker.trackExternalModuleSymbolOfImportTypeNode&&((r=eo(t,t,void 0))&&c.tracker.trackExternalModuleSymbolOfImportTypeNode(r));return t}},FE);if(!l)return t===e?UB(uR.cloneNode(e),e):t}var we=vF(),Ce=Qa(4,"undefined");Ce.declarations=[];var Ne=Qa(1536,"globalThis",8);Ne.exports=we,Ne.declarations=[],we.set(Ne.escapedName,Ne);var De,Ae,Ee,Fe=Qa(4,"arguments"),Pe=Qa(4,"require"),Ie=ee.verbatimModuleSyntax?"verbatimModuleSyntax":"isolatedModules",Oe=!ee.verbatimModuleSyntax||!!ee.importsNotUsedAsValues,Le=0,Me=0,Re={getNodeCount:function(){return ED(O.getSourceFiles(),function(e,t){return e+t.nodeCount},0)},getIdentifierCount:function(){return ED(O.getSourceFiles(),function(e,t){return e+t.identifierCount},0)},getSymbolCount:function(){return ED(O.getSourceFiles(),function(e,t){return e+t.symbolCount},o)},getTypeCount:function(){return i},getInstantiationCount:function(){return s},getRelationCacheSizes:function(){return{assignable:Aa.size,identity:Fa.size,subtype:Na.size,strictSubtype:Da.size}},isUndefinedSymbol:function(e){return e===Ce},isArgumentsSymbol:function(e){return e===Fe},isUnknownSymbol:function(e){return e===it},getMergedSymbol:mo,getDiagnostics:fC,getGlobalDiagnostics:function(){return pC(),Sa.getGlobalDiagnostics()},getRecursionIdentity:Sm,getUnmatchedProperties:By,getTypeOfSymbolAtLocation:function(e,t){t=PA(t);return t?function(e,t){if(e=To(e),(80===t.kind||81===t.kind)&&(LL(t)&&(t=t.parent),$P(t)&&(!tO(t)||VL(t)))){var r=cy(xT(t));if(To(ci(t).resolvedSymbol)===e)return r}if(uO(t)&&$E(t.parent)&&Qs(t.parent))return $s(t.parent.symbol);return cc(e)}(e,t):dt},getTypeOfSymbol:sc,getSymbolsOfParameterPropertyDeclaration:function(e,t){e=PA(e,CR);return void 0===e?rA.fail("Cannot get symbols of a synthetic parameter that cannot be resolved to a parse-tree node."):(rA.assert(CA(e,e.parent)),function(e,t){var r=e.parent,e=e.parent.parent,r=_i(r.locals,t,111551),t=_i(Gc(e.symbol),t,111551);if(r&&t)return[r,t];return rA.fail("There should exist two symbols, one as property declaration and one as parameter declaration")}(e,IA(t)))},getDeclaredTypeOfSymbol:Pc,getPropertiesOfType:Ou,getPropertyOfType:function(e,t){return u_(e,IA(t))},getPrivateIdentifierPropertyOfType:function(e,t,r){r=PA(r);if(r){r=dx(IA(t),r);return r?mx(e,r):void 0}},getTypeOfPropertyOfType:function(e,t){return vs(e,IA(t))},getIndexInfoOfType:function(e,t){return g_(e,0===t?wt:Ct)},getIndexInfosOfType:v_,getIndexInfosOfIndexSymbol:Z_,getSignaturesOfType:l_,getIndexTypeOfType:function(e,t){return h_(e,0===t?wt:Ct)},getIndexType:function(e){return jd(e)},getBaseTypes:Tc,getBaseTypeOfLiteralType:Vm,getWidenedType:xy,getTypeFromTypeNode:function(e){e=PA(e,FE);return e?Uf(e):dt},getParameterType:ek,getParameterIdentifierInfoAtPosition:function(e,t){if(324===(null==(i=e.declaration)?void 0:i.kind))return;var r=e.parameters.length-(bJ(e)?1:0);if(t>",0,ut),Sn=Zc(void 0,void 0,void 0,WN,ut,void 0,0,0),wn=Zc(void 0,void 0,void 0,WN,dt,void 0,0,0),Cn=Zc(void 0,void 0,void 0,WN,ut,void 0,0,0),Nn=Zc(void 0,void 0,void 0,WN,Rt,void 0,0,0),Dn=Q_(Ct,wt,!0),An=new Map,En={get yieldType(){return rA.fail("Not supported")},get returnType(){return rA.fail("Not supported")},get nextType(){return rA.fail("Not supported")}},Fn=QS(ut,ut,ut),Pn=QS(ut,ut,yt),In=QS(Mt,ut,gt),On={iterableCacheKey:"iterationTypesOfAsyncIterable",iteratorCacheKey:"iterationTypesOfAsyncIterator",iteratorSymbolName:"asyncIterator",getGlobalIteratorType:function(e){return(Gr=Gr||Ol("AsyncIterator",3,e))||ar},getGlobalIterableType:Vl,getGlobalIterableIteratorType:function(e){return(Xr=Xr||Ol("AsyncIterableIterator",1,e))||ar},getGlobalGeneratorType:function(e){return(Qr=Qr||Ol("AsyncGenerator",3,e))||ar},resolveIterationType:function(e,t){return rS(e,t,mA.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member)},mustHaveANextMethodDiagnostic:mA.An_async_iterator_must_have_a_next_method,mustBeAMethodDiagnostic:mA.The_0_property_of_an_async_iterator_must_be_a_method,mustHaveAValueDiagnostic:mA.The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property},Ln={iterableCacheKey:"iterationTypesOfIterable",iteratorCacheKey:"iterationTypesOfIterator",iteratorSymbolName:"iterator",getGlobalIteratorType:function(e){return(Ur=Ur||Ol("Iterator",3,e))||ar},getGlobalIterableType:ql,getGlobalIterableIteratorType:function(e){return(Vr=Vr||Ol("IterableIterator",1,e))||ar},getGlobalGeneratorType:function(e){return(qr=qr||Ol("Generator",3,e))||ar},resolveIterationType:function(e,t){return e},mustHaveANextMethodDiagnostic:mA.An_iterator_must_have_a_next_method,mustBeAMethodDiagnostic:mA.The_0_property_of_an_iterator_must_be_a_method,mustHaveAValueDiagnostic:mA.The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property},Mn=new Map,Rn=[],jn=new Map,Bn=0,Jn=0,zn=0,Un=!1,Vn=0,qn=[],Wn=[],Hn=[],Kn=0,Gn=[],Xn=[],Qn=0,Yn=Lf(""),Zn=Mf(0),$n=Rf({negative:!1,base10Value:"0"}),ea=[],ta=[],ra=[],na=0,aa=!1,ia=0,oa=10,sa=[],ca=[],ua=[],_a=[],la=[],da=[],fa=[],pa=[],ma=[],ya=[],va=[],ga=[],ha=[],xa=[],ba=[],ka=[],Ta=[],Sa=JO(),wa=JO(),Ca=hd(PD(cJ.keys(),Lf)),Na=new Map,Da=new Map,Aa=new Map,Ea=new Map,Fa=new Map,Pa=new Map,Ia=vF();Ia.set(Ce.escapedName,Ce);var Oa=[[".mts",".mjs"],[".ts",".js"],[".cts",".cjs"],[".mjs",".mjs"],[".js",".js"],[".cjs",".cjs"],[".tsx",1===ee.jsx?".jsx":".js"],[".jsx",".jsx"],[".json",".json"]];return function(){var t,e,r,n,a,i,o,s,c,u,_,l,d,f,p;try{for(var m=__values(O.getSourceFiles()),y=m.next();!y.done;y=m.next())eJ(v=y.value,ee)}catch(e){t={error:e}}finally{try{y&&!y.done&&(e=m.return)&&e.call(m)}finally{if(t)throw t.error}}pr=new Map;try{for(var v,g=__values(O.getSourceFiles()),h=g.next();!h.done;h=g.next())if(!(v=h.value).redirectInfo){if(!_P(v)){var x=v.locals.get("globalThis");if(null!=x&&x.declarations)try{for(var b=(a=void 0,__values(x.declarations)),k=b.next();!k.done;k=b.next()){var T=k.value;Sa.add(tP(T,mA.Declaration_name_conflicts_with_built_in_global_identifier_0,"globalThis"))}}catch(e){a={error:e}}finally{try{k&&!k.done&&(i=b.return)&&i.call(b)}finally{if(a)throw a.error}}ii(we,v.locals)}v.jsGlobalAugmentations&&ii(we,v.jsGlobalAugmentations),v.patternAmbientModules&&v.patternAmbientModules.length&&(yr=fD(yr,v.patternAmbientModules)),v.moduleAugmentations.length&&(p=p||[]).push(v.moduleAugmentations),v.symbol&&v.symbol.globalExports&&v.symbol.globalExports.forEach(function(e,t){we.has(t)||we.set(t,e)})}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=g.return)&&n.call(g)}finally{if(r)throw r.error}}if(p)try{for(var S=__values(p),w=S.next();!w.done;w=S.next()){var C=w.value;try{for(var N=(c=void 0,__values(C)),D=N.next();!D.done;D=N.next())zF((F=D.value).parent)&&oi(F)}catch(e){c={error:e}}finally{try{D&&!D.done&&(u=N.return)&&u.call(N)}finally{if(c)throw c.error}}}}catch(e){o={error:e}}finally{try{w&&!w.done&&(s=S.return)&&s.call(S)}finally{if(o)throw o.error}}if(function(i,o){Ia.forEach(function(e,t){var r,n,a=i.get(t);a?KN(a.declarations,(r=OA(t),n=o,function(e){return Sa.add(tP(e,n,r))})):i.set(t,e)})}(we,mA.Declaration_name_conflicts_with_built_in_global_identifier_0),si(Ce).type=ht,si(Fe).type=Ol("IArguments",0,!0),si(it).type=dt,si(Ne).type=Eo(16,Ne),kr=Ol("Array",1,!0),gr=Ol("Object",0,!0),hr=Ol("Function",0,!0),xr=R&&Ol("CallableFunction",0,!0)||hr,br=R&&Ol("NewableFunction",0,!0)||hr,Sr=Ol("String",0,!0),wr=Ol("Number",0,!0),Cr=Ol("Boolean",0,!0),Nr=Ol("RegExp",0,!0),Ar=Yl(ut),(Er=Yl(_t))===$t&&(Er=Mo(void 0,M,WN,WN,WN)),Tr=Hl("ReadonlyArray",1)||kr,Fr=Tr?Gl(Tr,[ut]):Ar,Dr=Hl("ThisType",1),p)try{for(var A=__values(p),E=A.next();!E.done;E=A.next()){C=E.value;try{for(var F,P=(d=void 0,__values(C)),I=P.next();!I.done;I=P.next())zF((F=I.value).parent)||oi(F)}catch(e){d={error:e}}finally{try{I&&!I.done&&(f=P.return)&&f.call(P)}finally{if(d)throw d.error}}}}catch(e){_={error:e}}finally{try{E&&!E.done&&(l=A.return)&&l.call(A)}finally{if(_)throw _.error}}pr.forEach(function(e){var t=e.firstFile,r=e.secondFile,e=e.conflictingSymbols;e.size<8?e.forEach(function(e,t){var r,n,a,i,o=e.isBlockScoped,s=e.firstFileLocations,c=e.secondFileLocations,u=o?mA.Cannot_redeclare_block_scoped_variable_0:mA.Duplicate_identifier_0;try{for(var _=__values(s),l=_.next();!l.done;l=_.next())ai(l.value,u,t,c)}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=_.return)&&n.call(_)}finally{if(r)throw r.error}}try{for(var d=__values(c),f=d.next();!f.done;f=d.next())ai(f.value,u,t,s)}catch(e){a={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(a)throw a.error}}}):(e=PD(e.keys()).join(", "),Sa.add(SM(tP(t,mA.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0,e),tP(r,mA.Conflicts_are_in_this_file))),Sa.add(SM(tP(r,mA.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0,e),tP(t,mA.Conflicts_are_in_this_file))))}),pr=void 0}(),Re;function La(e){return e?tt.get(e):void 0}function Ma(e,t){return e&&tt.set(e,t),t}function Ra(e){if(e){var t=CF(e);if(t)if(Zj(e)){if(t.localJsxFragmentNamespace)return t.localJsxFragmentNamespace;var r=t.pragmas.get("jsxfrag");if(r){var n=RD(r)?r[0]:r;if(t.localJsxFragmentFactory=GB(n.arguments.factory,V),TJ(t.localJsxFragmentFactory,Ba,hE),t.localJsxFragmentFactory)return t.localJsxFragmentNamespace=EL(t.localJsxFragmentFactory).escapedText}n=_N(e);if(n)return t.localJsxFragmentFactory=n,t.localJsxFragmentNamespace=EL(n).escapedText}else{n=ja(t);if(n)return t.localJsxNamespace=n}}return bn||(bn="React",ee.jsxFactory?(TJ(kn=GB(ee.jsxFactory,V),Ba),kn&&(bn=EL(kn).escapedText)):ee.reactNamespace&&(bn=IA(ee.reactNamespace))),kn=kn||uR.createQualifiedName(uR.createIdentifier(OA(bn)),"createElement"),bn}function ja(e){if(e.localJsxNamespace)return e.localJsxNamespace;var t=e.pragmas.get("jsx");if(t){t=RD(t)?t[0]:t;if(e.localJsxFactory=GB(t.arguments.factory,V),TJ(e.localJsxFactory,Ba,hE),e.localJsxFactory)return e.localJsxNamespace=EL(e.localJsxFactory).escapedText}}function Ba(e){return MM(e,-1,-1),wJ(e,Ba,iU)}function Ja(e,t,r){for(var n=[],a=3;a=n&&u.pos<=a){var _=uR.createPropertyAccessExpression(uR.createThis(),e);if(jM(_.expression,_),jM(_,u),_.flowNode=u.returnFlowNode,!Qp(fg(_,t,iy(t))))return!0}}}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}return!1}(t,sc(yo(n)),nD(n.parent.members,PR),n.parent.pos,e.pos))return!0}}else if(!(172===n.kind&&!lL(n))||IP(r)!==IP(n))return!0;return!1})}function s(t,e,r){return!(e.end>t.end)&&void 0===FA(e,function(e){if(e===t)return"quit";switch(e.kind){case 219:return!0;case 172:return!r||!(AR(t)&&e.parent===t.parent||CA(t,t.parent)&&e.parent===t.parent.parent)||"quit";case 241:switch(e.parent.kind){case 177:case 174:case 178:return!0;default:return!1}default:return!1}})}}function di(e,t,r){var n=rM(ee),t=t;if(CR(r)&&t.body&&e.valueDeclaration&&e.valueDeclaration.pos>=t.body.pos&&e.valueDeclaration.end<=t.body.end&&2<=n){e=ci(t);return void 0===e.declarationRequiresScopeChange&&(e.declarationRequiresScopeChange=KN(t.parameters,function(e){return a(e.name)||!!e.initializer&&a(e.initializer)})||!1),!e.declarationRequiresScopeChange}function a(e){switch(e.kind){case 219:case 218:case 262:case 176:return!1;case 174:case 177:case 178:case 303:return a(e.name);case 172:return dL(e)?!C:a(e.name);default:return cE(e)||aE(e)?n<7:tj(e)&&e.dotDotDotToken&&$R(e.parent)?n<4:!FE(e)&&HB(e,a)||!1}}}function fi(e){return BE(e)&&uE(e.type)||NB(e)&&uE(e.typeExpression)}function pi(e,t,r,n,a,i,o,s){return void 0===o&&(o=!1),void 0===s&&(s=!0),mi(e,t,r,n,a,i,o,s,_i)}function mi(e,i,o,s,c,t,r,u,a){var _,n,l,d,f,p,m=e,y=!1,v=e,g=!1;e:for(;e;){if("const"===i&&fi(e))return;if(WE(e)&&n&&e.name===n&&(e=(n=e).parent),KE(e)&&e.locals&&!ui(e)&&(_=a(e.locals,i,o))){var h=!0;if(bE(e)&&n&&n!==e.body?(o&_.flags&788968&&327!==n.kind&&(h=!!(262144&_.flags)&&(n===e.type||169===n.kind||348===n.kind||349===n.kind||168===n.kind)),o&_.flags&3&&(di(_,e,n)?h=!1:1&_.flags&&(h=169===n.kind||n===e.type&&!!FA(_.valueDeclaration,CR)))):194===e.kind&&(h=n===e.trueType),h)break e;_=void 0}switch(y=y||function(e,t){if(219!==e.kind&&218!==e.kind)return UR(e)||(TE(e)||172===e.kind&&!lL(e))&&(!t||t!==e.name);if(t&&t===e.name)return!1;if(e.asteriskToken||_L(e,512))return!0;return!UP(e)}(e,n),e.kind){case 312:if(!_P(e))break;g=!0;case 267:var x=(null==(x=yo(e))?void 0:x.exports)||M;if(312===e.kind||Mj(e)&&33554432&e.flags&&!zF(e)){if(_=x.get("default")){var b=RL(_);if(b&&_.flags&o&&b.escapedName===i)break e;_=void 0}b=x.get(i);if(b&&2097152===b.flags&&(mF(b,281)||mF(b,280)))break}if("default"!==i&&(_=a(x,i,2623475&o))){if(!uB(e)||!e.commonJsModuleIndicator||null!=(x=_.declarations)&&x.some(UI))break e;_=void 0}break;case 266:if(_=a((null==(p=yo(e))?void 0:p.exports)||M,i,8&o)){!s||!sM(ee)||33554432&e.flags||CF(e)===CF(_.valueDeclaration)||Ua(v,mA.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,OA(i),Ie,"".concat(OA(vo(e).escapedName),".").concat(OA(i)));break e}break;case 172:lL(e)||(p=wo(e.parent))&&p.locals&&a(p.locals,i,111551&o)&&(rA.assertNode(e,AR),d=e);break;case 263:case 231:case 264:if(_=a(yo(e).members||M,i,788968&o)){if(!function(e,t){var r,n;if(e.declarations)try{for(var a=__values(e.declarations),i=a.next();!i.done;i=a.next()){var o=i.value;if(168===o.kind)if((DB(o.parent)?YI(o.parent):o.parent)===t)return!(DB(o.parent)&&QN(o.parent.parent.tags,UI))}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return!1}(_,e)){_=void 0;break}if(n&&lL(n))return void(s&&Ua(v,mA.Static_members_cannot_reference_class_type_parameters));break e}if(vj(e)&&32&o){var k=e.name;if(k&&i===k.escapedText){_=e.symbol;break e}}break;case 233:if(n===e.expression&&96===e.parent.token){k=e.parent.parent;if(NE(k)&&(_=a(yo(k).members,i,788968&o)))return void(s&&Ua(v,mA.Base_class_expressions_cannot_reference_class_type_parameters))}break;case 167:if(T=e.parent.parent,(NE(T)||264===T.kind)&&(_=a(yo(T).members,i,788968&o)))return void(s&&Ua(v,mA.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type));break;case 219:if(2<=rM(ee))break;case 174:case 176:case 177:case 178:case 262:if(3&o&&"arguments"===i){_=Fe;break e}break;case 218:if(3&o&&"arguments"===i){_=Fe;break e}if(16&o){var T=e.name;if(T&&i===T.escapedText){_=e.symbol;break e}}break;case 170:e.parent&&169===e.parent.kind&&(e=e.parent),e.parent&&(CE(e.parent)||263===e.parent.kind)&&(e=e.parent);break;case 353:case 345:case 347:var S=ZI(e);S&&(e=S.parent);break;case 169:n&&(n===e.initializer||n===e.name&&PE(n))&&(f=f||e);break;case 208:n&&(n===e.initializer||n===e.name&&PE(n))&&LO(e)&&!f&&(f=e);break;case 195:if(262144&o){S=e.typeParameter.name;if(S&&i===S.escapedText){_=e.typeParameter.symbol;break e}}break;case 281:n&&n===e.propertyName&&e.parent.parent.moduleSpecifier&&(e=e.parent.parent.parent)}!function(e){switch(e.kind){case 262:case 263:case 264:case 266:case 265:case 267:return!0;default:return!1}}(e)||(l=e),e=DB(n=e)?GI(e)||e.parent:(wB(e)||CB(e))&&XI(e)||e.parent}if(!t||!_||l&&_===l.symbol||(_.isReferenced|=o),!_){if(n&&(rA.assertNode(n,uB),n.commonJsModuleIndicator&&"exports"===i&&o&n.symbol.flags))return n.symbol;r||(_=a(we,i,o))}if(!_&&m&&cI(m)&&m.parent&&dI(m.parent,!1))return Pe;function w(){return d&&!C&&(Ua(v,v&&d.type&&wA(d.type,v.pos)?mA.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor:mA.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor,QF(d.name),vi(c)),1)}if(_){if(!s||!w())return s&&D(function(){var e,t,r,n;v&&(2&o||(32&o||384&o)&&111551==(111551&o))&&(2&(e=To(_)).flags||32&e.flags||384&e.flags)&&function(e,t){if(rA.assert(!!(2&e.flags||32&e.flags||384&e.flags)),!(67108881&e.flags&&32&e.flags)){var r,n,a=null==(n=e.declarations)?void 0:n.find(function(e){return LF(e)||NE(e)||266===e.kind});if(void 0===a)return rA.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration");33554432&a.flags||li(a,t)||(r=void 0,n=QF(JA(a)),2&e.flags?r=Ua(t,mA.Block_scoped_variable_0_used_before_its_declaration,n):32&e.flags?r=Ua(t,mA.Class_0_used_before_its_declaration,n):256&e.flags&&(r=Ua(t,mA.Enum_0_used_before_its_declaration,n)),r&&SM(r,tP(a,mA._0_is_declared_here,n)))}}(e,v),!_||!g||111551!=(111551&o)||16777216&m.flags||HN((t=mo(_)).declarations)&&XN(t.declarations,function(e){return jj(e)||uB(e)&&e.symbol.globalExports})&&qa(!ee.allowUmdGlobalAccess,v,mA._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead,OA(i)),_&&f&&!y&&111551==(111551&o)&&(n=mo(Xc(_)),r=MO(f),n===yo(f)?Ua(v,mA.Parameter_0_cannot_reference_itself,QF(f.name)):n.valueDeclaration&&n.valueDeclaration.pos>f.pos&&r.parent.locals&&a(r.parent.locals,n.escapedName,o)===n&&Ua(v,mA.Parameter_0_cannot_reference_identifier_1_declared_after_it,QF(f.name),QF(v))),!(_&&v&&111551&o&&2097152&_.flags)||111551&_.flags||IM(v)||(t=Hi(_,111551))&&(r=281===t.kind||278===t.kind||280===t.kind?mA._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type:mA._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type,n=OA(i),yi(Ua(v,r,n),t,n))}),_}else s&&D(function(){var e,t,r,n,a;v&&(331===v.parent.kind||function(e,t,r){if(!xR(e)||e.escapedText!==t||yC(e)||eL(e))return!1;var n=RP(e,!1,!1),a=n;for(;a;){if(NE(a.parent)){var i=yo(a.parent);if(!i)break;if(u_(sc(i),t))return Ua(e,mA.Cannot_find_name_0_Did_you_mean_the_static_member_1_0,vi(r),Yo(i)),!0;if(a===n&&!lL(a))if(u_(Pc(i).thisType,t))return Ua(e,mA.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0,vi(r)),!0}a=a.parent}return!1}(v,i,c)||w()||gi(v)||function(e,t,r){var n=1920|(cI(e)?111551:0);if(r===n){var a=zi(pi(e,t,788968&~n,void 0,void 0,!1)),r=e.parent;if(a){if(TR(r)){rA.assert(r.left===e,"Should only be resolving left side of qualified name as a namespace");n=r.right.escapedText;if(u_(Pc(a),n))return Ua(r,mA.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1,OA(t),OA(n)),!0}return Ua(e,mA._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here,OA(t)),!0}}return!1}(v,i,o)||function(e,t){if(hi(t)&&281===e.parent.kind)return Ua(e,mA.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module,t),!0;return!1}(v,i)||function(e,t,r){if(111127&r){if(zi(pi(e,t,1024,void 0,void 0,!1)))return Ua(e,mA.Cannot_use_namespace_0_as_a_value,OA(t)),!0}else if(788544&r)if(zi(pi(e,t,1536,void 0,void 0,!1)))return Ua(e,mA.Cannot_use_namespace_0_as_a_type,OA(t)),!0;return!1}(v,i,o)||function(e,t,r){if(111551&r){if(hi(t))return!function(e){var t=e.parent.parent,e=t.parent;if(t&&e){t=nB(t)&&96===t.token,e=Ij(e);return t&&e}return!1}(e)?Ua(e,mA._0_only_refers_to_a_type_but_is_being_used_as_a_value_here,OA(t)):Ua(e,mA.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes,OA(t)),!0;var n=zi(pi(e,t,788544,void 0,void 0,!1)),r=n&&Vi(n);if(n&&void 0!==r&&!(111551&r)){r=OA(t);return!function(e){switch(e){case"Promise":case"Symbol":case"Map":case"WeakMap":case"Set":case"WeakSet":return!0}return!1}(t)?!function(e,t){e=FA(e.parent,function(e){return!SR(e)&&!DR(e)&&(VR(e)||"quit")});if(e&&1===e.members.length){t=Pc(t);return!!(1048576&t.flags)&&Kk(t,384,!0)}return!1}(e,n)?Ua(e,mA._0_only_refers_to_a_type_but_is_being_used_as_a_value_here,r):Ua(e,mA._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0,r,"K"===r?"P":"K"):Ua(e,mA._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later,r),!0}}return!1}(v,i,o)||function(e,t,r){if(788584&r){r=zi(pi(e,t,111127,void 0,void 0,!1));if(r&&!(1920&r.flags))return Ua(e,mA._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0,OA(t)),!0}return!1}(v,i,o))||(t=e=void 0,c&&(t=function(e){e=vi(e),e=OF().get(e);return e&&wD(e.keys())}(c))&&Ua(v,s,vi(c),t),!t&&u&&ia=a?n.substr(0,a-"...".length)+"...":n}function es(e,t){var r=rs(e.symbol)?$o(e,e.symbol.valueDeclaration):$o(e),n=rs(t.symbol)?$o(t,t.symbol.valueDeclaration):$o(t);return r===n&&(r=ts(e),n=ts(t)),[r,n]}function ts(e){return $o(e,void 0,64)}function rs(e){return e&&e.valueDeclaration&&jE(e.valueDeclaration)&&!hp(e.valueDeclaration)}function ns(e){return void 0===e&&(e=0),848330091&e}function as(e){return e.symbol&&32&e.symbol.flags&&(e===wc(e.symbol)||524288&e.flags&&16777216&WL(e))}function is(a,i,o,e){return void 0===o&&(o=16384),e?t(e).getText():kF(t);function t(e){var t=uR.createTypePredicateNode(2===a.kind||3===a.kind?uR.createToken(131):void 0,1===a.kind||3===a.kind?uR.createIdentifier(a.parameterName):uR.createThisTypeNode(),a.type&&U.typeToTypeNode(a.type,i,70222336|ns(o))),r=vU(),n=i&&CF(i);return r.writeNode(4,t,n,e),e}}function os(e){return 8===e?"private":16===e?"protected":"public"}function ss(e){return e&&e.parent&&268===e.parent.kind&&UF(e.parent.parent)}function cs(e){return 312===e.kind||RF(e)}function us(e,t){var r=si(e).nameType;if(r){if(384&r.flags){e=""+r.value;return bA(e,rM(ee))||qM(e)?qM(e)&&XD(e,"-")?"[".concat(e,"]"):e:'"'.concat(zO(e,34),'"')}if(8192&r.flags)return"[".concat(_s(r.symbol,t),"]")}}function _s(e,t){if(t&&"default"===e.escapedName&&!(16384&t.flags)&&(!(16777216&t.flags)||!e.declarations||t.enclosingDeclaration&&FA(e.declarations[0],cs)!==FA(t.enclosingDeclaration,cs)))return"default";if(e.declarations&&e.declarations.length){var r=GN(e.declarations,function(e){return JA(e)?e:void 0}),n=r&&JA(r);if(r&&n){if(oj(r)&&DI(r))return RA(e);if(SR(n)&&!(4096&BL(e))){var a=si(e).nameType;if(a&&384&a.flags){a=us(e,t);if(void 0!==a)return a}}return QF(n)}if((r=r||e.declarations[0]).parent&&260===r.parent.kind)return QF(r.parent.name);switch(r.kind){case 231:case 218:case 219:return!t||t.encounteredError||131072&t.flags||(t.encounteredError=!0),231===r.kind?"(Anonymous class)":"(Anonymous function)"}}n=us(e,t);return void 0!==n?n:RA(e)}function ls(t){if(t){var e=ci(t);return void 0===e.isVisible&&(e.isVisible=!!function(){switch(t.kind){case 345:case 353:case 347:return!!(t.parent&&t.parent.parent&&t.parent.parent.parent&&uB(t.parent.parent.parent));case 208:return ls(t.parent.parent);case 260:if(PE(t.name)&&!t.name.elements.length)return!1;case 267:case 263:case 264:case 265:case 262:case 266:case 271:if(UF(t))return!0;var e=ys(t);return 1&UN(t)||271!==t.kind&&312!==e.kind&&33554432&e.flags?ls(e):ui(e);case 172:case 171:case 177:case 178:case 174:case 173:if(uL(t,24))return!1;case 176:case 180:case 179:case 181:case 169:case 268:case 184:case 185:case 187:case 183:case 188:case 189:case 192:case 193:case 196:case 202:return ls(t.parent);case 273:case 274:case 276:return!1;case 168:case 312:case 270:return!0;case 277:default:return!1}}()),e.isVisible}return!1}function ds(e,n){var t,a,i;return e.parent&&277===e.parent.kind?t=pi(e,e.escapedText,2998271,void 0,e,!1):281===e.parent.kind&&(t=Ri(e.parent,2998271)),t&&((i=new Set).add(yJ(t)),function r(e){KN(e,function(e){var t=bi(e)||e;n?ci(e).isVisible=!0:hD(a=a||[],t),oI(e)&&(t=e.moduleReference,t=EL(t),(t=pi(e,t.escapedText,901119,void 0,void 0,!1))&&i&&lD(i,yJ(t))&&r(t.declarations))})}(t.declarations)),a}function fs(e,t){var r=ps(e,t);if(!(0<=r))return ea.push(e),ta.push(!0),ra.push(t),1;for(var n=ea.length,a=r;a=D_(e.typeParameters))&&n<=HN(e.typeParameters)})}function xc(e,t,r){var e=hc(e,t,r),n=iD(t,Uf);return oD(e,function(e){return dD(e.typeParameters)?U_(e,n,cI(r)):e})}function bc(e){if(!e.resolvedBaseConstructorType){var t=qL(e.symbol),r=t&&yO(t),n=gc(e);if(!n)return e.resolvedBaseConstructorType=gt;if(!fs(e,1))return dt;var a=TT(n.expression);if(r&&n!==r&&(rA.assert(!r.typeArguments),TT(r.expression)),2621440&a.flags&&Eu(a),!ms())return Ua(e.symbol.valueDeclaration,mA._0_is_referenced_directly_or_indirectly_in_its_own_base_expression,Yo(e.symbol)),e.resolvedBaseConstructorType=dt;if(!(1&a.flags||a===St||vc(a))){t=Ua(n.expression,mA.Type_0_is_not_a_constructor_function_type,$o(a));return 262144&a.flags&&(r=rl(a),n=yt,!r||(r=l_(r,1))[0]&&(n=j_(r[0])),a.symbol.declarations&&SM(t,tP(a.symbol.declarations[0],mA.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1,Yo(a.symbol),$o(n)))),e.resolvedBaseConstructorType=dt}e.resolvedBaseConstructorType=a}return e.resolvedBaseConstructorType}function kc(e,t){Ua(e,mA.Type_0_recursively_references_itself_as_a_base_type,$o(t,void 0,2))}function Tc(e){var t,r,n;if(!e.baseTypesResolved){if(fs(e,7)&&(8&e.objectFlags?e.resolvedBaseTypes=[Yl(hd(oD((n=e).typeParameters,function(e,t){return 8&n.elementFlags[t]?sf(e,Ct):e})||WN),n.readonly)]:96&e.symbol.flags?(32&e.symbol.flags&&function(e){e.resolvedBaseTypes=_F;var t=Zu(bc(e));if(!(2621441&t.flags))return e.resolvedBaseTypes=WN;var r=gc(e),n=t.symbol?Pc(t.symbol):void 0;if(t.symbol&&32&t.symbol.flags&&function(e){var t=e.outerTypeParameters;if(t){var r=t.length-1,e=ll(e);return t[r].symbol!==e[r].symbol}return!0}(n))i=fl(r,t.symbol);else if(1&t.flags)i=t;else{var a=xc(t,r.typeArguments,r);if(!a.length)return Ua(r.expression,mA.No_base_constructor_has_the_specified_number_of_type_arguments),e.resolvedBaseTypes=WN;i=j_(a[0])}if(hs(i))return e.resolvedBaseTypes=WN;if(!Sc(a=n_(i))){var i=$L(c_(void 0,i),mA.Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_known_members,$o(a));return Sa.add(nP(CF(r.expression),r.expression,i)),e.resolvedBaseTypes=WN}if(e===a||lc(a,e))return Ua(e.symbol.valueDeclaration,mA.Type_0_recursively_references_itself_as_a_base_type,$o(e,void 0,2)),e.resolvedBaseTypes=WN;e.resolvedBaseTypes===_F&&(e.members=void 0),e.resolvedBaseTypes=[a]}(e),64&e.symbol.flags&&function(e){var t,r,n,a;if(e.resolvedBaseTypes=e.resolvedBaseTypes||WN,e.symbol.declarations)try{for(var i=__values(e.symbol.declarations),o=i.next();!o.done;o=i.next()){var s=o.value;if(264===s.kind&&hO(s))try{for(var c=(n=void 0,__values(hO(s))),u=c.next();!u.done;u=c.next()){var _=u.value,l=n_(Uf(_));hs(l)||(Sc(l)?e===l||lc(l,e)?kc(s,e):e.resolvedBaseTypes===WN?e.resolvedBaseTypes=[l]:e.resolvedBaseTypes.push(l):Ua(_,mA.An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members))}}catch(e){n={error:e}}finally{try{u&&!u.done&&(a=c.return)&&a.call(c)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}}(e)):rA.fail("type must be class or interface"),!ms()&&e.symbol.declarations))try{for(var a=__values(e.symbol.declarations),i=a.next();!i.done;i=a.next()){var o=i.value;263!==o.kind&&264!==o.kind||kc(o,e)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}e.baseTypesResolved=!0}return e.resolvedBaseTypes}function Sc(e){if(262144&e.flags){var t=Vu(e);if(t)return Sc(t)}return!!(67633153&e.flags&&!Du(e)||2097152&e.flags&&XN(e.types,Sc))}function wc(e){var t,r,n,a=si(e),i=a;return a.declaredType||(t=32&e.flags?1:2,(r=Db(e,e.valueDeclaration&&((n=(null==(n=null==(n=null==(n=(n=e.valueDeclaration)&&Ab(n,!0))?void 0:n.exports)?void 0:n.get("prototype"))?void 0:n.valueDeclaration)&&function(e){if(!e.parent)return!1;var t=e.parent;for(;t&&211===t.kind;)t=t.parent;if(t&&mj(t)&&OL(t.left)&&64===t.operatorToken.kind){e=II(t);return nj(e)&&e}}(n.valueDeclaration))?yo(n):void 0)))&&(a=(e=r).links),n=i.declaredType=a.declaredType=Eo(t,e),r=pc(e),i=mc(e),!r&&!i&&1!=t&&function(e){var t,r,n,a;if(!e.declarations)return 1;try{for(var i=__values(e.declarations),o=i.next();!o.done;o=i.next()){var s=o.value;if(264===s.kind){if(256&s.flags)return;var c=hO(s);if(c)try{for(var u=(n=void 0,__values(c)),_=u.next();!_.done;_=u.next()){var l=_.value;if(AL(l.expression)){l=Yi(l.expression,788968,!0);if(!l||!(64&l.flags)||wc(l).thisType)return}}}catch(e){n={error:e}}finally{try{_&&!_.done&&(a=u.return)&&a.call(u)}finally{if(n)throw n.error}}}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return 1}(e)||(n.objectFlags|=4,n.typeParameters=fD(r,i),n.outerTypeParameters=r,n.localTypeParameters=i,n.instantiations=new Map,n.instantiations.set(al(n.typeParameters),n),(n.target=n).resolvedTypeArguments=n.typeParameters,n.thisType=Fo(e),n.thisType.isThisType=!0,n.thisType.constraint=n)),a.declaredType}function Cc(e){var t=si(e);if(!t.declaredType){if(!fs(e,2))return dt;var r=rA.checkDefined(null==(a=e.declarations)?void 0:a.find(VI),"Type alias symbol with no valid declaration found"),n=UI(r)?r.typeExpression:r.type,a=n?Uf(n):dt;ms()?(n=mc(e))&&(t.typeParameters=n,t.instantiations=new Map,t.instantiations.set(al(n),a)):(a=dt,347===r.kind?Ua(r.typeExpression.type,mA.Type_alias_0_circularly_references_itself,Yo(e)):Ua(BA(r)&&r.name||r,mA.Type_alias_0_circularly_references_itself,Yo(e))),t.declaredType=a}return t.declaredType}function Nc(e){return 1056&e.flags&&8&e.symbol.flags?Pc(go(e.symbol)):e}function Dc(e){var t,r,n,a,i,o=si(e);if(!o.declaredType){var s=[];if(e.declarations)try{for(var c=__values(e.declarations),u=c.next();!u.done;u=c.next()){var _=u.value;if(266===_.kind)try{for(var l=(n=void 0,__values(_.members)),d=l.next();!d.done;d=l.next()){var f,p,m,y=d.value;Wc(y)&&(f=yo(y),m=Pf(void 0!==(p=XC(y))?(i=p,y=yJ(e),m=f,p=void 0,p="".concat(y).concat("string"==typeof i?"@":"#").concat(i),y=1024|("string"==typeof i?128:256),Ge.get(p)||(Ge.set(p,m=Ff(y,i,m)),m)):Ac(f)),si(f).declaredType=m,s.push(If(m)))}}catch(e){n={error:e}}finally{try{d&&!d.done&&(a=l.return)&&a.call(l)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}var v=s.length?hd(s,1,e,void 0):Ac(e);1048576&v.flags&&(v.flags|=1024,v.symbol=e),o.declaredType=v}return o.declaredType}function Ac(e){var t=No(32,e),e=No(32,e);return((t.regularType=t).freshType=e).regularType=t,e.freshType=e,t}function Ec(e){var t=si(e);return t.declaredType||(e=Dc(go(e)),t.declaredType||(t.declaredType=e)),t.declaredType}function Fc(e){var t=si(e);return t.declaredType||(t.declaredType=Fo(e))}function Pc(e){return Ic(e)||dt}function Ic(e){return 96&e.flags?wc(e):524288&e.flags?Cc(e):262144&e.flags?Fc(e):384&e.flags?Dc(e):8&e.flags?Ec(e):2097152&e.flags?(e=si(t=e)).declaredType||(e.declaredType=Pc(Ui(t))):void 0;var t}function Oc(e){switch(e.kind){case 133:case 159:case 154:case 150:case 163:case 136:case 155:case 151:case 116:case 157:case 146:case 201:return!0;case 188:return Oc(e.elementType);case 183:return!e.typeArguments||e.typeArguments.every(Oc)}return!1}function Lc(e){e=tE(e);return!e||Oc(e)}function Mc(e){var t=nL(e);return t?Oc(t):!nF(e)}function Rc(e){if(e.declarations&&1===e.declarations.length){var t=e.declarations[0];if(t)switch(t.kind){case 172:case 171:return Mc(t);case 174:case 173:case 176:case 177:case 178:return n=aL(r=t),a=eE(r),(176===r.kind||!!n&&Oc(n))&&r.parameters.every(Mc)&&a.every(Lc)}}var r,n,a}function jc(e,t,r){var n,a,i=vF();try{for(var o=__values(e),s=o.next();!s.done;s=o.next()){var c=s.value;i.set(c.escapedName,r&&Rc(c)?c:op(c,t))}}catch(e){n={error:e}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(n)throw n.error}}return i}function Bc(e,t){var r,n;try{for(var a=__values(t),i=a.next();!i.done;i=a.next()){var o,s=i.value;Jc(s)||((o=e.get(s.escapedName))&&(!o.valueDeclaration||!mj(o.valueDeclaration)||Is(o)||OP(o.valueDeclaration))||(e.set(s.escapedName,s),e.set(s.escapedName,s)))}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}function Jc(e){return e.valueDeclaration&&yE(e.valueDeclaration)&&lL(e.valueDeclaration)}function zc(e){var t,r;return e.declaredProperties||(r=Gc(t=e.symbol),e.declaredProperties=Io(r),e.declaredCallSignatures=WN,e.declaredConstructSignatures=WN,e.declaredIndexInfos=WN,e.declaredCallSignatures=I_(r.get("__call")),e.declaredConstructSignatures=I_(r.get("__new")),e.declaredIndexInfos=Y_(t)),e}function Uc(e){if(!SR(e)&&!ij(e))return!1;var t=SR(e)?e.expression:e.argumentExpression;return AL(t)&&sR(SR(e)?bh(e):iT(t))}function Vc(e){return 95===e.charCodeAt(0)&&95===e.charCodeAt(1)&&64===e.charCodeAt(2)}function qc(e){e=JA(e);return!!e&&Uc(e)}function Wc(e){return!wO(e)||qc(e)}function Hc(e,t,r,n){rA.assert(!!n.symbol,"The member is expected to have a symbol.");var a=ci(n);if(!a.resolvedSymbol){a.resolvedSymbol=n.symbol;var i=mj(n)?n.left:n.name,o=ij(i)?iT(i.argumentExpression):bh(i);if(sR(o)){var s=cR(o),c=n.symbol.flags,u=r.get(s);u||r.set(s,u=Qa(0,s,4096));var _,t=t&&t.get(s);return(u.flags&$a(c)||t)&&(t=t?fD(t.declarations,u.declarations):u.declarations,_=!(8192&o.flags)&&OA(s)||QF(i),KN(t,function(e){return Ua(JA(e)||e,mA.Property_0_was_also_declared_here,_)}),Ua(i||n,mA.Duplicate_property_0,_),u=Qa(0,s,4096)),u.links.nameType=o,o=u,n=n,c=c,rA.assert(!!(4096&BL(o)),"Expected a late-bound symbol."),o.flags|=c,(si(n.symbol).lateSymbol=o).declarations?n.symbol.isReplaceableByMethod||o.declarations.push(n):o.declarations=[n],111551&c&&(o.valueDeclaration&&o.valueDeclaration.kind===n.kind||(o.valueDeclaration=n)),u.parent?rA.assert(u.parent===e,"Existing symbol parent should match new one"):u.parent=e,a.resolvedSymbol=u}}return a.resolvedSymbol}function Kc(e,t){var r,n,a,i,o,s,c,u=si(e);if(!u[t]){var _="resolvedExports"===t,l=_?(1536&e.flags?po(e):e).exports:e.members;u[t]=l||M;var d=vF();try{for(var f=__values(e.declarations||WN),p=f.next();!p.done;p=f.next()){var m=bP(p.value);if(m)try{for(var y=(a=void 0,__values(m)),v=y.next();!v.done;v=y.next())_===dL(k=v.value)&&qc(k)&&Hc(e,l,d,k)}catch(e){a={error:e}}finally{try{v&&!v.done&&(i=y.return)&&i.call(y)}finally{if(a)throw a.error}}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}var g=(219===(null==(c=e.valueDeclaration)?void 0:c.kind)||218===(null==(c=e.valueDeclaration)?void 0:c.kind))&&(null==(g=vo(e.valueDeclaration.parent))?void 0:g.assignmentDeclarationMembers)||e.assignmentDeclarationMembers;if(g){var h=PD(g.values());try{for(var x=__values(h),b=x.next();!b.done;b=x.next()){var k,T=NI(k=b.value);_==!(3===T||mj(k)&&Hg(k,T)||9===T||6===T)&&qc(k)&&Hc(e,l,d,k)}}catch(e){o={error:e}}finally{try{b&&!b.done&&(s=x.return)&&s.call(x)}finally{if(o)throw o.error}}}u[t]=function(e,t){if(null==e||!e.size)return t;if(null==t||!t.size)return e;var r=vF();return ii(r,e),ii(r,t),r}(l,d)||M}return u[t]}function Gc(e){return 6256&e.flags?Kc(e,"resolvedMembers"):e.members||M}function Xc(e){if(106500&e.flags&&"__computed"===e.escapedName){var t,r=si(e);return!r.lateSymbol&&dD(e.declarations,qc)&&(t=mo(e.parent),(dD(e.declarations,dL)?_o:Gc)(t)),r.lateSymbol||(r.lateSymbol=e)}return e}function Qc(e,t,r){if(4&WL(e)){var n=e.target,a=ll(e);return HN(n.typeParameters)===HN(a)?cl(n,fD(a,[t||n.thisType])):e}if(2097152&e.flags){n=oD(e.types,function(e){return Qc(e,t,r)});return n!==e.types?Cd(n):e}return r?Zu(e):e}function Yc(e,t,r,n){var a,i,o,s,c,u;m=bD(r,n,0,r.length)?(s=t.symbol?Gc(t.symbol):vF(t.declaredProperties),c=t.declaredCallSignatures,u=t.declaredConstructSignatures,t.declaredIndexInfos):(o=Gf(r,n),s=jc(t.declaredProperties,o,1===r.length),c=Hf(t.declaredCallSignatures,o),u=Hf(t.declaredConstructSignatures,o),Kf(t.declaredIndexInfos,o));var _=Tc(t);if(_.length){t.symbol&&s===Gc(t.symbol)&&(s=vF(t.declaredProperties)),Lo(e,s,c,u,m);var l=CD(n);try{for(var d=__values(_),f=d.next();!f.done;f=d.next()){var p=f.value,p=l?Qc(pp(p,o),l):p;Bc(s,Ou(p)),c=fD(c,l_(p,0)),u=fD(u,l_(p,1));var p=p!==ut?v_(p):[Q_(wt,ut,!1)],m=fD(m,nD(p,function(e){return!f_(m,e.keyType)}))}}catch(e){a={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(a)throw a.error}}}Lo(e,s,c,u,m)}function Zc(e,t,r,n,a,i,o,s){s=new c(Re,s);return s.declaration=e,s.typeParameters=t,s.parameters=n,s.thisParameter=r,s.resolvedReturnType=a,s.resolvedTypePredicate=i,s.minArgumentCount=o,s.resolvedMinArgumentCount=void 0,s.target=void 0,s.mapper=void 0,s.compositeSignatures=void 0,s.compositeKind=void 0,s}function $c(e){var t=Zc(e.declaration,e.typeParameters,e.thisParameter,e.parameters,void 0,void 0,e.minArgumentCount,167&e.flags);return t.target=e.target,t.mapper=e.mapper,t.compositeSignatures=e.compositeSignatures,t.compositeKind=e.compositeKind,t}function eu(e,t){e=$c(e);return e.compositeSignatures=t,e.compositeKind=1048576,e.target=void 0,e.mapper=void 0,e}function tu(e,t){if((24&e.flags)===t)return e;e.optionalCallSignatureCache||(e.optionalCallSignatureCache={});var r=8===t?"inner":"outer";return e.optionalCallSignatureCache[r]||(e.optionalCallSignatureCache[r]=function(e,t){rA.assert(8===t||16===t,"An optional call signature can either be for an inner call chain or an outer call chain, but not both.");e=$c(e);return e.flags|=t,e}(e,t))}function ru(c,e){if(bJ(c)){var t=c.parameters.length-1,r=c.parameters[t].escapedName,n=sc(c.parameters[t]);if(Xm(n))return[a(n,t,r)];if(!e&&1048576&n.flags&&XN(n.types,Xm))return iD(n.types,function(e){return a(e,t,r)})}return[c.parameters];function a(n,a,e){var t,r,i,o=ll(n),s=(t=n,r=e,i=new Map,iD(t.target.labeledElementDeclarations,function(e,t){e=Qb(e,t,r),t=i.get(e);return void 0===t?(i.set(e,1),e):(i.set(e,t+1),"".concat(e,"_").concat(t))})),o=iD(o,function(e,t){var r=s&&s[t]?s[t]:Yb(c,a+t,n),t=n.target.elementFlags[t],r=Qa(1,r,12&t?32768:2&t?16384:0);return r.links.type=4&t?Yl(e):e,r});return fD(c.parameters.slice(0,a),o)}}function nu(e,t,r,n,a){var i,o;try{for(var s=__values(e),c=s.next();!c.done;c=s.next()){var u=c.value;if(Cm(u,t,r,n,a,r?Cp:Sp))return u}}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}function au(e){for(var t,r,n,a,i,o,s=0;s=ak(i)&&l>=ak(o),d=n<=l?void 0:Yb(e,l),f=a<=l?void 0:Yb(t,l),f=Qa(1|(y&&!m?16777216:0),(d===f?d:d?f?void 0:d:f)||"arg".concat(l));f.links.type=m?Yl(p):p,_[l]=f}{var v;u&&((v=Qa(1,"args")).links.type=Yl(ek(o,s)),o===t&&(v.links.type=pp(v.links.type,r)),_[s]=v)}return _}(e,t,r),o=function(e,t,r){if(!e||!t)return e||t;r=Cd([sc(e),pp(sc(t),r)]);return my(e,r)}(e.thisParameter,t.thisParameter,r),s=Math.max(e.minArgumentCount,t.minArgumentCount),s=Zc(a,n,o,i,void 0,void 0,s,167&(e.flags|t.flags));s.compositeKind=1048576,s.compositeSignatures=fD(2097152!==e.compositeKind&&e.compositeSignatures||[e],[t]),r&&(s.mapper=2097152!==e.compositeKind&&e.mapper&&e.compositeSignatures?tp(e.mapper,r):r);return s}(e,t)})))return"break"}};try{for(var g=__values(e),h=g.next();!h.done;h=g.next())if("break"===v(h.value))break}catch(e){n={error:e}}finally{try{h&&!h.done&&(a=g.return)&&a.call(g)}finally{if(n)throw n.error}}i=y}return i||WN}function iu(e,t){if(HN(e)===HN(t)){if(!e||!t)return 1;for(var r=Gf(t,e),n=0;n=ak(t,3)}t=UP(e.parent);return!!t&&(!e.type&&!e.dotDotDotToken&&e.parent.parameters.indexOf(e)>=t.arguments.length)}function N_(e,t,r,n){return{kind:e,parameterName:t,parameterIndex:r,type:n}}function D_(e){var t=0;if(e)for(var r=0;rs.arguments.length&&!d||YM(_)||(a=r.length)}177!==e.kind&&178!==e.kind||!Wc(e)||o&&i||(c=177===e.kind?178:177,(c=mF(yo(e),c))&&(i=(c=NN(c=c))&&c.symbol)),!cI(e)||(f=GA(e))&&f.typeExpression&&(i=my(Qa(1,"this"),Uf(f.typeExpression)));var f=bB(e)?QI(e):e,f=f&&IR(f)?wc(mo(f.parent.symbol)):void 0,f=f?f.localTypeParameters:T_(e);(cF(e)||cI(e)&&function(e,t){if(bB(e)||!P_(e))return!1;var r=CD(e.parameters),r=GN(r?VA(r):YA(e).filter(wB),function(e){return e.typeExpression&&hB(e.typeExpression.type)?e.typeExpression.type:void 0}),e=Qa(3,"args",32768);r?e.links.type=Yl(Uf(r.type)):(e.links.checkFlags|=65536,e.links.deferralParent=Mt,e.links.deferralConstituents=[Ar],e.links.deferralWriteConstituents=[Ar]);r&&t.pop();return t.push(e),!0}(e,r))&&(n|=1),(zR(e)&&_L(e,256)||IR(e)&&_L(e.parent,256))&&(n|=4),t.resolvedSignature=Zc(e,f,i,r,void 0,void 0,a,n)}return t.resolvedSignature}function F_(e){if(cI(e)&&TE(e)){e=XA(e);return(null==e?void 0:e.typeExpression)&&Kx(Uf(e.typeExpression))}}function P_(e){var t=ci(e);return void 0===t.containsArgumentsReference&&(512&t.flags?t.containsArgumentsReference=!0:t.containsArgumentsReference=function e(t){if(!t)return!1;switch(t.kind){case 80:return t.escapedText===Fe.escapedName&&aN(t)===Fe;case 172:case 174:case 177:case 178:return 167===t.name.kind&&e(t.name);case 211:case 212:return e(t.expression);case 303:return e(t.initializer);default:return!RO(t)&&!vP(t)&&!!HB(t,e)}}(e.body)),t.containsArgumentsReference}function I_(e){var t,r,n,a;if(!e||!e.declarations)return WN;for(var i=[],o=0;on.length)){a=o&&hj(e)&&!kB(e.parent);if(Ua(e,i===n.length?a?mA.Expected_0_type_arguments_provide_these_with_an_extends_tag:mA.Generic_type_0_requires_1_type_argument_s:a?mA.Expected_0_1_type_arguments_provide_these_with_an_extends_tag:mA.Generic_type_0_requires_between_1_and_2_type_arguments,$o(r,void 0,2),i,n.length),!o)return dt}return 183===e.kind&&rd(e,HN(e.typeArguments)!==n.length)?_l(r,e,void 0):cl(r,fD(r.outerTypeParameters,A_(Nl(e),n,i,o)))}return Sl(e,t)?r:dt}function pl(e,t,r,n){var a=Pc(e);if(a===mt&&_J.has(e.escapedName)&&t&&1===t.length)return Ud(e,t[0]);var i=si(e),o=i.typeParameters,s=al(t)+il(r,n),c=i.instantiations.get(s);return c||i.instantiations.set(s,c=mp(a,Gf(o,A_(t,o,D_(o),cI(e.valueDeclaration))),r,n)),c}function ml(e){e=null==(e=e.declarations)?void 0:e.find(VI);return e&&PP(e)}function yl(e){var t=(166===e.kind?e.right:211===e.kind?e.name:e).escapedText;if(t){var r=166===e.kind?yl(e.left):211===e.kind?yl(e.expression):void 0,n=r?"".concat(function e(t){return t.parent?"".concat(e(t.parent),".").concat(t.escapedName):t.escapedName}(r),".").concat(t):t,e=st.get(n);return e||(st.set(n,e=Qa(524288,t,1048576)),e.parent=r,e.links.declaredType=ft),e}return it}function vl(e,t,r){e=function(e){switch(e.kind){case 183:return e.typeName;case 233:var t=e.expression;if(AL(t))return t}}(e);if(!e)return it;t=Yi(e,t,r);return t&&t!==it?t:r?it:yl(e)}function gl(e,t){if(t===it)return dt;if(96&(t=function(e){var t=e.valueDeclaration;if(t&&cI(t)&&!(524288&e.flags)&&!xI(t,!1)){t=(Aj(t)?gI:hI)(t);if(t){t=vo(t);if(t)return Db(t,e)}}}(t)||t).flags)return fl(e,t);if(524288&t.flags)return function(e,t){if(1048576&BL(t)){var r=Nl(e),n=il(t,r),a=ct.get(n);return a||((a=Ao(1,"error")).aliasSymbol=t,a.aliasTypeArguments=r,ct.set(n,a)),a}var i=Pc(t),o=si(t).typeParameters;if(o){r=HN(e.typeArguments),n=D_(o);if(ro.length)return Ua(e,n===o.length?mA.Generic_type_0_requires_1_type_argument_s:mA.Generic_type_0_requires_between_1_and_2_type_arguments,Yo(t),n,o.length),dt;a=Tf(e),r=!a||!ml(t)&&ml(a)?void 0:a,n=void 0;return r?n=Sf(r):iF(e)&&(!(a=vl(e,2097152,!0))||a===it||(a=Ui(a))&&524288&a.flags&&(r=a,n=Nl(e)||(o?[]:void 0))),pl(t,Nl(e),r,n)}return Sl(e,t)?i:dt}(e,t);var r=Ic(t);if(r)return Sl(e,t)?If(r):dt;if(111551&t.flags&&Tl(e)){r=function(e,t){var r=ci(e);{var n,a,i;r.resolvedJSDocType||(n=sc(t),a=n,t.valueDeclaration&&(i=205===e.kind&&e.qualifier,n.symbol&&n.symbol!==t&&i&&(a=gl(e,n.symbol))),r.resolvedJSDocType=a)}return r.resolvedJSDocType}(e,t);return r||(vl(e,788968),sc(t))}return dt}function hl(e,t){if(3&t.flags||t===e||1&e.flags)return e;var r="".concat(e.id,">").concat(t.id),n=Ze.get(r);if(n)return n;n=Co(33554432);return n.baseType=e,n.constraint=t,Ze.set(r,n),n}function xl(e){return Cd([e.constraint,e.baseType])}function bl(e){return 189===e.kind&&1===e.elements.length}function kl(e,t){for(var r,n=!0;t&&!XE(t)&&327!==t.kind;){var a,i,o=t.parent;169===o.kind&&(n=!n),(n||8650752&e.flags)&&194===o.kind&&t===o.trueType?(i=function e(t,r,n){return bl(r)&&bl(n)?e(t,r.elements[0],n.elements[0]):df(Uf(r))===df(t)?Uf(n):void 0}(e,o.checkType,o.extendsType))&&(r=vD(r,i)):262144&e.flags&&200===o.kind&&t===o.type&&(gu(a=Uf(o))!==df(e)||(a=cp(a))&&(i=Mu(a))&&Wv(i,Em)&&(r=vD(r,hd([Ct,Ht])))),t=o}return r?hl(e,Cd(r)):e}function Tl(e){return!!(16777216&e.flags)&&(183===e.kind||205===e.kind)}function Sl(e,t){if(!e.typeArguments)return 1;Ua(e,mA.Type_0_is_not_generic,t?Yo(t):e.typeName?QF(e.typeName):iJ)}function wl(e){if(xR(e.typeName)){var t=e.typeArguments;switch(e.typeName.escapedText){case"String":return Sl(e),wt;case"Number":return Sl(e),Ct;case"Boolean":return Sl(e),It;case"Void":return Sl(e),Lt;case"Undefined":return Sl(e),gt;case"Null":return Sl(e),Tt;case"Function":case"function":return Sl(e),hr;case"array":return t&&t.length||N?void 0:Ar;case"promise":return t&&t.length||N?void 0:Sk(ut);case"Object":if(t&&2===t.length){if(lI(e)){var r=Uf(t[0]),n=Uf(t[1]),n=r===wt||r===Ct?[Q_(r,n,!1)]:WN;return Mo(void 0,M,WN,WN,n)}return ut}return Sl(e),N?void 0:ut}}}function Cl(e){var t=ci(e);if(!t.resolvedType){if(uE(e)&&BE(e.parent))return t.resolvedSymbol=it,t.resolvedType=iT(e.parent.expression);var r=void 0,n=void 0,a=788968;Tl(e)&&((n=wl(e))||((r=vl(e,a,!0))===it?r=vl(e,900095):vl(e,a),n=gl(e,r))),n=n||gl(e,r=vl(e,a)),t.resolvedSymbol=r,t.resolvedType=n}return t.resolvedType}function Nl(e){return iD(e.typeArguments,Uf)}function Dl(e){var t=ci(e);return t.resolvedType||(e=Vb(e),t.resolvedType=If(xy(e))),t.resolvedType}function Al(e,t){function r(e){var t,r,n=e.declarations;if(n)try{for(var a=__values(n),i=a.next();!i.done;i=a.next()){var o=i.value;switch(o.kind){case 263:case 264:case 266:return o}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}if(!e)return t?ar:$t;var n=Pc(e);return 524288&n.flags?HN(n.typeParameters)!==t?(Ua(r(e),mA.Global_type_0_must_have_1_type_parameter_s,RA(e),t),t?ar:$t):n:(Ua(r(e),mA.Global_type_0_must_be_a_class_or_interface_type,RA(e)),t?ar:$t)}function El(e,t){return Il(e,111551,t?mA.Cannot_find_global_value_0:void 0)}function Fl(e,t){return Il(e,788968,t?mA.Cannot_find_global_type_0:void 0)}function Pl(e,t,r){r=Il(e,788968,r?mA.Cannot_find_global_type_0:void 0);if(r&&(Pc(r),HN(si(r).typeParameters)!==t))return void Ua(r.declarations&&QN(r.declarations,Oj),mA.Global_type_0_must_have_1_type_parameter_s,RA(r),t);return r}function Il(e,t,r){return pi(void 0,e,t,r,e,!1,!1,!1)}function Ol(e,t,r){e=Fl(e,r);return e||r?Al(e,t):void 0}function Ll(){return Zr=Zr||(Ol("ImportMeta",0,!0)||$t)}function Ml(){var e,t,r;return $r||(e=Qa(0,"ImportMetaExpression"),t=Ll(),(r=Qa(4,"meta",8)).parent=e,r.links.type=t,r=vF([r]),e.members=r,$r=Mo(e,r,WN,WN,WN)),$r}function Rl(e){return(en=en||Ol("ImportCallOptions",0,e))||$t}function jl(e){return Ir=Ir||El("Symbol",e)}function Bl(){return(Lr=Lr||Ol("Symbol",0,!1))||$t}function Jl(e){return(Rr=Rr||Ol("Promise",1,e))||ar}function zl(e){return(jr=jr||Ol("PromiseLike",1,e))||ar}function Ul(e){return Br=Br||El("Promise",e)}function Vl(e){return(Kr=Kr||Ol("AsyncIterable",1,e))||ar}function ql(e){return(zr=zr||Ol("Iterable",1,e))||ar}function Wl(e){return(tn=tn||Ol("Disposable",0,e))||$t}function Hl(e,t){void 0===t&&(t=0);e=Il(e,788968,void 0);return e&&Al(e,t)}function Kl(e){return(on=on||(Pl("Awaited",1,e)||(e?it:void 0)))===it?void 0:on}function Gl(e,t){return e!==ar?cl(e,t):$t}function Xl(e){return Gl(Mr=Mr||Ol("TypedPropertyDescriptor",1,!0)||ar,[e])}function Ql(e){return Gl(ql(!0),[e])}function Yl(e,t){return Gl(t?Tr:kr,[e])}function Zl(e){switch(e.kind){case 190:return 2;case 191:return $l(e);case 202:return e.questionToken?2:e.dotDotDotToken?$l(e):1;default:return 1}}function $l(e){return zf(e.type)?4:8}function ed(e){var t,t=XR(t=e.parent)&&148===t.operator;return zf(e)?t?Tr:kr:id(iD(e.elements,Zl),t,iD(e.elements,td))}function td(e){return WR(e)||CR(e)?e:void 0}function rd(e,t){return Tf(e)||function e(t){var r=t.parent;switch(r.kind){case 196:case 202:case 183:case 192:case 193:case 199:case 194:case 198:case 188:case 189:return e(r);case 265:return!0}return!1}(e)&&(188===e.kind?nd(e.elementType):189===e.kind?dD(e.elements,nd):t||dD(e.typeArguments,nd))}function nd(e){switch(e.kind){case 183:return Tl(e)||!!(524288&vl(e,788968).flags);case 186:return!0;case 198:return 158!==e.operator&&nd(e.type);case 196:case 190:case 202:case 323:case 321:case 322:case 316:return nd(e.type);case 191:return 188!==e.type.kind||nd(e.type.elementType);case 192:case 193:return dD(e.types,nd);case 199:return nd(e.objectType)||nd(e.indexType);case 194:return nd(e.checkType)||nd(e.extendsType)||nd(e.trueType)||nd(e.falseType)}return!1}function ad(e,t,r,n){void 0===r&&(r=!1),void 0===n&&(n=[]);n=id(t||iD(e,function(e){return 1}),r,n);return n===ar?$t:e.length?od(n,e):n}function id(e,t,r){if(1===e.length&&4&e[0])return t?Tr:kr;var n=uD(r,function(e){return e?mJ(e):void 0}),a=iD(e,function(e){return 1&e?"#":2&e?"?":4&e?".":"*"}).join()+(t?"R":"")+(n.length?","+n.join(","):""),n=ze.get(a);return n||ze.set(a,n=function(e,t,r){var n,a=e.length,i=rD(e,function(e){return 9&e}),o=[],s=0;if(a){n=new Array(a);for(var c=0;cn.fixedLength?function(e){e=Zm(e);return e&&Yl(e)}(e)||ad(WN):ad(ll(e).slice(t,r),n.elementFlags.slice(t,r),!1,n.labeledElementDeclarations&&n.labeledElementDeclarations.slice(t,r))}function ud(e){return hd(vD(FD(e.target.fixedLength,function(e){return Lf(""+e)}),jd(e.target.readonly?Tr:kr)))}function _d(e,t){return e.elementFlags.length-$N(e.elementFlags,function(e){return!(e&t)})-1}function ld(e){return e.fixedLength+_d(e,3)}function dd(e){var t=ll(e),e=dl(e);return t.length===e?t:t.slice(0,e)}function fd(e){return e.id}function pd(e,t){return 0<=AD(e,t,fd,UD)}function md(e,t){var r=AD(e,t,fd,UD);return r<0&&(e.splice(~r,0,t),1)}function yd(e,t,r){var n,a,i,o,s,c,u;try{for(var _=__values(r),l=_.next();!l.done;l=_.next()){var d=l.value;d!==i&&(t=1048576&d.flags?yd(e,t|(!(1048576&(u=d).flags&&(u.aliasSymbol||u.origin))?0:1048576),d.types):(o=e,s=t,c=void 0,131072&(c=(u=d).flags)||(s|=473694207&c,465829888&c&&(s|=33554432),u===lt&&(s|=8388608),!te&&98304&c?65536&WL(u)||(s|=4194304):(c=(c=o.length)&&u.id>o[c-1].id?~c:AD(o,u,fd,UD))<0&&o.splice(~c,0,u)),s),i=d)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(a=_.return)&&a.call(_)}finally{if(n)throw n.error}}return t}function vd(e){var r=nD(e,function(e){return 134217728&e.flags&&Yd(e)});if(r.length)for(var n=e.length;0Ad(e)?gd(2097152,e):void 0)}else o=e,e=t,t=r,(r=Co(2097152)).objectFlags=ol(o,98304),r.types=o,r.aliasSymbol=e,r.aliasTypeArguments=t,n=r;qe.set(a,n)}return n}function Nd(e){return ED(e,function(e,t){return 1048576&t.flags?e*t.types.length:131072&t.flags?0:e},1)}function Dd(e){var t=Nd(e);return!(1e5<=t)||(null!=iA&&iA.instant(iA.Phase.CheckTypes,"checkCrossProductUnion_DepthLimit",{typeIds:e.map(function(e){return e.id}),size:t}),void Ua(w,mA.Expression_produces_a_union_type_that_is_too_complex_to_represent))}function Ad(e){return ED(e,function(e,t){return e+function e(t){return 3145728&t.flags&&!t.aliasSymbol?1048576&t.flags&&t.origin?e(t.origin):Ad(t.types):1}(t)},0)}function Ed(e,t){return!!(76&e.flags)&&t===tr}function Fd(e,t){var r=Co(4194304);return r.type=e,r.indexFlags=t,r}function Pd(e,t){return 1&t?e.resolvedStringIndexType||(e.resolvedStringIndexType=Fd(e,1)):e.resolvedIndexType||(e.resolvedIndexType=Fd(e,0))}function Id(e){var r=gu(e);return function e(t){return!!(470810623&t.flags)||(16777216&t.flags?t.root.isDistributive&&t.checkType===r:137363456&t.flags?XN(t.types,e):8388608&t.flags?e(t.objectType)&&e(t.indexType):33554432&t.flags?e(t.baseType)&&e(t.constraint):!!(268435456&t.flags)&&e(t.type))}(xu(e)||r)}function Od(e){if(bR(e))return Mt;if(gR(e))return If(TT(e));if(SR(e))return If(bh(e));var t=NO(e);return void 0!==t?Lf(OA(t)):jE(e)?If(TT(e)):Mt}function Ld(e,t,r){if(r||!(24&JL(e))){var n=si(Xc(e)).nameType;if(n||(r=JA(e.valueDeclaration),n="default"===e.escapedName?Lf("default"):r&&Od(r)||(PO(e)?void 0:Lf(RA(e)))),n&&n.flags&t)return n}return Mt}function Md(e,t,r){var n,n=r&&(7&WL(e)||e.aliasSymbol)?(r=e,(n=Do(4194304)).type=r,n):void 0;return hd(fD(iD(Ou(e),function(e){return Ld(e,t)}),iD(v_(e),function(e){return e!==Dn&&function t(e,r){return!!(e.flags&r||2097152&e.flags&&dD(e.types,function(e){return t(e,r)}))}(e.keyType,t)?e.keyType===wt&&8&t?zt:e.keyType:Mt})),1,void 0,void 0,n)}function Rd(e,t){return void 0===t&&(t=0),58982400&e.flags||Qm(e)||Du(e)&&!Id(e)||1048576&e.flags&&!(4&t)&&s_(e)||2097152&e.flags&&Wk(e,465829888)&&dD(e.types,Xp)}function jd(e,t){return void 0===t&&(t=A),Rd(e=n_(e),t)?Pd(e,t):1048576&e.flags?Cd(iD(e.types,function(e){return jd(e,t)})):2097152&e.flags?hd(iD(e.types,function(e){return jd(e,t)})):32&WL(e)?function(t,e){var r=gu(t),n=hu(t),a=xu(t.target||t);if(!(a||2&e))return n;var i=[];if(Tu(t)){if(ef(n))return Pd(t,e);yu(Zu(Su(t)),8576,!!(1&e),o)}else Vv(pu(n),o);return ef(n)&&Vv(n,o),1048576&(e=2&e?Hv(hd(i),function(e){return!(5&e.flags)}):hd(i)).flags&&1048576&n.flags&&al(e.types)===al(n.types)?n:e;function o(e){e=a?pp(a,np(t.mapper,r,e)):e;i.push(e===wt?zt:e)}}(e,t):e===lt?lt:2&e.flags?Mt:131073&e.flags?Vt:Md(e,(2&t?128:402653316)|(1&t?0:12584),t===A)}function Bd(e){if(h)return e;var t=(nn=nn||Pl("Extract",2,!0)||it)===it?void 0:nn;return t?pl(t,[e,wt]):wt}function Jd(t,r){var n=ZN(r,function(e){return 1179648&e.flags});if(0<=n)return Dd(r)?Gv(r[n],function(e){return Jd(t,DD(r,n,e))}):dt;if(eD(r,lt))return lt;var i=[],o=[],s=t[0];if(!function e(t,r){for(var n=0;nc:ak(e)>c))return!n||8&r||a(mA.Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1,ak(e),c),0;e.typeParameters&&e.typeParameters!==t.typeParameters&&(e=Qx(e,t=H_(t),void 0,o));var u=nk(e),_=sk(e),l=sk(t);(_||l)&&pp(_||l,s);var d=t.declaration?t.declaration.kind:0,f=!(3&r)&&z&&174!==d&&173!==d&&176!==d,p=-1,m=L_(e);if(m&&m!==Lt){d=L_(t);if(d){if(!(b=!f&&o(m,d,!1)||o(d,m,n)))return n&&a(mA.The_this_types_of_each_signature_are_incompatible),0;p&=b}}for(var y=_||l?Math.min(u,c):Math.max(u,c),v=_||l?y-1:-1,g=0;g=ak(e)&&g=o.types.length&&i.length%o.types.length==0){var u=X(c,o.types[s%o.types.length],3,!1,void 0,n);if(u){a&=u;continue}}c=X(c,t,1,r,void 0,n);if(!c)return 0;a&=c}return a})(e,t,r&&!(402784252&e.flags),n);if(1048576&t.flags)return _(yy(e),t,r&&!(402784252&e.flags)&&!(402784252&t.flags));if(2097152&t.flags)return function(e,t,r,n){var a,i,o=-1,s=t.types;try{for(var c=__values(s),u=c.next();!u.done;u=c.next()){var _=u.value,_=X(e,_,2,r,void 0,n);if(!_)return 0;o&=_}}catch(e){a={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(a)throw a.error}}return o}(e,t,r,2);if(z===Ea&&402784252&t.flags){r=oD(e.types,function(e){return 465829888&e.flags?Vu(e)||yt:e});if(r!==e.types){if(131072&(e=Cd(r)).flags)return 0;if(!(2097152&e.flags))return X(e,t,1,!1)||X(t,e,1,!1)}}return c(e,t,!1,1)}function B(e,t){var r,n,a=-1,i=e.types;try{for(var o=__values(i),s=o.next();!s.done;s=o.next()){var c=_(s.value,t,!1);if(!c)return 0;a&=c}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return a}function _(e,t,r){var n,a,i=t.types;if(1048576&t.flags){if(pd(i,e))return-1;if(z!==Ea&&32768&WL(t)&&!(1024&e.flags)&&(2688&e.flags||(z===Na||z===Da)&&256&e.flags)){var o=e===e.regularType?e.freshType:e.regularType,s=128&e.flags?wt:256&e.flags?Ct:2048&e.flags?Nt:void 0;return s&&pd(i,s)||o&&pd(i,o)?-1:0}o=hv(t,e);if(o)if(c=X(e,o,2,!1))return c}try{for(var c,u=__values(i),_=u.next();!_.done;_=u.next())if(c=X(e,_.value,2,!1))return c}catch(e){n={error:e}}finally{try{_&&!_.done&&(a=u.return)&&a.call(u)}finally{if(n)throw n.error}}return!r||(t=sm(e,t,X))&&X(e,t,2,!0),0}function c(e,t,r,n){var a=e.types;if(1048576&e.flags&&pd(a,t))return-1;for(var i=a.length,o=0;o";continue}a+="-"+s.id}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}}function gm(e,t,r,n,a){n===Fa&&e.id>t.id&&(n=e,e=t,t=n);r=r?":"+r:"";return ym(e)&&ym(t)?vm(e,t,r,a):"".concat(e.id,",").concat(t.id).concat(r)}function hm(e,t){var r,n;if(!(6&BL(e)))return t(e);try{for(var a=__values(e.links.containingType.types),i=a.next();!i.done;i=a.next()){var o=u_(i.value,e.escapedName),o=o&&hm(o,t);if(o)return o}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}function xm(e){return e.parent&&32&e.parent.flags?Pc(go(e)):void 0}function bm(e){var t=xm(e),t=t&&Tc(t)[0];return t&&vs(t,e.escapedName)}function km(t,e,r){return hm(e,function(e){return!!(16&JL(e,r))&&!lc(t,xm(e))})?void 0:t}function Tm(e,t,r,n){if(void 0===n&&(n=3),n<=r){if(2097152&e.flags)return dD(e.types,function(e){return Tm(e,t,r,n)});for(var a=Sm(e),i=0,o=0,s=0;s=o&&n<=++i)return!0;o=c.id}}}return!1}function Sm(e){if(524288&e.flags&&!ev(e)){if(4&WL(e)&&e.node)return e.node;if(e.symbol&&!(16&WL(e)&&32&e.symbol.flags))return e.symbol;if(Xm(e))return e.target}if(262144&e.flags)return e.symbol;if(8388608&e.flags){for(;e=e.objectType,8388608&e.flags;);return e}return 16777216&e.flags?e.root:e}function wm(e,t,r){if(e===t)return-1;var n=24&JL(e);if(n!=(24&JL(t)))return 0;if(n){if(Iw(e)!==Iw(t))return 0}else if((16777216&e.flags)!=(16777216&t.flags))return 0;return jk(e)!==jk(t)?0:r(sc(e),sc(t))}function Cm(e,t,r,n,a,i){if(e===t)return-1;if(s=t,c=r,u=nk(o=e),_=nk(s),l=ak(o),r=ak(s),o=ik(o),s=ik(s),(u!==_||l!==r||o!==s)&&!(c&&l<=r))return 0;var o,s,c,u,_,l;if(HN(e.typeParameters)!==HN(t.typeParameters))return 0;if(t.typeParameters){for(var d=Gf(e.typeParameters,t.typeParameters),f=0;fHN(t.typeParameters)&&(r=Qc(r,ND(ll(e)))),e.objectFlags|=67108864,e.cachedEquivalentBaseType=r}}}function Lm(e){return te?e===jt:e===ht}function Mm(e){e=Pm(e);return e&&Lm(e)}function Rm(e){var t;return Xm(e)||!!u_(e,"0")||Im(e)&&!!(t=vs(e,"length"))&&Wv(t,function(e){return!!(256&e.flags)})}function jm(e){return Im(e)||Rm(e)}function Bm(e){return!(240544&e.flags)}function Jm(e){return!!(109472&e.flags)}function zm(e){e=qu(e);return 2097152&e.flags?dD(e.types,Jm):Jm(e)}function Um(e){return!!(16&e.flags)||(1048576&e.flags?!!(1024&e.flags)||XN(e.types,Jm):Jm(e))}function Vm(e){return 1056&e.flags?Nc(e):402653312&e.flags?wt:256&e.flags?Ct:2048&e.flags?Nt:512&e.flags?It:1048576&e.flags?(n="B".concat((t=e).id),null!==(r=La(n))&&void 0!==r?r:Ma(n,Gv(t,Vm))):e;var t,r,n}function qm(e){return 402653312&e.flags?wt:288&e.flags?Ct:2048&e.flags?Nt:512&e.flags?It:1048576&e.flags?Gv(e,qm):e}function Wm(e){return 1056&e.flags&&Of(e)?Nc(e):128&e.flags&&Of(e)?wt:256&e.flags&&Of(e)?Ct:2048&e.flags&&Of(e)?Nt:512&e.flags&&Of(e)?It:1048576&e.flags?Gv(e,Wm):e}function Hm(e){return 8192&e.flags?Ot:1048576&e.flags?Gv(e,Hm):e}function Km(e,t){return uT(e,t)||(e=Hm(Wm(e))),If(e)}function Gm(e,t,r,n){return e&&Jm(e)&&(e=Km(e,t?mw(r,t,n):void 0)),e}function Xm(e){return!!(4&WL(e)&&8&e.target.objectFlags)}function Qm(e){return Xm(e)&&!!(8&e.target.combinedFlags)}function Ym(e){return Qm(e)&&1===e.target.elementFlags.length}function Zm(e){return ey(e,e.target.fixedLength)}function $m(e,r,n){return Gv(e,function(e){var t=e,e=Zm(t);return e?n&&r>=ld(t.target)?hd([e,n]):e:gt})}function ey(e,t,r,n,a){void 0===r&&(r=0),void 0===n&&(n=!1),void 0===a&&(a=!1);var i=dl(e)-r;if(ta.target.minLength||!i.target.hasRestElement&&(a.target.hasRestElement||i.target.fixedLength=e.length?a:void 0}(r,t),e.keyPropertyName=r?t:"",e.constituentMap=r),e.keyPropertyName.length?e.keyPropertyName:void 0}function gv(e,t){t=null==(e=e.constituentMap)?void 0:e.get(If(t).id);return t!==yt?t:void 0}function hv(e,t){var r=vv(e),r=r&&vs(t,r);return r&&gv(e,r)}function xv(e,t){return uv(e,t)||fv(e,t)}function bv(e,t){var r,n;if(e.arguments)try{for(var a=__values(e.arguments),i=a.next();!i.done;i=a.next())if(xv(t,i.value))return!0}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return!(211!==e.expression.kind||!xv(t,e.expression.expression))}function kv(e){return(!e.id||e.id<0)&&(e.id=sJ,sJ++),e.id}function Tv(e,t){var r;if(e===t)return e;if(131072&t.flags)return t;var n,a="A".concat(e.id,",").concat(t.id);return null!==(r=La(a))&&void 0!==r?r:Ma(a,(n=t,e=Hv(t=e,function(e){return function(e,t){var r,n;if(!(1048576&e.flags))return Ap(e,t);try{for(var a=__values(e.types),i=a.next();!i.done;i=a.next())if(Ap(i.value,t))return!0}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return!1}(n,e)}),e=512&n.flags&&Of(n)?Gv(e,Pf):e,Ap(n,e)?e:t))}function Sv(e){var t=Eu(e);return!!(t.callSignatures.length||t.constructSignatures.length||t.members.get("bind")&&Np(e,hr))}function wv(e){467927040&e.flags&&(e=Vu(e)||yt);var t=e.flags;if(268435460&t)return te?16317953:16776705;if(134217856&t){var r=128&t&&""===e.value;return te?r?12123649:7929345:r?12582401:16776705}if(40&t)return te?16317698:16776450;if(256&t){var n=0===e.value;return te?n?12123394:7929090:n?12582146:16776450}if(64&t)return te?16317188:16775940;if(2048&t){n=ty(e);return te?n?12122884:7928580:n?12581636:16775940}return 16&t?te?16316168:16774920:528&t?te?e===Dt||e===At?12121864:7927560:e===Dt||e===At?12580616:16774920:524288&t?16&WL(e)&&Gp(e)?te?83427327:83886079:Sv(e)?te?7880640:16728e3:te?7888800:16736160:16384&t?9830144:32768&t?26607360:65536&t?42917664:12288&t?te?7925520:16772880:67108864&t?te?7888800:16736160:131072&t?0:1048576&t?ED(e.types,function(e,t){return e|wv(t)},0):2097152&t?function(e){var t,r,n=Wk(e,402784252),a=0,i=134217727;try{for(var o=__values(e.types),s=o.next();!s.done;s=o.next()){var c=s.value;n&&524288&c.flags||(c=wv(c),a|=c,i&=c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return 8256&a|134209471&i}(e):83886079}function Cv(e,t){return Hv(e,function(e){return 0!=(wv(e)&t)})}function Nv(e,t){var r=Dv(Cv(te&&2&e.flags?nr:e,t));if(te)switch(t){case 524288:return Gv(r,function(e){return 65536&wv(e)?Cd([e,131072&wv(e)&&!Wk(r,65536)?hd([$t,Tt]):$t]):e});case 1048576:return Gv(r,function(e){return 131072&wv(e)?Cd([e,65536&wv(e)&&!Wk(r,32768)?hd([$t,gt]):$t]):e});case 2097152:case 4194304:return Gv(r,function(e){return 262144&wv(e)?(t=e,(Pr=Pr||(Il("NonNullable",524288,void 0)||it))!==it?pl(Pr,[t]):Cd([t,$t])):e;var t})}return r}function Dv(e){return e===nr?yt:e}function Av(e,t){return t?hd([Ts(e),xT(t)]):e}function Ev(e,t){var t=Od(t);if(!sR(t))return dt;t=cR(t);return vs(e,t)||Pv(null==(t=k_(e,t))?void 0:t.type)||dt}function Fv(e,t){return Wv(e,Rm)&&(vs(r=e,""+(t=t))||(Wv(r,Xm)?$m(r,t,ee.noUncheckedIndexedAccess?gt:void 0):void 0))||Pv(KS(65,e,gt,void 0))||dt;var r}function Pv(e){return e&&(ee.noUncheckedIndexedAccess?hd([e,xt]):e)}function Iv(e){return Yl(KS(65,e,gt,void 0)||dt)}function Ov(e){return 226===e.parent.kind&&e.parent.left===e||250===e.parent.kind&&e.parent.initializer===e}function Lv(e){return Ev(Mv(e.parent),e.name)}function Mv(e){var t,r,n=e.parent;switch(n.kind){case 249:return wt;case 250:return HS(n)||dt;case 226:return 209===(r=n).parent.kind&&Ov(r.parent)||303===r.parent.kind&&Ov(r.parent.parent)?Av(Mv(r),r.right):xT(r.right);case 220:return gt;case 209:return t=e,Fv(Mv(r=n),r.elements.indexOf(t));case 230:return Iv(Mv(n.parent));case 303:return Lv(n);case 304:return Av(Lv(t=n),t.objectAssignmentInitializer)}return dt}function Rv(e){return ci(e).resolvedType||xT(e)}function jv(e){return 260===e.kind?(r=e).initializer?Rv(r.initializer):249===r.parent.parent.kind?wt:250===r.parent.parent.kind&&HS(r.parent.parent)||dt:(r=(t=e).parent,e=jv(r.parent),Av(206===r.kind?Ev(e,t.propertyName||t.name):t.dotDotDotToken?Iv(e):Fv(e,r.elements.indexOf(t)),t.initializer));var t,r}function Bv(e){switch(e.kind){case 217:return Bv(e.expression);case 226:switch(e.operatorToken.kind){case 64:case 76:case 77:case 78:return Bv(e.left);case 28:return Bv(e.right)}}return e}function Jv(e){var t,r,n=ci(e);if(!n.switchTypes){n.switchTypes=[];try{for(var a=__values(e.caseBlock.clauses),i=a.next();!i.done;i=a.next()){var o=i.value;n.switchTypes.push(296===(o=o).kind?If(xT(o.expression)):Mt)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}return n.switchTypes}function zv(e){var t,r;if(!dD(e.caseBlock.clauses,function(e){return 296===e.kind&&!oF(e.expression)})){var n=[];try{for(var a=__values(e.caseBlock.clauses),i=a.next();!i.done;i=a.next()){var o=i.value,o=296===o.kind?o.expression.text:void 0;n.push(o&&!eD(n,o)?o:void 0)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return n}}function Uv(e,t){return e===t||131072&e.flags||1048576&t.flags&&function(e,t){var r,n;if(1048576&e.flags){try{for(var a=__values(e.types),i=a.next();!i.done;i=a.next()){var o=i.value;if(!pd(t.types,o))return!1}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return!0}if(1056&e.flags&&Nc(e)===t)return!0;return pd(t.types,e)}(e,t)}function Vv(e,t){return 1048576&e.flags?KN(e.types,t):t(e)}function qv(e,t){return 1048576&e.flags?dD(e.types,t):t(e)}function Wv(e,t){return 1048576&e.flags?XN(e.types,t):t(e)}function Hv(e,t){if(1048576&e.flags){var r=e.types,n=nD(r,t);if(n===r)return e;var a=e.origin,i=void 0;if(a&&1048576&a.flags){var o=a.types,a=nD(o,function(e){return 1048576&e.flags||t(e)});if(o.length-a.length==r.length-n.length){if(1===a.length)return a[0];i=gd(1048576,a)}}return kd(n,16809984&e.objectFlags,void 0,void 0,i)}return 131072&e.flags||t(e)?e:Mt}function Kv(e,t){return Hv(e,function(e){return e!==t})}function Gv(e,t,r){var n,a;if(131072&e.flags)return e;if(!(1048576&e.flags))return t(e);var i,o=e.origin,s=(o&&1048576&o.flags?o:e).types,c=!1;try{for(var u=__values(s),_=u.next();!_.done;_=u.next()){var l=_.value,d=1048576&l.flags?Gv(l,t,r):t(l),c=c||l!==d;d&&(i?i.push(d):i=[d])}}catch(e){n={error:e}}finally{try{_&&!_.done&&(a=u.return)&&a.call(u)}finally{if(n)throw n.error}}return c?i&&hd(i,r?0:1):e}function Xv(e,t,r,n){return 1048576&e.flags&&r?hd(iD(e.types,t),1,r,n):Gv(e,t)}function Qv(e,t){return Hv(e,function(e){return 0!=(e.flags&t)})}function Yv(e,t){return Wk(e,134217804)&&Wk(t,402655616)?Gv(e,function(e){return 4&e.flags?Qv(t,402653316):Yd(e)&&!Wk(t,402653188)?Qv(t,128):8&e.flags?Qv(t,264):64&e.flags?Qv(t,2112):e}):e}function Zv(e){return 0===e.flags}function $v(e){return 0===e.flags?e.type:e}function eg(e,t){return t?{flags:0,type:131072&e.flags?Rt:e}:e}function tg(e){return rt[e.id]||(rt[e.id]=(t=e,(e=Eo(256)).elementType=t,e));var t}function rg(e,t){t=yy(Vm(kT(t)));return Uv(t,e.elementType)?e:tg(hd([e.elementType,t]))}function ng(e){return e.finalArrayType||(e.finalArrayType=131072&(e=e.elementType).flags?Er:Yl(1048576&e.flags?hd(e.types,2):e))}function ag(e){return 256&WL(e)?ng(e):e}function ig(e){return 256&WL(e)?e.elementType:Mt}function og(e){var t=function e(t){var r=t.parent;return 217===r.kind||226===r.kind&&64===r.operatorToken.kind&&r.left===t||226===r.kind&&28===r.operatorToken.kind&&r.right===t?e(r):t}(e),r=t.parent,e=aj(r)&&("length"===r.name.escapedText||213===r.parent.kind&&xR(r.name)&&OO(r.name)),r=212===r.kind&&r.expression===t&&226===r.parent.kind&&64===r.parent.operatorToken.kind&&r.parent.left===r&&!tO(r.parent)&&Hk(xT(r.argumentExpression),296);return e||r}function sg(e,t){if(8752&(e=zi(e)).flags)return sc(e);if(7&e.flags){if(262144&BL(e)){var r=e.links.syntheticOrigin;if(r&&sg(r))return sc(e)}var n=e.valueDeclaration;if(n){if((Aj(a=n)||AR(a)||DR(a)||CR(a))&&(nL(a)||cI(a)&&nF(a)&&a.initializer&&VM(a.initializer)&&aL(a.initializer)))return sc(e);if(Aj(n)&&250===n.parent.parent.kind){r=n.parent.parent,a=cg(r.expression,void 0);if(a)return KS(r.awaitModifier?15:13,a,gt,void 0)}t&&SM(t,tP(n,mA._0_needs_an_explicit_type_annotation,Yo(e)))}}var a}function cg(e,t){if(!(67108864&e.flags))switch(e.kind){case 80:return sg(To(sv(e)),t);case 110:return function(e){e=RP(e,!1,!1);if(bE(e)){var t=E_(e);if(t.thisParameter)return sg(t.thisParameter)}if(NE(e.parent)){t=yo(e.parent);return lL(e)?sc(t):Pc(t).thisType}}(e);case 108:return Ig(e);case 211:var r=cg(e.expression,t);if(r){var n=e.name,a=void 0;if(bR(n)){if(!r.symbol)return;a=u_(r,FO(r.symbol,n.escapedText))}else a=u_(r,n.escapedText);return a&&sg(a,t)}return;case 217:return cg(e.expression,t)}}function ug(e){var t,r=ci(e),n=r.effectsSignature;return void 0===n&&(t=void 0,244===e.parent.kind?t=cg(e.expression,void 0):108!==e.expression.kind&&(t=aE(e)?sx(_y(TT(e.expression),e.expression),e.expression):tx(e.expression)),t=1!==(t=l_(t&&Zu(t)||yt,0)).length||t[0].typeParameters?dD(t,_g)?Cb(e):void 0:t[0],n=r.effectsSignature=t&&_g(t)?t:wn),n===wn?void 0:n}function _g(e){return!!(M_(e)||e.declaration&&131072&(B_(e.declaration)||yt).flags)}function lg(e){var t=function t(e,r){for(;;){if(e===gn)return hn;var n=e.flags;if(4096&n){if(!r){var a=kv(e),i=ya[a];return void 0!==i?i:ya[a]=t(e,!0)}r=!1}if(368&n)e=e.antecedent;else if(512&n){var o=ug(e.node);if(o){var a=M_(o);if(a&&3===a.kind&&!a.type){var s=e.node.arguments[a.parameterIndex];if(s&&dg(s))return!1}if(131072&j_(o).flags)return!1}e=e.antecedent}else{if(4&n)return dD(e.antecedents,function(e){return t(e,!1)});if(8&n){var c=e.antecedents;if(void 0===c||0===c.length)return!1;e=c[0]}else{if(!(128&n)){if(1024&n){gn=void 0;var s=e.target,o=s.antecedents;s.antecedents=e.antecedents;var c=t(e.antecedent,!1);return s.antecedents=o,c}return!(1&n)}if(e.clauseStart===e.clauseEnd&&Fk(e.switchStatement))return!1;e=e.antecedent}}}}(e,!1);return gn=e,hn=t}function dg(e){e=oO(e,!0);return 97===e.kind||226===e.kind&&(56===e.operatorToken.kind&&(dg(e.left)||dg(e.right))||57===e.operatorToken.kind&&dg(e.left)&&dg(e.right))}function fg(u,m,y,_,e){var t,r;void 0===y&&(y=m),void 0===e&&(e=null==(t=BD(u,WI))?void 0:t.flowNode);var n=!1,l=0;if(Un)return dt;if(!e)return m;Vn++;var d=zn,e=$v(g(e));zn=d;e=256&WL(e)&&og(u)?Er:ag(e);return e===Bt||u.parent&&235===u.parent.kind&&!(131072&e.flags)&&131072&Cv(e,2097152).flags?m:e===vt?yt:e;function v(){return n?r:(n=!0,r=function e(t,r,n,a){switch(t.kind){case 80:if(!tL(t)){var i=sv(t);return i!==it?"".concat(a?mJ(a):"-1","|").concat(r.id,"|").concat(n.id,"|").concat(yJ(i)):void 0}case 110:return"0|".concat(a?mJ(a):"-1","|").concat(r.id,"|").concat(n.id);case 235:case 217:return e(t.expression,r,n,a);case 166:var o=e(t.left,r,n,a);return o&&o+"."+t.right.escapedText;case 211:case 212:if(void 0===(i=_v(t)))break;return(o=e(t.expression,r,n,a))&&o+"."+i;case 206:case 207:case 262:case 218:case 219:case 174:return"".concat(mJ(t),"#").concat(r.id)}}(u,m,y,_))}function g(e){var t,r,n;if(2e3===l)return null!=iA&&iA.instant(iA.Phase.CheckTypes,"getTypeAtFlowNode_DepthLimit",{flowId:e.id}),Un=!0,r=FA(t=u,wE),r=sP(t=CF(t),r.statements.pos),Sa.add(QL(t,r.start,r.length,mA.The_containing_function_or_module_body_is_too_large_for_control_flow_analysis)),dt;for(l++;;){var a=e.flags;if(4096&a){for(var i=d;i=ak(i)&&l>=ak(o),d=n<=l?void 0:Yb(e,l),f=a<=l?void 0:Yb(t,l),f=Qa(1|(y&&!m?16777216:0),(d===f?d:d?f?void 0:d:f)||"arg".concat(l));f.links.type=m?Yl(p):p,_[l]=f}{var v;u&&((v=Qa(1,"args")).links.type=Yl(ek(o,s)),o===t&&(v.links.type=pp(v.links.type,r)),_[s]=v)}return _}(e,t,r),o=function(e,t,r){if(!e||!t)return e||t;r=hd([sc(e),pp(sc(t),r)]);return my(e,r)}(e.thisParameter,t.thisParameter,r),s=Math.max(e.minArgumentCount,t.minArgumentCount),s=Zc(a,n,o,i,void 0,void 0,s,167&(e.flags|t.flags));s.compositeKind=2097152,s.compositeSignatures=fD(2097152===e.compositeKind&&e.compositeSignatures||[e],[t]),r&&(s.mapper=2097152===e.compositeKind&&e.mapper&&e.compositeSignatures?tp(e.mapper,r):r);return s}(e,t):void 0:e}):void 0}function ph(e,t){e=nD(l_(e,0),function(e){return!function(e,t){for(var r=0;r=r.length)return 0===HN(i=A_(r,o,r.length,t))?a:pl(e,i)}if(HN(a.typeParameters)>=r.length)return cl(a,i=A_(r,a.typeParameters,r.length,t))}function Hh(e){var t,r,n,a,i,o,s,c,u,_=YE(e);function l(){var e=PF(s.tagName);return $L(void 0,mA._0_cannot_be_used_as_a_JSX_component,e)}_&&function(e){var t,r;(function(e){if(aj(e)&&rB(e.expression))return RN(e.expression,mA.JSX_property_access_expressions_cannot_include_JSX_namespace_names);if(rB(e)&&vM(ee)&&!VO(e.namespace.escapedText))RN(e,mA.React_components_cannot_include_JSX_namespace_names)})(e.tagName),hN(e,e.typeArguments);var n=new Map;try{for(var a=__values(e.attributes.properties),i=a.next();!i.done;i=a.next()){var o=i.value;if(293!==o.kind){var s=o.name,c=o.initializer,o=nR(s);if(n.get(o))return RN(s,mA.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);if(n.set(o,!0),c&&294===c.kind&&!c.expression)return RN(c,mA.JSX_attributes_must_only_be_assigned_a_non_empty_expression)}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}(e),a=e,0===(ee.jsx||0)&&Ua(a,mA.Cannot_use_JSX_unless_the_jsx_flag_is_provided),void 0===Uh(a)&&N&&Ua(a,mA.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist),Lh(e)||(t=Sa&&2===ee.jsx?mA.Cannot_find_name_0:void 0,r=Ra(e),n=_?e.tagName:e,a=void 0,Zj(e)&&"null"===r||(a=pi(n,r,111551,t,r,!0)),a&&(a.isReferenced=67108863,Oe&&2097152&a.flags&&!Hi(a)&&Gi(a)),!Zj(e)||(i=ja(CF(e)))&&pi(n,i,111551,t,i,!0)),_&&(Eb(_=Cb(i=e),e),void 0!==(e=qh(i))?nm(Dh(o=i.tagName)?Lf(oR(o)):TT(o),e,Aa,o,mA.Its_type_0_is_not_a_valid_JSX_element_type,function(){var e=PF(o);return $L(void 0,mA._0_cannot_be_used_as_a_JSX_component,e)}):(e=rb(i),_=j_(_),s=i,1===e?(c=Vh(s))&&nm(_,c,Aa,s.tagName,mA.Its_return_type_0_is_not_a_valid_JSX_element,l):0===e?(u=zh(s))&&nm(_,u,Aa,s.tagName,mA.Its_instance_type_0_is_not_a_valid_JSX_element,l):(c=Vh(s),u=zh(s),c&&u&&nm(_,hd([c,u]),Aa,s.tagName,mA.Its_element_type_0_is_not_a_valid_JSX_element,l))))}function Kh(e,t,r){var n,a;if(524288&e.flags){if(Pu(e,t)||k_(e,t)||Vc(t)&&g_(e,wt)||r&&Nh(t))return 1}else if(3145728&e.flags&&Gh(e))try{for(var i=__values(e.types),o=i.next();!o.done;o=i.next())if(Kh(o.value,t,r))return 1}catch(e){n={error:e}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(n)throw n.error}}}function Gh(e){return!!(524288&e.flags&&!(512&WL(e))||67108864&e.flags||1048576&e.flags&&dD(e.types,Gh)||2097152&e.flags&&XN(e.types,Gh))}function Xh(e,t){if(!function(e){if(e.expression&&OB(e.expression))RN(e.expression,mA.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array)}(e),e.expression){t=TT(e.expression,t);return e.dotDotDotToken&&t!==ut&&!Dm(t)&&Ua(e,mA.JSX_spread_child_must_be_an_array_type),t}return dt}function Qh(e){return e.valueDeclaration?VN(e.valueDeclaration):0}function Yh(e){if(8192&e.flags||4&BL(e))return 1;if(cI(e.valueDeclaration)){e=e.valueDeclaration.parent;return e&&mj(e)&&3===NI(e)}}function Zh(e,t,r,n,a,i){return void 0===i&&(i=!0),$h(e,t,r,n,a,i?166===e.kind?e.right:205===e.kind?e:208===e.kind&&e.propertyName?e.propertyName:e.name:void 0)}function $h(e,t,r,n,a,i){var o,s=JL(a,r);if(t){if(V<2&&ex(a))return i&&Ua(i,mA.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword),!1;if(256&s)return i&&Ua(i,mA.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression,Yo(a),$o(xm(a))),!1}if(256&s&&ex(a)&&(qP(e)||HP(e)||$R(e.parent)&&WP(e.parent.parent))&&((o=qL(go(a)))&&!!FA(e,function(e){return!!(IR(e)&&FF(e.body)||AR(e))||!(!NE(e)&&!TE(e))&&"quit"})))return i&&Ua(i,mA.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor,Yo(a),AO(o.name)),!1;if(!(24&s))return!0;if(8&s)return!!gC(e,o=qL(go(a)))||(i&&Ua(i,mA.Property_0_is_private_and_only_accessible_within_class_1,Yo(a),$o(xm(a))),!1);if(t)return!0;t=vC(e,function(e){return km(Pc(yo(e)),a,r)});return!t&&(t=(t=function(e){e=function(e){e=RP(e,!1,!1);return e&&bE(e)?YO(e):void 0}(e),e=(null==e?void 0:e.type)&&Uf(e.type);e&&262144&e.flags&&(e=Mu(e));if(e&&7&WL(e))return _c(e);return}(e))&&km(t,a,r),32&s||!t)?(i&&Ua(i,mA.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses,Yo(a),$o(xm(a)||n)),!1):!!(32&s)||(262144&n.flags&&(n=(n.isThisType?Mu:Vu)(n)),!(!n||!lc(n,t))||(i&&Ua(i,mA.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2,Yo(a),$o(t),$o(n)),!1))}function ex(e){return hm(e,function(e){return!(8192&e.flags)})}function tx(e){return sx(TT(e),e)}function rx(e){return!!(50331648&wv(e))}function nx(e){return rx(e)?oy(e):e}function ax(e,t){var r=AL(e)?eP(e):void 0;106!==e.kind?void 0!==r&&r.length<100?xR(e)&&"undefined"===r?Ua(e,mA.The_value_0_cannot_be_used_here,"undefined"):Ua(e,16777216&t?33554432&t?mA._0_is_possibly_null_or_undefined:mA._0_is_possibly_undefined:mA._0_is_possibly_null,r):Ua(e,16777216&t?33554432&t?mA.Object_is_possibly_null_or_undefined:mA.Object_is_possibly_undefined:mA.Object_is_possibly_null):Ua(e,mA.The_value_0_cannot_be_used_here,"null")}function ix(e,t){Ua(e,16777216&t?33554432&t?mA.Cannot_invoke_an_object_which_is_possibly_null_or_undefined:mA.Cannot_invoke_an_object_which_is_possibly_undefined:mA.Cannot_invoke_an_object_which_is_possibly_null)}function ox(e,t,r){if(te&&2&e.flags){if(AL(t)){var n=eP(t);if(n.length<100)return Ua(t,mA._0_is_of_type_unknown,n),dt}return Ua(t,mA.Object_is_of_type_unknown),dt}n=wv(e);if(50331648&n){r(t,n);n=oy(e);return 229376&n.flags?dt:n}return e}function sx(e,t){return ox(e,t,ax)}function cx(e,t){var r=sx(e,t);if(16384&r.flags){if(AL(t)){e=eP(t);if(xR(t)&&"undefined"===e)return Ua(t,mA.The_value_0_cannot_be_used_here,e),r;if(e.length<100)return Ua(t,mA._0_is_possibly_undefined,e),r}Ua(t,mA.Object_is_possibly_undefined)}return r}function ux(e,t,r){return 64&e.flags?(a=t,i=TT((n=e).expression),o=_y(i,n.expression),uy(vx(n,n.expression,sx(o,n.expression),n.name,a),n,o!==i)):vx(e,e.expression,tx(e.expression),e.name,t,r);var n,a,i,o}function _x(e,t){var r=tI(e)&&$O(e.left)?sx(Eg(e.left),e.left):tx(e.left);return vx(e,e.left,r,e.right,t)}function lx(e){for(;217===e.parent.kind;)e=e.parent;return ME(e.parent)&&e.parent.expression===e}function dx(e,t){for(var r=MP(t);r;r=IP(r)){var n=r.symbol,a=FO(n,e),a=n.members&&n.members.get(a)||n.exports&&n.exports.get(a);if(a)return a}}function fx(e){!function(e){if(!IP(e))return RN(e,mA.Private_identifiers_are_not_allowed_outside_class_bodies);if(!Nj(e.parent)){if(!$P(e))return RN(e,mA.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression);var t=mj(e.parent)&&103===e.parent.operatorToken.kind;if(!px(e)&&!t)RN(e,mA.Cannot_find_name_0,LA(e))}}(e);e=px(e);return e&&Ex(e,void 0,!1),ut}function px(e){if($P(e)){var t=ci(e);return void 0===t.resolvedSymbol&&(t.resolvedSymbol=dx(e.escapedText,e)),t.resolvedSymbol}}function mx(e,t){return u_(e,t.escapedName)}function yx(e,t){return(Is(t)||qP(e)&&Os(t))&&RP(e,!0,!1)===Ls(t)}function vx(e,t,r,n,a,i){var o,s,c,u=ci(t).resolvedSymbol,_=eO(e),l=Zu(0!==_||lx(e)?xy(r):r),d=gs(l)||l===Rt;if(bR(n)){V<99&&(0!==_&&dN(e,1048576),1!==_&&dN(e,524288));var f=dx(n.escapedText,n);if(_&&f&&f.valueDeclaration&&FR(f.valueDeclaration)&&RN(n,mA.Cannot_assign_to_private_method_0_Private_methods_are_not_writable,LA(n)),d){if(f)return hs(l)?dt:l;if(void 0===MP(n))return RN(n,mA.Private_identifiers_are_not_allowed_outside_class_bodies),ut}if(void 0===(o=f&&mx(r,f))){if(function(e,r,t){var n,a=Ou(e);a&&KN(a,function(e){var t=e.valueDeclaration;if(t&&BA(t)&&bR(t.name)&&t.name.escapedText===r.escapedText)return n=e,!0});var i=vi(r);if(n){var o=rA.checkDefined(n.valueDeclaration),s=rA.checkDefined(IP(o));if(null!=t&&t.valueDeclaration){a=t.valueDeclaration,t=IP(a);if(rA.assert(!!t),FA(t,function(e){return s===e}))return SM(Ua(r,mA.The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_private_identifier_with_the_same_spelling,i,$o(e)),tP(a,mA.The_shadowing_declaration_of_0_is_defined_here,i),tP(o,mA.The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here,i)),1}return Ua(r,mA.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier,i,vi(s.name||iJ)),1}}(r,n,f))return dt;var p=MP(n);p&&DF(CF(p),ee.checkJs)&&RN(n,mA.Private_field_0_must_be_declared_in_an_enclosing_class,LA(n))}else 65536&o.flags&&!(32768&o.flags)&&1!==_&&Ua(e,mA.Private_accessor_was_defined_without_a_getter)}else{if(d)return xR(t)&&u&&Tg(u,e),hs(l)?dt:l;o=u_(l,n.escapedText,!1,166===e.kind)}if(xR(t)&&u&&(sM(ee)||!o||!(zC(o)||8&o.flags&&306===e.parent.kind)||fM(ee)&&kg(e))&&Tg(u,e),o){var m=Gw(o,n);if(Ka(m)&&Kd(e,m)&&m.declarations&&Xa(n,m.declarations,n.escapedText),f=e,p=n,(m=(d=o).valueDeclaration)&&!CF(f).isDeclarationFile&&(c=LA(p),!xx(f)||function(e){return AR(e)&&!yL(e)&&e.questionToken}(m)||GL(f)&&GL(f.expression)||li(m,p)||FR(m)&&32&UN(m)||!b&&function(e){if(!(32&e.parent.flags))return!1;var t=sc(e.parent);for(;;){if(!(t=t.symbol&&function(e){e=Tc(e);return 0!==e.length?Cd(e):void 0}(t)))return!1;var r=u_(t,e.escapedName);if(r&&r.valueDeclaration)return!0}}(d)?263!==m.kind||183===f.parent.kind||33554432&m.flags||li(m,p)||(s=Ua(p,mA.Class_0_used_before_its_declaration,c)):s=Ua(p,mA.Property_0_is_used_before_its_initialization,c),s&&SM(s,tP(m,mA._0_is_declared_here,c))),Ex(o,e,Fx(t,u)),ci(e).resolvedSymbol=o,Zh(e,108===t.kind,VL(e),l,o),Bk(e,o,_))return Ua(n,mA.Cannot_assign_to_0_because_it_is_a_read_only_property,LA(n)),dt;c=yx(e,o)?_t:(i||UL(e)?oc:sc)(o)}else{i=bR(n)||0!==_&&$d(r)&&!HM(r)?void 0:k_(l,n.escapedText);if(!i||!i.type){_=gx(e,r.symbol,!0);return!_&&Wd(r)?ut:r.symbol===Ne?(Ne.exports.has(n.escapedText)&&418&Ne.exports.get(n.escapedText).flags?Ua(n,mA.Property_0_does_not_exist_on_type_1,OA(n.escapedText),$o(r)):N&&Ua(n,mA.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature,$o(r)),ut):(n.escapedText&&!gi(e)&&bx(n,HM(r)?l:r,_),dt)}i.isReadonly&&(tO(e)||sO(e))&&Ua(e,mA.Index_signature_in_type_0_only_permits_reading,$o(l)),c=ee.noUncheckedIndexedAccess&&!tO(e)?hd([i.type,xt]):i.type,ee.noPropertyAccessFromIndexSignature&&aj(e)&&Ua(n,mA.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0,OA(n.escapedText)),i.declaration&&Ga(i.declaration)&&Xa(n,[i.declaration],n.escapedText)}return hx(e,o,c,n,a)}function gx(e,t,r){var n=CF(e);if(!n||void 0!==ee.checkJs||void 0!==n.checkJsDirective||1!==n.scriptKind&&2!==n.scriptKind)return!1;var a=KN(null==t?void 0:t.declarations,CF);return!(n!==a&&a&&ui(a)||r&&t&&32&t.flags||e&&r&&aj(e)&&110===e.expression.kind)}function hx(e,t,r,n,a){var i=eO(e);if(1===i)return ly(r,!!(t&&16777216&t.flags));if(t&&!(98311&t.flags)&&!(8192&t.flags&&1048576&r.flags)&&!aC(t.declarations))return r;if(r===_t)return Rs(e,t);r=bg(r,e,a);var o,s=!1;te&&v&&GL(e)&&110===e.expression.kind?(o=t&&t.valueDeclaration)&&Mw(o)&&(lL(o)||(176!==(a=pg(e)).kind||a.parent!==o.parent||33554432&o.flags||(s=!0))):te&&t&&t.valueDeclaration&&aj(t.valueDeclaration)&&PI(t.valueDeclaration)&&pg(e)===pg(t.valueDeclaration)&&(s=!0);e=fg(e,r,s?iy(r):r);return s&&!Qp(r)&&Qp(e)?(Ua(n,mA.Property_0_is_used_before_being_assigned,Yo(t)),r):i?Vm(e):e}function xx(e){return FA(e,function(e){switch(e.kind){case 172:return!0;case 303:case 174:case 177:case 178:case 305:case 167:case 239:case 294:case 291:case 292:case 293:case 286:case 233:case 298:return!1;case 219:case 244:return!(!kj(e.parent)||!PR(e.parent.parent))||"quit";default:return!$P(e)&&"quit"}})}function bx(e,t,r){var n,a,i,o,s,c,u;if(!bR(e)&&1048576&t.flags&&!(402784252&t.flags))try{for(var _=__values(t.types),l=_.next();!l.done;l=_.next()){var d=l.value;if(!u_(d,e.escapedText)&&!k_(d,e.escapedText)){o=$L(o,mA.Property_0_does_not_exist_on_type_1,QF(e),$o(d));break}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(a=_.return)&&a.call(_)}finally{if(n)throw n.error}}kx(e.escapedText,t)?(s=QF(e),c=$o(t),o=$L(o,mA.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead,s,c,c+"."+s)):(c=XT(t))&&u_(c,e.escapedText)?(o=$L(o,mA.Property_0_does_not_exist_on_type_1,QF(e),$o(t)),i=tP(e,mA.Did_you_forget_to_use_await)):(s=QF(e),f=$o(t),void 0!==(c=function(e,t){var r,n,t=Zu(t).symbol;if(!t)return;var t=RA(t),a=OF().get(t);if(a)try{for(var i=__values(a),o=i.next();!o.done;o=i.next()){var s=__read(o.value,2),c=s[0];if(eD(s[1],e))return c}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}(s,t))?o=$L(o,mA.Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2_or_later,s,f,c):void 0!==(c=Sx(e,t))?(u=RA(c),o=$L(o,r?mA.Property_0_may_not_exist_on_type_1_Did_you_mean_2:mA.Property_0_does_not_exist_on_type_1_Did_you_mean_2,s,f,u),i=c.valueDeclaration&&tP(c.valueDeclaration,mA._0_is_declared_here,u)):(u=t,u=ee.lib&&!ee.lib.includes("dom")&&function(e,t){return 3145728&e.flags?XN(e.types,t):t(e)}(u,function(e){return e.symbol&&/^(EventTarget|Node|((HTML[a-zA-Z]*)?Element))$/.test(OA(e.symbol.escapedName))})&&Gp(u)?mA.Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom:mA.Property_0_does_not_exist_on_type_1,o=$L(c_(o,t),u,s,f)));var f=nP(CF(e),e,o);i&&SM(f,i),Va(!r||o.code!==mA.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code,f)}function kx(e,t){e=t.symbol&&u_(sc(t.symbol),e);return void 0!==e&&e.valueDeclaration&&lL(e.valueDeclaration)}function Tx(e,t){return Ax(e,Ou(t),106500)}function Sx(e,t){var r,n=Ou(t);return"string"!=typeof e&&(aj(r=e.parent)&&(n=nD(n,function(e){return Px(r,t,e)})),e=LA(e)),Ax(e,n,111551)}function wx(e,t){var r=jD(e)?e:LA(e),e=Ou(t),t="for"===r?QN(e,function(e){return"htmlFor"===RA(e)}):"class"===r?QN(e,function(e){return"className"===RA(e)}):void 0;return null!=t?t:Ax(r,e,111551)}function Cx(e,t){t=Sx(e,t);return t&&RA(t)}function Nx(e,a,t){return rA.assert(void 0!==a,"outername should always be defined"),mi(e,a,t,void 0,a,!1,!1,!0,function(t,e,r){rA.assertEqual(a,e,"name should equal outerName");var n=_i(t,e,r);return n||(n=t===we?uD(["string","number","boolean","object","bigint","symbol"],function(e){return t.has(e.charAt(0).toUpperCase()+e.slice(1))?Qa(524288,e):void 0}).concat(PD(t.values())):PD(t.values()),Ax(OA(e),n,r))})}function Dx(e,t){return t.exports&&Ax(LA(e),so(t),2623475)}function Ax(e,t,r){return VD(e,t,function(e){var t=RA(e);if(XD(t,'"'))return;if(e.flags&r)return t;if(2097152&e.flags){e=function(e){if(si(e).aliasTarget!==ot)return Ui(e)}(e);if(e&&e.flags&r)return t}return})}function Ex(e,t,r){var n=e&&106500&e.flags&&e.valueDeclaration;if(n){var a=uL(n,8),n=e.valueDeclaration&&BA(e.valueDeclaration)&&bR(e.valueDeclaration.name);if((a||n)&&(!t||!UL(t)||65536&e.flags)){if(r){t=FA(t,TE);if(t&&t.symbol===e)return}(1&BL(e)?si(e).target:e).isReferenced=67108863}}}function Fx(e,t){return 110===e.kind||!!t&&AL(e)&&t===sv(EL(e))}function Px(e,t,r){return Ox(e,211===e.kind&&108===e.expression.kind,!1,t,r)}function Ix(e,t,r,n){if(gs(n))return!0;r=u_(n,r);return!!r&&Ox(e,t,!1,n,r)}function Ox(e,t,r,n,a){if(gs(n))return!0;if(a.valueDeclaration&&yE(a.valueDeclaration)){var i=IP(a.valueDeclaration);return!aE(e)&&!!FA(e,function(e){return e===i})}return $h(e,t,r,n,a)}function Lx(e){var t,r=oO(e);if(80===r.kind){var n=sv(r);if(3&n.flags)for(var a=e,i=e.parent;i;){if(249===i.kind&&a===i.statement&&function(e){var t=e.initializer;if(261===t.kind){e=t.declarations[0];if(e&&!PE(e.name))return yo(e)}else if(80===t.kind)return sv(t)}(i)===n&&(1===v_(t=xT(i.expression)).length&&g_(t,Ct)))return 1;i=(a=i).parent}}}function Mx(e,t){return 64&e.flags?(n=t,a=TT((r=e).expression),i=_y(a,r.expression),uy(Rx(r,sx(i,r.expression),n),r,i!==a)):Rx(e,tx(e.expression),t);var r,n,a,i}function Rx(e,t,r){var n=0!==eO(e)||lx(e)?xy(t):t,a=e.argumentExpression,t=TT(a);if(hs(n)||n===Rt)return n;if(Gk(n)&&!oF(a))return Ua(a,mA.A_const_enum_member_can_only_be_accessed_using_a_string_literal),dt;n=uf(n,Lx(a)?Ct:t,tO(e)?4|($d(n)&&!HM(n)?2:0):32,e)||dt;return zT(hx(e,ci(e).resolvedSymbol,n,a,r),e)}function jx(e){return ME(e)||cj(e)||YE(e)}function Bx(e){return jx(e)&&KN(e.typeArguments,iC),215===e.kind?TT(e.template):YE(e)?TT(e.attributes):170!==e.kind&&KN(e.arguments,function(e){TT(e)}),Sn}function Jx(e){return Bx(e),wn}function zx(e){return!!e&&(230===e.kind||237===e.kind&&e.isSpread)}function Ux(e){return ZN(e,zx)}function Vx(e){return!!(16384&e.flags)}function qx(e){return!!(49155&e.flags)}function Wx(e,t,r,n){void 0===n&&(n=!1);var a=!1,i=nk(r),o=ak(r);if(215===e.kind){var s,c=t.length;a=228===e.template.kind?EF((s=ND(e.template.templateSpans)).literal)||!!s.literal.isUnterminated:(s=e.template,rA.assert(15===s.kind),!!s.isUnterminated)}else if(170===e.kind)c=cb(e,r);else if(YE(e)){if(a=e.attributes.end===e.end)return 1;c=0===o?t.length:1,i=0===t.length?i:1,o=Math.min(o,1)}else{if(!e.arguments)return rA.assert(214===e.kind),0===ak(r);c=n?t.length+1:t.length,a=e.arguments.end===e.end;t=Ux(t);if(0<=t)return t>=ak(r)&&(ik(r)||t=e&&t.length<=r}function Kx(e){return Xx(e,0,!1)}function Gx(e){return Xx(e,0,!1)||Xx(e,1,!1)}function Xx(e,t,r){if(524288&e.flags){e=Eu(e);if(r||0===e.properties.length&&0===e.indexInfos.length){if(0===t&&1===e.callSignatures.length&&0===e.constructSignatures.length)return e.callSignatures[0];if(1===t&&1===e.constructSignatures.length&&0===e.callSignatures.length)return e.constructSignatures[0]}}}function Qx(e,t,r,n){var a=Cy(e.typeParameters,e,0,n),n=ok(t),n=r&&(n&&262144&n.flags?r.nonFixingMapper:r.mapper);return Sy(n?ip(t,n):t,e,function(e,t){Qy(a.inferences,e,t)}),r||wy(t,e,function(e,t){Qy(a.inferences,e,t,128)}),U_(e,iv(a),cI(t.declaration))}function Yx(e){if(!e)return Lt;var t=TT(e);return iE(e.parent)?oy(t):aE(e.parent)?cy(t):t}function Zx(e,t,r,n,a){if(YE(e))return i=n,o=a,s=lh(s=t,c=e),i=aT(c.attributes,s,o,i),Qy(o.inferences,i,s),iv(o);var i,o,s,c,u;170!==e.kind&&(!(i=ih(e,(c=XN(t.typeParameters,Gu))?8:0))||Iy(s=j_(t))&&(o=_h(e),!c&&ih(e,8)!==i||(u=(c=Kx(u=pp(i,Py((void 0===(u=1)&&(u=0),(c=o)&&Ny(iD(c.inferences,Fy),c.signature,c.flags|u,c.compareTypes))))))&&c.typeParameters?K_(V_(c,c.typeParameters)):u,Qy(a.inferences,u,s,128)),u=Cy(t.typeParameters,t,a.flags),o=pp(i,o&&o.returnMapper),Qy(u.inferences,o,s),a.returnMapper=dD(u.inferences,yT)?Py((u=nD((s=u).inferences,yT)).length?Ny(iD(u,Fy),s.signature,s.flags,s.compareTypes):void 0):void 0));var _=sk(t),l=_?Math.min(nk(t)-1,r.length):r.length;_&&262144&_.flags&&((d=QN(a.inferences,function(e){return e.typeParameter===_}))&&(d.impliedArity=ZN(r,zx,l)<0?r.length-l:void 0));var d=L_(t);d&&Iy(d)&&(e=ib(e),Qy(a.inferences,Yx(e),d));for(var f=0;ft.length;)n.pop();for(;n.lengtha.parameters.length&&(s=_h(a),r&&2&r&&_k(o,n,s)),!n||B_(a)||o.resolvedReturnType||(r=Nk(a,r),o.resolvedReturnType||(o.resolvedReturnType=r)),NT(a)))),sc(yo(e))}function Mk(e,t,r,n){if(void 0===n&&(n=!1),Ap(t,qt))return!0;t=n&>(t);return Wa(e,!!t&&Ap(t,qt),r),!1}function Rk(e){if(!oj(e))return!1;if(!DI(e))return!1;var t=iT(e.arguments[2]);if(vs(t,"value")){var r=u_(t,"writable"),e=r&&sc(r);if(!e||e===Dt||e===At)return!0;if(r&&r.valueDeclaration&&iB(r.valueDeclaration)){r=TT(r.valueDeclaration.initializer);if(r===Dt||r===At)return!0}return!1}return!u_(t,"set")}function jk(e){return!!(8&BL(e)||4&e.flags&&64&JL(e)||3&e.flags&&6&Qh(e)||98304&e.flags&&!(65536&e.flags)||8&e.flags||dD(e.declarations,Rk))}function Bk(e,t,r){if(0!==r){if(jk(t)){if(4&t.flags&&GL(e)&&110===e.expression.kind){var n=PP(e);if(!n||176!==n.kind&&!Nb(n))return 1;if(t.valueDeclaration){var a=mj(t.valueDeclaration),i=n.parent===t.valueDeclaration.parent,r=n===t.valueDeclaration.parent,o=a&&(null==(o=t.parent)?void 0:o.valueDeclaration)===n.parent,n=a&&(null==(t=t.parent)?void 0:t.valueDeclaration)===n;return!(i||r||o||n)}}return 1}if(GL(e)){e=oO(e.expression);if(80===e.kind){e=ci(e).resolvedSymbol;if(2097152&e.flags){e=ki(e);return e&&274===e.kind}}}}}function Jk(e,t,r){var n=RB(e,7);if(80===n.kind||GL(n)){if(!(64&n.flags))return 1;Ua(e,r)}else Ua(e,t)}function zk(e){TT(e.expression);var t=oO(e.expression);if(!GL(t))return Ua(t,mA.The_operand_of_a_delete_operator_must_be_a_property_reference),It;aj(t)&&bR(t.name)&&Ua(t,mA.The_operand_of_a_delete_operator_cannot_be_a_private_identifier);var r=To(ci(t).resolvedSymbol);return r&&(jk(r)&&Ua(t,mA.The_operand_of_a_delete_operator_cannot_be_a_read_only_property),e=t,r=sc(t=r),!te||131075&r.flags||(re?16777216&t.flags:16777216&wv(r))||Ua(e,mA.The_operand_of_a_delete_operator_must_be_optional)),It}function Uk(e){var t,r=!1,n=LP(e);if(n&&PR(n))Ua(e,o=fj(e)?mA.await_expression_cannot_be_used_inside_a_class_static_block:mA.await_using_statements_cannot_be_used_inside_a_class_static_block),r=!0;else if(!(65536&e.flags))if(BP(e)){if(!IN(t=CF(e))){var a,i=void 0;switch(qF(t,ee)||(null!=i||(i=sP(t,e.pos)),o=fj(e)?mA.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module:mA.await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module,a=QL(t,i.start,i.length,o),Sa.add(a),r=!0),x){case 100:case 199:if(1===t.impliedNodeFormat){null!=i||(i=sP(t,e.pos)),Sa.add(QL(t,i.start,i.length,mA.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level)),r=!0;break}case 7:case 99:case 4:if(4<=V)break;default:null!=i||(i=sP(t,e.pos));var o=fj(e)?mA.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher:mA.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher;Sa.add(QL(t,i.start,i.length,o)),r=!0}}}else IN(t=CF(e))||(i=sP(t,e.pos),o=fj(e)?mA.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules:mA.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules,a=QL(t,i.start,i.length,o),n&&176!==n.kind&&0==(2&kO(n))&&SM(a,tP(n,mA.Did_you_mean_to_mark_this_function_as_async)),Sa.add(a),r=!0);return fj(e)&&Jg(e)&&(Ua(e,mA.await_expressions_cannot_be_used_in_a_parameter_initializer),r=!0),r}function Vk(e){return Wk(e,2112)?Hk(e,3)||Wk(e,296)?qt:Nt:Ct}function qk(e,t){if(Wk(e,t))return 1;e=qu(e);return e&&Wk(e,t)}function Wk(e,t){var r,n;if(e.flags&t)return!0;if(3145728&e.flags){var a=e.types;try{for(var i=__values(a),o=i.next();!o.done;o=i.next())if(Wk(o.value,t))return!0}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}return!1}function Hk(e,t,r){return!!(e.flags&t)||!(r&&114691&e.flags)&&(!!(296&t)&&Ap(e,Ct)||!!(2112&t)&&Ap(e,Nt)||!!(402653316&t)&&Ap(e,wt)||!!(528&t)&&Ap(e,It)||!!(16384&t)&&Ap(e,Lt)||!!(131072&t)&&Ap(e,Mt)||!!(65536&t)&&Ap(e,Tt)||!!(32768&t)&&Ap(e,gt)||!!(4096&t)&&Ap(e,Ot)||!!(67108864&t)&&Ap(e,Jt))}function Kk(e,t,r){return 1048576&e.flags?XN(e.types,function(e){return Kk(e,t,r)}):Hk(e,t,r)}function Gk(e){return 16&WL(e)&&e.symbol&&Xk(e.symbol)}function Xk(e){return 0!=(128&e.flags)}function Qk(e,t,r,n){return r===Rt||n===Rt?Rt:(bR(e)?(V<99&&dN(e,2097152),!ci(e).resolvedSymbol&&IP(e)&&bx(e,n,gx(e,n.symbol,!0))):Ip(sx(r,e),Ut,e),Ip(sx(n,t),Jt,t)&&qv(n,function(e){return e===rr||!!(2097152&e.flags)&&Xp(qu(e))})&&Ua(t,mA.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator,$o(n)),It)}function Yk(e,t,r,n,a){var i,o;void 0===a&&(a=!1);var s=e.properties,c=s[r];if(303===c.kind||304===c.kind){var u=c.name,_=Od(u);!sR(_)||(e=u_(t,cR(_)))&&(Ex(e,c,a),Zh(c,!1,!0,t,e));u=Ss(c,sf(t,_,32,u));return $k(304===c.kind?c:c.initializer,u)}if(305===c.kind){if(!(r>a;case 50:return n>>>a;case 48:return n<=ua.length)&&(null==(e=ua[e])?void 0:e.flags)||0}function XC(e){return Bw(e.parent),ci(e).enumMemberValue}function QC(e){switch(e.kind){case 306:case 211:case 212:return!0}return!1}function YC(e){if(306===e.kind)return XC(e);e=ci(e).resolvedSymbol;if(e&&8&e.flags){e=e.valueDeclaration;if(dP(e.parent))return XC(e)}}function ZC(e){return 524288&e.flags&&0".length-r,mA.Type_parameter_list_cannot_be_empty)}return!1}function vN(e){if(3<=V){var t=e.body&&kj(e.body)&&IB(e.body.statements);if(t){e=nD(e.parameters,function(e){return e.initializer||PE(e.name)||uF(e)});if(HN(e)){KN(e,function(e){SM(Ua(e,mA.This_parameter_is_not_allowed_with_use_strict_directive),tP(t,mA.use_strict_directive_used_here))});e=e.map(function(e,t){return tP(e,0===t?mA.Non_simple_parameter_declared_here:mA.and_here)});return SM.apply(void 0,__spreadArray([Ua(t,mA.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)],__read(e),!1)),!0}}}return!1}function gN(e){var t=CF(e);return fN(e)||yN(e.typeParameters,t)||function(e){for(var t=!1,r=e.length,n=0;n".length-e,mA.Type_argument_list_cannot_be_empty)}return!1}(e,t)}function xN(e){var t=e.types;if(mN(t))return 1;if(t&&0===t.length){var r=vA(e.token);return LN(e,t.pos,0,mA._0_list_cannot_be_empty,r)}return dD(t,bN)}function bN(e){return hj(e)&&kR(e.expression)&&e.typeArguments?RN(e,mA.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments):hN(e,e.typeArguments)}function kN(e){return 167===e.kind&&(226===e.expression.kind&&28===e.expression.operatorToken.kind&&RN(e.expression,mA.A_comma_expression_is_not_allowed_in_a_computed_property_name))}function TN(e){return e.asteriskToken&&(rA.assert(262===e.kind||218===e.kind||174===e.kind),33554432&e.flags?RN(e.asteriskToken,mA.Generators_are_not_allowed_in_an_ambient_context):!e.body&&RN(e.asteriskToken,mA.An_overload_signature_cannot_be_declared_as_a_generator))}function SN(e,t){return e&&RN(e,t)}function wN(e,t){return e&&RN(e,t)}function CN(e){if(jN(e))return 1;if(250!==e.kind||!e.awaitModifier||65536&e.flags)if(!Dj(e)||65536&e.flags||!xR(e.initializer)||"async"!==e.initializer.escapedText){if(261===e.initializer.kind){var t=e.initializer;if(!PN(t)){var r=t.declarations;if(!r.length)return;if(1i.line||h.generatedLine===i.line&&h.generatedCharacter>i.character))break;a&&(h.generatedLine>=5)&&(t|=32),L(0<=(t=t)&&t<26?65+t:26<=t&&t<52?97+t-26:52<=t&&t<62?48+t-52:62===t?43:63===t?47:rA.fail("".concat(t,": not a base64 value")))}while(0=a.length)return f("Error in decoding base64VLQFormatDecode, past the mapping string"),-1;var n=65<=(n=a.charCodeAt(i))&&n<=90?n-65:97<=n&&n<=122?n-97+26:48<=n&&n<=57?n-48+52:43===n?62:47===n?63:-1;if(-1==n)return f("Invalid character in VLQ"),-1;e=0!=(32&n),r|=(31&n)<>=1:r=-(r>>=1),r}}function ZC(e,t){return e===t||e.generatedLine===t.generatedLine&&e.generatedCharacter===t.generatedCharacter&&e.sourceIndex===t.sourceIndex&&e.sourceLine===t.sourceLine&&e.sourceCharacter===t.sourceCharacter&&e.nameIndex===t.nameIndex}function $C(e){return void 0!==e.sourceIndex&&void 0!==e.sourceLine&&void 0!==e.sourceCharacter}function eN(e){return void 0!==e.sourceIndex&&void 0!==e.sourcePosition}function tN(e,t){return e.generatedPosition===t.generatedPosition&&e.sourceIndex===t.sourceIndex&&e.sourcePosition===t.sourcePosition}function rN(e,t){return rA.assert(e.sourceIndex===t.sourceIndex),UD(e.sourcePosition,t.sourcePosition)}function nN(e,t){return UD(e.generatedPosition,t.generatedPosition)}function aN(e){return e.sourcePosition}function iN(e){return e.generatedPosition}function oN(a,i,e){var r,o,c,e=lA(e),t=i.sourceRoot?fA(i.sourceRoot,e):e,s=fA(i.file,e),u=a.getSourceFileLike(s),_=i.sources.map(function(e){return fA(e,t)}),l=new Map(_.map(function(e,t){return[a.getCanonicalFileName(e),t]}));return{getSourcePosition:function(e){var t=function(){var t,e;if(void 0===o){var r=[];try{for(var n=__values(d()),a=n.next();!a.done;a=n.next()){var i=a.value;r.push(i)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}o=E(r,nN,tN)}return o}();if(!dD(t))return e;var r=B(t,e.pos,iN,UD);r<0&&(r=~r);r=t[r];return void 0!==r&&eN(r)?{fileName:_[r.sourceIndex],pos:r.sourcePosition}:e},getGeneratedPosition:function(e){var t=l.get(a.getCanonicalFileName(e.fileName));if(void 0===t)return e;var r=function(e){var t,r;if(void 0===c){var n=[];try{for(var a=__values(d()),i=a.next();!i.done;i=a.next()){var o,s=i.value;eN(s)&&((o=n[s.sourceIndex])||(n[s.sourceIndex]=o=[]),o.push(s))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}c=n.map(function(e){return E(e,rN,tN)})}return c[e]}(t);if(!dD(r))return e;var n=B(r,e.pos,aN,UD);n<0&&(n=~n);n=r[n];return void 0!==n&&n.sourceIndex===t?{fileName:s,pos:n.generatedPosition}:e}};function n(e){var t,r,n=void 0!==u?Fi(u,e.generatedLine,e.generatedCharacter,!0):-1;return $C(e)&&(r=a.getSourceFileLike(_[e.sourceIndex]),t=i.sources[e.sourceIndex],r=void 0!==r?Fi(r,e.sourceLine,e.sourceCharacter,!0):-1),{generatedPosition:n,source:t,sourceIndex:e.sourceIndex,sourcePosition:r,nameIndex:e.nameIndex}}function d(){var e,t;return void 0===r&&(t=PD(e=YC(i.mappings),n),r=void 0!==e.error?(a.log&&a.log("Encountered error while decoding sourcemap: ".concat(e.error)),WN):t),r}}var sN,cN,uN=e({"src/compiler/sourcemap.ts":function(){MK(),An(),JC=/\/\/[@#] source[M]appingURL=(.+)\r?\n?$/,zC=/^\/\/[@#] source[M]appingURL=(.+)\r?\n?$/,UC=/^\s*(\/\/[@#] .*)?$/,VC={getSourcePosition:ir,getGeneratedPosition:ir}}});function _N(e){return(e=EA(e))?mJ(e):0}function lN(e){return void 0!==e.propertyName&&"default"===e.propertyName.escapedText}function dN(t,r){return function(e){return(312===e.kind?r:function(e){return t.factory.createBundle(iD(e.sourceFiles,r),e.prepends)})(e)}}function fN(e){return!!jI(e)}function pN(e){var t,r;if(jI(e))return!0;var n=e.importClause&&e.importClause.namedBindings;if(!n)return!1;if(!ih(n))return!1;var a=0;try{for(var i=__values(n.elements),o=i.next();!o.done;o=i.next())lN(o.value)&&a++}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return 0=u.length&&null!==(_=t.body.multiLine)&&void 0!==_?_:0=e.end)return!1;var n=GF(e);for(;r;){if(r===n||r===e)return!1;if(CE(r)&&r.parent===e)return!0;r=r.parent}return!1}(t,e)))return UB(x.getGeneratedNameForNode(JA(t)),e)}return e}(e);case 110:return function(e){if(1&o&&16&v)return UB(x.createUniqueName("_this",48),e);return e}(e)}return e}(t);if(xR(t))return function(e){if(2&o&&!$h(e)){var t=PA(e,xR);if(t&&function(e){switch(e.parent.kind){case 208:case 263:case 266:case 260:return e.parent.name===e&&g.isDeclarationWithCollidingName(e.parent)}return!1}(t))return UB(x.getGeneratedNameForNode(t),e)}return e}(t);return t},dN(l,function(e){if(e.isDeclarationFile)return e;a=(u=e).text;e=function(e){var t=b(8064,64),r=[],n=[];_();var a=x.copyPrologue(e.statements,r,!1,S);gD(n,SJ(e.statements,S,XE,a)),i&&n.push(x.createVariableStatement(void 0,x.createVariableDeclarationList(i)));return x.mergeLexicalEnvironment(r,p()),B(r,e),k(t,0,0),x.updateSourceFile(e,UB(x.createNodeArray(fD(r,n)),e.statements))}(e);return qy(e,l.readEmitHelpers()),i=a=u=void 0,v=0,e});function b(e,t){var r=v;return v=32767&(v&~e|t),r}function k(e,t,r){v=-32768&(v&~t|r)|e}function T(e){return 0!=(8192&v)&&253===e.kind&&!e.expression}function n(e){return 0!=(1024&e.transformFlags)||void 0!==h||8192&v&&(4194304&(t=e).transformFlags&&(Kg(t)||wj(t)||Gg(t)||Xg(t)||eh(t)||fh(t)||ph(t)||Zg(t)||aB(t)||Qg(t)||JE(t,!1)||kj(t)))||JE(e,!1)&&_e(e)||0!=(1&m_(e));var t}function S(e){return n(e)?D(e,!1):e}function w(e){return n(e)?D(e,!0):e}function C(e){if(n(e)){var t=EA(e);if(AR(t)&&dL(t)){var r=b(32670,16449),t=D(e,!1);return k(r,98304,0),t}return D(e,!1)}return e}function N(e){return 108===e.kind?Se(!0):S(e)}function D(e,t){switch(e.kind){case 126:return;case 263:return function(e){var t=x.createVariableDeclaration(x.getLocalName(e,!0),void 0,void 0,F(e));_R(t,e);var r=[],t=x.createVariableStatement(void 0,x.createVariableDeclarationList([t]));_R(t,e),UB(t,e),sx(t),r.push(t),_L(e,1)&&(_R(e=_L(e,1024)?x.createExportDefault(x.getLocalName(e)):x.createExternalModuleExport(x.getLocalName(e)),t),r.push(e));return Ee(r)}(e);case 231:return F(e);case 169:return function(e){if(!e.dotDotDotToken)return PE(e.name)?_R(UB(x.createParameterDeclaration(void 0,void 0,x.getGeneratedNameForNode(e),void 0,void 0,void 0),e),e):e.initializer?_R(UB(x.createParameterDeclaration(void 0,void 0,e.name,void 0,void 0,void 0),e),e):e}(e);case 262:return function(e){var t=h;h=void 0;var r=b(32670,65),n=MC(e.parameters,S,l),a=W(e),i=32768&v?x.getLocalName(e):e.name;return k(r,98304,0),h=t,x.updateFunctionDeclaration(e,SJ(e.modifiers,S,gE),e.asteriskToken,i,void 0,n,void 0,a)}(e);case 219:return function(e){16384&e.transformFlags&&!(16384&v)&&(v|=65536);var t=h;h=void 0;var r=b(15232,66),n=x.createFunctionExpression(void 0,void 0,void 0,void 0,MC(e.parameters,S,l),void 0,W(e));return UB(n,e),_R(n,e),lR(n,16),k(r,0,0),h=t,n}(e);case 218:return function(e){var t=524288&p_(e)?b(32662,69):b(32670,65),r=h;h=void 0;var n=MC(e.parameters,S,l),a=W(e),i=32768&v?x.getLocalName(e):e.name;return k(t,98304,0),h=r,x.updateFunctionExpression(e,void 0,e.asteriskToken,i,void 0,n,void 0,a)}(e);case 260:return G(e);case 80:return E(e);case 261:return function(e){if(7&e.flags||524288&e.transformFlags){7&e.flags&&we();var t=SJ(e.declarations,1&e.flags?K:G,Aj),r=x.createVariableDeclarationList(t);return _R(r,e),UB(r,e),dR(r,e),524288&e.transformFlags&&(PE(e.declarations[0].name)||PE(ND(e.declarations).name))&&Ey(r,function(e){var t,r,n=-1,a=-1;try{for(var i=__values(e),o=i.next();!o.done;o=i.next()){var s=o.value;n=-1===n?s.pos:-1===s.pos?n:Math.min(n,s.pos),a=Math.max(a,s.end)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return gf(n,a)}(t)),r}return wJ(e,S,l)}(e);case 255:return function(e){if(void 0===h)return wJ(e,S,l);var t=h.allowedNonLabeledJumps;h.allowedNonLabeledJumps|=2;e=wJ(e,S,l);return h.allowedNonLabeledJumps=t,e}(e);case 269:return a=b(7104,0),n=wJ(n=e,S,l),k(a,0,0),n;case 241:return function(e,t){if(t)return wJ(e,S,l);t=256&v?b(7104,512):b(6976,128),e=wJ(e,S,l);return k(t,0,0),e}(e,!1);case 252:case 251:return function(e){if(h){var t=252===e.kind?2:4;if(!(e.label&&h.labels&&h.labels.get(LA(e.label))||!e.label&&h.allowedNonLabeledJumps&t)){var r=void 0,t=e.label;t?252===e.kind?(r="break-".concat(t.escapedText),ye(h,!0,LA(t),r)):(r="continue-".concat(t.escapedText),ye(h,!1,LA(t),r)):r=252===e.kind?(h.nonLocalJumps|=2,"break"):(h.nonLocalJumps|=4,"continue");r=x.createStringLiteral(r);if(h.loopOutParameters.length){for(var n=h.loopOutParameters,a=void 0,i=0;i(tx(t)?1:0);return!1}(e.left))return jN(e,E,p,0,!t,R);return wJ(e,E,p)}(e,t);break;case 224:case 225:return function(e,t){var r,n;if((46===e.operator||47===e.operator)&&xR(e.operand)&&!mE(e.operand)&&!ex(e.operand)&&!Rf(e.operand)){var a=K(e.operand);if(a){var i=void 0,o=TJ(e.operand,E,jE);pj(e)?o=y.updatePrefixUnaryExpression(e,o):(o=y.updatePostfixUnaryExpression(e,o),t||(i=y.createTempVariable(_),UB(o=y.createAssignment(i,o),e)),UB(o=y.createComma(o,y.cloneNode(e.operand)),e));try{for(var s=__values(a),c=s.next();!c.done;c=s.next()){var u=c.value;f[mJ(o)]=!0,UB(o=q(u,o),e)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i&&(f[mJ(o)]=!0,UB(o=y.createComma(o,i),e)),o}}return wJ(e,E,p)}(e,t)}var r,n,a;return wJ(e,E,p)}function E(e){return A(e,!1)}function F(e){return A(e,!0)}function P(e,t){if(t&&e.initializer&&Ej(e.initializer)&&!(7&e.initializer.flags)){var r=j(void 0,e.initializer,!1);if(r){var n=[],a=TJ(e.initializer,F,Ej),i=y.createVariableStatement(void 0,a);n.push(i),gD(n,r);a=TJ(e.condition,E,jE),i=TJ(e.incrementor,F,jE),r=jC(e.statement,t?D:E,p);return n.push(y.updateForStatement(e,void 0,a,i,r)),n}}return y.updateForStatement(e,TJ(e.initializer,F,mc),TJ(e.condition,E,jE),TJ(e.incrementor,F,jE),jC(e.statement,t?D:E,p))}function I(e,t){var r=y.createUniqueName("resolve"),n=y.createUniqueName("reject"),a=[y.createParameterDeclaration(void 0,void 0,r),y.createParameterDeclaration(void 0,void 0,n)],n=y.createBlock([y.createExpressionStatement(y.createCallExpression(y.createIdentifier("require"),void 0,[y.createArrayLiteralExpression([e||y.createOmittedExpression()]),r,n]))]);2<=l?i=y.createArrowFunction(void 0,void 0,a,void 0,void 0,n):(i=y.createFunctionExpression(void 0,void 0,void 0,void 0,a,void 0,n),t&&lR(i,16));var i=y.createNewExpression(y.createIdentifier("Promise"),void 0,[i]);return cM(v)?y.createCallExpression(y.createPropertyAccessExpression(i,y.createIdentifier("then")),void 0,[u().createImportStarCallbackHelper()]):i}function O(e,t){var r=e&&!hN(e)&&!t,t=y.createCallExpression(y.createPropertyAccessExpression(y.createIdentifier("Promise"),"resolve"),void 0,r?2<=l?[y.createTemplateExpression(y.createTemplateHead(""),[y.createTemplateSpan(e,y.createTemplateTail(""))])]:[y.createCallExpression(y.createPropertyAccessExpression(y.createStringLiteral(""),"concat"),void 0,[e])]:[]),e=y.createCallExpression(y.createIdentifier("require"),void 0,r?[y.createIdentifier("s")]:e?[e]:[]);cM(v)&&(e=u().createImportStarHelper(e));r=r?[y.createParameterDeclaration(void 0,void 0,"s")]:[],e=2<=l?y.createArrowFunction(void 0,void 0,r,void 0,void 0,e):y.createFunctionExpression(void 0,void 0,void 0,void 0,r,void 0,y.createBlock([y.createReturnStatement(e)]));return y.createCallExpression(y.createPropertyAccessExpression(t,"then"),void 0,[e])}function L(e,t){return!cM(v)||2&m_(e)?t:pN(e)?u().createImportStarHelper(t):mN(e)?u().createImportDefaultHelper(t):t}function M(e){var t=fx(y,e,h,g,k,v),e=[];return t&&e.push(t),y.createCallExpression(y.createIdentifier("require"),void 0,e)}function R(e,t,r){var n,a,i=K(e);if(i){var o=tx(e)?t:y.createAssignment(e,t);try{for(var s=__values(i),c=s.next();!c.done;c=s.next()){var u=c.value;lR(o,8),o=q(u,o,r)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}return o}return y.createAssignment(e,t)}function j(e,t,r){var n,a;if(T.exportEquals)return e;try{for(var i=__values(t.declarations),o=i.next();!o.done;o=i.next())e=function e(t,r,n){var a,i;if(T.exportEquals)return t;if(PE(r.name))try{for(var o=__values(r.name.elements),s=o.next();!s.done;s=o.next()){var c=s.value;gj(c)||(t=e(t,c,n))}}catch(e){a={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(a)throw a.error}}else mE(r.name)||Aj(r)&&!r.initializer&&!n||(t=J(t,new sN,r));return t}(e,o.value,r)}catch(e){n={error:e}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(n)throw n.error}}return e}function B(e,t){if(T.exportEquals)return e;var r=new sN;return _L(t,1)&&(e=z(e,r,_L(t,1024)?y.createIdentifier("default"):y.getDeclarationName(t),y.getLocalName(t),t)),t.name&&(e=J(e,r,t)),e}function J(e,t,r,n){var a,i,o=y.getDeclarationName(r),s=T.exportSpecifiers.get(o);if(s)try{for(var c=__values(s),u=c.next();!u.done;u=c.next()){var _=u.value;e=z(e,t,_.name,o,_.name,void 0,n)}}catch(e){a={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(a)throw a.error}}return e}function z(e,t,r,n,a,i,o){return t.has(r)||(t.set(r,!0),e=vD(e,V(r,n,a,i,o))),e}function U(){var e=0===l?y.createExpressionStatement(q(y.createIdentifier("__esModule"),y.createTrue())):y.createExpressionStatement(y.createCallExpression(y.createPropertyAccessExpression(y.createIdentifier("Object"),"defineProperty"),void 0,[y.createIdentifier("exports"),y.createStringLiteral("__esModule"),y.createObjectLiteralExpression([y.createPropertyAssignment("value",y.createTrue())])]));return lR(e,2097152),e}function V(e,t,r,n,a){r=UB(y.createExpressionStatement(q(e,t,void 0,a)),r);return sx(r),n||lR(r,3072),r}function q(e,t,r,n){return UB(n&&0!==l?y.createCallExpression(y.createPropertyAccessExpression(y.createIdentifier("Object"),"defineProperty"),void 0,[y.createIdentifier("exports"),y.createStringLiteralFromNode(e),y.createObjectLiteralExpression([y.createPropertyAssignment("enumerable",y.createTrue()),y.createPropertyAssignment("get",y.createFunctionExpression(void 0,void 0,void 0,void 0,[],void 0,y.createBlock([y.createReturnStatement(t)])))])]):y.createAssignment(y.createPropertyAccessExpression(y.createIdentifier("exports"),y.cloneNode(e)),t),r)}function W(e){switch(e.kind){case 95:case 90:return}return e}function H(e){if(8192&p_(e)){var t=cx(h);return t?y.createPropertyAccessExpression(t,e):e}if((!mE(e)||64&e.emitNode.autoGenerate.flags)&&!ex(e)){var r=k.getReferencedExportContainer(e,tx(e));if(r&&312===r.kind)return UB(y.createPropertyAccessExpression(y.createIdentifier("exports"),y.cloneNode(e)),e);var n=k.getReferencedImportDeclaration(e);if(n){if(zj(n))return UB(y.createPropertyAccessExpression(y.getGeneratedNameForNode(n.parent),y.createIdentifier("default")),e);if(Vj(n)){t=n.propertyName||n.name;return UB(y.createPropertyAccessExpression(y.getGeneratedNameForNode((null==(r=null==(r=n.parent)?void 0:r.parent)?void 0:r.parent)||n),y.cloneNode(t)),e)}}}return e}function K(e){var t,r,n,a,i,o;if(mE(e)){if(Rs(e)){var s=null==T?void 0:T.exportSpecifiers.get(e);if(s){var c=[];try{for(var u=__values(s),_=u.next();!_.done;_=u.next()){var l=_.value;c.push(l.name)}}catch(e){i={error:e}}finally{try{_&&!_.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}return c}}}else{var d=k.getReferencedImportDeclaration(e);if(d)return null==T?void 0:T.exportedBindings[_N(d)];var f=new Set,p=k.getReferencedValueDeclarations(e);if(p){try{for(var m=__values(p),y=m.next();!y.done;y=m.next()){var v=y.value,g=null==T?void 0:T.exportedBindings[_N(v)];if(g)try{for(var h=(n=void 0,__values(g)),x=h.next();!x.done;x=h.next()){var b=x.value;f.add(b)}}catch(e){n={error:e}}finally{try{x&&!x.done&&(a=h.return)&&a.call(h)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(t)throw t.error}}if(f.size)return PD(f)}}}}var Jz=e({"src/compiler/transformers/module/module.ts":function(){MK(),Rz={name:"typescript:dynamicimport-sync-require",scoped:!0,text:'\n var __syncRequire = typeof module === "object" && typeof module.exports === "object";'}}});function zz(l){var T=l.factory,o=l.startLexicalEnvironment,s=l.endLexicalEnvironment,d=l.hoistVariableDeclaration,f=l.getCompilerOptions(),p=l.getEmitResolver(),m=l.getEmitHost(),r=l.onSubstituteNode,a=l.onEmitNode;l.onSubstituteNode=function(e,t){if(function(e){return u&&e.id&&u[e.id]}(t=r(e,t)))return t;{if(1===e)return function(e){switch(e.kind){case 80:return function(e){if(8192&p_(e)){var t=cx(S);return t?T.createPropertyAccessExpression(t,e):e}if(!mE(e)&&!ex(e)){var r=p.getReferencedImportDeclaration(e);if(r){if(zj(r))return UB(T.createPropertyAccessExpression(T.getGeneratedNameForNode(r.parent),T.createIdentifier("default")),e);if(Vj(r))return UB(T.createPropertyAccessExpression(T.getGeneratedNameForNode((null==(t=null==(t=r.parent)?void 0:t.parent)?void 0:t.parent)||r),T.cloneNode(r.propertyName||r.name)),e)}}return e}(e);case 226:return function(e){var t,r;if(wL(e.operatorToken.kind)&&xR(e.left)&&(!mE(e.left)||Rs(e.left))&&!ex(e.left)){var n=q(e.left);if(n){var a=e;try{for(var i=__values(n),o=i.next();!o.done;o=i.next()){var s=o.value;a=M(s,W(a))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return a}}return e}(e);case 236:return function(e){if(B_(e))return T.createPropertyAccessExpression(c,T.createIdentifier("meta"));return e}(e)}return e}(t);if(4===e)return function(e){if(304===e.kind)return function(e){var t=e.name;if(!mE(t)&&!ex(t)){var r=p.getReferencedImportDeclaration(t);if(r){if(zj(r))return UB(T.createPropertyAssignment(T.cloneNode(t),T.createPropertyAccessExpression(T.getGeneratedNameForNode(r.parent),T.createIdentifier("default"))),e);if(Vj(r))return UB(T.createPropertyAssignment(T.cloneNode(t),T.createPropertyAccessExpression(T.getGeneratedNameForNode((null==(t=null==(t=r.parent)?void 0:t.parent)?void 0:t.parent)||r),T.cloneNode(r.propertyName||r.name))),e)}}return e}(e);return e}(t)}return t},l.onEmitNode=function(e,t,r){{var n;312===t.kind?(n=_N(t),S=t,y=_[n],w=h[n],u=x[n],c=b[n],u&&delete x[n],a(e,t,r),u=c=w=y=S=void 0):a(e,t,r)}},l.enableSubstitution(80),l.enableSubstitution(304),l.enableSubstitution(226),l.enableSubstitution(236),l.enableEmitNotification(312);var S,y,w,c,v,g,u,_=[],h=[],x=[],b=[];return dN(l,function(e){if(e.isDeclarationFile||!(qF(e,f)||8388608&e.transformFlags))return e;var t=_N(e);g=S=e,y=_[t]=yN(l,e),w=T.createUniqueName("exports"),h[t]=w,c=b[t]=T.createUniqueName("context");var r=function(e){var t,r,n=new Map,a=[];try{for(var i=__values(e),o=i.next();!o.done;o=i.next()){var s,c,u=o.value,_=fx(T,u,S,m,p,f);_&&(s=_.text,void 0!==(c=n.get(s))?a[c].externalImports.push(u):(n.set(s,a.length),a.push({name:_,externalImports:[u]})))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return a}(y.externalImports),n=function(e,t){var r=[];o();var n=pM(f,"alwaysStrict")||!f.noImplicitUseStrict&&XB(S),a=T.copyPrologue(e.statements,r,n,C);r.push(T.createVariableStatement(void 0,T.createVariableDeclarationList([T.createVariableDeclaration("__moduleName",void 0,void 0,T.createLogicalAnd(c,T.createPropertyAccessExpression(c,"id")))]))),TJ(y.externalHelpersImportDeclaration,C,XE);n=SJ(e.statements,C,XE,a);gD(r,v),t_(r,s());a=function(e){var t,r,n,a;if(!y.hasExportStarsToExportValues)return;if(!y.exportedNames&&0===y.exportSpecifiers.size){var i=!1;try{for(var o=__values(y.externalImports),s=o.next();!s.done;s=o.next()){var c=s.value;if(278===c.kind&&c.exportClause){i=!0;break}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}if(!i){var u=k(void 0);return e.push(u),u.name}}var _=[];if(y.exportedNames)try{for(var l=__values(y.exportedNames),d=l.next();!d.done;d=l.next()){var f=d.value;"default"!==f.escapedText&&_.push(T.createPropertyAssignment(T.createStringLiteralFromNode(f),T.createTrue()))}}catch(e){n={error:e}}finally{try{d&&!d.done&&(a=l.return)&&a.call(l)}finally{if(n)throw n.error}}u=T.createUniqueName("exportedNames");e.push(T.createVariableStatement(void 0,T.createVariableDeclarationList([T.createVariableDeclaration(u,void 0,void 0,T.createObjectLiteralExpression(_,!0))])));u=k(u);return e.push(u),u.name}(r),e=2097152&e.transformFlags?T.createModifiersFromModifierFlags(512):void 0,n=T.createObjectLiteralExpression([T.createPropertyAssignment("setters",function(e,t){var r,n,a,i,o,s,c=[];try{for(var u=__values(t),_=u.next();!_.done;_=u.next()){var l=_.value,d=KN(l.externalImports,function(e){return dx(T,e,S)}),f=d?T.getGeneratedNameForNode(d):T.createUniqueName(""),p=[];try{for(var m=(a=void 0,__values(l.externalImports)),y=m.next();!y.done;y=m.next()){var v=y.value,g=dx(T,v,S);switch(v.kind){case 272:if(!v.importClause)break;case 271:rA.assert(void 0!==g),p.push(T.createExpressionStatement(T.createAssignment(g,f))),_L(v,1)&&p.push(T.createExpressionStatement(T.createCallExpression(w,void 0,[T.createStringLiteral(LA(g)),f])));break;case 278:if(rA.assert(void 0!==g),v.exportClause)if(Hj(v.exportClause)){var h=[];try{for(var x=(o=void 0,__values(v.exportClause.elements)),b=x.next();!b.done;b=x.next()){var k=b.value;h.push(T.createPropertyAssignment(T.createStringLiteral(LA(k.name)),T.createElementAccessExpression(f,T.createStringLiteral(LA(k.propertyName||k.name)))))}}catch(e){o={error:e}}finally{try{b&&!b.done&&(s=x.return)&&s.call(x)}finally{if(o)throw o.error}}p.push(T.createExpressionStatement(T.createCallExpression(w,void 0,[T.createObjectLiteralExpression(h,!0)])))}else p.push(T.createExpressionStatement(T.createCallExpression(w,void 0,[T.createStringLiteral(LA(v.exportClause.name)),f])));else p.push(T.createExpressionStatement(T.createCallExpression(e,void 0,[f])))}}}catch(e){a={error:e}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(a)throw a.error}}c.push(T.createFunctionExpression(void 0,void 0,void 0,void 0,[T.createParameterDeclaration(void 0,void 0,f)],void 0,T.createBlock(p,!0)))}}catch(e){r={error:e}}finally{try{_&&!_.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}return T.createArrayLiteralExpression(c,!0)}(a,t)),T.createPropertyAssignment("execute",T.createFunctionExpression(e,void 0,void 0,void 0,[],void 0,T.createBlock(n,!0)))],!0);return r.push(T.createReturnStatement(n)),T.createBlock(r,!0)}(e,r),a=T.createFunctionExpression(void 0,void 0,void 0,void 0,[T.createParameterDeclaration(void 0,void 0,w),T.createParameterDeclaration(void 0,void 0,c)],void 0,n),i=px(T,e,m,f),r=T.createArrayLiteralExpression(iD(r,function(e){return e.name})),e=lR(T.updateSourceFile(e,UB(T.createNodeArray([T.createExpressionStatement(T.createCallExpression(T.createPropertyAccessExpression(T.createIdentifier("System"),"register"),void 0,i?[i,r,a]:[r,a]))]),e.statements)),2048);GO(f)||Ky(e,n,function(e){return!e.scoped});u&&(x[t]=u,u=void 0);return g=v=c=w=y=S=void 0,e});function k(e){var t=T.createUniqueName("exportStar"),r=T.createIdentifier("m"),n=T.createIdentifier("n"),a=T.createIdentifier("exports"),i=T.createStrictInequality(n,T.createStringLiteral("default"));return e&&(i=T.createLogicalAnd(i,T.createLogicalNot(T.createCallExpression(T.createPropertyAccessExpression(e,"hasOwnProperty"),void 0,[n])))),T.createFunctionDeclaration(void 0,void 0,t,void 0,[T.createParameterDeclaration(void 0,void 0,r)],void 0,T.createBlock([T.createVariableStatement(void 0,T.createVariableDeclarationList([T.createVariableDeclaration(a,void 0,void 0,T.createObjectLiteralExpression([]))])),T.createForInStatement(T.createVariableDeclarationList([T.createVariableDeclaration(n)]),r,T.createBlock([lR(T.createIfStatement(i,T.createExpressionStatement(T.createAssignment(T.createElementAccessExpression(a,n),T.createElementAccessExpression(r,n)))),1)])),T.createExpressionStatement(T.createCallExpression(w,void 0,[a]))],!0))}function C(e){switch(e.kind){case 272:return function(e){e.importClause&&d(dx(T,e,S));return Ee(function(e,t){var r,n;if(y.exportEquals)return e;t=t.importClause;if(!t)return e;t.name&&(e=I(e,t));var a=t.namedBindings;if(a)switch(a.kind){case 274:e=I(e,a);break;case 275:try{for(var i=__values(a.elements),o=i.next();!o.done;o=i.next()){var s=o.value;e=I(e,s)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}return e}(void 0,e))}(e);case 271:return t=e,rA.assert(nI(t),"import= for internal module references should be handled in an earlier transformer."),d(dx(T,t,S)),Ee(function(e,t){if(y.exportEquals)return e;return I(e,t)}(void 0,t));case 278:return t=e,void rA.assertIsDefined(t);case 277:return function(e){if(e.isExportEquals)return;e=TJ(e.expression,J,jE);return L(T.createIdentifier("default"),e,!0)}(e);default:return R(e)}var t}function N(e){var t,r,n,a;if(!A(e.declarationList))return TJ(e,J,XE);if(M_(e.declarationList)||L_(e.declarationList)){var i=SJ(e.modifiers,V,Hs),o=[];try{for(var s=__values(e.declarationList.declarations),c=s.next();!c.done;c=s.next()){var u=c.value;o.push(T.updateVariableDeclaration(u,T.getGeneratedNameForNode(u.name),void 0,void 0,E(u,!1)))}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}var _=T.updateVariableDeclarationList(e.declarationList,o),l=vD(l,T.updateVariableStatement(e,i,_))}else{var d=void 0,f=_L(e,1);try{for(var p=__values(e.declarationList.declarations),m=p.next();!m.done;m=p.next())(u=m.value).initializer?d=vD(d,E(u,f)):D(u)}catch(e){n={error:e}}finally{try{m&&!m.done&&(a=p.return)&&a.call(p)}finally{if(n)throw n.error}}d&&(l=vD(l,UB(T.createExpressionStatement(T.inlineExpressions(d)),e)))}return Ee(l=function(e,t,r){var n,a;if(y.exportEquals)return e;try{for(var i=__values(t.declarationList.declarations),o=i.next();!o.done;o=i.next()){var s=o.value;(s.initializer||r)&&(e=function e(t,r,n){var a,i;if(y.exportEquals)return t;if(PE(r.name))try{for(var o=__values(r.name.elements),s=o.next();!s.done;s=o.next()){var c=s.value;gj(c)||(t=e(t,c,n))}}catch(e){a={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(a)throw a.error}}else{var u;mE(r.name)||(u=void 0,n&&(t=O(t,r.name,T.getLocalName(r)),u=LA(r.name)),t=I(t,r,u))}return t}(e,s,r))}}catch(e){n={error:e}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(n)throw n.error}}return e}(l,e,!1))}function D(e){var t,r;if(PE(e.name))try{for(var n=__values(e.name.elements),a=n.next();!a.done;a=n.next()){var i=a.value;gj(i)||D(i)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}else d(T.cloneNode(e.name))}function A(e){return 0==(4194304&p_(e))&&(312===g.kind||0==(7&EA(e).flags))}function E(e,t){t=t?n:i;return PE(e.name)?jN(e,J,l,0,!1,t):e.initializer?t(e.name,TJ(e.initializer,J,jE)):e.name}function n(e,t,r){return F(e,t,r,!0)}function i(e,t,r){return F(e,t,r,!1)}function F(e,t,r,n){return d(T.cloneNode(e)),n?M(e,W(UB(T.createAssignment(e,t),r))):W(UB(T.createAssignment(e,t),r))}function P(e,t){return y.exportEquals||(_L(t,1)&&(e=O(e,r=_L(t,1024)?T.createStringLiteral("default"):t.name,T.getLocalName(t)),r=AO(r)),t.name&&(e=I(e,t,r))),e;var r}function I(e,t,r){var n,a;if(y.exportEquals)return e;var i=T.getDeclarationName(t),o=y.exportSpecifiers.get(i);if(o)try{for(var s=__values(o),c=s.next();!c.done;c=s.next()){var u=c.value;u.name.escapedText!==r&&(e=O(e,u.name,i))}}catch(e){n={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}return e}function O(e,t,r,n){return e=vD(e,L(t,r,n))}function L(e,t,r){t=T.createExpressionStatement(M(e,t));return sx(t),r||lR(t,3072),t}function M(e,t){e=xR(e)?T.createStringLiteralFromNode(e):e;return lR(t,3072|p_(t)),dR(T.createCallExpression(w,void 0,[e,t]),t)}function R(e){switch(e.kind){case 243:return N(e);case 262:return void(v=P(v=_L(_=e,1)?vD(v,T.updateFunctionDeclaration(_,SJ(_.modifiers,V,Hs),_.asteriskToken,T.getDeclarationName(_,!0,!0),void 0,SJ(_.parameters,J,CR),void 0,TJ(_.body,J,kj))):vD(v,wJ(_,J,l)),_));case 263:return u=e,_=T.getLocalName(u),d(_),Ee(P(vD(void 0,UB(T.createExpressionStatement(T.createAssignment(_,UB(T.createClassExpression(SJ(u.modifiers,V,Hs),u.name,void 0,SJ(u.heritageClauses,J,nB),SJ(u.members,J,CE)),u))),u)),u));case 248:return j(e,!0);case 249:return u=g,g=c=e,c=T.updateForInStatement(c,B(c.initializer),TJ(c.expression,J,jE),jC(c.statement,R,l)),g=u,c;case 250:return c=g,g=s=e,s=T.updateForOfStatement(s,s.awaitModifier,B(s.initializer),TJ(s.expression,J,jE),jC(s.statement,R,l)),g=c,s;case 246:return s=e,T.updateDoStatement(s,jC(s.statement,R,l),TJ(s.expression,J,jE));case 247:return o=e,T.updateWhileStatement(o,TJ(o.expression,J,jE),jC(o.statement,R,l));case 256:return o=e,T.updateLabeledStatement(o,o.label,rA.checkDefined(TJ(o.statement,R,XE,T.liftToBlock)));case 254:return i=e,T.updateWithStatement(i,TJ(i.expression,J,jE),rA.checkDefined(TJ(i.statement,R,XE,T.liftToBlock)));case 245:return i=e,T.updateIfStatement(i,TJ(i.expression,J,jE),rA.checkDefined(TJ(i.thenStatement,R,XE,T.liftToBlock)),TJ(i.elseStatement,R,XE,T.liftToBlock));case 255:return a=e,T.updateSwitchStatement(a,TJ(a.expression,J,jE),rA.checkDefined(TJ(a.caseBlock,R,eh)));case 269:return a=g,g=n=e,n=T.updateCaseBlock(n,SJ(n.clauses,R,Ac)),g=a,n;case 296:return n=e,T.updateCaseClause(n,TJ(n.expression,J,jE),SJ(n.statements,R,XE));case 297:return wJ(e,R,l);case 258:return wJ(e,R,l);case 299:return r=g,g=t=e,t=T.updateCatchClause(t,t.variableDeclaration,rA.checkDefined(TJ(t.block,R,kj))),g=r,t;case 241:return r=g,t=wJ(g=t=e,R,l),g=r,t;default:return J(e)}var t,r,n,a,i,o,s,c,u,_}function j(e,t){var r=g;return g=e,e=T.updateForStatement(e,TJ(e.initializer,t?B:z,mc),TJ(e.condition,J,jE),TJ(e.incrementor,z,jE),jC(e.statement,t?R:J,l)),g=r,e}function B(e){var t,r,n;if(Ej(n=e)&&A(n)){var a=void 0;try{for(var i=__values(e.declarations),o=i.next();!o.done;o=i.next()){var s=o.value,a=vD(a,E(s,!1));s.initializer||D(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return a?T.inlineExpressions(a):T.createOmittedExpression()}return TJ(e,z,mc)}function t(e,t){if(!(276828160&e.transformFlags))return e;switch(e.kind){case 248:return j(e,!1);case 244:return i=e,T.updateExpressionStatement(i,TJ(i.expression,z,jE));case 217:return a=e,i=t,T.updateParenthesizedExpression(a,TJ(a.expression,i?z:J,jE));case 360:return r=e,n=t,T.updatePartiallyEmittedExpression(r,TJ(r.expression,n?z:J,jE));case 226:if(sf(e))return function(e,t){if(U(e.left))return jN(e,J,l,0,!t);return wJ(e,J,l)}(e,t);break;case 213:if(mP(e))return n=fx(T,r=e,S,m,p,f),r=TJ(kD(r.arguments),J,jE),n=!n||r&&hR(r)&&r.text===n.text?r:n,T.createCallExpression(T.createPropertyAccessExpression(c,T.createIdentifier("import")),void 0,n?[n]:[]);break;case 224:case 225:return function(e,t){var r,n;if((46===e.operator||47===e.operator)&&xR(e.operand)&&!mE(e.operand)&&!ex(e.operand)&&!Rf(e.operand)){var a=q(e.operand);if(a){var i=void 0,o=TJ(e.operand,J,jE);pj(e)?o=T.updatePrefixUnaryExpression(e,o):(o=T.updatePostfixUnaryExpression(e,o),t||(i=T.createTempVariable(d),UB(o=T.createAssignment(i,o),e)),UB(o=T.createComma(o,T.cloneNode(e.operand)),e));try{for(var s=__values(a),c=s.next();!c.done;c=s.next()){var u=c.value;o=M(u,W(o))}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i&&UB(o=T.createComma(o,i),e),o}}return wJ(e,J,l)}(e,t)}var r,n,a,i;return wJ(e,J,l)}function J(e){return t(e,!1)}function z(e){return t(e,!0)}function U(e){if(NL(e,!0))return U(e.left);if(yj(e))return U(e.expression);if(nj(e))return dD(e.properties,U);if(rj(e))return dD(e.elements,U);if(oB(e))return U(e.name);if(iB(e))return U(e.initializer);if(xR(e)){e=p.getReferencedExportContainer(e);return void 0!==e&&312===e.kind}return!1}function V(e){switch(e.kind){case 95:case 90:return}return e}function q(e){var t,r,n,a=function(e){var t,r;if(!mE(e)){var n=p.getReferencedImportDeclaration(e);if(n)return n;var a=p.getReferencedValueDeclaration(e);if(a&&null!=y&&y.exportedBindings[_N(a)])return a;var i=p.getReferencedValueDeclarations(e);if(i)try{for(var o=__values(i),s=o.next();!s.done;s=o.next()){var c=s.value;if(c!==a&&null!=y&&y.exportedBindings[_N(c)])return c}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return a}}(e);if(a){var i=p.getReferencedExportContainer(e,!1);i&&312===i.kind&&(n=vD(n,T.getDeclarationName(a))),n=gD(n,null==y?void 0:y.exportedBindings[_N(a)])}else if(mE(e)&&Rs(e)){var o=null==y?void 0:y.exportSpecifiers.get(e);if(o){var s=[];try{for(var c=__values(o),u=c.next();!u.done;u=c.next()){var _=u.value;s.push(_.name)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}return s}}return n}function W(e){return void 0===u&&(u=[]),u[mJ(e)]=!0,e}}var Uz=e({"src/compiler/transformers/module/system.ts":function(){MK()}});function Vz(a){var n,i,o,s=a.factory,c=a.getEmitHelperFactory,u=a.getEmitHost(),_=a.getEmitResolver(),l=a.getCompilerOptions(),d=rM(l),f=a.onEmitNode,r=a.onSubstituteNode;return a.onEmitNode=function(e,t,r){uB(t)?((XB(t)||sM(l))&&l.importHelpers&&(n=new Map),f(e,t,r),n=void 0):f(e,t,r)},a.onSubstituteNode=function(e,t){if(t=r(e,t),n&&xR(t)&&8192&p_(t))return function(e){var t=LA(e),e=n.get(t);e||n.set(t,e=s.createUniqueName(t,48));return e}(t);return t},a.enableEmitNotification(312),a.enableSubstitution(80),dN(a,function(e){if(e.isDeclarationFile)return e;if(XB(e)||sM(l)){o=void 0;var t=function(e){var t=_x(s,c(),e,l);{if(t){var r=[],n=s.copyPrologue(e.statements,r);return vD(r,t),gD(r,SJ(e.statements,p,XE,n)),s.updateSourceFile(e,UB(s.createNodeArray(r),e.statements))}return wJ(e,p,a)}}(i=e);return i=void 0,o&&(t=s.updateSourceFile(t,UB(s.createNodeArray(r_(t.statements.slice(),o)),t.statements))),!XB(e)||dD(t.statements,VE)?t:s.updateSourceFile(t,UB(s.createNodeArray(__spreadArray(__spreadArray([],__read(t.statements),!1),[PB(s)],!1)),t.statements))}return e});function p(e){switch(e.kind){case 271:return 100<=nM(l)?(t=e,rA.assert(nI(t),"import= for internal module references should be handled in an earlier transformer."),Ee(function(e,t){_L(t,1)&&(e=vD(e,s.createExportDeclaration(void 0,t.isTypeOnly,s.createNamedExports([s.createExportSpecifier(!1,void 0,LA(t.name))]))));return e}(vD(void 0,_R(UB(s.createVariableStatement(void 0,s.createVariableDeclarationList([s.createVariableDeclaration(s.cloneNode(t.name),void 0,void 0,function(e){var t=fx(s,e,rA.checkDefined(i),u,_,l),r=[];t&&r.push(t);o||(n=s.createUniqueName("_createRequire",48),e=s.createImportDeclaration(void 0,s.createImportClause(!1,void 0,s.createNamedImports([s.createImportSpecifier(!1,s.createIdentifier("createRequire"),n)])),s.createStringLiteral("module")),t=s.createUniqueName("__require",48),n=s.createVariableStatement(void 0,s.createVariableDeclarationList([s.createVariableDeclaration(t,void 0,void 0,s.createCallExpression(s.cloneNode(n),void 0,[s.createPropertyAccessExpression(s.createMetaProperty(102,s.createIdentifier("meta")),s.createIdentifier("url"))]))],2<=d?2:0)),o=[e,n]);var n=o[1].declarationList.declarations[0].name;return rA.assertNode(n,xR),s.createCallExpression(s.cloneNode(n),void 0,r)}(t))],2<=d?2:0)),t),t)),t))):void 0;case 277:return(t=e).isExportEquals?void 0:t;case 278:return function(e){if(void 0!==l.module&&5"),Yt(),Ae(U.type),Tr(U),0;case 185:return kr(z=t),Dt(z,z.modifiers),Kt("new"),Yt(),Lt(z,z.typeParameters),Mt(z,z.parameters),Yt(),Wt("=>"),Yt(),Ae(z.type),Tr(z),0;case 186:return z=t,Kt("typeof"),Yt(),Ae(z.exprName),Ot(z,z.typeArguments),0;case 187:return function(e){wr(0,void 0),Wt("{");var t=1&p_(e)?768:32897;Bt(e,e.members,524288|t),Wt("}"),Cr()}(t),0;case 188:return Ae(t.elementType,we.parenthesizeNonArrayTypeOfPostfixType),Wt("["),Wt("]"),0;case 189:return function(e){et(23,e.pos,Wt,e);var t=1&p_(e)?528:657;Bt(e,e.elements,524288|t,we.parenthesizeElementTypeOfTupleType),et(24,e.elements.end,Wt,e)}(t),0;case 190:return Ae(t.type,we.parenthesizeTypeOfOptionalType),Wt("?"),0;case 192:return Bt(J=t,J.types,516,we.parenthesizeConstituentTypeOfUnionType),0;case 193:return Bt(J=t,J.types,520,we.parenthesizeConstituentTypeOfIntersectionType),0;case 194:return Ae((B=t).checkType,we.parenthesizeCheckTypeOfConditionalType),Yt(),Kt("extends"),Yt(),Ae(B.extendsType,we.parenthesizeExtendsTypeOfConditionalType),Yt(),Wt("?"),Yt(),Ae(B.trueType),Yt(),Wt(":"),Yt(),Ae(B.falseType),0;case 195:return B=t,Kt("infer"),Yt(),Ae(B.typeParameter),0;case 196:return j=t,Wt("("),Ae(j.type),Wt(")"),0;case 233:return Xe(t),0;case 197:return Kt("this"),0;case 198:return function(e){ir(e.operator,Kt),Yt();var t=148===e.operator?we.parenthesizeOperandOfReadonlyTypeOperator:we.parenthesizeOperandOfTypeOperator;Ae(e.type,t)}(t),0;case 199:return Ae((j=t).objectType,we.parenthesizeNonArrayTypeOfPostfixType),Wt("["),Ae(j.indexType),Wt("]"),0;case 200:return function(e){var t=p_(e);Wt("{"),1&t?Yt():(er(),tr());e.readonlyToken&&(Ae(e.readonlyToken),148!==e.readonlyToken.kind&&Kt("readonly"),Yt());Wt("["),Ie(3,e.typeParameter),e.nameType&&(Yt(),Kt("as"),Yt(),Ae(e.nameType));Wt("]"),e.questionToken&&(Ae(e.questionToken),58!==e.questionToken.kind&&Wt("?"));Wt(":"),Yt(),Ae(e.type),Ht(),1&t?Yt():(er(),rr());Bt(e,e.members,2),Wt("}")}(t),0;case 201:return Fe(t.literal),0;case 202:return Ae((R=t).dotDotDotToken),Ae(R.name),Ae(R.questionToken),et(59,R.name.end,Wt,R),Yt(),Ae(R.type),0;case 203:return Ae((R=t).head),Bt(R,R.templateSpans,262144),0;case 204:return Ae((M=t).type),Ae(M.literal),0;case 205:return function(e){e.isTypeOf&&(Kt("typeof"),Yt());{var t;Kt("import"),Wt("("),Ae(e.argument),e.assertions&&(Wt(","),Yt(),Wt("{"),Yt(),Kt("assert"),Wt(":"),Yt(),t=e.assertions.assertClause.elements,Bt(e.assertions.assertClause,t,526226),Yt(),Wt("}"))}Wt(")"),e.qualifier&&(Wt("."),Ae(e.qualifier));Ot(e,e.typeArguments)}(t),0;case 206:return M=t,Wt("{"),Bt(M,M.elements,525136),Wt("}"),0;case 207:return L=t,Wt("["),Bt(L,L.elements,524880),Wt("]"),0;case 208:return function(e){Ae(e.dotDotDotToken),e.propertyName&&(Ae(e.propertyName),Wt(":"),Yt());Ae(e.name),Et(e.initializer,e.name.end,e,we.parenthesizeExpressionForDisallowedComma)}(t),0;case 239:return Fe((L=t).expression),Ae(L.literal),0;case 240:return Ht(),0;case 241:return Qe(O=t,!O.multiLine&&gr(O)),0;case 243:return Nt(O=t,O.modifiers,!1),Ae(O.declarationList),Ht(),0;case 242:return Ye(!1),0;case 244:return Fe((I=t).expression,we.parenthesizeExpressionOfExpressionStatement),me&&lP(me)&&!jO(I.expression)||Ht(),0;case 245:return I=et(101,(P=t).pos,Kt,P),Yt(),et(21,I,Wt,P),Fe(P.expression),et(22,P.expression.end,Wt,P),It(P,P.thenStatement),P.elseStatement&&(or(P,P.thenStatement,P.elseStatement),et(93,P.thenStatement.end,Kt,P),245===P.elseStatement.kind?(Yt(),Ae(P.elseStatement)):It(P,P.elseStatement)),0;case 246:return function(e){et(92,e.pos,Kt,e),It(e,e.statement),kj(e.statement)&&!be?Yt():or(e,e.statement,e.expression);Ze(e,e.statement.end),Ht()}(t),0;case 247:return Ze(P=t,P.pos),It(P,P.statement),0;case 248:return function(e){var t=et(99,e.pos,Kt,e);Yt();t=et(21,t,Wt,e);$e(e.initializer),t=et(27,e.initializer?e.initializer.end:t,Wt,e),Pt(e.condition),t=et(27,e.condition?e.condition.end:t,Wt,e),Pt(e.incrementor),et(22,e.incrementor?e.incrementor.end:t,Wt,e),It(e,e.statement)}(t),0;case 249:return F=et(99,(E=t).pos,Kt,E),Yt(),et(21,F,Wt,E),$e(E.initializer),Yt(),et(103,E.initializer.end,Kt,E),Yt(),Fe(E.expression),et(22,E.expression.end,Wt,E),It(E,E.statement),0;case 250:return E=et(99,(F=t).pos,Kt,F),Yt(),function(e){e&&(Ae(e),Yt())}(F.awaitModifier),et(21,E,Wt,F),$e(F.initializer),Yt(),et(165,F.initializer.end,Kt,F),Yt(),Fe(F.expression),et(22,F.expression.end,Wt,F),It(F,F.statement),0;case 251:return et(88,(A=t).pos,Kt,A),Ft(A.label),Ht(),0;case 252:return et(83,(A=t).pos,Kt,A),Ft(A.label),Ht(),0;case 253:return et(107,(D=t).pos,Kt,D),Pt(D.expression&&rt(D.expression),rt),Ht(),0;case 254:return D=et(118,(N=t).pos,Kt,N),Yt(),et(21,D,Wt,N),Fe(N.expression),et(22,N.expression.end,Wt,N),It(N,N.statement),0;case 255:return N=et(109,(C=t).pos,Kt,C),Yt(),et(21,N,Wt,C),Fe(C.expression),et(22,C.expression.end,Wt,C),Yt(),Ae(C.caseBlock),0;case 256:return Ae((C=t).label),et(59,C.label.end,Wt,C),Yt(),Ae(C.statement),0;case 257:return et(111,(w=t).pos,Kt,w),Pt(rt(w.expression),rt),Ht(),0;case 258:return function(e){et(113,e.pos,Kt,e),Yt(),Ae(e.tryBlock),e.catchClause&&(or(e,e.tryBlock,e.catchClause),Ae(e.catchClause));e.finallyBlock&&(or(e,e.catchClause||e.tryBlock,e.finallyBlock),et(98,(e.catchClause||e.tryBlock).end,Kt,e),Yt(),Ae(e.finallyBlock))}(t),0;case 259:return nr(89,t.pos,Kt),Ht(),0;case 260:return Ae((T=t).name),Ae(T.exclamationToken),At(T.type),Et(T.initializer,null!==(S=null!==(w=null==(w=T.type)?void 0:w.end)&&void 0!==w?w:null==(S=null==(S=T.name.emitNode)?void 0:S.typeNode)?void 0:S.end)&&void 0!==S?S:T.name.end,T,we.parenthesizeExpressionForDisallowedComma),0;case 261:return function(e){L_(e)?(Kt("await"),Yt(),Kt("using")):Kt(j_(e)?"let":R_(e)?"const":M_(e)?"using":"var");Yt(),Bt(e,e.declarations,528)}(t),0;case 262:return at(t),0;case 263:return _t(t),0;case 264:return T=t,wr(0,void 0),Nt(T,T.modifiers,!1),Kt("interface"),Yt(),Ae(T.name),Lt(T,T.typeParameters),Bt(T,T.heritageClauses,512),Yt(),Wt("{"),Bt(T,T.members,129),Wt("}"),Cr(),0;case 265:return Nt(k=t,k.modifiers,!1),Kt("type"),Yt(),Ae(k.name),Lt(k,k.typeParameters),Yt(),Wt("="),Yt(),Ae(k.type),Ht(),0;case 266:return Nt(k=t,k.modifiers,!1),Kt("enum"),Yt(),Ae(k.name),Yt(),Wt("{"),Bt(k,k.members,145),Wt("}"),0;case 267:return function(e){Nt(e,e.modifiers,!1),2048&~e.flags&&(Kt(32&e.flags?"namespace":"module"),Yt());Ae(e.name);var t=e.body;if(!t)return Ht();for(;t&&Mj(t);)Wt("."),Ae(t.name),t=t.body;Yt(),Ae(t)}(t),0;case 268:return kr(b=t),KN(b.statements,Dr),Qe(b,gr(b)),Tr(b),0;case 269:return et(19,(x=t).pos,Wt,x),Bt(x,x.clauses,129),et(20,x.clauses.end,Wt,x,!0),0;case 270:return x=et(95,(b=t).pos,Kt,b),Yt(),x=et(130,x,Kt,b),Yt(),x=et(145,x,Kt,b),Yt(),Ae(b.name),Ht(),0;case 271:return function(e){Nt(e,e.modifiers,!1),et(102,e.modifiers?e.modifiers.end:e.pos,Kt,e),Yt(),e.isTypeOnly&&(et(156,e.pos,Kt,e),Yt());Ae(e.name),Yt(),et(64,e.name.end,Wt,e),Yt(),function(e){(80===e.kind?Fe:Ae)(e)}(e.moduleReference),Ht()}(t),0;case 272:return function(e){Nt(e,e.modifiers,!1),et(102,e.modifiers?e.modifiers.end:e.pos,Kt,e),Yt(),e.importClause&&(Ae(e.importClause),Yt(),et(161,e.importClause.end,Kt,e),Yt());Fe(e.moduleSpecifier),e.assertClause&&Ft(e.assertClause);Ht()}(t),0;case 273:return function(e){e.isTypeOnly&&(et(156,e.pos,Kt,e),Yt());Ae(e.name),e.name&&e.namedBindings&&(et(28,e.name.end,Wt,e),Yt());Ae(e.namedBindings)}(t),0;case 274:return h=et(42,(g=t).pos,Wt,g),Yt(),et(130,h,Kt,g),Yt(),Ae(g.name),0;case 280:return g=et(42,(h=t).pos,Wt,h),Yt(),et(130,g,Kt,h),Yt(),Ae(h.name),0;case 275:return lt(t),0;case 276:return dt(t),0;case 277:return function(e){var t=et(95,e.pos,Kt,e);Yt(),e.isExportEquals?et(64,t,Gt,e):et(90,t,Kt,e);Yt(),Fe(e.expression,e.isExportEquals?we.getParenthesizeRightSideOfBinaryForOperator(64):we.parenthesizeExpressionOfExportDefault),Ht()}(t),0;case 278:return function(e){Nt(e,e.modifiers,!1);var t=et(95,e.pos,Kt,e);Yt(),e.isTypeOnly&&(t=et(156,t,Kt,e),Yt());e.exportClause?Ae(e.exportClause):t=et(42,t,Wt,e);e.moduleSpecifier&&(Yt(),et(161,e.exportClause?e.exportClause.end:t,Kt,e),Yt(),Fe(e.moduleSpecifier));e.assertClause&&Ft(e.assertClause);Ht()}(t),0;case 279:return lt(t),0;case 281:return dt(t),0;case 300:return function(e){et(132,e.pos,Kt,e),Yt();var t=e.elements;Bt(e,t,526226)}(t),0;case 301:return function(e){Ae(e.name),Wt(":"),Yt();e=e.value;0==(1024&p_(e))&&on(Ly(e).pos);Ae(e)}(t),0;case 282:return;case 283:return v=t,Kt("require"),Wt("("),Fe(v.expression),Wt(")"),0;case 12:return v=t,ge.writeLiteral(v.text),0;case 286:case 289:return function(e){{var t;Wt("<"),Yj(e)&&(t=pr(e.tagName,e),ft(e.tagName),Ot(e,e.typeArguments),e.attributes.properties&&0")}(t),0;case 287:case 290:return function(e){Wt("")}(t),0;case 291:return Ae((y=t).name),function(e,t,r,n){r&&(t(e),n(r))}("=",Wt,y.initializer,Pe),0;case 292:return Bt(y=t,y.properties,262656),0;case 293:return m=t,Wt("{..."),Fe(m.expression),Wt("}"),0;case 294:return function(e){var t;{var r,n;(e.expression||!Se&&!jO(e)&&function(e){return function(e){var t=!1;return Xi((null==me?void 0:me.text)||"",e+1,function(){return t=!0}),t}(e)||function(e){var t=!1;return Gi((null==me?void 0:me.text)||"",e+1,function(){return t=!0}),t}(e)}(e.pos))&&((r=me&&!jO(e)&&gA(me,e.pos).line!==gA(me,e.end).line)&&ge.increaseIndent(),n=et(19,e.pos,Wt,e),Ae(e.dotDotDotToken),Fe(e.expression),et(20,(null==(t=e.expression)?void 0:t.end)||n,Wt,e),r&&ge.decreaseIndent())}}(t),0;case 295:return Ee((m=t).namespace),Wt(":"),Ee(m.name),0;case 296:return et(84,(p=t).pos,Kt,p),Yt(),Fe(p.expression,we.parenthesizeExpressionForDisallowedComma),pt(p,p.statements,p.expression.end),0;case 297:return f=et(90,(p=t).pos,Kt,p),pt(p,p.statements,f),0;case 298:return f=t,Yt(),ir(f.token,Kt),Yt(),Bt(f,f.types,528),0;case 299:return function(e){var t=et(85,e.pos,Kt,e);Yt(),e.variableDeclaration&&(et(21,t,Wt,e),Ae(e.variableDeclaration),et(22,e.variableDeclaration.end,Wt,e),Yt());Ae(e.block)}(t),0;case 303:return function(e){Ae(e.name),Wt(":"),Yt();e=e.initializer;0==(1024&p_(e))&&on(Ly(e).pos);Fe(e,we.parenthesizeExpressionForDisallowedComma)}(t),0;case 304:return Ae((d=t).name),d.objectAssignmentInitializer&&(Yt(),Wt("="),Yt(),Fe(d.objectAssignmentInitializer,we.parenthesizeExpressionForDisallowedComma)),0;case 305:return(d=t).expression&&(et(26,d.pos,Wt,d),Fe(d.expression,we.parenthesizeExpressionForDisallowedComma)),0;case 306:return Ae((l=t).name),Et(l.initializer,l.name.end,l,we.parenthesizeExpressionForDisallowedComma),0;case 307:return We(t),0;case 314:case 308:return function(e){var t,r;try{for(var n=__values(e.texts),a=n.next();!a.done;a=n.next()){var i=a.value;er(),Ae(i)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}(t),0;case 309:case 310:return _=t,l=Ne(),We(_),Te&&De(l,ge.getTextPos(),309===_.kind?"text":"internal"),0;case 311:return u=t,_=Ne(),We(u),Te&&((u=kn(u.section)).pos=_,u.end=ge.getTextPos(),Te.sections.push(u)),0;case 312:return xt(t),0;case 313:return rA.fail("Bundles should be printed using printBundle");case 315:return rA.fail("InputFiles should not be printed");case 316:return ht(t),0;case 317:return u=t,Yt(),Wt("{"),Ae(u.name),Wt("}"),0;case 319:return Wt("*"),0;case 320:return Wt("?"),0;case 321:return c=t,Wt("?"),Ae(c.type),0;case 322:return c=t,Wt("!"),Ae(c.type),0;case 323:return Ae(t.type),Wt("="),0;case 324:return s=t,Kt("function"),Mt(s,s.parameters),Wt(":"),Ae(s.type),0;case 191:case 325:return s=t,Wt("..."),Ae(s.type),0;case 326:return;case 327:return function(e){var t,r;if(ke("/**"),e.comment){var n=$A(e.comment);if(n){var a=n.split(/\r\n?|\n/g);try{for(var i=__values(a),o=i.next();!o.done;o=i.next()){var s=o.value;er(),Yt(),Wt("*"),Yt(),ke(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}}}e.tags&&(1!==e.tags.length||351!==e.tags[0].kind||e.comment?Bt(e,e.tags,33):(Yt(),Ae(e.tags[0])));Yt(),ke("*/")}(t),0;case 329:return mt(t),0;case 330:return yt(t),0;case 334:case 339:case 344:return vt((o=t).tagName),gt(o.comment),0;case 335:case 336:return vt((o=t).tagName),Yt(),Wt("{"),Ae(o.class),Wt("}"),gt(o.comment),0;case 337:case 338:return;case 340:case 341:case 342:case 343:return;case 345:return function(e){vt(e.tagName),e.name&&(Yt(),Ae(e.name));gt(e.comment),yt(e.typeExpression)}(t),0;case 346:return gt((i=t).comment),yt(i.typeExpression),0;case 348:case 355:return function(e){vt(e.tagName),ht(e.typeExpression),Yt(),e.isBracketed&&Wt("[");Ae(e.name),e.isBracketed&&Wt("]");gt(e.comment)}(t),0;case 347:case 349:case 350:case 351:case 356:case 357:return vt((i=t).tagName),ht(i.typeExpression),gt(i.comment),0;case 352:return vt((a=t).tagName),ht(a.constraint),Yt(),Bt(a,a.typeParameters,528),gt(a.comment),0;case 353:return function(e){vt(e.tagName),e.typeExpression&&(316===e.typeExpression.kind?ht(e.typeExpression):(Yt(),Wt("{"),ke("Object"),e.typeExpression.isArrayType&&(Wt("["),Wt("]")),Wt("}")));e.fullName&&(Yt(),Ae(e.fullName));gt(e.comment),e.typeExpression&&329===e.typeExpression.kind&&mt(e.typeExpression)}(t),0;case 354:return vt((a=t).tagName),Ae(a.name),gt(a.comment),0;case 359:return}jE(t)&&(e=1,xe===lU||(n=xe(e,t)||t)!==t&&(t=n,he&&(t=he(t))))}if(1===e)switch(t.kind){case 9:case 10:return qe(t,!1),0;case 11:case 14:case 15:return qe(t,!1),0;case 80:return He(t),0;case 81:return Ke(t),0;case 209:return fe=(de=t).elements,pe=de.multiLine?65536:0,Jt(de,fe,8914|pe,we.parenthesizeExpressionForDisallowedComma),0;case 210:return function(e){wr(0,void 0),KN(e.properties,Ar);var t=131072&p_(e);t&&tr();var r=e.multiLine?65536:0,n=me&&1<=me.languageVersion&&!lP(me)?64:0;Bt(e,e.properties,526226|n|r),t&&rr();Cr()}(t),0;case 211:return function(e){Fe(e.expression,we.parenthesizeLeftSideOfAccess);var t=e.questionDotToken||MM(uR.createToken(25),e.expression.end,e.name.pos),r=vr(e,e.expression,t),n=vr(e,t,e.name);cr(r,!1),29===t.kind||!function(e){{if(gR(e=vs(e))){var t=br(e,!0,!1);return!(448&e.numericLiteralFlags||WD(t,yA[25])||WD(t,String.fromCharCode(69))||WD(t,String.fromCharCode(101)))}if(GL(e)){e=zy(e);return"number"==typeof e&&isFinite(e)&&0<=e&&Math.floor(e)===e}}}(e.expression)||ge.hasTrailingComment()||ge.hasTrailingWhitespace()||Wt(".");e.questionDotToken?Ae(t):et(t.kind,e.expression.end,Wt,e);cr(n,!1),Ae(e.name),ur(r,n)}(t),0;case 212:return Fe((pe=t).expression,we.parenthesizeLeftSideOfAccess),Ae(pe.questionDotToken),et(23,pe.expression.end,Wt,pe),Fe(pe.argumentExpression),et(24,pe.argumentExpression.end,Wt,pe),0;case 213:return function(e){var t=16&m_(e);t&&(Wt("("),Vt("0"),Wt(","),Yt());Fe(e.expression,we.parenthesizeLeftSideOfAccess),t&&Wt(")");Ae(e.questionDotToken),Ot(e,e.typeArguments),Jt(e,e.arguments,2576,we.parenthesizeExpressionForDisallowedComma)}(t),0;case 214:return et(105,(le=t).pos,Kt,le),Yt(),Fe(le.expression,we.parenthesizeExpressionOfNew),Ot(le,le.typeArguments),Jt(le,le.arguments,18960,we.parenthesizeExpressionForDisallowedComma),0;case 215:return function(e){var t=16&m_(e);t&&(Wt("("),Vt("0"),Wt(","),Yt());Fe(e.tag,we.parenthesizeLeftSideOfAccess),t&&Wt(")");Ot(e,e.typeArguments),Yt(),Fe(e.template)}(t),0;case 216:return _e=t,Wt("<"),Ae(_e.type),Wt(">"),Fe(_e.expression,we.parenthesizeOperandOfPrefixUnary),0;case 217:return le=et(21,(ue=t).pos,Wt,ue),_e=pr(ue.expression,ue),Fe(ue.expression,void 0),mr(ue.expression,ue),ur(_e),et(22,ue.expression?ue.expression.end:le,Wt,ue),0;case 218:return Er((ue=t).name),at(ue),0;case 219:return Dt(ce=t,ce.modifiers),it(ce,Ge),0;case 220:return et(91,(ce=t).pos,Kt,ce),Yt(),Fe(ce.expression,we.parenthesizeOperandOfPrefixUnary),0;case 221:return et(114,(se=t).pos,Kt,se),Yt(),Fe(se.expression,we.parenthesizeOperandOfPrefixUnary),0;case 222:return et(116,(oe=t).pos,Kt,oe),Yt(),Fe(oe.expression,we.parenthesizeOperandOfPrefixUnary),0;case 223:return et(135,(ie=t).pos,Kt,ie),Yt(),Fe(ie.expression,we.parenthesizeOperandOfPrefixUnary),0;case 224:return function(e){ir(e.operator,Gt),function(e){var t=e.operand;return 224===t.kind&&(40===e.operator&&(40===t.operator||46===t.operator)||41===e.operator&&(41===t.operator||47===t.operator))}(e)&&Yt();Fe(e.operand,we.parenthesizeOperandOfPrefixUnary)}(t),0;case 225:return Fe((ae=t).operand,we.parenthesizeOperandOfPostfixUnary),ir(ae.operator,Gt),0;case 226:return Ce(t);case 227:return oe=vr(se=t,se.condition,se.questionToken),ie=vr(se,se.questionToken,se.whenTrue),ae=vr(se,se.whenTrue,se.colonToken),ne=vr(se,se.colonToken,se.whenFalse),Fe(se.condition,we.parenthesizeConditionOfConditionalExpression),cr(oe,!0),Ae(se.questionToken),cr(ie,!0),Fe(se.whenTrue,we.parenthesizeBranchOfConditionalExpression),ur(oe,ie),cr(ae,!0),Ae(se.colonToken),cr(ne,!0),Fe(se.whenFalse,we.parenthesizeBranchOfConditionalExpression),ur(ae,ne),0;case 228:return Ae((ne=t).head),Bt(ne,ne.templateSpans,262144),0;case 229:return et(127,(re=t).pos,Kt,re),Ae(re.asteriskToken),Pt(re.expression&&rt(re.expression),nt),0;case 230:return et(26,(re=t).pos,Wt,re),Fe(re.expression,we.parenthesizeExpressionForDisallowedComma),0;case 231:return Er((te=t).name),_t(te),0;case 232:return;case 234:return Fe((te=t).expression,void 0),te.type&&(Yt(),Kt("as"),Yt(),Ae(te.type)),0;case 235:return Fe(t.expression,we.parenthesizeLeftSideOfAccess),Gt("!"),0;case 233:return Xe(t),0;case 238:return Fe((ee=t).expression,void 0),ee.type&&(Yt(),Kt("satisfies"),Yt(),Ae(ee.type)),0;case 236:return nr((ee=t).keywordToken,ee.pos,Wt),Wt("."),Ae(ee.name),0;case 237:return rA.fail("SyntheticExpression should never be printed.");case 282:return;case 284:return Ae(($=t).openingElement),Bt($,$.children,262144),Ae($.closingElement),0;case 285:return $=t,Wt("<"),ft($.tagName),Ot($,$.typeArguments),Yt(),Ae($.attributes),Wt("/>"),0;case 288:return Ae((Z=t).openingFragment),Bt(Z,Z.children,262144),Ae(Z.closingFragment),0;case 358:return rA.fail("SyntaxList should not be printed");case 359:return;case 360:return function(e){var t=p_(e);1024&t||e.pos===e.expression.pos||on(e.expression.pos);Fe(e.expression),2048&t||e.end===e.expression.end||nn(e.expression.end)}(t),0;case 361:return Jt(Z=t,Z.elements,528,void 0),0;case 362:return rA.fail("SyntheticReferenceExpression should not be printed")}return zl(t.kind)?(ar(t,Kt),0):ws(t.kind)?(ar(t,Wt),0):void rA.fail("Unhandled SyntaxKind: ".concat(rA.formatSyntaxKind(t.kind),"."))}function ze(e,t){var r=Re(1,e,t);rA.assertIsDefined(k),t=k,k=void 0,r(e,t)}function Ue(e){var t,r,n=!1,a=313===e.kind?e:void 0;if(!a||0!==O){for(var i=a?a.prepends.length:0,o=a?a.sourceFiles.length+i:1,s=0;s'),Te&&Te.sections.push({pos:g,end:ge.getTextPos(),kind:"no-default-lib"}),er()),me&&me.moduleName&&(Qt('/// ')),er()),me&&me.amdDependencies)try{for(var d=__values(me.amdDependencies),f=d.next();!f.done;f=d.next()){var p=f.value;p.name?Qt('/// ')):Qt('/// ')),er()}}catch(e){a={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(a)throw a.error}}try{for(var m=__values(t),y=m.next();!y.done;y=m.next()){var v=y.value,g=ge.getTextPos();Qt('/// ')),Te&&Te.sections.push({pos:g,end:ge.getTextPos(),kind:"reference",data:v.fileName}),er()}}catch(e){o={error:e}}finally{try{y&&!y.done&&(s=m.return)&&s.call(m)}finally{if(o)throw o.error}}try{for(var h=__values(r),x=h.next();!x.done;x=h.next()){var v=x.value,g=ge.getTextPos(),b=v.resolutionMode&&v.resolutionMode!==(null==me?void 0:me.impliedNodeFormat)?'resolution-mode="'.concat(99===v.resolutionMode?"import":"require",'"'):"";Qt('/// ")),Te&&Te.sections.push({pos:g,end:ge.getTextPos(),kind:v.resolutionMode?99===v.resolutionMode?"type-import":"type-require":"type",data:v.fileName}),er()}}catch(e){c={error:e}}finally{try{x&&!x.done&&(u=h.return)&&u.call(h)}finally{if(c)throw c.error}}try{for(var k=__values(n),T=k.next();!T.done;T=k.next()){v=T.value,g=ge.getTextPos();Qt('/// ')),Te&&Te.sections.push({pos:g,end:ge.getTextPos(),kind:"lib",data:v.fileName}),er()}}catch(e){_={error:e}}finally{try{T&&!T.done&&(l=k.return)&&l.call(k)}finally{if(_)throw _.error}}}function kt(e){var t=e.statements;kr(e),KN(e.statements,Dr),Ue(e);var r,n=ZN(t,function(e){return!J_(e)});(r=e).isDeclarationFile&&bt(r.hasNoDefaultLib,r.referencedFiles,r.typeReferenceDirectives,r.libReferenceDirectives),Bt(e,t,1,void 0,-1===n?t.length:n),Tr(e)}function Tt(e,t,r,n){for(var a=!!t,i=0;i=r.length||0===o;if(s&&32768&n)return null!=A&&A(r),void(null!=E&&E(r));15360&n&&(Wt(pU[15360&n][0]),s&&r&&on(r.pos,!0)),null!=A&&A(r),s?!(1&n)||be&&(!t||me&&wf(t,me))?256&n&&!(524288&n)&&Yt():er():Ut(e,t,r,n,a,i,o,r.hasTrailingComma,r),null!=E&&E(r),15360&n&&(s&&r&&nn(r.end),Wt(pU[15360&n][1]))}}function Ut(e,t,r,n,a,i,o,s,c){var u=0==(262144&n),_=u,l=_r(t,r[i],n);l?(er(l),_=!1):256&n&&Yt(),128&n&&tr();for(var d,f,p=(l=a,1===e.length?WU:"object"==typeof l?HU:KU),m=!1,y=0;y"],e[8192]=["[","]"],pU=e,mU={hasGlobalName:ue,getReferencedExportContainer:ue,getReferencedImportDeclaration:ue,getReferencedDeclarationWithCollidingName:ue,isDeclarationWithCollidingName:ue,isValueAliasDeclaration:ue,isReferencedAliasDeclaration:ue,isTopLevelValueImportEqualsWithEntityName:ue,getNodeCheckFlags:ue,isDeclarationVisible:ue,isLateBound:function(e){return!1},collectLinkedAliases:ue,isImplementationOfOverload:ue,isRequiredInitializedParameter:ue,isOptionalUninitializedParameterProperty:ue,isExpandoFunctionDeclaration:ue,getPropertiesOfContainerFunction:ue,createTypeOfDeclaration:ue,createReturnTypeOfSignatureDeclaration:ue,createTypeOfExpression:ue,createLiteralConstValue:ue,isSymbolAccessible:ue,isEntityNameVisible:ue,getConstantValue:ue,getReferencedValueDeclaration:ue,getReferencedValueDeclarations:ue,getTypeReferenceSerializationKind:ue,isOptionalParameter:ue,moduleExportsSomeValue:ue,isArgumentsLocalBinding:ue,getExternalModuleFileFromDeclaration:ue,getTypeReferenceDirectivesForEntityName:ue,getTypeReferenceDirectivesForSymbol:ue,isLiteralConstDeclaration:ue,getJsxFactoryEntity:ue,getJsxFragmentFactoryEntity:ue,getAllAccessorDeclarations:ue,getSymbolOfExternalModuleSpecifier:ue,isBindingCapturedByNode:ue,getDeclarationStatementsForSourceFile:ue,isImportRequiredByAugmentation:ue},yU=va(function(){return qU({})}),vU=va(function(){return qU({removeComments:!0})}),gU=va(function(){return qU({removeComments:!0,neverAsciiEscape:!0})}),hU=va(function(){return qU({removeComments:!0,omitTrailingSemicolon:!0})})}});function YU(u,_,l){if(u.getDirectories&&u.readDirectory){var n=new Map,i=KD(l);return{useCaseSensitiveFileNames:l,fileExists:function(e){var t=o(d(e));return t&&s(t.sortedAndCanonicalizedFiles,i(f(e)))||u.fileExists(e)},readFile:function(e,t){return u.readFile(e,t)},directoryExists:u.directoryExists&&function(e){var t=d(e);return n.has(Ua(t))||u.directoryExists(e)},getDirectories:function(e){var t=d(e),t=p(e,t);if(t)return t.directories.slice();return u.getDirectories(e)},readDirectory:function(e,t,r,n,a){var i,o=d(e),s=p(e,o);return void 0===s?u.readDirectory(e,t,r,n,a):rm(e,t,r,n,l,_,a,function(e){var t=d(e);if(t===o)return s||c(e,t);var r=p(e,t);return void 0!==r?r||c(e,t):Du},m);function c(e,t){if(i&&t===o)return i;e={files:iD(u.readDirectory(e,void 0,void 0,["*.*"]),f)||WN,directories:u.getDirectories(e)||WN};return t===o&&(i=e),e}},createDirectory:u.createDirectory&&function(e){var t=o(d(e));{var r,n;t&&(r=f(e),n=i(r),Q(t.sortedAndCanonicalizedDirectories,n,ge)&&t.directories.push(r))}u.createDirectory(e)},writeFile:u.writeFile&&function(e,t,r){var n=o(d(e));n&&c(n,f(e),!0);return u.writeFile(e,t,r)},addOrDeleteFileOrDirectory:function(e,t){if(void 0!==a(t))return void y();var r=o(t);if(!r)return;if(!u.directoryExists)return void y();e=f(e),t={fileExists:u.fileExists(t),directoryExists:u.directoryExists(t)};t.directoryExists||s(r.sortedAndCanonicalizedDirectories,i(e))?y():c(r,e,t.fileExists);return t},addOrDeleteFile:function(e,t,r){if(1===r)return;t=o(t);t&&c(t,f(e),0===r)},clearCache:y,realpath:u.realpath&&m}}function d(e){return Ja(e,_,i)}function a(e){return n.get(Ua(e))}function o(e){e=a(lA(e));return e&&(e.sortedAndCanonicalizedFiles||(e.sortedAndCanonicalizedFiles=e.files.map(i).sort(),e.sortedAndCanonicalizedDirectories=e.directories.map(i).sort()),e)}function f(e){return Ea(pi(e))}function p(e,t){var r=a(t=Ua(t));if(r)return r;try{return function(e,t){if(!u.realpath||Ua(d(u.realpath(e)))===t){var r={files:iD(u.readDirectory(e,void 0,void 0,["*.*"]),f)||[],directories:u.getDirectories(e)||[]};return n.set(Ua(t),r),r}if(null!=(r=u.directoryExists)&&r.call(u,e))return n.set(t,!1),!1}(e,t)}catch(e){return void rA.assert(!n.has(Ua(t)))}}function s(e,t){return 0<=AD(e,t,ir,ge)}function m(e){return u.realpath?u.realpath(e):e}function c(e,t,r){var n=e.sortedAndCanonicalizedFiles,a=i(t);r?Q(n,a,ge)&&e.files.push(t):0<=(t=AD(n,a,ir,ge))&&(n.splice(t,1),t=e.files.findIndex(function(e){return i(e)===a}),e.files.splice(t,1))}function y(){n.clear()}}function ZU(n,e,a,i,t){var r=ie((null==(e=null==e?void 0:e.configFile)?void 0:e.extendedSourceFiles)||WN,t);a.forEach(function(e,t){r.has(t)||(e.projects.delete(n),e.close())}),r.forEach(function(e,t){var r=a.get(t);r?r.projects.add(n):a.set(t,{projects:new Set([n]),watcher:i(e,t),close:function(){var e=a.get(t);e&&0===e.projects.size&&(e.watcher.close(),a.delete(t))}})})}function $U(t,e){e.forEach(function(e){e.projects.delete(t)&&e.close()})}function eV(r,n,a){r.delete(n)&&r.forEach(function(e,t){null!=(e=e.extendedResult.extendedSourceFiles)&&e.some(function(e){return a(e)===n})&&eV(r,t,a)})}function tV(e,t,r){Kf(t,new Map(e),{createNewValue:r,onDeleteValue:zf})}function rV(e,t,r){Kf(t,ie(e.getMissingFilePaths(),ir,ya),{createNewValue:r,onDeleteValue:zf})}function nV(n,e,r){function a(e,t){return{watcher:r(e,t),flags:t}}Kf(n,e,{createNewValue:a,onDeleteValue:cV,onExistingValue:function(e,t,r){if(e.flags===t)return;e.watcher.close(),n.set(r,a(r,t))}})}function aV(e){var t=e.watchedDirPath,r=e.fileOrDirectory,n=e.fileOrDirectoryPath,a=e.configFileName,i=e.options,o=e.program,s=e.extraFileExtensions,c=e.currentDirectory,u=e.useCaseSensitiveFileNames,_=e.writeLog,l=e.toPath,e=cW(n);if(!e)return _("Project: ".concat(a," Detected ignored path: ").concat(r)),!0;if((n=e)===t)return!1;if(cA(n)&&!lm(r,i,s))return _("Project: ".concat(a," Detected file add/remove of non supported extension: ").concat(r)),!0;if(zT(r,i.configFile.configFileSpecs,fA(lA(a),c),u,c))return _("Project: ".concat(a," Detected excluded file: ").concat(r)),!0;if(!o)return!1;if(GO(i)||i.outDir)return!1;if(QB(n)){if(i.declarationDir)return!1}else if(!_A(n,xu))return!1;var n=pm(n),d=RD(o)?void 0:o.getState?o.getProgramOrUndefined():o,f=d||RD(o)?void 0:o;return!(!p(n+".ts")&&!p(n+".tsx"))&&(_("Project: ".concat(a," Detected output file: ").concat(r)),!0);function p(t){return d?d.getSourceFileByPath(t):f?f.getState().fileInfos.has(t):QN(o,function(e){return l(e)===t})}}function iV(e,t){return!!e&&e.isEmittedFile(t)}function oV(c,e,l,d){ta(2===e?l:fi);var t={watchFile:function(e,t,r,n){return c.watchFile(e,t,r,n)},watchDirectory:function(e,t,r,n){return c.watchDirectory(e,t,0!=(1&r),n)}},u=0!==e?{watchFile:n("watchFile"),watchDirectory:n("watchDirectory")}:void 0,_=2===e?{watchFile:function(e,t,r,n,a,i){l("FileWatcher:: Added:: ".concat(p(e,r,n,a,i,d)));var o=u.watchFile(e,t,r,n,a,i);return{close:function(){l("FileWatcher:: Close:: ".concat(p(e,r,n,a,i,d))),o.close()}}},watchDirectory:function(r,e,n,a,i,o){var t="DirectoryWatcher:: Added:: ".concat(p(r,n,a,i,o,d));l(t);var s=ht(),c=u.watchDirectory(r,e,n,a,i,o),s=ht()-s;return l("Elapsed:: ".concat(s,"ms ").concat(t)),{close:function(){var e="DirectoryWatcher:: Close:: ".concat(p(r,n,a,i,o,d));l(e);var t=ht();c.close();t=ht()-t;l("Elapsed:: ".concat(t,"ms ").concat(e))}}}}:u||t,f=2===e?function(e,t,r,n,a){return l("ExcludeWatcher:: Added:: ".concat(p(e,t,r,n,a,d))),{close:function(){return l("ExcludeWatcher:: Close:: ".concat(p(e,t,r,n,a,d)))}}}:wW;return{watchFile:r("watchFile"),watchDirectory:r("watchDirectory")};function r(s){return function(e,t,r,n,a,i){var o;return VT(e,"watchFile"===s?null==n?void 0:n.excludeFiles:null==n?void 0:n.excludeDirectories,"boolean"==typeof c.useCaseSensitiveFileNames?c.useCaseSensitiveFileNames:c.useCaseSensitiveFileNames(),(null==(o=c.getCurrentDirectory)?void 0:o.call(c))||"")?f(e,r,n,a,i):_[s].call(void 0,e,t,r,n,a,i)}}function n(_){return function(a,i,o,s,c,u){return t[_].call(void 0,a,function(){for(var e=[],t=0;tu?F_(s,i.elements[u],2===e.kind?mA.File_is_output_from_referenced_project_specified_here:mA.File_is_source_from_referenced_project_specified_here):void 0;case 8:if(!V.types)return;n=Vt("types",e.typeReference),a=mA.File_is_entry_point_of_type_library_specified_here;break;case 6:if(void 0!==e.index){n=Vt("lib",V.lib[e.index]),a=mA.File_is_library_specified_here;break}u=hF(Xb.type,function(e,t){return e===rM(V)?t:void 0});n=u?function(e,t){return zt(e,function(e){return hR(e.initializer)&&e.initializer.text===t?e.initializer:void 0})}("target",u):void 0,a=mA.File_is_default_library_for_target_specified_here;break;default:rA.assertNever(e)}return n&&F_(V.configFile,n,a)}(e))),e===t&&(t=void 0)}}function Rt(e,t,r,n){(R=R||[]).push({kind:1,file:e&&e.path,fileProcessingReason:t,diagnostic:r,args:n})}function jt(e,t,r){F.add(Mt(e,void 0,t,r))}function Bt(t,r,n){for(var a=[],e=3;er&&(F.add(F_.apply(void 0,__spreadArray([V.configFile,e.elements[r],n],__read(a),!1))),i=!1)})}),i&&F.add(ZL.apply(void 0,__spreadArray([n],__read(a),!1)))}function Jt(t,r,n){for(var a=[],e=3;et?F.add(F_.apply(void 0,__spreadArray([e||V.configFile,i.elements[t],r],__read(n),!1))):F.add(ZL.apply(void 0,__spreadArray([r],__read(n),!1)))}function Kt(e,t,r,n){for(var a=[],i=4;ia.length+1?vW(t,o,Math.max(a.length+1,i+1)):{dir:r,dirPath:n,nonRecursive:!0}:yW(t,o,o.length-1,i,e,a)}}function yW(e,t,r,n,a,i){if(-1!==a)return vW(e,t,a+1);for(var o=!0,s=r,c=0;cr)for(a=r;ae.length&&XD(t,e))||!Ta(e)&&t[e.length]!==ca)||void 0})}function re(e){return!!u&&(null==(e=e.affectingLocations)?void 0:e.some(function(e){return u.has(e)}))}function ne(){Wf(r,zf)}function ae(r,n){return e=r,!!A.getCompilationSettings().typeRoots||lW(A.toPath(e))?A.watchTypeRootsDirectory(n,function(e){var t=A.toPath(e);p&&p.addOrDeleteFileOrDirectory(e,t),d=!0,A.onChangedAutomaticTypeDirectiveNames();e=gW(n,r,C,N,f,function(e){return T.has(e)});e&&Y(t,e===t)},1):SW;var e}}var kW,TW,SW,wW,CW,NW=e({"src/compiler/resolutionCache.ts":function(){MK()}});function DW(t,e){var r=t===zn&&kW?kW:{getCurrentDirectory:function(){return t.getCurrentDirectory()},getNewLine:function(){return t.newLine},getCanonicalFileName:KD(t.useCaseSensitiveFileNames)};if(!e)return function(e){return t.write(IV(e,r))};var n=new Array(1);return function(e){n[0]=e,t.write(jV(n,r)+r.getNewLine()),n[0]=void 0}}function AW(e,t,r){return e.clearScreen&&!r.preserveWatchOutput&&!r.extendedDiagnostics&&!r.diagnostics&&eD(TW,t.code)&&(e.clearScreen(),1)}function EW(e){return e.now?e.now().toLocaleTimeString("en-US",{timeZone:"UTC"}).replace(" "," "):(new Date).toLocaleTimeString()}function FW(a,e){return e?function(e,t,r){AW(a,e,r);r="[".concat(LV(EW(a),""),"] ");r+="".concat(BV(e.messageText,a.newLine)).concat(t+t),a.write(r)}:function(e,t,r){var n="";AW(a,e,r)||(n+=t),n+="".concat(EW(a)," - "),n+="".concat(BV(e.messageText,a.newLine)).concat((t=t,eD(TW,e.code)?t+t:t)),a.write(n)}}function PW(e,t,r,n,a,i){var o=a;o.onUnRecoverableConfigFileDiagnostic=function(e){return tH(a,i,e)};n=Hk(e,t,o,r,n);return o.onUnRecoverableConfigFileDiagnostic=void 0,n}function IW(e){return rD(e,function(e){return 1===e.category})}function OW(r){return nD(r,function(e){return 1===e.category}).map(function(e){if(void 0!==e.file)return"".concat(e.file.fileName)}).map(function(t){if(void 0!==t){var e=QN(r,function(e){return void 0!==e.file&&e.file.fileName===t});if(void 0!==e){e=gA(e.file,e.start).line;return{fileName:t,line:e+1}}}})}function LW(e){return 1===e?mA.Found_1_error_Watching_for_file_changes:mA.Found_0_errors_Watching_for_file_changes}function MW(e,t){var r=LV(":"+e.line,"");return Sa(e.fileName)&&Sa(t)?Ya(t,e.fileName,!1)+r:e.fileName+r}function RW(e,t,r,n){if(0===e)return"";var a=t.filter(function(e){return void 0!==e}),i=a.map(function(e){return"".concat(e.fileName,":").concat(e.line)}).filter(function(e,t,r){return r.indexOf(e)===t}),o=a[0]&&MW(a[0],n.getCurrentDirectory()),e=1===e?void 0!==t[0]?[mA.Found_1_error_in_0,o]:[mA.Found_1_error]:0===i.length?[mA.Found_0_errors,e]:1===i.length?[mA.Found_0_errors_in_the_same_file_starting_at_Colon_1,e,o]:[mA.Found_0_errors_in_1_files,e,i.length],e=ZL.apply(void 0,__spreadArray([],__read(e),!1)),n=1OK)return 2;if(46===t.charCodeAt(0))return 3;if(95===t.charCodeAt(0))return 4;if(r){var n=/^@([^/]+)\/([^/]+)$/.exec(t);if(n){r=e(n[1],!1);if(0!==r)return{name:n[1],isScopeName:!0,result:r};var r=e(n[2],!1);return 0!==r?{name:n[2],isScopeName:!1,result:r}:0}}if(encodeURIComponent(t)!==t)return 5;return 0}(e,!0)}function VK(e,t){return"object"==typeof e?qK(t,e.result,e.name,e.isScopeName):qK(t,e,t,!1)}function qK(e,t,r,n){var a=n?"Scope":"Package";switch(t){case 1:return"'".concat(e,"':: ").concat(a," name '").concat(r,"' cannot be empty");case 2:return"'".concat(e,"':: ").concat(a," name '").concat(r,"' should be less than ").concat(OK," characters");case 3:return"'".concat(e,"':: ").concat(a," name '").concat(r,"' cannot start with '.'");case 4:return"'".concat(e,"':: ").concat(a," name '").concat(r,"' cannot start with '_'");case 5:return"'".concat(e,"':: ").concat(a," name '").concat(r,"' contains non URI safe characters");case 0:return rA.fail();default:rA.assertNever(t)}}var WK=e({"src/jsTyping/jsTyping.ts":function(){IG(),EK=(AK=["assert","assert/strict","async_hooks","buffer","child_process","cluster","console","constants","crypto","dgram","diagnostics_channel","dns","dns/promises","domain","events","fs","fs/promises","http","https","http2","inspector","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","stream/promises","string_decoder","timers","timers/promises","tls","trace_events","tty","url","util","util/types","v8","vm","wasi","worker_threads","zlib"]).map(function(e){return"node:".concat(e)}),FK=__spreadArray(__spreadArray([],__read(AK),!1),__read(EK),!1),PK=new Set(FK),IK=function(e){return e[e.Ok=0]="Ok",e[e.EmptyName=1]="EmptyName",e[e.NameTooLong=2]="NameTooLong",e[e.NameStartsWithDot=3]="NameStartsWithDot",e[e.NameStartsWithUnderscore=4]="NameStartsWithUnderscore",e[e.NameContainsNonURISafeCharacters=5]="NameContainsNonURISafeCharacters",e}(IK||{}),OK=214}}),HK={};t(HK,{NameValidationResult:function(){return IK},discoverTypings:function(){return zK},isTypingUpToDate:function(){return RK},loadSafeList:function(){return BK},loadTypesMap:function(){return JK},nodeCoreModuleList:function(){return FK},nodeCoreModules:function(){return PK},nonRelativeModuleNameForTypingCache:function(){return jK},prefixedNodeCoreModuleList:function(){return EK},renderPackageNameValidationFailure:function(){return VK},validatePackageName:function(){return UK}});var KK,GK,XK,QK,YK,ZK,$K,eG,tG,rG=e({"src/jsTyping/_namespaces/ts.JsTyping.ts":function(){WK()}});function nG(e){return 0<=zn.args.indexOf(e)}function aG(e){e=zn.args.indexOf(e);return 0<=e&&e=r.end}function DX(e,t,r){return e.pos<=t&&e.end>=r}function AX(e,t,r){return FX(e.pos,e.end,t,r)}function EX(e,t,r,n){return FX(e.getStart(t),e.end,r,n)}function FX(e,t,r,n){return Math.max(e,r)r.getStart(e)&&tn.end||e.pos===n.end;return t&&gQ(e,a)?r(e):void 0})}(e)}function tQ(o,s,c,u){var e=function e(t){if(rQ(t)&&1!==t.kind)return t;var r=t.getChildren(s);var n=B(r,o,function(e,t){return t},function(e,t){return o=r[e-1].end?0:1:-1});if(0<=n&&r[n]){var a=r[n];if(or.getStart(e)}function uQ(e,t){t=QX(e,t);return!!qv(t)||(!(19!==t.kind||!dh(t.parent)||!Xj(t.parent.parent))||!(30!==t.kind||!YE(t.parent)||!Xj(t.parent.parent)))}function _Q(t,r){return function(e){for(;e;)if(285<=e.kind&&e.kind<=294||12===e.kind||30===e.kind||32===e.kind||80===e.kind||20===e.kind||19===e.kind||44===e.kind)e=e.parent;else{if(284!==e.kind)return!1;if(r>e.getStart(t))return!0;e=e.parent}return!1}(QX(t,r))}function lQ(e,t,r){var n=vA(e.kind),a=vA(t),i=e.getFullStart(),a=r.text.lastIndexOf(a,i);if(-1!==a){if(r.text.lastIndexOf(n,i-1)=t})}function mQ(e,t){if(-1!==t.text.lastIndexOf("<",e?e.pos:t.text.length))for(var r=e,n=0,a=0;r;){switch(r.kind){case 30:if((r=tQ(r.getFullStart(),t))&&29===r.kind&&(r=tQ(r.getFullStart(),t)),!r||!xR(r))return;if(!n)return uO(r)?void 0:{called:r,nTypeArguments:a};n--;break;case 50:n=3;break;case 49:n=2;break;case 32:n++;break;case 20:if(!(r=lQ(r,19,t)))return;break;case 22:if(!(r=lQ(r,21,t)))return;break;case 24:if(!(r=lQ(r,23,t)))return;break;case 28:a++;break;case 39:case 80:case 11:case 9:case 10:case 112:case 97:case 114:case 96:case 143:case 25:case 52:case 58:case 59:break;default:if(FE(r))break;return}r=tQ(r.getFullStart(),t)}}function yQ(e,t,r){return upe.getRangeOfEnclosingComment(e,t,void 0,r)}function vQ(e,t){return!!FA(QX(e,t),kh)}function gQ(e,t){return 1===e.kind?e.jsDoc:0!==e.getWidth(t)}function hQ(e,t){void 0===t&&(t=0);var r=[],t=GE(e)?Oo(e)&~t:0;return 8&t&&r.push("private"),16&t&&r.push("protected"),4&t&&r.push("public"),(32&t||PR(e))&&r.push("static"),256&t&&r.push("abstract"),1&t&&r.push("export"),8192&t&&r.push("deprecated"),33554432&e.flags&&r.push("declare"),277===e.kind&&r.push("export"),0"===e[n]&&r--,n++,!r)return n;return 0}(e.text),i=PF(e.name)+e.text.slice(0,n),t=function(e){var t=0;if(124!==e.charCodeAt(t++))return e;for(;ti)break;yo(e,o)&&a.push(o),n++}return a}function KZ(e){var t=e.startPosition,e=e.endPosition;return wo(t,void 0===e?t:e)}function GZ(t,r){return FA(QX(t,r.start),function(e){return e.getStart(t)TA(r)?"quit":jE(e)&&yY(r,IQ(e,t))})}function XZ(e,t,r){return void 0===r&&(r=ir),e?RD(e)?r(iD(e,t)):t(e,0):void 0}function QZ(e){return RD(e)?SD(e):e}function YZ(e,t){if($Z(e)){var r=e$(e);if(r)return r;r=Roe.moduleSymbolToValidIdentifier(t$(e),t,!1),t=Roe.moduleSymbolToValidIdentifier(t$(e),t,!0);return r===t?r:[r,t]}return e.name}function ZZ(e,t,r){return $Z(e)?e$(e)||Roe.moduleSymbolToValidIdentifier(t$(e),t,!!r):e.name}function $Z(e){return!(33554432&e.flags||"export="!==e.escapedName&&"default"!==e.escapedName)}function e$(e){return GN(e.declarations,function(e){var t;return qj(e)?null==(t=BD(RB(e.expression),xR))?void 0:t.text:Kj(e)&&2097152===e.symbol.flags?null==(t=BD(e.propertyName,xR))?void 0:t.text:null==(e=BD(JA(e),xR))?void 0:e.text})}function t$(e){return rA.checkDefined(e.parent,"Symbol parent was undefined. Flags: ".concat(rA.formatSymbolFlags(e.flags),". Declarations: ").concat(null==(e=e.declarations)?void 0:e.map(function(e){var t=rA.formatSyntaxKind(e.kind),r=cI(e),e=e.expression;return(r?"[JS]":"")+t+(e?" (expression: ".concat(rA.formatSyntaxKind(e.kind),")"):"")}).join(", "),"."))}function r$(e,t,r){var n=t.length;if(n+r>e.length)return!1;for(var a=0;a=e.length&&(void 0!==(y=function(e,t,r){switch(t){case 11:if(!e.isUnterminated())return;for(var n=e.getTokenText(),a=n.length-1,i=0;92===n.charCodeAt(a-i);)i++;return 0==(1&i)?void 0:34===n.charCodeAt(0)?3:2;case 3:return e.isUnterminated()?1:void 0;default:if(As(t)){if(!e.isUnterminated())return;switch(t){case 18:return 5;case 15:return 4;default:return rA.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #"+t)}}return 16===r?6:void 0}}(v,n,CD(i)))&&(f=y))}while(1!==n);return{endOfLineState:f,spans:p}}return{getClassificationsForLine:function(e,t,r){return function(e,t){for(var r=[],n=e.spans,a=0,i=0;i])*)(\/>)?)?/im.exec(n);if(!n)return!1;if(!(n[3]&&n[3]in Dn))return!1;var a=e;m(a,n[1].length),p(a+=n[1].length,n[2].length,10),p(a+=n[2].length,n[3].length,21),a+=n[3].length;var i=n[4],o=a;for(;;){var s=r.exec(i);if(!s)break;var c=a+s.index+s[1].length;oo&&m(o,a-o);n[5]&&(p(a,n[5].length,10),a+=n[5].length);t=e+t;a=i.end;c--)if(!ji(t.text.charCodeAt(c))){s=!1;break}if(s){n.push({fileName:t.fileName,textSpan:wo(i.getStart(),o.end),kind:"reference"}),a++;continue}}n.push(u(r[a],t))}return n}(e.parent,n):void 0;case 107:return a(e.parent,Kg,p);case 111:return a(e.parent,Yg,f);case 113:case 85:case 98:return a((85===e.kind?e.parent:e).parent,Zg,d);case 109:return a(e.parent,Xg,l);case 84:case 90:return ph(e.parent)||fh(e.parent)?a(e.parent.parent.parent,Xg,l):void 0;case 83:case 88:return a(e.parent,hs,c);case 99:case 117:case 92:return a(e.parent,function(e){return JE(e,!0)},s);case 137:return t(IR,[137]);case 139:case 153:return t(DE,[139,153]);case 135:return a(e.parent,fj,m);case 134:return i(m(e));case 127:return i(function(e){e=PP(e);if(!e)return;var t=[];return HB(e,function(e){y(e,function(e){Og(e)&&_(t,e.getFirstToken(),127)})}),t}(e));case 103:return;default:return js(e.kind)&&(GE(e.parent)||Tj(e.parent))?i(function(t,e){return uD(function(e,t){var r=e.parent;switch(r.kind){case 268:case 312:case 241:case 296:case 297:return 256&t&&Pj(e)?__spreadArray(__spreadArray([],__read(e.members),!1),[e],!1):r.statements;case 176:case 174:case 262:return __spreadArray(__spreadArray([],__read(r.parameters),!1),__read(NE(r.parent)?r.parent.members:[]),!1);case 263:case 231:case 264:case 187:var n=r.members;if(92&t){var a=QN(r.members,IR);if(a)return __spreadArray(__spreadArray([],__read(n),!1),__read(a.parameters),!1)}else if(256&t)return __spreadArray(__spreadArray([],__read(n),!1),[r],!1);return n;case 210:return;default:rA.assertNever(r,"Invalid container kind.")}}(e,kL(t)),function(e){return fY(e,t)})}(e.kind,e.parent)):void 0}function t(t,r){return a(e.parent,t,function(e){return uD(null==(e=BD(e,HE))?void 0:e.symbol.declarations,function(e){return t(e)?QN(e.getChildren(n),function(e){return eD(r,e.kind)}):void 0})})}function a(e,t,r){return t(e)?i(r(e,n)):void 0}function i(e){return e&&e.map(function(e){return u(e,n)})}}(e,t);return e&&[{fileName:t.fileName,highlightSpans:e}]}(i,r)}}});function B$(e){return!!e.sourceFile}function J$(e,t){return z$(e,t)}function z$(e,o,g){void 0===o&&(o="");var h=new Map,s=KD(!!e);function x(e){return"function"==typeof e.getCompilationSettings?e.getCompilationSettings():e}function c(e,t,r,n,a,i,o,s){return _(e,t,r,n,a,i,!0,o,s)}function u(e,t,r,n,a,i,o,s){return _(e,t,x(r),n,a,i,!1,o,s)}function b(e,t){e=B$(e)?e:e.get(rA.checkDefined(t,"If there are more than one scriptKind's for same document the scriptKind should be provided"));return rA.assert(void 0===t||!e||e.sourceFile.scriptKind===t,"Script kind should match provided ScriptKind:".concat(t," and sourceFile.scriptKind: ").concat(null==e?void 0:e.sourceFile.scriptKind,", !entry: ").concat(!e)),e}function _(e,r,t,n,a,i,o,s,c){s=nm(e,s);var u=x(t),_=t===u?void 0:t,l=6===s?100:rM(u),_="object"==typeof c?c:{languageVersion:l,impliedNodeFormat:_&&oq(r,null==(c=null==(t=null==(c=null==(t=_.getCompilerHost)?void 0:t.call(_))?void 0:c.getModuleResolutionCache)?void 0:t.call(c))?void 0:c.getPackageJsonInfoCache(),_,u),setExternalModuleIndicator:Np(u)};_.languageVersion=l;var l=h.size,d=V$(n,_.impliedNodeFormat),f=_D(h,d,function(){return new Map});iA&&(h.size>l&&iA.instant(iA.Phase.Session,"createdDocumentRegistryBucket",{configFilePath:u.configFilePath,key:d}),(u=!QB(r)&&hF(h,function(e,t){return t!==d&&e.has(r)&&t}))&&iA.instant(iA.Phase.Session,"documentRegistryBucketOverlap",{path:r,key1:u,key2:d}));var p,m=f.get(r),y=m&&b(m,s);return!y&&g&&(p=g.getDocument(d,r))&&(rA.assert(o),y={sourceFile:p,languageServiceRefCount:0},v()),y?(y.sourceFile.version!==i&&(y.sourceFile=b8(y.sourceFile,a,i,a.getChangeRange(y.sourceFile.scriptSnapshot)),g&&g.setDocument(d,r,y.sourceFile)),o&&y.languageServiceRefCount++):(p=x8(e,a,_,i,!1,s),g&&g.setDocument(d,r,p),y={sourceFile:p,languageServiceRefCount:1},v()),rA.assert(0!==y.languageServiceRefCount),y.sourceFile;function v(){var e;m?B$(m)?((e=new Map).set(m.sourceFile.scriptKind,m),e.set(s,y),f.set(r,e)):m.set(s,y):f.set(r,y)}}function a(e,t,r,n){var a=rA.checkDefined(h.get(V$(t,n))),t=a.get(e),n=b(t,r);n.languageServiceRefCount--,rA.assert(0<=n.languageServiceRefCount),0===n.languageServiceRefCount&&(B$(t)?a.delete(e):(t.delete(r),1===t.size&&a.set(e,tr(t.values(),ir))))}return{acquireDocument:function(e,t,r,n,a,i){return c(e,Ja(e,o,s),t,U$(x(t)),r,n,a,i)},acquireDocumentWithKey:c,updateDocument:function(e,t,r,n,a,i){return u(e,Ja(e,o,s),t,U$(x(t)),r,n,a,i)},updateDocumentWithKey:u,releaseDocument:function(e,t,r,n){return a(Ja(e,o,s),U$(t),r,n)},releaseDocumentWithKey:a,getKeyForCompilationSettings:U$,getDocumentRegistryBucketKeyWithMode:V$,reportStats:function(){var e=PD(h.keys()).filter(function(e){return e&&"_"===e.charAt(0)}).map(function(e){var t=h.get(e),n=[];return t.forEach(function(e,r){B$(e)?n.push({name:r,scriptKind:e.sourceFile.scriptKind,refCount:e.languageServiceRefCount}):e.forEach(function(e,t){return n.push({name:r,scriptKind:t,refCount:e.languageServiceRefCount})})}),n.sort(function(e,t){return t.refCount-e.refCount}),{bucket:e,sourceFiles:n}});return JSON.stringify(e,void 0,2)},getBuckets:function(){return h}}}function U$(e){return SS(e,nk)}function V$(e,t){return t?"".concat(e,"|").concat(t):e}var q$=e({"src/services/documentRegistry.ts":function(){fpe()}});function W$(f,p,m,y,e,t,r){var v=gd(y),g=KD(v),h=H$(p,m,g,r),x=H$(m,p,g,r);return ode.ChangeTracker.with({host:y,formatContext:e,preferences:t},function(e){function n(e){var t,r,n=rj(e.initializer)?e.initializer.elements:[e.initializer],a=!1;try{for(var i=__values(n),o=i.next();!o.done;o=i.next())a=s(o.value)||a}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return a}function s(e){if(!hR(e))return!1;var t=K$(l,e.text),t=r(t);return void 0!==t&&(i.replaceRangeWithText(d,X$(e,d),a(t)),!0)}function a(e){return Ya(l,e,!_)}var t,i,r,o,c,u,_,l,d;t=f,i=e,r=h,o=p,c=m,u=y.getCurrentDirectory(),_=v,(d=t.getCompilerOptions().configFile)&&(l=lA(d.fileName),(t=$_(d))&&Q$(t,function(e,t){switch(t){case"files":case"include":case"exclude":if(n(e)||"include"!==t||!rj(e.initializer))return;var r=uD(e.initializer.elements,function(e){return hR(e)?e.text:void 0});if(0===r.length)return;r=em(l,[],r,_,u);return void(tm(rA.checkDefined(r.includeFilePattern),_).test(o)&&!tm(rA.checkDefined(r.includeFilePattern),_).test(c)&&i.insertNodeAfter(d,ND(e.initializer.elements),uR.createStringLiteral(a(c))));case"compilerOptions":return void Q$(e.initializer,function(e,t){var r=zk(t);rA.assert("listOrElement"!==(null==r?void 0:r.type)),r&&(r.isFilePath||"list"===r.type&&r.element.isFilePath)?n(e):"paths"===t&&Q$(e.initializer,function(e){var t,r;if(rj(e.initializer))try{for(var n=__values(e.initializer.elements),a=n.next();!a.done;a=n.next())s(a.value)}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}})})}})),function(c,u,_,l,d,f){function e(r){var e=_(r.fileName),n=null!=e?e:r.fileName,t=lA(n),a=l(r.fileName),i=a||r.fileName,o=lA(i),s=void 0!==e||void 0!==a;!function(e,t,r,n){var a,i,o,s;try{for(var c=__values(e.referencedFiles||WN),u=c.next();!u.done;u=c.next()){var _=u.value;void 0!==(f=r(_.fileName))&&f!==e.text.slice(_.pos,_.end)&&t.replaceRangeWithText(e,_,f)}}catch(e){a={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(a)throw a.error}}try{for(var l=__values(e.imports),d=l.next();!d.done;d=l.next()){var f,p=d.value;void 0!==(f=n(p))&&f!==p.text&&t.replaceRangeWithText(e,X$(p,e),f)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(s=l.return)&&s.call(l)}finally{if(o)throw o.error}}}(r,u,function(e){if(sA(e)){e=K$(o,e),e=_(e);return void 0===e?void 0:Va(Ya(t,e,f))}},function(e){var t=c.getTypeChecker().getSymbolAtLocation(e);if(null==t||!t.declarations||!t.declarations.some(RF)){t=void 0!==a?G$(e,JS(e.text,i,c.getCompilerOptions(),d),_,p):function(e,t,r,n,a,i){{if(e){var o=QN(e.declarations,uB).fileName,s=i(o);return void 0===s?{newFileName:o,updated:!1}:{newFileName:s,updated:!0}}o=VV(r,t),o=a.resolveModuleNameLiterals||!a.resolveModuleNames?null==(s=r.resolvedModules)?void 0:s.get(t.text,o):a.getResolvedModuleWithFailedLookupLocationsFromCache&&a.getResolvedModuleWithFailedLookupLocationsFromCache(t.text,r.fileName,o);return G$(t,o,i,n.getSourceFiles())}}(t,e,r,c,d,_);return void 0!==t&&(t.updated||s&&sA(e.text))?kC.updateModuleSpecifier(c.getCompilerOptions(),r,f(n),t.newFileName,ZQ(c,d),e.text):void 0}})}var t,r,p=c.getSourceFiles();try{for(var n=__values(p),a=n.next();!a.done;a=n.next()){var i=a.value;e(i)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}(f,e,h,x,y,g)})}function H$(e,n,a,i){var o=a(e);return function(e){var t=i&&i.tryGetSourcePosition({fileName:e,pos:0}),r=function(e){if(a(e)===o)return n;e=Wp(e,o,a);return void 0===e?void 0:n+"/"+e}(t?t.fileName:e);return t?void 0===r?void 0:function(e,t,r,n){n=$a(e,t,n);return K$(lA(r),n)}(t.fileName,r,e,a):r}}function K$(e,t){return Va(pi(dA(e,t)))}function G$(e,t,r,n){if(t){if(t.resolvedModule){var a=o(t.resolvedModule.resolvedFileName);if(a)return a}e=KN(t.failedLookupLocations,function(e){var t=r(e);return t&&QN(n,function(e){return e.fileName===t})?i(e):void 0})||sA(e.text)&&KN(t.failedLookupLocations,i);return e||t.resolvedModule&&{newFileName:t.resolvedModule.resolvedFileName,updated:!1}}function i(e){return qD(e,"/package.json")?void 0:o(e)}function o(e){e=r(e);return e&&{newFileName:e,updated:!0}}}function X$(e,t){return gf(e.getStart(t)+1,e.end-1)}function Q$(e,t){var r,n;if(nj(e))try{for(var a=__values(e.properties),i=a.next();!i.done;i=a.next()){var o=i.value;iB(o)&&hR(o.name)&&t(o,o.name.text)}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}var Y$,Z$=e({"src/services/getEditsForFileRename.ts":function(){fpe()}});function $$(e,t){return{kind:e,isCaseSensitive:t}}function e0(e){var r=new Map,n=e.trim().split(".").map(function(e){return{totalTextChunk:d0(e=e.trim()),subWordTextChunks:function(e){for(var t=[],r=0,n=0,a=0;ae.length)return;for(var i=r.length-2,o=e.length-1;0<=i;--i,--o)a=a0(a,n0(e[o],r[i],n));return a}(e,t,n,r)},getMatchForLastSegmentOfPattern:function(e){return n0(e,ND(n),r)},patternContainsDots:1t)&&(e.arguments.length";case 277:return qj(e)&&e.isExportEquals?"export=":"default";case 219:case 262:case 218:case 263:case 231:return 1024&Qd(e)?"default":q1(e);case 176:return"constructor";case 180:return"new()";case 179:return"()";case 181:return"[]";default:return""}}function R1(e){return{text:M1(e.node,e.name),kind:xX(e.node),kindModifiers:V1(e.node),spans:B1(e),nameSpan:e.name&&U1(e.name),childItems:iD(e.children,R1)}}function j1(e){return{text:M1(e.node,e.name),kind:xX(e.node),kindModifiers:V1(e.node),spans:B1(e),childItems:iD(e.children,function(e){return{text:M1(e.node,e.name),kind:xX(e.node),kindModifiers:hQ(e.node),spans:B1(e),childItems:c1,indent:0,bolded:!1,grayed:!1}})||c1,indent:e.indent,bolded:!1,grayed:!1}}function B1(e){var t,r,n=[U1(e.node)];if(e.additionalNodes)try{for(var a=__values(e.additionalNodes),i=a.next();!i.done;i=a.next()){var o=i.value;n.push(U1(o))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return n}function J1(e){return RF(e)?PF(e.name):z1(e)}function z1(e){for(var t=[AO(e.name)];e.body&&267===e.body.kind;)e=e.body,t.push(AO(e.name));return t.join(".")}function U1(e){return 312===e.kind?MQ(e):IQ(e,n1)}function V1(e){return e.parent&&260===e.parent.kind&&(e=e.parent),hQ(e)}function q1(e){var t=e.parent;if(e.name&&0";if(oj(t)){e=function e(t){{if(xR(t))return t.text;if(aj(t)){var r=e(t.expression),t=t.name.text;return void 0===r?t:"".concat(r,".").concat(t)}}}(t.expression);if(void 0!==e){if((e=W1(e)).length>t1)return"".concat(e," callback");t=W1(uD(t.arguments,function(e){return oF(e)?e.getText(n1):void 0}).join(", "));return"".concat(e,"(").concat(t,") callback")}}return""}function W1(e){return(e=e.length>t1?e.substring(0,t1)+"...":e).replace(/\\?(\r?\n|\r|\u2028|\u2029)/g,"")}var H1=e({"src/services/navigationBar.ts":function(){fpe(),u1={5:!0,3:!0,7:!0,9:!0,0:!(c1=[]),1:!(o1=[]),2:!(a1=[]),8:!(t1=150),6:!0,4:!(e1=/\s+/g)}}}),K1={};t(K1,{getNavigationBarItems:function(){return l1},getNavigationTree:function(){return d1}});var G1,X1=e({"src/services/_namespaces/ts.NavigationBar.ts":function(){H1()}});function Q1(e,t){G1.set(e,t)}function Y1(r,n){return PD(w(G1.values(),function(e){var t;return r.cancellationToken&&r.cancellationToken.isCancellationRequested()||null==(t=e.kinds)||!t.some(function(e){return w2(e,r.kind)})?void 0:e.getAvailableActions(r,n)}))}function Z1(e,t,r,n){t=G1.get(t);return t&&t.getEditsForAction(e,r,n)}var $1,e2,t2,r2=e({"src/services/refactorProvider.ts":function(){fpe(),j4(),G1=new Map}});function n2(e,t){void 0===t&&(t=!0);var r=e.file,n=e.program,a=KZ(e),e=QX(r,a.start),i=e.parent&&1&Qd(e.parent)&&t?e.parent:dY(e,r,a);if(!(i&&(uB(i.parent)||Rj(i.parent)&&RF(i.parent.parent))))return{error:vp(mA.Could_not_find_export_statement)};var o=n.getTypeChecker(),s=function(e,t){if(uB(e))return e.symbol;e=e.parent.symbol;if(e.valueDeclaration&&UF(e.valueDeclaration))return t.getMergedSymbol(e);return e}(i.parent,o),n=Qd(i)||(qj(i)&&!i.isExportEquals?1025:0),c=!!(1024&n);if(!(1&n)||!c&&s.exports.has("default"))return{error:vp(mA.This_file_already_has_a_default_export)};function u(e){return xR(e)&&o.getSymbolAtLocation(e)?void 0:{error:vp(mA.Can_only_convert_named_export)}}var _;switch(i.kind){case 262:case 263:case 264:case 266:case 265:case 267:return(_=i).name?u(_.name)||{exportNode:_,exportName:_.name,wasDefault:c,exportingModuleSymbol:s}:void 0;case 243:var l=i;if(!(2&l.declarationList.flags)||1!==l.declarationList.declarations.length)return;var d=SD(l.declarationList.declarations);return d.initializer?(rA.assert(!c,"Can't have a default flag here"),u(d.name)||{exportNode:l,exportName:d.name,wasDefault:c,exportingModuleSymbol:s}):void 0;case 277:return(_=i).isExportEquals?void 0:u(_.expression)||{exportNode:_,exportName:_.expression,wasDefault:c,exportingModuleSymbol:s};default:return}}function a2(e,t,r,n,a){var i,o,s;!function(e,t,r,n){var a=t.wasDefault,i=t.exportNode,o=t.exportName;if(a)qj(i)&&!i.isExportEquals?(a=o2((a=i.expression).text,a.text),r.replaceNode(e,i,uR.createExportDeclaration(void 0,!1,uR.createNamedExports([a])))):r.delete(e,rA.checkDefined(fY(i,90),"Should find a default keyword in modifier list"));else{var s=rA.checkDefined(fY(i,95),"Should find an export keyword in modifier list");switch(i.kind){case 262:case 263:case 264:r.insertNodeAfter(e,s,uR.createToken(90));break;case 243:var c=SD(i.declarationList.declarations);if(!pue.Core.isSymbolReferencedInFile(o,n,e)&&!c.type){r.replaceNode(e,i,uR.createExportDefault(rA.checkDefined(c.initializer,"Initializer was previously known to be present")));break}case 266:case 265:case 267:r.deleteModifier(e,s),r.insertNodeAfter(e,i,uR.createExportDefault(uR.createIdentifier(o.text)));break;default:rA.fail("Unexpected exportNode kind ".concat(i.kind))}}}(e,r,n,t.getTypeChecker()),e=t,i=n,t=a,o=(n=r).wasDefault,s=n.exportName,a=n.exportingModuleSymbol,r=e.getTypeChecker(),n=rA.checkDefined(r.getSymbolAtLocation(s),"Export name should resolve to a symbol"),pue.Core.eachExportReference(e.getSourceFiles(),r,t,n,a,s.text,o,function(e){var t;s!==e&&(t=e.getSourceFile(),o?function(e,t,r,n){var a=t.parent;switch(a.kind){case 211:r.replaceNode(e,t,uR.createIdentifier(n));break;case 276:case 281:var i=a;r.replaceNode(e,i,i2(n,i.name.text));break;case 273:var o=a;rA.assert(o.name===t,"Import clause name should match provided ref");var s,i=i2(n,t.text),c=o.namedBindings;c?274===c.kind?(r.deleteRange(e,{pos:t.getStart(e),end:c.getStart(e)}),s=hR(o.parent.moduleSpecifier)?aY(o.parent.moduleSpecifier,e):1,s=rY(void 0,[i2(n,t.text)],o.parent.moduleSpecifier,s),r.insertNodeAfter(e,o.parent,s)):(r.delete(e,t),r.insertNodeAtEndOfList(e,c.elements,i)):r.replaceNode(e,t,uR.createNamedImports([i]));break;case 205:i=a;r.replaceNode(e,a,uR.createImportTypeNode(i.argument,i.assertions,uR.createIdentifier(n),i.typeArguments,i.isTypeOf));break;default:rA.failBadSyntaxKind(a)}}(t,e,i,s.text):function(e,t,r){var n=t.parent;switch(n.kind){case 211:r.replaceNode(e,t,uR.createIdentifier("default"));break;case 276:var a=uR.createIdentifier(n.name.text);1===n.parent.elements.length?r.replaceNode(e,n.parent,a):(r.delete(e,n),r.insertNodeBefore(e,n.parent,a));break;case 281:r.replaceNode(e,n,o2("default",n.name.text));break;default:rA.assertNever(n,"Unexpected parent kind ".concat(n.kind))}}(t,e,i))})}function i2(e,t){return uR.createImportSpecifier(!1,e===t?void 0:uR.createIdentifier(e),uR.createIdentifier(t))}function o2(e,t){return uR.createExportSpecifier(!1,e===t?void 0:uR.createIdentifier(e),uR.createIdentifier(t))}var s2,c2,u2=e({"src/services/refactors/convertExport.ts":function(){fpe(),j4(),$1="Convert export",e2={name:"Convert default export to named export",description:vp(mA.Convert_default_export_to_named_export),kind:"refactor.rewrite.export.named"},t2={name:"Convert named export to default export",description:vp(mA.Convert_named_export_to_default_export),kind:"refactor.rewrite.export.default"},Q1($1,{kinds:[e2.kind,t2.kind],getAvailableActions:function(e){var t=n2(e,"invoked"===e.triggerReason);if(!t)return WN;if(S2(t))return e.preferences.provideRefactorNotApplicableReason?[{name:$1,description:vp(mA.Convert_default_export_to_named_export),actions:[__assign(__assign({},e2),{notApplicableReason:t.error}),__assign(__assign({},t2),{notApplicableReason:t.error})]}]:WN;t=t.wasDefault?e2:t2;return[{name:$1,description:t.description,actions:[t]}]},getEditsForAction:function(t,e){rA.assert(e===e2.name||e===t2.name,"Unexpected action name");var r=n2(t);return rA.assert(r&&!S2(r),"Expected applicable refactor info"),{edits:ode.ChangeTracker.with(t,function(e){return a2(t.file,t.program,r,e,t.cancellationToken)}),renameFilename:void 0,renameLocation:void 0}}})}});function _2(e,t){void 0===t&&(t=!0);var r=e.file,n=KZ(e),a=QX(r,n.start),a=t?FA(a,Jj):dY(a,r,n);if(!a||!Jj(a))return{error:"Selection is not an import declaration."};n=n.start+n.length,r=eQ(a,a.parent,r);if(!(r&&n>r.getStart())){a=a.importClause;return a?a.namedBindings?274===a.namedBindings.kind?{convertTo:0,import:a.namedBindings}:l2(e.program,a)?{convertTo:1,import:a.namedBindings}:{convertTo:2,import:a.namedBindings}:{error:vp(mA.Could_not_find_namespace_import_or_named_imports)}:{error:vp(mA.Could_not_find_import_clause)}}}function l2(e,t){return uM(e.getCompilerOptions())&&function(e,t){e=t.resolveExternalModuleName(e);if(!e)return!1;t=t.resolveExternalModuleSymbol(e);return e!==t}(t.parent.moduleSpecifier,e.getTypeChecker())}function d2(e,t,r,n){var a=t.getTypeChecker();0===n.convertTo?function(e,r,t,n,a){var i,o,s=!1,c=[],u=new Map;pue.Core.eachSymbolReferenceInFile(n.name,r,e,function(e){var t;ac(e.parent)?(t=f2(e.parent).text,r.resolveName(t,e,67108863,!0)&&u.set(t,!0),rA.assert((aj(t=e.parent)?t.expression:t.left)===e,"Parent expression should match id"),c.push(e.parent)):s=!0});var _=new Map;try{for(var l=__values(c),d=l.next();!d.done;d=l.next()){var f=d.value,p=f2(f).text,m=_.get(p);void 0===m&&_.set(p,m=u.has(p)?lZ(p,e):p),t.replaceNode(e,f,uR.createIdentifier(m))}}catch(e){i={error:e}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}var y=[];_.forEach(function(e,t){y.push(uR.createImportSpecifier(!1,e===t?void 0:uR.createIdentifier(t),uR.createIdentifier(e)))});var v=n.parent.parent;s&&!a?t.insertNodeAfter(e,v,m2(v,void 0,y)):t.replaceNode(e,v,m2(v,s?uR.createIdentifier(n.name.text):void 0,y))}(e,a,r,n.import,uM(t.getCompilerOptions())):p2(e,t,r,n.import,1===n.convertTo)}function f2(e){return aj(e)?e.name:e.right}function p2(a,e,i,t,r){var n,o;void 0===r&&(r=l2(e,t.parent));var s=e.getTypeChecker(),c=t.parent.parent,e=c.moduleSpecifier,u=new Set;t.elements.forEach(function(e){e=s.getSymbolAtLocation(e.name);e&&u.add(e)});var _=e&&hR(e)?Roe.moduleSpecifierToValidIdentifier(e.text,99):"module";var l=t.elements.some(function(e){return!!pue.Core.eachSymbolReferenceInFile(e.name,s,a,function(e){var t=s.resolveName(_,e,67108863,!0);return!!t&&(!u.has(t)||Kj(e.parent))})})?lZ(_,a):_,d=new Set;try{for(var f=__values(t.elements),p=f.next();!p.done;p=f.next())!function(r){var n=(r.propertyName||r.name).text;pue.Core.eachSymbolReferenceInFile(r.name,s,a,function(e){var t=uR.createPropertyAccessExpression(uR.createIdentifier(l),n);oB(e.parent)?i.replaceNode(a,e.parent,uR.createPropertyAssignment(e.text,t)):Kj(e.parent)?d.add(r):i.replaceNode(a,e,t)})}(p.value)}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}i.replaceNode(a,t,r?uR.createIdentifier(l):uR.createNamespaceImport(uR.createIdentifier(l))),d.size&&(r=PD(d.values(),function(e){return uR.createImportSpecifier(e.isTypeOnly,e.propertyName&&uR.createIdentifier(e.propertyName.text),uR.createIdentifier(e.name.text))}),i.insertNodeAfter(a,t.parent.parent,m2(c,void 0,r)))}function m2(e,t,r){return uR.createImportDeclaration(void 0,uR.createImportClause(!1,t,r&&r.length?uR.createNamedImports(r):void 0),e.moduleSpecifier,void 0)}var y2,v2,g2,h2,x2=e({"src/services/refactors/convertImport.ts":function(){var e;fpe(),j4(),s2="Convert import",(e={})[0]={name:"Convert namespace import to named imports",description:vp(mA.Convert_namespace_import_to_named_imports),kind:"refactor.rewrite.import.named"},e[2]={name:"Convert named imports to namespace import",description:vp(mA.Convert_named_imports_to_namespace_import),kind:"refactor.rewrite.import.namespace"},e[1]={name:"Convert named imports to default import",description:vp(mA.Convert_named_imports_to_default_import),kind:"refactor.rewrite.import.default"},Q1(s2,{kinds:q(c2=e).map(function(e){return e.kind}),getAvailableActions:function(e){var t=_2(e,"invoked"===e.triggerReason);if(!t)return WN;if(S2(t))return e.preferences.provideRefactorNotApplicableReason?q(c2).map(function(e){return{name:s2,description:e.description,actions:[__assign(__assign({},e),{notApplicableReason:t.error})]}}):WN;e=c2[t.convertTo];return[{name:s2,description:e.description,actions:[e]}]},getEditsForAction:function(t,r){rA.assert(dD(q(c2),function(e){return e.name===r}),"Unexpected action name");var n=_2(t);return rA.assert(n&&!S2(n),"Expected applicable refactor info"),{edits:ode.ChangeTracker.with(t,function(e){return d2(t.file,t.program,e,n)}),renameFilename:void 0,renameLocation:void 0}}})}});function b2(e,t){void 0===t&&(t=!0);var r=e.file,n=e.startPosition,a=sI(r),i=QX(r,n),o=RQ(KZ(e)),s=o.pos===o.end&&t,c=FA(i,function(e){return e.parent&&FE(e)&&!k2(o,e.parent,r)&&(s||EX(i,r,o.pos,o.end))});if(!c||!FE(c))return{error:vp(mA.Selection_is_not_a_valid_type_node)};n=e.program.getTypeChecker(),t=a,t=FA(e=c,XE)||(t?FA(e,kh):void 0);if(void 0===t)return{error:vp(mA.No_type_could_be_extracted_from_this_type_node)};var _,l,d,f,p,e=(_=n,d=t,f=r,p=[],function e(t){var r,n;if(BR(t)){if(xR(t.typeName)){var a=t.typeName,i=_.resolveName(a.text,a,262144,!0);try{for(var o=__values((null==i?void 0:i.declarations)||WN),s=o.next();!s.done;s=o.next()){var c=s.value;if(wR(c)&&c.getSourceFile()===f){if(c.name.escapedText===a.escapedText&&k2(c,l,f))return!0;if(k2(d,c,f)&&!k2(l,c,f)){hD(p,c);break}}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}}else if(Tg(t)){var u=FA(t,function(e){return kg(e)&&k2(e.extendsType,t,f)});if(!u||!k2(l,u,f))return!0}else if(jR(t)||Sg(t)){var u=FA(t.parent,bE);if(u&&u.type&&k2(u.type,t,f)&&!k2(l,u,f))return!0}else if(UR(t))if(xR(t.exprName)){var i=_.resolveName(t.exprName.text,t.exprName,111551,!1);if(null!=i&&i.valueDeclaration&&k2(d,i.valueDeclaration,f)&&!k2(l,i.valueDeclaration,f))return!0}else if($O(t.exprName.left)&&!k2(l,t.parent,f))return!0;f&&qR(t)&&gA(f,t.pos).line===gA(f,t.end).line&&lR(t,1);return HB(t,e)}(l=c)?void 0:p);return e?{isJS:a,selection:c,enclosingNode:t,typeParameters:e,typeElements:function e(t,r){var n,a;if(!r)return;{if(bg(r)){var i=[],o=new Map;try{for(var s=__values(r.types),c=s.next();!c.done;c=s.next()){var u=c.value,u=e(t,u);if(!u||!u.every(function(e){return e.name&&Zf(o,GQ(e.name))}))return;gD(i,u)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}return i}if(GR(r))return e(t,r.type);if(VR(r))return r.members}return}(n,c)}:{error:vp(mA.No_type_could_be_extracted_from_this_type_node)}}function k2(e,t,r){return DX(e,xA(r.text,t.pos),t.end)}var T2=e({"src/services/refactors/extractType.ts":function(){fpe(),j4(),y2="Extract type",v2={name:"Extract to type alias",description:vp(mA.Extract_to_type_alias),kind:"refactor.extract.type"},g2={name:"Extract to interface",description:vp(mA.Extract_to_interface),kind:"refactor.extract.interface"},h2={name:"Extract to typedef",description:vp(mA.Extract_to_typedef),kind:"refactor.extract.typedef"},Q1(y2,{kinds:[v2.kind,g2.kind,h2.kind],getAvailableActions:function(e){var t=b2(e,"invoked"===e.triggerReason);return t?S2(t)?e.preferences.provideRefactorNotApplicableReason?[{name:y2,description:vp(mA.Extract_type),actions:[__assign(__assign({},h2),{notApplicableReason:t.error}),__assign(__assign({},v2),{notApplicableReason:t.error}),__assign(__assign({},g2),{notApplicableReason:t.error})]}]:WN:[{name:y2,description:vp(mA.Extract_type),actions:t.isJS?[h2]:vD([v2],t.typeElements&&g2)}]:WN},getEditsForAction:function(u,_){var l=u.file,d=b2(u);rA.assert(d&&!S2(d),"Expected to find a range to extract");var f=lZ("NewType",l),e=ode.ChangeTracker.with(u,function(e){switch(_){case v2.name:return rA.assert(!d.isJS,"Invalid actionName/JS combo"),r=e,n=l,a=f,o=(i=d).enclosingNode,s=i.selection,c=i.typeParameters,i=uR.createTypeAliasDeclaration(void 0,a,c.map(function(e){return uR.updateTypeParameterDeclaration(e,e.modifiers,e.name,e.constraint,void 0)}),s),r.insertNodeBefore(n,o,Qy(i),!0),void r.replaceNode(n,s,uR.createTypeReferenceNode(a,c.map(function(e){return uR.createTypeReferenceNode(e.name,void 0)})),{leadingTriviaOption:ode.LeadingTriviaOption.Exclude,trailingTriviaOption:ode.TrailingTriviaOption.ExcludeWhitespace});case h2.name:return rA.assert(d.isJS,"Invalid actionName/JS combo"),function(e,t,r,n,a){var i=a.enclosingNode,o=a.selection,s=a.typeParameters;lR(o,7168);var c=uR.createJSDocTypedefTag(uR.createIdentifier("typedef"),uR.createJSDocTypeExpression(o),uR.createIdentifier(n)),u=[];KN(s,function(e){var t=tE(e),e=uR.createTypeParameterDeclaration(void 0,e.name),e=uR.createJSDocTemplateTag(uR.createIdentifier("template"),t&&JD(t,_B),[e]);u.push(e)}),a=uR.createJSDocComment(void 0,uR.createNodeArray(fD(u,[c]))),kh(i)?(c=i.getStart(r),t=zY(t.host,null==(t=t.formatContext)?void 0:t.options),e.insertNodeAt(r,i.getStart(r),a,{suffix:t+t+r.text.slice($Y(r.text,c-1),c)})):e.insertNodeBefore(r,i,a,!0),e.replaceNode(r,o,uR.createTypeReferenceNode(n,s.map(function(e){return uR.createTypeReferenceNode(e.name,void 0)})))}(e,u,l,f,d);case g2.name:return rA.assert(!d.isJS&&!!d.typeElements,"Invalid actionName/JS combo"),t=e,o=l,i=f,n=(r=d).enclosingNode,s=r.selection,a=r.typeParameters,c=r.typeElements,UB(r=uR.createInterfaceDeclaration(void 0,i,a,void 0,c),null==(c=c[0])?void 0:c.parent),t.insertNodeBefore(o,n,Qy(r),!0),void t.replaceNode(o,s,uR.createTypeReferenceNode(i,a.map(function(e){return uR.createTypeReferenceNode(e.name,void 0)})),{leadingTriviaOption:ode.LeadingTriviaOption.Exclude,trailingTriviaOption:ode.TrailingTriviaOption.ExcludeWhitespace});default:rA.fail("Unexpected action name")}var t,r,n,a,i,o,s,c}),t=l.fileName;return{edits:e,renameFilename:t,renameLocation:dZ(e,t,f,!1)}}})}});function S2(e){return void 0!==e.error}function w2(e,t){return!t||e.substr(0,t.length)===t}var C2,N2,D2,A2=e({"src/services/refactors/helpers.ts":function(){}});function E2(e,t,r,n){var a=n.getTypeChecker(),i=GX(e,t),n=i.parent;if(xR(i)){if(Bf(n)&&SP(n)&&xR(n.name))return 1!==(null==(t=a.getMergedSymbol(n.symbol).declarations)?void 0:t.length)?{error:vp(mA.Variables_with_multiple_declarations_cannot_be_inlined)}:F2(n)?void 0:(o=P2(n,a,e))&&{references:o,declaration:n,replacement:n.initializer};if(r){r=a.resolveName(i.text,i,111551,!1);if(1!==(null==(i=null==(r=r&&a.getMergedSymbol(r))?void 0:r.declarations)?void 0:i.length))return{error:vp(mA.Variables_with_multiple_declarations_cannot_be_inlined)};var o,r=r.declarations[0];return Bf(r)&&SP(r)&&xR(r.name)?F2(r)?void 0:(o=P2(r,a,e))&&{references:o,declaration:r,replacement:r.initializer}:void 0}return{error:vp(mA.Could_not_find_variable_to_inline)}}}function F2(e){return dD(JD(e.parent.parent,Tj).modifiers,og)}function P2(t,e,r){var n=[],r=pue.Core.eachSymbolReferenceInFile(t.name,e,r,function(e){return!!pue.isWriteAccessForReference(e)||(!(!Kj(e.parent)&&!qj(e.parent))||(!!UR(e.parent)||(!!wA(t,e.pos)||void n.push(e))))});return 0===n.length||r?void 0:n}var I2,O2,L2,M2=e({"src/services/refactors/inlineVariable.ts":function(){fpe(),j4(),C2="Inline variable",N2=vp(mA.Inline_variable),Q1(C2,{kinds:[(D2={name:C2,description:N2,kind:"refactor.inline.variable"}).kind],getAvailableActions:function(e){var t=e.file,r=e.program,n=e.preferences,r=E2(t,e.startPosition,"invoked"===e.triggerReason,r);return r?I4.isRefactorErrorInfo(r)?n.provideRefactorNotApplicableReason?[{name:C2,description:N2,actions:[__assign(__assign({},D2),{notApplicableReason:r.error})]}]:WN:[{name:C2,description:N2,actions:[D2]}]:WN},getEditsForAction:function(e,t){rA.assert(t===C2,"Unexpected refactor invoked");var s=e.file,r=e.program,t=e.startPosition,r=E2(s,t,!0,r);if(r&&!I4.isRefactorErrorInfo(r)){var c=r.references,u=r.declaration,_=r.replacement;return{edits:ode.ChangeTracker.with(e,function(e){var t,r,n;try{for(var a=__values(c),i=a.next();!i.done;i=a.next()){var o=i.value;e.replaceNode(s,o,(n=o,o=eZ(o=_),jE(n=n.parent)&&(od(o)r.pos});if(-1!==a){e=x6(t,n[a]);e&&(a=e.start);e=ZN(n,function(e){return e.end>=r.end},a);-1!==e&&r.end<=n[e].getStart()&&e--;t=x6(t,n[e]);return t&&(e=t.end),{toMove:n.slice(a,-1===e?n.length:e+1),afterLast:-1===e?void 0:n[e+1]}}}(e);if(void 0!==e){var n=[],a=[],i=e.toMove,o=e.afterLast;return Ze(i,d6,function(e,t){for(var r=e;r=a.end});return{toMove:e,start:ZN(t.statements,function(e){return e.end>=n.end}),end:r}}}var b6,k6,T6,S6=e({"src/services/refactors/moveToFile.ts":function(){bC(),fpe(),r2(),j2="Move to file",B2=vp(mA.Move_to_file),Q1(j2,{kinds:[(J2={name:"Move to file",description:B2,kind:"refactor.move.file"}).kind],getAvailableActions:function(e,t){var r=l6(e);return t?e.preferences.allowTextChangesInNewFiles&&r?[{name:j2,description:B2,actions:[J2]}]:e.preferences.provideRefactorNotApplicableReason?[{name:j2,description:B2,actions:[__assign(__assign({},J2),{notApplicableReason:vp(mA.Selection_is_not_a_valid_statement_or_statements)})]}]:WN:WN},getEditsForAction:function(_,e,l){rA.assert(e===j2,"Wrong refactor invoked");var d=rA.checkDefined(l6(_)),t=_.host,r=_.program;rA.assert(l,"No interactive refactor arguments available");e=l.targetFile;return sm(e)||cm(e)?t.fileExists(e)&&void 0===r.getSourceFile(e)?U2(vp(mA.Cannot_move_statements_to_the_selected_file)):{edits:ode.ChangeTracker.with(_,function(e){return r=(t=_).file,n=l.targetFile,a=_.program,i=d,o=e,s=_.host,c=_.preferences,u=a.getTypeChecker(),e=f6(r,i.all,u),void(s.fileExists(n)?V2(r,u=rA.checkDefined(a.getSourceFile(n)),e,o,i,a,s,c,Roe.createImportAdder(u,t.program,t.preferences,t.host)):(o.createNewFile(r,n,V2(r,n,e,o,i,a,s,c)),q2(a,o,r.fileName,n,hd(s))));var t,r,n,a,i,o,s,c,u}),renameFilename:void 0,renameLocation:void 0}:U2(vp(mA.Cannot_move_to_file_selected_file_is_invalid))}})}});function w6(e){return D6(e.file,e.startPosition,e.program)?[{name:b6,description:k6,actions:[T6]}]:WN}function C6(e){var t=e.file,r=e.startPosition,n=e.program,a=D6(t,r,n);if(a){var i=n.getTypeChecker(),o=a[a.length-1],s=o;switch(o.kind){case 173:s=uR.updateMethodSignature(o,o.modifiers,o.name,o.questionToken,o.typeParameters,c(a),o.type);break;case 174:s=uR.updateMethodDeclaration(o,o.modifiers,o.asteriskToken,o.name,o.questionToken,o.typeParameters,c(a),o.type,o.body);break;case 179:s=uR.updateCallSignature(o,o.typeParameters,c(a),o.type);break;case 176:s=uR.updateConstructorDeclaration(o,o.modifiers,c(a),o.body);break;case 180:s=uR.updateConstructSignature(o,o.typeParameters,c(a),o.type);break;case 262:s=uR.updateFunctionDeclaration(o,o.modifiers,o.asteriskToken,o.name,o.typeParameters,c(a),o.type,o.body);break;default:return rA.failBadSyntaxKind(o,"Unhandled signature kind in overload list conversion refactoring")}if(s!==o)return{renameFilename:void 0,renameLocation:void 0,edits:ode.ChangeTracker.with(e,function(e){e.replaceNodeRange(t,a[0],a[a.length-1],s)})}}function c(e){var t=e[e.length-1];return TE(t)&&t.body&&(e=e.slice(0,e.length-1)),uR.createNodeArray([uR.createParameterDeclaration(void 0,uR.createToken(26),"args",void 0,uR.createUnionTypeNode(iD(e,u)))])}function u(e){e=iD(e.parameters,_);return lR(uR.createTupleTypeNode(e),dD(e,function(e){return!!HN(My(e))})?0:1)}function _(e){rA.assert(xR(e.name));var t=UB(uR.createNamedTupleMember(e.dotDotDotToken,e.name,e.questionToken,e.type||uR.createKeywordTypeNode(133)),e),e=e.symbol&&e.symbol.getDocumentationComment(i);return!e||(e=y8(e)).length&&fR(t,[{text:"*\n".concat(e.split("\n").map(function(e){return" * ".concat(e)}).join("\n"),"\n "),kind:3,pos:-1,end:-1,hasTrailingNewLine:!0,hasLeadingNewline:!0}]),t}}function N6(e){switch(e.kind){case 173:case 174:case 179:case 176:case 180:case 262:return!0}return!1}function D6(t,e,r){var n=FA(QX(t,e),N6);if(n&&!(TE(n)&&n.body&&wX(n.body,e))){var a=r.getTypeChecker(),e=n.symbol;if(e){r=e.declarations;if(!(HN(r)<=1)&&XN(r,function(e){return CF(e)===t})&&N6(r[0])){var i=r[0].kind;if(XN(r,function(e){return e.kind===i})){n=r;if(!dD(n,function(e){return!!e.typeParameters||dD(e.parameters,function(e){return!!e.modifiers||!xR(e.name)})})){e=uD(n,function(e){return a.getSignatureFromDeclaration(e)});if(HN(e)===HN(r)){var o=a.getReturnTypeOfSignature(e[0]);if(XN(e,function(e){return a.getReturnTypeOfSignature(e)===o}))return n}}}}}}}var A6,E6,F6,P6,I6=e({"src/services/refactors/convertOverloadListToSingleSignature.ts":function(){fpe(),j4(),b6="Convert overload list to single signature",k6=vp(mA.Convert_overload_list_to_single_signature),Q1(b6,{kinds:[(T6={name:b6,description:k6,kind:"refactor.rewrite.function.overloadList"}).kind],getEditsForAction:C6,getAvailableActions:w6})}});function O6(e){var t=M6(e.file,e.startPosition,"invoked"===e.triggerReason);return t?S2(t)?e.preferences.provideRefactorNotApplicableReason?[{name:A6,description:E6,actions:[__assign(__assign({},F6),{notApplicableReason:t.error}),__assign(__assign({},P6),{notApplicableReason:t.error})]}]:WN:[{name:A6,description:E6,actions:[t.addBraces?F6:P6]}]:WN}function L6(e,t){var r=e.file,n=e.startPosition,a=M6(r,n);rA.assert(a&&!S2(a),"Expected applicable refactor info");var i,o=a.expression,n=a.returnStatement,s=a.func;return t===F6.name?(a=uR.createReturnStatement(o),i=uR.createBlock([a],!0),fZ(o,a,r,3,!0)):t===P6.name&&n?(o=o||uR.createVoidZero(),mZ(n,i=vZ(o)?uR.createParenthesizedExpression(o):o,r,3,!1),fZ(n,i,r,3,!1),pZ(n,i,r,3,!1)):rA.fail("invalid action"),{renameFilename:void 0,renameLocation:void 0,edits:ode.ChangeTracker.with(e,function(e){e.replaceNode(r,s.body,i)})}}function M6(e,t,r,n){void 0===r&&(r=!0);e=QX(e,t),t=PP(e);if(!t)return{error:vp(mA.Could_not_find_a_containing_arrow_function)};if(!lj(t))return{error:vp(mA.Containing_function_is_not_an_arrow_function)};if(TX(t,e)&&(!TX(t.body,e)||r)){if(w2(F6.kind,n)&&jE(t.body))return{func:t,addBraces:!0,expression:t.body};if(w2(P6.kind,n)&&kj(t.body)&&1===t.body.statements.length){n=SD(t.body.statements);if(Kg(n))return{func:t,addBraces:!1,expression:n.expression,returnStatement:n}}}}var R6,j6,B6,J6,z6,U6=e({"src/services/refactors/addOrRemoveBracesToArrowFunction.ts":function(){fpe(),j4(),A6="Add or remove braces in an arrow function",E6=vp(mA.Add_or_remove_braces_in_an_arrow_function),F6={name:"Add braces to arrow function",description:vp(mA.Add_braces_to_arrow_function),kind:"refactor.rewrite.arrow.braces.add"},P6={name:"Remove braces from arrow function",description:vp(mA.Remove_braces_from_arrow_function),kind:"refactor.rewrite.arrow.braces.remove"},Q1(A6,{kinds:[P6.kind],getEditsForAction:L6,getAvailableActions:O6})}}),V6={},q6=e({"src/services/_namespaces/ts.refactor.addOrRemoveBracesToArrowFunction.ts":function(){I6(),U6()}});function W6(e){var t=e.file,r=e.startPosition,n=e.program,a=e.kind,i=G6(t,r,n);if(!i)return WN;var o,t=i.selectedVariableDeclaration,r=i.func,n=[],i=[];return w2(J6.kind,a)&&((o=t||lj(r)&&Aj(r.parent)?void 0:vp(mA.Could_not_convert_to_named_function))?i.push(__assign(__assign({},J6),{notApplicableReason:o})):n.push(J6)),w2(B6.kind,a)&&((o=!t&&lj(r)?void 0:vp(mA.Could_not_convert_to_anonymous_function))?i.push(__assign(__assign({},B6),{notApplicableReason:o})):n.push(B6)),w2(z6.kind,a)&&((o=_j(r)?void 0:vp(mA.Could_not_convert_to_arrow_function))?i.push(__assign(__assign({},z6),{notApplicableReason:o})):n.push(z6)),[{name:R6,description:j6,actions:0===n.length&&e.preferences.provideRefactorNotApplicableReason?i:n}]}function H6(e,t){var r=G6(e.file,e.startPosition,e.program);if(r){var n,a,i,o,s=r.func,c=[];switch(t){case B6.name:c.push.apply(c,__spreadArray([],__read((n=s,a=(u=e).file,i=X6(n.body),o=uR.createFunctionExpression(n.modifiers,n.asteriskToken,void 0,n.typeParameters,n.parameters,n.type,i),ode.ChangeTracker.with(u,function(e){return e.replaceNode(a,n,o)}))),!1));break;case J6.name:var u=function(e){var t=e.parent;if(!Aj(t)||!SP(t))return;var r=t.parent,e=r.parent;return Ej(r)&&Tj(e)&&xR(t.name)?{variableDeclaration:t,variableDeclarationList:r,statement:e,name:t.name}:void 0}(s);if(!u)return;c.push.apply(c,__spreadArray([],__read(function(e,t,r){var n=e.file,a=X6(t.body),i=r.variableDeclaration,o=r.variableDeclarationList,s=r.statement,c=r.name;oZ(s);var r=1&DA(i)|xL(t),r=uR.createModifiersFromModifierFlags(r),u=uR.createFunctionDeclaration(HN(r)?r:void 0,t.asteriskToken,c,t.typeParameters,t.parameters,t.type,a);return 1===o.declarations.length?ode.ChangeTracker.with(e,function(e){return e.replaceNode(n,s,u)}):ode.ChangeTracker.with(e,function(e){e.delete(n,i),e.insertNodeAfter(n,s,u)})}(e,s,u)),!1));break;case z6.name:if(!_j(s))return;c.push.apply(c,__spreadArray([],__read(function(e,t){var r,n=e.file,a=t.body.statements[0];!function(e,t){return 1===e.statements.length&&Kg(t)&&!!t.expression}(t.body,a)?r=t.body:(iZ(r=a.expression),cZ(a,r));var i=uR.createArrowFunction(t.modifiers,t.typeParameters,t.parameters,t.type,uR.createToken(39),r);return ode.ChangeTracker.with(e,function(e){return e.replaceNode(n,t,i)})}(e,s)),!1));break;default:return rA.fail("invalid action")}return{renameFilename:void 0,renameLocation:void 0,edits:c}}}function K6(e){var r=!1;return e.forEachChild(function e(t){bX(t)?r=!0:NE(t)||Fj(t)||_j(t)||HB(t,e)}),r}function G6(e,t,r){var n=QX(e,t),t=r.getTypeChecker(),r=function(e,t,r){if(!function(e){return Aj(e)||Ej(e)&&1===e.declarations.length}(r))return;r=(Aj(r)?r:SD(r.declarations)).initializer;if(r&&(lj(r)||_j(r)&&!Q6(e,t,r)))return r;return}(e,t,n.parent);if(r&&!K6(r.body)&&!t.containsArgumentsReference(r))return{selectedVariableDeclaration:!0,func:r};r=PP(n);return!r||!_j(r)&&!lj(r)||TX(r.body,n)||K6(r.body)||t.containsArgumentsReference(r)||_j(r)&&Q6(e,t,r)?void 0:{selectedVariableDeclaration:!1,func:r}}function X6(e){if(jE(e)){var t=uR.createReturnStatement(e),r=e.getSourceFile();return UB(t,e),iZ(t),mZ(e,t,r,void 0,!0),uR.createBlock([t],!0)}return e}function Q6(e,t,r){return r.name&&pue.Core.isSymbolReferencedInFile(r.name,t,e)}var Y6,Z6,$6,e3,t3=e({"src/services/refactors/convertArrowFunctionOrFunctionExpression.ts":function(){fpe(),j4(),R6="Convert arrow function or function expression",j6=vp(mA.Convert_arrow_function_or_function_expression),B6={name:"Convert to anonymous function",description:vp(mA.Convert_to_anonymous_function),kind:"refactor.rewrite.function.anonymous"},J6={name:"Convert to named function",description:vp(mA.Convert_to_named_function),kind:"refactor.rewrite.function.named"},z6={name:"Convert to arrow function",description:vp(mA.Convert_to_arrow_function),kind:"refactor.rewrite.function.arrow"},Q1(R6,{kinds:[B6.kind,J6.kind,z6.kind],getEditsForAction:H6,getAvailableActions:W6})}}),r3={},n3=e({"src/services/_namespaces/ts.refactor.convertArrowFunctionOrFunctionExpression.ts":function(){t3()}});function a3(e){var t=e.file,r=e.startPosition;return!sI(t)&&_3(t,r,e.program.getTypeChecker())?[{name:Y6,description:$6,actions:[e3]}]:WN}function i3(e,t){rA.assert(t===Y6,"Unexpected action name");var r=e.file,n=e.startPosition,a=e.program,t=e.cancellationToken,i=e.host,o=_3(r,n,a.getTypeChecker());if(o&&t){var s=function(m,t,r){var y=function(e){switch(e.kind){case 262:return e.name?[e.name]:[rA.checkDefined(fY(e,90),"Nameless function declaration should be a default export")];case 174:return[e.name];case 176:var t=rA.checkDefined(MX(e,137,e.getSourceFile()),"Constructor declaration should have constructor keyword");return 231!==e.parent.kind?[t]:[e.parent.parent.name,t];case 219:return[e.parent.name];case 218:return e.name?[e.name,e.parent.name]:[e.parent.name];default:return rA.assertNever(e,"Unexpected function declaration kind ".concat(e.kind))}}(m),v=IR(m)?function(e){switch(e.parent.kind){case 263:var t=e.parent;return t.name?[t.name]:[rA.checkDefined(fY(t,90),"Nameless class declaration should be a default export")];case 231:var r=e.parent,t=e.parent.parent,r=r.name;return r?[r,t.name]:[t.name]}}(m):[],n=mD(__spreadArray(__spreadArray([],__read(y),!1),__read(v),!1),zD),g=t.getTypeChecker(),e=function(e){var t,r,n={accessExpressions:[],typeUsages:[]},a={functionCalls:[],declarations:[],classReferences:n,valid:!0},i=iD(y,h),o=iD(v,h),s=IR(m),c=iD(y,function(e){return o3(e,g)});try{for(var u=__values(e),_=u.next();!_.done;_=u.next()){var l=_.value;if(l.kind!==pue.EntryKind.Span){if(eD(c,h(l.node))){if(function(e){return ER(e)&&(Ij(e.parent)||VR(e.parent))}(l.node.parent)){a.signature=l.node.parent;continue}if(d=u3(l)){a.functionCalls.push(d);continue}}var d,f,p=o3(l.node,g);if(p&&eD(c,p))if(f=c3(l)){a.declarations.push(f);continue}if(eD(i,h(l.node))||XG(l.node)){if(s3(l))continue;if(f=c3(l)){a.declarations.push(f);continue}if(d=u3(l)){a.functionCalls.push(d);continue}}if(s&&eD(o,h(l.node))){if(s3(l))continue;if(f=c3(l)){a.declarations.push(f);continue}p=function(e){if(e.node.parent){var t=e.node,r=t.parent;switch(r.kind){case 211:var n=BD(r,aj);if(n&&n.expression===t)return n;break;case 212:n=BD(r,ij);if(n&&n.expression===t)return n}}return}(l);if(p){n.accessExpressions.push(p);continue}if(Pj(m.parent)){l=function(e){e=e.node;if(2===HG(e)||DL(e.parent))return e;return}(l);if(l){n.typeUsages.push(l);continue}}}a.valid=!1}else a.valid=!1}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return a}(cD(n,function(e){return pue.getReferenceEntriesForNode(-1,e,t,t.getSourceFiles(),r)}));XN(e.declarations,function(e){return eD(n,e)})||(e.valid=!1);return e;function h(e){e=g.getSymbolAtLocation(e);return e&&QY(e,g)}}(o,a,t);return s.valid?{renameFilename:void 0,renameLocation:void 0,edits:ode.ChangeTracker.with(e,function(e){return function(r,e,t,n,a,i){var o,s,c=i.signature,u=iD(y3(a,e,t),function(e){return eZ(e)});c&&(t=iD(y3(c,e,t),function(e){return eZ(e)}),m(c,t));m(a,u);var _=E(i.functionCalls,function(e,t){return UD(e.pos,t.pos)});try{for(var l=__values(_),d=l.next();!d.done;d=l.next()){var f,p=d.value;p.arguments&&p.arguments.length&&(f=eZ(function(e,t){var r=m3(e.parameters),n=uF(ND(r)),e=iD(n?t.slice(0,r.length-1):t,function(e,t){t=function(e,t){if(xR(t)&&AO(t)===e)return uR.createShorthandPropertyAssignment(e);return uR.createPropertyAssignment(e,t)}(v3(r[t]),e);return iZ(t.name),iB(t)&&iZ(t.initializer),cZ(e,t),t});n&&t.length>=r.length&&(t=t.slice(r.length-1),t=uR.createPropertyAssignment(v3(ND(r)),uR.createArrayLiteralExpression(t)),e.push(t));return uR.createObjectLiteralExpression(e,!1)}(a,p.arguments),!0),n.replaceNodeRange(CF(p),SD(p.arguments),ND(p.arguments),f,{leadingTriviaOption:ode.LeadingTriviaOption.IncludeAll,trailingTriviaOption:ode.TrailingTriviaOption.Include}))}}catch(e){o={error:e}}finally{try{d&&!d.done&&(s=l.return)&&s.call(l)}finally{if(o)throw o.error}}function m(e,t){n.replaceNodeRangeWithNodes(r,SD(e.parameters),ND(e.parameters),t,{joiner:", ",indentation:0,leadingTriviaOption:ode.LeadingTriviaOption.IncludeAll,trailingTriviaOption:ode.TrailingTriviaOption.Include})}}(r,a,i,e,o,s)})}:{edits:[]}}}function o3(e,t){e=S8(e);if(e){e=t.getContextualTypeForObjectLiteralElement(e),e=null==e?void 0:e.getSymbol();if(e&&!(6&BL(e)))return e}}function s3(e){e=e.node;return Vj(e.parent)||zj(e.parent)||Bj(e.parent)||ah(e.parent)||Kj(e.parent)||qj(e.parent)?e:void 0}function c3(e){if(GE(e.node.parent))return e.node}function u3(e){if(e.node.parent){var t=e.node,r=t.parent;switch(r.kind){case 213:case 214:var n=BD(r,ME);if(n&&n.expression===t)return n;break;case 211:var a=BD(r,aj);if(a&&a.parent&&a.name===t)if((i=BD(a.parent,ME))&&i.expression===a)return i;break;case 212:var i,a=BD(r,ij);if(a&&a.parent&&a.argumentExpression===t)if((i=BD(a.parent,ME))&&i.expression===a)return i}}}function _3(e,t,r){e=XX(e,t),t=rl(e);if(!function(e){e=FA(e,ZE);if(e){e=FA(e,function(e){return!ZE(e)});return!!e&&TE(e)}return!1}(e))return!(t&&function(e,t){if(!function(e,t){return function(e){if(p3(e))return e.length-1;return e.length}(e)>=Z6&&XN(e,function(e){return function(e,t){if(uF(e)){var r=t.getTypeAtLocation(e);if(!t.isArrayType(r)&&!t.isTupleType(r))return}return!e.modifiers&&xR(e.name)}(e,t)})}(e.parameters,t))return!1;switch(e.kind){case 262:return d3(e)&&l3(e,t);case 174:if(nj(e.parent)){var r=o3(e.name,t);return 1===(null==(r=null==r?void 0:r.declarations)?void 0:r.length)&&l3(e,t)}return l3(e,t);case 176:return Pj(e.parent)?d3(e.parent)&&l3(e,t):f3(e.parent.parent)&&l3(e,t);case 218:case 219:return f3(e.parent)}return!1}(t,r)&&TX(t,e))||t.body&&TX(t.body,e)?void 0:t}function l3(e,t){return!!e.body&&!t.isImplementationOfOverload(e)}function d3(e){return!!e.name||!!fY(e,90)}function f3(e){return Aj(e)&&R_(e)&&xR(e.name)&&!e.type}function p3(e){return 0=t.pos?a:t).getEnd()),a=e?function(e){for(;e.parent;){if(V3(e)&&!V3(e.parent))return e;e=e.parent}return}(t):function(e,t){for(;e.parent;){if(V3(e)&&0!==t.length&&e.end>=t.start+t.length)return e;e=e.parent}return}(t,a),a=a&&V3(a)?function(e){if(U3(e))return e;if(Tj(e)){var t=qI(e),t=null==t?void 0:t.initializer;return t&&U3(t)?t:void 0}return e.expression&&U3(e.expression)?e.expression:void 0}(a):void 0;if(!a)return{error:vp(mA.Could_not_find_convertible_access_expression)};n=n.getTypeChecker();return Pg(a)?function(e,t){var r=e.condition,n=G3(e.whenTrue);if(!n||t.isNullableType(t.getTypeAtLocation(n)))return{error:vp(mA.Could_not_find_convertible_access_expression)};{if((aj(r)||xR(r))&&H3(r,n.expression))return{finalExpression:n,occurrences:[r],expression:e};if(mj(r)){r=W3(n.expression,r);return r?{finalExpression:n,occurrences:r,expression:e}:{error:vp(mA.Could_not_find_matching_access_expressions)}}}}(a,n):function(e){if(56!==e.operatorToken.kind)return{error:vp(mA.Can_only_convert_logical_AND_access_chains)};var t=G3(e.right);if(!t)return{error:vp(mA.Could_not_find_convertible_access_expression)};var r=W3(t.expression,e.left);return r?{finalExpression:t,occurrences:r,expression:e}:{error:vp(mA.Could_not_find_matching_access_expressions)}}(a)}}function W3(e,t){for(var r=[];mj(t)&&56===t.operatorToken.kind;){var n=H3(oO(e),oO(t.right));if(!n)break;r.push(n),e=n,t=t.left}var a=H3(e,t);return a&&r.push(a),0=t&&TE(e)&&!IR(e)})}((_4(a.range)?ND(a.range):a.range).end,n);t?v.insertNodeBefore(i.file,t,x,!0):v.insertNodeAtEndOfScope(i.file,n,x);y.writeFixes(v);var S=[],x=function(e,t,r){r=uR.createIdentifier(r);{if(NE(e)){e=32&t.facts?uR.createIdentifier(e.name.text):uR.createThis();return uR.createPropertyAccessExpression(e,r)}return r}}(n,a,g);f&&k.unshift(uR.createIdentifier("this"));l=uR.createCallExpression(f?uR.createPropertyAccessExpression(x,"call"):x,l,k);2&a.facts&&(l=uR.createYieldExpression(uR.createToken(42),l));4&a.facts&&(l=uR.createAwaitExpression(l));f4(e)&&(l=uR.createJsxExpression(void 0,l));if(r.length&&!_)if(rA.assert(!T,"Expected no returnValueProperty"),rA.assert(!(1&a.facts),"Expected RangeFacts.HasReturn flag to be unset"),1===r.length){var w=r[0];S.push(uR.createVariableStatement(void 0,uR.createVariableDeclarationList([uR.createVariableDeclaration(eZ(w.name),void 0,eZ(w.type),l)],w.parent.flags)))}else{var C=[],N=[],D=r[0].parent.flags,A=!1;try{for(var E=__values(r),F=E.next();!F.done;F=E.next()){w=F.value;C.push(uR.createBindingElement(void 0,void 0,eZ(w.name)));var P=p.typeToTypeNode(p.getBaseTypeOfLiteralType(p.getTypeAtLocation(w)),n,1);N.push(uR.createPropertySignature(void 0,w.symbol.name,void 0,P)),A=A||void 0!==w.type,D&=w.parent.flags}}catch(e){o={error:e}}finally{try{F&&!F.done&&(s=E.return)&&s.call(E)}finally{if(o)throw o.error}}e=A?uR.createTypeLiteralNode(N):void 0;e&&lR(e,1),S.push(uR.createVariableStatement(void 0,uR.createVariableDeclarationList([uR.createVariableDeclaration(uR.createObjectBindingPattern(C),void 0,e,l)],D)))}else if(r.length||_){if(r.length)try{for(var I=__values(r),O=I.next();!O.done;O=I.next()){var L=(w=O.value).parent.flags;2&L&&(L=-3&L|1),S.push(uR.createVariableStatement(void 0,uR.createVariableDeclarationList([uR.createVariableDeclaration(w.symbol.name,void 0,R(w.type))],L)))}}catch(e){c={error:e}}finally{try{O&&!O.done&&(u=I.return)&&u.call(I)}finally{if(c)throw c.error}}T&&S.push(uR.createVariableStatement(void 0,uR.createVariableDeclarationList([uR.createVariableDeclaration(T,void 0,R(M))],1)));var M=u4(r,_);T&&M.unshift(uR.createShorthandPropertyAssignment(T)),1===M.length?(rA.assert(!T,"Shouldn't have returnValueProperty here"),S.push(uR.createExpressionStatement(uR.createAssignment(M[0].name,l))),1&a.facts&&S.push(uR.createReturnStatement())):(S.push(uR.createExpressionStatement(uR.createAssignment(uR.createObjectLiteralExpression(M),l))),T&&S.push(uR.createReturnStatement(uR.createIdentifier(T))))}else 1&a.facts?S.push(uR.createReturnStatement(l)):_4(a.range)?S.push(uR.createExpressionStatement(l)):S.push(l);_4(a.range)?v.replaceNodeRangeWithNodes(i.file,SD(a.range),ND(a.range),S):v.replaceNodeWithNodes(i.file,a.range,S);v=v.getChanges(),a=(_4(a.range)?SD(a.range):a.range).getSourceFile().fileName,g=dZ(v,a,g,!1);return{renameFilename:a,renameLocation:g,edits:v};function R(e){if(void 0!==e){for(var e=eZ(e),t=e;GR(t);)t=t.type;return xg(t)&&QN(t.types,function(e){return 157===e.kind})?e:uR.createUnionTypeNode([e,uR.createKeywordTypeNode(157)])}}}(a,n[l],o[l],_,c,u)}var c,u,_,l=/^constant_scope_(\d+)$/.exec(t);if(l){var s=+l[1];return rA.assert(isFinite(s),"Expected to parse a finite number from the constant scope index"),_=s,t=s4(c=i,u=e),l=t.scopes,s=t.readsAndWrites,i=s.target,e=s.usagesPerScope,t=s.constantErrorsPerScope,s=s.exposedVariableDeclarations,rA.assert(!t[_].length,"The extraction went missing? How?"),rA.assert(0===s.length,"Extract constant accepted a range containing a variable declaration?"),u.cancellationToken.throwIfCancellationRequested(),function(d,f,e,t,r){var n=e.substitutions,p=r.program.getTypeChecker(),a=f.getSourceFile(),i=!aj(d)||NE(f)||p.resolveName(d.name.text,d,111551,!1)||bR(d.name)||MA(d.name)?lZ(NE(f)?"newProperty":"newLocal",a):d.name.text,o=cI(f),e=o||!p.isContextSensitive(d)?void 0:p.typeToTypeNode(p.getContextualType(d),f,1),a=function(e,n){return n.size?function e(t){var r=n.get(mJ(t).toString());return r?eZ(r):wJ(t,e,iU)}(e):e}(oO(d),n);n=function(e,t){var r,n;if(void 0===e)return{variableType:e,initializer:t};if(!_j(t)&&!lj(t)||t.typeParameters)return{variableType:e,initializer:t};var a=p.getTypeAtLocation(d),i=pa(p.getSignaturesOfType(a,0));if(!i)return{variableType:e,initializer:t};if(i.getTypeParameters())return{variableType:e,initializer:t};var o=[],s=!1;try{for(var c=__values(t.parameters),u=c.next();!u.done;u=c.next()){var _,l=u.value;l.type?o.push(l):((_=p.getTypeAtLocation(l))===p.getAnyType()&&(s=!0),o.push(uR.updateParameterDeclaration(l,l.modifiers,l.dotDotDotToken,l.name,l.questionToken,l.type||p.typeToTypeNode(_,f,1),l.initializer)))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}if(s)return{variableType:e,initializer:t};e=void 0,t=lj(t)?uR.updateArrowFunction(t,VB(d)?UA(d):void 0,t.typeParameters,o,t.type||p.typeToTypeNode(i.getReturnType(),f,1),t.equalsGreaterThanToken,t.body):(i&&i.thisParameter&&((!(a=kD(o))||xR(a.name)&&"this"!==a.name.escapedText)&&(a=p.getTypeOfSymbolAtLocation(i.thisParameter,d),o.splice(0,0,uR.createParameterDeclaration(void 0,void 0,"this",void 0,p.typeToTypeNode(a,f,1))))),uR.updateFunctionExpression(t,VB(d)?UA(d):void 0,t.asteriskToken,t.name,t.typeParameters,o,t.type||p.typeToTypeNode(i.getReturnType(),f,1),t.body));return{variableType:e,initializer:t}}(e,a),e=n.variableType,iZ(a=n.initializer);n=ode.ChangeTracker.fromContext(r);{var s,c;NE(f)?(rA.assert(!o,"Cannot extract to a JS class"),(c=[]).push(uR.createModifier(123)),32&t&&c.push(uR.createModifier(126)),c.push(uR.createModifier(148)),o=uR.createPropertyDeclaration(c,i,void 0,e,a),u=uR.createPropertyAccessExpression(32&t?uR.createIdentifier(f.name.getText()):uR.createThis(),uR.createIdentifier(i)),f4(d)&&(u=uR.createJsxExpression(void 0,u)),c=function(e,t){var r,n,a,i=t.members;rA.assert(0e)return a||i[0];if(o&&!AR(u)){if(void 0!==a)return u;o=!1}a=u}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return void 0===a?rA.fail():a}(d.pos,f),n.insertNodeBefore(r.file,c,o,!0),n.replaceNode(r.file,d,u)):(e=uR.createVariableDeclaration(i,void 0,e,a),(a=function(e,t){var r;for(;void 0!==e&&e!==t;){if(Aj(e)&&e.initializer===r&&Ej(e.parent)&&1e.pos)break;o=u}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return!o&&fh(i)?(rA.assert(Xg(i.parent.parent),"Grandparent isn't a switch statement"),i.parent.parent):rA.checkDefined(o,"prevStatement failed to get set")}rA.assert(i!==t,"Didn't encounter a block-like before encountering scope")}}(d,f)).pos?n.insertNodeAtTopOfFile(r.file,s,!1):n.insertNodeBefore(r.file,c,s,!1),244===d.parent.kind?n.delete(r.file,d.parent):(u=uR.createIdentifier(i),f4(d)&&(u=uR.createJsxExpression(void 0,u)),n.replaceNode(r.file,d,u))))}var u=n.getChanges(),n=d.getSourceFile().fileName,i=dZ(u,n,i,!0);return{renameFilename:n,renameLocation:i,edits:u}}(jE(i)?i:i.statements[0].expression,l[_],e[_],c.facts,u)}rA.fail("Unrecognized action name")}function i4(e,c,t){var r,n;void 0===t&&(t=!0);var a=c.length;if(0===a&&!t)return{errors:[QL(e,c.start,a,Z3.cannotExtractEmpty)]};var u,i=0===a&&t,o=ZX(e,c.start),s=$X(e,TA(c)),t=o&&s&&t?function(e,t,r){e=e.getStart(r),t=t.getEnd();59===r.text.charCodeAt(t)&&t++;return{start:e,length:t-e}}(o,s,e):c,_=i?FA(o,function(e){return e.parent&&l4(e)&&!mj(e.parent)}):dY(o,e,t),l=i?_:dY(s,e,t),d=0;if(!_||!l)return{errors:[QL(e,c.start,a,Z3.cannotExtractRange)]};if(16777216&_.flags)return{errors:[QL(e,c.start,a,Z3.cannotExtractJSDoc)]};if(_.parent!==l.parent)return{errors:[QL(e,c.start,a,Z3.cannotExtractRange)]};if(_!==l){if(!d4(_.parent))return{errors:[QL(e,c.start,a,Z3.cannotExtractRange)]};var f=[];try{for(var p=__values(_.parent.statements),m=p.next();!m.done;m=p.next()){var y=m.value;if(y===_||f.length){var v=g(y);if(v)return{errors:v};f.push(y)}if(y===l)break}}catch(e){r={error:e}}finally{try{m&&!m.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}return f.length?{targetRange:{range:f,facts:d,thisNode:u}}:{errors:[QL(e,c.start,a,Z3.cannotExtractRange)]}}if(Kg(_)&&!_.expression)return{errors:[QL(e,c.start,a,Z3.cannotExtractRange)]};e=function(e){var t,r;if(Kg(e)){if(e.expression)return e.expression}else if(Tj(e)||Ej(e)){var n=(Tj(e)?e.declarationList:e).declarations,a=0,i=void 0;try{for(var o=__values(n),s=o.next();!s.done;s=o.next()){var c=s.value;c.initializer&&(a++,i=c.initializer)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}if(1===a)return i}else if(Aj(e)&&e.initializer)return e.initializer;return e}(_),a=function(e){if(xR(Sj(e)?e.expression:e))return[tP(e,Z3.cannotExtractIdentifier)];return}(e)||g(e);return a?{errors:a}:{targetRange:{range:function(e){if(XE(e))return[e];if($P(e))return Sj(e.parent)?[e.parent]:e;if(p4(e))return e;return}(e),facts:d,thisNode:u}};function g(r){if((e={})[e.None=0]="None",e[e.Break=1]="Break",e[e.Continue=2]="Continue",e[e.Return=4]="Return",rA.assert(r.pos<=r.end,"This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (1)"),rA.assert(!hm(r.pos),"This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (2)"),!(XE(r)||$P(r)&&l4(r)||p4(r)))return[tP(r,Z3.statementOrExpressionExpected)];if(33554432&r.flags)return[tP(r,Z3.cannotExtractAmbientBlock)];var i,e=IP(r);e&&function(e){for(var t=r;t!==e;){if(172===t.kind){lL(t)&&(d|=32);break}if(169===t.kind){176===PP(t).kind&&(d|=32);break}174===t.kind&&lL(t)&&(d|=32),t=t.parent}}(e);var o,s=4;return function e(r){if(i)return!0;if(GE(r)){var t=260===r.kind?r.parent.parent:r;if(_L(t,1))return(i=i||[]).push(tP(r,Z3.cannotExtractExportedEntity)),!0}switch(r.kind){case 272:return(i=i||[]).push(tP(r,Z3.cannotExtractImport)),!0;case 277:return(i=i||[]).push(tP(r,Z3.cannotExtractExportedEntity)),!0;case 108:if(213===r.parent.kind){var n=IP(r);if(void 0===n||n.pos=c.start+c.length)return(i=i||[]).push(tP(r,Z3.cannotExtractSuper)),!0}else d|=8,u=r;break;case 219:HB(r,function e(t){if(bX(t))d|=8,u=r;else{if(NE(t)||bE(t)&&!lj(t))return!1;HB(t,e)}});case 263:case 262:uB(r.parent)&&void 0===r.parent.externalModuleIndicator&&(i=i||[]).push(tP(r,Z3.functionWillNotBeVisibleInTheNewScope));case 231:case 218:case 174:case 176:case 177:case 178:return!1}var t=s;switch(r.kind){case 245:s&=-5;break;case 258:s=0;break;case 241:r.parent&&258===r.parent.kind&&r.parent.finallyBlock===r&&(s=4);break;case 297:case 296:s|=1;break;default:JE(r,!1)&&(s|=3)}switch(r.kind){case 197:case 110:d|=8,u=r;break;case 256:var a=r.label;(o=o||[]).push(a.escapedText),HB(r,e),o.pop();break;case 252:case 251:var a=r.label;a?eD(o,a.escapedText)||(i=i||[]).push(tP(r,Z3.cannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange)):s&(252===r.kind?1:2)||(i=i||[]).push(tP(r,Z3.cannotExtractRangeContainingConditionalBreakOrContinueStatements));break;case 223:d|=4;break;case 229:d|=2;break;case 253:4&s?d|=1:(i=i||[]).push(tP(r,Z3.cannotExtractRangeContainingConditionalReturnStatement));break;default:HB(r,e)}s=t}(r),8&d&&((262===(e=RP(r,!1,!1)).kind||174===e.kind&&210===e.parent.kind||218===e.kind)&&(d|=16)),i}}function o4(e){return lj(e)?pc(e.body):TE(e)||uB(e)||Rj(e)||NE(e)}function s4(e,t){var r=t.file,n=function(e){var t=_4(e.range)?SD(e.range):e.range;if(8&e.facts&&!(16&e.facts)){var r=IP(t);if(r){e=FA(t,TE);return e?[e,r]:[r]}}for(var n=[];;)if(t=t.parent,169===t.kind&&(t=FA(t,TE).parent),o4(t)&&(n.push(t),312===t.kind))return n}(e);return{scopes:n,readsAndWrites:function(k,T,S,w,C,s){var t,e,r,n,i,a,c=new Map,N=[],D=[],A=[],E=[],o=[],u=new Map,_=[],l=_4(k.range)?1===k.range.length&&Sj(k.range[0])?k.range[0].expression:void 0:k.range;{var d;void 0===l?(d=k.range,v=SD(d).getStart(),d=ND(d).end,a=QL(w,v,d-v,Z3.expressionExpected)):147456&C.getTypeAtLocation(l).flags&&(a=tP(l,Z3.uselessConstantType))}try{for(var f=__values(T),p=f.next();!p.done;p=f.next()){var m=p.value;N.push({usages:new Map,typeParameterUsages:new Map,substitutions:new Map}),D.push(new Map),A.push([]);var y=[];a&&y.push(a),NE(m)&&cI(m)&&y.push(tP(m,Z3.cannotExtractToJSClass)),lj(m)&&!kj(m.body)&&y.push(tP(m,Z3.cannotExtractToExpressionArrowFunction)),E.push(y)}}catch(e){t={error:e}}finally{try{p&&!p.done&&(e=f.return)&&e.call(f)}finally{if(t)throw t.error}}var F=new Map,v=_4(k.range)?uR.createBlock(k.range):k.range,l=_4(k.range)?SD(k.range):k.range,g=function(e){return!!FA(e,function(e){return w_(e)&&0!==eE(e).length})}(l);(function e(t,r){void 0===r&&(r=1);g&&M(C.getTypeAtLocation(t));GE(t)&&t.symbol&&o.push(t);NL(t)?(e(t.left,2),e(t.right)):uc(t)?e(t.operand,2):!aj(t)&&!ij(t)&&xR(t)?t.parent&&(TR(t.parent)&&t!==t.parent.left||aj(t.parent)&&t!==t.parent.expression||R(t,r,vP(t))):HB(t,e)})(v),!g||_4(k.range)||$j(k.range)||M(C.getContextualType(k.range));if(0")};e=32===e.kind&&Zj(e.parent)?e.parent.parent:qv(e)&&_h(e.parent)?e.parent:void 0;return e&&function e(t){var r=t.closingFragment,t=t.parent;return!!(262144&r.flags)||_h(t)&&e(t)}(e)?{newText:""}:void 0}},getLinkedEditingRangeAtPosition:function(e,t){var r=w.getCurrentSourceFile(e),n=tQ(t,r);if(n&&312!==n.parent.kind){var a="[a-zA-Z0-9:\\-\\._$]*";if(_h(n.parent.parent)){var i=n.parent.parent.openingFragment,o=n.parent.parent.closingFragment;if(!wF(i)&&!wF(o)){var s=i.getStart(r)+1,c=o.getStart(r)+2;if(t===s||t===c)return{ranges:[{start:s,length:0},{start:c,length:0}],wordPattern:a}}}else{e=FA(n.parent,function(e){return!(!Yj(e)&&!uh(e))});if(e){rA.assert(Yj(e)||uh(e),"tag should be opening or closing element");i=e.parent.openingElement,o=e.parent.closingElement,s=i.tagName.getStart(r),c=i.tagName.end,n=o.tagName.getStart(r),e=o.tagName.end;if(s<=t&&t<=c||n<=t&&t<=e)if(i.tagName.getText(r)===o.tagName.getText(r))return{ranges:[{start:s,length:c-s},{start:n,length:e-n}],wordPattern:a}}}}},getSpanOfEnclosingComment:function(e,t,r){return e=w.getCurrentSourceFile(e),!(t=upe.getRangeOfEnclosingComment(e,t))||r&&3!==t.kind?void 0:MQ(t)},getCodeFixesAtPosition:function(e,t,r,n,a,i){void 0===i&&(i=fG),p();var o=f(e),s=wo(t,r),c=upe.getFormatContext(a,v);return cD(mD(n,zD,UD),function(e){return T.throwIfCancellationRequested(),Roe.getFixes({errorCode:e,sourceFile:o,span:s,program:x,host:v,cancellationToken:T,formatContext:c,preferences:i})})},getCombinedCodeFix:function(e,t,r,n){return void 0===n&&(n=fG),p(),rA.assert("file"===e.type),e=f(e.fileName),r=upe.getFormatContext(r,v),Roe.getAllFixes({fixId:t,sourceFile:e,program:x,host:v,cancellationToken:T,formatContext:r,preferences:n})},applyCodeActionCommand:function(e,t){return RD(e="string"==typeof e?t:e)?Promise.all(e.map(r)):r(e)},organizeImports:function(e,t,r){void 0===r&&(r=fG),p(),rA.assert("file"===e.type);var n=f(e.fileName),a=upe.getFormatContext(t,v),e=null!==(t=e.mode)&&void 0!==t?t:e.skipDestructiveCodeActions?"SortAndCombine":"All";return F_e.organizeImports(n,a,v,x,r,e)},getEditsForFileRename:function(e,t,r,n){return void 0===n&&(n=fG),W$(o(),e,t,v,upe.getFormatContext(r,v),n,A)},getEmitOutput:function(e,t,r){p();var n=f(e),e=v.getCustomTransformers&&v.getCustomTransformers();return xq(x,n,!!t,T,e,r)},getNonBoundSourceFile:function(e){return w.getCurrentSourceFile(e)},getProgram:o,getCurrentProgram:function(){return x},getAutoImportProvider:function(){var e;return null==(e=v.getPackageJsonAutoImportProvider)?void 0:e.call(v)},updateIsDefinitionOfReferencedSymbols:function(l,d){var t,e,r,n,f=x.getTypeChecker(),a=function(){var t,e,r,n;try{for(var a=__values(l),i=a.next();!i.done;i=a.next()){var o=i.value;try{for(var s=(r=void 0,__values(o.references)),c=s.next();!c.done;c=s.next()){var u=c.value;if(d.has(u)){var _=m(u);return rA.assertIsDefined(_),f.getSymbolAtLocation(_)}u=bY(u,A,LD(v,v.fileExists));if(u&&d.has(u))if(_=m(u))return f.getSymbolAtLocation(_)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}return}();if(!a)return!1;try{for(var i=__values(l),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var c=(r=void 0,__values(s.references)),u=c.next();!u.done;u=c.next()){var _=u.value,p=m(_);rA.assertIsDefined(p),d.has(_)||pue.isDeclarationOfSymbol(p,a)?(d.add(_),_.isDefinition=!0,(p=bY(_,A,LD(v,v.fileExists)))&&d.add(p)):_.isDefinition=!1}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return!0;function m(e){var t=x.getSourceFile(e.fileName);if(t){e=GX(t,e.textSpan.start);return pue.Core.getAdjustedNode(e,{use:pue.FindReferencesUse.References})}}},getApplicableRefactors:function(e,t,r,n,a,i){return void 0===r&&(r=fG),p(),e=f(e),I4.getApplicableRefactors(s(e,t,r,fG,n,a),i)},getEditsForRefactor:function(e,t,r,n,a,i,o){return void 0===i&&(i=fG),p(),e=f(e),I4.getEditsForRefactor(s(e,r,i,t),n,a,o)},getMoveToRefactoringFileSuggestions:function(e,t,r){void 0===r&&(r=fG),p();var n=f(e),a=rA.checkDefined(x.getSourceFiles()),i=bm(e),a=uD(a,function(e){return null!=x&&x.isSourceFileFromExternalLibrary(n)||n===f(e.fileName)||".ts"===i&&".d.ts"===bm(e.fileName)||".d.ts"===i&&XD(Ea(e.fileName),"lib.")&&".d.ts"===bm(e.fileName)||i!==bm(e.fileName)?void 0:e.fileName});return{newFileName:_6(n,x,s(n,t,r,fG),v),files:a}},toLineColumnOffset:function(e,t){return 0===t?{line:0,character:0}:A.toLineColumnOffset(e,t)},getSourceMapper:function(){return A},clearSourceMapperCache:function(){return A.clearCache()},prepareCallHierarchy:function(e,t){return p(),(t=p7.resolveCallHierarchyDeclaration(x,GX(f(e),t)))&&XZ(t,function(e){return p7.createCallHierarchyItem(x,e)})},provideCallHierarchyIncomingCalls:function(e,t){return p(),e=f(e),(t=QZ(p7.resolveCallHierarchyDeclaration(x,0===t?e:GX(e,t))))?p7.getIncomingCalls(x,t,T):[]},provideCallHierarchyOutgoingCalls:function(e,t){return p(),e=f(e),(t=QZ(p7.resolveCallHierarchyDeclaration(x,0===t?e:GX(e,t))))?p7.getOutgoingCalls(x,t):[]},toggleLineComment:c,toggleMultilineComment:F,commentSelection:function(e,t){var r=E(w.getCurrentSourceFile(e),t);return(r.firstLine===r.lastLine&&t.pos!==t.end?F:c)(e,t,!0)},uncommentSelection:function(e,t){var r=w.getCurrentSourceFile(e),n=[],a=t.pos,i=t.end;a===i&&(i+=_Q(r,a)?2:1);for(var o=a;o<=i;o++){var s=yQ(r,o);if(s){switch(s.kind){case 2:n.push.apply(n,c(e,{end:s.end,pos:s.pos+1},!1));break;case 3:n.push.apply(n,F(e,{end:s.end,pos:s.pos+1},!1))}o=s.end+1}}return n},provideInlayHints:function(e,t,r){return void 0===r&&(r=fG),p(),e=f(e),Bue.provideInlayHints((t=t,r=r,{file:e,program:o(),host:v,span:t,preferences:r,cancellationToken:T}))},getSupportedCodeFixes:g8};switch(h){case 0:break;case 1:a8.forEach(function(e){return a[e]=function(){throw new Error("LanguageService Operation: ".concat(e," not allowed in LanguageServiceMode.PartialSemantic"))}});break;case 2:i8.forEach(function(e){return a[e]=function(){throw new Error("LanguageService Operation: ".concat(e," not allowed in LanguageServiceMode.Syntactic"))}});break;default:rA.assertNever(h)}return a}function T8(e){var t,c;return e.nameTable||(c=(t=e).nameTable=new Map,t.forEachChild(function e(t){var r,n,a,i;if(xR(t)&&!lX(t)&&t.escapedText||SO(t)&&(uO(i=t)||283===i.parent.kind||function(e){return e&&e.parent&&212===e.parent.kind&&e.parent.argumentExpression===e}(i)||_O(i))?(a=EO(t),c.set(a,void 0===c.get(a)?t.pos:-1)):bR(t)&&(a=t.escapedText,c.set(a,void 0===c.get(a)?t.pos:-1)),HB(t,e),tF(t))try{for(var o=__values(t.jsDoc),s=o.next();!s.done;s=o.next())HB(s.value,e)}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}})),e.nameTable}function S8(e){e=function(e){switch(e.kind){case 11:case 15:case 9:if(167===e.parent.kind)return Pc(e.parent.parent)?e.parent.parent:void 0;case 80:return!Pc(e.parent)||210!==e.parent.parent.kind&&292!==e.parent.parent.kind||e.parent.name!==e?void 0:e.parent}return}(e);return e&&(nj(e.parent)||eB(e.parent))?e:void 0}function w8(t,r,e,n){var a=GQ(t.name);if(!a)return WN;if(!e.isUnion())return(i=e.getProperty(a))?[i]:WN;var i,o=uD(e.types,function(e){return(nj(t.parent)||eB(t.parent))&&r.isTypeInvalidDueToUnionDiscriminant(e,t.parent)?void 0:e.getProperty(a)});if(n&&(0===o.length||o.length===e.types.length)&&(i=e.getProperty(a)))return[i];return 0===o.length?uD(e.types,function(e){return e.getProperty(a)}):o}function C8(e){if(zn)return dA(lA(pi(zn.getExecutingFilePath())),po(e));throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. ")}var N8=e({"src/services/services.ts":function(){function e(e,t,r){this.pos=t,this.end=r,this.flags=0,this.modifierFlagsCache=0,this.transformFlags=0,this.parent=void 0,this.kind=e}function t(e,t){this.pos=e,this.end=t,this.flags=0,this.modifierFlagsCache=0,this.transformFlags=0,this.parent=void 0}function r(e,t){this.id=0,this.mergeId=0,this.flags=e,this.escapedName=t}function n(e,t,r){r=a.call(this,t,r)||this;return r.kind=e,r}var a,i,o,s;function c(e,t,r){r=i.call(this,t,r)||this;return r.kind=80,r}function u(e,t,r){r=o.call(this,t,r)||this;return r.kind=81,r}function _(e,t){this.checker=e,this.flags=t}function l(e,t){this.checker=e,this.flags=t}function d(e,t,r){r=s.call(this,e,t,r)||this;return r.kind=312,r}function f(e,t,r){this.fileName=e,this.text=t,this.skipTrivia=r}function p(e){this.host=e}function m(e){this.cancellationToken=e}function y(e,t){void 0===t&&(t=20),this.hostCancellationToken=e,this.throttleWaitMilliseconds=t,this.lastCancellationCheckTime=0}fpe(),_1(),X1(),j4(),R$(),o8(),V4="0.8",e.prototype.assertHasRealPosition=function(e){rA.assert(!hm(this.pos)&&!hm(this.end),e||"Node must have a real position for this operation")},e.prototype.getSourceFile=function(){return CF(this)},e.prototype.getStart=function(e,t){return this.assertHasRealPosition(),c_(this,e,t)},e.prototype.getFullStart=function(){return this.assertHasRealPosition(),this.pos},e.prototype.getEnd=function(){return this.assertHasRealPosition(),this.end},e.prototype.getWidth=function(e){return this.assertHasRealPosition(),this.getEnd()-this.getStart(e)},e.prototype.getFullWidth=function(){return this.assertHasRealPosition(),this.end-this.pos},e.prototype.getLeadingTriviaWidth=function(e){return this.assertHasRealPosition(),this.getStart(e)-this.pos},e.prototype.getFullText=function(e){return this.assertHasRealPosition(),(e||this.getSourceFile()).text.substring(this.pos,this.end)},e.prototype.getText=function(e){return this.assertHasRealPosition(),(e=e||this.getSourceFile()).text.substring(this.getStart(e),this.getEnd())},e.prototype.getChildCount=function(e){return this.getChildren(e).length},e.prototype.getChildAt=function(e,t){return this.getChildren(t)[e]},e.prototype.getChildren=function(e){return this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine"),this._children||(this._children=c8(this,e))},e.prototype.getFirstToken=function(e){this.assertHasRealPosition();var t=this.getChildren(e);if(t.length){t=QN(t,function(e){return e.kind<316||357=e.length&&(t=this.getEnd()),t=t||e[r+1]-1;r=this.getFullText();return"\n"===r[t]&&"\r"===r[t-1]?t-1:t},d.prototype.getNamedDeclarations=function(){return this.namedDeclarations||(this.namedDeclarations=this.computeNamedDeclarations()),this.namedDeclarations},d.prototype.computeNamedDeclarations=function(){var r=MD();return this.forEachChild(function e(t){switch(t.kind){case 262:case 218:case 174:case 173:var r,n=t,a=c(n);a&&(r=s(a),(a=CD(r))&&n.parent===a.parent&&n.symbol===a.symbol?n.body&&!a.body&&(r[r.length-1]=n):r.push(n)),HB(t,e);break;case 263:case 231:case 264:case 265:case 266:case 267:case 271:case 281:case 276:case 273:case 274:case 177:case 178:case 187:o(t),HB(t,e);break;case 169:if(!_L(t,16476))break;case 260:case 208:var n=t;if(PE(n.name)){HB(n.name,e);break}n.initializer&&e(n.initializer);case 306:case 172:case 171:o(t);break;case 278:var i=t;i.exportClause&&(Hj(i.exportClause)?KN(i.exportClause.elements,e):e(i.exportClause.name));break;case 272:var i=t.importClause;i&&(i.name&&o(i.name),i.namedBindings&&(274===i.namedBindings.kind?o(i.namedBindings):KN(i.namedBindings.elements,e)));break;case 226:0!==NI(t)&&o(t);default:HB(t,e)}}),r;function o(e){var t=c(e);t&&r.add(t,e)}function s(e){var t=r.get(e);return t||r.set(e,t=[]),t}function c(e){e=zo(e);return e&&(SR(e)&&aj(e.expression)?e.expression.name.text:xE(e)?GQ(e):void 0)}},Z4=d,f.prototype.getLineAndCharacterOfPosition=function(e){return gA(this,e)},$4=f,p.prototype.getCurrentSourceFile=function(e){var t,r=this.host.getScriptSnapshot(e);if(!r)throw new Error("Could not find file: '"+e+"'.");var n,a=XY(e,this.host),i=this.host.getScriptVersion(e);return this.currentFileName!==e?n=x8(e,r,{languageVersion:99,impliedNodeFormat:oq(Ja(e,this.host.getCurrentDirectory(),(null==(n=null==(n=(t=this.host).getCompilerHost)?void 0:n.call(t))?void 0:n.getCanonicalFileName)||hd(this.host)),null==(n=null==(t=null==(n=null==(n=(t=this.host).getCompilerHost)?void 0:n.call(t))?void 0:n.getModuleResolutionCache)?void 0:t.call(n))?void 0:n.getPackageJsonInfoCache(),this.host,this.host.getCompilationSettings()),setExternalModuleIndicator:Np(this.host.getCompilationSettings())},i,!0,a):this.currentFileVersion!==i&&(a=r.getChangeRange(this.currentFileScriptSnapshot),n=b8(this.currentSourceFile,r,i,a)),n&&(this.currentFileVersion=i,this.currentFileName=e,this.currentFileScriptSnapshot=r,this.currentSourceFile=n),this.currentSourceFile},e8=p,t8={isCancellationRequested:ar,throwIfCancellationRequested:fi},m.prototype.isCancellationRequested=function(){return this.cancellationToken.isCancellationRequested()},m.prototype.throwIfCancellationRequested=function(){if(this.isCancellationRequested())throw null!=iA&&iA.instant(iA.Phase.Session,"cancellationThrown",{kind:"CancellationTokenObject"}),new mr},r8=m,y.prototype.isCancellationRequested=function(){var e=ht();return Math.abs(e-this.lastCancellationCheckTime)>=this.throttleWaitMilliseconds&&(this.lastCancellationCheckTime=e,this.hostCancellationToken.isCancellationRequested())},y.prototype.throwIfCancellationRequested=function(){if(this.isCancellationRequested())throw null!=iA&&iA.instant(iA.Phase.Session,"cancellationThrown",{kind:"ThrottledCancellationToken"}),new mr},n8=y,i8=__spreadArray(__spreadArray([],__read(a8=["getSemanticDiagnostics","getSuggestionDiagnostics","getCompilerOptionsDiagnostics","getSemanticClassifications","getEncodedSemanticClassifications","getCodeFixesAtPosition","getCombinedCodeFix","applyCodeActionCommand","organizeImports","getEditsForFileRename","getEmitOutput","getApplicableRefactors","getEditsForRefactor","prepareCallHierarchy","provideCallHierarchyIncomingCalls","provideCallHierarchyOutgoingCalls","provideInlayHints","getSupportedCodeFixes"]),!1),["getCompletionsAtPosition","getCompletionEntryDetails","getCompletionEntrySymbol","getSignatureHelpItems","getQuickInfoAtPosition","getDefinitionAtPosition","getDefinitionAndBoundSpan","getImplementationAtPosition","getTypeDefinitionAtPosition","getReferencesAtPosition","findReferences","getDocumentHighlights","getNavigateToItems","getRenameInfo","findRenameLocations","getApplicableRefactors"],!1),fp({getNodeConstructor:function(){return q4},getTokenConstructor:function(){return K4},getIdentifierConstructor:function(){return G4},getPrivateIdentifierConstructor:function(){return X4},getSourceFileConstructor:function(){return Z4},getSymbolConstructor:function(){return H4},getTypeConstructor:function(){return Q4},getSignatureConstructor:function(){return Y4},getSourceMapSourceConstructor:function(){return $4}})}});function D8(e,t,r){var n=[];r=W0(r,n);e=RD(e)?e:[e],t=fU(void 0,void 0,uR,r,e,t,!0);return t.diagnostics=fD(t.diagnostics,n),t}var A8,E8,F8,P8,I8,O8,L8,M8,R8,j8=e({"src/services/transform.ts":function(){fpe()}});function B8(e,t){e&&e.log("*INTERNAL ERROR* - Exception in typescript services: "+t.message)}function J8(e,t,r,n){return z8(e,t,!0,r,n)}function z8(t,r,e,n,a){try{var i=function(e,t,r,n){n&&(e.log(t),a=ht());var a,r=r();return n&&(n=ht(),e.log("".concat(t," completed in ").concat(n-a," msec")),jD(r)&&(128<(a=r).length&&(a=a.substring(0,128)+"..."),e.log(" result.length=".concat(a.length,", result='").concat(JSON.stringify(a),"'")))),r}(t,r,n,a);return e?JSON.stringify({result:i}):i}catch(e){return e instanceof mr?JSON.stringify({canceled:!0}):(B8(t,e),e.description=r,JSON.stringify({error:e}))}}function U8(e,r){return e.map(function(e){return t=r,{message:BV((e=e).messageText,t),start:e.start,length:e.length,category:Fn(e),code:e.code,reportsUnnecessary:e.reportsUnnecessary,reportsDeprecated:e.reportsDeprecated};var t})}function V8(e){return{spans:e.spans.join(","),endOfLineState:e.endOfLineState}}var q8=e({"src/services/shims.ts":function(){function e(e){this.scriptSnapshotShim=e}function t(e){var n=this;this.shimHost=e,this.loggingEnabled=!1,this.tracingEnabled=!1,"getModuleResolutionsForFile"in this.shimHost&&(this.resolveModuleNames=function(e,t){var r=JSON.parse(n.shimHost.getModuleResolutionsForFile(t));return iD(e,function(e){e=J(r,e);return e?{resolvedFileName:e,extension:bm(e),isExternalLibraryImport:!1}:void 0})}),"directoryExists"in this.shimHost&&(this.directoryExists=function(e){return n.shimHost.directoryExists(e)}),"getTypeReferenceDirectiveResolutionsForFile"in this.shimHost&&(this.resolveTypeReferenceDirectives=function(e,t){var r=JSON.parse(n.shimHost.getTypeReferenceDirectiveResolutionsForFile(t));return iD(e,function(e){return J(r,jD(e)?e:or(e.fileName))})})}function r(e){var t=this;this.shimHost=e,this.useCaseSensitiveFileNames=!!this.shimHost.useCaseSensitiveFileNames&&this.shimHost.useCaseSensitiveFileNames(),"directoryExists"in this.shimHost?this.directoryExists=function(e){return t.shimHost.directoryExists(e)}:this.directoryExists=void 0,"realpath"in this.shimHost?this.realpath=function(e){return t.shimHost.realpath(e)}:this.realpath=void 0}function n(e){(this.factory=e).registerShim(this)}function a(e,t,r){e=i.call(this,e)||this;return e.host=t,e.languageService=r,e.logPerformance=!1,e.logger=e.host,e}var i,o,s;function c(e,t){e=o.call(this,e)||this;return e.logger=t,e.logPerformance=!1,e.classifier=D$(),e}function u(e,t,r){e=s.call(this,e)||this;return e.logger=t,e.host=r,e.logPerformance=!1,e}function _(){this._shims=[]}fpe(),A8=function(){return this}(),e.prototype.getText=function(e,t){return this.scriptSnapshotShim.getText(e,t)},e.prototype.getLength=function(){return this.scriptSnapshotShim.getLength()},e.prototype.getChangeRange=function(e){e=this.scriptSnapshotShim.getChangeRange(e.scriptSnapshotShim);if(null===e)return null;e=JSON.parse(e);return Do(So(e.span.start,e.span.length),e.newLength)},e.prototype.dispose=function(){"dispose"in this.scriptSnapshotShim&&this.scriptSnapshotShim.dispose()},E8=e,t.prototype.log=function(e){this.loggingEnabled&&this.shimHost.log(e)},t.prototype.trace=function(e){this.tracingEnabled&&this.shimHost.trace(e)},t.prototype.error=function(e){this.shimHost.error(e)},t.prototype.getProjectVersion=function(){if(this.shimHost.getProjectVersion)return this.shimHost.getProjectVersion()},t.prototype.getTypeRootsVersion=function(){return this.shimHost.getTypeRootsVersion?this.shimHost.getTypeRootsVersion():0},t.prototype.useCaseSensitiveFileNames=function(){return!!this.shimHost.useCaseSensitiveFileNames&&this.shimHost.useCaseSensitiveFileNames()},t.prototype.getCompilationSettings=function(){var e=this.shimHost.getCompilationSettings();if(null===e||""===e)throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings");e=JSON.parse(e);return e.allowNonTsExtensions=!0,e},t.prototype.getScriptFileNames=function(){var e=this.shimHost.getScriptFileNames();return JSON.parse(e)},t.prototype.getScriptSnapshot=function(e){e=this.shimHost.getScriptSnapshot(e);return e&&new E8(e)},t.prototype.getScriptKind=function(e){return"getScriptKind"in this.shimHost?this.shimHost.getScriptKind(e):0},t.prototype.getScriptVersion=function(e){return this.shimHost.getScriptVersion(e)},t.prototype.getLocalizedDiagnosticMessages=function(){var e=this.shimHost.getLocalizedDiagnosticMessages();if(null===e||""===e)return null;try{return JSON.parse(e)}catch(e){return this.log(e.description||"diagnosticMessages.generated.json has invalid JSON format"),null}},t.prototype.getCancellationToken=function(){var e=this.shimHost.getCancellationToken();return new n8(e)},t.prototype.getCurrentDirectory=function(){return this.shimHost.getCurrentDirectory()},t.prototype.getDirectories=function(e){return JSON.parse(this.shimHost.getDirectories(e))},t.prototype.getDefaultLibFileName=function(e){return this.shimHost.getDefaultLibFileName(JSON.stringify(e))},t.prototype.readDirectory=function(e,t,r,n,a){n=em(e,r,n,this.shimHost.useCaseSensitiveFileNames(),this.shimHost.getCurrentDirectory());return JSON.parse(this.shimHost.readDirectory(e,JSON.stringify(t),JSON.stringify(n.basePaths),n.excludePattern,n.includeFilePattern,n.includeDirectoryPattern,a))},t.prototype.readFile=function(e,t){return this.shimHost.readFile(e,t)},t.prototype.fileExists=function(e){return this.shimHost.fileExists(e)},F8=t,r.prototype.readDirectory=function(e,t,r,n,a){n=em(e,r,n,this.shimHost.useCaseSensitiveFileNames(),this.shimHost.getCurrentDirectory());return JSON.parse(this.shimHost.readDirectory(e,JSON.stringify(t),JSON.stringify(n.basePaths),n.excludePattern,n.includeFilePattern,n.includeDirectoryPattern,a))},r.prototype.fileExists=function(e){return this.shimHost.fileExists(e)},r.prototype.readFile=function(e){return this.shimHost.readFile(e)},r.prototype.getDirectories=function(e){return JSON.parse(this.shimHost.getDirectories(e))},P8=r,n.prototype.dispose=function(e){this.factory.unregisterShim(this)},__extends(a,i=I8=n),a.prototype.forwardJSONCall=function(e,t){return J8(this.logger,e,t,this.logPerformance)},a.prototype.dispose=function(e){this.logger.log("dispose()"),this.languageService.dispose(),this.languageService=null,A8&&A8.CollectGarbage&&(A8.CollectGarbage(),this.logger.log("CollectGarbage()")),this.logger=null,i.prototype.dispose.call(this,e)},a.prototype.refresh=function(e){this.forwardJSONCall("refresh(".concat(e,")"),function(){return null})},a.prototype.cleanupSemanticCache=function(){var e=this;this.forwardJSONCall("cleanupSemanticCache()",function(){return e.languageService.cleanupSemanticCache(),null})},a.prototype.realizeDiagnostics=function(e){return U8(e,zY(this.host,void 0))},a.prototype.getSyntacticClassifications=function(e,t,r){var n=this;return this.forwardJSONCall("getSyntacticClassifications('".concat(e,"', ").concat(t,", ").concat(r,")"),function(){return n.languageService.getSyntacticClassifications(e,So(t,r))})},a.prototype.getSemanticClassifications=function(e,t,r){var n=this;return this.forwardJSONCall("getSemanticClassifications('".concat(e,"', ").concat(t,", ").concat(r,")"),function(){return n.languageService.getSemanticClassifications(e,So(t,r))})},a.prototype.getEncodedSyntacticClassifications=function(e,t,r){var n=this;return this.forwardJSONCall("getEncodedSyntacticClassifications('".concat(e,"', ").concat(t,", ").concat(r,")"),function(){return V8(n.languageService.getEncodedSyntacticClassifications(e,So(t,r)))})},a.prototype.getEncodedSemanticClassifications=function(e,t,r){var n=this;return this.forwardJSONCall("getEncodedSemanticClassifications('".concat(e,"', ").concat(t,", ").concat(r,")"),function(){return V8(n.languageService.getEncodedSemanticClassifications(e,So(t,r)))})},a.prototype.getSyntacticDiagnostics=function(t){var r=this;return this.forwardJSONCall("getSyntacticDiagnostics('".concat(t,"')"),function(){var e=r.languageService.getSyntacticDiagnostics(t);return r.realizeDiagnostics(e)})},a.prototype.getSemanticDiagnostics=function(t){var r=this;return this.forwardJSONCall("getSemanticDiagnostics('".concat(t,"')"),function(){var e=r.languageService.getSemanticDiagnostics(t);return r.realizeDiagnostics(e)})},a.prototype.getSuggestionDiagnostics=function(e){var t=this;return this.forwardJSONCall("getSuggestionDiagnostics('".concat(e,"')"),function(){return t.realizeDiagnostics(t.languageService.getSuggestionDiagnostics(e))})},a.prototype.getCompilerOptionsDiagnostics=function(){var t=this;return this.forwardJSONCall("getCompilerOptionsDiagnostics()",function(){var e=t.languageService.getCompilerOptionsDiagnostics();return t.realizeDiagnostics(e)})},a.prototype.getQuickInfoAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getQuickInfoAtPosition('".concat(e,"', ").concat(t,")"),function(){return r.languageService.getQuickInfoAtPosition(e,t)})},a.prototype.getNameOrDottedNameSpan=function(e,t,r){var n=this;return this.forwardJSONCall("getNameOrDottedNameSpan('".concat(e,"', ").concat(t,", ").concat(r,")"),function(){return n.languageService.getNameOrDottedNameSpan(e,t,r)})},a.prototype.getBreakpointStatementAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getBreakpointStatementAtPosition('".concat(e,"', ").concat(t,")"),function(){return r.languageService.getBreakpointStatementAtPosition(e,t)})},a.prototype.getSignatureHelpItems=function(e,t,r){var n=this;return this.forwardJSONCall("getSignatureHelpItems('".concat(e,"', ").concat(t,")"),function(){return n.languageService.getSignatureHelpItems(e,t,r)})},a.prototype.getDefinitionAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getDefinitionAtPosition('".concat(e,"', ").concat(t,")"),function(){return r.languageService.getDefinitionAtPosition(e,t)})},a.prototype.getDefinitionAndBoundSpan=function(e,t){var r=this;return this.forwardJSONCall("getDefinitionAndBoundSpan('".concat(e,"', ").concat(t,")"),function(){return r.languageService.getDefinitionAndBoundSpan(e,t)})},a.prototype.getTypeDefinitionAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getTypeDefinitionAtPosition('".concat(e,"', ").concat(t,")"),function(){return r.languageService.getTypeDefinitionAtPosition(e,t)})},a.prototype.getImplementationAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getImplementationAtPosition('".concat(e,"', ").concat(t,")"),function(){return r.languageService.getImplementationAtPosition(e,t)})},a.prototype.getRenameInfo=function(e,t,r){var n=this;return this.forwardJSONCall("getRenameInfo('".concat(e,"', ").concat(t,")"),function(){return n.languageService.getRenameInfo(e,t,r)})},a.prototype.getSmartSelectionRange=function(e,t){var r=this;return this.forwardJSONCall("getSmartSelectionRange('".concat(e,"', ").concat(t,")"),function(){return r.languageService.getSmartSelectionRange(e,t)})},a.prototype.findRenameLocations=function(e,t,r,n,a){var i=this;return this.forwardJSONCall("findRenameLocations('".concat(e,"', ").concat(t,", ").concat(r,", ").concat(n,")"),function(){return i.languageService.findRenameLocations(e,t,r,n,a)})},a.prototype.getBraceMatchingAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getBraceMatchingAtPosition('".concat(e,"', ").concat(t,")"),function(){return r.languageService.getBraceMatchingAtPosition(e,t)})},a.prototype.isValidBraceCompletionAtPosition=function(e,t,r){var n=this;return this.forwardJSONCall("isValidBraceCompletionAtPosition('".concat(e,"', ").concat(t,", ").concat(r,")"),function(){return n.languageService.isValidBraceCompletionAtPosition(e,t,r)})},a.prototype.getSpanOfEnclosingComment=function(e,t,r){var n=this;return this.forwardJSONCall("getSpanOfEnclosingComment('".concat(e,"', ").concat(t,")"),function(){return n.languageService.getSpanOfEnclosingComment(e,t,r)})},a.prototype.getIndentationAtPosition=function(t,r,n){var a=this;return this.forwardJSONCall("getIndentationAtPosition('".concat(t,"', ").concat(r,")"),function(){var e=JSON.parse(n);return a.languageService.getIndentationAtPosition(t,r,e)})},a.prototype.getReferencesAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getReferencesAtPosition('".concat(e,"', ").concat(t,")"),function(){return r.languageService.getReferencesAtPosition(e,t)})},a.prototype.findReferences=function(e,t){var r=this;return this.forwardJSONCall("findReferences('".concat(e,"', ").concat(t,")"),function(){return r.languageService.findReferences(e,t)})},a.prototype.getFileReferences=function(e){var t=this;return this.forwardJSONCall("getFileReferences('".concat(e,")"),function(){return t.languageService.getFileReferences(e)})},a.prototype.getDocumentHighlights=function(r,n,a){var i=this;return this.forwardJSONCall("getDocumentHighlights('".concat(r,"', ").concat(n,")"),function(){var e=i.languageService.getDocumentHighlights(r,n,JSON.parse(a)),t=or(La(r));return nD(e,function(e){return or(La(e.fileName))===t})})},a.prototype.getCompletionsAtPosition=function(e,t,r,n){var a=this;return this.forwardJSONCall("getCompletionsAtPosition('".concat(e,"', ").concat(t,", ").concat(r,", ").concat(n,")"),function(){return a.languageService.getCompletionsAtPosition(e,t,r,n)})},a.prototype.getCompletionEntryDetails=function(t,r,n,a,i,o,s){var c=this;return this.forwardJSONCall("getCompletionEntryDetails('".concat(t,"', ").concat(r,", '").concat(n,"')"),function(){var e=void 0===a?void 0:JSON.parse(a);return c.languageService.getCompletionEntryDetails(t,r,n,e,i,o,s)})},a.prototype.getFormattingEditsForRange=function(t,r,n,a){var i=this;return this.forwardJSONCall("getFormattingEditsForRange('".concat(t,"', ").concat(r,", ").concat(n,")"),function(){var e=JSON.parse(a);return i.languageService.getFormattingEditsForRange(t,r,n,e)})},a.prototype.getFormattingEditsForDocument=function(t,r){var n=this;return this.forwardJSONCall("getFormattingEditsForDocument('".concat(t,"')"),function(){var e=JSON.parse(r);return n.languageService.getFormattingEditsForDocument(t,e)})},a.prototype.getFormattingEditsAfterKeystroke=function(t,r,n,a){var i=this;return this.forwardJSONCall("getFormattingEditsAfterKeystroke('".concat(t,"', ").concat(r,", '").concat(n,"')"),function(){var e=JSON.parse(a);return i.languageService.getFormattingEditsAfterKeystroke(t,r,n,e)})},a.prototype.getDocCommentTemplateAtPosition=function(e,t,r,n){var a=this;return this.forwardJSONCall("getDocCommentTemplateAtPosition('".concat(e,"', ").concat(t,")"),function(){return a.languageService.getDocCommentTemplateAtPosition(e,t,r,n)})},a.prototype.getNavigateToItems=function(e,t,r){var n=this;return this.forwardJSONCall("getNavigateToItems('".concat(e,"', ").concat(t,", ").concat(r,")"),function(){return n.languageService.getNavigateToItems(e,t,r)})},a.prototype.getNavigationBarItems=function(e){var t=this;return this.forwardJSONCall("getNavigationBarItems('".concat(e,"')"),function(){return t.languageService.getNavigationBarItems(e)})},a.prototype.getNavigationTree=function(e){var t=this;return this.forwardJSONCall("getNavigationTree('".concat(e,"')"),function(){return t.languageService.getNavigationTree(e)})},a.prototype.getOutliningSpans=function(e){var t=this;return this.forwardJSONCall("getOutliningSpans('".concat(e,"')"),function(){return t.languageService.getOutliningSpans(e)})},a.prototype.getTodoComments=function(e,t){var r=this;return this.forwardJSONCall("getTodoComments('".concat(e,"')"),function(){return r.languageService.getTodoComments(e,JSON.parse(t))})},a.prototype.prepareCallHierarchy=function(e,t){var r=this;return this.forwardJSONCall("prepareCallHierarchy('".concat(e,"', ").concat(t,")"),function(){return r.languageService.prepareCallHierarchy(e,t)})},a.prototype.provideCallHierarchyIncomingCalls=function(e,t){var r=this;return this.forwardJSONCall("provideCallHierarchyIncomingCalls('".concat(e,"', ").concat(t,")"),function(){return r.languageService.provideCallHierarchyIncomingCalls(e,t)})},a.prototype.provideCallHierarchyOutgoingCalls=function(e,t){var r=this;return this.forwardJSONCall("provideCallHierarchyOutgoingCalls('".concat(e,"', ").concat(t,")"),function(){return r.languageService.provideCallHierarchyOutgoingCalls(e,t)})},a.prototype.provideInlayHints=function(e,t,r){var n=this;return this.forwardJSONCall("provideInlayHints('".concat(e,"', '").concat(JSON.stringify(t),"', ").concat(JSON.stringify(r),")"),function(){return n.languageService.provideInlayHints(e,t,r)})},a.prototype.getEmitOutput=function(r){var n=this;return this.forwardJSONCall("getEmitOutput('".concat(r,"')"),function(){var e=n.languageService.getEmitOutput(r),t=e.diagnostics,e=__rest(e,["diagnostics"]);return __assign(__assign({},e),{diagnostics:n.realizeDiagnostics(t)})})},a.prototype.getEmitOutputObject=function(e){var t=this;return z8(this.logger,"getEmitOutput('".concat(e,"')"),!1,function(){return t.languageService.getEmitOutput(e)},this.logPerformance)},a.prototype.toggleLineComment=function(e,t){var r=this;return this.forwardJSONCall("toggleLineComment('".concat(e,"', '").concat(JSON.stringify(t),"')"),function(){return r.languageService.toggleLineComment(e,t)})},a.prototype.toggleMultilineComment=function(e,t){var r=this;return this.forwardJSONCall("toggleMultilineComment('".concat(e,"', '").concat(JSON.stringify(t),"')"),function(){return r.languageService.toggleMultilineComment(e,t)})},a.prototype.commentSelection=function(e,t){var r=this;return this.forwardJSONCall("commentSelection('".concat(e,"', '").concat(JSON.stringify(t),"')"),function(){return r.languageService.commentSelection(e,t)})},a.prototype.uncommentSelection=function(e,t){var r=this;return this.forwardJSONCall("uncommentSelection('".concat(e,"', '").concat(JSON.stringify(t),"')"),function(){return r.languageService.uncommentSelection(e,t)})},O8=a,__extends(c,o=I8),c.prototype.getEncodedLexicalClassifications=function(e,t,r){var n=this;return void 0===r&&(r=!1),J8(this.logger,"getEncodedLexicalClassifications",function(){return V8(n.classifier.getEncodedLexicalClassifications(e,t,r))},this.logPerformance)},c.prototype.getClassificationsForLine=function(e,t,r){var n,a;void 0===r&&(r=!1);var i=this.classifier.getClassificationsForLine(e,t,r),o="";try{for(var s=__values(i.entries),c=s.next();!c.done;c=s.next()){var u=c.value;o+=u.length+"\n",o+=u.classification+"\n"}}catch(e){n={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}return o+=i.finalLexState},L8=c,__extends(u,s=I8),u.prototype.forwardJSONCall=function(e,t){return J8(this.logger,e,t,this.logPerformance)},u.prototype.resolveModuleName=function(r,n,a){var i=this;return this.forwardJSONCall("resolveModuleName('".concat(r,"')"),function(){var e=JSON.parse(a),t=JS(n,La(r),e,i.host),e=t.resolvedModule?t.resolvedModule.resolvedFileName:void 0;return t.resolvedModule&&".ts"!==t.resolvedModule.extension&&".tsx"!==t.resolvedModule.extension&&".d.ts"!==t.resolvedModule.extension&&(e=void 0),{resolvedFileName:e,failedLookupLocations:t.failedLookupLocations,affectingLocations:t.affectingLocations}})},u.prototype.resolveTypeReferenceDirective=function(t,r,n){var a=this;return this.forwardJSONCall("resolveTypeReferenceDirective(".concat(t,")"),function(){var e=JSON.parse(n),e=hS(r,La(t),e,a.host);return{resolvedFileName:e.resolvedTypeReferenceDirective?e.resolvedTypeReferenceDirective.resolvedFileName:void 0,primary:!e.resolvedTypeReferenceDirective||e.resolvedTypeReferenceDirective.primary,failedLookupLocations:e.failedLookupLocations}})},u.prototype.getPreProcessedFileInfo=function(e,t){var r=this;return this.forwardJSONCall("getPreProcessedFileInfo('".concat(e,"')"),function(){var e=b0(WQ(t),!0,!0);return{referencedFiles:r.convertFileReferences(e.referencedFiles),importedFiles:r.convertFileReferences(e.importedFiles),ambientExternalModules:e.ambientExternalModules,isLibFile:e.isLibFile,typeReferenceDirectives:r.convertFileReferences(e.typeReferenceDirectives),libReferenceDirectives:r.convertFileReferences(e.libReferenceDirectives)}})},u.prototype.getAutomaticTypeDirectiveNames=function(e){var t=this;return this.forwardJSONCall("getAutomaticTypeDirectiveNames('".concat(e,"')"),function(){return TS(JSON.parse(e),t.host)})},u.prototype.convertFileReferences=function(e){var t,r;if(e){var n=[];try{for(var a=__values(e),i=a.next();!i.done;i=a.next()){var o=i.value;n.push({path:La(o.fileName),position:o.pos,length:o.end-o.pos})}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return n}},u.prototype.getTSConfigFileInfo=function(r,n){var a=this;return this.forwardJSONCall("getTSConfigFileInfo('".concat(r,"')"),function(){var e=Ob(r,WQ(n)),t=La(r),t=yT(e,a.host,lA(t),{},t);return{options:t.options,typeAcquisition:t.typeAcquisition,files:t.fileNames,raw:t.raw,errors:U8(__spreadArray(__spreadArray([],__read(e.parseDiagnostics),!1),__read(t.errors),!1),"\r\n")}})},u.prototype.getDefaultCompilationSettings=function(){return this.forwardJSONCall("getDefaultCompilationSettings()",v8)},u.prototype.discoverTypings=function(t){var r=this,n=or;return this.forwardJSONCall("discoverTypings()",function(){var e=JSON.parse(t);return void 0===r.safeList&&(r.safeList=HK.loadSafeList(r.host,Ja(e.safeListPath,e.safeListPath,n))),HK.discoverTypings(r.host,function(e){return r.logger.log(e)},e.fileNames,Ja(e.projectRootPath,e.projectRootPath,n),r.safeList,e.packageNameToTypingLocation,e.typeAcquisition,e.unresolvedImports,e.typesRegistry,fG)})},M8=u,_.prototype.getServicesVersion=function(){return V4},_.prototype.createLanguageServiceShim=function(t){try{void 0===this.documentRegistry&&(this.documentRegistry=J$(t.useCaseSensitiveFileNames&&t.useCaseSensitiveFileNames(),t.getCurrentDirectory()));var e=k8(new F8(t),this.documentRegistry,!1);return new O8(this,t,e)}catch(e){throw B8(t,e),e}},_.prototype.createClassifierShim=function(t){try{return new L8(this,t)}catch(e){throw B8(t,e),e}},_.prototype.createCoreServicesShim=function(t){try{var e=new P8(t);return new M8(this,t,e)}catch(e){throw B8(t,e),e}},_.prototype.close=function(){aD(this._shims),this.documentRegistry=void 0},_.prototype.registerShim=function(e){this._shims.push(e)},_.prototype.unregisterShim=function(e){for(var t=0;tr){e=tQ(t.pos,g);if(!e||g.getLineAndCharacterOfPosition(e.getEnd()).line!==r)return;t=e}if(!(33554432&t.flags))return S(t)}function h(e,t){var r=qB(e)?YN(e.modifiers,NR):void 0;return wo(r?xA(g.text,r.end):e.getStart(g),(t||e).getEnd())}function x(e,t){return h(e,eQ(t,t.parent,g))}function b(e,t){return e&&r===g.getLineAndCharacterOfPosition(e.getStart(g)).line?S(e):S(t)}function k(e){return S(tQ(e.pos,g))}function T(e){return S(eQ(e,e.parent,g))}function S(e){if(e){var t=e.parent;switch(e.kind){case 243:return l(e.declarationList.declarations[0]);case 260:case 172:case 171:return l(e);case 169:return function e(t){{if(PE(t.name))return y(t.name);if(d(t))return h(t);var r=t.parent,t=r.parameters.indexOf(t);return rA.assert(-1!==t),0!==t?e(r.parameters[t-1]):S(r.body)}}(e);case 262:case 174:case 173:case 177:case 178:case 176:case 218:case 219:return function(e){if(!e.body)return;if(f(e))return h(e);return S(e.body)}(e);case 241:if(X_(e))return function(e){var t=e.statements.length?e.statements[0]:e.getLastToken();if(f(e.parent))return b(e.parent,t);return S(t)}(e);case 268:return p(e);case 299:return p(e.block);case 244:return h(e.expression);case 253:return h(e.getChildAt(0),e.expression);case 247:return x(e,e.expression);case 246:return S(e.statement);case 259:return h(e.getChildAt(0));case 245:return x(e,e.expression);case 256:return S(e.statement);case 252:case 251:return h(e.getChildAt(0),e.label);case 248:return function(e){if(e.initializer)return m(e);if(e.condition)return h(e.condition);if(e.incrementor)return h(e.incrementor)}(e);case 249:return x(e,e.expression);case 250:return m(e);case 255:return x(e,e.expression);case 296:case 297:return S(e.statements[0]);case 258:return p(e.tryBlock);case 257:case 277:return h(e,e.expression);case 271:return h(e,e.moduleReference);case 272:case 278:return h(e,e.moduleSpecifier);case 267:if(1!==$B(e))return;case 263:case 266:case 306:case 208:return h(e);case 254:return S(e.statement);case 170:return function(e,t,r){if(e){var n=e.indexOf(t);if(0<=n){for(var a=n,i=n+1;0TA(r)?"quit":(lj(e)||FR(e)||_j(e)||Fj(e))&&yY(r,IQ(e,t))})}var K7,G7,X7,Q7,Y7=e({"src/services/codefixes/addMissingAsync.ts":function(){fpe(),Hoe(),z7="addMissingAsync",U7=[mA.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,mA.Type_0_is_not_assignable_to_type_1.code,mA.Type_0_is_not_comparable_to_type_1.code],N7({fixIds:[z7],errorCodes:U7,getCodeActions:function(t){var a,i,e=t.sourceFile,r=t.errorCode,n=t.cancellationToken,o=t.program,s=t.span,r=QN(o.getTypeChecker().getDiagnostics(e,n),(a=s,i=r,function(e){var t=e.start,r=e.length,n=e.relatedInformation,e=e.code;return ae(t)&&ae(r)&&yY({start:t,length:r},a)&&e===i&&!!n&&dD(n,function(e){return e.code===mA.Did_you_mean_to_mark_this_function_as_async.code})})),r=H7(e,r&&r.relatedInformation&&QN(r.relatedInformation,function(e){return e.code===mA.Did_you_mean_to_mark_this_function_as_async.code}));if(r)return[W7(t,r,function(e){return ode.ChangeTracker.with(t,e)})]},getAllCodeActions:function(r){var n=r.sourceFile,a=new Set;return I7(r,U7,function(t,e){e=e.relatedInformation&&QN(e.relatedInformation,function(e){return e.code===mA.Did_you_mean_to_mark_this_function_as_async.code}),e=H7(n,e);if(e)return W7(r,e,function(e){return e(t),[]},a)})}})}});function Z7(e,t,r,n,a){var i,o,s=GZ(e,r);return s&&(e=e,i=t,o=r,n=n,dD(a.getTypeChecker().getDiagnostics(e,n),function(e){var t=e.start,r=e.length,n=e.relatedInformation,e=e.code;return ae(t)&&ae(r)&&yY({start:t,length:r},o)&&e===i&&!!n&&dD(n,function(e){return e.code===mA.Did_you_forget_to_use_await.code})}))&&t5(s)?s:void 0}function $7(e,r,n,a,t,i){var o=e.sourceFile,s=e.program,e=e.cancellationToken,c=function(e,s,a,c,u){var t,r,n=function(e,t){var r,n;if(aj(e.parent)&&xR(e.parent.expression))return{identifiers:[e.parent.expression],isCompleteFix:!0};if(xR(e))return{identifiers:[e],isCompleteFix:!0};if(mj(e)){var a=void 0,i=!0;try{for(var o=__values([e.left,e.right]),s=o.next();!s.done;s=o.next()){var c=s.value,u=t.getTypeAtLocation(c);t.getPromisedTypeOfPromise(u)&&(xR(c)?(a=a||[]).push(c):i=!1)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return a&&{identifiers:a,isCompleteFix:i}}}(e,u);if(!n)return;function i(i){var e=u.getSymbolAtLocation(i);if(!e)return 1;var t=BD(e.valueDeclaration,Aj),r=t&&BD(t.name,xR),n=xO(t,243);if(!t||!n||t.type||!t.initializer||n.getSourceFile()!==s||_L(n,1)||!r||!t5(t.initializer))return l=!1,1;var o=c.getSemanticDiagnostics(s,a);if(pue.Core.eachSymbolReferenceInFile(r,u,s,function(e){return i!==e&&(t=o,r=s,n=u,a=aj((e=e).parent)?e.parent.name:mj(e.parent)?e.parent:e,!((t=QN(t,function(e){return e.start===a.getStart(r)&&e.start+e.length===a.getEnd()}))&&eD(Q7,t.code)||1&n.getTypeAtLocation(a).flags));var t,r,n,a}))return l=!1,1;(_=_||[]).push({expression:t.initializer,declarationSymbol:e})}var _,l=n.isCompleteFix;try{for(var o=__values(n.identifiers),d=o.next();!d.done;d=o.next()){var f=d.value;i(f)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return _&&{initializers:_,needsSecondPassForFixAll:!l}}(r,o,e,s,a);if(c)return T7("addMissingAwaitToInitializer",t(function(t){KN(c.initializers,function(e){e=e.expression;return r5(t,n,o,a,e,i)}),i&&c.needsSecondPassForFixAll&&r5(t,n,o,a,r,i)}),1===c.initializers.length?[mA.Add_await_to_initializer_for_0,c.initializers[0].declarationSymbol.name]:mA.Add_await_to_initializers)}function e5(t,r,n,a,e,i){e=e(function(e){return r5(e,n,t.sourceFile,a,r,i)});return S7(K7,e,mA.Add_await,K7,mA.Fix_all_expressions_possibly_missing_await)}function t5(e){return 65536&e.kind||FA(e,function(e){return e.parent&&lj(e.parent)&&e.parent.body===e||kj(e)&&(262===e.parent.kind||218===e.parent.kind||219===e.parent.kind||174===e.parent.kind)})}function r5(e,t,r,n,a,i){var o,s;if(Dj(a.parent)&&!a.parent.awaitModifier){var c=n.getTypeAtLocation(a),u=n.getAsyncIterableType();if(u&&n.isTypeAssignableTo(c,u)){u=a.parent;return void e.replaceNode(r,u,uR.updateForOfStatement(u,uR.createToken(135),u.initializer,u.expression,u.statement))}}if(mj(a))try{for(var _=__values([a.left,a.right]),l=_.next();!l.done;l=_.next()){var d,f=l.value;if(i&&xR(f))if((d=n.getSymbolAtLocation(f))&&i.has(yJ(d)))continue;var p=n.getTypeAtLocation(f),p=n.getPromisedTypeOfPromise(p)?uR.createAwaitExpression(f):f;e.replaceNode(r,f,p)}}catch(e){o={error:e}}finally{try{l&&!l.done&&(s=_.return)&&s.call(_)}finally{if(o)throw o.error}}else if(t===G7&&aj(a.parent)){if(i&&xR(a.parent.expression))if((d=n.getSymbolAtLocation(a.parent.expression))&&i.has(yJ(d)))return;e.replaceNode(r,a.parent.expression,uR.createParenthesizedExpression(uR.createAwaitExpression(a.parent.expression))),n5(e,a.parent.expression,r)}else if(eD(X7,t)&&ME(a.parent)){if(i&&xR(a))if((d=n.getSymbolAtLocation(a))&&i.has(yJ(d)))return;e.replaceNode(r,a,uR.createParenthesizedExpression(uR.createAwaitExpression(a))),n5(e,a,r)}else{if(i&&Aj(a.parent)&&xR(a.parent.name))if((d=n.getSymbolAtLocation(a.parent.name))&&!lD(i,yJ(d)))return;e.replaceNode(r,a,uR.createAwaitExpression(a))}}function n5(e,t,r){var n=tQ(t.pos,r);n&&AZ(n.end,n.parent,r)&&e.insertText(r,t.getStart(r),";")}var a5,i5,o5=e({"src/services/codefixes/addMissingAwait.ts":function(){fpe(),Hoe(),K7="addMissingAwait",G7=mA.Property_0_does_not_exist_on_type_1.code,X7=[mA.This_expression_is_not_callable.code,mA.This_expression_is_not_constructable.code],Q7=__spreadArray([mA.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type.code,mA.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code,mA.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code,mA.Operator_0_cannot_be_applied_to_type_1.code,mA.Operator_0_cannot_be_applied_to_types_1_and_2.code,mA.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap.code,mA.This_condition_will_always_return_true_since_this_0_is_always_defined.code,mA.Type_0_is_not_an_array_type.code,mA.Type_0_is_not_an_array_type_or_a_string_type.code,mA.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher.code,mA.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code,mA.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code,mA.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator.code,mA.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator.code,mA.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,G7],__read(X7),!1),N7({fixIds:[K7],errorCodes:Q7,getCodeActions:function(t){var e=t.sourceFile,r=t.errorCode,n=Z7(e,r,t.span,t.cancellationToken,t.program);if(n){var a=t.program.getTypeChecker(),e=function(e){return ode.ChangeTracker.with(t,e)};return Me([$7(t,n,r,a,e),e5(t,n,r,a,e)])}},getAllCodeActions:function(a){var i=a.sourceFile,o=a.program,s=a.cancellationToken,c=a.program.getTypeChecker(),u=new Set;return I7(a,Q7,function(t,e){var r=Z7(i,e.code,e,s,o);if(r){var n=function(e){return e(t),[]};return $7(a,r,e.code,c,n,u)||e5(a,r,e.code,c,n,u)}})}})}});function s5(e,t,r,n,a){var i=QX(t,r),r=FA(i,function(e){return qE(e.parent)?e.parent.initializer===e:!function(e){switch(e.kind){case 80:case 209:case 210:case 303:case 304:return!0;default:return!1}}(e)&&"quit"});if(r)return c5(e,r,t,a);r=i.parent;if(mj(r)&&64===r.operatorToken.kind&&Sj(r.parent))return c5(e,i,t,a);if(rj(r)){var o=n.getTypeChecker();return XN(r.elements,function(e){return function(e,t){e=xR(e)?e:NL(e,!0)&&xR(e.left)?e.left:void 0;return e&&!t.getSymbolAtLocation(e)}(e,o)})?c5(e,r,t,a):void 0}i=FA(i,function(e){return!!Sj(e.parent)||!function(e){switch(e.kind){case 80:case 226:case 28:return!0;default:return!1}}(e)&&"quit"});if(i&&function t(e,r){if(!mj(e))return!1;if(28===e.operatorToken.kind)return XN([e.left,e.right],function(e){return t(e,r)});return 64===e.operatorToken.kind&&xR(e.left)&&!r.getSymbolAtLocation(e.left)}(i,n.getTypeChecker()))return c5(e,i,t,a)}function c5(e,t,r,n){n&&!lD(n,t)||e.insertModifierBefore(r,87,t)}var u5,_5,l5=e({"src/services/codefixes/addMissingConst.ts":function(){fpe(),Hoe(),a5="addMissingConst",N7({errorCodes:i5=[mA.Cannot_find_name_0.code,mA.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code],getCodeActions:function(t){var e=ode.ChangeTracker.with(t,function(e){return s5(e,t.sourceFile,t.span.start,t.program)});if(0"),[mA.Convert_function_expression_0_to_arrow_function,r?r.text:UG]):(e.replaceNode(t,o,uR.createToken(87)),e.insertText(t,r.end," = "),e.insertText(t,a.pos," =>"),[mA.Convert_function_declaration_0_to_arrow_function,r.text])}}}var gte,hte,xte=e({"src/services/codefixes/fixImplicitThis.ts":function(){fpe(),Hoe(),pte="fixImplicitThis",N7({errorCodes:mte=[mA.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code],getCodeActions:function(e){var t,r=e.sourceFile,n=e.program,a=e.span,e=ode.ChangeTracker.with(e,function(e){t=vte(e,r,a.start,n.getTypeChecker())});return t?[S7(pte,e,t,pte,mA.Fix_all_implicit_this_errors)]:WN},fixIds:[pte],getAllCodeActions:function(r){return I7(r,mte,function(e,t){vte(e,t.file,t.start,r.program.getTypeChecker())})}})}});function bte(e,t,r){var n=QX(e,t);if(xR(n)){t=FA(n,Jj);if(void 0===t)return;t=hR(t.moduleSpecifier)?t.moduleSpecifier.text:void 0;if(void 0===t)return;e=TF(e,t,void 0);if(void 0===e)return;e=r.getSourceFile(e.resolvedFileName);if(void 0===e||d$(r,e))return;r=null==(r=BD(e.symbol.valueDeclaration,KE))?void 0:r.locals;if(void 0===r)return;r=r.get(n.escapedText);if(void 0===r)return;r=function(e){if(void 0===e.valueDeclaration)return kD(e.declarations);var t=e.valueDeclaration,e=Aj(t)?BD(t.parent.parent,Tj):void 0;return e&&1===HN(e.declarationList.declarations)?e:t}(r);return void 0===r?void 0:{exportName:{node:n,isTypeOnly:KM(r)},node:r,moduleSourceFile:e,moduleSpecifier:t}}}function kte(e,t,r,n,a){HN(n)&&(a?Ste(e,t,r,a,n):wte(e,t,r,n))}function Tte(e,t){return YN(e.statements,function(e){return Wj(e)&&(t&&e.isTypeOnly||!e.isTypeOnly)})}function Ste(e,t,r,n,a){var i=n.exportClause&&Hj(n.exportClause)?n.exportClause.elements:uR.createNodeArray([]),t=!(n.isTypeOnly||!sM(t.getCompilerOptions())&&!QN(i,function(e){return e.isTypeOnly}));e.replaceNode(r,n,uR.updateExportDeclaration(n,n.modifiers,n.isTypeOnly,uR.createNamedExports(uR.createNodeArray(__spreadArray(__spreadArray([],__read(i),!1),__read(Cte(a,t)),!1),i.hasTrailingComma)),n.moduleSpecifier,n.assertClause))}function wte(e,t,r,n){e.insertNodeAtEndOfScope(r,r,uR.createExportDeclaration(void 0,!1,uR.createNamedExports(Cte(n,sM(t.getCompilerOptions()))),void 0,void 0))}function Cte(e,t){return uR.createNodeArray(iD(e,function(e){return uR.createExportSpecifier(t&&e.isTypeOnly,void 0,e.node)}))}var Nte,Dte=e({"src/services/codefixes/fixImportNonExportedMember.ts":function(){fpe(),Hoe(),gte="fixImportNonExportedMember",N7({errorCodes:hte=[mA.Module_0_declares_1_locally_but_it_is_not_exported.code],fixIds:[gte],getCodeActions:function(e){var t=e.sourceFile,r=e.span,o=e.program,s=bte(t,r.start,o);if(void 0!==s){e=ode.ChangeTracker.with(e,function(e){return t=e,r=o,a=(n=s).exportName,i=n.node,e=n.moduleSourceFile,void((n=Tte(e,a.isTypeOnly))?Ste(t,r,e,n,[a]):GM(i)?t.insertExportModifier(e,i):wte(t,r,e,[a]));var t,r,n,a,i});return[S7(gte,e,[mA.Export_0_from_module_1,s.exportName.node.text,s.moduleSpecifier],gte,mA.Export_all_referenced_locals)]}},getAllCodeActions:function(e){var i=e.program;return F7(ode.ChangeTracker.with(e,function(n){var a=new Map;O7(e,hte,function(e){var t,r=bte(e.file,e.start,i);void 0!==r&&(t=r.exportName,e=r.node,void 0===Tte(r=r.moduleSourceFile,t.isTypeOnly)&&GM(e)?n.insertExportModifier(r,e):(e=a.get(r)||{typeOnlyExports:[],exports:[]},(t.isTypeOnly?e.typeOnlyExports:e.exports).push(t),a.set(r,e)))}),a.forEach(function(e,t){var r=Tte(t,!0);r&&r.isTypeOnly?(kte(n,i,t,e.typeOnlyExports,r),kte(n,i,t,e.exports,Tte(t,!1))):kte(n,i,t,__spreadArray(__spreadArray([],__read(e.exports),!1),__read(e.typeOnlyExports),!1),r)})}))}})}});var Ate,Ete,Fte=e({"src/services/codefixes/fixIncorrectNamedTupleSyntax.ts":function(){fpe(),Hoe(),Nte="fixIncorrectNamedTupleSyntax",N7({errorCodes:[mA.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type.code,mA.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type.code],getCodeActions:function(e){var t,r=e.sourceFile,n=e.span,a=(t=r,n=n.start,FA(QX(t,n),function(e){return 202===e.kind})),e=ode.ChangeTracker.with(e,function(e){return function(e,t,r){if(r){for(var n=r.type,a=!1,i=!1;190===n.kind||191===n.kind||196===n.kind;)190===n.kind?a=!0:191===n.kind&&(i=!0),n=n.type;var o=uR.updateNamedTupleMember(r,r.dotDotDotToken||(i?uR.createToken(26):void 0),r.name,r.questionToken||(a?uR.createToken(58):void 0),n);o!==r&&e.replaceNode(t,r,o)}}(e,r,a)});return[S7(Nte,e,mA.Move_labeled_tuple_element_modifiers_to_labels,Nte,mA.Move_labeled_tuple_element_modifiers_to_labels)]},fixIds:[Nte]})}});function Pte(e,t,r,n){var a=QX(e,t),t=a.parent;if(n!==mA.No_overload_matches_this_call.code&&n!==mA.Type_0_is_not_assignable_to_type_1.code||$j(t)){var i,o,s,c,u,n=r.program.getTypeChecker();return aj(t)&&t.name===a?(rA.assert(ps(a),"Expected an identifier for spelling (property access)"),i=n.getTypeAtLocation(t.expression),64&t.flags&&(i=n.getNonNullableType(i)),i=n.getSuggestedSymbolForNonexistentProperty(a,i)):mj(t)&&103===t.operatorToken.kind&&t.left===a&&bR(a)?(o=n.getTypeAtLocation(t.right),i=n.getSuggestedSymbolForNonexistentProperty(a,o)):TR(t)&&t.right===a?(o=n.getSymbolAtLocation(t.left))&&1536&o.flags&&(i=n.getSuggestedSymbolForNonexistentModule(t.right,o)):Vj(t)&&t.name===a?(rA.assertNode(a,xR,"Expected an identifier for spelling (import)"),(s=function(e,t,r){if(!r||!oF(r.moduleSpecifier))return;r=TF(e,r.moduleSpecifier.text,VV(e,r.moduleSpecifier));return r?t.program.getSourceFile(r.resolvedFileName):void 0}(e,r,FA(a,Jj)))&&s.symbol&&(i=n.getSuggestedSymbolForNonexistentModule(a,s.symbol))):$j(t)&&t.name===a?(rA.assertNode(a,xR,"Expected an identifier for JSX attribute"),s=FA(a,YE),s=n.getContextualTypeForArgumentAtIndex(s,0),i=n.getSuggestedSymbolForNonexistentJSXAttribute(a,s)):_L(t,16384)&&CE(t)&&t.name===a?(u=(c=(u=FA(a,NE))?yO(u):void 0)?n.getTypeAtLocation(c):void 0)&&(i=n.getSuggestedSymbolForNonexistentClassMember(PF(a),u)):(c=HG(a),u=PF(a),rA.assert(void 0!==u,"name should be defined"),i=n.getSuggestedSymbolForNonexistentSymbol(a,u,function(e){var t=0;4&e&&(t|=1920);2&e&&(t|=788968);1&e&&(t|=111551);return t}(c))),void 0===i?void 0:{node:a,suggestedSymbol:i}}}function Ite(e,t,r,n,a){var i=RA(n);bA(i,a)||!aj(r.parent)||(n=n.valueDeclaration)&&BA(n)&&bR(n.name)?e.replaceNode(t,r,uR.createIdentifier(i)):e.replaceNode(t,r.parent,uR.createElementAccessExpression(r.parent.expression,uR.createStringLiteral(i)))}var Ote,Lte,Mte,Rte,jte,Bte=e({"src/services/codefixes/fixSpelling.ts":function(){fpe(),Hoe(),Ate="fixSpelling",N7({errorCodes:Ete=[mA.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,mA.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code,mA.Cannot_find_name_0_Did_you_mean_1.code,mA.Could_not_find_name_0_Did_you_mean_1.code,mA.Cannot_find_namespace_0_Did_you_mean_1.code,mA.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,mA.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code,mA._0_has_no_exported_member_named_1_Did_you_mean_2.code,mA.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1.code,mA.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1.code,mA.No_overload_matches_this_call.code,mA.Type_0_is_not_assignable_to_type_1.code],getCodeActions:function(e){var t=e.sourceFile,r=e.errorCode,r=Pte(t,e.span.start,e,r);if(r){var n=r.node,a=r.suggestedSymbol,i=rM(e.host.getCompilationSettings());return[S7("spelling",ode.ChangeTracker.with(e,function(e){return Ite(e,t,n,a,i)}),[mA.Change_spelling_to_0,RA(a)],Ate,mA.Fix_all_detected_spelling_errors)]}},fixIds:[Ate],getAllCodeActions:function(n){return I7(n,Ete,function(e,t){var r=Pte(t.file,t.start,n,t.code),t=rM(n.host.getCompilationSettings());r&&Ite(e,n.sourceFile,r.node,r.suggestedSymbol,t)})}})}});function Jte(e,t,r){t=e.createSymbol(4,t.escapedText);t.links.type=e.getTypeAtLocation(r);t=vF([t]);return e.createAnonymousType(void 0,t,[],[],[])}function zte(e,t,r,n){if(t.body&&kj(t.body)&&1===HN(t.body.statements)){var a=SD(t.body.statements);if(Sj(a)&&Ute(e,t,e.getTypeAtLocation(a.expression),r,n))return{declaration:t,kind:0,expression:a.expression,statement:a,commentSource:a.expression};if(Qg(a)&&Sj(a.statement)){var i=uR.createObjectLiteralExpression([uR.createPropertyAssignment(a.label,a.statement.expression)]);if(Ute(e,t,Jte(e,a.label,a.statement.expression),r,n))return lj(t)?{declaration:t,kind:1,expression:i,statement:a,commentSource:a.statement.expression}:{declaration:t,kind:0,expression:i,statement:a,commentSource:a.statement.expression}}else if(kj(a)&&1===HN(a.statements)){var o=SD(a.statements);if(Qg(o)&&Sj(o.statement)){i=uR.createObjectLiteralExpression([uR.createPropertyAssignment(o.label,o.statement.expression)]);if(Ute(e,t,Jte(e,o.label,o.statement.expression),r,n))return{declaration:t,kind:0,expression:i,statement:a,commentSource:o}}}}}function Ute(e,t,r,n,a){return a&&(r=(a=e.getSignatureFromDeclaration(t))?(_L(t,512)&&(r=e.createPromiseType(r)),a=e.createSignature(t,a.typeParameters,a.thisParameter,a.parameters,r,void 0,a.minArgumentCount,a.flags),e.createAnonymousType(void 0,vF(),[a],[],[])):e.getAnyType()),e.isTypeAssignableTo(r,n)}function Vte(e,t,r,n){var a=QX(t,r);if(a.parent){var i=FA(a.parent,TE);switch(n){case mA.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value.code:return i&&i.body&&i.type&&TX(i.type,a)?zte(e,i,e.getTypeFromTypeNode(i.type),!1):void 0;case mA.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code:if(!i||!oj(i.parent)||!i.body)return;var o=i.parent.arguments.indexOf(i);if(-1===o)return;o=e.getContextualTypeForArgumentAtIndex(i.parent,o);return o?zte(e,i,o,!0):void 0;case mA.Type_0_is_not_assignable_to_type_1.code:if(!uO(a)||!kP(a.parent)&&!$j(a.parent))return;o=function(e){switch(e.kind){case 260:case 169:case 208:case 172:case 303:return e.initializer;case 291:return e.initializer&&(dh(e.initializer)?e.initializer.expression:void 0);case 304:case 171:case 306:case 355:case 348:return}}(a.parent);return o&&TE(o)&&o.body?zte(e,o,e.getTypeAtLocation(a.parent),!0):void 0}}}function qte(e,t,r,n){iZ(r);var a=EZ(t);e.replaceNode(t,n,uR.createReturnStatement(r),{leadingTriviaOption:ode.LeadingTriviaOption.Exclude,trailingTriviaOption:ode.TrailingTriviaOption.Exclude,suffix:a?";":void 0})}function Wte(e,t,r,n,a,i){n=i||vZ(n)?uR.createParenthesizedExpression(n):n;iZ(a),cZ(a,n),e.replaceNode(t,r.body,n)}function Hte(e,t,r,n){e.replaceNode(t,r.body,uR.createParenthesizedExpression(n))}var Kte,Gte,Xte,Qte,Yte,Zte=e({"src/services/codefixes/returnValueCorrect.ts":function(){fpe(),Hoe(),Ote="returnValueCorrect",Lte="fixAddReturnStatement",Mte="fixRemoveBracesFromArrowFunctionBody",Rte="fixWrapTheBlockWithParen",N7({errorCodes:jte=[mA.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value.code,mA.Type_0_is_not_assignable_to_type_1.code,mA.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code],fixIds:[Lte,Mte,Rte],getCodeActions:function(e){var t,r,n,a,i,o,s,c,u,_,l=e.program,d=e.sourceFile,f=e.span.start,p=e.errorCode,f=Vte(l.getTypeChecker(),d,f,p);if(f)return 0===f.kind?vD([(c=e,u=f.expression,_=f.statement,p=ode.ChangeTracker.with(c,function(e){return qte(e,c.sourceFile,u,_)}),S7(Ote,p,mA.Add_a_return_statement,Lte,mA.Add_all_missing_return_statement))],lj(f.declaration)?(a=e,i=f.declaration,o=f.expression,s=f.commentSource,p=ode.ChangeTracker.with(a,function(e){return Wte(e,a.sourceFile,i,o,s,!1)}),S7(Ote,p,mA.Remove_braces_from_arrow_function_body,Mte,mA.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues)):void 0):[(t=e,r=f.declaration,n=f.expression,f=ode.ChangeTracker.with(t,function(e){return Hte(e,t.sourceFile,r,n)}),S7(Ote,f,mA.Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal,Rte,mA.Wrap_all_object_literal_with_parentheses))]},getAllCodeActions:function(n){return I7(n,jte,function(e,t){var r=Vte(n.program.getTypeChecker(),t.file,t.start,t.code);if(r)switch(n.fixId){case Lte:qte(e,t.file,r.expression,r.statement);break;case Mte:if(!lj(r.declaration))return;Wte(e,t.file,r.declaration,r.expression,r.commentSource,!1);break;case Rte:if(!lj(r.declaration))return;Hte(e,t.file,r.declaration,r.expression);break;default:rA.fail(JSON.stringify(n.fixId))}})}})}});function $te(e,t,r,n,a){var t=QX(e,t),i=t.parent;if(r===mA.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code){if(19!==t.kind||!nj(i)||!oj(i.parent))return;r=ZN(i.parent.arguments,function(e){return e===i});if(r<0)return;if(!((u=n.getResolvedSignature(i.parent))&&u.declaration&&u.parameters[r]))return;var o=u.parameters[r].valueDeclaration;return o&&CR(o)&&xR(o.name)?HN(s=PD(n.getUnmatchedProperties(n.getTypeAtLocation(i),n.getParameterType(u,r),!1,!1)))?{kind:3,token:o.name,properties:s,parentDeclaration:i}:void 0:void 0}if(ps(t)){if(xR(t)&&nF(i)&&i.initializer&&nj(i.initializer)){o=n.getContextualType(t)||n.getTypeAtLocation(t);return HN(s=PD(n.getUnmatchedProperties(n.getTypeAtLocation(i.initializer),o,!1,!1)))?{kind:3,token:t,properties:s,parentDeclaration:i.initializer}:void 0}if(xR(t)&&YE(t.parent)){var s=function(e,t,r){var n,a,i,o,s=e.getContextualType(r.attributes);if(void 0===s)return WN;s=s.getProperties();if(!HN(s))return WN;var c=new Set;try{for(var u=__values(r.attributes.properties),_=u.next();!_.done;_=u.next()){var l=_.value;if($j(l)&&c.add(nR(l.name)),tB(l)){var d=e.getTypeAtLocation(l.expression);try{for(var f=(i=void 0,__values(d.getProperties())),p=f.next();!p.done;p=f.next()){var m=p.value;c.add(m.escapedName)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}}}}catch(e){n={error:e}}finally{try{_&&!_.done&&(a=u.return)&&a.call(u)}finally{if(n)throw n.error}}return nD(s,function(e){return bA(e.name,t,1)&&!(16777216&e.flags||48&BL(e)||c.has(e.escapedName))})}(n,rM(a.getCompilerOptions()),t.parent);return HN(s)?{kind:4,token:t,attributes:s,parentDeclaration:t.parent}:void 0}if(xR(t)){var c=null==(c=n.getContextualType(t))?void 0:c.getNonNullableType();if(c&&16&WL(c))return void 0===(u=kD(n.getSignaturesOfType(c,0)))?void 0:{kind:5,token:t,signature:u,sourceFile:e,parentDeclaration:fre(t)};if(oj(i)&&i.expression===t)return{kind:2,token:t,call:i,sourceFile:e,modifierFlags:0,parentDeclaration:fre(t)}}if(aj(i)){var c=KQ(n.getTypeAtLocation(i.expression)),u=c.symbol;if(u&&u.declarations){if(xR(t)&&oj(i.parent)){var _=QN(u.declarations,Mj),l=null==_?void 0:_.getSourceFile();if(_&&l&&!d$(a,l))return{kind:2,token:t,call:i.parent,sourceFile:e,modifierFlags:1,parentDeclaration:_};l=QN(u.declarations,uB);if(e.commonJsModuleIndicator)return;if(l&&!d$(a,l))return{kind:2,token:t,call:i.parent,sourceFile:l,modifierFlags:1,parentDeclaration:l}}_=QN(u.declarations,NE);if(_||!bR(t)){e=_||QN(u.declarations,function(e){return Ij(e)||VR(e)});if(e&&!d$(a,e.getSourceFile())){l=!VR(e)&&(c.target||c)!==n.getDeclaredTypeOfSymbol(u);if(l&&(bR(t)||Ij(e)))return;_=e.getSourceFile(),n=VR(e)?0:(l?32:0)|(n$(t.text)?8:0),l=sI(_);return{kind:0,token:t,call:BD(i.parent,oj),modifierFlags:n,parentDeclaration:e,declSourceFile:_,isJSFile:l}}u=QN(u.declarations,Lj);return!u||1056&c.flags||bR(t)||d$(a,u.getSourceFile())?void 0:{kind:1,token:t,parentDeclaration:u}}}}}}function ere(e,t){return t.isJSFile?eA(function(e,t){var r=t.parentDeclaration,n=t.declSourceFile,a=t.modifierFlags,i=t.token;if(Ij(r)||VR(r))return;t=ode.ChangeTracker.with(e,function(e){return tre(e,n,r,i,!!(32&a))});if(0===t.length)return;e=32&a?mA.Initialize_static_property_0:bR(i)?mA.Declare_a_private_field_named_0:mA.Initialize_property_0_in_the_constructor;return S7(Kte,t,[e,i.text],Kte,mA.Add_all_missing_members)}(e,t)):function(e,t){function r(t){return ode.ChangeTracker.with(e,function(e){return are(e,a,n,s,u,t)})}var n=t.parentDeclaration,a=t.declSourceFile,i=t.modifierFlags,o=t.token,s=o.text,c=32&i,u=nre(e.program.getTypeChecker(),n,o),t=[S7(Kte,r(32&i),[c?mA.Declare_static_property_0:mA.Declare_property_0,s],Kte,mA.Add_all_missing_members)];if(c||bR(o))return t;8&i&&t.unshift(T7(Kte,r(8),[mA.Declare_private_property_0,s]));return t.push(function(e,t,r,n,a){var i=uR.createKeywordTypeNode(154),i=uR.createParameterDeclaration(void 0,void 0,"x",void 0,i,void 0),o=uR.createIndexSignature(void 0,[i],a),e=ode.ChangeTracker.with(e,function(e){return e.insertMemberAtStart(t,r,o)});return T7(Kte,e,[mA.Add_index_signature_for_property_0,n])}(e,a,n,o.text,u)),t}(e,t)}function tre(e,t,r,n,a){var i,o=n.text;a?231!==r.kind&&(i=r.name.getText(),i=rre(uR.createIdentifier(i),o),e.insertNodeAfter(t,r,i)):bR(n)?(i=uR.createPropertyDeclaration(void 0,o,void 0,void 0,void 0),(n=ire(r))?e.insertNodeAfter(t,n,i):e.insertMemberAtStart(t,r,i)):(r=XO(r))&&(o=rre(uR.createThis(),o),e.insertNodeAtConstructorEnd(t,r,o))}function rre(e,t){return uR.createExpressionStatement(uR.createAssignment(uR.createPropertyAccessExpression(e,t),dre()))}function nre(e,t,r){var n;return(226===r.parent.parent.kind?(n=r.parent.parent,n=r.parent===n.left?n.right:n.left,n=e.getWidenedType(e.getBaseTypeOfLiteralType(e.getTypeAtLocation(n))),e.typeToTypeNode(n,t,1)):(r=e.getContextualType(r.parent))?e.typeToTypeNode(r,void 0,1):void 0)||uR.createKeywordTypeNode(133)}function are(e,t,r,n,a,i){i=i?uR.createNodeArray(uR.createModifiersFromModifierFlags(i)):void 0,n=NE(r)?uR.createPropertyDeclaration(i,n,void 0,a,void 0):uR.createPropertySignature(void 0,n,void 0,a),a=ire(r);a?e.insertNodeAfter(t,a,n):e.insertMemberAtStart(t,r,n)}function ire(e){var t,r,n;try{for(var a=__values(e.members),i=a.next();!i.done;i=a.next()){var o=i.value;if(!AR(o))break;n=o}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return n}function ore(e,t,r,n,a,i,o){var s=yee(o,e.program,e.preferences,e.host),a=Gae(NE(i)?174:173,e,s,r,n,a,i),r=function(e,t){if(VR(e))return;t=FA(t,function(e){return FR(e)||IR(e)});return t&&t.parent===e?t:void 0}(i,r);r?t.insertNodeAfter(o,r,a):t.insertMemberAtStart(o,i,a),s.writeFixes(t)}function sre(e,t,r){var n=r.token,a=r.parentDeclaration,r=dD(a.members,function(e){e=t.getTypeAtLocation(e);return!!(e&&402653316&e.flags)}),n=uR.createEnumMember(n,r?uR.createStringLiteral(n.text):void 0);e.replaceNode(a.getSourceFile(),a,uR.updateEnumDeclaration(a,a.modifiers,a.name,fD(a.members,eA(n))),{leadingTriviaOption:ode.LeadingTriviaOption.IncludeAll,trailingTriviaOption:ode.TrailingTriviaOption.Exclude})}function cre(e,t,r){var n=iY(t.sourceFile,t.preferences),a=yee(t.sourceFile,t.program,t.preferences,t.host),n=2===r.kind?Gae(262,t,a,r.call,LA(r.token),r.modifierFlags,r.parentDeclaration):Kae(262,t,n,r.signature,tie(mA.Function_not_implemented.message,n),r.token,void 0,void 0,void 0,a);void 0===n&&rA.fail("fixMissingFunctionDeclaration codefix got unexpected error."),Kg(r.parentDeclaration)?e.insertNodeBefore(r.sourceFile,r.parentDeclaration,n,!0):e.insertNodeAtEndOfScope(r.sourceFile,r.parentDeclaration,n),a.writeFixes(e)}function ure(e,r,n){var a=yee(r.sourceFile,r.program,r.preferences,r.host),i=iY(r.sourceFile,r.preferences),o=r.program.getTypeChecker(),t=n.parentDeclaration.attributes,s=dD(t.properties,tB),c=iD(n.attributes,function(e){var t=lre(r,o,a,i,o.getTypeOfSymbol(e),n.parentDeclaration),e=uR.createIdentifier(e.name),t=uR.createJsxAttribute(e,uR.createJsxExpression(void 0,t));return jM(e,t),t}),s=uR.createJsxAttributes(s?__spreadArray(__spreadArray([],__read(c),!1),__read(t.properties),!1):__spreadArray(__spreadArray([],__read(t.properties),!1),__read(c),!1)),c={prefix:t.pos===t.end?" ":void 0};e.replaceNode(r.sourceFile,t,s,c),a.writeFixes(e)}function _re(e,r,n){var a=yee(r.sourceFile,r.program,r.preferences,r.host),i=iY(r.sourceFile,r.preferences),o=rM(r.program.getCompilerOptions()),s=r.program.getTypeChecker(),t=iD(n.properties,function(e){var t=lre(r,s,a,i,s.getTypeOfSymbol(e),n.parentDeclaration);return uR.createPropertyAssignment(function(e,t,r,n){if(gF(e)){n=n.symbolToNode(e,111551,void 0,1073741824);if(n&&SR(n))return n}return WM(e.name,t,0===r)}(e,o,i,s),t)}),c={leadingTriviaOption:ode.LeadingTriviaOption.Exclude,trailingTriviaOption:ode.TrailingTriviaOption.Exclude,indentation:n.indentation};e.replaceNode(r.sourceFile,n.parentDeclaration,uR.createObjectLiteralExpression(__spreadArray(__spreadArray([],__read(n.parentDeclaration.properties),!1),__read(t),!1),!0),c),a.writeFixes(e)}function lre(r,n,a,i,e,o){if(3&e.flags)return dre();if(134217732&e.flags)return uR.createStringLiteral("",0===i);if(8&e.flags)return uR.createNumericLiteral(0);if(64&e.flags)return uR.createBigIntLiteral("0n");if(16&e.flags)return uR.createFalse();if(1056&e.flags){var t=e.symbol.exports?TD(e.symbol.exports.values()):e.symbol,s=n.symbolToExpression(e.symbol.parent||e.symbol,111551,void 0,void 0);return void 0===t||void 0===s?uR.createNumericLiteral(0):uR.createPropertyAccessExpression(s,n.symbolToString(t))}if(256&e.flags)return uR.createNumericLiteral(e.value);if(2048&e.flags)return uR.createBigIntLiteral(e.value);if(128&e.flags)return uR.createStringLiteral(e.value,0===i);if(512&e.flags)return e===n.getFalseType()||e===n.getFalseType(!0)?uR.createFalse():uR.createTrue();if(65536&e.flags)return uR.createNull();if(1048576&e.flags){var c=GN(e.types,function(e){return lre(r,n,a,i,e,o)});return null!=c?c:dre()}if(n.isArrayLikeType(e))return uR.createArrayLiteralExpression();if(524288&(c=e).flags&&(128&WL(c)||c.symbol&&BD(pa(c.symbol.declarations),VR))){c=iD(n.getPropertiesOfType(e),function(e){var t=lre(r,n,a,i,n.getTypeOfSymbol(e),o);return uR.createPropertyAssignment(e.name,t)});return uR.createObjectLiteralExpression(c,!0)}if(16&WL(e)){if(void 0===QN(e.symbol.declarations||WN,ZD(JR,ER,FR)))return dre();var u=n.getSignaturesOfType(e,0);if(void 0===u)return dre();u=Kae(218,r,i,u[0],tie(mA.Function_not_implemented.message,i),void 0,void 0,void 0,o,a);return null!=u?u:dre()}if(1&WL(e)){u=qL(e.symbol);if(void 0===u||pL(u))return dre();u=XO(u);return u&&HN(u.parameters)?dre():uR.createNewExpression(uR.createIdentifier(e.symbol.name),void 0,void 0)}return dre()}function dre(){return uR.createIdentifier("undefined")}function fre(e){if(FA(e,dh)){var t=FA(e.parent,Kg);if(t)return t}return CF(e)}var pre,mre,yre=e({"src/services/codefixes/fixAddMissingMember.ts":function(){fpe(),Hoe(),Kte="fixMissingMember",Gte="fixMissingProperties",Xte="fixMissingAttributes",Qte="fixMissingFunctionDeclaration",N7({errorCodes:Yte=[mA.Property_0_does_not_exist_on_type_1.code,mA.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,mA.Property_0_is_missing_in_type_1_but_required_in_type_2.code,mA.Type_0_is_missing_the_following_properties_from_type_1_Colon_2.code,mA.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more.code,mA.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,mA.Cannot_find_name_0.code],getCodeActions:function(t){var e=t.program.getTypeChecker(),r=$te(t.sourceFile,t.span.start,t.errorCode,e,t.program);if(r){if(3===r.kind){var n=ode.ChangeTracker.with(t,function(e){return _re(e,t,r)});return[S7(Gte,n,mA.Add_missing_properties,Gte,mA.Add_all_missing_properties)]}if(4===r.kind){n=ode.ChangeTracker.with(t,function(e){return ure(e,t,r)});return[S7(Xte,n,mA.Add_missing_attributes,Xte,mA.Add_all_missing_attributes)]}if(2===r.kind||5===r.kind){n=ode.ChangeTracker.with(t,function(e){return cre(e,t,r)});return[S7(Qte,n,[mA.Add_missing_function_declaration_0,r.token.text],Qte,mA.Add_all_missing_function_declarations)]}if(1!==r.kind)return fD(function(r,e){var n=e.parentDeclaration,a=e.declSourceFile,t=e.modifierFlags,i=e.token,o=e.call;if(void 0!==o){var s=i.text,c=function(t){return ode.ChangeTracker.with(r,function(e){return ore(r,e,o,i,t,n,a)})},e=[S7(Kte,c(32&t),[32&t?mA.Declare_static_method_0:mA.Declare_method_0,s],Kte,mA.Add_all_missing_members)];return 8&t&&e.unshift(T7(Kte,c(8),[mA.Declare_private_method_0,s])),e}}(t,r),ere(t,r));n=ode.ChangeTracker.with(t,function(e){return sre(e,t.program.getTypeChecker(),r)});return[S7(Kte,n,[mA.Add_missing_enum_member_0,r.token.text],Kte,mA.Add_all_missing_members)]}},fixIds:[Kte,Qte,Gte,Xte],getAllCodeActions:function(u){var e=u.program,n=u.fixId,_=e.getTypeChecker(),a=new Map,l=new Map;return F7(ode.ChangeTracker.with(u,function(c){O7(u,Yte,function(e){var t,r=$te(e.file,e.start,e.code,_,u.program);r&&Zf(a,mJ(r.parentDeclaration)+"#"+r.token.text)&&(n!==Qte||2!==r.kind&&5!==r.kind?n===Gte&&3===r.kind?_re(c,u,r):n===Xte&&4===r.kind?ure(c,u,r):(1===r.kind&&sre(c,_,r),0===r.kind&&(e=r.parentDeclaration,t=r.token,(e=_D(l,e,function(){return[]})).some(function(e){return e.token.text===t.text})||e.push(r))):cre(c,u,r))}),l.forEach(function(e,t){var r,n,s=VR(t)?void 0:vie(t,_);try{for(var a=__values(e),i=a.next();!i.done;i=a.next())!function(t){var e,r,n,a,i,o;null!=s&&s.some(function(e){e=l.get(e);return!!e&&e.some(function(e){return e.token.text===t.token.text})})||(e=t.parentDeclaration,r=t.declSourceFile,n=t.modifierFlags,a=t.token,i=t.call,o=t.isJSFile,i&&!bR(a)?ore(u,c,i,a,32&n,e,r):!o||Ij(e)||VR(e)?(o=nre(_,e,a),are(c,r,e,a.text,o,32&n)):tre(c,r,e,a,!!(32&n)))}(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}})}))}})}});function vre(e,t,r){var n=JD(function(e,t){var r=QX(e,t.start),n=TA(t);for(;r.end":">","}":"}"}}});function Sne(e,t){var r=QX(e,t);if(r.parent&&wB(r.parent)&&xR(r.parent.name)){var n=r.parent,e=YI(n),t=XI(n);if(e&&t)return{jsDocHost:e,signature:t,name:r.parent.name,jsDocParameterTag:n}}}var wne,Cne=e({"src/services/codefixes/fixUnmatchedParameter.ts":function(){fpe(),Hoe(),xne="deleteUnmatchedParameter",bne="renameUnmatchedParameter",kne=[mA.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name.code],N7({fixIds:[xne,bne],errorCodes:kne,getCodeActions:function(e){var t,r,n,a,i,o=[],s=Sne(e.sourceFile,e.span.start);if(s)return vD(o,(t=e,n=(r=s).name,a=r.jsDocHost,i=r.jsDocParameterTag,r=ode.ChangeTracker.with(t,function(e){return e.filterJSDocTags(t.sourceFile,a,function(e){return e!==i})}),S7(xne,r,[mA.Delete_unused_param_tag_0,n.getText(t.sourceFile)],xne,mA.Delete_all_unused_param_tags))),vD(o,function(e,t){var r,n,a=t.name,i=t.jsDocHost,o=t.signature,s=t.jsDocParameterTag;if(HN(o.parameters)){var c=e.sourceFile,u=YA(o),_=new Set;try{for(var l=__values(u),d=l.next();!d.done;d=l.next()){var f=d.value;wB(f)&&xR(f.name)&&_.add(f.name.escapedText)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}o=GN(o.parameters,function(e){return xR(e.name)&&!_.has(e.name.escapedText)?e.name.getText(c):void 0});if(void 0!==o){var p=uR.updateJSDocParameterTag(s,s.tagName,uR.createIdentifier(o),s.isBracketed,s.typeExpression,s.isNameFirst,s.comment),e=ode.ChangeTracker.with(e,function(e){return e.replaceJSDocComment(c,i,iD(u,function(e){return e===s?p:e}))});return T7(bne,e,[mA.Rename_param_tag_name_0_to_1,a.getText(c),o])}}}(e,s)),o},getAllCodeActions:function(a){var t=new Map;return F7(ode.ChangeTracker.with(a,function(n){O7(a,kne,function(e){e=Sne(e.file,e.start);e&&t.set(e.signature,vD(t.get(e.signature),e.jsDocParameterTag))}),t.forEach(function(e,t){var r;a.fixId===xne&&(r=new Set(e),n.filterJSDocTags(t.getSourceFile(),t,function(e){return!r.has(e)}))})}))}})}});var Nne,Dne,Ane,Ene,Fne,Pne,Ine=e({"src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts":function(){fpe(),Hoe(),wne="fixUnreferenceableDecoratorMetadata",N7({errorCodes:[mA.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled.code],getCodeActions:function(o){var s=function(e,t,r){if((r=BD(QX(e,r),xR))&&183===r.parent.kind){r=t.getTypeChecker().getSymbolAtLocation(r);return QN((null==r?void 0:r.declarations)||WN,ZD(zj,Vj,Bj))}}(o.sourceFile,o.program,o.span.start);if(s){var e,t=ode.ChangeTracker.with(o,function(e){return 276===s.kind&&(t=e,r=o.sourceFile,n=s,e=o.program,void I4.doChangeNamedToNamespaceOrDefault(r,e,t,n.parent));var t,r,n}),r=ode.ChangeTracker.with(o,function(e){return t=e,r=o.sourceFile,n=s,a=o.program,void(271!==n.kind?(e=273===n.kind?n:n.parent.parent).name&&e.namedBindings||(i=a.getTypeChecker(),BI(e,function(e){if(111551&Uf(e.symbol,i).flags)return!0})||t.insertModifierBefore(r,156,e)):t.insertModifierBefore(r,156,n.name));var t,r,n,a,i});return t.length&&(e=vD(e,T7(wne,t,mA.Convert_named_imports_to_namespace_import))),r.length&&(e=vD(e,T7(wne,r,mA.Use_import_type))),e}},fixIds:[wne]})}});function One(e,t,r){e.replaceNode(t,r.parent,uR.createKeywordTypeNode(159))}function Lne(e,t){return S7(Nne,e,t,Ane,mA.Delete_all_unused_declarations)}function Mne(e,t,r){e.delete(t,rA.checkDefined(JD(r.parent,C_).typeParameters,"The type parameter to delete should exist"))}function Rne(e){return 102===e.kind||80===e.kind&&(276===e.parent.kind||273===e.parent.kind)}function jne(e){return 102===e.kind?BD(e.parent,Jj):void 0}function Bne(e,t){return Ej(t.parent)&&SD(t.parent.getChildren(e))===t}function Jne(e,t,r){e.delete(t,243===r.parent.kind?r.parent:r)}function zne(t,e,r,n){e!==mA.Property_0_is_declared_but_its_value_is_never_read.code&&(140===n.kind&&(n=JD(n.parent,Tg).typeParameter.name),xR(n)&&function(e){switch(e.parent.kind){case 169:case 168:return!0;case 260:switch(e.parent.parent.parent.kind){case 250:case 249:return!0}}return!1}(n)&&(t.replaceNode(r,n,uR.createIdentifier("_".concat(n.text))),CR(n.parent)&&VA(n.parent).forEach(function(e){xR(e.name)&&t.replaceNode(r,e.name,uR.createIdentifier("_".concat(e.name.text)))})))}function Une(r,e,n,t,a,i,o,s){var c,u,_,l,d,f;c=n,u=r,_=t,l=a,d=i,f=o,a=s,CR(o=(i=e).parent)?function(e,t,r,n,a,i){var o,s;if(void 0===i&&(i=!1),function(e,t,r,n,a,i,o){var s,c,u,_,l=r.parent;switch(l.kind){case 174:case 176:var d=l.parameters.indexOf(r),f=FR(l)?l.name:l,p=pue.Core.getReferencedSymbolsForNode(l.pos,f,a,n,i);if(p)try{for(var m=__values(p),y=m.next();!y.done;y=m.next()){var v=y.value;try{for(var g=(u=void 0,__values(v.references)),h=g.next();!h.done;h=g.next()){var x=h.value;if(x.kind===pue.EntryKind.Node){var b=yg(x.node)&&oj(x.node.parent)&&x.node.parent.arguments.length>d,k=aj(x.node.parent)&&yg(x.node.parent.expression)&&oj(x.node.parent.parent)&&x.node.parent.parent.arguments.length>d,x=(FR(x.node.parent)||ER(x.node.parent))&&x.node.parent!==r.parent&&x.node.parent.parameters.length>d;if(b||k||x)return!1}}}catch(e){u={error:e}}finally{try{h&&!h.done&&(_=g.return)&&_.call(g)}finally{if(u)throw u.error}}}}catch(e){s={error:e}}finally{try{y&&!y.done&&(c=m.return)&&c.call(m)}finally{if(s)throw s.error}}return!0;case 262:return!l.name||!function(e,t,r){return!!pue.Core.eachSymbolReferenceInFile(r,e,t,function(e){return xR(e)&&oj(e.parent)&&0<=e.parent.arguments.indexOf(e)})}(e,t,l.name)||qne(l,r,o);case 218:case 219:return qne(l,r,o);case 178:return!1;case 177:return!0;default:return rA.failBadSyntaxKind(l)}}(n,t,r,a,d,f,i))if(r.modifiers&&0n})}function qne(e,t,r){e=e.parameters,t=e.indexOf(t);return rA.assert(-1!==t,"The parameter should already be in the list"),r?e.slice(t+1).every(function(e){return xR(e.name)&&!e.symbol.isReferenced}):t===e.length-1}var Wne,Hne,Kne=e({"src/services/codefixes/fixUnusedIdentifier.ts":function(){fpe(),Hoe(),Nne="unusedIdentifier",Dne="unusedIdentifier_prefix",Ane="unusedIdentifier_delete",Ene="unusedIdentifier_deleteImports",Fne="unusedIdentifier_infer",N7({errorCodes:Pne=[mA._0_is_declared_but_its_value_is_never_read.code,mA._0_is_declared_but_never_used.code,mA.Property_0_is_declared_but_its_value_is_never_read.code,mA.All_imports_in_import_declaration_are_unused.code,mA.All_destructured_elements_are_unused.code,mA.All_variables_are_unused.code,mA.All_type_parameters_are_unused.code],getCodeActions:function(o){var t=o.errorCode,s=o.sourceFile,r=o.program,n=o.cancellationToken,a=r.getTypeChecker(),i=r.getSourceFiles(),c=QX(s,o.span.start);if(DB(c))return[Lne(ode.ChangeTracker.with(o,function(e){return e.delete(s,c)}),mA.Remove_template_tag)];if(30===c.kind)return[Lne(e=ode.ChangeTracker.with(o,function(e){return Mne(e,s,c)}),mA.Remove_type_parameters)];var u=jne(c);if(u){var e=ode.ChangeTracker.with(o,function(e){return e.delete(s,u)});return[S7(Nne,e,[mA.Remove_import_from_0,Qf(u)],Ene,mA.Delete_all_unused_imports)]}if(Rne(c)&&(d=ode.ChangeTracker.with(o,function(e){return Une(s,c,e,a,i,r,n,!1)})).length)return[S7(Nne,d,[mA.Remove_unused_declaration_for_Colon_0,c.getText(s)],Ene,mA.Delete_all_unused_imports)];if($R(c.parent)||ej(c.parent)){if(CR(c.parent.parent)){var _=c.parent.elements,l=[1<_.length?mA.Remove_unused_declarations_for_Colon_0:mA.Remove_unused_declaration_for_Colon_0,iD(_,function(e){return e.getText(s)}).join(", ")];return[Lne(ode.ChangeTracker.with(o,function(e){return t=e,r=s,void KN(c.parent.elements,function(e){return t.delete(r,e)});var t,r}),l)]}return[Lne(ode.ChangeTracker.with(o,function(e){return t=o,r=e,n=s,a=c.parent,void(Aj(i=a.parent)&&i.initializer&&LE(i.initializer)?Ej(i.parent)&&1O.length?(L=y.getSignatureFromDeclaration(p[p.length-1]),j(C,L,k,B(h),J(n,C))):(rA.assert(p.length===O.length,"Declarations and signatures should match count"),c(function(e,t,r,n,a,i,o,s,c){var u,_,l=n[0],d=n[0].minArgumentCount,f=!1;try{for(var p=__values(n),m=p.next();!m.done;m=p.next()){var y=m.value;d=Math.min(y.minArgumentCount,d),bJ(y)&&(f=!0),y.parameters.length>=l.parameters.length&&(!bJ(y)||bJ(l))&&(l=y)}}catch(e){u={error:e}}finally{try{m&&!m.done&&(_=p.return)&&_.call(p)}finally{if(u)throw u.error}}var v=l.parameters.length-(bJ(l)?1:0),g=l.parameters.map(function(e){return e.name}),h=$ae(v,g,void 0,d,!1);f&&(v=uR.createParameterDeclaration(void 0,uR.createToken(26),g[v]||"rest",d<=v?uR.createToken(58):void 0,uR.createArrayTypeNode(uR.createKeywordTypeNode(159)),void 0),h.push(v));return function(e,t,r,n,a,i,o,s){return uR.createMethodDeclaration(e,void 0,t,r?uR.createToken(58):void 0,n,a,i,s||eie(o))}(o,a,i,void 0,h,function(e,t,r,n){if(HN(e)){e=t.getUnionType(iD(e,t.getReturnTypeOfSignature));return t.typeToTypeNode(e,n,1,Wae(r))}}(n,e,t,r),s,c)}(y,o,i,O,B(h),S&&!!(1&u),k,C,n))))}function j(e,t,r,n,a){r=Kae(174,o,e,t,a,n,r,S&&!!(1&u),i,s);r&&c(r)}function B(e){return xR(e)&&"constructor"===e.escapedText?uR.createComputedPropertyName(uR.createStringLiteral(LA(e),0===C)):eZ(e,!1)}function J(e,t,r){return r?void 0:eZ(e,!1)||eie(t)}function z(e){return eZ(e,!1)}}function Kae(e,t,r,n,a,i,o,s,c,u){var _=t.program,l=_.getTypeChecker(),d=rM(_.getCompilerOptions()),f=cI(c),r=524545|(0===r?268435456:0),e=l.signatureToSignatureDeclaration(n,e,c,r,Wae(t));if(e){var p,c=f?void 0:e.typeParameters,r=e.parameters,t=f?void 0:e.type;u&&(!c||c!==(p=oD(c,function(e){var t,r=e.constraint,n=e.default;return r&&(t=oie(r,d))&&(r=t.typeNode,cie(u,t.symbols)),n&&(t=oie(n,d))&&(n=t.typeNode,cie(u,t.symbols)),uR.updateTypeParameterDeclaration(e,e.modifiers,e.name,r,n)}))&&(c=UB(uR.createNodeArray(p,c.hasTrailingComma),c)),r!==(p=oD(r,function(e){var t,r=f?void 0:e.type;return!r||(t=oie(r,d))&&(r=t.typeNode,cie(u,t.symbols)),uR.updateParameterDeclaration(e,e.modifiers,e.dotDotDotToken,e.name,f?void 0:e.questionToken,r,e.initializer)}))&&(r=UB(uR.createNodeArray(p,r.hasTrailingComma),r)),!t||(m=oie(t,d))&&(t=m.typeNode,cie(u,m.symbols)));var m=s?uR.createToken(58):void 0,s=e.asteriskToken;return _j(e)?uR.updateFunctionExpression(e,o,e.asteriskToken,BD(i,xR),c,r,t,null!=a?a:e.body):lj(e)?uR.updateArrowFunction(e,o,c,r,t,e.equalsGreaterThanToken,null!=a?a:e.body):FR(e)?uR.updateMethodDeclaration(e,o,s,null!=i?i:uR.createIdentifier(""),m,c,r,t,a):Fj(e)?uR.updateFunctionDeclaration(e,o,e.asteriskToken,BD(i,xR),c,r,t,null!=a?a:e.body):void 0}}function Gae(e,t,r,n,a,i,o){var s=iY(t.sourceFile,t.preferences),c=rM(t.program.getCompilerOptions()),u=Wae(t),_=t.program.getTypeChecker(),l=cI(o),d=n.typeArguments,f=n.arguments,p=n.parent,m=l?void 0:_.getContextualType(n),t=iD(f,function(e){return xR(e)?e.text:aj(e)&&xR(e.name)?e.name.text:void 0}),n=l?[]:iD(f,function(e){return _.getTypeAtLocation(e)}),n=Zae(_,r,n,o,c,1,u),c=n.argumentTypeNodes,n=n.argumentTypeParameters,y=i?uR.createNodeArray(uR.createModifiersFromModifierFlags(i)):void 0,v=Og(p)?uR.createToken(42):void 0,g=l?void 0:function(r,e,t){var n=new Set(e.map(function(e){return e[0]})),a=new Map(e);if(t)for(var t=t.filter(function(t){return!e.some(function(e){return r.getTypeAtLocation(t)===(null==(e=e[1])?void 0:e.argumentType)})}),i=n.size+t.length,o=0;n.size} */(")):(!o||2&o.flags)&&e.insertText(t,n.parent.parent.expression.end,"")))))}var Moe=e({"src/services/codefixes/fixAddVoidToPromise.ts":function(){fpe(),Hoe(),Poe="addVoidToPromise",N7({errorCodes:Ioe=[mA.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code,mA.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code],fixIds:[Poe],getCodeActions:function(t){var e=ode.ChangeTracker.with(t,function(e){return Loe(e,t.sourceFile,t.span,t.program)});if(0"),r=IQ(r.tagName),e={name:e,kind:"class",kindModifiers:void 0,sortText:Joe.LocationPriority};return{isGlobalCompletion:!1,isMemberCompletion:!0,isNewIdentifierLocation:!1,optionalReplacementSpan:r,entries:[e]}}return}(b,e);if(R)return R}R=FA(v,fh);{var j;R&&(vg(v)||cO(v,R.expression))&&(j=f$(M,R.parent.clauses),L=L.filter(function(e){return!j.hasValue(e)}),y.forEach(function(e,t){e.valueDeclaration&&cB(e.valueDeclaration)&&(void 0!==(e=M.getConstantValue(e.valueDeclaration))&&j.hasValue(e)&&(S[t]={kind:256}))}))}var B=[],R=cse(e,n);if(R&&!x&&(!y||0===y.length)&&0===T)return;var J,z=hse(y,B,void 0,v,b,c,e,t,r,rM(n),a,g,o,n,s,N,k,D,C,F,w,S,I,D,A,u);if(0!==T)try{for(var U=__values(Fse(T,!P&&sI(e))),V=U.next();!V.done;V=U.next()){var q=V.value;(N&&JQ(Ai(q.name))||!z.has(q.name))&&(z.add(q.name),Q(B,q,ese,!0))}}catch(e){_={error:e}}finally{try{V&&!V.done&&(l=U.return)&&l.call(U)}finally{if(_)throw _.error}}try{for(var W=__values(function(e,t){var r=[];{var n,a,i;e&&(n=e.getSourceFile(),a=e.parent,i=n.getLineAndCharacterOfPosition(e.end).line,t=n.getLineAndCharacterOfPosition(t).line,(Jj(a)||Wj(a)&&a.moduleSpecifier)&&e===a.moduleSpecifier&&i===t&&r.push({name:yA[132],kind:"keyword",kindModifiers:"",sortText:Joe.GlobalsOrKeywords}))}return r}(v,c)),H=W.next();!H.done;H=W.next()){q=H.value;z.has(q.name)||(z.add(q.name),Q(B,q,ese,!0))}}catch(e){d={error:e}}finally{try{H&&!H.done&&(f=W.return)&&f.call(W)}finally{if(d)throw d.error}}try{for(var K=__values(L),G=K.next();!G.done;G=K.next()){var X=G.value,X=function(e,t,r){return{name:lse(e,t,r),kind:"string",kindModifiers:"",sortText:Joe.LocationPriority}}(e,o,X);z.add(X.name),Q(B,X,ese,!0)}}catch(e){p={error:e}}finally{try{G&&!G.done&&(m=K.return)&&m.call(K)}finally{if(p)throw p.error}}R||function(r,n,a,i){T8(e).forEach(function(e,t){e!==r&&(t=OA(t),!n.has(t)&&bA(t,a)&&(n.add(t),Q(i,{name:t,kind:"warning",kindModifiers:"",sortText:Joe.JavascriptIdentifiers,isFromUncheckedFile:!0},ese)))})}(b.pos,z,rM(n),B);!o.includeCompletionsWithInsertText||!v||A||E||!(J=FA(v,eh))||(s=use(J,e,o,n,t,r,s))&&B.push(s.entry);return{flags:i.flags,isGlobalCompletion:h,isIncomplete:!(!o.allowIncompleteCompletions||!O)||void 0,isMemberCompletion:function(e){switch(e){case 0:case 3:case 2:return!0;default:return!1}}(g),isNewIdentifierLocation:x,optionalReplacementSpan:sse(b),entries:B}}(n,e,t,f,r,v,i,u,a,_);return null!=g&&g.isIncomplete&&null!=m&&m.set(g),g;case 1:return rse(__spreadArray(__spreadArray([],__read(a_e.getJSDocTagNameCompletions()),!1),__read(nse(n,a,p,f,i,!0)),!1));case 2:return rse(__spreadArray(__spreadArray([],__read(a_e.getJSDocTagCompletions()),!1),__read(nse(n,a,p,f,i,!1)),!1));case 3:return rse(a_e.getJSDocParameterNameCompletions(v.tag));case 4:return g=v.keywordCompletions,{isGlobalCompletion:!1,isMemberCompletion:!1,isNewIdentifierLocation:v.isNewIdentifierLocation,entries:g.slice()};default:return rA.assertNever(v)}}}function ese(e,t){var r,n,a=ke(e.sortText,t.sortText);return 0===a&&(a=ke(e.name,t.name)),0===a&&null!=(r=e.data)&&r.moduleSpecifier&&null!=(n=t.data)&&n.moduleSpecifier&&(a=fm(e.data.moduleSpecifier,t.data.moduleSpecifier)),0===a?-1:a}function tse(e){return null!=e&&e.moduleSpecifier}function rse(e){return{isGlobalCompletion:!1,isMemberCompletion:!1,isNewIdentifierLocation:!1,entries:e}}function nse(e,t,i,o,s,c){var r=QX(e,t);if(!Fc(r)&&!kh(r))return[];var n=kh(r)?r:r.parent;if(!kh(n))return[];r=n.parent;if(!bE(r))return[];var u=sI(e),_=s.includeCompletionsWithSnippetText||void 0,l=rD(n.tags,function(e){return wB(e)&&e.getEnd()<=t});return uD(r.parameters,function(e){if(!VA(e).length){if(xR(e.name)){var t=e.name.text,r=ise(t,e.initializer,e.dotDotDotToken,u,!1,!1,i,o,s),n=_?ise(t,e.initializer,e.dotDotDotToken,u,!1,!0,i,o,s,{tabstop:1}):void 0;return c&&(r=r.slice(1),n=n&&n.slice(1)),{name:r,kind:"parameter",sortText:Joe.LocationPriority,insertText:_?n:void 0,isSnippet:_}}if(e.parent.parameters.indexOf(e)===l){var a="param".concat(l),t=ase(a,e.name,e.initializer,e.dotDotDotToken,u,!1,i,o,s),e=_?ase(a,e.name,e.initializer,e.dotDotDotToken,u,!0,i,o,s):void 0,r=t.join(vf(o)+"* "),n=null==e?void 0:e.join(vf(o)+"* ");return c&&(r=r.slice(1),n=n&&n.slice(1)),{name:r,kind:"parameter",sortText:Joe.LocationPriority,insertText:_?n:void 0,isSnippet:_}}}})}function ase(e,t,r,n,f,p,m,y,v){return f?g(e,t,r,n,{tabstop:1}):[ise(e,r,n,f,!1,p,m,y,v,{tabstop:1})];function g(e,t,r,n,a){var i,o;if($R(t)&&!n){var s={tabstop:a.tabstop},c=ise(e,r,n,f,!0,p,m,y,v,s),u=[];try{for(var _=__values(t.elements),l=_.next();!l.done;l=_.next()){var d=function(e,t,r){{var n;if(!t.propertyName&&xR(t.name)||xR(t.name))return(n=t.propertyName?E_(t.propertyName):t.name.text)?[ise("".concat(e,".").concat(n),t.initializer,t.dotDotDotToken,f,!1,p,m,y,v,r)]:void 0;if(t.propertyName)return(n=E_(t.propertyName))&&g("".concat(e,".").concat(n),t.name,t.initializer,t.dotDotDotToken,r)}return}(e,l.value,s);if(!d){u=void 0;break}u.push.apply(u,__spreadArray([],__read(d),!1))}}catch(e){i={error:e}}finally{try{l&&!l.done&&(o=_.return)&&o.call(_)}finally{if(i)throw i.error}}if(u)return a.tabstop=s.tabstop,__spreadArray([c],__read(u),!1)}return[ise(e,r,n,f,!1,p,m,y,v,a)]}}function ise(e,t,r,n,a,i,o,s,c,u){if(i&&rA.assertIsDefined(u),t&&(e=function(e,t){t=t.getText().trim();if(t.includes("\n")||80gA(t,e.getEnd()).line)return{modifiers:0};var n,a=0,i={pos:r,end:r};AR(e.parent)&&e.parent.modifiers&&(a|=126975&bL(e.parent.modifiers),n=e.parent.modifiers.filter(NR)||[],i.pos=Math.min(i.pos,e.parent.modifiers.pos));(t=function(e){if(gE(e))return e.kind;if(xR(e)){e=MA(e);if(e&&js(e))return e}return}(e))&&(t=kL(t),a&t||(a|=t,i.pos=Math.min(i.pos,e.pos)));return{modifiers:a,decorators:n,range:i.pos!==r?i:void 0}}(c,a,s),c=y.modifiers,s=y.range,y=y.decorators,v=256&c&&256&_.modifierFlagsCache,g=[];if(Roe.addNewNodeForMemberSymbol(i,_,a,{program:t,host:e},n,r,function(e){var t=0;v&&(t|=256),CE(e)&&1===p.getMemberOverrideModifierStatus(_,e,i)&&(t|=16384),g.length||(m=e.modifierFlagsCache|t),e=uR.updateModifiers(e,m),g.push(e)},h,Roe.PreserveOptionalFlags.Property,!!v),g.length){var n=8192&i.flags,h=16388|m,n=c&(h|=n?512:66);if(c&~h)return;16&m&&4&n&&(m&=-17),0==n||4&n||(m&=-5),m|=n,g=g.map(function(e){return uR.updateModifiers(e,m)}),null==y||!y.length||qB(n=g[g.length-1])&&(g[g.length-1]=uR.updateModifierLike(n,y.concat(UA(n)||[])));d=u?o.printAndFormatSnippetList(131073,uR.createNodeArray(g),a,u):o.printSnippetList(131073,uR.createNodeArray(g),a)}return{insertText:d,filterText:f,isSnippet:l,importAdder:r,eraseRange:s}}}function pse(e,t,r,n,a,i,o,s){var c=o.includeCompletionsWithSnippetText||void 0,u=t,t=r.getSourceFile(),o=function(e,t,r,n,a,i){var o=e.getDeclarations();if(!o||!o.length)return;var s=n.getTypeChecker(),o=o[0],c=eZ(JA(o),!1),u=s.getWidenedType(s.getTypeOfSymbolAtLocation(e,t)),_=33554432|(0===iY(r,i)?268435456:0);switch(o.kind){case 171:case 172:case 173:case 174:var l=1048576&u.flags&&u.types.length<10?s.getUnionType(u.types,2):u;if(1048576&l.flags){var d=nD(l.types,function(e){return 0=N.pos&&i&&a=e.pos;case 25:return 207===r;case 59:return 208===r;case 23:return 207===r;case 21:return 299===r||ie(r);case 19:return 266===r;case 30:return 263===r||231===r||264===r||265===r||Vs(r);case 126:return 172===r&&!NE(t.parent);case 26:return 169===r||!!t.parent&&207===t.parent.kind;case 125:case 123:case 124:return 169===r&&!IR(t.parent);case 130:return 276===r||281===r||274===r;case 139:case 153:return!Jse(e);case 80:if(276===r&&e===t.name&&"type"===e.text)return!1;break;case 86:case 94:case 120:case 100:case 115:case 102:case 121:case 87:case 140:return!0;case 156:return 276!==r;case 42:return bE(e.parent)&&!FR(e.parent)}if(Ose(Mse(e))&&Jse(e))return!1;if(ne(e)&&(!xR(e)||Bs(Mse(e))||ue(e)))return!1;switch(Mse(e)){case 128:case 86:case 87:case 138:case 94:case 100:case 120:case 121:case 123:case 124:case 125:case 126:case 115:return!0;case 134:return AR(e.parent)}if(FA(e.parent,NE)&&e===y&&ae(e,f))return!1;var n=xO(e.parent,172);if(n&&e!==y&&NE(y.parent.parent)&&f<=y.end){if(ae(e,y.end))return!1;if(64!==e.kind&&(NJ(n)||rF(n)))return!0}return uO(e)&&!oB(e.parent)&&!$j(e.parent)&&!((NE(e.parent)||Ij(e.parent)||wR(e.parent))&&(e!==y||f>y.end))}(S)||function(e){if(9!==e.kind)return!1;e=e.getFullText();return"."===e.charAt(e.length-1)}(S)||function(e){if(12===e.kind)return!0;if(32===e.kind&&e.parent){if(I===e.parent&&(286===I.kind||285===I.kind))return!1;if(286===e.parent.kind)return 286!==I.parent.kind;if(287===e.parent.kind||285===e.parent.kind)return!!e.parent.parent&&284===e.parent.parent.kind}return!1}(S)||Vv(S),e("getCompletionsAtPosition: isCompletionListBlocker: "+(ht()-w)),S))return e("Returning an empty list because completion was requested in an invalid position."),O?ose(O,_,re()):void 0;var j=b.parent;if(25===b.kind||29===b.kind)switch(N=25===b.kind,D=29===b.kind,j.kind){case 211:C=(k=j).expression;if(EF(XL(k))||(oj(C)||bE(C))&&C.end===b.pos&&C.getChildCount(v)&&22!==ND(C.getChildren(v)).kind)return;break;case 166:C=j.left;break;case 267:C=j.name;break;case 205:C=j;break;case 236:C=j.getFirstToken(v),rA.assert(102===C.kind||105===C.kind);break;default:return}else if(!T){if(j&&211===j.kind&&(j=(b=j).parent),r.parent===I)switch(r.kind){case 32:284!==r.parent.kind&&286!==r.parent.kind||(I=r);break;case 44:285===r.parent.kind&&(I=r)}switch(j.kind){case 287:44===b.kind&&(E=!0,I=b);break;case 226:if(!zse(j))break;case 285:case 284:case 286:P=!0,30===b.kind&&(A=!0,I=b);break;case 294:case 293:(20===y.kind||80===y.kind&&291===y.parent.kind)&&(P=!0);break;case 291:if(j.initializer===y&&y.end=e.pos&&t<=e.end});if(!o)return;var s=e.text.slice(o.pos,t),c=Yse.exec(s);if(!c)return;a=__read(c,4),i=a[1],s=a[2],c=a[3],a=lA(e.path),e="path"===s?yce(c,a,mce(r,0,e),n,!0,e.path):"types"===s?Tce(n,r,a,xce(c),mce(r,1,e)):rA.fail();return fce(c,o.pos+i.length,PD(e.values()))}(e,t,n,a))&&nce(u);if(iQ(e,t,r)&&(r&&oF(r)))return function(e,t,r,n,a,i,o,s,c,u){if(void 0===e)return;var _=OQ(t);switch(e.kind){case 0:return nce(e.paths);case 1:var l=[];return hse(e.symbols,l,t,t,r,c,r,n,a,99,i,4,s,o,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,u),{isGlobalCompletion:!1,isMemberCompletion:!0,isNewIdentifierLocation:e.hasIndexSignature,optionalReplacementSpan:_,entries:l};case 2:l=e.types.map(function(e){return{name:e.value,kindModifiers:"",kind:"string",sortText:Joe.LocationPriority,replacementSpan:PQ(t)}});return{isGlobalCompletion:!1,isMemberCompletion:!1,isNewIdentifierLocation:e.isNewIdentifier,optionalReplacementSpan:_,entries:l};default:return rA.assertNever(e)}}(u=ice(e,r,t,i.getTypeChecker(),n,a,s),r,e,a,i,o,n,s,t,c)}function rce(e,t,r,n,a,i,o,s,c){if(n&&oF(n)){c=ice(t,n,r,a,i,o,c);return c&&function(t,e,r,n,a,i){switch(r.kind){case 0:return(o=QN(r.paths,function(e){return e.name===t}))&&Sse(t,ace(o.extension),o.kind,[OY(t)]);case 1:var o;return(o=QN(r.symbols,function(e){return e.name===t}))&&Tse(o,o.name,a,n,e,i);case 2:return QN(r.types,function(e){return e.value===t})?Sse(t,"","string",[OY(t)]):void 0;default:return rA.assertNever(r)}}(e,n,c,t,a,s)}}function nce(e){return{isGlobalCompletion:!1,isMemberCompletion:!1,isNewIdentifierLocation:!0,entries:e.map(function(e){var t=e.name,r=e.kind,n=e.span;return{name:t,kind:r,kindModifiers:ace(e.extension),sortText:Joe.LocationPriority,replacementSpan:n}})}}function ace(e){switch(e){case".d.ts":return".d.ts";case".js":return".js";case".json":return".json";case".jsx":return".jsx";case".ts":return".ts";case".tsx":return".tsx";case".d.mts":return".d.mts";case".mjs":return".mjs";case".mts":return".mts";case".d.cts":return".d.cts";case".cjs":return".cjs";case".cts":return".cts";case".tsbuildinfo":return rA.fail("Extension ".concat(".tsbuildinfo"," is unsupported."));case void 0:return"";default:return rA.assertNever(e)}}function ice(e,t,i,o,r,n,a){var s=oce(t.parent);switch(s.kind){case 201:var c=oce(s.parent);return 205===c.kind?{kind:0,paths:pce(e,t,r,n,o,a)}:function e(t){switch(t.kind){case 233:case 183:var r=FA(s,function(e){return e.parent===t});return r?{kind:2,types:_ce(o.getTypeArgumentConstraint(r)),isNewIdentifier:!1}:void 0;case 199:var r=t.indexType,n=t.objectType;return wX(r,i)?uce(o.getTypeFromTypeNode(n)):void 0;case 192:var n=e(oce(t.parent));if(!n)return;var a=sce(t,s);return 1===n.kind?{kind:1,symbols:n.symbols.filter(function(e){return!eD(a,e.name)}),hasIndexSignature:n.hasIndexSignature}:{kind:2,types:n.types.filter(function(e){return!eD(a,e.value)}),isNewIdentifier:!1};default:return}}(c);case 303:return nj(s.parent)&&s.name===t?function(e,t){var r=e.getContextualType(t);if(!r)return;var n=e.getContextualType(t,4);return{kind:1,symbols:Rse(r,n,t,e),hasIndexSignature:kZ(r)}}(o,s.parent):d()||d(0);case 212:var u=s.expression,c=s.argumentExpression;return t===oO(c)?uce(o.getTypeAtLocation(u)):void 0;case 213:case 214:case 291:if(!(oj((u=t).parent)&&kD(u.parent.arguments)===u&&xR(u.parent.expression)&&"require"===u.parent.expression.escapedText||mP(s))){var _=dle.getArgumentInfoForCompletions(291===s.kind?s.parent:t,i,e);return _&&(cce(_.invocation,t,_,o)||cce(_.invocation,t,_,o,0))||d(0)}case 272:case 278:case 283:return{kind:0,paths:pce(e,t,r,n,o,a)};case 296:var l=f$(o,s.parent.clauses),_=d();return _?{kind:2,types:_.types.filter(function(e){return!l.hasValue(e.value)}),isNewIdentifier:!1}:void 0;default:return d()||d(0)}function d(e){void 0===e&&(e=4);e=_ce(gZ(t,o,e));if(e.length)return{kind:2,types:e,isNewIdentifier:!1}}}function oce(e){switch(e.kind){case 196:return nO(e);case 217:return aO(e);default:return e}}function sce(e,t){return uD(e.types,function(e){return e!==t&&YR(e)&&hR(e.literal)?e.literal.text:void 0})}function cce(r,e,n,a,t){void 0===t&&(t=32);var i=!1,o=new Map,s=[],c=YE(r)?rA.checkDefined(FA(e.parent,$j)):e;a.getResolvedSignatureForStringLiteralCompletions(r,c,s,t);s=cD(s,function(e){if(bJ(e)||!(n.argumentCount>e.parameters.length)){var t=e.getTypeParameterAtPosition(n.argumentIndex);return!YE(r)||(e=a.getTypeOfPropertyOfType(t,aR(c.name)))&&(t=e),i=i||!!(4&t.flags),_ce(t,o)}});return HN(s)?{kind:2,types:s,isNewIdentifier:i}:void 0}function uce(e){return e&&{kind:1,symbols:nD(e.getApparentProperties(),function(e){return!e.valueDeclaration||!yE(e.valueDeclaration)}),hasIndexSignature:kZ(e)}}function _ce(e,t){return void 0===t&&(t=new Map),e?(e=KQ(e)).isUnion()?cD(e.types,function(e){return _ce(e,t)}):!e.isStringLiteral()||1024&e.flags||!Zf(t,e.value)?WN:[e]:WN}function lce(e,t,r){return{name:e,kind:t,extension:r}}function dce(e){return lce(e,"directory",void 0)}function fce(e,t,r){var n,a,i,o,s=(n=e,a=t,i=Math.max(n.lastIndexOf(ca),n.lastIndexOf(ua)),o=-1!==i?i+1:0,0==(i=n.length-o)||bA(n.substr(o,i),99)?void 0:So(a+o,i)),c=0===e.length?void 0:So(t,e.length);return r.map(function(e){var t=e.name,r=e.kind,e=e.extension;return-1!==Math.max(t.indexOf(ca),t.indexOf(ua))?{name:t,kind:r,extension:e,span:c}:{name:t,kind:r,extension:e,span:s}})}function pce(e,t,r,n,a,i){return fce(t.text,t.getStart(e)+1,(o=e,s=r,c=n,e=a,r=i,a=La((n=t).text),i=oF(n)?VV(o,n):void 0,t=o.path,n=lA(t),r=mce(s,1,o,e,r,i),function(e){if(e&&2<=e.length&&46===e.charCodeAt(0)){var t=3<=e.length&&46===e.charCodeAt(1)?2:1,t=e.charCodeAt(t);return 47===t||92===t}return!1}(a)||!s.baseUrl&&!s.paths&&(ka(a)||ba(a))?function(e,t,r,n,a,i){return r.rootDirs?function(e,t,r,n,a,i,o){var s=a.project||i.getCurrentDirectory(),a=!(i.useCaseSensitiveFileNames&&i.useCaseSensitiveFileNames());return cD(function(e,t,r,n){var a=GN(e=e.map(function(e){return pi(ka(e)?e:dA(t,e))}),function(e){return Ga(e,r,t,n)?r.substr(e.length):void 0});return mD(__spreadArray(__spreadArray([],__read(e.map(function(e){return dA(e,a)})),!1),[r],!1),cr,ge)}(e,s,r,a),function(e){return PD(yce(t,e,n,i,!0,o).values())})}(r.rootDirs,e,t,i,r,n,a):PD(yce(e,t,i,n,!0,a).values())}(a,n,s,c,t,r):function(o,e,s,c,u,_,t){var r,n,a,i,l=c.baseUrl,d=c.paths,f=ece(),p=iM(c);l&&(m=pi(dA(u.getCurrentDirectory(),l)),yce(o,m,_,u,!1,void 0,f));{var m;d&&(m=Dd(c,u),gce(f,o,m,_,u,d))}var y=xce(o);try{for(var v=__values(function(t,e,r){r=r.getAmbientModules().map(function(e){return UO(e.name)}).filter(function(e){return XD(e,t)&&e.indexOf("*")<0});if(void 0===e)return r;var n=Ua(e);return r.map(function(e){return QD(e,n)})}(o,y,t)),g=v.next();!g.done;g=v.next()){var h=g.value;f.add(lce(h,"external module name",void 0))}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=v.return)&&n.call(v)}finally{if(r)throw r.error}}if(Tce(u,c,e,y,_,f),eY(p)){var x,b=!1;if(void 0===y)try{for(var k=__values(function(e,t){var r,n,a,i;if(!e.readFile||!e.fileExists)return WN;var o=[];try{for(var s=__values(RZ(t,e)),c=s.next();!c.done;c=s.next()){var u=mf(c.value,e);try{for(var _=(a=void 0,__values(Zse)),l=_.next();!l.done;l=_.next()){var d=l.value,f=u[d];if(f)for(var p in f)ma(f,p)&&!XD(p,"@types/")&&o.push(p)}}catch(e){a={error:e}}finally{try{l&&!l.done&&(i=_.return)&&i.call(_)}finally{if(a)throw a.error}}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}(u,e)),T=k.next();!T.done;T=k.next()){var S=lce(T.value,"external module name",void 0);f.has(S.name)||(b=!0,f.add(S))}}catch(e){a={error:e}}finally{try{T&&!T.done&&(i=k.return)&&i.call(k)}finally{if(a)throw a.error}}b||(p=function(e){e=dA(e,"node_modules");OZ(u,e)&&yce(o,e,_,u,!1,void 0,f)},y&&Op(c)&&(x=p,p=function(e){var t=Ia(o);t.shift();var r=t.shift();if(!r)return x(e);if(XD(r,"@")){var n=t.shift();if(!n)return x(e);r=dA(r,n)}n=dA(e,"node_modules",r),r=dA(n,"package.json");if(IZ(u,r)){var a=mf(r,u).exports;if(a){if("object"!=typeof a||null===a)return;var r=G(a),t=t.join("/")+(t.length&&Ca(o)?"/":""),i=bS(c,99===s);return void hce(f,t,n,_,u,r,function(e){return eA(function e(t,r){if("string"==typeof t)return t;if(t&&"object"==typeof t&&!RD(t))for(var n in t)if("default"===n||-1r.end);){var c=s+o;0!==s&&no(a.charCodeAt(s-1),99)||c!==i&&no(a.charCodeAt(c),99)||n.push(s),s=a.indexOf(t,s+o+1)}return n}function w(e,t){var r=e.getSourceFile(),n=t.text,e=uD(P(r,n,e),function(e){return e===t||cX(e)&&oX(e,n)===t?Kce(e):void 0});return[{definition:{type:1,node:t},references:e}]}function D(e,t,r,n){return void 0===n&&(n=!0),r.cancellationToken.throwIfCancellationRequested(),c(e,e,t,r,n),0}function c(e,t,r,n,a){var i,o;if(n.markSearchedSymbols(t,r.allSearchSymbols))try{for(var s=__values(u(t,r.text,e)),c=s.next();!c.done;c=s.next())!function(e,t,r,n,a){var i=GX(e,t);if(!function(e,t){switch(e.kind){case 81:if(dB(e.parent))return 1;case 80:return e.text.length===t.length;case 15:case 11:var r=e;return(vX(r)||mX(e)||gX(e)||oj(e.parent)&&DI(e.parent)&&e.parent.arguments[1]===e)&&r.text.length===t.length;case 9:return vX(e)&&e.text.length===t.length;case 90:return"default".length===t.length;default:return}}(i,r.text))return!n.options.implementations&&(n.options.findInStrings&&iQ(e,t)||n.options.findInComments&&EQ(e,t))&&n.addStringOrCommentReference(e.fileName,So(t,r.text.length));if(A(i,n)){var o=n.checker.getSymbolAtLocation(i);if(o&&(!Vj(t=i.parent)||t.propertyName!==i)){if(Kj(t))return rA.assert(80===i.kind),C(i,o,t,r,n,a),0;var s=function(a,i,e,r){var n=r.checker;return O(i,e,n,!1,2!==r.options.use||!!r.options.providePrefixAndSuffixTextForRename,function(e,t,r,n){return r&&L(i)!==L(r)&&(r=void 0),a.includes(r||t||e)?{symbol:!t||6&BL(e)?e:t,kind:n}:void 0},function(t){return!a.parents||a.parents.some(function(e){return function t(e,r,n,a){if(e===r)return!0;var i=yJ(e)+","+yJ(r);var o=n.get(i);if(void 0!==o)return o;n.set(i,!1);var e=!!e.declarations&&e.declarations.some(function(e){return Bl(e).some(function(e){var e=a.getTypeAtLocation(e);return!!e&&!!e.symbol&&t(e.symbol,r,n,a)})});n.set(i,e);return e}(t.parent,e,r.inheritsFromCache,n)})})}(r,o,i,n);if(!s)return function(e,t,r){var n=e.flags,a=e.valueDeclaration,e=r.checker.getShorthandAssignmentValueSymbol(a),a=a&&JA(a);33554432&n||!a||!t.includes(e)||F(a,e,r)}(o,r,n),0;switch(n.specialSearchKind){case 0:a&&F(i,s,n);break;case 1:!function(e,t,r,n){function a(){return n.referenceAdder(r.symbol)}XG(e)&&F(e,r.symbol,n),NE(e.parent)?(rA.assert(90===e.kind||e.parent.name===e),function(e,t,r){var n,a,i=_(e);if(i&&i.declarations)try{for(var o=__values(i.declarations),s=o.next();!s.done;s=o.next()){var c=s.value,u=MX(c,137,t);rA.assert(176===c.kind&&!!u),r(u)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(n)throw n.error}}e.exports&&e.exports.forEach(function(e){e=e.valueDeclaration;!e||174!==e.kind||(e=e.body)&&l(e,110,function(e){XG(e)&&r(e)})})}(r.symbol,t,a())):(e=function(e){return af(aX(e).parent)}(e))&&(function(e,t){var r,n,a=_(e.symbol);if(a&&a.declarations)try{for(var i=__values(a.declarations),o=i.next();!o.done;o=i.next()){var s=o.value;rA.assert(176===s.kind);s=s.body;s&&l(s,108,function(e){GG(e)&&t(e)})}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}(e,a()),function(e,t){var r;!function(e){return!!_(e.symbol)}(e)&&(r=e.symbol,e=t.createSearch(void 0,r,void 0),p(r,t,e))}(e,n))}(i,e,r,n);break;case 2:!function(e,t,r){var n,a;F(e,t.symbol,r);var i=e.parent;if(2!==r.options.use&&NE(i)){rA.assert(i.name===e);var o=r.referenceAdder(t.symbol);try{for(var s=__values(i.members),c=s.next();!c.done;c=s.next()){var u=c.value;qs(u)&&lL(u)&&u.body&&u.body.forEachChild(function e(t){110===t.kind?o(t):bE(t)||NE(t)||t.forEachChild(e)})}}catch(e){n={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}}}(i,r,n);break;default:rA.assertNever(n.specialSearchKind)}cI(i)&&tj(i.parent)&&fI(i.parent.parent.parent)&&!(o=i.parent.symbol)||function(e,t,r,n){(t=Mce(e,t,n.checker,1===r.comingFrom))&&(r=t.symbol,0===t.kind?R(n.options)||d(r,n):S(e,r,t.exportInfo,n))}(i,o,r,n)}}}(t,c.value,r,n,a)}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}function A(e,t){return HG(e)&t.searchMeaning}function C(e,t,r,n,a,i,o){rA.assert(!o||!!a.options.providePrefixAndSuffixTextForRename,"If alwaysGetReferences is true, then prefix/suffix text must be enabled");var s=r.parent,c=r.propertyName,u=r.name,s=s.parent,_=E(e,t,r,a.checker);function l(){i&&F(e,_,a)}(o||n.includes(_))&&(c?e===c?(s.moduleSpecifier||l(),i&&2!==a.options.use&&a.markSeenReExportRHS(u)&&F(u,rA.checkDefined(r.symbol),a)):a.markSeenReExportRHS(e)&&l():2===a.options.use&&"default"===u.escapedText||l(),R(a.options)&&!o||(u="default"===e.escapedText||"default"===r.name.escapedText?1:0,(u=Rce(o=rA.checkDefined(r.symbol),u,a.checker))&&S(e,o,u,a)),1===n.comingFrom||!s.moduleSpecifier||c||R(a.options)||(r=a.checker.getExportSpecifierLocalTargetSymbol(r))&&d(r,a))}function E(e,t,r,n){return a=e,o=(i=r).parent,e=i.propertyName,i=i.name,rA.assert(e===a||i===a),(e?e===a:!o.parent.moduleSpecifier)&&n.getExportSpecifierLocalTargetSymbol(r)||t;var a,i,o}function F(e,t,r){var n="kind"in t?t:{kind:void 0,symbol:t},t=n.kind,n=n.symbol;2===r.options.use&&90===e.kind||(n=r.referenceAdder(n),r.options.implementations?function(e,t,r){if(uO(e)&&function(e){return 33554432&e.flags?!(Ij(e)||Oj(e)):kP(e)?nF(e):TE(e)?!!e.body:NE(e)||WE(e)}(e.parent))return t(e);if(80===e.kind){304===e.parent.kind&&i(e,r.checker,t);var n=function e(t){return xR(t)||aj(t)?e(t.parent):hj(t)?BD(t.parent.parent,ZD(NE,Ij)):void 0}(e);if(n)return t(n);n=FA(e,function(e){return!TR(e.parent)&&!FE(e.parent)&&!Ks(e.parent)}),rF(e=n.parent)&&e.type===n&&r.markSeenContainingTypeReference(e)&&(nF(e)?a(e.initializer):bE(e)&&e.body?241===(r=e.body).kind?gP(r,function(e){e.expression&&a(e.expression)}):a(r):BE(e)&&a(e.expression))}function a(e){!function e(t){switch(t.kind){case 217:return e(t.expression);case 219:case 218:case 210:case 231:case 209:return!0;default:return!1}}(e)||t(e)}}(e,n,r):n(e,t))}function _(e){return e.members&&e.members.get("__constructor")}function I(e){return 80===e.kind&&169===e.parent.kind&&e.parent.name===e}function O(e,t,c,r,n,u,_){var a=S8(t);if(a){var i=c.getShorthandAssignmentValueSymbol(t.parent);if(i&&r)return u(i,void 0,void 0,3);var o=c.getContextualType(a.parent);if(l=o&&GN(w8(a,c,o,!0),function(e){return f(e,4)}))return l;o=(a=c,DQ((o=t).parent.parent)?a.getPropertySymbolOfDestructuringAssignment(o):void 0),o=o&&u(o,void 0,void 0,4);if(o)return o;i=i&&u(i,void 0,void 0,3);if(i)return i}i=v(t,e,c);if(i&&(l=u(i,void 0,void 0,1)))return l;i=f(e);if(i)return i;if(e.valueDeclaration&&CA(e.valueDeclaration,e.valueDeclaration.parent)){var s=c.getSymbolsOfParameterPropertyDeclaration(JD(e.valueDeclaration,CR),e.name);return rA.assert(2===s.length&&!!(1&s[0].flags)&&!!(4&s[1].flags)),f(1&e.flags?s[1]:s[0])}s=mF(e,281);if(!r||s&&!s.propertyName){var l,s=s&&c.getExportSpecifierLocalTargetSymbol(s);if(s)if(l=u(s,void 0,void 0,1))return l}if(r)return rA.assert(r),n?(d=p(e,c))&&f(d,4):void 0;var d=void 0;return(d=n?_Y(t.parent)?lY(c,t.parent):void 0:p(e,c))&&f(d,4);function f(r,s){return GN(c.getRootSymbols(r),function(t){return u(r,t,void 0,s)||(t.parent&&96&t.parent.flags&&_(t)?(e=t.parent,n=t.name,a=c,i=function(e){return u(r,t,e,s)},o=new Map,function r(e){if(!(96&e.flags&&Zf(o,yJ(e))))return;return GN(e.declarations,function(e){return GN(Bl(e),function(e){var t=a.getTypeAtLocation(e),e=t&&t.symbol&&a.getPropertyOfType(t,n);return t&&e&&(GN(a.getRootSymbols(e),i)||r(t.symbol))})})}(e)):void 0);var e,n,a,i,o})}function p(e,t){e=mF(e,208);if(e&&_Y(e))return lY(t,e)}}function L(e){return!!e.valueDeclaration&&!!(32&xL(e.valueDeclaration))}function M(e,t){var r,n,a=HG(e),i=t.declarations;if(i){var o;do{o=a;try{for(var s=(r=void 0,__values(i)),c=s.next();!c.done;c=s.next()){var u=WG(c.value);u&a&&(a|=u)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}}while(a!==o)}return a}function i(e,t,r){var n,a,e=t.getSymbolAtLocation(e),i=t.getShorthandAssignmentValueSymbol(e.valueDeclaration);if(i)try{for(var o=__values(i.getDeclarations()),s=o.next();!s.done;s=o.next()){var c=s.value;1&WG(c)&&r(c)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(n)throw n.error}}}function l(e,t,r){HB(e,function(e){e.kind===t&&r(e),l(e,t,r)})}function R(e){return 2===e.use&&e.providePrefixAndSuffixTextForRename}e.eachExportReference=function(e,t,r,n,a,i,o,s){var c,u,_,l,d,f,p,m,y=(a=Pce(e,new Set(e.map(function(e){return e.fileName})),t,r)(n,{exportKind:o?1:0,exportingModuleSymbol:a},!1)).importSearches,v=a.indirectUsers,g=a.singleReferences;try{for(var h=__values(y),x=h.next();!x.done;x=h.next())s(__read(x.value,1)[0])}catch(e){c={error:e}}finally{try{x&&!x.done&&(u=h.return)&&u.call(h)}finally{if(c)throw c.error}}try{for(var b=__values(g),k=b.next();!k.done;k=b.next()){var T=k.value;xR(T)&&ZR(T.parent)&&s(T)}}catch(e){_={error:e}}finally{try{k&&!k.done&&(l=b.return)&&l.call(b)}finally{if(_)throw _.error}}try{for(var S=__values(v),w=S.next();!w.done;w=S.next()){var C=w.value;try{for(var N=(p=void 0,__values(P(C,o?"default":i))),D=N.next();!D.done;D=N.next()){var A=D.value,E=t.getSymbolAtLocation(A),F=dD(null==E?void 0:E.declarations,function(e){return!!BD(e,qj)});!xR(A)||fE(A.parent)||E!==n&&!F||s(A)}}catch(e){p={error:e}}finally{try{D&&!D.done&&(m=N.return)&&m.call(N)}finally{if(p)throw p.error}}}}catch(e){d={error:e}}finally{try{w&&!w.done&&(f=S.return)&&f.call(S)}finally{if(d)throw d.error}}},e.isSymbolReferencedInFile=function(e,t,r,n){return void 0===n&&(n=r),a(e,t,r,function(){return!0},n)||!1},e.eachSymbolReferenceInFile=a,e.getTopMostDeclarationNamesInFile=function(e,t){return nD(P(t,e),Ml).reduce(function(e,t){var r=function(e){var t=0;for(;e;)e=hX(e),t++;return t}(t);return dD(e.declarationNames)&&r!==e.depth?rIue?e.substr(0,Iue-"...".length)+"...":e),position:t,kind:"Type",whitespaceBefore:!0})}function s(e){var t;e.initializer||void 0!==(t=x.getConstantValue(e))&&(t=t.toString(),e=e.end,i.push({text:"= ".concat(t),position:e,kind:"Enum",whitespaceBefore:!0}))}function c(e){return e.symbol&&1536&e.symbol.flags}function u(e){var t;!e.initializer||PE(e.name)||Aj(e)&&!p(e)||nL(e)||(c(t=x.getTypeAtLocation(e))||(t=f(t))&&(!1===v.includeInlayVariableTypeHintsWhenTypeMatchesName&&sr(e.name.getText(),t)||o(t,e.name.end)))}function _(e){var t,r,n=e.arguments;if(n&&n.length){var a=[],i=x.getResolvedSignatureForSignatureHelp(e,a);if(i&&a.length){var o=0;try{for(var s=__values(n),c=s.next();!c.done;c=s.next()){var u=c.value,_=oO(u);if("literals"!==v.includeInlayParameterNameHints||k(_)){var l=0;if(yj(_)){var d=x.getTypeAtLocation(_.expression);if(x.isTupleType(d)){var f=d.target,p=f.elementFlags,f=f.fixedLength;if(0===f)continue;p=ZN(p,function(e){return!(1&e)});0<(p<0?f:p)&&(l=p<0?f:p)}}var m,f=x.getParameterIdentifierInfoAtPosition(i,o);o+=l||1,f&&(p=f.parameter,l=f.parameterName,f=f.isRestParameter,!v.includeInlayParameterNameHintsWhenArgumentMatchesName&&function(e,t){if(xR(e))return e.text===t;if(aj(e))return e.name.text===t;return!1}(_,l)&&!f||function(e,t){if(!bA(t,h.target,Tp(y.scriptKind)))return!1;e=$i(g,e.pos);if(null==e||!e.length)return!1;var r=Oue(t);return dD(e,function(e){return r.test(g.substring(e.pos,e.end))})}(_,m=OA(l))||b(m,p,u.getStart(),f))}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}}}}function k(e){switch(e.kind){case 224:var t=e.operand;return lE(t)||xR(t)&&zM(t.escapedText);case 112:case 97:case 106:case 15:case 228:return 1;case 80:t=e.escapedText;return"undefined"===t||zM(t)}return lE(e)}function l(e){var t;lj(e)&&!MX(e,21,y)||aL(e)||!e.body||(t=x.getSignatureFromDeclaration(e))&&(c(t=x.getReturnTypeOfSignature(t))||(t=f(t))&&o(t,function(e){var t=MX(e,22,y);if(t)return t.end;return e.parameters.end}(e)))}function d(e){var t=x.getSignatureFromDeclaration(e);if(t)for(var r=0;r...")}(i);case 288:return function(e){e=wo(e.openingFragment.getStart(o),e.closingFragment.getEnd());return J_e(e,"code",e,!1,"<>...")}(i);case 285:case 286:return function(e){return 0!==e.properties.length?j_e(e.getStart(o),e.getEnd(),"code"):void 0}(i.attributes);case 228:case 15:return function(e){return 15!==e.kind||0!==e.text.length?j_e(e.getStart(o),e.getEnd(),"code"):void 0}(i);case 207:return r(i,!1,!tj(i.parent),23);case 219:return function(e){if(kj(e.body)||uj(e.body)||If(e.body.getFullStart(),e.body.getEnd(),o))return;return J_e(wo(e.body.getFullStart(),e.body.getEnd()),"code",IQ(e))}(i);case 213:return function(e){if(!e.arguments.length)return;var t=MX(e,21,o),r=MX(e,22,o);return t&&r&&!If(t.pos,r.pos,o)?B_e(t,r,e,o,!1,!0):void 0}(i);case 217:return function(e){return If(e.getStart(),e.getEnd(),o)?void 0:J_e(wo(e.getStart(),e.getEnd()),"code",IQ(e))}(i);case 275:case 279:case 300:return function(e){if(!e.elements.length)return;var t=MX(e,19,o),r=MX(e,20,o);return t&&r&&!If(t.pos,r.pos,o)?B_e(t,r,e,o,!1,!1):void 0}(i)}function t(e,t){return void 0===t&&(t=19),r(e,!1,!rj(e.parent)&&!oj(e.parent),t)}function r(e,t,r,n,a){void 0===t&&(t=!1),void 0===r&&(r=!0),void 0===n&&(n=19),void 0===a&&(a=19===n?20:24);n=MX(i,n,o),a=MX(i,a,o);return n&&a&&B_e(n,a,e,o,t,r)}}(e,r))&&a.push(t),i--,oj(e)?(i++,u(e.expression),i--,e.arguments.forEach(u),null!=(t=e.typeArguments)&&t.forEach(u)):wj(e)&&e.elseStatement&&wj(e.elseStatement)?(u(e.expression),u(e.thenStatement),i++,u(e.elseStatement),i--):e.forEachChild(u),i++)}}(e,t,r),function(e,t){var r,n,a=[],i=e.getLineStarts();try{for(var o=__values(i),s=o.next();!s.done;s=o.next()){var c,u=s.value,_=e.getLineEndOfPosition(u),l=L_e(e.text.substring(u,_));l&&!yQ(e,u)&&(l[1]?(c=a.pop())&&(c.textSpan.length=_-c.textSpan.start,c.hintSpan.length=_-c.textSpan.start,t.push(c)):(_=wo(e.text.indexOf("//",u),_),a.push(J_e(_,"region",_,!1,l[2]||"#region"))))}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}(e,r),r.sort(function(e,t){return e.textSpan.start-t.textSpan.start})}function L_e(e){return XD(e=V(e),"//")?(e=h(e.slice(2)),P_e.exec(e)):null}function M_e(e,t,r,n){var a,i,o=$i(t.text,e);if(o){var s=-1,c=-1,u=0,_=t.getFullText();try{for(var l=__values(o),d=l.next();!d.done;d=l.next()){var f=d.value,p=f.kind,m=f.pos,y=f.end;switch(r.throwIfCancellationRequested(),p){case 2:if(L_e(_.slice(m,y))){v(),u=0;break}0===u&&(s=m),c=y,u++;break;case 3:v(),n.push(j_e(m,y,"comment")),u=0;break;default:rA.assertNever(p)}}}catch(e){a={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(a)throw a.error}}v()}function v(){1t+1),r[t+1]}(e.parent,e,t),argumentIndex:0};t=RX(e);return t&&{list:t,argumentIndex:function(e,t){var r,n,a=0;try{for(var i=__values(e.getChildren()),o=i.next();!o.done;o=i.next()){var s=o.value;if(s===t)break;28!==s.kind&&a++}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}(t,e)}}}(e,r);if(n){var a=n.list,n=n.argumentIndex,e=function(e,t){var r=e.getChildren(),e=rD(r,function(e){return 28!==e.kind});!t&&0=t.getStart(),"Assumed 'position' could not occur before node."),Es(t))return wQ(t,r,n)?0:e+2;return e+1}(c.parent.templateSpans.indexOf(c),e,t,r),r)}else{if(YE(n)){var l=n.attributes.pos;return{isTypeParameterList:!1,invocation:{kind:0,node:n},argumentsSpan:So(l,xA(r.text,n.attributes.end,!1)-l),argumentIndex:0,argumentCount:1}}n=mQ(e,r);if(n){l=n.called,n=n.nTypeArguments;return{isTypeParameterList:!0,invocation:a={kind:1,called:l},argumentsSpan:u=wo(l.getStart(r),e.end),argumentIndex:n,argumentCount:n+1}}}}}function ile(e){return mj(e.left)?ile(e.left)+1:2}function ole(e,t,r){var n=Hv(e.template)?1:e.template.templateSpans.length+1;return 0!==t&&rA.assertLessThan(t,n),{isTypeParameterList:!1,invocation:{kind:0,node:e},argumentsSpan:function(e,t){var r=e.template,n=r.getStart(),e=r.getEnd();228===r.kind&&0===ND(r.templateSpans).literal.getFullWidth()&&(e=xA(t.text,e,!1));return So(n,e-n)}(e,r),argumentIndex:t,argumentCount:n}}function sle(e){return 0===e.kind?GP(e.node):e.called}function cle(e){return 0!==e.kind&&1===e.kind?e.called:e.node}function ule(e,t,r,n,a,i){var o,s,c=r.isTypeParameterList,u=r.argumentCount,_=r.argumentsSpan,l=r.invocation,r=r.argumentIndex,f=cle(l),d=2===l.kind?l.symbol:a.getSymbolAtLocation(sle(l))||i&&(null==(d=t.declaration)?void 0:d.symbol),p=d?WY(a,d,i?n:void 0,void 0):WN,m=iD(e,function(e){return _=p,iD((c?function(e,r,n,a){var t=(e.target||e).typeParameters,i=vU(),o=(t||WN).map(function(e){return _le(e,r,n,a,i)}),s=e.thisParameter?[r.symbolToParameterDeclaration(e.thisParameter,n,Y_e)]:[];return r.getExpandedParameters(e).map(function(e){var t=uR.createNodeArray(__spreadArray(__spreadArray([],__read(s),!1),__read(iD(e,function(e){return r.symbolToParameterDeclaration(e,n,Y_e)})),!1)),e=VY(function(e){i.writeList(2576,t,a,e)});return{isVariadic:!1,parameters:o,prefix:[AY(30)],suffix:__spreadArray([AY(32)],__read(e),!1)}})}:function(r,c,u,_){var l=vU(),t=VY(function(e){var t;r.typeParameters&&r.typeParameters.length&&(t=uR.createNodeArray(r.typeParameters.map(function(e){return c.typeParameterToDeclaration(e,u,Y_e)})),l.writeList(53776,t,_,e))}),e=c.getExpandedParameters(r),n=c.hasEffectiveRestParameter(r)?1===e.length?function(e){return!0}:function(e){return!!(e.length&&32768&(null==(e=BD(e[e.length-1],gF))?void 0:e.links.checkFlags))}:function(e){return!1};return e.map(function(e){return{isVariadic:n(e),parameters:e.map(function(e){return r=e,n=c,a=u,i=_,o=l,t=VY(function(e){var t=n.symbolToParameterDeclaration(r,a,Y_e);o.writeNode(4,t,i,e)}),s=n.isOptionalParameter(r.valueDeclaration),e=gF(r)&&!!(32768&r.links.checkFlags),{name:r.name,documentation:r.getDocumentationComment(n),displayParts:t,isOptional:s,isRest:e};var r,n,a,i,o,t,s}),prefix:__spreadArray(__spreadArray([],__read(t),!1),[AY(21)],!1),suffix:[AY(22)]}})})(u=e,l=a,d=f,n),function(e){var r,n,a,t=e.isVariadic,i=e.parameters,o=e.prefix,s=e.suffix,c=__spreadArray(__spreadArray([],__read(_),!1),__read(o),!1),e=__spreadArray(__spreadArray([],__read(s),!1),__read((r=u,n=d,a=l,VY(function(e){e.writePunctuation(":"),e.writeSpace(" ");var t=a.getTypePredicateOfSignature(r);t?a.writeTypePredicate(t,n,void 0,e):a.writeType(a.getReturnTypeOfSignature(r),n,void 0,e)}))),!1),o=u.getDocumentationComment(l),s=u.getJsDocTags();return{isVariadic:t,prefixDisplayParts:c,suffixDisplayParts:e,separatorDisplayParts:Z_e,parameters:i,documentation:o,tags:s}});var u,_,l,d});0!==r&&rA.assertLessThan(r,u);for(var y=0,v=0,g=0;g=u){y=v+x;break}x++}}catch(e){o={error:e}}finally{try{k&&!k.done&&(s=b.return)&&s.call(b)}finally{if(o)throw o.error}}}v+=h.length}rA.assert(-1!==y);i={items:S(m,ir),applicableSpan:_,selectedItemIndex:y,argumentIndex:r,argumentCount:u},_=i.items[y];return _.isVariadic&&(-1<(r=ZN(_.parameters,function(e){return e.isRest}))&&r<_.parameters.length-1?i.argumentIndex=_.parameters.length:i.argumentIndex=Math.min(i.argumentIndex,_.parameters.length-1)),i}function _le(r,n,a,i,o){var e=VY(function(e){var t=n.typeParameterToDeclaration(r,a,Y_e);o.writeNode(4,t,i,e)});return{name:r.symbol.name,documentation:r.symbol.getDocumentationComment(n),displayParts:e,isOptional:!1,isRest:!1}}var lle=e({"src/services/signatureHelp.ts":function(){fpe(),Y_e=70246400,Z_e=[AY(28),NY()]}}),dle={};t(dle,{getArgumentInfoForCompletions:function(){return rle},getSignatureHelpItems:function(){return ele}});var fle,ple=e({"src/services/_namespaces/ts.SignatureHelp.ts":function(){lle()}});function mle(r,n){var e,t,a={textSpan:wo(n.getFullStart(),n.getEnd())},i=n;e:for(;;){var o=function(t){if(uB(t))return yle(t.getChildAt(0).getChildren(),fle);if(wg(t)){var e=__read(t.getChildren()),r=e[0],n=e.slice(1),a=rA.checkDefined(n.pop());rA.assertEqual(r.kind,19),rA.assertEqual(a.kind,20);e=yle(n,function(e){return e===t.readonlyToken||148===e.kind||e===t.questionToken||58===e.kind}),e=yle(e,function(e){e=e.kind;return 23===e||168===e||24===e});return[r,gle(vle(e,function(e){return 59===e.kind})),a]}if(DR(t)){n=yle(t.getChildren(),function(e){return e===t.name||eD(t.modifiers,e)}),a=327===(null==(a=n[0])?void 0:a.kind)?n[0]:void 0,n=vle(a?n.slice(1):n,function(e){return 59===e.kind});return a?[a,gle(n)]:n}if(CR(t)){var i=yle(t.getChildren(),function(e){return e===t.dotDotDotToken||e===t.name});return vle(yle(i,function(e){return e===i[0]||e===t.questionToken}),function(e){return 64===e.kind})}if(tj(t))return vle(t.getChildren(),function(e){return 64===e.kind});return t.getChildren()}(i);if(!o.length)break;for(var s=0;sr)break e;var l=pa(eo(n.text,u.end));if(l&&2===l.kind&&function(e,t){d(e,t);for(var r=e;47===n.text.charCodeAt(r);)r++;d(r,t)}(l.pos,l.end),function(e,t,r){if(rA.assert(r.pos<=t),ts)break;if(s",joiner:", "})},r.prototype.getOptionsForInsertNodeBefore=function(e,t,r){return XE(e)||CE(e)?{suffix:r?this.newLineCharacter+this.newLineCharacter:this.newLineCharacter}:Aj(e)?{suffix:", "}:CR(e)?CR(t)?{suffix:", "}:{}:hR(e)&&Jj(e.parent)||ih(e)?{suffix:", "}:Vj(e)?{suffix:","+(r?this.newLineCharacter:" ")}:rA.failBadSyntaxKind(e)},r.prototype.insertNodeAtConstructorStart=function(e,t,r){var n=kD(t.body.statements);n&&t.body.multiLine?this.insertNodeBefore(e,n,r):this.replaceConstructorBody(e,t,__spreadArray([r],__read(t.body.statements),!1))},r.prototype.insertNodeAtConstructorStartAfterSuperCall=function(e,t,r){var n=QN(t.body.statements,function(e){return Sj(e)&&pP(e.expression)});n&&t.body.multiLine?this.insertNodeAfter(e,n,r):this.replaceConstructorBody(e,t,__spreadArray(__spreadArray([],__read(t.body.statements),!1),[r],!1))},r.prototype.insertNodeAtConstructorEnd=function(e,t,r){var n=CD(t.body.statements);n&&t.body.multiLine?this.insertNodeAfter(e,n,r):this.replaceConstructorBody(e,t,__spreadArray(__spreadArray([],__read(t.body.statements),!1),[r],!1))},r.prototype.replaceConstructorBody=function(e,t,r){this.replaceNode(e,t.body,uR.createBlock(r,!0))},r.prototype.insertNodeAtEndOfScope=function(e,t,r){var n=Wle(e,t.getLastToken(),{});this.insertNodeAt(e,n,r,{prefix:hA(e.text.charCodeAt(t.getLastToken().pos))?this.newLineCharacter:this.newLineCharacter+this.newLineCharacter,suffix:this.newLineCharacter})},r.prototype.insertMemberAtStart=function(e,t,r){this.insertNodeAtStartWorker(e,t,r)},r.prototype.insertNodeAtObjectStart=function(e,t,r){this.insertNodeAtStartWorker(e,t,r)},r.prototype.insertNodeAtStartWorker=function(e,t,r){var n=null!==(n=this.guessIndentationFromExistingMembers(e,t))&&void 0!==n?n:this.computeIndentationForNewMember(e,t);this.insertNodeAt(e,Yle(t).pos,r,this.getInsertNodeAtStartInsertOptions(e,t,n))},r.prototype.guessIndentationFromExistingMembers=function(e,t){var r,n,a,i=t;try{for(var o=__values(Yle(t)),s=o.next();!s.done;s=o.next()){var c=s.value;if(Cf(i,c,e))return;var u=c.getStart(e),u=upe.SmartIndenter.findFirstNonWhitespaceColumn(kX(u,e),u,e,this.formatContext.options);if(void 0===a)a=u;else if(u!==a)return;i=c}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return a},r.prototype.computeIndentationForNewMember=function(e,t){t=t.getStart(e);return upe.SmartIndenter.findFirstNonWhitespaceColumn(kX(t,e),t,e,this.formatContext.options)+(null!==(e=this.formatContext.options.indentSize)&&void 0!==e?e:4)},r.prototype.getInsertNodeAtStartInsertOptions=function(e,t,r){var n=0===Yle(t).length,a=Zf(this.classesWithNodesInsertedAtStart,mJ(t),{node:t,sourceFile:e}),i=nj(t)&&(!lP(e)||!n);return{indentation:r,prefix:(nj(t)&&lP(e)&&n&&!a?",":"")+this.newLineCharacter,suffix:i?",":Ij(t)&&n?";":""}},r.prototype.insertNodeAfterComma=function(e,t,r){var n=this.insertNodeAfterWorker(e,this.nextCommaToken(e,t)||t,r);this.insertNodeAt(e,n,r,this.getInsertNodeAfterOptions(e,t))},r.prototype.insertNodeAfter=function(e,t,r){var n=this.insertNodeAfterWorker(e,t,r);this.insertNodeAt(e,n,r,this.getInsertNodeAfterOptions(e,t))},r.prototype.insertNodeAtEndOfList=function(e,t,r){this.insertNodeAt(e,t.end,r,{prefix:", "})},r.prototype.insertNodesAfter=function(e,t,r){var n=this.insertNodeAfterWorker(e,t,SD(r));this.insertNodesAt(e,n,r,this.getInsertNodeAfterOptions(e,t))},r.prototype.insertNodeAfterWorker=function(e,t,r){var n;return n=r,!((DR(r=t)||AR(r))&&Gs(n)&&167===n.name.kind||Tc(r)&&Tc(n))||59!==e.text.charCodeAt(t.end-1)&&this.replaceRange(e,gf(t.end),uR.createToken(27)),Kle(e,t,{})},r.prototype.getInsertNodeAfterOptions=function(e,t){var r=this.getInsertNodeAfterOptionsWorker(t);return __assign(__assign({},r),{prefix:t.end===e.end&&XE(t)?r.prefix?"\n".concat(r.prefix):"\n":r.prefix})},r.prototype.getInsertNodeAfterOptionsWorker=function(e){switch(e.kind){case 263:case 267:return{prefix:this.newLineCharacter,suffix:this.newLineCharacter};case 260:case 11:case 80:return{prefix:", "};case 303:return{suffix:","+this.newLineCharacter};case 95:return{prefix:" "};case 169:return{};default:return rA.assert(XE(e)||Gs(e)),{suffix:this.newLineCharacter}}},r.prototype.insertName=function(e,t,r){var n,a;rA.assert(!t.name),219===t.kind?(n=MX(t,39,e),(a=MX(t,21,e))?(this.insertNodesAt(e,a.getStart(e),[uR.createToken(100),uR.createIdentifier(r)],{joiner:" "}),nde(this,e,n)):(this.insertText(e,SD(t.parameters).getStart(e),"function ".concat(r,"(")),this.replaceRange(e,n,uR.createToken(22))),241!==t.body.kind&&(this.insertNodesAt(e,t.body.getStart(e),[uR.createToken(19),uR.createToken(107)],{joiner:" ",suffix:" "}),this.insertNodesAt(e,t.body.end,[uR.createToken(27),uR.createToken(20)],{joiner:" "}))):(t=MX(t,218===t.kind?100:86,e).end,this.insertNodeAt(e,t,uR.createIdentifier(r),{prefix:" "}))},r.prototype.insertExportModifier=function(e,t){this.insertText(e,t.getStart(e),"export ")},r.prototype.insertImportSpecifierAtIndex=function(e,t,r,n){n=r.elements[n-1];n?this.insertNodeInListAfter(e,n,t):this.insertNodeBefore(e,r.elements[0],t,!If(r.elements[0].getStart(),r.parent.parent.getStart(),e))},r.prototype.insertNodeInListAfter=function(e,t,r,n){if(void 0===n&&(n=upe.SmartIndenter.getContainingList(t,e)),n){var a=IF(n,t);if(!(a<0)){var i=t.getEnd();if(a!==n.length-1){var o=QX(e,t.end);o&&Gle(t,o)&&(u=n[a+1],_=Vle(e.text,u.getFullStart()),s="".concat(vA(o.kind)).concat(e.text.substring(o.end,_)),this.insertNodesAt(e,_,[r],{suffix:s}))}else{var s,c=t.getStart(e),u=kX(c,e),o=void 0,_=!1;if(1===n.length?o=28:(o=Gle(t,s=tQ(t.pos,e))?s.kind:28,_=kX(n[a-1].getStart(e),e)!==u),function(e,t){for(var r=t;r>=Ffe;return r}(t,a),0,e),r[n]=function(e,t){var r=1+(e>>t&Pfe);return rA.assert((r&Pfe)==r,"Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules."),e&~(Pfe<=i.pos?e.pos:o.end),t.end,function(e){return tpe(t,c,ope.getIndentationForNode(c,t,r,n.options),function(e,t,r){for(var n,a=-1;e;){var i=r.getLineAndCharacterOfPosition(e.getStart(r)).line;if(-1!==a&&i!==a)break;if(ope.shouldIndentChildNode(t,e,n,r))return t.indentSize;a=i,e=(n=e).parent}return 0}(c,n.options,r),e,n,a,function(e,t){if(!e.length)return a;var r=e.filter(function(e){return AX(t,e.start,e.start+e.length)}).sort(function(e,t){return e.start-t.start});if(!r.length)return a;var n=0;return function(e){for(;;){if(n>=r.length)return!1;var t=r[n];if(e.end<=t.start)return!1;if(FX(e.pos,e.end,t.start,t.start+t.length))return!0;n++}};function a(){return!1}}(r.parseDiagnostics,t),r)})}function tpe(g,t,e,r,h,n,a,x,b){var k,T,o,s,S,w=n.options,_=n.getRules,l=n.host,d=new cde(b,a,w),C=-1,f=[];h.advance(),h.isOnToken()&&(a=n=b.getLineAndCharacterOfPosition(t.getStart(b)).line,gL(t)&&(a=b.getLineAndCharacterOfPosition(u_(t,b)).line),function f(p,e,t,r,n,a){if(!AX(g,p.getStart(b),p.getEnd()))return;var i=A(p,t,n,a);var m=e;HB(p,function(e){y(e,-1,p,i,t,r,!1)},function(e){s(e,p,t,i)});for(;h.isOnToken()&&h.getTokenFullStart()Math.min(p.end,g.end))break;v(o,p,i,p)}function y(e,t,r,n,a,i,o,s){if(rA.assert(!jO(e)),EF(e)||Qu(r,e))return t;var c=e.getStart(b),u=b.getLineAndCharacterOfPosition(c).line,_=u;gL(e)&&(_=b.getLineAndCharacterOfPosition(u_(e,b)).line);var l=-1;if(o&&TX(g,r)&&-1!==(l=N(c,e.end,a,g,t))&&(t=l),!AX(g,e.pos,e.end))return e.endg.end)return t;if(d.token.end>c){d.token.pos>c&&h.skipToStartOf(e);break}v(d,p,n,p)}if(!h.isOnToken()||h.getTokenFullStart()>=g.end)return t;if(Cs(e)){var d=h.readTokenInfo(e);if(12!==e.kind)return rA.assert(d.token.end===e.end,"Token end is child end"),v(d,p,n,e),t}var i=170===e.kind?u:i,i=D(e,u,l,p,n,i);return f(e,m,u,_,i.indentation,i.delta),m=p,s&&209===r.kind&&-1===t&&(t=i.indentation),t}function s(e,t,r,n){rA.assert(Ns(e)),rA.assert(!jO(e));var a=npe(t,e),i=n,o=r;if(AX(g,e.pos,e.end)){if(0!==a)for(;h.isOnToken()&&h.getTokenFullStart()e.pos)break;u.token.kind===a?(o=b.getLineAndCharacterOfPosition(u.token.pos).line,v(u,t,n,t),s=void 0,s=-1!==C?C:(c=kX(u.token.pos,b),ope.findFirstNonWhitespaceColumn(c,u.token.pos,b,w)),i=A(t,r,s,w.indentSize)):v(u,t,n,t)}for(var _=-1,l=0;l=g.end&&((e=h.isOnEOF()?h.readEOFTokenRange():h.isOnToken()?h.readTokenInfo(t).token:void 0)&&e.pos===k&&(r=(null==(r=tQ(e.end,b,t))?void 0:r.parent)||o,c(e,b.getLineAndCharacterOfPosition(e.pos).line,r,T,s,o,r,void 0))),f;function N(e,t,r,n,a){if(AX(n,e,t)||DX(n,e,t)){if(-1!==a)return a}else{t=b.getLineAndCharacterOfPosition(e).line,a=kX(e,b),a=ope.findFirstNonWhitespaceColumn(a,e,b,w);if(t!==r||e===a){e=ope.getBaseIndentation(w);return ao||-1!==(a=function(e,t){var r=t;for(;e<=r&&ji(b.text.charCodeAt(r));)r--;return r===t?-1:r+1}(i,o))&&(rA.assert(a===i||!ji(b.text.charCodeAt(a-1))),y(a,o+1-a))}}function u(e,t,r){p(b.getLineAndCharacterOfPosition(e).line,b.getLineAndCharacterOfPosition(t).line+1,r)}function y(e,t){t&&f.push(jQ(e,t,""))}function v(e,t,r){(t||r)&&f.push(jQ(e,t,r))}}function rpe(t,r,e,n){void 0===n&&(n=QX(t,r));var a=FA(n,kh);if(a&&(n=a.parent),!(n.getStart(t)<=r&&rr.end);var f=function(e,t,r){t=b(t,r),e=t?t.pos:e.getStart(r);return r.getLineAndCharacterOfPosition(e)}(_,e,a),p=f.line===t.line||x(_,e,t.line,a);if(d){var m=null==(u=b(e,a))?void 0:u[0],y=k(e,a,o,!!m&&g(m,a).line>f.line);if(-1!==y)return y+n;if(s=_,c=t,l=p,d=a,u=o,-1!==(y=!GE(m=e)&&!Tc(m)||312!==s.kind&&l?-1:T(c,d,u)))return y+n}S(o,_,e,a,i)&&!p&&(n+=o.indentSize);p=h(_,e,t.line,a),_=(e=_).parent;t=p?a.getLineAndCharacterOfPosition(e.getStart(a)):f}return n+v(o)}function g(e,t){return t.getLineAndCharacterOfPosition(e.getStart(t))}function h(e,t,r,n){return!(!oj(e)||!eD(e.arguments,t))&&gA(n,e.expression.getEnd()).line===r}function x(e,t,r,n){if(245!==e.kind||e.elseStatement!==t)return!1;e=MX(e,93,n);return rA.assert(void 0!==e),g(e,n).line===r}function b(e,t){return e.parent&&l(e.getStart(t),e.getEnd(),e.parent,t)}function l(t,r,n,a){switch(n.kind){case 183:return e(n.typeArguments);case 210:return e(n.properties);case 209:return e(n.elements);case 187:return e(n.members);case 262:case 218:case 219:case 174:case 173:case 179:case 176:case 185:case 180:return e(n.typeParameters)||e(n.parameters);case 177:return e(n.parameters);case 263:case 231:case 264:case 265:case 352:return e(n.typeParameters);case 214:case 213:return e(n.typeArguments)||e(n.arguments);case 261:return e(n.declarations);case 275:case 279:return e(n.elements);case 206:case 207:return e(n.elements)}function e(e){return e&&DX(function(e,t,r){for(var n=e.getChildren(r),a=1;at.text.length)return v(r);if(0===r.indentStyle)return 0;var a,i=tQ(e,t,void 0,!0);if((a=rpe(t,e,i||null))&&3===a.kind)return function(e,t,r,n){var a=gA(e,t).line-1,n=gA(e,n.pos).line;if(rA.assert(0<=n),a<=n)return m(Hu(n,e),t,e,r);a=Hu(a,e),t=p(a,t,e,r),r=t.column,t=t.character;return 0!==r&&42===e.text.charCodeAt(a+t)?r-1:r}(t,e,r,a);if(!i)return v(r);if(kQ(i.kind)&&i.getStart(t)<=e&&e Date: Sun, 24 Dec 2023 14:40:27 +0200 Subject: [PATCH 14/20] fix: correctly convert virtual to real path --- src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java b/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java index 80bcf2f..18bdb39 100644 --- a/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java +++ b/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java @@ -10,7 +10,9 @@ public class PhysicalFilesystem implements Filesystem { public final Path root; private Path getPath(String name) { - return root.resolve(name.replace("\\", "/")).normalize(); + var absolutized = Path.of("/" + name.replace("\\", "/")).normalize().toString(); + var res = Path.of(root.toString() + absolutized).normalize(); + return res; } private void checkMode(Path path, Mode mode) { From e9e020512ec16be3b980b827161ba3513f5ff971 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 24 Dec 2023 15:17:38 +0200 Subject: [PATCH 15/20] fix: environment pushed when it shouldn't be --- src/me/topchetoeu/jscript/engine/Context.java | 4 ++-- src/me/topchetoeu/jscript/engine/Environment.java | 4 ---- src/me/topchetoeu/jscript/engine/debug/SimpleDebugger.java | 2 +- src/me/topchetoeu/jscript/engine/values/Values.java | 2 +- src/me/topchetoeu/jscript/exceptions/EngineException.java | 2 +- src/me/topchetoeu/jscript/lib/AsyncFunctionLib.java | 1 - 6 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/me/topchetoeu/jscript/engine/Context.java b/src/me/topchetoeu/jscript/engine/Context.java index 3872541..5761c82 100644 --- a/src/me/topchetoeu/jscript/engine/Context.java +++ b/src/me/topchetoeu/jscript/engine/Context.java @@ -26,11 +26,11 @@ public class Context { return env.empty() ? null : env.peek(); } - public Context pushEnv(Environment env) { + private Context pushEnv(Environment env) { this.env.push(env); return this; } - public void popEnv() { + private void popEnv() { if (!env.empty()) this.env.pop(); } diff --git a/src/me/topchetoeu/jscript/engine/Environment.java b/src/me/topchetoeu/jscript/engine/Environment.java index da6a868..0eb322e 100644 --- a/src/me/topchetoeu/jscript/engine/Environment.java +++ b/src/me/topchetoeu/jscript/engine/Environment.java @@ -106,10 +106,6 @@ public class Environment implements PermissionsProvider { return permissions == null || permissions.hasPermission(perm); } - public Context context(Engine engine) { - return new Context(engine).pushEnv(this); - } - public static Symbol getSymbol(String name) { if (symbols.containsKey(name)) return symbols.get(name); else { diff --git a/src/me/topchetoeu/jscript/engine/debug/SimpleDebugger.java b/src/me/topchetoeu/jscript/engine/debug/SimpleDebugger.java index d2989b3..a21af73 100644 --- a/src/me/topchetoeu/jscript/engine/debug/SimpleDebugger.java +++ b/src/me/topchetoeu/jscript/engine/debug/SimpleDebugger.java @@ -482,7 +482,7 @@ public class SimpleDebugger implements Debugger { env.global = new GlobalScope(codeFrame.local); - var ctx = new Context(engine).pushEnv(env); + var ctx = new Context(engine, env); var awaiter = engine.pushMsg(false, ctx.environment(), new Filename("jscript", "eval"), code, codeFrame.frame.thisArg, codeFrame.frame.args); engine.run(true); diff --git a/src/me/topchetoeu/jscript/engine/values/Values.java b/src/me/topchetoeu/jscript/engine/values/Values.java index 83646e6..d9031ee 100644 --- a/src/me/topchetoeu/jscript/engine/values/Values.java +++ b/src/me/topchetoeu/jscript/engine/values/Values.java @@ -741,7 +741,7 @@ public class Values { try { if (err instanceof EngineException) { var ee = ((EngineException)err); - System.out.println(prefix + " " + ee.toString(new Context(ee.engine).pushEnv(ee.env))); + System.out.println(prefix + " " + ee.toString(new Context(ee.engine, ee.env))); } else if (err instanceof SyntaxException) { System.out.println("Syntax error:" + ((SyntaxException)err).msg); diff --git a/src/me/topchetoeu/jscript/exceptions/EngineException.java b/src/me/topchetoeu/jscript/exceptions/EngineException.java index 8976ace..2639aab 100644 --- a/src/me/topchetoeu/jscript/exceptions/EngineException.java +++ b/src/me/topchetoeu/jscript/exceptions/EngineException.java @@ -37,7 +37,7 @@ public class EngineException extends RuntimeException { if (function.equals("")) function = null; if (ctx == null) this.ctx = null; - else this.ctx = new Context(ctx.engine).pushEnv(ctx.environment()); + else this.ctx = new Context(ctx.engine, ctx.environment()); this.location = location; this.function = function; } diff --git a/src/me/topchetoeu/jscript/lib/AsyncFunctionLib.java b/src/me/topchetoeu/jscript/lib/AsyncFunctionLib.java index c352a20..385a9b4 100644 --- a/src/me/topchetoeu/jscript/lib/AsyncFunctionLib.java +++ b/src/me/topchetoeu/jscript/lib/AsyncFunctionLib.java @@ -21,7 +21,6 @@ import me.topchetoeu.jscript.interop.Native; private void next(Context ctx, Object inducedValue, Object inducedError) { Object res = null; ctx.pushFrame(frame); - ctx.pushEnv(frame.function.environment); awaiting = false; while (!awaiting) { From 28265a8f44731be67adb29ae2382de5deeaacb9b Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Tue, 26 Dec 2023 11:26:08 +0200 Subject: [PATCH 16/20] fix: some bug fixes and improvements with File interface --- src/me/topchetoeu/jscript/filesystem/File.java | 10 +++------- .../jscript/filesystem/MemoryFile.java | 17 ++++++----------- .../jscript/filesystem/PhysicalFile.java | 11 ++--------- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/src/me/topchetoeu/jscript/filesystem/File.java b/src/me/topchetoeu/jscript/filesystem/File.java index f6e625a..d17fc23 100644 --- a/src/me/topchetoeu/jscript/filesystem/File.java +++ b/src/me/topchetoeu/jscript/filesystem/File.java @@ -5,17 +5,13 @@ import me.topchetoeu.jscript.Buffer; public interface File { int read(byte[] buff); void write(byte[] buff); - long getPtr(); - void setPtr(long offset, int pos); + long seek(long offset, int pos); void close(); - Mode mode(); default String readToString() { - setPtr(0, 2); - long len = getPtr(); + long len = seek(0, 2); if (len < 0) return null; - - setPtr(0, 0); + seek(0, 0); byte[] res = new byte[(int)len]; len = read(res); diff --git a/src/me/topchetoeu/jscript/filesystem/MemoryFile.java b/src/me/topchetoeu/jscript/filesystem/MemoryFile.java index 7fd4afc..613177d 100644 --- a/src/me/topchetoeu/jscript/filesystem/MemoryFile.java +++ b/src/me/topchetoeu/jscript/filesystem/MemoryFile.java @@ -27,17 +27,17 @@ public class MemoryFile implements File { } @Override - public long getPtr() { - if (data == null || !mode.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); - return ptr; - } - @Override - public void setPtr(long offset, int pos) { + public long seek(long offset, int pos) { if (data == null || !mode.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); if (pos == 0) ptr = (int)offset; else if (pos == 1) ptr += (int)offset; else if (pos == 2) ptr = data.length() - (int)offset; + + if (ptr < 0) ptr = 0; + if (ptr > data.length()) ptr = data.length(); + + return pos; } @Override @@ -45,11 +45,6 @@ public class MemoryFile implements File { mode = Mode.NONE; ptr = 0; } - @Override - public Mode mode() { - if (data == null) return Mode.NONE; - return mode; - } public MemoryFile(String filename, Buffer buff, Mode mode) { this.filename = filename; diff --git a/src/me/topchetoeu/jscript/filesystem/PhysicalFile.java b/src/me/topchetoeu/jscript/filesystem/PhysicalFile.java index 0514e0e..cc3b78c 100644 --- a/src/me/topchetoeu/jscript/filesystem/PhysicalFile.java +++ b/src/me/topchetoeu/jscript/filesystem/PhysicalFile.java @@ -25,19 +25,14 @@ public class PhysicalFile implements File { } @Override - public long getPtr() { - if (file == null || !perms.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); - else try { return file.getFilePointer(); } - catch (IOException e) { throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); } - } - @Override - public void setPtr(long offset, int pos) { + public long seek(long offset, int pos) { if (file == null || !perms.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); try { if (pos == 1) offset += file.getFilePointer(); else if (pos == 2) offset += file.length(); file.seek(offset); + return offset; } catch (IOException e) { throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); } } @@ -50,8 +45,6 @@ public class PhysicalFile implements File { file = null; perms = Mode.NONE; } - @Override - public Mode mode() { return perms; } public PhysicalFile(String path, Mode mode) throws FileNotFoundException { if (mode == Mode.NONE) file = null; From 1c64912786cdb6f9041b45e9d26e0fb2a3fde736 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Tue, 26 Dec 2023 11:26:43 +0200 Subject: [PATCH 17/20] feat: create memory-light directory list file --- .../filesystem/FilesystemException.java | 6 +- .../jscript/filesystem/ListFile.java | 73 +++++++++++++++++++ 2 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 src/me/topchetoeu/jscript/filesystem/ListFile.java diff --git a/src/me/topchetoeu/jscript/filesystem/FilesystemException.java b/src/me/topchetoeu/jscript/filesystem/FilesystemException.java index 21028e3..6fd7c96 100644 --- a/src/me/topchetoeu/jscript/filesystem/FilesystemException.java +++ b/src/me/topchetoeu/jscript/filesystem/FilesystemException.java @@ -12,7 +12,8 @@ public class FilesystemException extends RuntimeException { NO_PERMISSIONS_RW(0x5), FOLDER_NOT_EMPTY(0x6), ALREADY_EXISTS(0x7), - FOLDER_EXISTS(0x8); + FOLDER_EXISTS(0x8), + UNSUPPORTED_OPERATION(0x9); public final int code; @@ -27,7 +28,8 @@ public class FilesystemException extends RuntimeException { "No permissions to read '%s'", "No permissions to write '%s'", "Can't delete '%s', since it is a full folder.", - "'%s' already exists." + "'%s' already exists.", + "An unsupported operation was performed on the file '%s'." }; public final String message, filename; diff --git a/src/me/topchetoeu/jscript/filesystem/ListFile.java b/src/me/topchetoeu/jscript/filesystem/ListFile.java new file mode 100644 index 0000000..8987ded --- /dev/null +++ b/src/me/topchetoeu/jscript/filesystem/ListFile.java @@ -0,0 +1,73 @@ +package me.topchetoeu.jscript.filesystem; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.stream.Stream; + +import me.topchetoeu.jscript.filesystem.FilesystemException.FSCode; + +public class ListFile implements File { + private Stream stream; + private String filename; + private byte[] currFile; + private long ptr = 0, start = 0, end = 0; + + private void next() { + while (stream != null) { + var opt = stream.findFirst(); + + if (opt.isPresent()) { + start = end; + currFile = (opt.get().toString() + "\n").getBytes(); + end = start + currFile.length; + } + else { + stream = null; + currFile = null; + } + } + } + + @Override + public void close() { + stream = null; + currFile = null; + } + + @Override + public int read(byte[] buff) { + if (stream == null) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); + if (ptr < start) return 0; + + var i = 0; + + while (i < buff.length) { + while (i > end) next(); + + int cpyN = Math.min(currFile.length, buff.length - i); + System.arraycopy(buff, i, currFile, 0, cpyN); + + i += cpyN; + } + + return i; + } + + @Override + public long seek(long offset, int pos) { + if (pos == 2) throw new FilesystemException(filename, FSCode.UNSUPPORTED_OPERATION); + if (pos == 1) offset += ptr; + return ptr = offset; + } + + @Override + public void write(byte[] buff) { + throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_RW); + } + + public ListFile(Path path) throws IOException { + stream = Files.list(path); + filename = path.toString(); + } +} From 8e01db637b3219b4006e9a2bda079708a7ea3bd5 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Tue, 26 Dec 2023 11:27:40 +0200 Subject: [PATCH 18/20] fix: improve path resolutions and FS API --- .../jscript/filesystem/Filesystem.java | 2 + .../jscript/filesystem/MemoryFilesystem.java | 65 ++++++----- .../topchetoeu/jscript/filesystem/Paths.java | 51 +++++++++ .../filesystem/PhysicalFilesystem.java | 108 ++++++++++-------- .../jscript/filesystem/RootFilesystem.java | 12 ++ 5 files changed, 165 insertions(+), 73 deletions(-) create mode 100644 src/me/topchetoeu/jscript/filesystem/Paths.java diff --git a/src/me/topchetoeu/jscript/filesystem/Filesystem.java b/src/me/topchetoeu/jscript/filesystem/Filesystem.java index 0cfea46..e75a00d 100644 --- a/src/me/topchetoeu/jscript/filesystem/Filesystem.java +++ b/src/me/topchetoeu/jscript/filesystem/Filesystem.java @@ -1,6 +1,8 @@ package me.topchetoeu.jscript.filesystem; public interface Filesystem { + String cwd(String cwd, String path); + String normalize(String path); File open(String path, Mode mode) throws FilesystemException; void create(String path, EntryType type) throws FilesystemException; FileStat stat(String path) throws FilesystemException; diff --git a/src/me/topchetoeu/jscript/filesystem/MemoryFilesystem.java b/src/me/topchetoeu/jscript/filesystem/MemoryFilesystem.java index 3b65ebb..2f2f162 100644 --- a/src/me/topchetoeu/jscript/filesystem/MemoryFilesystem.java +++ b/src/me/topchetoeu/jscript/filesystem/MemoryFilesystem.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.HashSet; import me.topchetoeu.jscript.Buffer; +import me.topchetoeu.jscript.Filename; import me.topchetoeu.jscript.filesystem.FilesystemException.FSCode; public class MemoryFilesystem implements Filesystem { @@ -12,66 +13,76 @@ public class MemoryFilesystem implements Filesystem { private HashMap files = new HashMap<>(); private HashSet folders = new HashSet<>(); - private Path getPath(String name) { - return Path.of("/" + name.replace("\\", "/")).normalize(); + private Path realPath(String path) { + return Filename.normalize(path); } @Override - public void create(String path, EntryType type) { - var _path = getPath(path); + public String normalize(String path) { + return Paths.normalize(path); + } + + @Override + public String cwd(String cwd, String path) { + return Paths.cwd(cwd, path); + } + + @Override + public void create(String _path, EntryType type) { + var path = realPath(_path); switch (type) { case FILE: - if (!folders.contains(_path.getParent())) throw new FilesystemException(path, FSCode.DOESNT_EXIST); - if (folders.contains(_path) || files.containsKey(_path)) throw new FilesystemException(path, FSCode.ALREADY_EXISTS); - if (folders.contains(_path)) throw new FilesystemException(path, FSCode.ALREADY_EXISTS); - files.put(_path, new Buffer()); + if (!folders.contains(path.getParent())) throw new FilesystemException(path.toString(), FSCode.DOESNT_EXIST); + if (folders.contains(path) || files.containsKey(path)) throw new FilesystemException(path.toString(), FSCode.ALREADY_EXISTS); + if (folders.contains(path)) throw new FilesystemException(path.toString(), FSCode.ALREADY_EXISTS); + files.put(path, new Buffer()); break; case FOLDER: - if (!folders.contains(_path.getParent())) throw new FilesystemException(path, FSCode.DOESNT_EXIST); - if (folders.contains(_path) || files.containsKey(_path)) throw new FilesystemException(path, FSCode.ALREADY_EXISTS); - folders.add(_path); + if (!folders.contains(path.getParent())) throw new FilesystemException(_path, FSCode.DOESNT_EXIST); + if (folders.contains(path) || files.containsKey(path)) throw new FilesystemException(path.toString(), FSCode.ALREADY_EXISTS); + folders.add(path); break; default: case NONE: - if (!folders.remove(_path) && files.remove(_path) == null) throw new FilesystemException(path, FSCode.DOESNT_EXIST); + if (!folders.remove(path) && files.remove(path) == null) throw new FilesystemException(path.toString(), FSCode.DOESNT_EXIST); } } @Override - public File open(String path, Mode perms) { - var _path = getPath(path); - var pcount = _path.getNameCount(); + public File open(String _path, Mode perms) { + var path = realPath(_path); + var pcount = path.getNameCount(); - if (files.containsKey(_path)) return new MemoryFile(path, files.get(_path), perms); - else if (folders.contains(_path)) { + if (files.containsKey(path)) return new MemoryFile(path.toString(), files.get(path), perms); + else if (folders.contains(path)) { var res = new StringBuilder(); for (var folder : folders) { if (pcount + 1 != folder.getNameCount()) continue; - if (!folder.startsWith(_path)) continue; + if (!folder.startsWith(path)) continue; res.append(folder.toFile().getName()).append('\n'); } for (var file : files.keySet()) { if (pcount + 1 != file.getNameCount()) continue; - if (!file.startsWith(_path)) continue; + if (!file.startsWith(path)) continue; res.append(file.toFile().getName()).append('\n'); } - return new MemoryFile(path, new Buffer(res.toString().getBytes()), perms.intersect(Mode.READ)); + return new MemoryFile(path.toString(), new Buffer(res.toString().getBytes()), perms.intersect(Mode.READ)); } - else throw new FilesystemException(path, FSCode.DOESNT_EXIST); + else throw new FilesystemException(path.toString(), FSCode.DOESNT_EXIST); } @Override - public FileStat stat(String path) { - var _path = getPath(path); + public FileStat stat(String _path) { + var path = realPath(_path); - if (files.containsKey(_path)) return new FileStat(mode, EntryType.FILE); - else if (folders.contains(_path)) return new FileStat(mode, EntryType.FOLDER); - else throw new FilesystemException(path, FSCode.DOESNT_EXIST); + if (files.containsKey(path)) return new FileStat(mode, EntryType.FILE); + else if (folders.contains(path)) return new FileStat(mode, EntryType.FOLDER); + else return new FileStat(Mode.NONE, EntryType.NONE); } public MemoryFilesystem put(String path, byte[] data) { - var _path = getPath(path); + var _path = realPath(path); var _curr = "/"; for (var seg : _path) { diff --git a/src/me/topchetoeu/jscript/filesystem/Paths.java b/src/me/topchetoeu/jscript/filesystem/Paths.java new file mode 100644 index 0000000..b59609e --- /dev/null +++ b/src/me/topchetoeu/jscript/filesystem/Paths.java @@ -0,0 +1,51 @@ +package me.topchetoeu.jscript.filesystem; + +import java.util.ArrayList; + +public class Paths { + public static String normalize(String path) { + var parts = path.split("[\\\\/]"); + var res = new ArrayList(); + + for (var part : parts) { + if (part.equals("...")) res.clear(); + else if (part.equals("..")) { + if (res.size() > 0) res.remove(res.size() - 1); + } + else if (!part.equals(".")) res.add(part); + } + + var sb = new StringBuilder(); + + for (var el : res) sb.append("/").append(el); + + return sb.toString(); + } + + public static String chroot(String root, String path) { + return normalize(root) + normalize(path); + } + + public static String cwd(String cwd, String path) { + return normalize(cwd + "/" + path); + } + + public static String filename(String path) { + var i = path.lastIndexOf('/'); + if (i < 0) i = path.lastIndexOf('\\'); + + if (i < 0) return path; + else return path.substring(i + 1); + } + + public static String extension(String path) { + var i = path.lastIndexOf('.'); + + if (i < 0) return ""; + else return path.substring(i + 1); + } + + public static String dir(String path) { + return normalize(path + "/.."); + } +} diff --git a/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java b/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java index 18bdb39..f590ee5 100644 --- a/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java +++ b/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java @@ -1,76 +1,92 @@ package me.topchetoeu.jscript.filesystem; -import java.io.FileNotFoundException; import java.io.IOException; +import java.nio.file.Files; import java.nio.file.Path; import me.topchetoeu.jscript.filesystem.FilesystemException.FSCode; public class PhysicalFilesystem implements Filesystem { - public final Path root; - - private Path getPath(String name) { - var absolutized = Path.of("/" + name.replace("\\", "/")).normalize().toString(); - var res = Path.of(root.toString() + absolutized).normalize(); - return res; - } + public final String root; private void checkMode(Path path, Mode mode) { if (!path.startsWith(root)) throw new FilesystemException(path.toString(), FSCode.NO_PERMISSIONS_R); - if (mode.readable && !path.toFile().canRead()) throw new FilesystemException(path.toString(), FSCode.NO_PERMISSIONS_R); - if (mode.writable && !path.toFile().canWrite()) throw new FilesystemException(path.toString(), FSCode.NO_PERMISSIONS_RW); + var stat = stat(path.toString()); + if (mode.readable && !stat.mode.readable) throw new FilesystemException(path.toString(), FSCode.NO_PERMISSIONS_R); + if (mode.writable && !stat.mode.writable) throw new FilesystemException(path.toString(), FSCode.NO_PERMISSIONS_RW); + } + + private Path realPath(String path) { + return Path.of(Paths.chroot(root, path)); } @Override - public File open(String path, Mode perms) { - var _path = getPath(path); - var f = _path.toFile(); - - checkMode(_path, perms); - - - if (f.isDirectory()) return MemoryFile.fromFileList(path, f.listFiles()); - else try { return new PhysicalFile(path, perms); } - catch (FileNotFoundException e) { throw new FilesystemException(_path.toString(), FSCode.DOESNT_EXIST); } + public String normalize(String path) { + return Paths.normalize(path); } @Override - public void create(String path, EntryType type) { - var _path = getPath(path); - var f = _path.toFile(); + public String cwd(String cwd, String path) { + return Paths.cwd(cwd, path); + } - switch (type) { - case FILE: - try { - if (!f.createNewFile()) throw new FilesystemException(_path.toString(), FSCode.ALREADY_EXISTS); - else break; - } - catch (IOException e) { throw new FilesystemException(_path.toString(), FSCode.NO_PERMISSIONS_RW); } - case FOLDER: - if (!f.mkdir()) throw new FilesystemException(_path.toString(), FSCode.ALREADY_EXISTS); - else break; - case NONE: - default: - if (!f.delete()) throw new FilesystemException(_path.toString(), FSCode.DOESNT_EXIST); - else break; + @Override + public File open(String _path, Mode perms) { + var path = realPath(_path); + + checkMode(path, perms); + + try { + if (Files.isDirectory(path)) return new ListFile(path); + else return new PhysicalFile(path.toString(), perms); } + catch (IOException e) { throw new FilesystemException(path.toString(), FSCode.DOESNT_EXIST); } } @Override - public FileStat stat(String path) { - var _path = getPath(path); - var f = _path.toFile(); + public void create(String _path, EntryType type) { + var path = realPath(_path); - if (!f.exists()) throw new FilesystemException(_path.toString(), FSCode.DOESNT_EXIST); - checkMode(_path, Mode.READ); + if (type == EntryType.NONE != Files.exists(path)) throw new FilesystemException(path.toString(), FSCode.ALREADY_EXISTS); + + try { + switch (type) { + case FILE: + Files.createFile(path); + break; + case FOLDER: + Files.createDirectories(path); + break; + case NONE: + default: + Files.delete(path); + } + } + catch (IOException e) { throw new FilesystemException(path.toString(), FSCode.NO_PERMISSIONS_RW); } + } + + @Override + public FileStat stat(String _path) { + var path = realPath(_path); + + if (!Files.exists(path)) return new FileStat(Mode.NONE, EntryType.NONE); + + var perms = Mode.NONE; + + if (Files.isReadable(path)) { + if (Files.isWritable(path)) perms = Mode.READ_WRITE; + else perms = Mode.READ; + } + + if (perms == Mode.NONE) return new FileStat(Mode.NONE, EntryType.NONE); return new FileStat( - f.canWrite() ? Mode.READ_WRITE : Mode.READ, - f.isFile() ? EntryType.FILE : EntryType.FOLDER + perms, + Files.isDirectory(path) ? EntryType.FOLDER : EntryType.FILE ); } - public PhysicalFilesystem(Path root) { - this.root = root.toAbsolutePath().normalize(); + public PhysicalFilesystem(String root) { + this.root = Paths.normalize(Path.of(root).toAbsolutePath().toString()); } } diff --git a/src/me/topchetoeu/jscript/filesystem/RootFilesystem.java b/src/me/topchetoeu/jscript/filesystem/RootFilesystem.java index 9afd813..74055c6 100644 --- a/src/me/topchetoeu/jscript/filesystem/RootFilesystem.java +++ b/src/me/topchetoeu/jscript/filesystem/RootFilesystem.java @@ -23,6 +23,18 @@ public class RootFilesystem implements Filesystem { if (mode.writable && perms != null && !canWrite(_path)) throw new FilesystemException(_path, FSCode.NO_PERMISSIONS_RW); } + @Override public String normalize(String path) { + var filename = Filename.parse(path); + var protocol = protocols.get(filename.protocol); + if (protocol == null) return filename.toString(); + else return new Filename(filename.protocol, protocol.normalize(filename.path)).toString(); + } + @Override public String cwd(String cwd, String path) { + var filename = Filename.parse(cwd); + var protocol = protocols.get(filename.protocol); + if (protocol == null) return filename.toString(); + else return new Filename(filename.protocol, protocol.cwd(filename.path, path)).toString(); + } @Override public File open(String path, Mode perms) throws FilesystemException { var filename = Filename.parse(path); var protocol = protocols.get(filename.protocol); From 4bc363485f6fb97042f14c7dbe8bf3517b6e40de Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Tue, 26 Dec 2023 14:01:31 +0200 Subject: [PATCH 19/20] fix: losts of FS API improvements --- src/me/topchetoeu/jscript/Filename.java | 11 +++-- .../jscript/filesystem/Filesystem.java | 3 +- .../jscript/filesystem/ListFile.java | 44 +++++++++--------- .../jscript/filesystem/MemoryFilesystem.java | 7 +-- .../topchetoeu/jscript/filesystem/Paths.java | 9 ++-- .../jscript/filesystem/PhysicalFile.java | 17 +++---- .../filesystem/PhysicalFilesystem.java | 22 ++++----- .../jscript/filesystem/RootFilesystem.java | 25 +++++----- src/me/topchetoeu/jscript/lib/FileLib.java | 22 +++------ .../topchetoeu/jscript/lib/FilesystemLib.java | 46 +++++++++++-------- 10 files changed, 100 insertions(+), 106 deletions(-) diff --git a/src/me/topchetoeu/jscript/Filename.java b/src/me/topchetoeu/jscript/Filename.java index 3138887..36e6a89 100644 --- a/src/me/topchetoeu/jscript/Filename.java +++ b/src/me/topchetoeu/jscript/Filename.java @@ -1,6 +1,7 @@ package me.topchetoeu.jscript; import java.io.File; +import java.nio.file.Path; public class Filename { public final String protocol; @@ -40,9 +41,7 @@ public class Filename { return true; } - public static Filename fromFile(File file) { - return new Filename("file", file.getAbsolutePath()); - } + public Filename(String protocol, String path) { @@ -57,4 +56,10 @@ public class Filename { if (i >= 0) return new Filename(val.substring(0, i).trim(), val.substring(i + 3).trim()); else return new Filename("file", val.trim()); } + public static Path normalize(String path) { + return Path.of(Path.of("/" + path.trim().replace("\\", "/")).normalize().toString().substring(1)); + } + public static Filename fromFile(File file) { + return new Filename("file", file.getAbsolutePath()); + } } diff --git a/src/me/topchetoeu/jscript/filesystem/Filesystem.java b/src/me/topchetoeu/jscript/filesystem/Filesystem.java index e75a00d..c21fb9e 100644 --- a/src/me/topchetoeu/jscript/filesystem/Filesystem.java +++ b/src/me/topchetoeu/jscript/filesystem/Filesystem.java @@ -1,8 +1,7 @@ package me.topchetoeu.jscript.filesystem; public interface Filesystem { - String cwd(String cwd, String path); - String normalize(String path); + String normalize(String... path); File open(String path, Mode mode) throws FilesystemException; void create(String path, EntryType type) throws FilesystemException; FileStat stat(String path) throws FilesystemException; diff --git a/src/me/topchetoeu/jscript/filesystem/ListFile.java b/src/me/topchetoeu/jscript/filesystem/ListFile.java index 8987ded..308f3bb 100644 --- a/src/me/topchetoeu/jscript/filesystem/ListFile.java +++ b/src/me/topchetoeu/jscript/filesystem/ListFile.java @@ -1,56 +1,56 @@ package me.topchetoeu.jscript.filesystem; import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; +import java.util.Iterator; import java.util.stream.Stream; import me.topchetoeu.jscript.filesystem.FilesystemException.FSCode; public class ListFile implements File { - private Stream stream; + private Iterator it; private String filename; private byte[] currFile; private long ptr = 0, start = 0, end = 0; private void next() { - while (stream != null) { - var opt = stream.findFirst(); - - if (opt.isPresent()) { - start = end; - currFile = (opt.get().toString() + "\n").getBytes(); - end = start + currFile.length; - } - else { - stream = null; - currFile = null; - } + if (it != null && it.hasNext()) { + start = end; + currFile = (it.next() + "\n").getBytes(); + end = start + currFile.length; + } + else { + it = null; + currFile = null; + end = -1; } } @Override public void close() { - stream = null; + it = null; currFile = null; } @Override public int read(byte[] buff) { - if (stream == null) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); if (ptr < start) return 0; + if (it == null) return 0; var i = 0; while (i < buff.length) { - while (i > end) next(); + while (i + ptr >= end) { + next(); + if (it == null) return 0; + } int cpyN = Math.min(currFile.length, buff.length - i); - System.arraycopy(buff, i, currFile, 0, cpyN); + System.arraycopy(currFile, (int)(ptr + i - start), buff, i, cpyN); i += cpyN; } + ptr += i; return i; } @@ -66,8 +66,8 @@ public class ListFile implements File { throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_RW); } - public ListFile(Path path) throws IOException { - stream = Files.list(path); - filename = path.toString(); + public ListFile(String filename, Stream stream) throws IOException { + this.it = stream.iterator(); + this.filename = filename; } } diff --git a/src/me/topchetoeu/jscript/filesystem/MemoryFilesystem.java b/src/me/topchetoeu/jscript/filesystem/MemoryFilesystem.java index 2f2f162..5270439 100644 --- a/src/me/topchetoeu/jscript/filesystem/MemoryFilesystem.java +++ b/src/me/topchetoeu/jscript/filesystem/MemoryFilesystem.java @@ -18,15 +18,10 @@ public class MemoryFilesystem implements Filesystem { } @Override - public String normalize(String path) { + public String normalize(String... path) { return Paths.normalize(path); } - @Override - public String cwd(String cwd, String path) { - return Paths.cwd(cwd, path); - } - @Override public void create(String _path, EntryType type) { var path = realPath(_path); diff --git a/src/me/topchetoeu/jscript/filesystem/Paths.java b/src/me/topchetoeu/jscript/filesystem/Paths.java index b59609e..e6f6c38 100644 --- a/src/me/topchetoeu/jscript/filesystem/Paths.java +++ b/src/me/topchetoeu/jscript/filesystem/Paths.java @@ -3,8 +3,8 @@ package me.topchetoeu.jscript.filesystem; import java.util.ArrayList; public class Paths { - public static String normalize(String path) { - var parts = path.split("[\\\\/]"); + public static String normalize(String... path) { + var parts = String.join("/", path).split("[\\\\/]"); var res = new ArrayList(); for (var part : parts) { @@ -12,14 +12,15 @@ public class Paths { else if (part.equals("..")) { if (res.size() > 0) res.remove(res.size() - 1); } - else if (!part.equals(".")) res.add(part); + else if (!part.equals(".") && !part.isEmpty()) res.add(part); } var sb = new StringBuilder(); for (var el : res) sb.append("/").append(el); - return sb.toString(); + if (sb.isEmpty()) return "/"; + else return sb.toString(); } public static String chroot(String root, String path) { diff --git a/src/me/topchetoeu/jscript/filesystem/PhysicalFile.java b/src/me/topchetoeu/jscript/filesystem/PhysicalFile.java index cc3b78c..76365e7 100644 --- a/src/me/topchetoeu/jscript/filesystem/PhysicalFile.java +++ b/src/me/topchetoeu/jscript/filesystem/PhysicalFile.java @@ -9,24 +9,24 @@ import me.topchetoeu.jscript.filesystem.FilesystemException.FSCode; public class PhysicalFile implements File { private String filename; private RandomAccessFile file; - private Mode perms; + private Mode mode; @Override public int read(byte[] buff) { - if (file == null || !perms.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); + if (file == null || !mode.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); else try { return file.read(buff); } catch (IOException e) { throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); } } @Override public void write(byte[] buff) { - if (file == null || !perms.writable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_RW); + if (file == null || !mode.writable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_RW); else try { file.write(buff); } catch (IOException e) { throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_RW); } } @Override public long seek(long offset, int pos) { - if (file == null || !perms.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); + if (file == null || !mode.readable) throw new FilesystemException(filename, FSCode.NO_PERMISSIONS_R); try { if (pos == 1) offset += file.getFilePointer(); @@ -43,14 +43,15 @@ public class PhysicalFile implements File { try { file.close(); } catch (IOException e) {} // SHUT file = null; - perms = Mode.NONE; + mode = Mode.NONE; } - public PhysicalFile(String path, Mode mode) throws FileNotFoundException { + public PhysicalFile(String name, String path, Mode mode) throws FileNotFoundException { + this.filename = name; + this.mode = mode; + if (mode == Mode.NONE) file = null; else try { file = new RandomAccessFile(path, mode.name); } catch (FileNotFoundException e) { throw new FilesystemException(filename, FSCode.DOESNT_EXIST); } - - perms = mode; } } diff --git a/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java b/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java index f590ee5..b1d497e 100644 --- a/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java +++ b/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java @@ -11,9 +11,9 @@ public class PhysicalFilesystem implements Filesystem { private void checkMode(Path path, Mode mode) { if (!path.startsWith(root)) throw new FilesystemException(path.toString(), FSCode.NO_PERMISSIONS_R); - var stat = stat(path.toString()); - if (mode.readable && !stat.mode.readable) throw new FilesystemException(path.toString(), FSCode.NO_PERMISSIONS_R); - if (mode.writable && !stat.mode.writable) throw new FilesystemException(path.toString(), FSCode.NO_PERMISSIONS_RW); + + if (mode.readable && !Files.isReadable(path)) throw new FilesystemException(path.toString(), FSCode.NO_PERMISSIONS_R); + if (mode.writable && !Files.isWritable(path)) throw new FilesystemException(path.toString(), FSCode.NO_PERMISSIONS_RW); } private Path realPath(String path) { @@ -21,24 +21,20 @@ public class PhysicalFilesystem implements Filesystem { } @Override - public String normalize(String path) { - return Paths.normalize(path); - } - - @Override - public String cwd(String cwd, String path) { - return Paths.cwd(cwd, path); + public String normalize(String... paths) { + return Paths.normalize(paths); } @Override public File open(String _path, Mode perms) { + _path = normalize(_path); var path = realPath(_path); checkMode(path, perms); - try { - if (Files.isDirectory(path)) return new ListFile(path); - else return new PhysicalFile(path.toString(), perms); + try { + if (Files.isDirectory(path)) return new ListFile(_path, Files.list(path).map((v -> v.getFileName().toString()))); + else return new PhysicalFile(_path, path.toString(), perms); } catch (IOException e) { throw new FilesystemException(path.toString(), FSCode.DOESNT_EXIST); } } diff --git a/src/me/topchetoeu/jscript/filesystem/RootFilesystem.java b/src/me/topchetoeu/jscript/filesystem/RootFilesystem.java index 74055c6..afa2ba3 100644 --- a/src/me/topchetoeu/jscript/filesystem/RootFilesystem.java +++ b/src/me/topchetoeu/jscript/filesystem/RootFilesystem.java @@ -23,17 +23,17 @@ public class RootFilesystem implements Filesystem { if (mode.writable && perms != null && !canWrite(_path)) throw new FilesystemException(_path, FSCode.NO_PERMISSIONS_RW); } - @Override public String normalize(String path) { - var filename = Filename.parse(path); - var protocol = protocols.get(filename.protocol); - if (protocol == null) return filename.toString(); - else return new Filename(filename.protocol, protocol.normalize(filename.path)).toString(); - } - @Override public String cwd(String cwd, String path) { - var filename = Filename.parse(cwd); - var protocol = protocols.get(filename.protocol); - if (protocol == null) return filename.toString(); - else return new Filename(filename.protocol, protocol.cwd(filename.path, path)).toString(); + @Override public String normalize(String... paths) { + if (paths.length == 0) return "file://"; + else { + var filename = Filename.parse(paths[0]); + var protocol = protocols.get(filename.protocol); + paths[0] = filename.path; + + + if (protocol == null) return Paths.normalize(paths); + else return filename.protocol + "://" + protocol.normalize(paths); + } } @Override public File open(String path, Mode perms) throws FilesystemException { var filename = Filename.parse(path); @@ -57,9 +57,8 @@ public class RootFilesystem implements Filesystem { var filename = Filename.parse(path); var protocol = protocols.get(filename.protocol); if (protocol == null) throw new FilesystemException(filename.toString(), FSCode.DOESNT_EXIST); - modeAllowed(filename.toString(), Mode.READ); - try { return protocol.stat(path); } + try { return protocol.stat(filename.path); } catch (FilesystemException e) { throw new FilesystemException(filename.toString(), e.code); } } diff --git a/src/me/topchetoeu/jscript/lib/FileLib.java b/src/me/topchetoeu/jscript/lib/FileLib.java index 8918f10..536e03c 100644 --- a/src/me/topchetoeu/jscript/lib/FileLib.java +++ b/src/me/topchetoeu/jscript/lib/FileLib.java @@ -15,7 +15,7 @@ public class FileLib { @NativeGetter public PromiseLib pointer(Context ctx) { return PromiseLib.await(ctx, () -> { try { - return file.getPtr(); + return file.seek(0, 1); } catch (FilesystemException e) { throw e.toEngineException(); } }); @@ -23,23 +23,14 @@ public class FileLib { @NativeGetter public PromiseLib length(Context ctx) { return PromiseLib.await(ctx, () -> { try { - long curr = file.getPtr(); - file.setPtr(0, 2); - long res = file.getPtr(); - file.setPtr(curr, 0); + long curr = file.seek(0, 1); + long res = file.seek(0, 2); + file.seek(curr, 0); return res; } catch (FilesystemException e) { throw e.toEngineException(); } }); } - @NativeGetter public PromiseLib getMode(Context ctx) { - return PromiseLib.await(ctx, () -> { - try { - return file.mode().name; - } - catch (FilesystemException e) { throw e.toEngineException(); } - }); - } @Native public PromiseLib read(Context ctx, int n) { return PromiseLib.await(ctx, () -> { @@ -73,11 +64,10 @@ public class FileLib { return null; }); } - @Native public PromiseLib setPointer(Context ctx, long ptr) { + @Native public PromiseLib seek(Context ctx, long ptr, int whence) { return PromiseLib.await(ctx, () -> { try { - file.setPtr(ptr, 0); - return null; + return file.seek(ptr, whence); } catch (FilesystemException e) { throw e.toEngineException(); } }); diff --git a/src/me/topchetoeu/jscript/lib/FilesystemLib.java b/src/me/topchetoeu/jscript/lib/FilesystemLib.java index 98a14d3..881f5ad 100644 --- a/src/me/topchetoeu/jscript/lib/FilesystemLib.java +++ b/src/me/topchetoeu/jscript/lib/FilesystemLib.java @@ -20,6 +20,10 @@ import me.topchetoeu.jscript.interop.Native; @Native("Filesystem") public class FilesystemLib { + @Native public static final int SEEK_SET = 0; + @Native public static final int SEEK_CUR = 1; + @Native public static final int SEEK_END = 2; + private static Filesystem fs(Context ctx) { var env = ctx.environment(); if (env != null) { @@ -29,24 +33,28 @@ public class FilesystemLib { throw EngineException.ofError("Current environment doesn't have a file system."); } + @Native public static String normalize(Context ctx, String... paths) { + return fs(ctx).normalize(paths); + } + @Native public static PromiseLib open(Context ctx, String _path, String mode) { - var filename = Filename.parse(_path); + var path = fs(ctx).normalize(_path); var _mode = Mode.parse(mode); return PromiseLib.await(ctx, () -> { try { - if (fs(ctx).stat(filename.path).type != EntryType.FILE) { - throw new FilesystemException(filename.toString(), FSCode.NOT_FILE); + if (fs(ctx).stat(path).type != EntryType.FILE) { + throw new FilesystemException(path, FSCode.NOT_FILE); } - var file = fs(ctx).open(filename.path, _mode); + var file = fs(ctx).open(path, _mode); return new FileLib(file); } catch (FilesystemException e) { throw e.toEngineException(); } }); } @Native public static ObjectValue ls(Context ctx, String _path) throws IOException { - var filename = Filename.parse(_path); + var path = fs(ctx).normalize(_path); return Values.toJSAsyncIterator(ctx, new Iterator<>() { private boolean failed, done; @@ -57,11 +65,11 @@ public class FilesystemLib { if (done) return; if (!failed) { if (file == null) { - if (fs(ctx).stat(filename.path).type != EntryType.FOLDER) { - throw new FilesystemException(filename.toString(), FSCode.NOT_FOLDER); + if (fs(ctx).stat(path).type != EntryType.FOLDER) { + throw new FilesystemException(path, FSCode.NOT_FOLDER); } - file = fs(ctx).open(filename.path, Mode.READ); + file = fs(ctx).open(path, Mode.READ); } if (nextLine == null) { @@ -108,34 +116,34 @@ public class FilesystemLib { }); } - @Native public static PromiseLib mkfile(Context ctx, String _path) throws IOException { + @Native public static PromiseLib mkfile(Context ctx, String path) throws IOException { return PromiseLib.await(ctx, () -> { try { - fs(ctx).create(Filename.parse(_path).toString(), EntryType.FILE); + fs(ctx).create(path, EntryType.FILE); return null; } catch (FilesystemException e) { throw e.toEngineException(); } }); } - @Native public static PromiseLib rm(Context ctx, String _path, boolean recursive) throws IOException { + @Native public static PromiseLib rm(Context ctx, String path, boolean recursive) throws IOException { return PromiseLib.await(ctx, () -> { try { - if (!recursive) fs(ctx).create(Filename.parse(_path).toString(), EntryType.NONE); + if (!recursive) fs(ctx).create(path, EntryType.NONE); else { var stack = new Stack(); - stack.push(_path); + stack.push(path); while (!stack.empty()) { - var path = Filename.parse(stack.pop()).toString(); + var currPath = stack.pop(); FileStat stat; - try { stat = fs(ctx).stat(path); } + try { stat = fs(ctx).stat(currPath); } catch (FilesystemException e) { continue; } if (stat.type == EntryType.FOLDER) { - for (var el : fs(ctx).open(path, Mode.READ).readToString().split("\n")) stack.push(el); + for (var el : fs(ctx).open(currPath, Mode.READ).readToString().split("\n")) stack.push(el); } - else fs(ctx).create(path, EntryType.NONE); + else fs(ctx).create(currPath, EntryType.NONE); } } return null; @@ -143,10 +151,10 @@ public class FilesystemLib { catch (FilesystemException e) { throw e.toEngineException(); } }); } - @Native public static PromiseLib stat(Context ctx, String _path) throws IOException { + @Native public static PromiseLib stat(Context ctx, String path) throws IOException { return PromiseLib.await(ctx, () -> { try { - var stat = fs(ctx).stat(_path); + var stat = fs(ctx).stat(path); var res = new ObjectValue(); res.defineProperty(ctx, "type", stat.type.name); From 2f58f6b245e52704b80f4c97cdf369f3d40a9721 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Tue, 26 Dec 2023 14:12:32 +0200 Subject: [PATCH 20/20] feat: implement basic module system --- src/assets/js/lib.d.ts | 9 ++++-- src/me/topchetoeu/jscript/Main.java | 4 ++- .../jscript/engine/Environment.java | 17 +++++++--- src/me/topchetoeu/jscript/lib/Internals.java | 6 ++++ src/me/topchetoeu/jscript/modules/Module.java | 20 ++++++++++++ .../jscript/modules/ModuleRepo.java | 32 +++++++++++++++++++ .../jscript/modules/RootModuleRepo.java | 30 +++++++++++++++++ .../jscript/modules/SourceModule.java | 23 +++++++++++++ 8 files changed, 133 insertions(+), 8 deletions(-) create mode 100644 src/me/topchetoeu/jscript/modules/Module.java create mode 100644 src/me/topchetoeu/jscript/modules/ModuleRepo.java create mode 100644 src/me/topchetoeu/jscript/modules/RootModuleRepo.java create mode 100644 src/me/topchetoeu/jscript/modules/SourceModule.java diff --git a/src/assets/js/lib.d.ts b/src/assets/js/lib.d.ts index 72b9d1f..1cc226b 100644 --- a/src/assets/js/lib.d.ts +++ b/src/assets/js/lib.d.ts @@ -488,14 +488,17 @@ interface FileStat { interface File { readonly pointer: Promise; readonly length: Promise; - readonly mode: Promise<'' | 'r' | 'rw'>; read(n: number): Promise; write(buff: number[]): Promise; close(): Promise; - setPointer(val: number): Promise; + seek(offset: number, whence: number): Promise; } interface Filesystem { + readonly SEEK_SET: 0; + readonly SEEK_CUR: 1; + readonly SEEK_END: 2; + open(path: string, mode: 'r' | 'rw'): Promise; ls(path: string): AsyncIterableIterator; mkdir(path: string): Promise; @@ -503,6 +506,7 @@ interface Filesystem { rm(path: string, recursive?: boolean): Promise; stat(path: string): Promise; exists(path: string): Promise; + normalize(...paths: string[]): string; } interface Encoding { @@ -526,6 +530,7 @@ declare var parseInt: typeof Number.parseInt; declare var parseFloat: typeof Number.parseFloat; declare function log(...vals: any[]): void; +declare function require(name: string): any; declare var Array: ArrayConstructor; declare var Boolean: BooleanConstructor; diff --git a/src/me/topchetoeu/jscript/Main.java b/src/me/topchetoeu/jscript/Main.java index db9211c..ca32edd 100644 --- a/src/me/topchetoeu/jscript/Main.java +++ b/src/me/topchetoeu/jscript/Main.java @@ -22,6 +22,7 @@ import me.topchetoeu.jscript.filesystem.MemoryFilesystem; import me.topchetoeu.jscript.filesystem.Mode; import me.topchetoeu.jscript.filesystem.PhysicalFilesystem; import me.topchetoeu.jscript.lib.Internals; +import me.topchetoeu.jscript.modules.ModuleRepo; public class Main { public static class Printer implements Observer { @@ -119,7 +120,8 @@ public class Main { })); environment.filesystem.protocols.put("temp", new MemoryFilesystem(Mode.READ_WRITE)); - environment.filesystem.protocols.put("file", new PhysicalFilesystem(Path.of(".").toAbsolutePath())); + environment.filesystem.protocols.put("file", new PhysicalFilesystem(".")); + environment.modules.repos.put("file", ModuleRepo.ofFilesystem(environment.filesystem)); } private static void initEngine() { debugServer.targets.put("target", (ws, req) -> new SimpleDebugger(ws, engine)); diff --git a/src/me/topchetoeu/jscript/engine/Environment.java b/src/me/topchetoeu/jscript/engine/Environment.java index 0eb322e..8f6e1bc 100644 --- a/src/me/topchetoeu/jscript/engine/Environment.java +++ b/src/me/topchetoeu/jscript/engine/Environment.java @@ -18,10 +18,12 @@ import me.topchetoeu.jscript.interop.Native; import me.topchetoeu.jscript.interop.NativeGetter; import me.topchetoeu.jscript.interop.NativeSetter; import me.topchetoeu.jscript.interop.NativeWrapperProvider; +import me.topchetoeu.jscript.modules.RootModuleRepo; import me.topchetoeu.jscript.parsing.Parsing; import me.topchetoeu.jscript.permissions.Permission; import me.topchetoeu.jscript.permissions.PermissionsProvider; +// TODO: Remove hardcoded extensions form environment public class Environment implements PermissionsProvider { private HashMap prototypes = new HashMap<>(); @@ -30,8 +32,11 @@ public class Environment implements PermissionsProvider { public GlobalScope global; public WrappersProvider wrappers; + public PermissionsProvider permissions = null; public final RootFilesystem filesystem = new RootFilesystem(this); + public final RootModuleRepo modules = new RootModuleRepo(); + public String moduleCwd = "/"; private static int nextId = 0; @@ -63,11 +68,6 @@ public class Environment implements PermissionsProvider { throw EngineException.ofError("Regular expressions not supported.").setCtx(ctx.environment(), ctx.engine); }); - public Environment addData(Data data) { - this.data.addAll(data); - return this; - } - @Native public ObjectValue proto(String name) { return prototypes.get(name); } @@ -96,6 +96,9 @@ public class Environment implements PermissionsProvider { @Native public Environment child() { var res = fork(); res.global = res.global.globalChild(); + res.permissions = this.permissions; + res.filesystem.protocols.putAll(this.filesystem.protocols); + res.modules.repos.putAll(this.modules.repos); return res; } @@ -106,6 +109,10 @@ public class Environment implements PermissionsProvider { return permissions == null || permissions.hasPermission(perm); } + public Context context(Engine engine) { + return new Context(engine, this); + } + public static Symbol getSymbol(String name) { if (symbols.containsKey(name)) return symbols.get(name); else { diff --git a/src/me/topchetoeu/jscript/lib/Internals.java b/src/me/topchetoeu/jscript/lib/Internals.java index 2bc6a26..2059e62 100644 --- a/src/me/topchetoeu/jscript/lib/Internals.java +++ b/src/me/topchetoeu/jscript/lib/Internals.java @@ -20,6 +20,12 @@ public class Internals { private static final DataKey> THREADS = new DataKey<>(); private static final DataKey I = new DataKey<>(); + @Native public static Object require(Context ctx, String name) { + var env = ctx.environment(); + var res = env.modules.getModule(ctx, env.moduleCwd, name); + res.load(ctx); + return res.value(); + } @Native public static Object log(Context ctx, Object ...args) { for (var arg : args) { diff --git a/src/me/topchetoeu/jscript/modules/Module.java b/src/me/topchetoeu/jscript/modules/Module.java new file mode 100644 index 0000000..938c721 --- /dev/null +++ b/src/me/topchetoeu/jscript/modules/Module.java @@ -0,0 +1,20 @@ +package me.topchetoeu.jscript.modules; + +import me.topchetoeu.jscript.engine.Context; + +public abstract class Module { + private Object value; + private boolean loaded; + + public Object value() { return value; } + public boolean loaded() { return loaded; } + + protected abstract Object onLoad(Context ctx); + + public void load(Context ctx) { + if (loaded) return; + this.value = onLoad(ctx); + this.loaded = true; + } +} + diff --git a/src/me/topchetoeu/jscript/modules/ModuleRepo.java b/src/me/topchetoeu/jscript/modules/ModuleRepo.java new file mode 100644 index 0000000..54a98e1 --- /dev/null +++ b/src/me/topchetoeu/jscript/modules/ModuleRepo.java @@ -0,0 +1,32 @@ +package me.topchetoeu.jscript.modules; + +import java.util.HashMap; + +import me.topchetoeu.jscript.Filename; +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.filesystem.Filesystem; +import me.topchetoeu.jscript.filesystem.Mode; + +public interface ModuleRepo { + public Module getModule(Context ctx, String cwd, String name); + + public static ModuleRepo ofFilesystem(Filesystem fs) { + var modules = new HashMap(); + + return (ctx, cwd, name) -> { + name = fs.normalize(cwd, name); + var filename = Filename.parse(name); + var src = fs.open(name, Mode.READ).readToString(); + + if (modules.containsKey(name)) return modules.get(name); + + var env = ctx.environment().child(); + env.moduleCwd = fs.normalize(name, ".."); + + var mod = new SourceModule(filename, src, env); + modules.put(name, mod); + + return mod; + }; + } +} diff --git a/src/me/topchetoeu/jscript/modules/RootModuleRepo.java b/src/me/topchetoeu/jscript/modules/RootModuleRepo.java new file mode 100644 index 0000000..3b57a63 --- /dev/null +++ b/src/me/topchetoeu/jscript/modules/RootModuleRepo.java @@ -0,0 +1,30 @@ +package me.topchetoeu.jscript.modules; + +import java.util.HashMap; + +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.exceptions.EngineException; + +public class RootModuleRepo implements ModuleRepo { + public final HashMap repos = new HashMap<>(); + + @Override + public Module getModule(Context ctx, String cwd, String name) { + var i = name.indexOf(":"); + String repoName, modName; + + if (i < 0) { + repoName = "file"; + modName = name; + } + else { + repoName = name.substring(0, i); + modName = name.substring(i + 1); + } + + var repo = repos.get(repoName); + if (repo == null) throw EngineException.ofError("ModuleError", "Couldn't find module repo '" + repoName + "'."); + + return repo.getModule(ctx, cwd, modName); + } +} diff --git a/src/me/topchetoeu/jscript/modules/SourceModule.java b/src/me/topchetoeu/jscript/modules/SourceModule.java new file mode 100644 index 0000000..5971ce1 --- /dev/null +++ b/src/me/topchetoeu/jscript/modules/SourceModule.java @@ -0,0 +1,23 @@ +package me.topchetoeu.jscript.modules; + +import me.topchetoeu.jscript.Filename; +import me.topchetoeu.jscript.engine.Context; +import me.topchetoeu.jscript.engine.Environment; + +public class SourceModule extends Module { + public final Filename filename; + public final String source; + public final Environment env; + + @Override + protected Object onLoad(Context ctx) { + var res = new Context(ctx.engine, env).compile(filename, source); + return res.call(ctx); + } + + public SourceModule(Filename filename, String source, Environment env) { + this.filename = filename; + this.source = source; + this.env = env; + } +}