From ede369af960c28dcaf9c621a705d550f156dbb41 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Fri, 10 Jul 2020 11:03:27 -0700 Subject: [PATCH 01/31] Create HangingTest.cs --- src/Framework/test/HangingTest.cs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/Framework/test/HangingTest.cs diff --git a/src/Framework/test/HangingTest.cs b/src/Framework/test/HangingTest.cs new file mode 100644 index 000000000000..3cda8d14c350 --- /dev/null +++ b/src/Framework/test/HangingTest.cs @@ -0,0 +1,31 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using ProcessUtilities; +using Xunit; + +namespace XUnitTestProject3 +{ + public class UnitTest1 + { + static UnitTest1() + { + AppDomain.CurrentDomain.FirstChanceException += (sender, e) => + { + if (e.Exception is TestTimeoutException) + { + // Block forever, this allows the test host to collect a dump with the test still on the stack + new ManualResetEventSlim().Wait(); + } + }; + } + + [Fact] + public async Task AsyncTimeoutTest() + { + var tcs = new TaskCompletionSource(); + + await tcs.Task.OrTimeout(); + } + } +} From 9f6e089fc3eac2166c5326975d370e7acf927e81 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Fri, 10 Jul 2020 11:04:38 -0700 Subject: [PATCH 02/31] Update HangingTest.cs --- src/Framework/test/HangingTest.cs | 128 ++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) diff --git a/src/Framework/test/HangingTest.cs b/src/Framework/test/HangingTest.cs index 3cda8d14c350..11362df47e23 100644 --- a/src/Framework/test/HangingTest.cs +++ b/src/Framework/test/HangingTest.cs @@ -1,4 +1,6 @@ using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; using ProcessUtilities; @@ -28,4 +30,130 @@ public async Task AsyncTimeoutTest() await tcs.Task.OrTimeout(); } } + + + static class TaskExtensions + { + private const int DefaultTimeout = 5 * 1000; + + public static Task OrTimeout(this ValueTask task, int milliseconds = DefaultTimeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) + { + return OrTimeout(task, new TimeSpan(0, 0, 0, 0, milliseconds), memberName, filePath, lineNumber); + } + + public static Task OrTimeout(this ValueTask task, TimeSpan timeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) + { + return task.AsTask().TimeoutAfter(timeout, filePath, lineNumber ?? 0); + } + + public static Task OrTimeout(this Task task, int milliseconds = DefaultTimeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) + { + return OrTimeout(task, new TimeSpan(0, 0, 0, 0, milliseconds), memberName, filePath, lineNumber); + } + + public static Task OrTimeout(this Task task, TimeSpan timeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) + { + return task.TimeoutAfter(timeout, filePath, lineNumber ?? 0); + } + + public static Task OrTimeout(this ValueTask task, int milliseconds = DefaultTimeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) => + OrTimeout(task, new TimeSpan(0, 0, 0, 0, milliseconds), memberName, filePath, lineNumber); + + public static Task OrTimeout(this ValueTask task, TimeSpan timeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) => + task.AsTask().OrTimeout(timeout, memberName, filePath, lineNumber); + + public static Task OrTimeout(this Task task, int milliseconds = DefaultTimeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) + { + return OrTimeout(task, new TimeSpan(0, 0, 0, 0, milliseconds), memberName, filePath, lineNumber); + } + + public static Task OrTimeout(this Task task, TimeSpan timeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) + { + return task.TimeoutAfter(timeout, filePath, lineNumber ?? 0); + } + + public static async Task OrThrowIfOtherFails(this Task task, Task otherTask) + { + var completed = await Task.WhenAny(task, otherTask); + if (completed == otherTask && otherTask.IsFaulted) + { + // Manifest the exception + otherTask.GetAwaiter().GetResult(); + throw new Exception("Unreachable code"); + } + else + { + // Await the task we were asked to await. Either it's finished, or the otherTask finished successfully, and it's not our job to check that + await task; + } + } + + public static async Task OrThrowIfOtherFails(this Task task, Task otherTask) + { + await OrThrowIfOtherFails((Task)task, otherTask); + + // If we get here, 'task' is finished and succeeded. + return task.GetAwaiter().GetResult(); + } + + public static async Task TimeoutAfter(this Task task, TimeSpan timeout, + [CallerFilePath] string filePath = null, + [CallerLineNumber] int lineNumber = default) + { + // Don't create a timer if the task is already completed + // or the debugger is attached + if (task.IsCompleted || Debugger.IsAttached) + { + return await task; + } + + var cts = new CancellationTokenSource(); + if (task == await Task.WhenAny(task, Task.Delay(timeout, cts.Token))) + { + cts.Cancel(); + return await task; + } + else + { + throw new TestTimeoutException(CreateMessage(timeout, filePath, lineNumber)); + } + } + + public static async Task TimeoutAfter(this Task task, TimeSpan timeout, + [CallerFilePath] string filePath = null, + [CallerLineNumber] int lineNumber = default) + { + // Don't create a timer if the task is already completed + // or the debugger is attached + if (task.IsCompleted || Debugger.IsAttached) + { + await task; + return; + } + + var cts = new CancellationTokenSource(); + if (task == await Task.WhenAny(task, Task.Delay(timeout, cts.Token))) + { + cts.Cancel(); + await task; + } + else + { + throw new TimeoutException(CreateMessage(timeout, filePath, lineNumber)); + } + } + + private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber) + => string.IsNullOrEmpty(filePath) + ? $"The operation timed out after reaching the limit of {timeout.TotalMilliseconds}ms." + : $"The operation at {filePath}:{lineNumber} timed out after reaching the limit of {timeout.TotalMilliseconds}ms."; + } + + public class TestTimeoutException : TimeoutException + { + public TestTimeoutException(string message) : base(message) + { + + } + } } From 20ef2e2032bdc9901852f918869a567f265ecee2 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Fri, 10 Jul 2020 12:06:23 -0700 Subject: [PATCH 03/31] Update HangingTest.cs --- src/Framework/test/HangingTest.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Framework/test/HangingTest.cs b/src/Framework/test/HangingTest.cs index 11362df47e23..f879e955a8c2 100644 --- a/src/Framework/test/HangingTest.cs +++ b/src/Framework/test/HangingTest.cs @@ -3,7 +3,6 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; -using ProcessUtilities; using Xunit; namespace XUnitTestProject3 From d3f7077935e4e7b9f2b7df4e4ca8bd59a6aa6c46 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Mon, 27 Jul 2020 14:26:31 -0700 Subject: [PATCH 04/31] Switch to test instead of vstest to prepare for new blame flag --- eng/helix/content/RunTests/TestRunner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index da4b4c228f0c..f5165d5731a6 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -247,7 +247,7 @@ public async Task RunTestsAsync() { // Timeout test run 5 minutes before the Helix job would timeout var cts = new CancellationTokenSource(Options.Timeout.Subtract(TimeSpan.FromMinutes(5))); - var commonTestArgs = $"vstest {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame"; + var commonTestArgs = $"test {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame"; if (Options.Quarantined) { Console.WriteLine("Running quarantined tests."); From 406559683756b8b9071fcea6a7be47aa321f4013 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Tue, 28 Jul 2020 01:38:36 -0700 Subject: [PATCH 05/31] Try new test timeout flag for --blame --- eng/helix/content/RunTests/TestRunner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index f5165d5731a6..d72fd6475ebd 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -247,7 +247,7 @@ public async Task RunTestsAsync() { // Timeout test run 5 minutes before the Helix job would timeout var cts = new CancellationTokenSource(Options.Timeout.Subtract(TimeSpan.FromMinutes(5))); - var commonTestArgs = $"test {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame"; + var commonTestArgs = $"test {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame "CollectHangDump;TestTimeout=5m"; if (Options.Quarantined) { Console.WriteLine("Running quarantined tests."); From 771f9461f59b2baffc30165837217664ec5bc6ba Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Tue, 28 Jul 2020 02:33:10 -0700 Subject: [PATCH 06/31] Update TestRunner.cs --- eng/helix/content/RunTests/TestRunner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index d72fd6475ebd..ea1606cd48ac 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -247,7 +247,7 @@ public async Task RunTestsAsync() { // Timeout test run 5 minutes before the Helix job would timeout var cts = new CancellationTokenSource(Options.Timeout.Subtract(TimeSpan.FromMinutes(5))); - var commonTestArgs = $"test {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame "CollectHangDump;TestTimeout=5m"; + var commonTestArgs = $"test {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame \"CollectHangDump;TestTimeout=5m\""; if (Options.Quarantined) { Console.WriteLine("Running quarantined tests."); From 31755f99a351f7b8ae25bdbf6c9c1966acb460e6 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Wed, 29 Jul 2020 01:44:17 -0700 Subject: [PATCH 07/31] Upload all dmp files under TestResults --- eng/helix/content/RunTests/TestRunner.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index ea1606cd48ac..58ae324abd71 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -331,6 +331,22 @@ public void UploadResults() { Console.WriteLine("No logs found in artifacts/log"); } + Console.WriteLine($"Copying TestResults/**/*.dmp to {HELIX_WORKITEM_UPLOAD_ROOT}/"); + if (Directory.Exists("TestResults")) + { + foreach (var file in Directory.EnumerateFiles("TestResults", "*.dmp", SearchOption.AllDirectories)) + { + // Combine the directory name + log name for the copied log file name to avoid overwriting duplicate test names in different test projects + Console.WriteLine($"Copying: {file} to {Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, file)}"); + // Need to copy to HELIX_WORKITEM_UPLOAD_ROOT and HELIX_WORKITEM_UPLOAD_ROOT/../ in order for Azure Devops attachments to link properly and for Helix to store the logs + File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, file)); + File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, "..", file)); + } + } + else + { + Console.WriteLine("No dmps found in TestResults"); + } } } } From 3c7c75ebf725067d4a45b732d5ae491bbf898a86 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Wed, 29 Jul 2020 02:43:01 -0700 Subject: [PATCH 08/31] Add rest of hang tests from helix-prototype --- src/Identity/src/Common/AssemblyResolution.cs | 58 ++ src/Identity/src/Common/AssemblyResolver.cs | 109 ++++ src/Identity/src/Common/BuildTask.Desktop.cs | 16 + src/Identity/src/Common/BuildTask.cs | 152 ++++++ src/Identity/src/Common/ExponentialRetry.cs | 74 +++ .../src/Common/TestUtilities/AssertEx.cs | 502 ++++++++++++++++++ .../src/Common/TestUtilities/DiffUtil.cs | 272 ++++++++++ .../src/Common/TestUtilities/MockEngine.cs | 122 +++++ .../src/ProcessUtilities/ProcessUtil.cs | 198 +++++++ .../ProcessUtilities/ProcessUtilities.csproj | 7 + .../src/ProcessWithAv/ProcessWithAv.csproj | 18 + src/Identity/src/ProcessWithAv/Program.cs | 18 + .../ProcessWithCrash/ProcessWithCrash.csproj | 18 + src/Identity/src/ProcessWithCrash/Program.cs | 29 + .../ProcessWithHang/ProcessWithHang.csproj | 18 + src/Identity/src/ProcessWithHang/Program.cs | 13 + .../ExecutionCollector.cs | 125 +++++ .../UnitTestingDiagnostics.Collector.csproj | 15 + .../test/XUnitTestProject1/UnitTest1.cs | 29 + .../XUnitTestProject1.csproj | 14 + .../test/XUnitTestProject2/UnitTest1.cs | 34 ++ .../XUnitTestProject2.csproj | 10 + .../test/XUnitTestProject3/TaskExtensions.cs | 133 +++++ .../test/XUnitTestProject3/UnitTest1.cs | 31 ++ .../XUnitTestProject3.csproj | 14 + .../test/XUnitTestProject4/UnitTest1.cs | 50 ++ .../XUnitTestProject4.csproj | 14 + .../test/XUnitTestProject5/UnitTest1.cs | 17 + .../XUnitTestProject5.csproj | 15 + .../test/XUnitTestProject6/UnitTest1.cs | 31 ++ .../XUnitTestProject6.csproj | 16 + .../test/XUnitTestProject7/UnitTest1.cs | 29 + .../XUnitTestProject7.csproj | 14 + .../test/XUnitTestProject8/UnitTest1.cs | 29 + .../XUnitTestProject8.csproj | 15 + .../test/XUnitTestProject9/UnitTest1.cs | 20 + .../XUnitTestProject9.csproj | 14 + 37 files changed, 2293 insertions(+) create mode 100644 src/Identity/src/Common/AssemblyResolution.cs create mode 100644 src/Identity/src/Common/AssemblyResolver.cs create mode 100644 src/Identity/src/Common/BuildTask.Desktop.cs create mode 100644 src/Identity/src/Common/BuildTask.cs create mode 100644 src/Identity/src/Common/ExponentialRetry.cs create mode 100644 src/Identity/src/Common/TestUtilities/AssertEx.cs create mode 100644 src/Identity/src/Common/TestUtilities/DiffUtil.cs create mode 100644 src/Identity/src/Common/TestUtilities/MockEngine.cs create mode 100644 src/Identity/src/ProcessUtilities/ProcessUtil.cs create mode 100644 src/Identity/src/ProcessUtilities/ProcessUtilities.csproj create mode 100644 src/Identity/src/ProcessWithAv/ProcessWithAv.csproj create mode 100644 src/Identity/src/ProcessWithAv/Program.cs create mode 100644 src/Identity/src/ProcessWithCrash/ProcessWithCrash.csproj create mode 100644 src/Identity/src/ProcessWithCrash/Program.cs create mode 100644 src/Identity/src/ProcessWithHang/ProcessWithHang.csproj create mode 100644 src/Identity/src/ProcessWithHang/Program.cs create mode 100644 src/Identity/src/UnitTestingDiagnostics/ExecutionCollector.cs create mode 100644 src/Identity/src/UnitTestingDiagnostics/UnitTestingDiagnostics.Collector.csproj create mode 100644 src/Identity/test/XUnitTestProject1/UnitTest1.cs create mode 100644 src/Identity/test/XUnitTestProject1/XUnitTestProject1.csproj create mode 100644 src/Identity/test/XUnitTestProject2/UnitTest1.cs create mode 100644 src/Identity/test/XUnitTestProject2/XUnitTestProject2.csproj create mode 100644 src/Identity/test/XUnitTestProject3/TaskExtensions.cs create mode 100644 src/Identity/test/XUnitTestProject3/UnitTest1.cs create mode 100644 src/Identity/test/XUnitTestProject3/XUnitTestProject3.csproj create mode 100644 src/Identity/test/XUnitTestProject4/UnitTest1.cs create mode 100644 src/Identity/test/XUnitTestProject4/XUnitTestProject4.csproj create mode 100644 src/Identity/test/XUnitTestProject5/UnitTest1.cs create mode 100644 src/Identity/test/XUnitTestProject5/XUnitTestProject5.csproj create mode 100644 src/Identity/test/XUnitTestProject6/UnitTest1.cs create mode 100644 src/Identity/test/XUnitTestProject6/XUnitTestProject6.csproj create mode 100644 src/Identity/test/XUnitTestProject7/UnitTest1.cs create mode 100644 src/Identity/test/XUnitTestProject7/XUnitTestProject7.csproj create mode 100644 src/Identity/test/XUnitTestProject8/UnitTest1.cs create mode 100644 src/Identity/test/XUnitTestProject8/XUnitTestProject8.csproj create mode 100644 src/Identity/test/XUnitTestProject9/UnitTest1.cs create mode 100644 src/Identity/test/XUnitTestProject9/XUnitTestProject9.csproj diff --git a/src/Identity/src/Common/AssemblyResolution.cs b/src/Identity/src/Common/AssemblyResolution.cs new file mode 100644 index 000000000000..09673ce631e4 --- /dev/null +++ b/src/Identity/src/Common/AssemblyResolution.cs @@ -0,0 +1,58 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#if NET472 + +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; + +namespace Microsoft.DotNet +{ + internal static class AssemblyResolution + { + internal static TaskLoggingHelper Log; + + public static void Initialize() + { + AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolve; + } + + private static Assembly AssemblyResolve(object sender, ResolveEventArgs args) + { + var name = new AssemblyName(args.Name); + + if (!name.Name.Equals("System.Collections.Immutable", StringComparison.OrdinalIgnoreCase)) + { + return null; + } + + var fullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "System.Collections.Immutable.dll"); + + Assembly sci; + try + { + sci = Assembly.LoadFile(fullPath); + } + catch (Exception e) + { + Log?.LogWarning($"AssemblyResolve: exception while loading '{fullPath}': {e.Message}"); + return null; + } + + if (name.Version <= sci.GetName().Version) + { + Log?.LogMessage(MessageImportance.Low, $"AssemblyResolve: loaded '{fullPath}' to {AppDomain.CurrentDomain.FriendlyName}"); + return sci; + } + + return null; + } + } +} + +#endif diff --git a/src/Identity/src/Common/AssemblyResolver.cs b/src/Identity/src/Common/AssemblyResolver.cs new file mode 100644 index 000000000000..8f266c2e61df --- /dev/null +++ b/src/Identity/src/Common/AssemblyResolver.cs @@ -0,0 +1,109 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Diagnostics; +using System.IO; +using System.Reflection; + +namespace Microsoft.DotNet.Build.Common.Desktop +{ + /// + /// Used to enable app-local assembly unification. + /// + internal static class AssemblyResolver + { + static AssemblyResolver() + { + AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; + } + + /// + /// Call to enable the assembly resolver for the current AppDomain. + /// + public static void Enable() + { + // intentionally empty. This is just meant to ensure the static constructor + // has run. + } + + private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) + { + // apply any existing policy + AssemblyName referenceName = new AssemblyName(AppDomain.CurrentDomain.ApplyPolicy(args.Name)); + + string fileName = referenceName.Name + ".dll"; + string assemblyPath = null; + string probingPath = null; + Assembly assm = null; + + // look next to requesting assembly + assemblyPath = args.RequestingAssembly?.Location; + if (!String.IsNullOrEmpty(assemblyPath)) + { + probingPath = Path.Combine(Path.GetDirectoryName(assemblyPath), fileName); + Debug.WriteLine($"Considering {probingPath} based on RequestingAssembly"); + if (Probe(probingPath, referenceName.Version, out assm)) + { + return assm; + } + } + + // look next to the executing assembly + assemblyPath = Assembly.GetExecutingAssembly().Location; + if (!String.IsNullOrEmpty(assemblyPath)) + { + probingPath = Path.Combine(Path.GetDirectoryName(assemblyPath), fileName); + + Debug.WriteLine($"Considering {probingPath} based on ExecutingAssembly"); + if (Probe(probingPath, referenceName.Version, out assm)) + { + return assm; + } + } + + // look in AppDomain base directory + probingPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName); + Debug.WriteLine($"Considering {probingPath} based on BaseDirectory"); + if (Probe(probingPath, referenceName.Version, out assm)) + { + return assm; + } + + // look in current directory + Debug.WriteLine($"Considering {fileName}"); + if (Probe(fileName, referenceName.Version, out assm)) + { + return assm; + } + + return null; + } + + /// + /// Considers a path to load for satisfying an assembly ref and loads it + /// if the file exists and version is sufficient. + /// + /// Path to consider for load + /// Minimum version to consider + /// loaded assembly + /// true if assembly was loaded + private static bool Probe(string filePath, Version minimumVersion, out Assembly assembly) + { + if (File.Exists(filePath)) + { + AssemblyName name = AssemblyName.GetAssemblyName(filePath); + + if (name.Version >= minimumVersion) + { + assembly = Assembly.Load(name); + return true; + } + } + + assembly = null; + return false; + } + } +} diff --git a/src/Identity/src/Common/BuildTask.Desktop.cs b/src/Identity/src/Common/BuildTask.Desktop.cs new file mode 100644 index 000000000000..5dac62182594 --- /dev/null +++ b/src/Identity/src/Common/BuildTask.Desktop.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.DotNet.Build.Common.Desktop; + +namespace Microsoft.DotNet.Build.Tasks +{ + public partial class BuildTask + { + static BuildTask() + { + AssemblyResolver.Enable(); + } + } +} diff --git a/src/Identity/src/Common/BuildTask.cs b/src/Identity/src/Common/BuildTask.cs new file mode 100644 index 000000000000..e497ade909e5 --- /dev/null +++ b/src/Identity/src/Common/BuildTask.cs @@ -0,0 +1,152 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using System; + +namespace Microsoft.DotNet.Build.Tasks +{ + public abstract partial class BuildTask : ITask + { + private Log _log = null; + + internal Log Log + { + get { return _log ?? (_log = new Log(new TaskLoggingHelper(this))); } + } + + public BuildTask() + { + } + + public IBuildEngine BuildEngine + { + get; + set; + } + + public ITaskHost HostObject + { + get; + set; + } + + public abstract bool Execute(); + } + + internal class Log : ILog + { + private readonly TaskLoggingHelper _logger; + public Log(TaskLoggingHelper logger) + { + _logger = logger; + } + + public void LogError(string message, params object[] messageArgs) + { + _logger.LogError(message, messageArgs); + } + + public void LogErrorFromException(Exception exception, bool showStackTrace) + { + _logger.LogErrorFromException(exception, showStackTrace); + } + + public void LogMessage(string message, params object[] messageArgs) + { + _logger.LogMessage(message, messageArgs); + } + + public void LogMessage(LogImportance importance, string message, params object[] messageArgs) + { + _logger.LogMessage((MessageImportance)importance, message, messageArgs); + } + + public void LogWarning(string message, params object[] messageArgs) + { + _logger.LogWarning(message, messageArgs); + } + + public bool HasLoggedErrors { get { return _logger.HasLoggedErrors; } } + } + + public enum LogImportance + { + Low = MessageImportance.Low, + Normal = MessageImportance.Normal, + High = MessageImportance.High + } + + + public interface ILog + { + // + // Summary: + // Logs an error with the specified message. + // + // Parameters: + // message: + // The message. + // + // messageArgs: + // Optional arguments for formatting the message string. + // + // Exceptions: + // T:System.ArgumentNullException: + // message is null. + void LogError(string message, params object[] messageArgs); + + // + // Summary: + // Logs a message with the specified string. + // + // Parameters: + // message: + // The message. + // + // messageArgs: + // The arguments for formatting the message. + // + // Exceptions: + // T:System.ArgumentNullException: + // message is null. + void LogMessage(string message, params object[] messageArgs); + + // + // Summary: + // Logs a message with the specified string and importance. + // + // Parameters: + // importance: + // One of the enumeration values that specifies the importance of the message. + // + // message: + // The message. + // + // messageArgs: + // The arguments for formatting the message. + // + // Exceptions: + // T:System.ArgumentNullException: + // message is null. + void LogMessage(LogImportance importance, string message, params object[] messageArgs); + + // + // Summary: + // Logs a warning with the specified message. + // + // Parameters: + // message: + // The message. + // + // messageArgs: + // Optional arguments for formatting the message string. + // + // Exceptions: + // T:System.ArgumentNullException: + // message is null. + void LogWarning(string message, params object[] messageArgs); + } +} diff --git a/src/Identity/src/Common/ExponentialRetry.cs b/src/Identity/src/Common/ExponentialRetry.cs new file mode 100644 index 000000000000..984d2b7dc760 --- /dev/null +++ b/src/Identity/src/Common/ExponentialRetry.cs @@ -0,0 +1,74 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.DotNet.VersionTools.Util +{ + public class ExponentialRetry + { + private Random _random = new Random(); + + public int MaxAttempts { get; set; } = 10; + + /// + /// Base, in seconds, raised to the power of the number of retries so far. + /// + public double DelayBase { get; set; } = 6; + + /// + /// A constant, in seconds, added to (base^retries) to find the delay before retrying. + /// + /// The default is -1 to make the first retry instant, because ((base^0)-1) == 0. + /// + public double DelayConstant { get; set; } = -1; + + public double MinRandomFactor { get; set; } = 0.5; + public double MaxRandomFactor { get; set; } = 1.0; + + public CancellationToken DefaultCancellationToken { get; set; } = CancellationToken.None; + + public Task RunAsync(Func> actionSuccessfulAsync) + { + return RunAsync(actionSuccessfulAsync, DefaultCancellationToken); + } + + public async Task RunAsync( + Func> actionSuccessfulAsync, + CancellationToken cancellationToken) + { + for (int i = 0; i < MaxAttempts; i++) + { + string attempt = $"Attempt {i + 1}/{MaxAttempts}"; + Trace.TraceInformation(attempt); + + if (await actionSuccessfulAsync(i)) + { + return true; + } + + double randomFactor = + _random.NextDouble() * (MaxRandomFactor - MinRandomFactor) + MinRandomFactor; + + TimeSpan delay = TimeSpan.FromSeconds( + (Math.Pow(DelayBase, i) + DelayConstant) * randomFactor); + + Trace.TraceInformation($"{attempt} failed. Waiting {delay} before next try."); + + try + { + await Task.Delay(delay, cancellationToken); + } + catch (TaskCanceledException) + { + break; + } + } + return false; + } + } +} diff --git a/src/Identity/src/Common/TestUtilities/AssertEx.cs b/src/Identity/src/Common/TestUtilities/AssertEx.cs new file mode 100644 index 000000000000..26e92367065e --- /dev/null +++ b/src/Identity/src/Common/TestUtilities/AssertEx.cs @@ -0,0 +1,502 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Text; +using Xunit; + +namespace TestUtilities +{ + /// + /// Assert style type to deal with the lack of features in xUnit's Assert type + /// + public static class AssertEx + { + #region AssertEqualityComparer + + private class AssertEqualityComparer : IEqualityComparer + { + private static readonly IEqualityComparer s_instance = new AssertEqualityComparer(); + + private static bool CanBeNull() + { + var type = typeof(T); + return !type.GetTypeInfo().IsValueType || + (type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)); + } + + public static bool IsNull(T @object) + { + if (!CanBeNull()) + { + return false; + } + + return object.Equals(@object, default(T)); + } + + public static bool Equals(T left, T right) + { + return s_instance.Equals(left, right); + } + + bool IEqualityComparer.Equals(T x, T y) + { + if (CanBeNull()) + { + if (object.Equals(x, default(T))) + { + return object.Equals(y, default(T)); + } + + if (object.Equals(y, default(T))) + { + return false; + } + } + + if (x.GetType() != y.GetType()) + { + return false; + } + + var equatable = x as IEquatable; + if (equatable != null) + { + return equatable.Equals(y); + } + + var comparableT = x as IComparable; + if (comparableT != null) + { + return comparableT.CompareTo(y) == 0; + } + + var comparable = x as IComparable; + if (comparable != null) + { + return comparable.CompareTo(y) == 0; + } + + var enumerableX = x as IEnumerable; + var enumerableY = y as IEnumerable; + + if (enumerableX != null && enumerableY != null) + { + var enumeratorX = enumerableX.GetEnumerator(); + var enumeratorY = enumerableY.GetEnumerator(); + + while (true) + { + bool hasNextX = enumeratorX.MoveNext(); + bool hasNextY = enumeratorY.MoveNext(); + + if (!hasNextX || !hasNextY) + { + return hasNextX == hasNextY; + } + + if (!Equals(enumeratorX.Current, enumeratorY.Current)) + { + return false; + } + } + } + + return object.Equals(x, y); + } + + int IEqualityComparer.GetHashCode(T obj) + { + throw new NotImplementedException(); + } + } + + #endregion + + public static void AreEqual(T expected, T actual, string message = null, IEqualityComparer comparer = null) + { + if (ReferenceEquals(expected, actual)) + { + return; + } + + if (expected == null) + { + Fail("expected was null, but actual wasn't\r\n" + message); + } + else if (actual == null) + { + Fail("actual was null, but expected wasn't\r\n" + message); + } + else + { + if (!(comparer != null ? + comparer.Equals(expected, actual) : + AssertEqualityComparer.Equals(expected, actual))) + { + Fail("Expected and actual were different.\r\n" + + "Expected: " + expected + "\r\n" + + "Actual: " + actual + "\r\n" + + message); + } + } + } + + public static void Equal(ImmutableArray expected, IEnumerable actual, Func comparer = null, string message = null) + { + if (actual == null || expected.IsDefault) + { + Assert.True((actual == null) == expected.IsDefault, message); + } + else + { + Equal((IEnumerable)expected, actual, comparer, message); + } + } + + public static void Equal(IEnumerable expected, ImmutableArray actual, Func comparer = null, string message = null, string itemSeparator = null) + { + if (expected == null || actual.IsDefault) + { + Assert.True((expected == null) == actual.IsDefault, message); + } + else + { + Equal(expected, (IEnumerable)actual, comparer, message, itemSeparator); + } + } + + public static void Equal(ImmutableArray expected, ImmutableArray actual, Func comparer = null, string message = null, string itemSeparator = null) + { + Equal(expected, (IEnumerable)actual, comparer, message, itemSeparator); + } + + public static void Equal(IEnumerable expected, IEnumerable actual, Func comparer = null, string message = null, + string itemSeparator = null, Func itemInspector = null) + { + if (ReferenceEquals(expected, actual)) + { + return; + } + + if (expected == null) + { + Fail("expected was null, but actual wasn't\r\n" + message); + } + else if (actual == null) + { + Fail("actual was null, but expected wasn't\r\n" + message); + } + else if (!SequenceEqual(expected, actual, comparer)) + { + string assertMessage = GetAssertMessage(expected, actual, comparer, itemInspector, itemSeparator); + + if (message != null) + { + assertMessage = message + "\r\n" + assertMessage; + } + + Assert.True(false, assertMessage); + } + } + + private static bool SequenceEqual(IEnumerable expected, IEnumerable actual, Func comparer = null) + { + var enumerator1 = expected.GetEnumerator(); + var enumerator2 = actual.GetEnumerator(); + + while (true) + { + var hasNext1 = enumerator1.MoveNext(); + var hasNext2 = enumerator2.MoveNext(); + + if (hasNext1 != hasNext2) + { + return false; + } + + if (!hasNext1) + { + break; + } + + var value1 = enumerator1.Current; + var value2 = enumerator2.Current; + + if (!(comparer != null ? comparer(value1, value2) : AssertEqualityComparer.Equals(value1, value2))) + { + return false; + } + } + + return true; + } + + public static void SetEqual(IEnumerable expected, IEnumerable actual, IEqualityComparer comparer = null, string message = null, string itemSeparator = "\r\n") + { + var expectedSet = new HashSet(expected, comparer); + var result = expected.Count() == actual.Count() && expectedSet.SetEquals(actual); + if (!result) + { + if (string.IsNullOrEmpty(message)) + { + message = GetAssertMessage(expected, actual); + } + + Assert.True(result, message); + } + } + + public static void SetEqual(IEnumerable actual, params T[] expected) + { + var expectedSet = new HashSet(expected); + Assert.True(expectedSet.SetEquals(actual), string.Format("Expected: {0}\nActual: {1}", ToString(expected), ToString(actual))); + } + + public static void None(IEnumerable actual, Func predicate) + { + var none = !actual.Any(predicate); + if (!none) + { + Assert.True(none, string.Format( + "Unexpected item found among existing items: {0}\nExisting items: {1}", + ToString(actual.First(predicate)), + ToString(actual))); + } + } + + public static void Any(IEnumerable actual, Func predicate) + { + var any = actual.Any(predicate); + Assert.True(any, string.Format("No expected item was found.\nExisting items: {0}", ToString(actual))); + } + + public static void All(IEnumerable actual, Func predicate) + { + var all = actual.All(predicate); + if (!all) + { + Assert.True(all, string.Format( + "Not all items satisfy condition:\n{0}", + ToString(actual.Where(i => !predicate(i))))); + } + } + + public static string ToString(object o) + { + return Convert.ToString(o); + } + + public static string ToString(IEnumerable list, string separator = ", ", Func itemInspector = null) + { + if (itemInspector == null) + { + itemInspector = i => Convert.ToString(i); + } + + return string.Join(separator, list.Select(itemInspector)); + } + + public static void Fail(string message) + { + Assert.False(true, message); + } + + public static void Fail(string format, params object[] args) + { + Assert.False(true, string.Format(format, args)); + } + + public static void Null(T @object, string message = null) + { + Assert.True(AssertEqualityComparer.IsNull(@object), message); + } + + public static void NotNull(T @object, string message = null) + { + Assert.False(AssertEqualityComparer.IsNull(@object), message); + } + + // compares against a baseline + public static void AssertEqualToleratingWhitespaceDifferences( + string expected, + string actual, + bool escapeQuotes = true, + [CallerFilePath]string expectedValueSourcePath = null, + [CallerLineNumber]int expectedValueSourceLine = 0) + { + if (!EqualIgnoringWhitespace(expected, actual)) + { + Assert.True(false, GetAssertMessage(expected, actual, escapeQuotes, expectedValueSourcePath, expectedValueSourceLine)); + } + } + + public static bool EqualIgnoringWhitespace(string left, string right) + => NormalizeWhitespace(left) == NormalizeWhitespace(right); + + public static void ThrowsArgumentNull(string parameterName, Action del) + { + try + { + del(); + } + catch (ArgumentNullException e) + { + Assert.Equal(parameterName, e.ParamName); + } + } + + public static void ThrowsArgumentException(string parameterName, Action del) + { + try + { + del(); + } + catch (ArgumentException e) + { + Assert.Equal(parameterName, e.ParamName); + } + } + + public static T Throws(Action del, bool allowDerived = false) where T : Exception + { + try + { + del(); + } + catch (Exception ex) + { + var type = ex.GetType(); + if (type.Equals(typeof(T))) + { + // We got exactly the type we wanted + return (T)ex; + } + + if (allowDerived && typeof(T).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo())) + { + // We got a derived type + return (T)ex; + } + + // We got some other type. We know that type != typeof(T), and so we'll use Assert.Equal since Xunit + // will give a nice Expected/Actual output for this + Assert.Equal(typeof(T), type); + } + + throw new Exception("No exception was thrown."); + } + + internal static string NormalizeWhitespace(string input) + { + var output = new StringBuilder(); + var inputLines = input.Split('\n', '\r'); + foreach (var line in inputLines) + { + var trimmedLine = line.Trim(); + if (trimmedLine.Length > 0) + { + if (!(trimmedLine[0] == '{' || trimmedLine[0] == '}')) + { + output.Append(" "); + } + + output.AppendLine(trimmedLine); + } + } + + return output.ToString(); + } + + public static string GetAssertMessage(string expected, string actual, bool escapeQuotes = false, string expectedValueSourcePath = null, int expectedValueSourceLine = 0) + { + return GetAssertMessage(DiffUtil.Lines(expected), DiffUtil.Lines(actual), escapeQuotes, expectedValueSourcePath, expectedValueSourceLine); + } + + public static string GetAssertMessage(IEnumerable expected, IEnumerable actual, bool escapeQuotes, string expectedValueSourcePath = null, int expectedValueSourceLine = 0) + { + Func itemInspector = escapeQuotes ? new Func(t => t.ToString().Replace("\"", "\"\"")) : null; + return GetAssertMessage(expected, actual, itemInspector: itemInspector, itemSeparator: "\r\n", expectedValueSourcePath: expectedValueSourcePath, expectedValueSourceLine: expectedValueSourceLine); + } + + public static string GetAssertMessage( + IEnumerable expected, + IEnumerable actual, + Func comparer = null, + Func itemInspector = null, + string itemSeparator = null, + string expectedValueSourcePath = null, + int expectedValueSourceLine = 0) + { + if (itemInspector == null) + { + if (expected is IEnumerable) + { + itemInspector = b => $"0x{b:X2}"; + } + else + { + itemInspector = new Func(obj => (obj != null) ? obj.ToString() : ""); + } + } + + if (itemSeparator == null) + { + if (expected is IEnumerable) + { + itemSeparator = ", "; + } + else + { + itemSeparator = ",\r\n"; + } + } + + var message = new StringBuilder(); + message.AppendLine(); + message.AppendLine("Actual:"); + message.AppendLine(string.Join(itemSeparator, actual.Select(itemInspector))); + + message.AppendLine(); + message.AppendLine("Expected:"); + message.AppendLine(string.Join(itemSeparator, expected.Select(itemInspector))); + + message.AppendLine(); + message.AppendLine("Diff:"); + message.Append(DiffUtil.DiffReport(expected, actual, comparer, itemInspector, itemSeparator)); + + return message.ToString(); + } + + public static void AssertLinesEqual(string expected, string actual, string message = null, Func comparer = null) + { + if (expected == actual) + { + return; + } + + Assert.NotNull(expected); + Assert.NotNull(actual); + + IEnumerable GetLines(string str) => + str.Trim().Replace("\r\n", "\n").Split(new[] { '\r', '\n' }, StringSplitOptions.None); + + Equal( + GetLines(expected), + GetLines(actual), + message: message, + comparer: comparer ?? new Func((left, right) => left.Trim() == right.Trim()), + itemInspector: line => line.Replace("\"", "\"\""), + itemSeparator: Environment.NewLine); + } + + } +} diff --git a/src/Identity/src/Common/TestUtilities/DiffUtil.cs b/src/Identity/src/Common/TestUtilities/DiffUtil.cs new file mode 100644 index 000000000000..a9a42007ff6d --- /dev/null +++ b/src/Identity/src/Common/TestUtilities/DiffUtil.cs @@ -0,0 +1,272 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; + +namespace TestUtilities +{ + public class DiffUtil + { + private enum EditKind + { + /// + /// No change. + /// + None = 0, + + /// + /// Node value was updated. + /// + Update = 1, + + /// + /// Node was inserted. + /// + Insert = 2, + + /// + /// Node was deleted. + /// + Delete = 3, + } + + private class LCS : LongestCommonSubsequence> + { + public static readonly LCS Default = new LCS((left, right) => EqualityComparer.Default.Equals(left, right)); + + private readonly Func _comparer; + + public LCS(Func comparer) + { + _comparer = comparer; + } + + protected override bool ItemsEqual(IList sequenceA, int indexA, IList sequenceB, int indexB) + { + return _comparer(sequenceA[indexA], sequenceB[indexB]); + } + + public IEnumerable CalculateDiff(IList sequenceA, IList sequenceB, Func toString) + { + foreach (var edit in GetEdits(sequenceA, sequenceA.Count, sequenceB, sequenceB.Count).Reverse()) + { + switch (edit.Kind) + { + case EditKind.Delete: + yield return "--> " + toString(sequenceA[edit.IndexA]); + break; + + case EditKind.Insert: + yield return "++> " + toString(sequenceB[edit.IndexB]); + break; + + case EditKind.Update: + yield return " " + toString(sequenceB[edit.IndexB]); + break; + } + } + } + } + + public static string DiffReport(IEnumerable expected, IEnumerable actual, Func comparer = null, Func toString = null, string separator = ",\r\n") + { + var lcs = (comparer != null) ? new LCS(comparer) : LCS.Default; + toString = toString ?? new Func(obj => obj.ToString()); + + IList expectedList = expected as IList ?? new List(expected); + IList actualList = actual as IList ?? new List(actual); + + return string.Join(separator, lcs.CalculateDiff(expectedList, actualList, toString)); + } + + private static readonly char[] s_lineSplitChars = new[] { '\r', '\n' }; + + public static string[] Lines(string s) + { + return s.Split(s_lineSplitChars, StringSplitOptions.RemoveEmptyEntries); + } + + public static string DiffReport(string expected, string actual) + { + var exlines = Lines(expected); + var aclines = Lines(actual); + return DiffReport(exlines, aclines, separator: "\r\n"); + } + + /// + /// Calculates Longest Common Subsequence. + /// + private abstract class LongestCommonSubsequence + { + protected struct Edit + { + public readonly EditKind Kind; + public readonly int IndexA; + public readonly int IndexB; + + internal Edit(EditKind kind, int indexA, int indexB) + { + this.Kind = kind; + this.IndexA = indexA; + this.IndexB = indexB; + } + } + + private const int DeleteCost = 1; + private const int InsertCost = 1; + private const int UpdateCost = 2; + + protected abstract bool ItemsEqual(TSequence sequenceA, int indexA, TSequence sequenceB, int indexB); + + protected IEnumerable> GetMatchingPairs(TSequence sequenceA, int lengthA, TSequence sequenceB, int lengthB) + { + int[,] d = ComputeCostMatrix(sequenceA, lengthA, sequenceB, lengthB); + int i = lengthA; + int j = lengthB; + + while (i != 0 && j != 0) + { + if (d[i, j] == d[i - 1, j] + DeleteCost) + { + i--; + } + else if (d[i, j] == d[i, j - 1] + InsertCost) + { + j--; + } + else + { + i--; + j--; + yield return new KeyValuePair(i, j); + } + } + } + + protected IEnumerable GetEdits(TSequence sequenceA, int lengthA, TSequence sequenceB, int lengthB) + { + int[,] d = ComputeCostMatrix(sequenceA, lengthA, sequenceB, lengthB); + int i = lengthA; + int j = lengthB; + + while (i != 0 && j != 0) + { + if (d[i, j] == d[i - 1, j] + DeleteCost) + { + i--; + yield return new Edit(EditKind.Delete, i, -1); + } + else if (d[i, j] == d[i, j - 1] + InsertCost) + { + j--; + yield return new Edit(EditKind.Insert, -1, j); + } + else + { + i--; + j--; + yield return new Edit(EditKind.Update, i, j); + } + } + + while (i > 0) + { + i--; + yield return new Edit(EditKind.Delete, i, -1); + } + + while (j > 0) + { + j--; + yield return new Edit(EditKind.Insert, -1, j); + } + } + + /// + /// Returns a distance [0..1] of the specified sequences. + /// The smaller distance the more of their elements match. + /// + /// + /// Returns a distance [0..1] of the specified sequences. + /// The smaller distance the more of their elements match. + /// + protected double ComputeDistance(TSequence sequenceA, int lengthA, TSequence sequenceB, int lengthB) + { + Debug.Assert(lengthA >= 0 && lengthB >= 0); + + if (lengthA == 0 || lengthB == 0) + { + return (lengthA == lengthB) ? 0.0 : 1.0; + } + + int lcsLength = 0; + foreach (var pair in GetMatchingPairs(sequenceA, lengthA, sequenceB, lengthB)) + { + lcsLength++; + } + + int max = Math.Max(lengthA, lengthB); + Debug.Assert(lcsLength <= max); + return 1.0 - (double)lcsLength / (double)max; + } + + /// + /// Calculates costs of all paths in an edit graph starting from vertex (0,0) and ending in vertex (lengthA, lengthB). + /// + /// + /// The edit graph for A and B has a vertex at each point in the grid (i,j), i in [0, lengthA] and j in [0, lengthB]. + /// + /// The vertices of the edit graph are connected by horizontal, vertical, and diagonal directed edges to form a directed acyclic graph. + /// Horizontal edges connect each vertex to its right neighbor. + /// Vertical edges connect each vertex to the neighbor below it. + /// Diagonal edges connect vertex (i,j) to vertex (i-1,j-1) if (sequenceA[i-1],sequenceB[j-1]) is true. + /// + /// Editing starts with S = []. + /// Move along horizontal edge (i-1,j)-(i,j) represents the fact that sequenceA[i-1] is not added to S. + /// Move along vertical edge (i,j-1)-(i,j) represents an insert of sequenceB[j-1] to S. + /// Move along diagonal edge (i-1,j-1)-(i,j) represents an addition of sequenceB[j-1] to S via an acceptable + /// change of sequenceA[i-1] to sequenceB[j-1]. + /// + /// In every vertex the cheapest outgoing edge is selected. + /// The number of diagonal edges on the path from (0,0) to (lengthA, lengthB) is the length of the longest common subsequence. + /// + private int[,] ComputeCostMatrix(TSequence sequenceA, int lengthA, TSequence sequenceB, int lengthB) + { + var la = lengthA + 1; + var lb = lengthB + 1; + + // TODO: Optimization possible: O(ND) time, O(N) space + // EUGENE W. MYERS: An O(ND) Difference Algorithm and Its Variations + var d = new int[la, lb]; + + d[0, 0] = 0; + for (int i = 1; i <= lengthA; i++) + { + d[i, 0] = d[i - 1, 0] + DeleteCost; + } + + for (int j = 1; j <= lengthB; j++) + { + d[0, j] = d[0, j - 1] + InsertCost; + } + + for (int i = 1; i <= lengthA; i++) + { + for (int j = 1; j <= lengthB; j++) + { + int m1 = d[i - 1, j - 1] + (ItemsEqual(sequenceA, i - 1, sequenceB, j - 1) ? 0 : UpdateCost); + int m2 = d[i - 1, j] + DeleteCost; + int m3 = d[i, j - 1] + InsertCost; + d[i, j] = Math.Min(Math.Min(m1, m2), m3); + } + } + + return d; + } + } + } +} diff --git a/src/Identity/src/Common/TestUtilities/MockEngine.cs b/src/Identity/src/Common/TestUtilities/MockEngine.cs new file mode 100644 index 000000000000..b1efe5e7ec47 --- /dev/null +++ b/src/Identity/src/Common/TestUtilities/MockEngine.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Build.Framework; +using Xunit.Abstractions; +using Xunit.Sdk; + +namespace Microsoft.DotNet.Arcade.Sdk.Tests.Utilities +{ + internal class MockEngine : IBuildEngine5 + { + private readonly ITestOutputHelper _output; + + public MockEngine() + { + } + + public MockEngine(ITestOutputHelper output) + { + _output = output; + } + + public ICollection Messages { get; } = new List(); + public ICollection Warnings { get; } = new List(); + public ICollection Errors { get; } = new List(); + + public bool IsRunningMultipleNodes => false; + + public bool ContinueOnError { get; set; } + + public int LineNumberOfTaskNode => 0; + + public int ColumnNumberOfTaskNode => 0; + + public string ProjectFileOfTaskNode => ""; + + public void LogMessageEvent(BuildMessageEventArgs e) + { + _output?.WriteLine($"{e.Importance} : {e.Message}"); + Messages.Add(e); + } + + public void LogWarningEvent(BuildWarningEventArgs e) + { + _output?.WriteLine($"warning {e.Code}: {e.Message}"); + Warnings.Add(e); + } + + public void LogErrorEvent(BuildErrorEventArgs e) + { + _output?.WriteLine($"error {e.Code}: {e.Message}"); + Errors.Add(e); + if (!ContinueOnError) + { + throw new XunitException("Task error: " + e.Message); + } + } + + public void LogCustomEvent(CustomBuildEventArgs e) + { + _output?.WriteLine(e.Message ?? string.Empty); + } + + public void LogTelemetry(string eventName, IDictionary properties) + { + if (_output != null) + { + _output?.WriteLine($"telemetry {eventName}: {properties.Aggregate(string.Empty, (sum, piece) => $"{sum}, {piece.Key} = {piece.Value}")}"); + } + } + + #region NotImplemented + + public bool BuildProjectFile(string projectFileName, string[] targetNames, IDictionary globalProperties, IDictionary targetOutputs, string toolsVersion) + { + throw new NotImplementedException(); + } + + public bool BuildProjectFile(string projectFileName, string[] targetNames, IDictionary globalProperties, IDictionary targetOutputs) + { + throw new NotImplementedException(); + } + + public BuildEngineResult BuildProjectFilesInParallel(string[] projectFileNames, string[] targetNames, IDictionary[] globalProperties, IList[] removeGlobalProperties, string[] toolsVersion, bool returnTargetOutputs) + { + throw new NotImplementedException(); + } + + public bool BuildProjectFilesInParallel(string[] projectFileNames, string[] targetNames, IDictionary[] globalProperties, IDictionary[] targetOutputsPerProject, string[] toolsVersion, bool useResultsCache, bool unloadProjectsOnCompletion) + { + throw new NotImplementedException(); + } + + public object GetRegisteredTaskObject(object key, RegisteredTaskObjectLifetime lifetime) + { + throw new NotImplementedException(); + } + + public void Reacquire() + { + throw new NotImplementedException(); + } + + public void RegisterTaskObject(object key, object obj, RegisteredTaskObjectLifetime lifetime, bool allowEarlyCollection) + { + throw new NotImplementedException(); + } + + public object UnregisterTaskObject(object key, RegisteredTaskObjectLifetime lifetime) + { + throw new NotImplementedException(); + } + + public void Yield() + { + throw new NotImplementedException(); + } + #endregion + } +} + diff --git a/src/Identity/src/ProcessUtilities/ProcessUtil.cs b/src/Identity/src/ProcessUtilities/ProcessUtil.cs new file mode 100644 index 000000000000..0efce44f13f1 --- /dev/null +++ b/src/Identity/src/ProcessUtilities/ProcessUtil.cs @@ -0,0 +1,198 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace ProcessUtilities +{ + public static class ProcessUtil + { + [DllImport("libc", SetLastError = true, EntryPoint = "kill")] + private static extern int sys_kill(int pid, int sig); + + public static Task CaptureDumpAsync() + { + var dumpDirectoryPath = Environment.GetEnvironmentVariable("HELIX_DUMP_FOLDER"); + + if (dumpDirectoryPath == null) + { + return Task.CompletedTask; + } + + var process = Process.GetCurrentProcess(); + var dumpFilePath = Path.Combine(dumpDirectoryPath, $"{process.ProcessName}-{process.Id}.dmp"); + + return CaptureDumpAsync(process.Id, dumpFilePath); + } + + public static Task CaptureDumpAsync(int pid) + { + var dumpDirectoryPath = Environment.GetEnvironmentVariable("HELIX_DUMP_FOLDER"); + + if (dumpDirectoryPath == null) + { + return Task.CompletedTask; + } + + var process = Process.GetProcessById(pid); + var dumpFilePath = Path.Combine(dumpDirectoryPath, $"{process.ProcessName}.{process.Id}.dmp"); + + return CaptureDumpAsync(process.Id, dumpFilePath); + } + + public static Task CaptureDumpAsync(int pid, string dumpFilePath) + { + // Skip this on OSX, we know it's unsupported right now + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + // Can we capture stacks or do a gcdump instead? + return Task.CompletedTask; + } + + return RunAsync("dotnet-dump", $"collect -p {pid} -o \"{dumpFilePath}\""); + } + + public static async Task<(string, string, int)> RunAsync( + string filename, + string arguments, + string workingDirectory = null, + string dumpDirectoryPath = null, + bool throwOnError = true, + IDictionary environmentVariables = null, + Action outputDataReceived = null, + Action errorDataReceived = null, + Action onStart = null, + CancellationToken cancellationToken = default) + { + using var process = new Process() + { + StartInfo = + { + FileName = filename, + Arguments = arguments, + RedirectStandardOutput = true, + RedirectStandardError = true, + UseShellExecute = false, + CreateNoWindow = true, + }, + EnableRaisingEvents = true + }; + + + if (workingDirectory != null) + { + process.StartInfo.WorkingDirectory = workingDirectory; + } + + dumpDirectoryPath ??= Environment.GetEnvironmentVariable("HELIX_DUMP_FOLDER"); + + if (dumpDirectoryPath != null) + { + process.StartInfo.EnvironmentVariables["COMPlus_DbgEnableMiniDump"] = "1"; + process.StartInfo.EnvironmentVariables["COMPlus_DbgMiniDumpName"] = Path.Combine(dumpDirectoryPath, $"{Path.GetFileName(filename)}.%d.dmp"); + } + + if (environmentVariables != null) + { + foreach (var kvp in environmentVariables) + { + process.StartInfo.Environment.Add(kvp); + } + } + + var outputBuilder = new StringBuilder(); + process.OutputDataReceived += (_, e) => + { + if (e.Data != null) + { + if (outputDataReceived != null) + { + outputDataReceived.Invoke(e.Data); + } + else + { + outputBuilder.AppendLine(e.Data); + } + } + }; + + var errorBuilder = new StringBuilder(); + process.ErrorDataReceived += (_, e) => + { + if (e.Data != null) + { + if (errorDataReceived != null) + { + errorDataReceived.Invoke(e.Data); + } + else + { + errorBuilder.AppendLine(e.Data); + } + } + }; + + var processLifetimeTask = new TaskCompletionSource<(string, string, int)>(); + + process.Exited += (_, e) => + { + if (throwOnError && process.ExitCode != 0) + { + processLifetimeTask.TrySetException(new InvalidOperationException($"Command {filename} {arguments} returned exit code {process.ExitCode}. \r\nStdOut:{outputBuilder}, \r\nStdErr: {errorBuilder}")); + } + else + { + processLifetimeTask.TrySetResult((outputBuilder.ToString(), errorBuilder.ToString(), process.ExitCode)); + } + }; + + process.Start(); + onStart?.Invoke(process.Id); + + process.BeginOutputReadLine(); + process.BeginErrorReadLine(); + + var cancelledTcs = new TaskCompletionSource(); + await using var _ = cancellationToken.Register(() => cancelledTcs.TrySetResult(null)); + + var result = await Task.WhenAny(processLifetimeTask.Task, cancelledTcs.Task); + + if (result == cancelledTcs.Task) + { + if (dumpDirectoryPath != null) + { + var dumpFilePath = Path.Combine(dumpDirectoryPath, $"{Path.GetFileName(filename)}.{process.Id}.dmp"); + // Capture a process dump if the dumpDirectory is set + await CaptureDumpAsync(process.Id, dumpFilePath); + } + + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + sys_kill(process.Id, sig: 2); // SIGINT + + var cancel = new CancellationTokenSource(); + + await Task.WhenAny(processLifetimeTask.Task, Task.Delay(TimeSpan.FromSeconds(5), cancel.Token)); + + cancel.Cancel(); + } + + if (!process.HasExited) + { + process.CloseMainWindow(); + + if (!process.HasExited) + { + process.Kill(); + } + } + } + + return await processLifetimeTask.Task; + } + } +} diff --git a/src/Identity/src/ProcessUtilities/ProcessUtilities.csproj b/src/Identity/src/ProcessUtilities/ProcessUtilities.csproj new file mode 100644 index 000000000000..cb631906963a --- /dev/null +++ b/src/Identity/src/ProcessUtilities/ProcessUtilities.csproj @@ -0,0 +1,7 @@ + + + + netcoreapp3.1 + + + diff --git a/src/Identity/src/ProcessWithAv/ProcessWithAv.csproj b/src/Identity/src/ProcessWithAv/ProcessWithAv.csproj new file mode 100644 index 000000000000..1b31179482cb --- /dev/null +++ b/src/Identity/src/ProcessWithAv/ProcessWithAv.csproj @@ -0,0 +1,18 @@ + + + + Exe + netcoreapp3.1 + true + + + + + + + + + + + diff --git a/src/Identity/src/ProcessWithAv/Program.cs b/src/Identity/src/ProcessWithAv/Program.cs new file mode 100644 index 000000000000..2ec7fe587485 --- /dev/null +++ b/src/Identity/src/ProcessWithAv/Program.cs @@ -0,0 +1,18 @@ +using System; +using System.Threading; + +namespace ProcessWithAv +{ + public class Program + { + static void Main(string[] args) + { + Thread.Sleep(5000); + + unsafe + { + *(int*)0x12345678 = 0x1; + } + } + } +} diff --git a/src/Identity/src/ProcessWithCrash/ProcessWithCrash.csproj b/src/Identity/src/ProcessWithCrash/ProcessWithCrash.csproj new file mode 100644 index 000000000000..eb20ac2b370e --- /dev/null +++ b/src/Identity/src/ProcessWithCrash/ProcessWithCrash.csproj @@ -0,0 +1,18 @@ + + + + Exe + netcoreapp3.1 + + + + + + + + + + + + diff --git a/src/Identity/src/ProcessWithCrash/Program.cs b/src/Identity/src/ProcessWithCrash/Program.cs new file mode 100644 index 000000000000..2abe9c2515d3 --- /dev/null +++ b/src/Identity/src/ProcessWithCrash/Program.cs @@ -0,0 +1,29 @@ +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace ProcessWithCrash +{ + public class Program + { + static Task Main(string[] args) + { + var tcs = new TaskCompletionSource(); + + ThreadPool.QueueUserWorkItem(state => + { + NullReference(null); + + tcs.TrySetResult(null); + }, + null); + + return tcs.Task; + } + + private static void NullReference(object o) + { + o.ToString(); + } + } +} diff --git a/src/Identity/src/ProcessWithHang/ProcessWithHang.csproj b/src/Identity/src/ProcessWithHang/ProcessWithHang.csproj new file mode 100644 index 000000000000..c2b1d72220ba --- /dev/null +++ b/src/Identity/src/ProcessWithHang/ProcessWithHang.csproj @@ -0,0 +1,18 @@ + + + + Exe + netcoreapp5.0 + + + + + + + + + + + + diff --git a/src/Identity/src/ProcessWithHang/Program.cs b/src/Identity/src/ProcessWithHang/Program.cs new file mode 100644 index 000000000000..effd07256f89 --- /dev/null +++ b/src/Identity/src/ProcessWithHang/Program.cs @@ -0,0 +1,13 @@ +using System; +using System.Threading.Tasks; + +namespace ProcessWithHang +{ + public class Program + { + static async Task Main(string[] args) + { + await new TaskCompletionSource().Task; + } + } +} diff --git a/src/Identity/src/UnitTestingDiagnostics/ExecutionCollector.cs b/src/Identity/src/UnitTestingDiagnostics/ExecutionCollector.cs new file mode 100644 index 000000000000..de01557e13e2 --- /dev/null +++ b/src/Identity/src/UnitTestingDiagnostics/ExecutionCollector.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Concurrent; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Threading; +using System.Xml; +using Microsoft.VisualStudio.TestPlatform.ObjectModel; +using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; +using ProcessUtilities; + +namespace UnitTestingDiagnostics +{ + [DataCollectorFriendlyName("execution")] + [DataCollectorTypeUri("datacollector://Microsoft/TestPlatform/Extensions/execution/v1")] + public class ExecutionCollector : DataCollector + { + public override void Initialize(XmlElement configurationElement, DataCollectionEvents events, DataCollectionSink dataSink, DataCollectionLogger logger, DataCollectionEnvironmentContext environmentContext) + { + var map = new ConcurrentDictionary(); + var timeout = TimeSpan.FromSeconds(20); + var testHostProcessId = 0; + Timer inactivityTimer = null; + + async void CaptureTestState(object state) + { + inactivityTimer.Change(-1, -1); + inactivityTimer = null; + + Process process = null; + + try + { + process = Process.GetProcessById(testHostProcessId); + } + catch (ArgumentException) + { + // Process doesn't exist.. + } + catch (InvalidOperationException) + { + // Process doesn't exist.. + } + + // Incomplete tests + var incompleteTests = string.Join(Environment.NewLine, map.Values.Where(r => !r.IsCompleted).Select(r => " - " + r.TestName)); + logger.LogWarning(environmentContext.SessionDataCollectionContext, "Incomplete Tests: \r\n" + incompleteTests); + + try + { + // Attempt to capture a dump if the process hasn't crashed + if (process != null) + { + logger.LogWarning(environmentContext.SessionDataCollectionContext, $"Capturing dump the test run is hanging. It's been > {timeout} since the last set of test activity"); + + var dumpFilePath = Path.Combine(Path.GetTempPath(), $"dotnet.{testHostProcessId}.dmp"); + await ProcessUtil.CaptureDumpAsync(testHostProcessId, dumpFilePath); + dataSink.SendFileAsync(environmentContext.SessionDataCollectionContext, dumpFilePath, true); + } + } + catch (Exception ex) + { + logger.LogError(environmentContext.SessionDataCollectionContext, ex); + } + finally + { + if (process != null) + { + logger.LogWarning(environmentContext.SessionDataCollectionContext, $"Killing the test host process {testHostProcessId}"); + process.Kill(); + } + } + } + + void ResetTimer() + { + inactivityTimer?.Change(timeout, Timeout.InfiniteTimeSpan); + } + + events.SessionEnd += (sender, e) => + { + inactivityTimer?.Dispose(); + inactivityTimer = null; + }; + + events.TestHostLaunched += (sender, e) => + { + inactivityTimer = new Timer(CaptureTestState, null, timeout, Timeout.InfiniteTimeSpan); + + testHostProcessId = e.TestHostProcessId; + }; + + events.TestCaseStart += (sender, e) => + { + ResetTimer(); + + map[e.TestCaseId] = new TestResult + { + TestName = e.TestCaseName + }; + + logger.LogWarning(environmentContext.SessionDataCollectionContext, e.TestCaseName + " [Start]"); + }; + + events.TestCaseEnd += (sender, e) => + { + ResetTimer(); + + var result = map[e.TestCaseId]; + + result.IsCompleted = true; + result.TestOutcome = e.TestOutcome; + + logger.LogWarning(environmentContext.SessionDataCollectionContext, e.TestCaseName + " [Ended]"); + }; + } + + private class TestResult + { + public string TestName { get; set; } + public TestOutcome TestOutcome { get; set; } + public bool IsCompleted { get; set; } + } + } +} diff --git a/src/Identity/src/UnitTestingDiagnostics/UnitTestingDiagnostics.Collector.csproj b/src/Identity/src/UnitTestingDiagnostics/UnitTestingDiagnostics.Collector.csproj new file mode 100644 index 000000000000..b78398b76979 --- /dev/null +++ b/src/Identity/src/UnitTestingDiagnostics/UnitTestingDiagnostics.Collector.csproj @@ -0,0 +1,15 @@ + + + + netcoreapp3.1 + + + + + + + + + + + diff --git a/src/Identity/test/XUnitTestProject1/UnitTest1.cs b/src/Identity/test/XUnitTestProject1/UnitTest1.cs new file mode 100644 index 000000000000..8b4b49c51fb0 --- /dev/null +++ b/src/Identity/test/XUnitTestProject1/UnitTest1.cs @@ -0,0 +1,29 @@ +using System; +using System.Threading.Tasks; +using Xunit; + +namespace XUnitTestProject1 +{ + public class UnitTest1 + { + [Fact] + public async Task HangTestRunner() + { + var tcs = new TaskCompletionSource(); + + await tcs.Task; + } + + [Fact] + public async Task SlowTest() + { + await Task.Delay(1000); + } + + [Fact] + public async Task SlowerTest() + { + await Task.Delay(5000); + } + } +} diff --git a/src/Identity/test/XUnitTestProject1/XUnitTestProject1.csproj b/src/Identity/test/XUnitTestProject1/XUnitTestProject1.csproj new file mode 100644 index 000000000000..c3e3821f5aa2 --- /dev/null +++ b/src/Identity/test/XUnitTestProject1/XUnitTestProject1.csproj @@ -0,0 +1,14 @@ + + + + $(DefaultNetCoreTargetFramework) + true + true + false + + + + + + + diff --git a/src/Identity/test/XUnitTestProject2/UnitTest1.cs b/src/Identity/test/XUnitTestProject2/UnitTest1.cs new file mode 100644 index 000000000000..f4ec46c6bfa4 --- /dev/null +++ b/src/Identity/test/XUnitTestProject2/UnitTest1.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections; +using Xunit; +using Xunit.Abstractions; + +namespace XUnitTestProject2 +{ + public class UnitTest1 + { + private readonly ITestOutputHelper _testOutputHelper; + + public UnitTest1(ITestOutputHelper testOutputHelper) + { + _testOutputHelper = testOutputHelper; + } + + [Fact] + public void LogTestOutput() + { + Console.WriteLine("This is direct console output from the test"); + + _testOutputHelper.WriteLine("This is line from a test!"); + + _testOutputHelper.WriteLine("This is line from another line from a test!"); + + foreach (DictionaryEntry pair in Environment.GetEnvironmentVariables()) + { + _testOutputHelper.WriteLine(pair.Key + "=" + pair.Value); + } + + Assert.True(false); + } + } +} diff --git a/src/Identity/test/XUnitTestProject2/XUnitTestProject2.csproj b/src/Identity/test/XUnitTestProject2/XUnitTestProject2.csproj new file mode 100644 index 000000000000..4282ef35b627 --- /dev/null +++ b/src/Identity/test/XUnitTestProject2/XUnitTestProject2.csproj @@ -0,0 +1,10 @@ + + + + $(DefaultNetCoreTargetFramework) + true + true + false + + + diff --git a/src/Identity/test/XUnitTestProject3/TaskExtensions.cs b/src/Identity/test/XUnitTestProject3/TaskExtensions.cs new file mode 100644 index 000000000000..50747ae0aa65 --- /dev/null +++ b/src/Identity/test/XUnitTestProject3/TaskExtensions.cs @@ -0,0 +1,133 @@ +using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading; +using System.Threading.Tasks; + +namespace XUnitTestProject3 +{ + static class TaskExtensions + { + private const int DefaultTimeout = 5 * 1000; + + public static Task OrTimeout(this ValueTask task, int milliseconds = DefaultTimeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) + { + return OrTimeout(task, new TimeSpan(0, 0, 0, 0, milliseconds), memberName, filePath, lineNumber); + } + + public static Task OrTimeout(this ValueTask task, TimeSpan timeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) + { + return task.AsTask().TimeoutAfter(timeout, filePath, lineNumber ?? 0); + } + + public static Task OrTimeout(this Task task, int milliseconds = DefaultTimeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) + { + return OrTimeout(task, new TimeSpan(0, 0, 0, 0, milliseconds), memberName, filePath, lineNumber); + } + + public static Task OrTimeout(this Task task, TimeSpan timeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) + { + return task.TimeoutAfter(timeout, filePath, lineNumber ?? 0); + } + + public static Task OrTimeout(this ValueTask task, int milliseconds = DefaultTimeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) => + OrTimeout(task, new TimeSpan(0, 0, 0, 0, milliseconds), memberName, filePath, lineNumber); + + public static Task OrTimeout(this ValueTask task, TimeSpan timeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) => + task.AsTask().OrTimeout(timeout, memberName, filePath, lineNumber); + + public static Task OrTimeout(this Task task, int milliseconds = DefaultTimeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) + { + return OrTimeout(task, new TimeSpan(0, 0, 0, 0, milliseconds), memberName, filePath, lineNumber); + } + + public static Task OrTimeout(this Task task, TimeSpan timeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null) + { + return task.TimeoutAfter(timeout, filePath, lineNumber ?? 0); + } + + public static async Task OrThrowIfOtherFails(this Task task, Task otherTask) + { + var completed = await Task.WhenAny(task, otherTask); + if (completed == otherTask && otherTask.IsFaulted) + { + // Manifest the exception + otherTask.GetAwaiter().GetResult(); + throw new Exception("Unreachable code"); + } + else + { + // Await the task we were asked to await. Either it's finished, or the otherTask finished successfully, and it's not our job to check that + await task; + } + } + + public static async Task OrThrowIfOtherFails(this Task task, Task otherTask) + { + await OrThrowIfOtherFails((Task)task, otherTask); + + // If we get here, 'task' is finished and succeeded. + return task.GetAwaiter().GetResult(); + } + + public static async Task TimeoutAfter(this Task task, TimeSpan timeout, + [CallerFilePath] string filePath = null, + [CallerLineNumber] int lineNumber = default) + { + // Don't create a timer if the task is already completed + // or the debugger is attached + if (task.IsCompleted || Debugger.IsAttached) + { + return await task; + } + + var cts = new CancellationTokenSource(); + if (task == await Task.WhenAny(task, Task.Delay(timeout, cts.Token))) + { + cts.Cancel(); + return await task; + } + else + { + throw new TestTimeoutException(CreateMessage(timeout, filePath, lineNumber)); + } + } + + public static async Task TimeoutAfter(this Task task, TimeSpan timeout, + [CallerFilePath] string filePath = null, + [CallerLineNumber] int lineNumber = default) + { + // Don't create a timer if the task is already completed + // or the debugger is attached + if (task.IsCompleted || Debugger.IsAttached) + { + await task; + return; + } + + var cts = new CancellationTokenSource(); + if (task == await Task.WhenAny(task, Task.Delay(timeout, cts.Token))) + { + cts.Cancel(); + await task; + } + else + { + throw new TimeoutException(CreateMessage(timeout, filePath, lineNumber)); + } + } + + private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber) + => string.IsNullOrEmpty(filePath) + ? $"The operation timed out after reaching the limit of {timeout.TotalMilliseconds}ms." + : $"The operation at {filePath}:{lineNumber} timed out after reaching the limit of {timeout.TotalMilliseconds}ms."; + } + + public class TestTimeoutException : TimeoutException + { + public TestTimeoutException(string message) : base(message) + { + + } + } +} diff --git a/src/Identity/test/XUnitTestProject3/UnitTest1.cs b/src/Identity/test/XUnitTestProject3/UnitTest1.cs new file mode 100644 index 000000000000..96e1e1d684ff --- /dev/null +++ b/src/Identity/test/XUnitTestProject3/UnitTest1.cs @@ -0,0 +1,31 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using ProcessUtilities; +using Xunit; + +namespace XUnitTestProject3 +{ + public class UnitTest1 + { + static UnitTest1() + { + AppDomain.CurrentDomain.FirstChanceException += (sender, e) => + { + if (e.Exception is TestTimeoutException) + { + // Block forever, this allows the test host to collect a dump with the test still on the stack + new ManualResetEventSlim().Wait(); + } + }; + } + + [Fact] + public async Task AsyncTimeoutTest() + { + var tcs = new TaskCompletionSource(); + + await tcs.Task.OrTimeout(); + } + } +} diff --git a/src/Identity/test/XUnitTestProject3/XUnitTestProject3.csproj b/src/Identity/test/XUnitTestProject3/XUnitTestProject3.csproj new file mode 100644 index 000000000000..c3e3821f5aa2 --- /dev/null +++ b/src/Identity/test/XUnitTestProject3/XUnitTestProject3.csproj @@ -0,0 +1,14 @@ + + + + $(DefaultNetCoreTargetFramework) + true + true + false + + + + + + + diff --git a/src/Identity/test/XUnitTestProject4/UnitTest1.cs b/src/Identity/test/XUnitTestProject4/UnitTest1.cs new file mode 100644 index 000000000000..90f012208ea4 --- /dev/null +++ b/src/Identity/test/XUnitTestProject4/UnitTest1.cs @@ -0,0 +1,50 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace XUnitTestProject4 +{ + public class OtherComponent + { + public static void Execute(TaskCompletionSource tcs) + { + ThreadPool.QueueUserWorkItem(_ => + { + BuggyCode(); + + tcs.TrySetResult(null); + }, + null); + + static void BuggyCode() => throw new InvalidOperationException(); + } + } + + public class UnitTest1 + { + [Fact] + public async Task Test1() + { + await Task.Delay(1000); + } + + [Fact] + public async Task CrashTestRunner() + { + var tcs = new TaskCompletionSource(); + + OtherComponent.Execute(tcs); + + await tcs.Task; + } + + + [Fact] + public async Task Test2() + { + await Task.Delay(5000); + Assert.True(false); + } + } +} diff --git a/src/Identity/test/XUnitTestProject4/XUnitTestProject4.csproj b/src/Identity/test/XUnitTestProject4/XUnitTestProject4.csproj new file mode 100644 index 000000000000..c3e3821f5aa2 --- /dev/null +++ b/src/Identity/test/XUnitTestProject4/XUnitTestProject4.csproj @@ -0,0 +1,14 @@ + + + + $(DefaultNetCoreTargetFramework) + true + true + false + + + + + + + diff --git a/src/Identity/test/XUnitTestProject5/UnitTest1.cs b/src/Identity/test/XUnitTestProject5/UnitTest1.cs new file mode 100644 index 000000000000..f880a81e6901 --- /dev/null +++ b/src/Identity/test/XUnitTestProject5/UnitTest1.cs @@ -0,0 +1,17 @@ +using System; +using Xunit; + +namespace XUnitTestProject5 +{ + public class UnitTest1 + { + [Fact] + public void Segfault() + { + unsafe + { + *(int*)0x12345678 = 0x1; + } + } + } +} diff --git a/src/Identity/test/XUnitTestProject5/XUnitTestProject5.csproj b/src/Identity/test/XUnitTestProject5/XUnitTestProject5.csproj new file mode 100644 index 000000000000..465d7f13c5dc --- /dev/null +++ b/src/Identity/test/XUnitTestProject5/XUnitTestProject5.csproj @@ -0,0 +1,15 @@ + + + + $(DefaultNetCoreTargetFramework) + true + true + false + true + + + + + + + diff --git a/src/Identity/test/XUnitTestProject6/UnitTest1.cs b/src/Identity/test/XUnitTestProject6/UnitTest1.cs new file mode 100644 index 000000000000..559aaac0278e --- /dev/null +++ b/src/Identity/test/XUnitTestProject6/UnitTest1.cs @@ -0,0 +1,31 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using ProcessUtilities; +using Xunit; +using Xunit.Abstractions; + +namespace XUnitTestProject6 +{ + public class UnitTest1 + { + private ITestOutputHelper _testOutputHelper; + + public UnitTest1(ITestOutputHelper testOutputHelper) + { + _testOutputHelper = testOutputHelper; + } + + [Fact] + public async Task OutOfProcessHang() + { + var path = typeof(ProcessWithHang.Program).Assembly.Location; + + _testOutputHelper.WriteLine($"About to execute: {path}"); + + await ProcessUtil.RunAsync("dotnet", path, cancellationToken: new CancellationTokenSource(TimeSpan.FromSeconds(5)).Token); + } + } +} diff --git a/src/Identity/test/XUnitTestProject6/XUnitTestProject6.csproj b/src/Identity/test/XUnitTestProject6/XUnitTestProject6.csproj new file mode 100644 index 000000000000..bed5d97d2fa7 --- /dev/null +++ b/src/Identity/test/XUnitTestProject6/XUnitTestProject6.csproj @@ -0,0 +1,16 @@ + + + + $(DefaultNetCoreTargetFramework) + true + true + false + true + + + + + + + + diff --git a/src/Identity/test/XUnitTestProject7/UnitTest1.cs b/src/Identity/test/XUnitTestProject7/UnitTest1.cs new file mode 100644 index 000000000000..bf7e085e0972 --- /dev/null +++ b/src/Identity/test/XUnitTestProject7/UnitTest1.cs @@ -0,0 +1,29 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using ProcessUtilities; +using Xunit; +using Xunit.Abstractions; + +namespace XUnitTestProject7 +{ + public class UnitTest1 + { + private ITestOutputHelper _testOutputHelper; + + public UnitTest1(ITestOutputHelper testOutputHelper) + { + _testOutputHelper = testOutputHelper; + } + + [Fact] + public async Task OutOfProcessAv() + { + var path = typeof(ProcessWithAv.Program).Assembly.Location; + + _testOutputHelper.WriteLine($"About to execute: {path}"); + + await ProcessUtil.RunAsync("dotnet", path); + } + } +} diff --git a/src/Identity/test/XUnitTestProject7/XUnitTestProject7.csproj b/src/Identity/test/XUnitTestProject7/XUnitTestProject7.csproj new file mode 100644 index 000000000000..d24ff0c12f13 --- /dev/null +++ b/src/Identity/test/XUnitTestProject7/XUnitTestProject7.csproj @@ -0,0 +1,14 @@ + + + $(DefaultNetCoreTargetFramework) + true + true + false + + + + + + + + diff --git a/src/Identity/test/XUnitTestProject8/UnitTest1.cs b/src/Identity/test/XUnitTestProject8/UnitTest1.cs new file mode 100644 index 000000000000..612cc05980fe --- /dev/null +++ b/src/Identity/test/XUnitTestProject8/UnitTest1.cs @@ -0,0 +1,29 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using ProcessUtilities; +using Xunit; +using Xunit.Abstractions; + +namespace XUnitTestProject8 +{ + public class UnitTest1 + { + private ITestOutputHelper _testOutputHelper; + + public UnitTest1(ITestOutputHelper testOutputHelper) + { + _testOutputHelper = testOutputHelper; + } + + [Fact] + public async Task OutOfProcessCrash() + { + var path = typeof(ProcessWithCrash.Program).Assembly.Location; + + _testOutputHelper.WriteLine($"About to execute: {path}"); + + await ProcessUtil.RunAsync("dotnet", path); + } + } +} diff --git a/src/Identity/test/XUnitTestProject8/XUnitTestProject8.csproj b/src/Identity/test/XUnitTestProject8/XUnitTestProject8.csproj new file mode 100644 index 000000000000..94e5a16e865f --- /dev/null +++ b/src/Identity/test/XUnitTestProject8/XUnitTestProject8.csproj @@ -0,0 +1,15 @@ + + + $(DefaultNetCoreTargetFramework) + true + true + false + XUnit + + + + + + + + diff --git a/src/Identity/test/XUnitTestProject9/UnitTest1.cs b/src/Identity/test/XUnitTestProject9/UnitTest1.cs new file mode 100644 index 000000000000..b0065a33e6a3 --- /dev/null +++ b/src/Identity/test/XUnitTestProject9/UnitTest1.cs @@ -0,0 +1,20 @@ +using System; +using Xunit; + +namespace XUnitTestProject9 +{ + public class UnitTest1 + { + [Fact] + public void PassingTest() + { + + } + + [Fact] + public void FailFast() + { + Environment.FailFast("Oh noes"); + } + } +} diff --git a/src/Identity/test/XUnitTestProject9/XUnitTestProject9.csproj b/src/Identity/test/XUnitTestProject9/XUnitTestProject9.csproj new file mode 100644 index 000000000000..2084ccd4f290 --- /dev/null +++ b/src/Identity/test/XUnitTestProject9/XUnitTestProject9.csproj @@ -0,0 +1,14 @@ + + + $(DefaultNetCoreTargetFramework) + true + true + false + XUnit + + + + + + + From bdb0e9f44f6e1963bd8858bf3b53a43bc99b92c5 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Wed, 29 Jul 2020 02:52:51 -0700 Subject: [PATCH 09/31] Remove collector --- .../ExecutionCollector.cs | 125 ------------------ .../UnitTestingDiagnostics.Collector.csproj | 15 --- 2 files changed, 140 deletions(-) delete mode 100644 src/Identity/src/UnitTestingDiagnostics/ExecutionCollector.cs delete mode 100644 src/Identity/src/UnitTestingDiagnostics/UnitTestingDiagnostics.Collector.csproj diff --git a/src/Identity/src/UnitTestingDiagnostics/ExecutionCollector.cs b/src/Identity/src/UnitTestingDiagnostics/ExecutionCollector.cs deleted file mode 100644 index de01557e13e2..000000000000 --- a/src/Identity/src/UnitTestingDiagnostics/ExecutionCollector.cs +++ /dev/null @@ -1,125 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Threading; -using System.Xml; -using Microsoft.VisualStudio.TestPlatform.ObjectModel; -using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; -using ProcessUtilities; - -namespace UnitTestingDiagnostics -{ - [DataCollectorFriendlyName("execution")] - [DataCollectorTypeUri("datacollector://Microsoft/TestPlatform/Extensions/execution/v1")] - public class ExecutionCollector : DataCollector - { - public override void Initialize(XmlElement configurationElement, DataCollectionEvents events, DataCollectionSink dataSink, DataCollectionLogger logger, DataCollectionEnvironmentContext environmentContext) - { - var map = new ConcurrentDictionary(); - var timeout = TimeSpan.FromSeconds(20); - var testHostProcessId = 0; - Timer inactivityTimer = null; - - async void CaptureTestState(object state) - { - inactivityTimer.Change(-1, -1); - inactivityTimer = null; - - Process process = null; - - try - { - process = Process.GetProcessById(testHostProcessId); - } - catch (ArgumentException) - { - // Process doesn't exist.. - } - catch (InvalidOperationException) - { - // Process doesn't exist.. - } - - // Incomplete tests - var incompleteTests = string.Join(Environment.NewLine, map.Values.Where(r => !r.IsCompleted).Select(r => " - " + r.TestName)); - logger.LogWarning(environmentContext.SessionDataCollectionContext, "Incomplete Tests: \r\n" + incompleteTests); - - try - { - // Attempt to capture a dump if the process hasn't crashed - if (process != null) - { - logger.LogWarning(environmentContext.SessionDataCollectionContext, $"Capturing dump the test run is hanging. It's been > {timeout} since the last set of test activity"); - - var dumpFilePath = Path.Combine(Path.GetTempPath(), $"dotnet.{testHostProcessId}.dmp"); - await ProcessUtil.CaptureDumpAsync(testHostProcessId, dumpFilePath); - dataSink.SendFileAsync(environmentContext.SessionDataCollectionContext, dumpFilePath, true); - } - } - catch (Exception ex) - { - logger.LogError(environmentContext.SessionDataCollectionContext, ex); - } - finally - { - if (process != null) - { - logger.LogWarning(environmentContext.SessionDataCollectionContext, $"Killing the test host process {testHostProcessId}"); - process.Kill(); - } - } - } - - void ResetTimer() - { - inactivityTimer?.Change(timeout, Timeout.InfiniteTimeSpan); - } - - events.SessionEnd += (sender, e) => - { - inactivityTimer?.Dispose(); - inactivityTimer = null; - }; - - events.TestHostLaunched += (sender, e) => - { - inactivityTimer = new Timer(CaptureTestState, null, timeout, Timeout.InfiniteTimeSpan); - - testHostProcessId = e.TestHostProcessId; - }; - - events.TestCaseStart += (sender, e) => - { - ResetTimer(); - - map[e.TestCaseId] = new TestResult - { - TestName = e.TestCaseName - }; - - logger.LogWarning(environmentContext.SessionDataCollectionContext, e.TestCaseName + " [Start]"); - }; - - events.TestCaseEnd += (sender, e) => - { - ResetTimer(); - - var result = map[e.TestCaseId]; - - result.IsCompleted = true; - result.TestOutcome = e.TestOutcome; - - logger.LogWarning(environmentContext.SessionDataCollectionContext, e.TestCaseName + " [Ended]"); - }; - } - - private class TestResult - { - public string TestName { get; set; } - public TestOutcome TestOutcome { get; set; } - public bool IsCompleted { get; set; } - } - } -} diff --git a/src/Identity/src/UnitTestingDiagnostics/UnitTestingDiagnostics.Collector.csproj b/src/Identity/src/UnitTestingDiagnostics/UnitTestingDiagnostics.Collector.csproj deleted file mode 100644 index b78398b76979..000000000000 --- a/src/Identity/src/UnitTestingDiagnostics/UnitTestingDiagnostics.Collector.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - netcoreapp3.1 - - - - - - - - - - - From b6f09cbd6dd08ab863ab4bd68b63d059f769c8d8 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Wed, 29 Jul 2020 09:43:16 -0700 Subject: [PATCH 10/31] Try renaming projects --- .../XUnitTestProject1.csproj => Helix1.Test/Helix1.Test.csproj} | 0 src/Identity/test/{XUnitTestProject1 => Helix1.Test}/UnitTest1.cs | 0 .../XUnitTestProject2.csproj => Helix2.Test/Helix2.Test.csproj} | 0 src/Identity/test/{XUnitTestProject2 => Helix2.Test}/UnitTest1.cs | 0 .../XUnitTestProject3.csproj => Helix3.Test/Helix3.Test.csproj} | 0 .../test/{XUnitTestProject3 => Helix3.Test}/TaskExtensions.cs | 0 src/Identity/test/{XUnitTestProject3 => Helix3.Test}/UnitTest1.cs | 0 .../XUnitTestProject4.csproj => Helix4.Test/Helix4.Test.csproj} | 0 src/Identity/test/{XUnitTestProject4 => Helix4.Test}/UnitTest1.cs | 0 .../XUnitTestProject5.csproj => Helix5.Test/Helix5.Test.csproj} | 0 src/Identity/test/{XUnitTestProject5 => Helix5.Test}/UnitTest1.cs | 0 .../XUnitTestProject6.csproj => Helix6.Test/Helix6.Test.csproj} | 0 src/Identity/test/{XUnitTestProject6 => Helix6.Test}/UnitTest1.cs | 0 .../XUnitTestProject7.csproj => Helix7.Test/Helix7.Test.csproj} | 0 src/Identity/test/{XUnitTestProject7 => Helix7.Test}/UnitTest1.cs | 0 .../XUnitTestProject8.csproj => Helix8.Test/Helix8.Test.csproj} | 0 src/Identity/test/{XUnitTestProject8 => Helix8.Test}/UnitTest1.cs | 0 .../XUnitTestProject9.csproj => Helix9.Test/Helix9.Test.csproj} | 0 src/Identity/test/{XUnitTestProject9 => Helix9.Test}/UnitTest1.cs | 0 19 files changed, 0 insertions(+), 0 deletions(-) rename src/Identity/test/{XUnitTestProject1/XUnitTestProject1.csproj => Helix1.Test/Helix1.Test.csproj} (100%) rename src/Identity/test/{XUnitTestProject1 => Helix1.Test}/UnitTest1.cs (100%) rename src/Identity/test/{XUnitTestProject2/XUnitTestProject2.csproj => Helix2.Test/Helix2.Test.csproj} (100%) rename src/Identity/test/{XUnitTestProject2 => Helix2.Test}/UnitTest1.cs (100%) rename src/Identity/test/{XUnitTestProject3/XUnitTestProject3.csproj => Helix3.Test/Helix3.Test.csproj} (100%) rename src/Identity/test/{XUnitTestProject3 => Helix3.Test}/TaskExtensions.cs (100%) rename src/Identity/test/{XUnitTestProject3 => Helix3.Test}/UnitTest1.cs (100%) rename src/Identity/test/{XUnitTestProject4/XUnitTestProject4.csproj => Helix4.Test/Helix4.Test.csproj} (100%) rename src/Identity/test/{XUnitTestProject4 => Helix4.Test}/UnitTest1.cs (100%) rename src/Identity/test/{XUnitTestProject5/XUnitTestProject5.csproj => Helix5.Test/Helix5.Test.csproj} (100%) rename src/Identity/test/{XUnitTestProject5 => Helix5.Test}/UnitTest1.cs (100%) rename src/Identity/test/{XUnitTestProject6/XUnitTestProject6.csproj => Helix6.Test/Helix6.Test.csproj} (100%) rename src/Identity/test/{XUnitTestProject6 => Helix6.Test}/UnitTest1.cs (100%) rename src/Identity/test/{XUnitTestProject7/XUnitTestProject7.csproj => Helix7.Test/Helix7.Test.csproj} (100%) rename src/Identity/test/{XUnitTestProject7 => Helix7.Test}/UnitTest1.cs (100%) rename src/Identity/test/{XUnitTestProject8/XUnitTestProject8.csproj => Helix8.Test/Helix8.Test.csproj} (100%) rename src/Identity/test/{XUnitTestProject8 => Helix8.Test}/UnitTest1.cs (100%) rename src/Identity/test/{XUnitTestProject9/XUnitTestProject9.csproj => Helix9.Test/Helix9.Test.csproj} (100%) rename src/Identity/test/{XUnitTestProject9 => Helix9.Test}/UnitTest1.cs (100%) diff --git a/src/Identity/test/XUnitTestProject1/XUnitTestProject1.csproj b/src/Identity/test/Helix1.Test/Helix1.Test.csproj similarity index 100% rename from src/Identity/test/XUnitTestProject1/XUnitTestProject1.csproj rename to src/Identity/test/Helix1.Test/Helix1.Test.csproj diff --git a/src/Identity/test/XUnitTestProject1/UnitTest1.cs b/src/Identity/test/Helix1.Test/UnitTest1.cs similarity index 100% rename from src/Identity/test/XUnitTestProject1/UnitTest1.cs rename to src/Identity/test/Helix1.Test/UnitTest1.cs diff --git a/src/Identity/test/XUnitTestProject2/XUnitTestProject2.csproj b/src/Identity/test/Helix2.Test/Helix2.Test.csproj similarity index 100% rename from src/Identity/test/XUnitTestProject2/XUnitTestProject2.csproj rename to src/Identity/test/Helix2.Test/Helix2.Test.csproj diff --git a/src/Identity/test/XUnitTestProject2/UnitTest1.cs b/src/Identity/test/Helix2.Test/UnitTest1.cs similarity index 100% rename from src/Identity/test/XUnitTestProject2/UnitTest1.cs rename to src/Identity/test/Helix2.Test/UnitTest1.cs diff --git a/src/Identity/test/XUnitTestProject3/XUnitTestProject3.csproj b/src/Identity/test/Helix3.Test/Helix3.Test.csproj similarity index 100% rename from src/Identity/test/XUnitTestProject3/XUnitTestProject3.csproj rename to src/Identity/test/Helix3.Test/Helix3.Test.csproj diff --git a/src/Identity/test/XUnitTestProject3/TaskExtensions.cs b/src/Identity/test/Helix3.Test/TaskExtensions.cs similarity index 100% rename from src/Identity/test/XUnitTestProject3/TaskExtensions.cs rename to src/Identity/test/Helix3.Test/TaskExtensions.cs diff --git a/src/Identity/test/XUnitTestProject3/UnitTest1.cs b/src/Identity/test/Helix3.Test/UnitTest1.cs similarity index 100% rename from src/Identity/test/XUnitTestProject3/UnitTest1.cs rename to src/Identity/test/Helix3.Test/UnitTest1.cs diff --git a/src/Identity/test/XUnitTestProject4/XUnitTestProject4.csproj b/src/Identity/test/Helix4.Test/Helix4.Test.csproj similarity index 100% rename from src/Identity/test/XUnitTestProject4/XUnitTestProject4.csproj rename to src/Identity/test/Helix4.Test/Helix4.Test.csproj diff --git a/src/Identity/test/XUnitTestProject4/UnitTest1.cs b/src/Identity/test/Helix4.Test/UnitTest1.cs similarity index 100% rename from src/Identity/test/XUnitTestProject4/UnitTest1.cs rename to src/Identity/test/Helix4.Test/UnitTest1.cs diff --git a/src/Identity/test/XUnitTestProject5/XUnitTestProject5.csproj b/src/Identity/test/Helix5.Test/Helix5.Test.csproj similarity index 100% rename from src/Identity/test/XUnitTestProject5/XUnitTestProject5.csproj rename to src/Identity/test/Helix5.Test/Helix5.Test.csproj diff --git a/src/Identity/test/XUnitTestProject5/UnitTest1.cs b/src/Identity/test/Helix5.Test/UnitTest1.cs similarity index 100% rename from src/Identity/test/XUnitTestProject5/UnitTest1.cs rename to src/Identity/test/Helix5.Test/UnitTest1.cs diff --git a/src/Identity/test/XUnitTestProject6/XUnitTestProject6.csproj b/src/Identity/test/Helix6.Test/Helix6.Test.csproj similarity index 100% rename from src/Identity/test/XUnitTestProject6/XUnitTestProject6.csproj rename to src/Identity/test/Helix6.Test/Helix6.Test.csproj diff --git a/src/Identity/test/XUnitTestProject6/UnitTest1.cs b/src/Identity/test/Helix6.Test/UnitTest1.cs similarity index 100% rename from src/Identity/test/XUnitTestProject6/UnitTest1.cs rename to src/Identity/test/Helix6.Test/UnitTest1.cs diff --git a/src/Identity/test/XUnitTestProject7/XUnitTestProject7.csproj b/src/Identity/test/Helix7.Test/Helix7.Test.csproj similarity index 100% rename from src/Identity/test/XUnitTestProject7/XUnitTestProject7.csproj rename to src/Identity/test/Helix7.Test/Helix7.Test.csproj diff --git a/src/Identity/test/XUnitTestProject7/UnitTest1.cs b/src/Identity/test/Helix7.Test/UnitTest1.cs similarity index 100% rename from src/Identity/test/XUnitTestProject7/UnitTest1.cs rename to src/Identity/test/Helix7.Test/UnitTest1.cs diff --git a/src/Identity/test/XUnitTestProject8/XUnitTestProject8.csproj b/src/Identity/test/Helix8.Test/Helix8.Test.csproj similarity index 100% rename from src/Identity/test/XUnitTestProject8/XUnitTestProject8.csproj rename to src/Identity/test/Helix8.Test/Helix8.Test.csproj diff --git a/src/Identity/test/XUnitTestProject8/UnitTest1.cs b/src/Identity/test/Helix8.Test/UnitTest1.cs similarity index 100% rename from src/Identity/test/XUnitTestProject8/UnitTest1.cs rename to src/Identity/test/Helix8.Test/UnitTest1.cs diff --git a/src/Identity/test/XUnitTestProject9/XUnitTestProject9.csproj b/src/Identity/test/Helix9.Test/Helix9.Test.csproj similarity index 100% rename from src/Identity/test/XUnitTestProject9/XUnitTestProject9.csproj rename to src/Identity/test/Helix9.Test/Helix9.Test.csproj diff --git a/src/Identity/test/XUnitTestProject9/UnitTest1.cs b/src/Identity/test/Helix9.Test/UnitTest1.cs similarity index 100% rename from src/Identity/test/XUnitTestProject9/UnitTest1.cs rename to src/Identity/test/Helix9.Test/UnitTest1.cs From f4f5f28f8e3d9a3b98b9e9944ee9ef7503e039cd Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Wed, 29 Jul 2020 14:12:46 -0700 Subject: [PATCH 11/31] Rename tests for clarity --- src/Identity/src/ProcessWithAv/ProcessWithAv.csproj | 2 +- src/Identity/src/ProcessWithCrash/ProcessWithCrash.csproj | 2 +- .../Helix1.HangTestRunner.Test.csproj} | 0 .../{Helix1.Test => Helix1.HangTestRunner.Test}/UnitTest1.cs | 0 .../Helix2.LogOutput.Test.csproj} | 0 .../test/{Helix2.Test => Helix2.LogOutput.Test}/UnitTest1.cs | 0 .../Helix3.AsyncTimeout.Test.csproj} | 0 .../{Helix3.Test => Helix3.AsyncTimeout.Test}/TaskExtensions.cs | 0 .../test/{Helix3.Test => Helix3.AsyncTimeout.Test}/UnitTest1.cs | 0 .../Helix4.CrashTestRunner.Test.csproj} | 0 .../{Helix4.Test => Helix4.CrashTestRunner.Test}/UnitTest1.cs | 0 .../Helix5.Segfault.Test.csproj} | 0 .../test/{Helix5.Test => Helix5.Segfault.Test}/UnitTest1.cs | 0 .../Helix6.OutOfProcessHang.Test.csproj} | 0 .../{Helix6.Test => Helix6.OutOfProcessHang.Test}/UnitTest1.cs | 0 .../Helix7.ProcessWithAv.Test.csproj} | 0 .../{Helix7.Test => Helix7.ProcessWithAv.Test}/UnitTest1.cs | 0 .../Helix8.OutOfProcessCrash.Test.csproj} | 0 .../{Helix8.Test => Helix8.OutOfProcessCrash.Test}/UnitTest1.cs | 0 .../Helix9.FailFast.Test.csproj} | 0 .../test/{Helix9.Test => Helix9.FailFast.Test}/UnitTest1.cs | 0 21 files changed, 2 insertions(+), 2 deletions(-) rename src/Identity/test/{Helix1.Test/Helix1.Test.csproj => Helix1.HangTestRunner.Test/Helix1.HangTestRunner.Test.csproj} (100%) rename src/Identity/test/{Helix1.Test => Helix1.HangTestRunner.Test}/UnitTest1.cs (100%) rename src/Identity/test/{Helix2.Test/Helix2.Test.csproj => Helix2.LogOutput.Test/Helix2.LogOutput.Test.csproj} (100%) rename src/Identity/test/{Helix2.Test => Helix2.LogOutput.Test}/UnitTest1.cs (100%) rename src/Identity/test/{Helix3.Test/Helix3.Test.csproj => Helix3.AsyncTimeout.Test/Helix3.AsyncTimeout.Test.csproj} (100%) rename src/Identity/test/{Helix3.Test => Helix3.AsyncTimeout.Test}/TaskExtensions.cs (100%) rename src/Identity/test/{Helix3.Test => Helix3.AsyncTimeout.Test}/UnitTest1.cs (100%) rename src/Identity/test/{Helix4.Test/Helix4.Test.csproj => Helix4.CrashTestRunner.Test/Helix4.CrashTestRunner.Test.csproj} (100%) rename src/Identity/test/{Helix4.Test => Helix4.CrashTestRunner.Test}/UnitTest1.cs (100%) rename src/Identity/test/{Helix5.Test/Helix5.Test.csproj => Helix5.Segfault.Test/Helix5.Segfault.Test.csproj} (100%) rename src/Identity/test/{Helix5.Test => Helix5.Segfault.Test}/UnitTest1.cs (100%) rename src/Identity/test/{Helix6.Test/Helix6.Test.csproj => Helix6.OutOfProcessHang.Test/Helix6.OutOfProcessHang.Test.csproj} (100%) rename src/Identity/test/{Helix6.Test => Helix6.OutOfProcessHang.Test}/UnitTest1.cs (100%) rename src/Identity/test/{Helix7.Test/Helix7.Test.csproj => Helix7.ProcessWithAv.Test/Helix7.ProcessWithAv.Test.csproj} (100%) rename src/Identity/test/{Helix7.Test => Helix7.ProcessWithAv.Test}/UnitTest1.cs (100%) rename src/Identity/test/{Helix8.Test/Helix8.Test.csproj => Helix8.OutOfProcessCrash.Test/Helix8.OutOfProcessCrash.Test.csproj} (100%) rename src/Identity/test/{Helix8.Test => Helix8.OutOfProcessCrash.Test}/UnitTest1.cs (100%) rename src/Identity/test/{Helix9.Test/Helix9.Test.csproj => Helix9.FailFast.Test/Helix9.FailFast.Test.csproj} (100%) rename src/Identity/test/{Helix9.Test => Helix9.FailFast.Test}/UnitTest1.cs (100%) diff --git a/src/Identity/src/ProcessWithAv/ProcessWithAv.csproj b/src/Identity/src/ProcessWithAv/ProcessWithAv.csproj index 1b31179482cb..4f4f0e64432a 100644 --- a/src/Identity/src/ProcessWithAv/ProcessWithAv.csproj +++ b/src/Identity/src/ProcessWithAv/ProcessWithAv.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + netcoreapp5.0 true diff --git a/src/Identity/src/ProcessWithCrash/ProcessWithCrash.csproj b/src/Identity/src/ProcessWithCrash/ProcessWithCrash.csproj index eb20ac2b370e..ec6ebb7780d9 100644 --- a/src/Identity/src/ProcessWithCrash/ProcessWithCrash.csproj +++ b/src/Identity/src/ProcessWithCrash/ProcessWithCrash.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + netcoreapp5.0 - 3.8.0-1.20367.11 + 3.8.0-2.20379.3 5.0.0-rc.1.20370.4 5.0.0-rc.1.20370.4 From 60c94a4c3c97ea3d859450c0c9acf937601dc40b Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Fri, 31 Jul 2020 12:44:27 -0700 Subject: [PATCH 16/31] Wait for component to mount before checking for output (#24451) * Wait for component to mount before checking for output * Use Exists to check for element with timeout * Update ComponentRenderingTest.cs --- src/Components/test/E2ETest/Tests/ComponentRenderingTest.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Components/test/E2ETest/Tests/ComponentRenderingTest.cs b/src/Components/test/E2ETest/Tests/ComponentRenderingTest.cs index 7f62e86441f9..6a105a5fffb3 100644 --- a/src/Components/test/E2ETest/Tests/ComponentRenderingTest.cs +++ b/src/Components/test/E2ETest/Tests/ComponentRenderingTest.cs @@ -46,7 +46,8 @@ public void BasicTestAppCanBeServed() public void CanRenderTextOnlyComponent() { var appElement = Browser.MountTestComponent(); - Assert.Equal("Hello from TextOnlyComponent", appElement.Text); + + Browser.Exists(By.XPath("//*[contains(., 'Hello from TextOnlyComponent')]")); } // This verifies that we've correctly configured the Razor language version via MSBuild. From 0f376586f27094700672c033a3c6c9aa6835a2a2 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Fri, 31 Jul 2020 13:35:54 -0700 Subject: [PATCH 17/31] Remove debian 8 from helix runs (#24454) * Add display environment * Print out env variables as part of helix runs * Update TestRunner.cs * Remove Debian 8 from helix matrix * Remove Debian 8 skip * Remove debian 8 skip * Remove debian 8 * Remove debian 8 skip * Remove Debian 8 skip * Remove debian 8 * Update Program.cs * Update TestRunner.cs * Update TestRunner.cs --- docs/Helix.md | 2 +- eng/scripts/RunHelix.ps1 | 3 +-- eng/targets/Helix.Common.props | 1 - .../Kestrel/test/FunctionalTests/Http2/HandshakeTests.cs | 2 -- .../Kestrel/test/FunctionalTests/Http2/ShutdownTests.cs | 1 - .../HttpsConnectionMiddlewareTests.cs | 1 - src/Servers/Kestrel/test/Interop.FunctionalTests/Utilities.cs | 4 +--- 7 files changed, 3 insertions(+), 11 deletions(-) diff --git a/docs/Helix.md b/docs/Helix.md index 318a9ef8cba6..477574dc2c0d 100644 --- a/docs/Helix.md +++ b/docs/Helix.md @@ -19,7 +19,7 @@ This will restore, and then publish all the test project including some bootstra ## Overview of the helix usage in our pipelines - Required queues: Windows10, OSX, Ubuntu1604 -- Full queue matrix: Windows[7, 81, 10], Ubuntu[1604, 1804, 2004], Centos7, Debian[8,9], Redhat7, Fedora28, Arm64 (Win10, Debian9) +- Full queue matrix: Windows[7, 81, 10], Ubuntu[1604, 1804, 2004], Centos7, Debian9, Redhat7, Fedora28, Arm64 (Win10, Debian9) - The queues are defined in [Helix.Common.props](https://github.com/dotnet/aspnetcore/blob/master/eng/targets/Helix.Common.props) [aspnetcore-ci](https://dev.azure.com/dnceng/public/_build?definitionId=278) runs non quarantined tests against the required helix queues as a required PR check and all builds on all branches. diff --git a/eng/scripts/RunHelix.ps1 b/eng/scripts/RunHelix.ps1 index b2200d37fdb0..2a20580c3a55 100644 --- a/eng/scripts/RunHelix.ps1 +++ b/eng/scripts/RunHelix.ps1 @@ -15,7 +15,6 @@ Windows.7.Amd64.Open OSX.1014.Amd64.Open Centos.7.Amd64.Open - Debian.8.Amd64.Open Debian.9.Amd64.Open Redhat.7.Amd64.Open .PARAMETER RunQuarantinedTests @@ -39,4 +38,4 @@ $env:BUILD_REPOSITORY_NAME="aspnetcore" $env:SYSTEM_TEAMPROJECT="aspnetcore" $HelixQueues = $HelixQueues -replace ";", "%3B" -dotnet msbuild $Project /t:Helix /p:TargetArchitecture="$TargetArchitecture" /p:IsRequiredCheck=true /p:IsHelixDaily=true /p:HelixTargetQueues=$HelixQueues /p:RunQuarantinedTests=$RunQuarantinedTests /p:_UseHelixOpenQueues=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log \ No newline at end of file +dotnet msbuild $Project /t:Helix /p:TargetArchitecture="$TargetArchitecture" /p:IsRequiredCheck=true /p:IsHelixDaily=true /p:HelixTargetQueues=$HelixQueues /p:RunQuarantinedTests=$RunQuarantinedTests /p:_UseHelixOpenQueues=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log diff --git a/eng/targets/Helix.Common.props b/eng/targets/Helix.Common.props index 5f8a83cb6d61..d68970f8dc68 100644 --- a/eng/targets/Helix.Common.props +++ b/eng/targets/Helix.Common.props @@ -32,7 +32,6 @@ - diff --git a/src/Servers/Kestrel/test/FunctionalTests/Http2/HandshakeTests.cs b/src/Servers/Kestrel/test/FunctionalTests/Http2/HandshakeTests.cs index c4a89e9fcfca..620c08a73e2a 100644 --- a/src/Servers/Kestrel/test/FunctionalTests/Http2/HandshakeTests.cs +++ b/src/Servers/Kestrel/test/FunctionalTests/Http2/HandshakeTests.cs @@ -80,7 +80,6 @@ public void TlsAndHttp2NotSupportedOnWin7() [ConditionalFact] [OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")] - [SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/10428", Queues = "Debian.8.Amd64;Debian.8.Amd64.Open")] // Debian 8 uses OpenSSL 1.0.1 which does not support HTTP/2 [MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10)] public async Task TlsAlpnHandshakeSelectsHttp2From1and2() { @@ -111,7 +110,6 @@ public async Task TlsAlpnHandshakeSelectsHttp2From1and2() [ConditionalFact] [OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")] - [SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/10428", Queues = "Debian.8.Amd64;Debian.8.Amd64.Open")] // Debian 8 uses OpenSSL 1.0.1 which does not support HTTP/2 [MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10)] public async Task TlsAlpnHandshakeSelectsHttp2() { diff --git a/src/Servers/Kestrel/test/FunctionalTests/Http2/ShutdownTests.cs b/src/Servers/Kestrel/test/FunctionalTests/Http2/ShutdownTests.cs index d5788e336912..e8537520d1c5 100644 --- a/src/Servers/Kestrel/test/FunctionalTests/Http2/ShutdownTests.cs +++ b/src/Servers/Kestrel/test/FunctionalTests/Http2/ShutdownTests.cs @@ -23,7 +23,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.Http2 { [OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")] [MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10)] - [SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/10428", Queues = "Debian.8.Amd64;Debian.8.Amd64.Open")] // Debian 8 uses OpenSSL 1.0.1 which does not support HTTP/2 public class ShutdownTests : TestApplicationErrorLoggerLoggedTest { private static X509Certificate2 _x509Certificate2 = TestResources.GetTestCertificate(); diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsConnectionMiddlewareTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsConnectionMiddlewareTests.cs index 70b216e149e7..59c7222df767 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsConnectionMiddlewareTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsConnectionMiddlewareTests.cs @@ -632,7 +632,6 @@ public void ThrowsForCertificatesMissingServerEku(string testCertName) [InlineData(HttpProtocols.Http2)] [InlineData(HttpProtocols.Http1AndHttp2)] [OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")] - [SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/10428", Queues = "Debian.8.Amd64;Debian.8.Amd64.Open")] // Debian 8 uses OpenSSL 1.0.1 which does not support HTTP/2 [MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10)] public async Task ListenOptionsProtolsCanBeSetAfterUseHttps(HttpProtocols httpProtocols) { diff --git a/src/Servers/Kestrel/test/Interop.FunctionalTests/Utilities.cs b/src/Servers/Kestrel/test/Interop.FunctionalTests/Utilities.cs index d2e2ce85a4d2..21b18f8aee01 100644 --- a/src/Servers/Kestrel/test/Interop.FunctionalTests/Utilities.cs +++ b/src/Servers/Kestrel/test/Interop.FunctionalTests/Utilities.cs @@ -12,9 +12,7 @@ internal static bool CurrentPlatformSupportsHTTP2OverTls() return // "Missing Windows ALPN support: https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation#Support" or missing compatible ciphers (Win8.1) new MinimumOSVersionAttribute(OperatingSystems.Windows, WindowsVersions.Win10).IsMet // "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492" - && new OSSkipConditionAttribute(OperatingSystems.MacOSX).IsMet - // Debian 8 uses OpenSSL 1.0.1 which does not support ALPN - && new SkipOnHelixAttribute("https://github.com/dotnet/aspnetcore/issues/10428") { Queues = "Debian.8.Amd64;Debian.8.Amd64.Open" }.IsMet; + && new OSSkipConditionAttribute(OperatingSystems.MacOSX).IsMet; } } } From 02ba8fd486c3afebc437e9bac779c64871196e0f Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 31 Jul 2020 13:40:52 -0700 Subject: [PATCH 18/31] Avoid doing unncecessary work when generating component declaration files. (#24445) The output of the declaration file for Razor components are unaffected by all inputs other than the input .razor file. Consequently we can avoid regenerating these files if the output is newer than the input. This is the same heuristic we apply to Blazor WebAsssembly's compression artifacts. This PR combines these two improvements for a ~90ms (10%) improvement in the inner loop. ``` 17 ms GenerateBlazorWebAssemblyBootJson 1 calls 22 ms Copy 8 calls 39 ms ProcessFrameworkReferences 1 calls 40 ms RazorTagHelper 1 calls 51 ms ResolveAssemblyReference 1 calls 70 ms GetFileHash 1 calls 80 ms RazorGenerate 2 calls 111 ms Csc 2 calls Time Elapsed 00:00:00.95 ``` ``` 17 ms GenerateBlazorWebAssemblyBootJson 1 calls 21 ms Copy 8 calls 37 ms ProcessFrameworkReferences 1 calls 51 ms ResolveAssemblyReference 1 calls 70 ms Csc 1 calls 72 ms GetFileHash 1 calls 79 ms RazorGenerate 2 calls Time Elapsed 00:00:00.86 ``` In after: Csc calls reduced to one, RazorTagHelper call removed. --- .../src/GenerateCommand.cs | 14 +++++ .../BuildIncrementalismTest.cs | 60 ++++++++++++++++++- .../Microsoft.NET.Sdk.Razor.Component.targets | 8 ++- 3 files changed, 78 insertions(+), 4 deletions(-) diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/GenerateCommand.cs b/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/GenerateCommand.cs index 6bcf622d1ddb..658b9d22631d 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/GenerateCommand.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/GenerateCommand.cs @@ -201,6 +201,7 @@ private int ExecuteCore( if (GenerateDeclaration.HasValue()) { b.Features.Add(new SetSuppressPrimaryMethodBodyOptionFeature()); + b.Features.Add(new SuppressChecksumOptionsFeature()); } if (RootNamespace.HasValue()) @@ -227,6 +228,7 @@ private int ExecuteCore( }); var results = GenerateCode(engine, sourceItems); + var isGeneratingDeclaration = GenerateDeclaration.HasValue(); foreach (var result in results) { @@ -255,6 +257,18 @@ private int ExecuteCore( { // Only output the file if we generated it without errors. var outputFilePath = result.InputItem.OutputPath; + var generatedCode = result.CSharpDocument.GeneratedCode; + if (isGeneratingDeclaration) + { + // When emiting declarations, only write if it the contents are different. + // This allows build incrementalism to kick in when the declaration remains unchanged between builds. + if (File.Exists(outputFilePath) && + string.Equals(File.ReadAllText(outputFilePath), generatedCode, StringComparison.Ordinal)) + { + continue; + } + } + File.WriteAllText(outputFilePath, result.CSharpDocument.GeneratedCode); } } diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/integrationtests/BuildIncrementalismTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/integrationtests/BuildIncrementalismTest.cs index df84c3b7a66b..e651cad69f80 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/integrationtests/BuildIncrementalismTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/integrationtests/BuildIncrementalismTest.cs @@ -172,11 +172,61 @@ async Task VerifyError() } } + [Fact] + [InitializeTestProject("MvcWithComponents")] + public async Task BuildComponents_DoesNotRegenerateComponentDefinition_WhenDefinitionIsUnchanged() + { + // Act - 1 + var updatedContent = "Some content"; + var tagHelperOutputCache = Path.Combine(IntermediateOutputPath, "MvcWithComponents.TagHelpers.output.cache"); + + var generatedFile = Path.Combine(RazorIntermediateOutputPath, "Views", "Shared", "NavMenu.razor.g.cs"); + var generatedDefinitionFile = Path.Combine(RazorComponentIntermediateOutputPath, "Views", "Shared", "NavMenu.razor.g.cs"); + + // Assert - 1 + var result = await DotnetMSBuild("Build"); + + Assert.BuildPassed(result); + var outputFile = Path.Combine(OutputPath, "MvcWithComponents.dll"); + Assert.FileExists(result, OutputPath, "MvcWithComponents.dll"); + var outputAssemblyThumbprint = GetThumbPrint(outputFile); + + Assert.FileExists(result, generatedDefinitionFile); + var generatedDefinitionThumbprint = GetThumbPrint(generatedDefinitionFile); + Assert.FileExists(result, generatedFile); + var generatedFileThumbprint = GetThumbPrint(generatedFile); + + Assert.FileExists(result, tagHelperOutputCache); + Assert.FileContains( + result, + tagHelperOutputCache, + @"""Name"":""MvcWithComponents.Views.Shared.NavMenu"""); + + var definitionThumbprint = GetThumbPrint(tagHelperOutputCache); + + // Act - 2 + ReplaceContent(updatedContent, "Views", "Shared", "NavMenu.razor"); + result = await DotnetMSBuild("Build"); + + // Assert - 2 + Assert.FileExists(result, generatedDefinitionFile); + // Definition file remains unchanged. + Assert.Equal(generatedDefinitionThumbprint, GetThumbPrint(generatedDefinitionFile)); + Assert.FileExists(result, generatedFile); + // Generated file should change and include the new content. + Assert.NotEqual(generatedFileThumbprint, GetThumbPrint(generatedFile)); + Assert.FileContains(result, generatedFile, updatedContent); + + // TagHelper cache should remain unchanged. + Assert.Equal(definitionThumbprint, GetThumbPrint(tagHelperOutputCache)); + } + [Fact] [InitializeTestProject("MvcWithComponents")] public async Task BuildComponents_RegeneratesComponentDefinition_WhenFilesChange() { // Act - 1 + var updatedContent = "@code { [Parameter] public string AParameter { get; set; } }"; var tagHelperOutputCache = Path.Combine(IntermediateOutputPath, "MvcWithComponents.TagHelpers.output.cache"); var generatedFile = Path.Combine(RazorIntermediateOutputPath, "Views", "Shared", "NavMenu.razor.g.cs"); @@ -204,7 +254,7 @@ public async Task BuildComponents_RegeneratesComponentDefinition_WhenFilesChange var definitionThumbprint = GetThumbPrint(tagHelperOutputCache); // Act - 2 - ReplaceContent("Different things", "Views", "Shared", "NavMenu.razor"); + ReplaceContent(updatedContent, "Views", "Shared", "NavMenu.razor"); result = await DotnetMSBuild("Build"); // Assert - 2 @@ -222,8 +272,12 @@ public async Task BuildComponents_RegeneratesComponentDefinition_WhenFilesChange tagHelperOutputCache, @"""Name"":""MvcWithComponents.Views.Shared.NavMenu"""); - // TODO: - Assert.Equal(definitionThumbprint, GetThumbPrint(tagHelperOutputCache)); + Assert.FileContains( + result, + tagHelperOutputCache, + "AParameter"); + + Assert.NotEqual(definitionThumbprint, GetThumbPrint(tagHelperOutputCache)); } [Fact] diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Component.targets b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Component.targets index 89e93a3a98a4..922d3fb34ef2 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Component.targets +++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Component.targets @@ -29,6 +29,7 @@ Copyright (c) .NET Foundation. All rights reserved. <_RazorComponentInputHash> <_RazorComponentInputCacheFile>$(IntermediateOutputPath)$(MSBuildProjectName).RazorComponent.input.cache + <_RazorComponentDeclarationOutputCacheFile>$(IntermediateOutputPath)$(MSBuildProjectName).RazorComponent.output.cache @@ -85,7 +86,7 @@ Copyright (c) .NET Foundation. All rights reserved. Name="RazorGenerateComponentDeclaration" DependsOnTargets="$(RazorGenerateComponentDeclarationDependsOn)" Inputs="$(MSBuildAllProjects);@(RazorComponentWithTargetPath);$(_RazorComponentInputCacheFile)" - Outputs="@(_RazorComponentDeclaration)" + Outputs="$(_RazorComponentDeclarationOutputCacheFile)" Condition="'@(RazorComponentWithTargetPath->Count())'!='0'"> @@ -120,8 +121,13 @@ Copyright (c) .NET Foundation. All rights reserved. TagHelperManifest="$(_RazorComponentDeclarationManifest)" GenerateDeclaration="true" /> + + + From ad0d7d22f4afde218d052e3e7f44fa8e09fd0d84 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2020 14:04:05 -0700 Subject: [PATCH 19/31] Update dependencies from https://github.com/dotnet/arcade build 20200724.1 (#24482) Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.Arcade.Sdk From Version 5.0.0-beta.20364.3 -> To Version 5.0.0-beta.20374.1 - downgrade of the Arcade SDK should be fine Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 +++---- eng/common/cross/toolchain.cmake | 41 ++++++++++++++++++++------------ global.json | 4 ++-- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3b884cae68af..2995c7f56489 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -305,13 +305,13 @@ https://github.com/dotnet/runtime 0e0e648770e54b12c2fa81a77538ce1a72fca8af - + https://github.com/dotnet/arcade - 22d6355c4f3c9ac00b0e3abf9d85f2fb07e4787b + f6192d1e284a08ac05041d05fa6e60dec74b24f5 - + https://github.com/dotnet/arcade - ff5d4b6c8dbdaeacb6e6159d3f8185118dffd915 + f6192d1e284a08ac05041d05fa6e60dec74b24f5 https://github.com/dotnet/roslyn diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index 88a758afb19c..b9fe796f0da7 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -127,29 +127,40 @@ endif() # Specify link flags +function(add_toolchain_linker_flag Flag) + set(Config "${ARGV1}") + set(CONFIG_SUFFIX "") + if (NOT Config STREQUAL "") + set(CONFIG_SUFFIX "_${Config}") + endif() + set("CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}" "${CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}} ${Flag}" PARENT_SCOPE) + set("CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}" "${CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}} ${Flag}" PARENT_SCOPE) +endfunction() + + if(TARGET_ARCH_NAME STREQUAL "armel") if(DEFINED TIZEN_TOOLCHAIN) # For Tizen only - add_link_options("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") - add_link_options("-L${CROSS_ROOTFS}/lib") - add_link_options("-L${CROSS_ROOTFS}/usr/lib") - add_link_options("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") endif() elseif(TARGET_ARCH_NAME STREQUAL "arm64") if(DEFINED TIZEN_TOOLCHAIN) # For Tizen only - add_link_options("-B${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") - add_link_options("-L${CROSS_ROOTFS}/lib64") - add_link_options("-L${CROSS_ROOTFS}/usr/lib64") - add_link_options("-L${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") - - add_link_options("-Wl,--rpath-link=${CROSS_ROOTFS}/lib64") - add_link_options("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64") - add_link_options("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib64") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib64") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/lib64") + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64") + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") endif() elseif(TARGET_ARCH_NAME STREQUAL "x86") - add_link_options(-m32) + add_toolchain_linker_flag(-m32) elseif(ILLUMOS) - add_link_options("-L${CROSS_ROOTFS}/lib/amd64") - add_link_options("-L${CROSS_ROOTFS}/usr/amd64/lib") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib/amd64") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/amd64/lib") endif() # Specify compile options diff --git a/global.json b/global.json index 6496dffe47d9..43ce9ccf9d90 100644 --- a/global.json +++ b/global.json @@ -30,7 +30,7 @@ }, "msbuild-sdks": { "Yarn.MSBuild": "1.15.2", - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20377.2", - "Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.20364.3" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20374.1", + "Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.20374.1" } } From 870f27ce7107869cdc8aba36e85cabaa5ad673c3 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 31 Jul 2020 22:04:48 +0100 Subject: [PATCH 20/31] Remove Blazor internal profiling infrastructure (#24468) * Put back InternalCalls * Removing .NET profiling calls * Remove JS side profiling --- .../Microsoft.AspNetCore.Components.csproj | 1 - .../src/Profiling/ComponentsProfiling.cs | 23 --- .../src/Profiling/NoOpComponentsProfiling.cs | 16 -- .../WebAssemblyComponentsProfiling.cs | 41 ------ .../src/RenderTree/RenderTreeDiffBuilder.cs | 47 ------ .../Components/src/RenderTree/Renderer.cs | 11 -- .../src/Rendering/ComponentState.cs | 5 - .../src/Rendering/RenderTreeBuilder.cs | 71 --------- .../Web.JS/dist/Release/blazor.server.js | 8 +- .../Web.JS/dist/Release/blazor.webassembly.js | 2 +- src/Components/Web.JS/src/Boot.Server.ts | 2 - src/Components/Web.JS/src/Boot.WebAssembly.ts | 5 - src/Components/Web.JS/src/GlobalExports.ts | 2 - .../Web.JS/src/Platform/Mono/MonoPlatform.ts | 5 - .../Web.JS/src/Platform/Profiling.ts | 137 ------------------ .../Web.JS/src/Rendering/BrowserRenderer.ts | 5 - .../JSInterop/src/InternalCalls.cs} | 0 .../Microsoft.JSInterop.WebAssembly.csproj | 1 - 18 files changed, 5 insertions(+), 377 deletions(-) delete mode 100644 src/Components/Components/src/Profiling/ComponentsProfiling.cs delete mode 100644 src/Components/Components/src/Profiling/NoOpComponentsProfiling.cs delete mode 100644 src/Components/Components/src/Profiling/WebAssemblyComponentsProfiling.cs delete mode 100644 src/Components/Web.JS/src/Platform/Profiling.ts rename src/Components/{Shared/src/WebAssemblyJSInteropInternalCalls.cs => WebAssembly/JSInterop/src/InternalCalls.cs} (100%) diff --git a/src/Components/Components/src/Microsoft.AspNetCore.Components.csproj b/src/Components/Components/src/Microsoft.AspNetCore.Components.csproj index 7565534a51d1..1e7f881ed501 100644 --- a/src/Components/Components/src/Microsoft.AspNetCore.Components.csproj +++ b/src/Components/Components/src/Microsoft.AspNetCore.Components.csproj @@ -10,7 +10,6 @@ - diff --git a/src/Components/Components/src/Profiling/ComponentsProfiling.cs b/src/Components/Components/src/Profiling/ComponentsProfiling.cs deleted file mode 100644 index f47a0c917c8e..000000000000 --- a/src/Components/Components/src/Profiling/ComponentsProfiling.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -namespace Microsoft.AspNetCore.Components.Profiling -{ - internal abstract class ComponentsProfiling - { - // For now, this is only intended for use on Blazor WebAssembly, and will have no effect - // when running on Blazor Server. The reason for having the ComponentsProfiling abstraction - // is so that if we later have two different implementations (one for WebAssembly, one for - // Server), the execution characteristics of calling Start/End will be unchanged and historical - // perf data will still be comparable to newer data. - public static readonly ComponentsProfiling Instance = PlatformInfo.IsWebAssembly - ? new WebAssemblyComponentsProfiling() - : (ComponentsProfiling)new NoOpComponentsProfiling(); - - public abstract void Start([CallerMemberName] string? name = null); - public abstract void End([CallerMemberName] string? name = null); - } -} diff --git a/src/Components/Components/src/Profiling/NoOpComponentsProfiling.cs b/src/Components/Components/src/Profiling/NoOpComponentsProfiling.cs deleted file mode 100644 index 74037e7de744..000000000000 --- a/src/Components/Components/src/Profiling/NoOpComponentsProfiling.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.AspNetCore.Components.Profiling -{ - internal class NoOpComponentsProfiling : ComponentsProfiling - { - public override void Start(string? name) - { - } - - public override void End(string? name) - { - } - } -} diff --git a/src/Components/Components/src/Profiling/WebAssemblyComponentsProfiling.cs b/src/Components/Components/src/Profiling/WebAssemblyComponentsProfiling.cs deleted file mode 100644 index 4e0b6dbd7454..000000000000 --- a/src/Components/Components/src/Profiling/WebAssemblyComponentsProfiling.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using WebAssembly.JSInterop; - -namespace Microsoft.AspNetCore.Components.Profiling -{ - // Later on, we will likely want to move this into the WebAssembly package. However it needs to - // be inlined into the Components package directly until we're ready to make the underlying - // ComponentsProfile abstraction into a public API. It's possible that this API will never become - // public, or that it will be replaced by something more standard for .NET, if it's possible to - // make that work performantly on WebAssembly. - - internal class WebAssemblyComponentsProfiling : ComponentsProfiling - { - static bool IsCapturing = false; - - public static void SetCapturing(bool isCapturing) - { - IsCapturing = isCapturing; - } - - public override void Start(string? name) - { - if (IsCapturing) - { - InternalCalls.InvokeJSUnmarshalled( - out _, "_blazorProfileStart", name, null, null); - } - } - - public override void End(string? name) - { - if (IsCapturing) - { - InternalCalls.InvokeJSUnmarshalled( - out _, "_blazorProfileEnd", name, null, null); - } - } - } -} diff --git a/src/Components/Components/src/RenderTree/RenderTreeDiffBuilder.cs b/src/Components/Components/src/RenderTree/RenderTreeDiffBuilder.cs index 6adf9cffbfac..aabd22217a3a 100644 --- a/src/Components/Components/src/RenderTree/RenderTreeDiffBuilder.cs +++ b/src/Components/Components/src/RenderTree/RenderTreeDiffBuilder.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Runtime.CompilerServices; -using Microsoft.AspNetCore.Components.Profiling; using Microsoft.AspNetCore.Components.Rendering; namespace Microsoft.AspNetCore.Components.RenderTree @@ -28,7 +27,6 @@ public static RenderTreeDiff ComputeDiff( ArrayRange oldTree, ArrayRange newTree) { - ComponentsProfiling.Instance.Start(); var editsBuffer = batchBuilder.EditsBuffer; var editsBufferStartLength = editsBuffer.Count; @@ -37,7 +35,6 @@ public static RenderTreeDiff ComputeDiff( var editsSegment = editsBuffer.ToSegment(editsBufferStartLength, editsBuffer.Count); var result = new RenderTreeDiff(componentId, editsSegment); - ComponentsProfiling.Instance.End(); return result; } @@ -49,7 +46,6 @@ private static void AppendDiffEntriesForRange( int oldStartIndex, int oldEndIndexExcl, int newStartIndex, int newEndIndexExcl) { - ProfilingStart(); // This is deliberately a very large method. Parts of it could be factored out // into other private methods, but doing so comes at a consequential perf cost, // because it involves so much parameter passing. You can think of the code here @@ -300,12 +296,10 @@ private static void AppendDiffEntriesForRange( diffContext.KeyedItemInfoDictionaryPool.Return(keyedItemInfos); } } - ProfilingEnd(); } private static Dictionary BuildKeyToInfoLookup(DiffContext diffContext, int oldStartIndex, int oldEndIndexExcl, int newStartIndex, int newEndIndexExcl) { - ProfilingStart(); var result = diffContext.KeyedItemInfoDictionaryPool.Get(); var oldTree = diffContext.OldTree; var newTree = diffContext.NewTree; @@ -351,7 +345,6 @@ private static Dictionary BuildKeyToInfoLookup(DiffContex newStartIndex = NextSiblingIndex(frame, newStartIndex); } - ProfilingEnd(); return result; } @@ -394,7 +387,6 @@ private static void AppendAttributeDiffEntriesForRange( int oldStartIndex, int oldEndIndexExcl, int newStartIndex, int newEndIndexExcl) { - ProfilingStart(); // The overhead of the dictionary used by AppendAttributeDiffEntriesForRangeSlow is // significant, so we want to try and do a merge-join if possible, but fall back to // a hash-join if not. We'll do a merge join until we hit a case we can't handle and @@ -443,7 +435,6 @@ private static void AppendAttributeDiffEntriesForRange( ref diffContext, oldStartIndex, oldEndIndexExcl, newStartIndex, newEndIndexExcl); - ProfilingEnd(); return; } @@ -469,12 +460,9 @@ private static void AppendAttributeDiffEntriesForRange( ref diffContext, oldStartIndex, oldEndIndexExcl, newStartIndex, newEndIndexExcl); - ProfilingEnd(); return; } } - - ProfilingEnd(); } private static void AppendAttributeDiffEntriesForRangeSlow( @@ -482,7 +470,6 @@ private static void AppendAttributeDiffEntriesForRangeSlow( int oldStartIndex, int oldEndIndexExcl, int newStartIndex, int newEndIndexExcl) { - ProfilingStart(); var oldTree = diffContext.OldTree; var newTree = diffContext.NewTree; @@ -521,7 +508,6 @@ private static void AppendAttributeDiffEntriesForRangeSlow( // We should have processed any additions at this point. Reset for the next batch. diffContext.AttributeDiffSet.Clear(); - ProfilingEnd(); } private static void UpdateRetainedChildComponent( @@ -529,7 +515,6 @@ private static void UpdateRetainedChildComponent( int oldComponentIndex, int newComponentIndex) { - ProfilingStart(); var oldTree = diffContext.OldTree; var newTree = diffContext.NewTree; ref var oldComponentFrame = ref oldTree[oldComponentIndex]; @@ -556,8 +541,6 @@ private static void UpdateRetainedChildComponent( { componentState.SetDirectParameters(newParameters); } - - ProfilingEnd(); } private static int NextSiblingIndex(in RenderTreeFrame frame, int frameIndex) @@ -580,7 +563,6 @@ private static void AppendDiffEntriesForFramesWithSameSequence( int oldFrameIndex, int newFrameIndex) { - ProfilingStart(); var oldTree = diffContext.OldTree; var newTree = diffContext.NewTree; ref var oldFrame = ref oldTree[oldFrameIndex]; @@ -593,7 +575,6 @@ private static void AppendDiffEntriesForFramesWithSameSequence( { InsertNewFrame(ref diffContext, newFrameIndex); RemoveOldFrame(ref diffContext, oldFrameIndex); - ProfilingEnd(); return; } @@ -719,8 +700,6 @@ private static void AppendDiffEntriesForFramesWithSameSequence( default: throw new NotImplementedException($"Encountered unsupported frame type during diffing: {newTree[newFrameIndex].FrameType}"); } - - ProfilingEnd(); } // This should only be called for attributes that have the same name. This is an @@ -730,7 +709,6 @@ private static void AppendDiffEntriesForAttributeFrame( int oldFrameIndex, int newFrameIndex) { - ProfilingStart(); var oldTree = diffContext.OldTree; var newTree = diffContext.NewTree; ref var oldFrame = ref oldTree[oldFrameIndex]; @@ -759,13 +737,10 @@ private static void AppendDiffEntriesForAttributeFrame( // since it was unchanged. newFrame = oldFrame; } - - ProfilingEnd(); } private static void InsertNewFrame(ref DiffContext diffContext, int newFrameIndex) { - ProfilingStart(); var newTree = diffContext.NewTree; ref var newFrame = ref newTree[newFrameIndex]; switch (newFrame.FrameType) @@ -818,12 +793,10 @@ private static void InsertNewFrame(ref DiffContext diffContext, int newFrameInde default: throw new NotImplementedException($"Unexpected frame type during {nameof(InsertNewFrame)}: {newFrame.FrameType}"); } - ProfilingEnd(); } private static void RemoveOldFrame(ref DiffContext diffContext, int oldFrameIndex) { - ProfilingStart(); var oldTree = diffContext.OldTree; ref var oldFrame = ref oldTree[oldFrameIndex]; switch (oldFrame.FrameType) @@ -865,7 +838,6 @@ private static void RemoveOldFrame(ref DiffContext diffContext, int oldFrameInde default: throw new NotImplementedException($"Unexpected frame type during {nameof(RemoveOldFrame)}: {oldFrame.FrameType}"); } - ProfilingEnd(); } private static int GetAttributesEndIndexExclusive(RenderTreeFrame[] tree, int rootIndex) @@ -899,7 +871,6 @@ private static void AppendStepOut(ref DiffContext diffContext) private static void InitializeNewSubtree(ref DiffContext diffContext, int frameIndex) { - ProfilingStart(); var frames = diffContext.NewTree; var endIndexExcl = frameIndex + frames[frameIndex].ElementSubtreeLength; for (var i = frameIndex; i < endIndexExcl; i++) @@ -921,12 +892,10 @@ private static void InitializeNewSubtree(ref DiffContext diffContext, int frameI break; } } - ProfilingEnd(); } private static void InitializeNewComponentFrame(ref DiffContext diffContext, int frameIndex) { - ProfilingStart(); var frames = diffContext.NewTree; ref var frame = ref frames[frameIndex]; @@ -943,7 +912,6 @@ private static void InitializeNewComponentFrame(ref DiffContext diffContext, int var initialParametersLifetime = new ParameterViewLifetime(diffContext.BatchBuilder); var initialParameters = new ParameterView(initialParametersLifetime, frames, frameIndex); childComponentState.SetDirectParameters(initialParameters); - ProfilingEnd(); } private static void InitializeNewAttributeFrame(ref DiffContext diffContext, ref RenderTreeFrame newFrame) @@ -988,7 +956,6 @@ private static void InitializeNewComponentReferenceCaptureFrame(ref DiffContext private static void DisposeFramesInRange(RenderBatchBuilder batchBuilder, RenderTreeFrame[] frames, int startIndex, int endIndexExcl) { - ProfilingStart(); for (var i = startIndex; i < endIndexExcl; i++) { ref var frame = ref frames[i]; @@ -1001,7 +968,6 @@ private static void DisposeFramesInRange(RenderBatchBuilder batchBuilder, Render batchBuilder.DisposedEventHandlerIds.Append(frame.AttributeEventHandlerId); } } - ProfilingEnd(); } /// @@ -1043,18 +1009,5 @@ public DiffContext( SiblingIndex = 0; } } - - // Having too many calls to ComponentsProfiling.Instance.Start/End has a measurable perf impact - // even when capturing is disabled. So, to enable detailed profiling for this class, define the - // Profile_RenderTreeDiffBuilder compiler symbol, otherwise the calls are compiled out entirely. - // Enabling detailed profiling adds about 5% to rendering benchmark times. - - [Conditional("Profile_RenderTreeDiffBuilder")] - private static void ProfilingStart([CallerMemberName] string? name = null) - => ComponentsProfiling.Instance.Start(name); - - [Conditional("Profile_RenderTreeDiffBuilder")] - private static void ProfilingEnd([CallerMemberName] string? name = null) - => ComponentsProfiling.Instance.End(name); } } diff --git a/src/Components/Components/src/RenderTree/Renderer.cs b/src/Components/Components/src/RenderTree/Renderer.cs index e284e0c867e4..6a501d1e0452 100644 --- a/src/Components/Components/src/RenderTree/Renderer.cs +++ b/src/Components/Components/src/RenderTree/Renderer.cs @@ -8,7 +8,6 @@ using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Microsoft.AspNetCore.Components.Profiling; using Microsoft.AspNetCore.Components.Rendering; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -247,7 +246,6 @@ private ComponentState AttachAndInitComponent(IComponent component, int parentCo /// public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs) { - ComponentsProfiling.Instance.Start(); Dispatcher.AssertAccess(); if (!_eventBindings.TryGetValue(eventHandlerId, out var callback)) @@ -275,7 +273,6 @@ public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo fiel catch (Exception e) { HandleException(e); - ComponentsProfiling.Instance.End(); return Task.CompletedTask; } finally @@ -290,7 +287,6 @@ public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo fiel // Task completed synchronously or is still running. We already processed all of the rendering // work that was queued so let our error handler deal with it. var result = GetErrorHandledTask(task); - ComponentsProfiling.Instance.End(); return result; } @@ -441,7 +437,6 @@ protected virtual void ProcessPendingRender() private void ProcessRenderQueue() { - ComponentsProfiling.Instance.Start(); Dispatcher.AssertAccess(); if (_isBatchInProgress) @@ -456,7 +451,6 @@ private void ProcessRenderQueue() { if (_batchBuilder.ComponentRenderQueue.Count == 0) { - ComponentsProfiling.Instance.End(); return; } @@ -468,9 +462,7 @@ private void ProcessRenderQueue() } var batch = _batchBuilder.ToBatch(); - ComponentsProfiling.Instance.Start(nameof(UpdateDisplayAsync)); updateDisplayTask = UpdateDisplayAsync(batch); - ComponentsProfiling.Instance.End(nameof(UpdateDisplayAsync)); // Fire off the execution of OnAfterRenderAsync, but don't wait for it // if there is async work to be done. @@ -480,7 +472,6 @@ private void ProcessRenderQueue() { // Ensure we catch errors while running the render functions of the components. HandleException(e); - ComponentsProfiling.Instance.End(); return; } finally @@ -498,8 +489,6 @@ private void ProcessRenderQueue() { ProcessRenderQueue(); } - - ComponentsProfiling.Instance.End(); } private Task InvokeRenderCompletedCalls(ArrayRange updatedComponents, Task updateDisplayTask) diff --git a/src/Components/Components/src/Rendering/ComponentState.cs b/src/Components/Components/src/Rendering/ComponentState.cs index 760d3b8d1a4b..3bff9bcfc8ef 100644 --- a/src/Components/Components/src/Rendering/ComponentState.cs +++ b/src/Components/Components/src/Rendering/ComponentState.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; -using Microsoft.AspNetCore.Components.Profiling; using Microsoft.AspNetCore.Components.RenderTree; namespace Microsoft.AspNetCore.Components.Rendering @@ -57,7 +56,6 @@ public ComponentState(Renderer renderer, int componentId, IComponent component, public void RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment) { - ComponentsProfiling.Instance.Start(); // A component might be in the render queue already before getting disposed by an // earlier entry in the render queue. In that case, rendering is a no-op. if (_componentWasDisposed) @@ -69,9 +67,7 @@ public void RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment rend (CurrentRenderTree, _renderTreeBuilderPrevious) = (_renderTreeBuilderPrevious, CurrentRenderTree); CurrentRenderTree.Clear(); - ComponentsProfiling.Instance.Start("BuildRenderTree"); renderFragment(CurrentRenderTree); - ComponentsProfiling.Instance.End("BuildRenderTree"); var diff = RenderTreeDiffBuilder.ComputeDiff( _renderer, @@ -81,7 +77,6 @@ public void RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment rend CurrentRenderTree.GetFrames()); batchBuilder.UpdatedComponentDiffs.Append(diff); batchBuilder.InvalidateParameterViews(); - ComponentsProfiling.Instance.End(); } public bool TryDisposeInBatch(RenderBatchBuilder batchBuilder, [NotNullWhen(false)] out Exception? exception) diff --git a/src/Components/Components/src/Rendering/RenderTreeBuilder.cs b/src/Components/Components/src/Rendering/RenderTreeBuilder.cs index 4e9280c70f4b..566265c98880 100644 --- a/src/Components/Components/src/Rendering/RenderTreeBuilder.cs +++ b/src/Components/Components/src/Rendering/RenderTreeBuilder.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Runtime.CompilerServices; -using Microsoft.AspNetCore.Components.Profiling; using Microsoft.AspNetCore.Components.RenderTree; namespace Microsoft.AspNetCore.Components.Rendering @@ -45,7 +44,6 @@ public sealed class RenderTreeBuilder : IDisposable /// A value representing the type of the element. public void OpenElement(int sequence, string elementName) { - ProfilingStart(); // We are entering a new scope, since we track the "duplicate attributes" per // element/component we might need to clean them up now. if (_hasSeenAddMultipleAttributes) @@ -56,7 +54,6 @@ public void OpenElement(int sequence, string elementName) _openElementIndices.Push(_entries.Count); Append(RenderTreeFrame.Element(sequence, elementName)); - ProfilingEnd(); } /// @@ -65,7 +62,6 @@ public void OpenElement(int sequence, string elementName) /// public void CloseElement() { - ProfilingStart(); var indexOfEntryBeingClosed = _openElementIndices.Pop(); // We might be closing an element with only attributes, run the duplicate cleanup pass @@ -77,7 +73,6 @@ public void CloseElement() ref var entry = ref _entries.Buffer[indexOfEntryBeingClosed]; entry = entry.WithElementSubtreeLength(_entries.Count - indexOfEntryBeingClosed); - ProfilingEnd(); } /// @@ -87,9 +82,7 @@ public void CloseElement() /// Content for the new markup frame. public void AddMarkupContent(int sequence, string? markupContent) { - ProfilingStart(); Append(RenderTreeFrame.Markup(sequence, markupContent ?? string.Empty)); - ProfilingEnd(); } /// @@ -99,9 +92,7 @@ public void AddMarkupContent(int sequence, string? markupContent) /// Content for the new text frame. public void AddContent(int sequence, string? textContent) { - ProfilingStart(); Append(RenderTreeFrame.Text(sequence, textContent ?? string.Empty)); - ProfilingEnd(); } /// @@ -111,7 +102,6 @@ public void AddContent(int sequence, string? textContent) /// Content to append. public void AddContent(int sequence, RenderFragment? fragment) { - ProfilingStart(); if (fragment != null) { // We surround the fragment with a region delimiter to indicate that the @@ -122,7 +112,6 @@ public void AddContent(int sequence, RenderFragment? fragment) fragment(this); CloseRegion(); } - ProfilingEnd(); } /// @@ -133,12 +122,10 @@ public void AddContent(int sequence, RenderFragment? fragment) /// The value used by . public void AddContent(int sequence, RenderFragment? fragment, TValue value) { - ProfilingStart(); if (fragment != null) { AddContent(sequence, fragment(value)); } - ProfilingEnd(); } /// @@ -169,15 +156,12 @@ public void AddContent(int sequence, object? textContent) /// The name of the attribute. public void AddAttribute(int sequence, string name) { - ProfilingStart(); - if (_lastNonAttributeFrameType != RenderTreeFrameType.Element) { throw new InvalidOperationException($"Valueless attributes may only be added immediately after frames of type {RenderTreeFrameType.Element}"); } Append(RenderTreeFrame.Attribute(sequence, name, BoxedTrue)); - ProfilingEnd(); } /// @@ -194,7 +178,6 @@ public void AddAttribute(int sequence, string name) /// The value of the attribute. public void AddAttribute(int sequence, string name, bool value) { - ProfilingStart(); AssertCanAddAttribute(); if (_lastNonAttributeFrameType == RenderTreeFrameType.Component) { @@ -210,7 +193,6 @@ public void AddAttribute(int sequence, string name, bool value) { TrackAttributeName(name); } - ProfilingEnd(); } /// @@ -227,7 +209,6 @@ public void AddAttribute(int sequence, string name, bool value) /// The value of the attribute. public void AddAttribute(int sequence, string name, string? value) { - ProfilingStart(); AssertCanAddAttribute(); if (value != null || _lastNonAttributeFrameType == RenderTreeFrameType.Component) { @@ -237,7 +218,6 @@ public void AddAttribute(int sequence, string name, string? value) { TrackAttributeName(name); } - ProfilingEnd(); } /// @@ -254,7 +234,6 @@ public void AddAttribute(int sequence, string name, string? value) /// The value of the attribute. public void AddAttribute(int sequence, string name, MulticastDelegate? value) { - ProfilingStart(); AssertCanAddAttribute(); if (value != null || _lastNonAttributeFrameType == RenderTreeFrameType.Component) { @@ -264,7 +243,6 @@ public void AddAttribute(int sequence, string name, MulticastDelegate? value) { TrackAttributeName(name); } - ProfilingEnd(); } /// @@ -285,7 +263,6 @@ public void AddAttribute(int sequence, string name, MulticastDelegate? value) /// public void AddAttribute(int sequence, string name, EventCallback value) { - ProfilingStart(); AssertCanAddAttribute(); if (_lastNonAttributeFrameType == RenderTreeFrameType.Component) { @@ -310,7 +287,6 @@ public void AddAttribute(int sequence, string name, EventCallback value) // Track the attribute name if needed since we elided the frame. TrackAttributeName(name); } - ProfilingEnd(); } /// @@ -331,7 +307,6 @@ public void AddAttribute(int sequence, string name, EventCallback value) /// public void AddAttribute(int sequence, string name, EventCallback value) { - ProfilingStart(); AssertCanAddAttribute(); if (_lastNonAttributeFrameType == RenderTreeFrameType.Component) { @@ -356,7 +331,6 @@ public void AddAttribute(int sequence, string name, EventCallback @@ -370,7 +344,6 @@ public void AddAttribute(int sequence, string name, EventCallbackThe value of the attribute. public void AddAttribute(int sequence, string name, object? value) { - ProfilingStart(); // This looks a bit daunting because we need to handle the boxed/object version of all of the // types that AddAttribute special cases. if (_lastNonAttributeFrameType == RenderTreeFrameType.Element) @@ -423,7 +396,6 @@ public void AddAttribute(int sequence, string name, object? value) // This is going to throw. Calling it just to get a consistent exception message. AssertCanAddAttribute(); } - ProfilingEnd(); } /// @@ -438,7 +410,6 @@ public void AddAttribute(int sequence, string name, object? value) /// A holding the name and value of the attribute. public void AddAttribute(int sequence, in RenderTreeFrame frame) { - ProfilingStart(); if (frame.FrameType != RenderTreeFrameType.Attribute) { throw new ArgumentException($"The {nameof(frame.FrameType)} must be {RenderTreeFrameType.Attribute}."); @@ -446,7 +417,6 @@ public void AddAttribute(int sequence, in RenderTreeFrame frame) AssertCanAddAttribute(); Append(frame.WithAttributeSequence(sequence)); - ProfilingEnd(); } /// @@ -456,7 +426,6 @@ public void AddAttribute(int sequence, in RenderTreeFrame frame) /// A collection of key-value pairs representing attributes. public void AddMultipleAttributes(int sequence, IEnumerable>? attributes) { - ProfilingStart(); // Calling this up-front just to make sure we validate before mutating anything. AssertCanAddAttribute(); @@ -473,7 +442,6 @@ public void AddMultipleAttributes(int sequence, IEnumerable @@ -490,7 +458,6 @@ public void AddMultipleAttributes(int sequence, IEnumerableThe name of another attribute whose value can be updated when the event handler is executed. public void SetUpdatesAttributeName(string updatesAttributeName) { - ProfilingStart(); if (_entries.Count == 0) { throw new InvalidOperationException("No preceding attribute frame exists."); @@ -503,7 +470,6 @@ public void SetUpdatesAttributeName(string updatesAttributeName) } prevFrame = prevFrame.WithAttributeEventUpdatesAttributeName(updatesAttributeName); - ProfilingEnd(); } /// @@ -535,12 +501,10 @@ public void OpenComponent(int sequence, Type componentType) /// The value for the key. public void SetKey(object? value) { - ProfilingStart(); if (value == null) { // Null is equivalent to not having set a key, which is valuable because Razor syntax doesn't have an // easy way to have conditional directive attributes - ProfilingEnd(); return; } @@ -563,12 +527,10 @@ public void SetKey(object? value) default: throw new InvalidOperationException($"Cannot set a key on a frame of type {parentFrame.FrameType}."); } - ProfilingEnd(); } private void OpenComponentUnchecked(int sequence, Type componentType) { - ProfilingStart(); // We are entering a new scope, since we track the "duplicate attributes" per // element/component we might need to clean them up now. if (_hasSeenAddMultipleAttributes) @@ -579,7 +541,6 @@ private void OpenComponentUnchecked(int sequence, Type componentType) _openElementIndices.Push(_entries.Count); Append(RenderTreeFrame.ChildComponent(sequence, componentType)); - ProfilingEnd(); } /// @@ -588,7 +549,6 @@ private void OpenComponentUnchecked(int sequence, Type componentType) /// public void CloseComponent() { - ProfilingStart(); var indexOfEntryBeingClosed = _openElementIndices.Pop(); // We might be closing a component with only attributes. Run the attribute cleanup pass @@ -600,7 +560,6 @@ public void CloseComponent() ref var entry = ref _entries.Buffer[indexOfEntryBeingClosed]; entry = entry.WithComponentSubtreeLength(_entries.Count - indexOfEntryBeingClosed); - ProfilingEnd(); } /// @@ -610,14 +569,12 @@ public void CloseComponent() /// An action to be invoked whenever the reference value changes. public void AddElementReferenceCapture(int sequence, Action elementReferenceCaptureAction) { - ProfilingStart(); if (GetCurrentParentFrameType() != RenderTreeFrameType.Element) { throw new InvalidOperationException($"Element reference captures may only be added as children of frames of type {RenderTreeFrameType.Element}"); } Append(RenderTreeFrame.ElementReferenceCapture(sequence, elementReferenceCaptureAction)); - ProfilingEnd(); } /// @@ -627,7 +584,6 @@ public void AddElementReferenceCapture(int sequence, Action el /// An action to be invoked whenever the reference value changes. public void AddComponentReferenceCapture(int sequence, Action componentReferenceCaptureAction) { - ProfilingStart(); var parentFrameIndex = GetCurrentParentFrameIndex(); if (!parentFrameIndex.HasValue) { @@ -641,7 +597,6 @@ public void AddComponentReferenceCapture(int sequence, Action component } Append(RenderTreeFrame.ComponentReferenceCapture(sequence, componentReferenceCaptureAction, parentFrameIndexValue)); - ProfilingEnd(); } /// @@ -650,7 +605,6 @@ public void AddComponentReferenceCapture(int sequence, Action component /// An integer that represents the position of the instruction in the source code. public void OpenRegion(int sequence) { - ProfilingStart(); // We are entering a new scope, since we track the "duplicate attributes" per // element/component we might need to clean them up now. if (_hasSeenAddMultipleAttributes) @@ -661,7 +615,6 @@ public void OpenRegion(int sequence) _openElementIndices.Push(_entries.Count); Append(RenderTreeFrame.Region(sequence)); - ProfilingEnd(); } /// @@ -670,11 +623,9 @@ public void OpenRegion(int sequence) /// public void CloseRegion() { - ProfilingStart(); var indexOfEntryBeingClosed = _openElementIndices.Pop(); ref var entry = ref _entries.Buffer[indexOfEntryBeingClosed]; entry = entry.WithRegionSubtreeLength(_entries.Count - indexOfEntryBeingClosed); - ProfilingEnd(); } private void AssertCanAddAttribute() @@ -702,29 +653,24 @@ private void AssertCanAddAttribute() /// public void Clear() { - ProfilingStart(); _entries.Clear(); _openElementIndices.Clear(); _lastNonAttributeFrameType = null; _hasSeenAddMultipleAttributes = false; _seenAttributeNames?.Clear(); - ProfilingEnd(); } // internal because this should only be used during the post-event tree patching logic // It's expensive because it involves copying all the subsequent memory in the array internal void InsertAttributeExpensive(int insertAtIndex, int sequence, string attributeName, object? attributeValue) { - ProfilingStart(); // Replicate the same attribute omission logic as used elsewhere if ((attributeValue == null) || (attributeValue is bool boolValue && !boolValue)) { - ProfilingEnd(); return; } _entries.InsertExpensive(insertAtIndex, RenderTreeFrame.Attribute(sequence, attributeName, attributeValue)); - ProfilingEnd(); } /// @@ -748,7 +694,6 @@ private void Append(in RenderTreeFrame frame) // Internal for testing internal void ProcessDuplicateAttributes(int first) { - ProfilingStart(); Debug.Assert(_hasSeenAddMultipleAttributes); // When AddMultipleAttributes method has been called, we need to postprocess attributes while closing @@ -830,7 +775,6 @@ internal void ProcessDuplicateAttributes(int first) seenAttributeNames.Clear(); _hasSeenAddMultipleAttributes = false; - ProfilingEnd(); } // Internal for testing @@ -847,22 +791,7 @@ internal void TrackAttributeName(string name) void IDisposable.Dispose() { - ProfilingStart(); _entries.Dispose(); - ProfilingEnd(); } - - // Having too many calls to ComponentsProfiling.Instance.Start/End has a measurable perf impact - // even when capturing is disabled. So, to enable detailed profiling for this class, define the - // Profile_RenderTreeBuilder compiler symbol, otherwise the calls are compiled out entirely. - // Enabling detailed profiling adds about 5% to rendering benchmark times. - - [Conditional("Profile_RenderTreeBuilder")] - private static void ProfilingStart([CallerMemberName] string? name = null) - => ComponentsProfiling.Instance.Start(name); - - [Conditional("Profile_RenderTreeBuilder")] - private static void ProfilingEnd([CallerMemberName] string? name = null) - => ComponentsProfiling.Instance.End(name); } } diff --git a/src/Components/Web.JS/dist/Release/blazor.server.js b/src/Components/Web.JS/dist/Release/blazor.server.js index 341b69d67cf3..950538b8a245 100644 --- a/src/Components/Web.JS/dist/Release/blazor.server.js +++ b/src/Components/Web.JS/dist/Release/blazor.server.js @@ -1,19 +1,19 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=54)}([function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(r||(r={}))},function(e,t,n){"use strict";(function(e){n.d(t,"e",(function(){return c})),n.d(t,"a",(function(){return u})),n.d(t,"c",(function(){return l})),n.d(t,"g",(function(){return f})),n.d(t,"i",(function(){return h})),n.d(t,"j",(function(){return p})),n.d(t,"f",(function(){return d})),n.d(t,"d",(function(){return g})),n.d(t,"b",(function(){return y})),n.d(t,"h",(function(){return v}));var r=n(0),o=n(6),i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]-1&&this.subject.observers.splice(e,1),0===this.subject.observers.length&&this.subject.cancelCallback&&this.subject.cancelCallback().catch((function(e){}))},e}(),y=function(){function e(e){this.minimumLogLevel=e,this.outputConsole=console}return e.prototype.log=function(e,t){if(e>=this.minimumLogLevel)switch(e){case r.a.Critical:case r.a.Error:this.outputConsole.error("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;case r.a.Warning:this.outputConsole.warn("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;case r.a.Information:this.outputConsole.info("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;default:this.outputConsole.log("["+(new Date).toISOString()+"] "+r.a[e]+": "+t)}},e}();function v(){var e="X-SignalR-User-Agent";return l.isNode&&(e="User-Agent"),[e,b(c,m(),E(),w())]}function b(e,t,n,r){var o="Microsoft SignalR/",i=e.split(".");return o+=i[0]+"."+i[1],o+=" ("+e+"; ",o+=t&&""!==t?t+"; ":"Unknown OS; ",o+=""+n,o+=r?"; "+r:"; Unknown Runtime Version",o+=")"}function m(){if(!l.isNode)return"";switch(e.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return e.platform}}function w(){if(l.isNode)return e.versions.node}function E(){return l.isNode?"NodeJS":"Browser"}}).call(this,n(14))},function(e,t,n){"use strict";n.r(t),n.d(t,"AbortError",(function(){return s})),n.d(t,"HttpError",(function(){return i})),n.d(t,"TimeoutError",(function(){return a})),n.d(t,"HttpClient",(function(){return l})),n.d(t,"HttpResponse",(function(){return u})),n.d(t,"DefaultHttpClient",(function(){return S})),n.d(t,"HubConnection",(function(){return O})),n.d(t,"HubConnectionState",(function(){return I})),n.d(t,"HubConnectionBuilder",(function(){return re})),n.d(t,"MessageType",(function(){return b})),n.d(t,"LogLevel",(function(){return f.a})),n.d(t,"HttpTransportType",(function(){return P})),n.d(t,"TransferFormat",(function(){return x})),n.d(t,"NullLogger",(function(){return $.a})),n.d(t,"JsonHubProtocol",(function(){return ee})),n.d(t,"Subject",(function(){return _})),n.d(t,"VERSION",(function(){return h.e}));var r,o=(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(t,n){var r=this,o=this.constructor.prototype;return(r=e.call(this,t)||this).statusCode=n,r.__proto__=o,r}return o(t,e),t}(Error),a=function(e){function t(t){void 0===t&&(t="A timeout occurred.");var n=this,r=this.constructor.prototype;return(n=e.call(this,t)||this).__proto__=r,n}return o(t,e),t}(Error),s=function(e){function t(t){void 0===t&&(t="An abort occurred.");var n=this,r=this.constructor.prototype;return(n=e.call(this,t)||this).__proto__=r,n}return o(t,e),t}(Error),c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=200&&o.status<300?n(new u(o.status,o.statusText,o.response||o.responseText)):r(new i(o.statusText,o.status))},o.onerror=function(){t.logger.log(f.a.Warning,"Error from HTTP request. "+o.status+": "+o.statusText+"."),r(new i(o.statusText,o.status))},o.ontimeout=function(){t.logger.log(f.a.Warning,"Timeout from HTTP request."),r(new a)},o.send(e.content||"")})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t}(l),E=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),S=function(e){function t(t){var n=e.call(this)||this;if("undefined"!=typeof fetch||h.c.isNode)n.httpClient=new v(t);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");n.httpClient=new w(t)}return n}return E(t,e),t.prototype.send=function(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new s):e.method?e.url?this.httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t.prototype.getCookieString=function(e){return this.httpClient.getCookieString(e)},t}(l),C=n(45);!function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close"}(b||(b={}));var I,_=function(){function e(){this.observers=[]}return e.prototype.next=function(e){for(var t=0,n=this.observers;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?[2,Promise.reject(new Error("Unable to connect to the server with any of the available transports. "+i.join(" ")))]:[2,Promise.reject(new Error("None of the transports supported by the client are supported by the server."))]}}))}))},e.prototype.constructTransport=function(e){switch(e){case P.WebSockets:if(!this.options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new Y(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.WebSocket,this.options.headers||{});case P.ServerSentEvents:if(!this.options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new H(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.EventSource,this.options.withCredentials,this.options.headers||{});case P.LongPolling:return new B(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.withCredentials,this.options.headers||{});default:throw new Error("Unknown transport: "+e+".")}},e.prototype.startTransport=function(e,t){var n=this;return this.transport.onreceive=this.onreceive,this.transport.onclose=function(e){return n.stopConnection(e)},this.transport.connect(e,t)},e.prototype.resolveTransportOrError=function(e,t,n){var r=P[e.transport];if(null==r)return this.logger.log(f.a.Debug,"Skipping transport '"+e.transport+"' because it is not supported by this client."),new Error("Skipping transport '"+e.transport+"' because it is not supported by this client.");if(!function(e,t){return!e||0!=(t&e)}(t,r))return this.logger.log(f.a.Debug,"Skipping transport '"+P[r]+"' because it was disabled by the client."),new Error("'"+P[r]+"' is disabled by the client.");if(!(e.transferFormats.map((function(e){return x[e]})).indexOf(n)>=0))return this.logger.log(f.a.Debug,"Skipping transport '"+P[r]+"' because it does not support the requested transfer format '"+x[n]+"'."),new Error("'"+P[r]+"' does not support "+x[n]+".");if(r===P.WebSockets&&!this.options.WebSocket||r===P.ServerSentEvents&&!this.options.EventSource)return this.logger.log(f.a.Debug,"Skipping transport '"+P[r]+"' because it is not supported in your environment.'"),new Error("'"+P[r]+"' is not supported in your environment.");this.logger.log(f.a.Debug,"Selecting transport '"+P[r]+"'.");try{return this.constructTransport(r)}catch(e){return e}},e.prototype.isITransport=function(e){return e&&"object"==typeof e&&"connect"in e},e.prototype.stopConnection=function(e){var t=this;if(this.logger.log(f.a.Debug,"HttpConnection.stopConnection("+e+") called while in state "+this.connectionState+"."),this.transport=void 0,e=this.stopError||e,this.stopError=void 0,"Disconnected"!==this.connectionState){if("Connecting"===this.connectionState)throw this.logger.log(f.a.Warning,"Call to HttpConnection.stopConnection("+e+") was ignored because the connection is still in the connecting state."),new Error("HttpConnection.stopConnection("+e+") was called while the connection is still in the connecting state.");if("Disconnecting"===this.connectionState&&this.stopPromiseResolver(),e?this.logger.log(f.a.Error,"Connection disconnected with error '"+e+"'."):this.logger.log(f.a.Information,"Connection disconnected."),this.sendQueue&&(this.sendQueue.stop().catch((function(e){t.logger.log(f.a.Error,"TransportSendQueue.stop() threw error '"+e+"'.")})),this.sendQueue=void 0),this.connectionId=void 0,this.connectionState="Disconnected",this.connectionStarted){this.connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this.logger.log(f.a.Error,"HttpConnection.onclose("+e+") threw error '"+t+"'.")}}}else this.logger.log(f.a.Debug,"Call to HttpConnection.stopConnection("+e+") was ignored because the connection is already in the disconnected state.")},e.prototype.resolveUrl=function(e){if(0===e.lastIndexOf("https://",0)||0===e.lastIndexOf("http://",0))return e;if(!h.c.isBrowser||!window.document)throw new Error("Cannot resolve '"+e+"'.");var t=window.document.createElement("a");return t.href=e,this.logger.log(f.a.Information,"Normalizing '"+e+"' to '"+t.href+"'."),t.href},e.prototype.resolveNegotiateUrl=function(e){var t=e.indexOf("?"),n=e.substring(0,-1===t?e.length:t);return"/"!==n[n.length-1]&&(n+="/"),n+="negotiate",-1===(n+=-1===t?"":e.substring(t)).indexOf("negotiateVersion")&&(n+=-1===t?"?":"&",n+="negotiateVersion="+this.negotiateVersion),n},e}();var G=function(){function e(e){this.transport=e,this.buffer=[],this.executing=!0,this.sendBufferedData=new Q,this.transportResult=new Q,this.sendLoopPromise=this.sendLoop()}return e.prototype.send=function(e){return this.bufferData(e),this.transportResult||(this.transportResult=new Q),this.transportResult.promise},e.prototype.stop=function(){return this.executing=!1,this.sendBufferedData.resolve(),this.sendLoopPromise},e.prototype.bufferData=function(e){if(this.buffer.length&&typeof this.buffer[0]!=typeof e)throw new Error("Expected data to be of type "+typeof this.buffer+" but was of type "+typeof e);this.buffer.push(e),this.sendBufferedData.resolve()},e.prototype.sendLoop=function(){return K(this,void 0,void 0,(function(){var t,n,r;return V(this,(function(o){switch(o.label){case 0:return[4,this.sendBufferedData.promise];case 1:if(o.sent(),!this.executing)return this.transportResult&&this.transportResult.reject("Connection stopped."),[3,6];this.sendBufferedData=new Q,t=this.transportResult,this.transportResult=void 0,n="string"==typeof this.buffer[0]?this.buffer.join(""):e.concatBuffers(this.buffer),this.buffer.length=0,o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.transport.send(n)];case 3:return o.sent(),t.resolve(),[3,5];case 4:return r=o.sent(),t.reject(r),[3,5];case 5:return[3,0];case 6:return[2]}}))}))},e.concatBuffers=function(e){for(var t=e.map((function(e){return e.byteLength})).reduce((function(e,t){return e+t})),n=new Uint8Array(t),r=0,o=0,i=e;o0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]-1&&this.subject.observers.splice(e,1),0===this.subject.observers.length&&this.subject.cancelCallback&&this.subject.cancelCallback().catch((function(e){}))},e}(),y=function(){function e(e){this.minimumLogLevel=e,this.outputConsole=console}return e.prototype.log=function(e,t){if(e>=this.minimumLogLevel)switch(e){case r.a.Critical:case r.a.Error:this.outputConsole.error("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;case r.a.Warning:this.outputConsole.warn("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;case r.a.Information:this.outputConsole.info("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;default:this.outputConsole.log("["+(new Date).toISOString()+"] "+r.a[e]+": "+t)}},e}();function v(){var e="X-SignalR-User-Agent";return l.isNode&&(e="User-Agent"),[e,b(c,m(),E(),w())]}function b(e,t,n,r){var o="Microsoft SignalR/",i=e.split(".");return o+=i[0]+"."+i[1],o+=" ("+e+"; ",o+=t&&""!==t?t+"; ":"Unknown OS; ",o+=""+n,o+=r?"; "+r:"; Unknown Runtime Version",o+=")"}function m(){if(!l.isNode)return"";switch(e.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return e.platform}}function w(){if(l.isNode)return e.versions.node}function E(){return l.isNode?"NodeJS":"Browser"}}).call(this,n(13))},function(e,t,n){"use strict";n.r(t),n.d(t,"AbortError",(function(){return s})),n.d(t,"HttpError",(function(){return i})),n.d(t,"TimeoutError",(function(){return a})),n.d(t,"HttpClient",(function(){return l})),n.d(t,"HttpResponse",(function(){return u})),n.d(t,"DefaultHttpClient",(function(){return S})),n.d(t,"HubConnection",(function(){return O})),n.d(t,"HubConnectionState",(function(){return I})),n.d(t,"HubConnectionBuilder",(function(){return re})),n.d(t,"MessageType",(function(){return b})),n.d(t,"LogLevel",(function(){return f.a})),n.d(t,"HttpTransportType",(function(){return P})),n.d(t,"TransferFormat",(function(){return x})),n.d(t,"NullLogger",(function(){return $.a})),n.d(t,"JsonHubProtocol",(function(){return ee})),n.d(t,"Subject",(function(){return _})),n.d(t,"VERSION",(function(){return h.e}));var r,o=(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(t,n){var r=this,o=this.constructor.prototype;return(r=e.call(this,t)||this).statusCode=n,r.__proto__=o,r}return o(t,e),t}(Error),a=function(e){function t(t){void 0===t&&(t="A timeout occurred.");var n=this,r=this.constructor.prototype;return(n=e.call(this,t)||this).__proto__=r,n}return o(t,e),t}(Error),s=function(e){function t(t){void 0===t&&(t="An abort occurred.");var n=this,r=this.constructor.prototype;return(n=e.call(this,t)||this).__proto__=r,n}return o(t,e),t}(Error),c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=200&&o.status<300?n(new u(o.status,o.statusText,o.response||o.responseText)):r(new i(o.statusText,o.status))},o.onerror=function(){t.logger.log(f.a.Warning,"Error from HTTP request. "+o.status+": "+o.statusText+"."),r(new i(o.statusText,o.status))},o.ontimeout=function(){t.logger.log(f.a.Warning,"Timeout from HTTP request."),r(new a)},o.send(e.content||"")})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t}(l),E=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),S=function(e){function t(t){var n=e.call(this)||this;if("undefined"!=typeof fetch||h.c.isNode)n.httpClient=new v(t);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");n.httpClient=new w(t)}return n}return E(t,e),t.prototype.send=function(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new s):e.method?e.url?this.httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t.prototype.getCookieString=function(e){return this.httpClient.getCookieString(e)},t}(l),C=n(43);!function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close"}(b||(b={}));var I,_=function(){function e(){this.observers=[]}return e.prototype.next=function(e){for(var t=0,n=this.observers;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?[2,Promise.reject(new Error("Unable to connect to the server with any of the available transports. "+i.join(" ")))]:[2,Promise.reject(new Error("None of the transports supported by the client are supported by the server."))]}}))}))},e.prototype.constructTransport=function(e){switch(e){case P.WebSockets:if(!this.options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new Y(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.WebSocket,this.options.headers||{});case P.ServerSentEvents:if(!this.options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new H(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.EventSource,this.options.withCredentials,this.options.headers||{});case P.LongPolling:return new B(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.withCredentials,this.options.headers||{});default:throw new Error("Unknown transport: "+e+".")}},e.prototype.startTransport=function(e,t){var n=this;return this.transport.onreceive=this.onreceive,this.transport.onclose=function(e){return n.stopConnection(e)},this.transport.connect(e,t)},e.prototype.resolveTransportOrError=function(e,t,n){var r=P[e.transport];if(null==r)return this.logger.log(f.a.Debug,"Skipping transport '"+e.transport+"' because it is not supported by this client."),new Error("Skipping transport '"+e.transport+"' because it is not supported by this client.");if(!function(e,t){return!e||0!=(t&e)}(t,r))return this.logger.log(f.a.Debug,"Skipping transport '"+P[r]+"' because it was disabled by the client."),new Error("'"+P[r]+"' is disabled by the client.");if(!(e.transferFormats.map((function(e){return x[e]})).indexOf(n)>=0))return this.logger.log(f.a.Debug,"Skipping transport '"+P[r]+"' because it does not support the requested transfer format '"+x[n]+"'."),new Error("'"+P[r]+"' does not support "+x[n]+".");if(r===P.WebSockets&&!this.options.WebSocket||r===P.ServerSentEvents&&!this.options.EventSource)return this.logger.log(f.a.Debug,"Skipping transport '"+P[r]+"' because it is not supported in your environment.'"),new Error("'"+P[r]+"' is not supported in your environment.");this.logger.log(f.a.Debug,"Selecting transport '"+P[r]+"'.");try{return this.constructTransport(r)}catch(e){return e}},e.prototype.isITransport=function(e){return e&&"object"==typeof e&&"connect"in e},e.prototype.stopConnection=function(e){var t=this;if(this.logger.log(f.a.Debug,"HttpConnection.stopConnection("+e+") called while in state "+this.connectionState+"."),this.transport=void 0,e=this.stopError||e,this.stopError=void 0,"Disconnected"!==this.connectionState){if("Connecting"===this.connectionState)throw this.logger.log(f.a.Warning,"Call to HttpConnection.stopConnection("+e+") was ignored because the connection is still in the connecting state."),new Error("HttpConnection.stopConnection("+e+") was called while the connection is still in the connecting state.");if("Disconnecting"===this.connectionState&&this.stopPromiseResolver(),e?this.logger.log(f.a.Error,"Connection disconnected with error '"+e+"'."):this.logger.log(f.a.Information,"Connection disconnected."),this.sendQueue&&(this.sendQueue.stop().catch((function(e){t.logger.log(f.a.Error,"TransportSendQueue.stop() threw error '"+e+"'.")})),this.sendQueue=void 0),this.connectionId=void 0,this.connectionState="Disconnected",this.connectionStarted){this.connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this.logger.log(f.a.Error,"HttpConnection.onclose("+e+") threw error '"+t+"'.")}}}else this.logger.log(f.a.Debug,"Call to HttpConnection.stopConnection("+e+") was ignored because the connection is already in the disconnected state.")},e.prototype.resolveUrl=function(e){if(0===e.lastIndexOf("https://",0)||0===e.lastIndexOf("http://",0))return e;if(!h.c.isBrowser||!window.document)throw new Error("Cannot resolve '"+e+"'.");var t=window.document.createElement("a");return t.href=e,this.logger.log(f.a.Information,"Normalizing '"+e+"' to '"+t.href+"'."),t.href},e.prototype.resolveNegotiateUrl=function(e){var t=e.indexOf("?"),n=e.substring(0,-1===t?e.length:t);return"/"!==n[n.length-1]&&(n+="/"),n+="negotiate",-1===(n+=-1===t?"":e.substring(t)).indexOf("negotiateVersion")&&(n+=-1===t?"?":"&",n+="negotiateVersion="+this.negotiateVersion),n},e}();var G=function(){function e(e){this.transport=e,this.buffer=[],this.executing=!0,this.sendBufferedData=new Q,this.transportResult=new Q,this.sendLoopPromise=this.sendLoop()}return e.prototype.send=function(e){return this.bufferData(e),this.transportResult||(this.transportResult=new Q),this.transportResult.promise},e.prototype.stop=function(){return this.executing=!1,this.sendBufferedData.resolve(),this.sendLoopPromise},e.prototype.bufferData=function(e){if(this.buffer.length&&typeof this.buffer[0]!=typeof e)throw new Error("Expected data to be of type "+typeof this.buffer+" but was of type "+typeof e);this.buffer.push(e),this.sendBufferedData.resolve()},e.prototype.sendLoop=function(){return K(this,void 0,void 0,(function(){var t,n,r;return V(this,(function(o){switch(o.label){case 0:return[4,this.sendBufferedData.promise];case 1:if(o.sent(),!this.executing)return this.transportResult&&this.transportResult.reject("Connection stopped."),[3,6];this.sendBufferedData=new Q,t=this.transportResult,this.transportResult=void 0,n="string"==typeof this.buffer[0]?this.buffer.join(""):e.concatBuffers(this.buffer),this.buffer.length=0,o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.transport.send(n)];case 3:return o.sent(),t.resolve(),[3,5];case 4:return r=o.sent(),t.reject(r),[3,5];case 5:return[3,0];case 6:return[2]}}))}))},e.concatBuffers=function(e){for(var t=e.map((function(e){return e.byteLength})).reduce((function(e,t){return e+t})),n=new Uint8Array(t),r=0,o=0,i=e;o0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1] * @license MIT */ -var r=n(55),o=n(56),i=n(57);function a(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function d(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return F(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return k(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return P(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){var i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var l=-1;for(i=n;is&&(n=s-c),i=n;i>=0;i--){for(var f=!0,h=0;ho&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function k(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+f<=n)switch(f){case 1:u<128&&(l=u);break;case 2:128==(192&(i=e[o+1]))&&(c=(31&u)<<6|63&i)>127&&(l=c);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(c=(15&u)<<12|(63&i)<<6|63&a)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(c=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&c<1114112&&(l=c)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},c.prototype.compare=function(e,t,n,r,o){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n),f=0;fo)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return m(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return E(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return C(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function D(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function M(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function j(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function A(e,t,n,r,i){return i||j(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,i){return i||j(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||L(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);L(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);L(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return A(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return A(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!c.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function H(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(9))},function(e,t,n){"use strict";var r=n(15).Buffer,o=n(58),i=n(21),a=n(71),s=n(74),c=n(75);e.exports=function(e){var t=[],n=[];return{encode:c(t,(e=e||{forceFloat64:!1,compatibilityMode:!1,disableTimestampEncoding:!1}).forceFloat64,e.compatibilityMode,e.disableTimestampEncoding),decode:s(n),register:function(e,t,n,a){return o(t,"must have a constructor"),o(n,"must have an encode function"),o(e>=0,"must have a non-negative type"),o(a,"must have a decode function"),this.registerEncoder((function(e){return e instanceof t}),(function(t){var o=i(),a=r.allocUnsafe(1);return a.writeInt8(e,0),o.append(a),o.append(n(t)),o})),this.registerDecoder(e,a),this},registerEncoder:function(e,n){return o(e,"must have an encode function"),o(n,"must have an encode function"),t.push({check:e,encode:n}),this},registerDecoder:function(e,t){return o(e>=0,"must have a non-negative type"),o(t,"must have a decode function"),n.push({type:e,decode:t}),this},encoder:a.encoder,decoder:a.decoder,buffer:!0,type:"msgpack5",IncompleteBufferError:s.IncompleteBufferError}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=p("_blazorLogicalChildren"),o=p("_blazorLogicalParent"),i=p("_blazorLogicalEnd");function a(e,t){if(e.childNodes.length>0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return r in e||(e[r]=[]),e}function s(e,t,n){var i=e;if(e instanceof Comment&&(u(i)&&u(i).length>0))throw new Error("Not implemented: inserting non-empty logical container");if(c(i))throw new Error("Not implemented: moving existing logical children");var a=u(t);if(n0;)e(r,0)}var i=r;i.parentNode.removeChild(i)},t.getLogicalParent=c,t.getLogicalSiblingEnd=function(e){return e[i]||null},t.getLogicalChild=function(e,t){return u(e)[t]},t.isSvgElement=function(e){return"http://www.w3.org/2000/svg"===l(e).namespaceURI},t.getLogicalChildrenArray=u,t.permuteLogicalChildren=function(e,t){var n=u(e);t.forEach((function(e){e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=function e(t){if(t instanceof Element)return t;var n=f(t);if(n)return n.previousSibling;var r=c(t);return r instanceof Element?r.lastChild:e(r)}(e.moveRangeStart)})),t.forEach((function(t){var r=t.moveToBeforeMarker=document.createComment("marker"),o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):h(r,e)})),t.forEach((function(e){for(var t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd,i=r;i;){var a=i.nextSibling;if(n.insertBefore(i,t),i===o)break;i=a}n.removeChild(t)})),t.forEach((function(e){n[e.toSiblingIndex]=e.moveRangeStart}))},t.getClosestDomElement=l},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,u=[],l=!1,f=-1;function h(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&p())}function p(){if(!l){var e=s(h);l=!0;for(var t=u.length;t;){for(c=u,u=[];++f1)for(var n=1;nthis.length)&&(r=this.length),n>=this.length)return e||i.alloc(0);if(r<=0)return e||i.alloc(0);var o,a,s=!!e,c=this._offset(n),u=r-n,l=u,f=s&&t||0,h=c[1];if(0===n&&r==this.length){if(!s)return 1===this._bufs.length?this._bufs[0]:i.concat(this._bufs,this.length);for(a=0;a(o=this._bufs[a].length-h))){this._bufs[a].copy(e,f,h,h+l);break}this._bufs[a].copy(e,f,h),f+=o,l-=o,h&&(h=0)}return e},a.prototype.shallowSlice=function(e,t){e=e||0,t=t||this.length,e<0&&(e+=this.length),t<0&&(t+=this.length);var n=this._offset(e),r=this._offset(t),o=this._bufs.slice(n[0],r[0]+1);return 0==r[1]?o.pop():o[o.length-1]=o[o.length-1].slice(0,r[1]),0!=n[1]&&(o[0]=o[0].slice(n[1])),new a(o)},a.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},a.prototype.consume=function(e){for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},a.prototype.duplicate=function(){for(var e=0,t=new a;e0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]>>0)}t.readInt32LE=function(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24},t.readUint32LE=i,t.readUint64LE=function(e,t){var n=i(e,t+4);if(n>o)throw new Error("Cannot read uint64 with high order part "+n+", because the result would exceed Number.MAX_SAFE_INTEGER.");return n*r+i(e,t)},t.readLEB128=function(e,t){for(var n=0,r=0,o=0;o<4;o++){var i=e[t+o];if(n|=(127&i)<65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u)}r.length>1024&&(o.push(String.fromCharCode.apply(null,r)),r.length=0)}return o.push(String.fromCharCode.apply(null,r)),o.join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shouldAutoStart=function(){return!(!document||!document.currentScript||"false"===document.currentScript.getAttribute("autostart"))}},function(e,t,n){(function(e){var r=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),c=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(n)?r.showHidden=n:n&&t._extend(r,n),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=c),l(r,e,r.depth)}function c(e,t){var n=s.styles[t];return n?"["+s.colors[n][0]+"m"+e+"["+s.colors[n][1]+"m":e}function u(e,t){return e}function l(e,n,r){if(e.customInspect&&n&&C(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var o=n.inspect(r,e);return v(o)||(o=l(e,o,r)),o}var i=function(e,t){if(b(t))return e.stylize("undefined","undefined");if(v(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(y(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,n);if(i)return i;var a=Object.keys(n),s=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(n)),S(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(n);if(0===a.length){if(C(n)){var c=n.name?": "+n.name:"";return e.stylize("[Function"+c+"]","special")}if(m(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(E(n))return e.stylize(Date.prototype.toString.call(n),"date");if(S(n))return f(n)}var u,w="",I=!1,_=["{","}"];(p(n)&&(I=!0,_=["[","]"]),C(n))&&(w=" [Function"+(n.name?": "+n.name:"")+"]");return m(n)&&(w=" "+RegExp.prototype.toString.call(n)),E(n)&&(w=" "+Date.prototype.toUTCString.call(n)),S(n)&&(w=" "+f(n)),0!==a.length||I&&0!=n.length?r<0?m(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),u=I?function(e,t,n,r,o){for(var i=[],a=0,s=t.length;a=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(u,w,_)):_[0]+w+_[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,o,i){var a,s,c;if((c=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),P(r,o)||(a="["+o+"]"),s||(e.seen.indexOf(c.value)<0?(s=g(n)?l(e,c.value,null):l(e,c.value,n-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),b(a)){if(i&&o.match(/^\d+$/))return s;(a=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function p(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function g(e){return null===e}function y(e){return"number"==typeof e}function v(e){return"string"==typeof e}function b(e){return void 0===e}function m(e){return w(e)&&"[object RegExp]"===I(e)}function w(e){return"object"==typeof e&&null!==e}function E(e){return w(e)&&"[object Date]"===I(e)}function S(e){return w(e)&&("[object Error]"===I(e)||e instanceof Error)}function C(e){return"function"==typeof e}function I(e){return Object.prototype.toString.call(e)}function _(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(b(i)&&(i=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!a[n])if(new RegExp("\\b"+n+"\\b","i").test(i)){var r=e.pid;a[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else a[n]=function(){};return a[n]},t.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=p,t.isBoolean=d,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=y,t.isString=v,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=b,t.isRegExp=m,t.isObject=w,t.isDate=E,t.isError=S,t.isFunction=C,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(60);var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(){var e=new Date,t=[_(e.getHours()),_(e.getMinutes()),_(e.getSeconds())].join(":");return[e.getDate(),k[e.getMonth()],t].join(" ")}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",T(),t.format.apply(t,arguments))},t.inherits=n(61),t._extend=function(e,t){if(!t||!w(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var x="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function O(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(x&&e[x]){var t;if("function"!=typeof(t=e[x]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,x,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise((function(e,r){t=e,n=r})),o=[],i=0;i0?("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),r?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):E(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||0!==t.length?E(e,a,t,!1):_(e,a)):E(e,a,t,!1))):r||(a.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function C(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?o.nextTick(I,e):I(e))}function I(e){p("emit readable"),e.emit("readable"),x(e)}function _(e,t){t.readingMore||(t.readingMore=!0,o.nextTick(k,e,t))}function k(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ei.length?i.length:e;if(a===i.length?o+=i:o+=i.slice(0,e),0===(e-=a)){a===i.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(a));break}++r}return t.length-=r,o}(e,t):function(e,t){var n=u.allocUnsafe(e),r=t.head,o=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var i=r.data,a=e>i.length?i.length:e;if(i.copy(n,n.length-e,0,a),0===(e-=a)){a===i.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(a));break}++o}return t.length-=o,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function R(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,o.nextTick(L,t,e))}function L(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function D(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?R(this):C(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&R(this),null;var r,o=t.needReadable;return p("need readable",o),(0===t.length||t.length-e0?O(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&R(this)),null!==r&&this.emit("data",r),r},m.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},m.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,p("pipe count=%d opts=%j",i.pipesCount,t);var c=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?l:m;function u(t,r){p("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",l),n.removeListener("end",m),n.removeListener("data",g),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function l(){p("onend"),e.end()}i.endEmitted?o.nextTick(c):n.once("end",c),e.on("unpipe",u);var f=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,x(e))}}(n);e.on("drain",f);var h=!1;var d=!1;function g(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==D(i.pipes,e))&&!h&&(p("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){p("onerror",t),m(),e.removeListener("error",y),0===s(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),m()}function b(){p("onfinish"),e.removeListener("close",v),m()}function m(){p("unpipe"),n.unpipe(e)}return n.on("data",g),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?a(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),i.flowing||(p("pipe resume"),n.resume()),e},m.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i0&&a.length>o&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,s=c,console&&console.warn&&console.warn(s)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=h.bind(r);return o.listener=n,r.wrapFn=o,o}function d(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var u=c.length,l=y(c,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},s.prototype.listenerCount=g,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){e.exports=n(39).EventEmitter},function(e,t,n){"use strict";var r=n(22);function o(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,i=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return i||a?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||r.nextTick(o,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(r.nextTick(o,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,n){"use strict";var r=n(67).Buffer,o=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function i(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===o||!o(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=l,this.end=f,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return o>0&&(e.lastNeed=o-1),o;if(--r=0)return o>0&&(e.lastNeed=o-2),o;if(--r=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},i.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";(function(t,r,o){var i=n(22);function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var o=r.callback;t.pendingcb--,o(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=b;var s,c=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?r:i.nextTick;b.WritableState=v;var u=n(20);u.inherits=n(16);var l={deprecate:n(70)},f=n(40),h=n(15).Buffer,p=o.Uint8Array||function(){};var d,g=n(41);function y(){}function v(e,t){s=s||n(10),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var o=e.highWaterMark,u=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:r&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,o=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,o){--t.pendingcb,n?(i.nextTick(o,r),i.nextTick(I,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(o(r),e._writableState.errorEmitted=!0,e.emit("error",r),I(e,t))}(e,n,r,t,o);else{var a=S(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||E(e,n),r?c(w,e,n,a,o):w(e,n,a,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function b(e){if(s=s||n(10),!(d.call(b,this)||this instanceof s))return new b(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function m(e,t,n,r,o,i,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function w(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),I(e,t)}function E(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=new Array(r),i=t.corkedRequestsFree;i.entry=n;for(var s=0,c=!0;n;)o[s]=n,n.isBuf||(c=!1),n=n.next,s+=1;o.allBuffers=c,m(e,t,!0,t.length,o,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new a(t),t.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,l=n.encoding,f=n.callback;if(m(e,t,!1,t.objectMode?1:u.length,u,l,f),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function C(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),I(e,t)}))}function I(e,t){var n=S(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(C,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}u.inherits(b,f),v.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(v.prototype,"buffer",{get:l.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===b&&(e&&e._writableState instanceof v)}})):d=function(e){return e instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(e,t,n){var r,o=this._writableState,a=!1,s=!o.objectMode&&(r=e,h.isBuffer(r)||r instanceof p);return s&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(n=t,t=null),s?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=y),o.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}(this,n):(s||function(e,t,n,r){var o=!0,a=!1;return null===n?a=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),i.nextTick(r,a),o=!1),o}(this,o,e,n))&&(o.pendingcb++,a=function(e,t,n,r,o,i){if(!n){var a=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n));return t}(t,r,o);r!==a&&(n=!0,o="buffer",r=a)}var s=t.objectMode?1:r.length;t.length+=s;var c=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,I(e,t),n&&(t.finished?i.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),b.prototype.destroy=g.destroy,b.prototype._undestroy=g.undestroy,b.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(14),n(68).setImmediate,n(9))},function(e,t,n){"use strict";e.exports=a;var r=n(10),o=n(20);function i(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.lengths?a.slice(s).buffer:null}else{var c,u=t;if(-1===(c=u.indexOf(r.a.RecordSeparator)))throw new Error("Message is incomplete.");s=c+1;n=u.substring(0,s),i=u.length>s?u.substring(s):null}var l=r.a.parse(n),f=JSON.parse(l[0]);if(f.type)throw new Error("Expected a handshake response from the server.");return[i,f]},t}()}).call(this,n(11).Buffer)},,,,,,,,,function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t0?a-4:a;for(n=0;n>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===s&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,c[l++]=255&t);1===s&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,s=n-o;as?s:a+16383));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,c=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var o,i,a=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<>1,l=-7,f=n?o-1:0,h=n?-1:1,p=e[t+f];for(f+=h,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+e[t+f],f+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+f],f+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=u}return(p?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+f>=1?h/c:h*Math.pow(2,1-f))*c>=2&&(a++,c/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(t*c-1)*Math.pow(2,o),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&s,p+=d,s/=256,o-=8);for(a=a<0;e[n+p]=255&a,p+=d,a/=256,u-=8);e[n+p-d]|=128*g}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";(function(t){var r=n(59); +var r=n(53),o=n(54),i=n(55);function a(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function d(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return F(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return k(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return P(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){var i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var l=-1;for(i=n;is&&(n=s-c),i=n;i>=0;i--){for(var f=!0,h=0;ho&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function k(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+f<=n)switch(f){case 1:u<128&&(l=u);break;case 2:128==(192&(i=e[o+1]))&&(c=(31&u)<<6|63&i)>127&&(l=c);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(c=(15&u)<<12|(63&i)<<6|63&a)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(c=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&c<1114112&&(l=c)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},c.prototype.compare=function(e,t,n,r,o){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n),f=0;fo)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return m(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return E(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return C(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function D(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function M(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function j(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function A(e,t,n,r,i){return i||j(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,i){return i||j(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||L(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);L(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);L(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return A(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return A(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!c.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function H(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(N,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(8))},function(e,t,n){"use strict";var r=n(14).Buffer,o=n(56),i=n(20),a=n(69),s=n(72),c=n(73);e.exports=function(e){var t=[],n=[];return{encode:c(t,(e=e||{forceFloat64:!1,compatibilityMode:!1,disableTimestampEncoding:!1}).forceFloat64,e.compatibilityMode,e.disableTimestampEncoding),decode:s(n),register:function(e,t,n,a){return o(t,"must have a constructor"),o(n,"must have an encode function"),o(e>=0,"must have a non-negative type"),o(a,"must have a decode function"),this.registerEncoder((function(e){return e instanceof t}),(function(t){var o=i(),a=r.allocUnsafe(1);return a.writeInt8(e,0),o.append(a),o.append(n(t)),o})),this.registerDecoder(e,a),this},registerEncoder:function(e,n){return o(e,"must have an encode function"),o(n,"must have an encode function"),t.push({check:e,encode:n}),this},registerDecoder:function(e,t){return o(e>=0,"must have a non-negative type"),o(t,"must have a decode function"),n.push({type:e,decode:t}),this},encoder:a.encoder,decoder:a.decoder,buffer:!0,type:"msgpack5",IncompleteBufferError:s.IncompleteBufferError}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=p("_blazorLogicalChildren"),o=p("_blazorLogicalParent"),i=p("_blazorLogicalEnd");function a(e,t){if(e.childNodes.length>0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return r in e||(e[r]=[]),e}function s(e,t,n){var i=e;if(e instanceof Comment&&(u(i)&&u(i).length>0))throw new Error("Not implemented: inserting non-empty logical container");if(c(i))throw new Error("Not implemented: moving existing logical children");var a=u(t);if(n0;)e(r,0)}var i=r;i.parentNode.removeChild(i)},t.getLogicalParent=c,t.getLogicalSiblingEnd=function(e){return e[i]||null},t.getLogicalChild=function(e,t){return u(e)[t]},t.isSvgElement=function(e){return"http://www.w3.org/2000/svg"===l(e).namespaceURI},t.getLogicalChildrenArray=u,t.permuteLogicalChildren=function(e,t){var n=u(e);t.forEach((function(e){e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=function e(t){if(t instanceof Element)return t;var n=f(t);if(n)return n.previousSibling;var r=c(t);return r instanceof Element?r.lastChild:e(r)}(e.moveRangeStart)})),t.forEach((function(t){var r=t.moveToBeforeMarker=document.createComment("marker"),o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):h(r,e)})),t.forEach((function(e){for(var t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd,i=r;i;){var a=i.nextSibling;if(n.insertBefore(i,t),i===o)break;i=a}n.removeChild(t)})),t.forEach((function(e){n[e.toSiblingIndex]=e.moveRangeStart}))},t.getClosestDomElement=l},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,u=[],l=!1,f=-1;function h(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&p())}function p(){if(!l){var e=s(h);l=!0;for(var t=u.length;t;){for(c=u,u=[];++f1)for(var n=1;nthis.length)&&(r=this.length),n>=this.length)return e||i.alloc(0);if(r<=0)return e||i.alloc(0);var o,a,s=!!e,c=this._offset(n),u=r-n,l=u,f=s&&t||0,h=c[1];if(0===n&&r==this.length){if(!s)return 1===this._bufs.length?this._bufs[0]:i.concat(this._bufs,this.length);for(a=0;a(o=this._bufs[a].length-h))){this._bufs[a].copy(e,f,h,h+l);break}this._bufs[a].copy(e,f,h),f+=o,l-=o,h&&(h=0)}return e},a.prototype.shallowSlice=function(e,t){e=e||0,t=t||this.length,e<0&&(e+=this.length),t<0&&(t+=this.length);var n=this._offset(e),r=this._offset(t),o=this._bufs.slice(n[0],r[0]+1);return 0==r[1]?o.pop():o[o.length-1]=o[o.length-1].slice(0,r[1]),0!=n[1]&&(o[0]=o[0].slice(n[1])),new a(o)},a.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},a.prototype.consume=function(e){for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},a.prototype.duplicate=function(){for(var e=0,t=new a;e0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]>>0)}t.readInt32LE=function(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24},t.readUint32LE=i,t.readUint64LE=function(e,t){var n=i(e,t+4);if(n>o)throw new Error("Cannot read uint64 with high order part "+n+", because the result would exceed Number.MAX_SAFE_INTEGER.");return n*r+i(e,t)},t.readLEB128=function(e,t){for(var n=0,r=0,o=0;o<4;o++){var i=e[t+o];if(n|=(127&i)<65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u)}r.length>1024&&(o.push(String.fromCharCode.apply(null,r)),r.length=0)}return o.push(String.fromCharCode.apply(null,r)),o.join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shouldAutoStart=function(){return!(!document||!document.currentScript||"false"===document.currentScript.getAttribute("autostart"))}},function(e,t,n){(function(e){var r=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),c=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(n)?r.showHidden=n:n&&t._extend(r,n),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=c),l(r,e,r.depth)}function c(e,t){var n=s.styles[t];return n?"["+s.colors[n][0]+"m"+e+"["+s.colors[n][1]+"m":e}function u(e,t){return e}function l(e,n,r){if(e.customInspect&&n&&C(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var o=n.inspect(r,e);return v(o)||(o=l(e,o,r)),o}var i=function(e,t){if(b(t))return e.stylize("undefined","undefined");if(v(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(y(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,n);if(i)return i;var a=Object.keys(n),s=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(n)),S(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(n);if(0===a.length){if(C(n)){var c=n.name?": "+n.name:"";return e.stylize("[Function"+c+"]","special")}if(m(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(E(n))return e.stylize(Date.prototype.toString.call(n),"date");if(S(n))return f(n)}var u,w="",I=!1,_=["{","}"];(p(n)&&(I=!0,_=["[","]"]),C(n))&&(w=" [Function"+(n.name?": "+n.name:"")+"]");return m(n)&&(w=" "+RegExp.prototype.toString.call(n)),E(n)&&(w=" "+Date.prototype.toUTCString.call(n)),S(n)&&(w=" "+f(n)),0!==a.length||I&&0!=n.length?r<0?m(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),u=I?function(e,t,n,r,o){for(var i=[],a=0,s=t.length;a=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(u,w,_)):_[0]+w+_[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,o,i){var a,s,c;if((c=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),P(r,o)||(a="["+o+"]"),s||(e.seen.indexOf(c.value)<0?(s=g(n)?l(e,c.value,null):l(e,c.value,n-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),b(a)){if(i&&o.match(/^\d+$/))return s;(a=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function p(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function g(e){return null===e}function y(e){return"number"==typeof e}function v(e){return"string"==typeof e}function b(e){return void 0===e}function m(e){return w(e)&&"[object RegExp]"===I(e)}function w(e){return"object"==typeof e&&null!==e}function E(e){return w(e)&&"[object Date]"===I(e)}function S(e){return w(e)&&("[object Error]"===I(e)||e instanceof Error)}function C(e){return"function"==typeof e}function I(e){return Object.prototype.toString.call(e)}function _(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(b(i)&&(i=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!a[n])if(new RegExp("\\b"+n+"\\b","i").test(i)){var r=e.pid;a[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else a[n]=function(){};return a[n]},t.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=p,t.isBoolean=d,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=y,t.isString=v,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=b,t.isRegExp=m,t.isObject=w,t.isDate=E,t.isError=S,t.isFunction=C,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(58);var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(){var e=new Date,t=[_(e.getHours()),_(e.getMinutes()),_(e.getSeconds())].join(":");return[e.getDate(),k[e.getMonth()],t].join(" ")}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",T(),t.format.apply(t,arguments))},t.inherits=n(59),t._extend=function(e,t){if(!t||!w(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var x="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function O(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(x&&e[x]){var t;if("function"!=typeof(t=e[x]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,x,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise((function(e,r){t=e,n=r})),o=[],i=0;i0?("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),r?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):E(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||0!==t.length?E(e,a,t,!1):_(e,a)):E(e,a,t,!1))):r||(a.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function C(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?o.nextTick(I,e):I(e))}function I(e){p("emit readable"),e.emit("readable"),x(e)}function _(e,t){t.readingMore||(t.readingMore=!0,o.nextTick(k,e,t))}function k(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ei.length?i.length:e;if(a===i.length?o+=i:o+=i.slice(0,e),0===(e-=a)){a===i.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(a));break}++r}return t.length-=r,o}(e,t):function(e,t){var n=u.allocUnsafe(e),r=t.head,o=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var i=r.data,a=e>i.length?i.length:e;if(i.copy(n,n.length-e,0,a),0===(e-=a)){a===i.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(a));break}++o}return t.length-=o,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function R(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,o.nextTick(L,t,e))}function L(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function D(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?R(this):C(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&R(this),null;var r,o=t.needReadable;return p("need readable",o),(0===t.length||t.length-e0?O(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&R(this)),null!==r&&this.emit("data",r),r},m.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},m.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,p("pipe count=%d opts=%j",i.pipesCount,t);var c=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?l:m;function u(t,r){p("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",l),n.removeListener("end",m),n.removeListener("data",g),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function l(){p("onend"),e.end()}i.endEmitted?o.nextTick(c):n.once("end",c),e.on("unpipe",u);var f=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,x(e))}}(n);e.on("drain",f);var h=!1;var d=!1;function g(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==D(i.pipes,e))&&!h&&(p("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){p("onerror",t),m(),e.removeListener("error",y),0===s(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),m()}function b(){p("onfinish"),e.removeListener("close",v),m()}function m(){p("unpipe"),n.unpipe(e)}return n.on("data",g),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?a(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),i.flowing||(p("pipe resume"),n.resume()),e},m.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i0&&a.length>o&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,s=c,console&&console.warn&&console.warn(s)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=h.bind(r);return o.listener=n,r.wrapFn=o,o}function d(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var u=c.length,l=y(c,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},s.prototype.listenerCount=g,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){e.exports=n(37).EventEmitter},function(e,t,n){"use strict";var r=n(21);function o(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,i=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return i||a?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||r.nextTick(o,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(r.nextTick(o,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,n){"use strict";var r=n(65).Buffer,o=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function i(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===o||!o(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=l,this.end=f,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return o>0&&(e.lastNeed=o-1),o;if(--r=0)return o>0&&(e.lastNeed=o-2),o;if(--r=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},i.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";(function(t,r,o){var i=n(21);function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var o=r.callback;t.pendingcb--,o(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=b;var s,c=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?r:i.nextTick;b.WritableState=v;var u=n(19);u.inherits=n(15);var l={deprecate:n(68)},f=n(38),h=n(14).Buffer,p=o.Uint8Array||function(){};var d,g=n(39);function y(){}function v(e,t){s=s||n(9),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var o=e.highWaterMark,u=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:r&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,o=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,o){--t.pendingcb,n?(i.nextTick(o,r),i.nextTick(I,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(o(r),e._writableState.errorEmitted=!0,e.emit("error",r),I(e,t))}(e,n,r,t,o);else{var a=S(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||E(e,n),r?c(w,e,n,a,o):w(e,n,a,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function b(e){if(s=s||n(9),!(d.call(b,this)||this instanceof s))return new b(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function m(e,t,n,r,o,i,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function w(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),I(e,t)}function E(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=new Array(r),i=t.corkedRequestsFree;i.entry=n;for(var s=0,c=!0;n;)o[s]=n,n.isBuf||(c=!1),n=n.next,s+=1;o.allBuffers=c,m(e,t,!0,t.length,o,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new a(t),t.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,l=n.encoding,f=n.callback;if(m(e,t,!1,t.objectMode?1:u.length,u,l,f),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function C(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),I(e,t)}))}function I(e,t){var n=S(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(C,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}u.inherits(b,f),v.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(v.prototype,"buffer",{get:l.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===b&&(e&&e._writableState instanceof v)}})):d=function(e){return e instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(e,t,n){var r,o=this._writableState,a=!1,s=!o.objectMode&&(r=e,h.isBuffer(r)||r instanceof p);return s&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(n=t,t=null),s?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=y),o.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}(this,n):(s||function(e,t,n,r){var o=!0,a=!1;return null===n?a=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),i.nextTick(r,a),o=!1),o}(this,o,e,n))&&(o.pendingcb++,a=function(e,t,n,r,o,i){if(!n){var a=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n));return t}(t,r,o);r!==a&&(n=!0,o="buffer",r=a)}var s=t.objectMode?1:r.length;t.length+=s;var c=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,I(e,t),n&&(t.finished?i.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),b.prototype.destroy=g.destroy,b.prototype._undestroy=g.undestroy,b.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(13),n(66).setImmediate,n(8))},function(e,t,n){"use strict";e.exports=a;var r=n(9),o=n(19);function i(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.lengths?a.slice(s).buffer:null}else{var c,u=t;if(-1===(c=u.indexOf(r.a.RecordSeparator)))throw new Error("Message is incomplete.");s=c+1;n=u.substring(0,s),i=u.length>s?u.substring(s):null}var l=r.a.parse(n),f=JSON.parse(l[0]);if(f.type)throw new Error("Expected a handshake response from the server.");return[i,f]},t}()}).call(this,n(10).Buffer)},,,,,,,,,function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t0?a-4:a;for(n=0;n>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===s&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,c[l++]=255&t);1===s&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,s=n-o;as?s:a+16383));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,c=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var o,i,a=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<>1,l=-7,f=n?o-1:0,h=n?-1:1,p=e[t+f];for(f+=h,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+e[t+f],f+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+f],f+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=u}return(p?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+f>=1?h/c:h*Math.pow(2,1-f))*c>=2&&(a++,c/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(t*c-1)*Math.pow(2,o),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&s,p+=d,s/=256,o-=8);for(a=a<0;e[n+p]=255&a,p+=d,a/=256,u-=8);e[n+p-d]|=128*g}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";(function(t){var r=n(57); /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */function o(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o=0;u--)if(l[u]!==f[u])return!1;for(u=l.length-1;u>=0;u--)if(s=l[u],!m(e[s],t[s],n,r))return!1;return!0}(e,t,n,r))}return n?e===t:e==t}function w(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function E(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function S(e,t,n,r){var o;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),o=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!o&&v(o,n,"Missing expected exception"+r);var i="string"==typeof r,s=!e&&o&&!n;if((!e&&a.isError(o)&&i&&E(o,n)||s)&&v(o,n,"Got unwanted exception"+r),e&&o&&n&&!E(o,n)||!e&&o)throw o}h.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return g(y(e.actual),128)+" "+e.operator+" "+g(y(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,o=d(t),i=r.indexOf("\n"+o);if(i>=0){var a=r.indexOf("\n",i+1);r=r.substring(a+1)}this.stack=r}}},a.inherits(h.AssertionError,Error),h.fail=v,h.ok=b,h.equal=function(e,t,n){e!=t&&v(e,t,n,"==",h.equal)},h.notEqual=function(e,t,n){e==t&&v(e,t,n,"!=",h.notEqual)},h.deepEqual=function(e,t,n){m(e,t,!1)||v(e,t,n,"deepEqual",h.deepEqual)},h.deepStrictEqual=function(e,t,n){m(e,t,!0)||v(e,t,n,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function(e,t,n){m(e,t,!1)&&v(e,t,n,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=function e(t,n,r){m(t,n,!0)&&v(t,n,r,"notDeepStrictEqual",e)},h.strictEqual=function(e,t,n){e!==t&&v(e,t,n,"===",h.strictEqual)},h.notStrictEqual=function(e,t,n){e===t&&v(e,t,n,"!==",h.notStrictEqual)},h.throws=function(e,t,n){S(!0,e,t,n)},h.doesNotThrow=function(e,t,n){S(!1,e,t,n)},h.ifError=function(e){if(e)throw e},h.strict=r((function e(t,n){t||v(t,!0,n,"==",e)}),h,{equal:h.strictEqual,deepEqual:h.deepStrictEqual,notEqual:h.notStrictEqual,notDeepEqual:h.notDeepStrictEqual}),h.strict.strict=h.strict;var C=Object.keys||function(e){var t=[];for(var n in e)s.call(e,n)&&t.push(n);return t}}).call(this,n(9))},function(e,t,n){"use strict"; + */function o(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o=0;u--)if(l[u]!==f[u])return!1;for(u=l.length-1;u>=0;u--)if(s=l[u],!m(e[s],t[s],n,r))return!1;return!0}(e,t,n,r))}return n?e===t:e==t}function w(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function E(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function S(e,t,n,r){var o;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),o=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!o&&v(o,n,"Missing expected exception"+r);var i="string"==typeof r,s=!e&&o&&!n;if((!e&&a.isError(o)&&i&&E(o,n)||s)&&v(o,n,"Got unwanted exception"+r),e&&o&&n&&!E(o,n)||!e&&o)throw o}h.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return g(y(e.actual),128)+" "+e.operator+" "+g(y(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,o=d(t),i=r.indexOf("\n"+o);if(i>=0){var a=r.indexOf("\n",i+1);r=r.substring(a+1)}this.stack=r}}},a.inherits(h.AssertionError,Error),h.fail=v,h.ok=b,h.equal=function(e,t,n){e!=t&&v(e,t,n,"==",h.equal)},h.notEqual=function(e,t,n){e==t&&v(e,t,n,"!=",h.notEqual)},h.deepEqual=function(e,t,n){m(e,t,!1)||v(e,t,n,"deepEqual",h.deepEqual)},h.deepStrictEqual=function(e,t,n){m(e,t,!0)||v(e,t,n,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function(e,t,n){m(e,t,!1)&&v(e,t,n,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=function e(t,n,r){m(t,n,!0)&&v(t,n,r,"notDeepStrictEqual",e)},h.strictEqual=function(e,t,n){e!==t&&v(e,t,n,"===",h.strictEqual)},h.notStrictEqual=function(e,t,n){e===t&&v(e,t,n,"!==",h.notStrictEqual)},h.throws=function(e,t,n){S(!0,e,t,n)},h.doesNotThrow=function(e,t,n){S(!1,e,t,n)},h.ifError=function(e){if(e)throw e},h.strict=r((function e(t,n){t||v(t,!0,n,"==",e)}),h,{equal:h.strictEqual,deepEqual:h.deepStrictEqual,notEqual:h.notStrictEqual,notDeepEqual:h.notDeepStrictEqual}),h.strict.strict=h.strict;var C=Object.keys||function(e){var t=[];for(var n in e)s.call(e,n)&&t.push(n);return t}}).call(this,n(8))},function(e,t,n){"use strict"; /* object-assign (c) Sindre Sorhus @license MIT -*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,s,c=a(e),u=1;u0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,o,i=r.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,n=i,o=s,t.copy(n,o),s+=a.data.length,a=a.next;return i},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){var r=n(11),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=a),a.prototype=Object.create(o.prototype),i(o,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(69),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(9))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o,i,a,s,c=1,u={},l=!1,f=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){d(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){d(e.data)},r=function(e){i.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(o=f.documentElement,r=function(e){var t=f.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):r=function(e){setTimeout(d,0,e)}:(a="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&d(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),r=function(t){e.postMessage(a+t,"*")}),h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n0?this._transform(null,t,n):n()},e.exports.decoder=c,e.exports.encoder=s},function(e,t,n){(t=e.exports=n(38)).Stream=t,t.Readable=t,t.Writable=n(43),t.Duplex=n(10),t.Transform=n(44),t.PassThrough=n(73)},function(e,t,n){"use strict";e.exports=i;var r=n(44),o=n(20);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}o.inherits=n(16),o.inherits(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){var r=n(21);function o(e){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e||"unable to decode"}n(37).inherits(o,Error),e.exports=function(e){return function(e){e instanceof r||(e=r().append(e));var t=i(e);if(t)return e.consume(t.bytesConsumed),t.value;throw new o};function t(e,t,n){return t>=n+e}function n(e,t){return{value:e,bytesConsumed:t}}function i(e,r){r=void 0===r?0:r;var o=e.length-r;if(o<=0)return null;var i,l,f,h=e.readUInt8(r),p=0;if(!function(e,t){var n=function(e){switch(e){case 196:return 2;case 197:return 3;case 198:return 5;case 199:return 3;case 200:return 4;case 201:return 6;case 202:return 5;case 203:return 9;case 204:return 2;case 205:return 3;case 206:return 5;case 207:return 9;case 208:return 2;case 209:return 3;case 210:return 5;case 211:return 9;case 212:return 3;case 213:return 4;case 214:return 6;case 215:return 10;case 216:return 18;case 217:return 2;case 218:return 3;case 219:return 5;case 222:return 3;default:return-1}}(e);return!(-1!==n&&t=0;f--)p+=e.readUInt8(r+f+1)*Math.pow(2,8*(7-f));return n(p,9);case 208:return n(p=e.readInt8(r+1),2);case 209:return n(p=e.readInt16BE(r+1),3);case 210:return n(p=e.readInt32BE(r+1),5);case 211:return n(p=function(e,t){var n=128==(128&e[t]);if(n)for(var r=1,o=t+7;o>=t;o--){var i=(255^e[o])+r;e[o]=255&i,r=i>>8}var a=e.readUInt32BE(t+0),s=e.readUInt32BE(t+4);return(4294967296*a+s)*(n?-1:1)}(e.slice(r+1,r+9),0),9);case 202:return n(p=e.readFloatBE(r+1),5);case 203:return n(p=e.readDoubleBE(r+1),9);case 217:return t(i=e.readUInt8(r+1),o,2)?n(p=e.toString("utf8",r+2,r+2+i),2+i):null;case 218:return t(i=e.readUInt16BE(r+1),o,3)?n(p=e.toString("utf8",r+3,r+3+i),3+i):null;case 219:return t(i=e.readUInt32BE(r+1),o,5)?n(p=e.toString("utf8",r+5,r+5+i),5+i):null;case 196:return t(i=e.readUInt8(r+1),o,2)?n(p=e.slice(r+2,r+2+i),2+i):null;case 197:return t(i=e.readUInt16BE(r+1),o,3)?n(p=e.slice(r+3,r+3+i),3+i):null;case 198:return t(i=e.readUInt32BE(r+1),o,5)?n(p=e.slice(r+5,r+5+i),5+i):null;case 220:return o<3?null:(i=e.readUInt16BE(r+1),a(e,r,i,3));case 221:return o<5?null:(i=e.readUInt32BE(r+1),a(e,r,i,5));case 222:return i=e.readUInt16BE(r+1),s(e,r,i,3);case 223:throw new Error("map too big to decode in JS");case 212:return c(e,r,1);case 213:return c(e,r,2);case 214:return c(e,r,4);case 215:return c(e,r,8);case 216:return c(e,r,16);case 199:return i=e.readUInt8(r+1),l=e.readUInt8(r+2),t(i,o,3)?u(e,r,l,i,3):null;case 200:return i=e.readUInt16BE(r+1),l=e.readUInt8(r+3),t(i,o,4)?u(e,r,l,i,4):null;case 201:return i=e.readUInt32BE(r+1),l=e.readUInt8(r+5),t(i,o,6)?u(e,r,l,i,6):null}if(144==(240&h))return a(e,r,i=15&h,1);if(128==(240&h))return s(e,r,i=15&h,1);if(160==(224&h))return t(i=31&h,o,1)?n(p=e.toString("utf8",r+1,r+i+1),i+1):null;if(h>=224)return n(p=h-256,1);if(h<128)return n(h,1);throw new Error("not implemented yet")}function a(e,t,r,o){var a,s=[],c=0;for(t+=o,a=0;a.1)&&((n=r.allocUnsafe(9))[0]=203,n.writeDoubleBE(e,1)),n}e.exports=function(e,t,n,a){function s(c,u){var l,f,h;if(void 0===c)throw new Error("undefined is not encodable in msgpack!");if(null===c)(l=r.allocUnsafe(1))[0]=192;else if(!0===c)(l=r.allocUnsafe(1))[0]=195;else if(!1===c)(l=r.allocUnsafe(1))[0]=194;else if("string"==typeof c)(f=r.byteLength(c))<32?((l=r.allocUnsafe(1+f))[0]=160|f,f>0&&l.write(c,1)):f<=255&&!n?((l=r.allocUnsafe(2+f))[0]=217,l[1]=f,l.write(c,2)):f<=65535?((l=r.allocUnsafe(3+f))[0]=218,l.writeUInt16BE(f,1),l.write(c,3)):((l=r.allocUnsafe(5+f))[0]=219,l.writeUInt32BE(f,1),l.write(c,5));else if(c&&(c.readUInt32LE||c instanceof Uint8Array))c instanceof Uint8Array&&(c=r.from(c)),c.length<=255?((l=r.allocUnsafe(2))[0]=196,l[1]=c.length):c.length<=65535?((l=r.allocUnsafe(3))[0]=197,l.writeUInt16BE(c.length,1)):((l=r.allocUnsafe(5))[0]=198,l.writeUInt32BE(c.length,1)),l=o([l,c]);else if(Array.isArray(c))c.length<16?(l=r.allocUnsafe(1))[0]=144|c.length:c.length<65536?((l=r.allocUnsafe(3))[0]=220,l.writeUInt16BE(c.length,1)):((l=r.allocUnsafe(5))[0]=221,l.writeUInt32BE(c.length,1)),l=c.reduce((function(e,t){return e.append(s(t,!0)),e}),o().append(l));else{if(!a&&"function"==typeof c.getDate)return function(e){var t,n=1*e,i=Math.floor(n/1e3),a=1e6*(n-1e3*i);if(a||i>4294967295){(t=new r(10))[0]=215,t[1]=-1;var s=4*a,c=i/Math.pow(2,32),u=s+c&4294967295,l=4294967295&i;t.writeInt32BE(u,2),t.writeInt32BE(l,6)}else(t=new r(6))[0]=214,t[1]=-1,t.writeUInt32BE(Math.floor(n/1e3),2);return o().append(t)}(c);if("object"==typeof c)l=function(t){var n,i,a,s=[];for(n=0;n>8),s.push(255&a)):(s.push(201),s.push(a>>24),s.push(a>>16&255),s.push(a>>8&255),s.push(255&a));return o().append(r.from(s)).append(i)}(c)||function(e){var t,n,i=[],a=0;for(t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&"function"!=typeof e[t]&&(++a,i.push(s(t,!0)),i.push(s(e[t],!0)));a<16?(n=r.allocUnsafe(1))[0]=128|a:((n=r.allocUnsafe(3))[0]=222,n.writeUInt16BE(a,1));return i.unshift(n),i.reduce((function(e,t){return e.append(t)}),o())}(c);else if("number"==typeof c){if((h=c)!==Math.floor(h))return i(c,t);if(c>=0)if(c<128)(l=r.allocUnsafe(1))[0]=c;else if(c<256)(l=r.allocUnsafe(2))[0]=204,l[1]=c;else if(c<65536)(l=r.allocUnsafe(3))[0]=205,l.writeUInt16BE(c,1);else if(c<=4294967295)(l=r.allocUnsafe(5))[0]=206,l.writeUInt32BE(c,1);else{if(!(c<=9007199254740991))return i(c,!0);(l=r.allocUnsafe(9))[0]=207,function(e,t){for(var n=7;n>=0;n--)e[n+1]=255&t,t/=256}(l,c)}else if(c>=-32)(l=r.allocUnsafe(1))[0]=256+c;else if(c>=-128)(l=r.allocUnsafe(2))[0]=208,l.writeInt8(c,1);else if(c>=-32768)(l=r.allocUnsafe(3))[0]=209,l.writeInt16BE(c,1);else if(c>-214748365)(l=r.allocUnsafe(5))[0]=210,l.writeInt32BE(c,1);else{if(!(c>=-9007199254740991))return i(c,!0);(l=r.allocUnsafe(9))[0]=211,function(e,t,n){var r=n<0;r&&(n=Math.abs(n));var o=n%4294967296,i=n/4294967296;if(e.writeUInt32BE(Math.floor(i),t+0),e.writeUInt32BE(o,t+4),r)for(var a=1,s=t+7;s>=t;s--){var c=(255^e[s])+a;e[s]=255&c,a=c>>8}}(l,1,c)}}}if(!l)throw new Error("not implemented yet");return u?l:l.slice()}return s}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]this.nextBatchId?this.fatalError?(this.logger.log(s.LogLevel.Debug,"Received a new batch "+e+" but errored out on a previous batch "+(this.nextBatchId-1)),[4,n.send("OnRenderCompleted",this.nextBatchId-1,this.fatalError.toString())]):[3,4]:[3,5];case 3:return o.sent(),[2];case 4:return this.logger.log(s.LogLevel.Debug,"Waiting for batch "+this.nextBatchId+". Batch "+e+" not processed."),[2];case 5:return o.trys.push([5,7,,8]),this.nextBatchId++,this.logger.log(s.LogLevel.Debug,"Applying batch "+e+"."),i.renderBatch(this.browserRendererId,new a.OutOfProcessRenderBatch(t)),[4,this.completeBatch(n,e)];case 6:return o.sent(),[3,8];case 7:throw r=o.sent(),this.fatalError=r.toString(),this.logger.log(s.LogLevel.Error,"There was an error applying batch "+e+"."),n.send("OnRenderCompleted",e,r.toString()),r;case 8:return[2]}}))}))},e.prototype.getLastBatchid=function(){return this.nextBatchId-1},e.prototype.completeBatch=function(e,t){return r(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e.send("OnRenderCompleted",t,null)];case 1:return n.sent(),[3,3];case 2:return n.sent(),this.logger.log(s.LogLevel.Warning,"Failed to deliver completion notification for render '"+t+"'."),[3,3];case 3:return[2]}}))}))},e}();t.RenderQueue=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(35),o=n(34),i=function(){function e(e){this.batchData=e;var t=new u(e);this.arrayRangeReader=new l(e),this.arrayBuilderSegmentReader=new f(e),this.diffReader=new a(e),this.editReader=new s(e,t),this.frameReader=new c(e,t)}return e.prototype.updatedComponents=function(){return o.readInt32LE(this.batchData,this.batchData.length-20)},e.prototype.referenceFrames=function(){return o.readInt32LE(this.batchData,this.batchData.length-16)},e.prototype.disposedComponentIds=function(){return o.readInt32LE(this.batchData,this.batchData.length-12)},e.prototype.disposedEventHandlerIds=function(){return o.readInt32LE(this.batchData,this.batchData.length-8)},e.prototype.updatedComponentsEntry=function(e,t){var n=e+4*t;return o.readInt32LE(this.batchData,n)},e.prototype.referenceFramesEntry=function(e,t){return e+20*t},e.prototype.disposedComponentIdsEntry=function(e,t){var n=e+4*t;return o.readInt32LE(this.batchData,n)},e.prototype.disposedEventHandlerIdsEntry=function(e,t){var n=e+8*t;return o.readUint64LE(this.batchData,n)},e}();t.OutOfProcessRenderBatch=i;var a=function(){function e(e){this.batchDataUint8=e}return e.prototype.componentId=function(e){return o.readInt32LE(this.batchDataUint8,e)},e.prototype.edits=function(e){return e+4},e.prototype.editsEntry=function(e,t){return e+16*t},e}(),s=function(){function e(e,t){this.batchDataUint8=e,this.stringReader=t}return e.prototype.editType=function(e){return o.readInt32LE(this.batchDataUint8,e)},e.prototype.siblingIndex=function(e){return o.readInt32LE(this.batchDataUint8,e+4)},e.prototype.newTreeIndex=function(e){return o.readInt32LE(this.batchDataUint8,e+8)},e.prototype.moveToSiblingIndex=function(e){return o.readInt32LE(this.batchDataUint8,e+8)},e.prototype.removedAttributeName=function(e){var t=o.readInt32LE(this.batchDataUint8,e+12);return this.stringReader.readString(t)},e}(),c=function(){function e(e,t){this.batchDataUint8=e,this.stringReader=t}return e.prototype.frameType=function(e){return o.readInt32LE(this.batchDataUint8,e)},e.prototype.subtreeLength=function(e){return o.readInt32LE(this.batchDataUint8,e+4)},e.prototype.elementReferenceCaptureId=function(e){var t=o.readInt32LE(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.componentId=function(e){return o.readInt32LE(this.batchDataUint8,e+8)},e.prototype.elementName=function(e){var t=o.readInt32LE(this.batchDataUint8,e+8);return this.stringReader.readString(t)},e.prototype.textContent=function(e){var t=o.readInt32LE(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.markupContent=function(e){var t=o.readInt32LE(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.attributeName=function(e){var t=o.readInt32LE(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.attributeValue=function(e){var t=o.readInt32LE(this.batchDataUint8,e+8);return this.stringReader.readString(t)},e.prototype.attributeEventHandlerId=function(e){return o.readUint64LE(this.batchDataUint8,e+12)},e}(),u=function(){function e(e){this.batchDataUint8=e,this.stringTableStartIndex=o.readInt32LE(e,e.length-4)}return e.prototype.readString=function(e){if(-1===e)return null;var t=o.readInt32LE(this.batchDataUint8,this.stringTableStartIndex+4*e),n=o.readLEB128(this.batchDataUint8,t),i=t+o.numLEB128Bytes(n),a=new Uint8Array(this.batchDataUint8.buffer,this.batchDataUint8.byteOffset+i,n);return r.decodeUtf8(a)},e}(),l=function(){function e(e){this.batchDataUint8=e}return e.prototype.count=function(e){return o.readInt32LE(this.batchDataUint8,e)},e.prototype.values=function(e){return e+4},e}(),f=function(){function e(e){this.batchDataUint8=e}return e.prototype.offset=function(e){return 0},e.prototype.count=function(e){return o.readInt32LE(this.batchDataUint8,e)},e.prototype.values=function(e){return e+4},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(17),o=function(){function e(){}return e.prototype.log=function(e,t){},e.instance=new e,e}();t.NullLogger=o;var i=function(){function e(e){this.minimumLogLevel=e}return e.prototype.log=function(e,t){if(e>=this.minimumLogLevel)switch(e){case r.LogLevel.Critical:case r.LogLevel.Error:console.error("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t);break;case r.LogLevel.Warning:console.warn("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t);break;case r.LogLevel.Information:console.info("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t);break;default:console.log("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t)}},e}();t.ConsoleLogger=i},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]reloading the page if you're unable to reconnect.",this.message.querySelector("a").addEventListener("click",(function(){return location.reload()}))},e.prototype.rejected=function(){this.button.style.display="none",this.reloadParagraph.style.display="none",this.message.innerHTML="Could not reconnect to the server. Reload the page to restore functionality.",this.message.querySelector("a").addEventListener("click",(function(){return location.reload()}))},e}();t.DefaultReconnectDisplay=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.dialog=e}return e.prototype.show=function(){this.removeClasses(),this.dialog.classList.add(e.ShowClassName)},e.prototype.hide=function(){this.removeClasses(),this.dialog.classList.add(e.HideClassName)},e.prototype.failed=function(){this.removeClasses(),this.dialog.classList.add(e.FailedClassName)},e.prototype.rejected=function(){this.removeClasses(),this.dialog.classList.add(e.RejectedClassName)},e.prototype.removeClasses=function(){this.dialog.classList.remove(e.ShowClassName,e.HideClassName,e.FailedClassName,e.RejectedClassName)},e.ShowClassName="components-reconnect-show",e.HideClassName="components-reconnect-hide",e.FailedClassName="components-reconnect-failed",e.RejectedClassName="components-reconnect-rejected",e}();t.UserSpecifiedDisplay=r},function(e,t,n){"use strict";n.r(t),n.d(t,"VERSION",(function(){return l})),n.d(t,"MessagePackHubProtocol",(function(){return u}));var r=n(11),o=n(12),i=n(2),a=function(){function e(){}return e.write=function(e){var t=e.byteLength||e.length,n=[];do{var r=127&t;(t>>=7)>0&&(r|=128),n.push(r)}while(t>0);t=e.byteLength||e.length;var o=new Uint8Array(n.length+t);return o.set(n,0),o.set(e,n.length),o.buffer},e.parse=function(e){for(var t=[],n=new Uint8Array(e),r=[0,7,14,21,28],o=0;o7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=o+i+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+i,o+i+a):n.subarray(o+i,o+i+a)),o=o+i+a}return t},e}();var s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=3?e[2]:void 0,error:e[1],type:i.MessageType.Close}},e.prototype.createPingMessage=function(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:i.MessageType.Ping}},e.prototype.createInvocationMessage=function(e,t){if(t.length<5)throw new Error("Invalid payload for Invocation message.");var n=t[2];return n?{arguments:t[4],headers:e,invocationId:n,streamIds:[],target:t[3],type:i.MessageType.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:i.MessageType.Invocation}},e.prototype.createStreamItemMessage=function(e,t){if(t.length<4)throw new Error("Invalid payload for StreamItem message.");return{headers:e,invocationId:t[2],item:t[3],type:i.MessageType.StreamItem}},e.prototype.createCompletionMessage=function(e,t){if(t.length<4)throw new Error("Invalid payload for Completion message.");var n,r,o=t[3];if(o!==this.voidResult&&t.length<5)throw new Error("Invalid payload for Completion message.");switch(o){case this.errorResult:n=t[4];break;case this.nonVoidResult:r=t[4]}return{error:n,headers:e,invocationId:t[2],result:r,type:i.MessageType.Completion}},e.prototype.writeInvocation=function(e){var t,n=o(this.messagePackOptions);return t=e.streamIds?n.encode([i.MessageType.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):n.encode([i.MessageType.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),a.write(t.slice())},e.prototype.writeStreamInvocation=function(e){var t,n=o(this.messagePackOptions);return t=e.streamIds?n.encode([i.MessageType.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):n.encode([i.MessageType.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),a.write(t.slice())},e.prototype.writeStreamItem=function(e){var t=o(this.messagePackOptions).encode([i.MessageType.StreamItem,e.headers||{},e.invocationId,e.item]);return a.write(t.slice())},e.prototype.writeCompletion=function(e){var t,n=o(this.messagePackOptions),r=e.error?this.errorResult:e.result?this.nonVoidResult:this.voidResult;switch(r){case this.errorResult:t=n.encode([i.MessageType.Completion,e.headers||{},e.invocationId,r,e.error]);break;case this.voidResult:t=n.encode([i.MessageType.Completion,e.headers||{},e.invocationId,r]);break;case this.nonVoidResult:t=n.encode([i.MessageType.Completion,e.headers||{},e.invocationId,r,e.result])}return a.write(t.slice())},e.prototype.writeCancelInvocation=function(e){var t=o(this.messagePackOptions).encode([i.MessageType.CancelInvocation,e.headers||{},e.invocationId]);return a.write(t.slice())},e.prototype.readHeaders=function(e){var t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t},e}(),l="0.0.0-DEV_BUILD"}]); \ No newline at end of file +*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,s,c=a(e),u=1;u0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,o,i=r.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,n=i,o=s,t.copy(n,o),s+=a.data.length,a=a.next;return i},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){var r=n(10),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=a),a.prototype=Object.create(o.prototype),i(o,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(67),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(8))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o,i,a,s,c=1,u={},l=!1,f=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){d(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){d(e.data)},r=function(e){i.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(o=f.documentElement,r=function(e){var t=f.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):r=function(e){setTimeout(d,0,e)}:(a="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&d(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),r=function(t){e.postMessage(a+t,"*")}),h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n0?this._transform(null,t,n):n()},e.exports.decoder=c,e.exports.encoder=s},function(e,t,n){(t=e.exports=n(36)).Stream=t,t.Readable=t,t.Writable=n(41),t.Duplex=n(9),t.Transform=n(42),t.PassThrough=n(71)},function(e,t,n){"use strict";e.exports=i;var r=n(42),o=n(19);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}o.inherits=n(15),o.inherits(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){var r=n(20);function o(e){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e||"unable to decode"}n(35).inherits(o,Error),e.exports=function(e){return function(e){e instanceof r||(e=r().append(e));var t=i(e);if(t)return e.consume(t.bytesConsumed),t.value;throw new o};function t(e,t,n){return t>=n+e}function n(e,t){return{value:e,bytesConsumed:t}}function i(e,r){r=void 0===r?0:r;var o=e.length-r;if(o<=0)return null;var i,l,f,h=e.readUInt8(r),p=0;if(!function(e,t){var n=function(e){switch(e){case 196:return 2;case 197:return 3;case 198:return 5;case 199:return 3;case 200:return 4;case 201:return 6;case 202:return 5;case 203:return 9;case 204:return 2;case 205:return 3;case 206:return 5;case 207:return 9;case 208:return 2;case 209:return 3;case 210:return 5;case 211:return 9;case 212:return 3;case 213:return 4;case 214:return 6;case 215:return 10;case 216:return 18;case 217:return 2;case 218:return 3;case 219:return 5;case 222:return 3;default:return-1}}(e);return!(-1!==n&&t=0;f--)p+=e.readUInt8(r+f+1)*Math.pow(2,8*(7-f));return n(p,9);case 208:return n(p=e.readInt8(r+1),2);case 209:return n(p=e.readInt16BE(r+1),3);case 210:return n(p=e.readInt32BE(r+1),5);case 211:return n(p=function(e,t){var n=128==(128&e[t]);if(n)for(var r=1,o=t+7;o>=t;o--){var i=(255^e[o])+r;e[o]=255&i,r=i>>8}var a=e.readUInt32BE(t+0),s=e.readUInt32BE(t+4);return(4294967296*a+s)*(n?-1:1)}(e.slice(r+1,r+9),0),9);case 202:return n(p=e.readFloatBE(r+1),5);case 203:return n(p=e.readDoubleBE(r+1),9);case 217:return t(i=e.readUInt8(r+1),o,2)?n(p=e.toString("utf8",r+2,r+2+i),2+i):null;case 218:return t(i=e.readUInt16BE(r+1),o,3)?n(p=e.toString("utf8",r+3,r+3+i),3+i):null;case 219:return t(i=e.readUInt32BE(r+1),o,5)?n(p=e.toString("utf8",r+5,r+5+i),5+i):null;case 196:return t(i=e.readUInt8(r+1),o,2)?n(p=e.slice(r+2,r+2+i),2+i):null;case 197:return t(i=e.readUInt16BE(r+1),o,3)?n(p=e.slice(r+3,r+3+i),3+i):null;case 198:return t(i=e.readUInt32BE(r+1),o,5)?n(p=e.slice(r+5,r+5+i),5+i):null;case 220:return o<3?null:(i=e.readUInt16BE(r+1),a(e,r,i,3));case 221:return o<5?null:(i=e.readUInt32BE(r+1),a(e,r,i,5));case 222:return i=e.readUInt16BE(r+1),s(e,r,i,3);case 223:throw new Error("map too big to decode in JS");case 212:return c(e,r,1);case 213:return c(e,r,2);case 214:return c(e,r,4);case 215:return c(e,r,8);case 216:return c(e,r,16);case 199:return i=e.readUInt8(r+1),l=e.readUInt8(r+2),t(i,o,3)?u(e,r,l,i,3):null;case 200:return i=e.readUInt16BE(r+1),l=e.readUInt8(r+3),t(i,o,4)?u(e,r,l,i,4):null;case 201:return i=e.readUInt32BE(r+1),l=e.readUInt8(r+5),t(i,o,6)?u(e,r,l,i,6):null}if(144==(240&h))return a(e,r,i=15&h,1);if(128==(240&h))return s(e,r,i=15&h,1);if(160==(224&h))return t(i=31&h,o,1)?n(p=e.toString("utf8",r+1,r+i+1),i+1):null;if(h>=224)return n(p=h-256,1);if(h<128)return n(h,1);throw new Error("not implemented yet")}function a(e,t,r,o){var a,s=[],c=0;for(t+=o,a=0;a.1)&&((n=r.allocUnsafe(9))[0]=203,n.writeDoubleBE(e,1)),n}e.exports=function(e,t,n,a){function s(c,u){var l,f,h;if(void 0===c)throw new Error("undefined is not encodable in msgpack!");if(null===c)(l=r.allocUnsafe(1))[0]=192;else if(!0===c)(l=r.allocUnsafe(1))[0]=195;else if(!1===c)(l=r.allocUnsafe(1))[0]=194;else if("string"==typeof c)(f=r.byteLength(c))<32?((l=r.allocUnsafe(1+f))[0]=160|f,f>0&&l.write(c,1)):f<=255&&!n?((l=r.allocUnsafe(2+f))[0]=217,l[1]=f,l.write(c,2)):f<=65535?((l=r.allocUnsafe(3+f))[0]=218,l.writeUInt16BE(f,1),l.write(c,3)):((l=r.allocUnsafe(5+f))[0]=219,l.writeUInt32BE(f,1),l.write(c,5));else if(c&&(c.readUInt32LE||c instanceof Uint8Array))c instanceof Uint8Array&&(c=r.from(c)),c.length<=255?((l=r.allocUnsafe(2))[0]=196,l[1]=c.length):c.length<=65535?((l=r.allocUnsafe(3))[0]=197,l.writeUInt16BE(c.length,1)):((l=r.allocUnsafe(5))[0]=198,l.writeUInt32BE(c.length,1)),l=o([l,c]);else if(Array.isArray(c))c.length<16?(l=r.allocUnsafe(1))[0]=144|c.length:c.length<65536?((l=r.allocUnsafe(3))[0]=220,l.writeUInt16BE(c.length,1)):((l=r.allocUnsafe(5))[0]=221,l.writeUInt32BE(c.length,1)),l=c.reduce((function(e,t){return e.append(s(t,!0)),e}),o().append(l));else{if(!a&&"function"==typeof c.getDate)return function(e){var t,n=1*e,i=Math.floor(n/1e3),a=1e6*(n-1e3*i);if(a||i>4294967295){(t=new r(10))[0]=215,t[1]=-1;var s=4*a,c=i/Math.pow(2,32),u=s+c&4294967295,l=4294967295&i;t.writeInt32BE(u,2),t.writeInt32BE(l,6)}else(t=new r(6))[0]=214,t[1]=-1,t.writeUInt32BE(Math.floor(n/1e3),2);return o().append(t)}(c);if("object"==typeof c)l=function(t){var n,i,a,s=[];for(n=0;n>8),s.push(255&a)):(s.push(201),s.push(a>>24),s.push(a>>16&255),s.push(a>>8&255),s.push(255&a));return o().append(r.from(s)).append(i)}(c)||function(e){var t,n,i=[],a=0;for(t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&"function"!=typeof e[t]&&(++a,i.push(s(t,!0)),i.push(s(e[t],!0)));a<16?(n=r.allocUnsafe(1))[0]=128|a:((n=r.allocUnsafe(3))[0]=222,n.writeUInt16BE(a,1));return i.unshift(n),i.reduce((function(e,t){return e.append(t)}),o())}(c);else if("number"==typeof c){if((h=c)!==Math.floor(h))return i(c,t);if(c>=0)if(c<128)(l=r.allocUnsafe(1))[0]=c;else if(c<256)(l=r.allocUnsafe(2))[0]=204,l[1]=c;else if(c<65536)(l=r.allocUnsafe(3))[0]=205,l.writeUInt16BE(c,1);else if(c<=4294967295)(l=r.allocUnsafe(5))[0]=206,l.writeUInt32BE(c,1);else{if(!(c<=9007199254740991))return i(c,!0);(l=r.allocUnsafe(9))[0]=207,function(e,t){for(var n=7;n>=0;n--)e[n+1]=255&t,t/=256}(l,c)}else if(c>=-32)(l=r.allocUnsafe(1))[0]=256+c;else if(c>=-128)(l=r.allocUnsafe(2))[0]=208,l.writeInt8(c,1);else if(c>=-32768)(l=r.allocUnsafe(3))[0]=209,l.writeInt16BE(c,1);else if(c>-214748365)(l=r.allocUnsafe(5))[0]=210,l.writeInt32BE(c,1);else{if(!(c>=-9007199254740991))return i(c,!0);(l=r.allocUnsafe(9))[0]=211,function(e,t,n){var r=n<0;r&&(n=Math.abs(n));var o=n%4294967296,i=n/4294967296;if(e.writeUInt32BE(Math.floor(i),t+0),e.writeUInt32BE(o,t+4),r)for(var a=1,s=t+7;s>=t;s--){var c=(255^e[s])+a;e[s]=255&c,a=c>>8}}(l,1,c)}}}if(!l)throw new Error("not implemented yet");return u?l:l.slice()}return s}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]this.nextBatchId?this.fatalError?(this.logger.log(s.LogLevel.Debug,"Received a new batch "+e+" but errored out on a previous batch "+(this.nextBatchId-1)),[4,n.send("OnRenderCompleted",this.nextBatchId-1,this.fatalError.toString())]):[3,4]:[3,5];case 3:return o.sent(),[2];case 4:return this.logger.log(s.LogLevel.Debug,"Waiting for batch "+this.nextBatchId+". Batch "+e+" not processed."),[2];case 5:return o.trys.push([5,7,,8]),this.nextBatchId++,this.logger.log(s.LogLevel.Debug,"Applying batch "+e+"."),i.renderBatch(this.browserRendererId,new a.OutOfProcessRenderBatch(t)),[4,this.completeBatch(n,e)];case 6:return o.sent(),[3,8];case 7:throw r=o.sent(),this.fatalError=r.toString(),this.logger.log(s.LogLevel.Error,"There was an error applying batch "+e+"."),n.send("OnRenderCompleted",e,r.toString()),r;case 8:return[2]}}))}))},e.prototype.getLastBatchid=function(){return this.nextBatchId-1},e.prototype.completeBatch=function(e,t){return r(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e.send("OnRenderCompleted",t,null)];case 1:return n.sent(),[3,3];case 2:return n.sent(),this.logger.log(s.LogLevel.Warning,"Failed to deliver completion notification for render '"+t+"'."),[3,3];case 3:return[2]}}))}))},e}();t.RenderQueue=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(33),o=n(32),i=function(){function e(e){this.batchData=e;var t=new u(e);this.arrayRangeReader=new l(e),this.arrayBuilderSegmentReader=new f(e),this.diffReader=new a(e),this.editReader=new s(e,t),this.frameReader=new c(e,t)}return e.prototype.updatedComponents=function(){return o.readInt32LE(this.batchData,this.batchData.length-20)},e.prototype.referenceFrames=function(){return o.readInt32LE(this.batchData,this.batchData.length-16)},e.prototype.disposedComponentIds=function(){return o.readInt32LE(this.batchData,this.batchData.length-12)},e.prototype.disposedEventHandlerIds=function(){return o.readInt32LE(this.batchData,this.batchData.length-8)},e.prototype.updatedComponentsEntry=function(e,t){var n=e+4*t;return o.readInt32LE(this.batchData,n)},e.prototype.referenceFramesEntry=function(e,t){return e+20*t},e.prototype.disposedComponentIdsEntry=function(e,t){var n=e+4*t;return o.readInt32LE(this.batchData,n)},e.prototype.disposedEventHandlerIdsEntry=function(e,t){var n=e+8*t;return o.readUint64LE(this.batchData,n)},e}();t.OutOfProcessRenderBatch=i;var a=function(){function e(e){this.batchDataUint8=e}return e.prototype.componentId=function(e){return o.readInt32LE(this.batchDataUint8,e)},e.prototype.edits=function(e){return e+4},e.prototype.editsEntry=function(e,t){return e+16*t},e}(),s=function(){function e(e,t){this.batchDataUint8=e,this.stringReader=t}return e.prototype.editType=function(e){return o.readInt32LE(this.batchDataUint8,e)},e.prototype.siblingIndex=function(e){return o.readInt32LE(this.batchDataUint8,e+4)},e.prototype.newTreeIndex=function(e){return o.readInt32LE(this.batchDataUint8,e+8)},e.prototype.moveToSiblingIndex=function(e){return o.readInt32LE(this.batchDataUint8,e+8)},e.prototype.removedAttributeName=function(e){var t=o.readInt32LE(this.batchDataUint8,e+12);return this.stringReader.readString(t)},e}(),c=function(){function e(e,t){this.batchDataUint8=e,this.stringReader=t}return e.prototype.frameType=function(e){return o.readInt32LE(this.batchDataUint8,e)},e.prototype.subtreeLength=function(e){return o.readInt32LE(this.batchDataUint8,e+4)},e.prototype.elementReferenceCaptureId=function(e){var t=o.readInt32LE(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.componentId=function(e){return o.readInt32LE(this.batchDataUint8,e+8)},e.prototype.elementName=function(e){var t=o.readInt32LE(this.batchDataUint8,e+8);return this.stringReader.readString(t)},e.prototype.textContent=function(e){var t=o.readInt32LE(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.markupContent=function(e){var t=o.readInt32LE(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.attributeName=function(e){var t=o.readInt32LE(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.attributeValue=function(e){var t=o.readInt32LE(this.batchDataUint8,e+8);return this.stringReader.readString(t)},e.prototype.attributeEventHandlerId=function(e){return o.readUint64LE(this.batchDataUint8,e+12)},e}(),u=function(){function e(e){this.batchDataUint8=e,this.stringTableStartIndex=o.readInt32LE(e,e.length-4)}return e.prototype.readString=function(e){if(-1===e)return null;var t=o.readInt32LE(this.batchDataUint8,this.stringTableStartIndex+4*e),n=o.readLEB128(this.batchDataUint8,t),i=t+o.numLEB128Bytes(n),a=new Uint8Array(this.batchDataUint8.buffer,this.batchDataUint8.byteOffset+i,n);return r.decodeUtf8(a)},e}(),l=function(){function e(e){this.batchDataUint8=e}return e.prototype.count=function(e){return o.readInt32LE(this.batchDataUint8,e)},e.prototype.values=function(e){return e+4},e}(),f=function(){function e(e){this.batchDataUint8=e}return e.prototype.offset=function(e){return 0},e.prototype.count=function(e){return o.readInt32LE(this.batchDataUint8,e)},e.prototype.values=function(e){return e+4},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(16),o=function(){function e(){}return e.prototype.log=function(e,t){},e.instance=new e,e}();t.NullLogger=o;var i=function(){function e(e){this.minimumLogLevel=e}return e.prototype.log=function(e,t){if(e>=this.minimumLogLevel)switch(e){case r.LogLevel.Critical:case r.LogLevel.Error:console.error("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t);break;case r.LogLevel.Warning:console.warn("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t);break;case r.LogLevel.Information:console.info("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t);break;default:console.log("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t)}},e}();t.ConsoleLogger=i},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]reloading the page if you're unable to reconnect.",this.message.querySelector("a").addEventListener("click",(function(){return location.reload()}))},e.prototype.rejected=function(){this.button.style.display="none",this.reloadParagraph.style.display="none",this.message.innerHTML="Could not reconnect to the server. Reload the page to restore functionality.",this.message.querySelector("a").addEventListener("click",(function(){return location.reload()}))},e}();t.DefaultReconnectDisplay=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.dialog=e}return e.prototype.show=function(){this.removeClasses(),this.dialog.classList.add(e.ShowClassName)},e.prototype.hide=function(){this.removeClasses(),this.dialog.classList.add(e.HideClassName)},e.prototype.failed=function(){this.removeClasses(),this.dialog.classList.add(e.FailedClassName)},e.prototype.rejected=function(){this.removeClasses(),this.dialog.classList.add(e.RejectedClassName)},e.prototype.removeClasses=function(){this.dialog.classList.remove(e.ShowClassName,e.HideClassName,e.FailedClassName,e.RejectedClassName)},e.ShowClassName="components-reconnect-show",e.HideClassName="components-reconnect-hide",e.FailedClassName="components-reconnect-failed",e.RejectedClassName="components-reconnect-rejected",e}();t.UserSpecifiedDisplay=r},function(e,t,n){"use strict";n.r(t),n.d(t,"VERSION",(function(){return l})),n.d(t,"MessagePackHubProtocol",(function(){return u}));var r=n(10),o=n(11),i=n(2),a=function(){function e(){}return e.write=function(e){var t=e.byteLength||e.length,n=[];do{var r=127&t;(t>>=7)>0&&(r|=128),n.push(r)}while(t>0);t=e.byteLength||e.length;var o=new Uint8Array(n.length+t);return o.set(n,0),o.set(e,n.length),o.buffer},e.parse=function(e){for(var t=[],n=new Uint8Array(e),r=[0,7,14,21,28],o=0;o7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=o+i+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+i,o+i+a):n.subarray(o+i,o+i+a)),o=o+i+a}return t},e}();var s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=3?e[2]:void 0,error:e[1],type:i.MessageType.Close}},e.prototype.createPingMessage=function(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:i.MessageType.Ping}},e.prototype.createInvocationMessage=function(e,t){if(t.length<5)throw new Error("Invalid payload for Invocation message.");var n=t[2];return n?{arguments:t[4],headers:e,invocationId:n,streamIds:[],target:t[3],type:i.MessageType.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:i.MessageType.Invocation}},e.prototype.createStreamItemMessage=function(e,t){if(t.length<4)throw new Error("Invalid payload for StreamItem message.");return{headers:e,invocationId:t[2],item:t[3],type:i.MessageType.StreamItem}},e.prototype.createCompletionMessage=function(e,t){if(t.length<4)throw new Error("Invalid payload for Completion message.");var n,r,o=t[3];if(o!==this.voidResult&&t.length<5)throw new Error("Invalid payload for Completion message.");switch(o){case this.errorResult:n=t[4];break;case this.nonVoidResult:r=t[4]}return{error:n,headers:e,invocationId:t[2],result:r,type:i.MessageType.Completion}},e.prototype.writeInvocation=function(e){var t,n=o(this.messagePackOptions);return t=e.streamIds?n.encode([i.MessageType.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):n.encode([i.MessageType.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),a.write(t.slice())},e.prototype.writeStreamInvocation=function(e){var t,n=o(this.messagePackOptions);return t=e.streamIds?n.encode([i.MessageType.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):n.encode([i.MessageType.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),a.write(t.slice())},e.prototype.writeStreamItem=function(e){var t=o(this.messagePackOptions).encode([i.MessageType.StreamItem,e.headers||{},e.invocationId,e.item]);return a.write(t.slice())},e.prototype.writeCompletion=function(e){var t,n=o(this.messagePackOptions),r=e.error?this.errorResult:e.result?this.nonVoidResult:this.voidResult;switch(r){case this.errorResult:t=n.encode([i.MessageType.Completion,e.headers||{},e.invocationId,r,e.error]);break;case this.voidResult:t=n.encode([i.MessageType.Completion,e.headers||{},e.invocationId,r]);break;case this.nonVoidResult:t=n.encode([i.MessageType.Completion,e.headers||{},e.invocationId,r,e.result])}return a.write(t.slice())},e.prototype.writeCancelInvocation=function(e){var t=o(this.messagePackOptions).encode([i.MessageType.CancelInvocation,e.headers||{},e.invocationId]);return a.write(t.slice())},e.prototype.readHeaders=function(e){var t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t},e}(),l="5.0.0-dev"}]); \ No newline at end of file diff --git a/src/Components/Web.JS/dist/Release/blazor.webassembly.js b/src/Components/Web.JS/dist/Release/blazor.webassembly.js index c26bbb9fa2fb..15031bc249a4 100644 --- a/src/Components/Web.JS/dist/Release/blazor.webassembly.js +++ b/src/Components/Web.JS/dist/Release/blazor.webassembly.js @@ -1 +1 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=46)}([,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){window.DotNet=e;var t=[],n={},r={},o=1,i=null;function a(e){t.push(e)}function s(e,t,n,r){var o=l();if(o.invokeDotNetFromJS){var i=JSON.stringify(r,m),a=o.invokeDotNetFromJS(e,t,n,i);return a?f(a):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeMethodAsync instead.")}function u(e,t,r,i){if(e&&r)throw new Error("For instance method calls, assemblyName should be null. Received '"+e+"'.");var a=o++,s=new Promise((function(e,t){n[a]={resolve:e,reject:t}}));try{var u=JSON.stringify(i,m);l().beginInvokeDotNetFromJS(a,e,t,r,u)}catch(e){c(a,!1,e)}return s}function l(){if(null!==i)return i;throw new Error("No .NET call dispatcher has been set.")}function c(e,t,r){if(!n.hasOwnProperty(e))throw new Error("There is no pending async call with ID "+e+".");var o=n[e];delete n[e],t?o.resolve(r):o.reject(r)}function f(e){return e?JSON.parse(e,(function(e,n){return t.reduce((function(t,n){return n(e,t)}),n)})):null}function d(e){return e instanceof Error?e.message+"\n"+e.stack:e?e.toString():"null"}function p(e){if(Object.prototype.hasOwnProperty.call(r,e))return r[e];var t,n=window,o="window";if(e.split(".").forEach((function(e){if(!(e in n))throw new Error("Could not find '"+e+"' in '"+o+"'.");t=n,n=n[e],o+="."+e})),n instanceof Function)return n=n.bind(t),r[e]=n,n;throw new Error("The value '"+o+"' is not a function.")}e.attachDispatcher=function(e){i=e},e.attachReviver=a,e.invokeMethod=function(e,t){for(var n=[],r=2;r0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return r in e||(e[r]=[]),e}function s(e,t,n){var i=e;if(e instanceof Comment&&(l(i)&&l(i).length>0))throw new Error("Not implemented: inserting non-empty logical container");if(u(i))throw new Error("Not implemented: moving existing logical children");var a=l(t);if(n0;)e(r,0)}var i=r;i.parentNode.removeChild(i)},t.getLogicalParent=u,t.getLogicalSiblingEnd=function(e){return e[i]||null},t.getLogicalChild=function(e,t){return l(e)[t]},t.isSvgElement=function(e){return"http://www.w3.org/2000/svg"===c(e).namespaceURI},t.getLogicalChildrenArray=l,t.permuteLogicalChildren=function(e,t){var n=l(e);t.forEach((function(e){e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=function e(t){if(t instanceof Element)return t;var n=f(t);if(n)return n.previousSibling;var r=u(t);return r instanceof Element?r.lastChild:e(r)}(e.moveRangeStart)})),t.forEach((function(t){var r=t.moveToBeforeMarker=document.createComment("marker"),o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):d(r,e)})),t.forEach((function(e){for(var t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd,i=r;i;){var a=i.nextSibling;if(n.insertBefore(i,t),i===o)break;i=a}n.removeChild(t)})),t.forEach((function(e){n[e.toSiblingIndex]=e.moveRangeStart}))},t.getClosestDomElement=c},,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setPlatform=function(e){return t.platform=e,t.platform}},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.dispatchEvent=function(e,t){if(!r)throw new Error("eventDispatcher not initialized. Call 'setEventDispatcher' to configure it.");r(e,t)},t.setEventDispatcher=function(e){r=e}},,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(8),o=n(4),i=n(32),a=n(5);window.Blazor={navigateTo:r.navigateTo,_internal:{attachRootComponentToElement:o.attachRootComponentToElement,navigationManager:r.internalFunctions,domWrapper:i.domFunctions,setProfilingEnabled:a.setProfilingEnabled}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(26),o=n(27),i=n(13),a=n(30),s=n(19),u=n(8),l=n(5),c=document.createElement("template"),f=document.createElementNS("http://www.w3.org/2000/svg","g"),d={submit:!0},p={},h=function(){function e(e){var t=this;this.childComponentLocations={},this.browserRendererId=e,this.eventDelegator=new o.EventDelegator((function(e,n,r,o){!function(e,t,n,r,o){d[e.type]&&e.preventDefault();var i={browserRendererId:t,eventHandlerId:n,eventArgsType:r.type,eventFieldInfo:o};s.dispatchEvent(i,r.data)}(e,t.browserRendererId,n,r,o)})),u.attachToEventDelegator(this.eventDelegator)}return e.prototype.attachRootComponentToLogicalElement=function(e,t){this.attachComponentToElement(e,t),p[e]=t},e.prototype.updateComponent=function(e,t,n,r){l.profileStart("updateComponent");var o=this.childComponentLocations[t];if(!o)throw new Error("No element is currently associated with component "+t);var a=p[t];if(a){var s=i.getLogicalSiblingEnd(a);delete p[t],s?function(e,t){var n=i.getLogicalParent(e);if(!n)throw new Error("Can't clear between nodes. The start node does not have a logical parent.");for(var r=i.getLogicalChildrenArray(n),o=r.indexOf(e)+1,a=r.indexOf(t),s=o;s<=a;s++)i.removeLogicalChild(n,o);e.textContent="!"}(a,s):function(e){var t;for(;t=e.firstChild;)e.removeChild(t)}(a)}var u=i.getClosestDomElement(o).ownerDocument,c=u&&u.activeElement;this.applyEdits(e,t,o,0,n,r),c instanceof HTMLElement&&u&&u.activeElement!==c&&c.focus(),l.profileEnd("updateComponent")},e.prototype.disposeComponent=function(e){delete this.childComponentLocations[e]},e.prototype.disposeEventHandler=function(e){this.eventDelegator.removeListener(e)},e.prototype.attachComponentToElement=function(e,t){this.childComponentLocations[e]=t},e.prototype.applyEdits=function(e,t,n,o,a,s){for(var u,l=0,c=o,f=e.arrayBuilderSegmentReader,d=e.editReader,p=e.frameReader,h=f.values(a),m=f.offset(a),y=m+f.count(a),v=m;v0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]>>0)}t.readInt32LE=function(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24},t.readUint32LE=i,t.readUint64LE=function(e,t){var n=i(e,t+4);if(n>o)throw new Error("Cannot read uint64 with high order part "+n+", because the result would exceed Number.MAX_SAFE_INTEGER.");return n*r+i(e,t)},t.readLEB128=function(e,t){for(var n=0,r=0,o=0;o<4;o++){var i=e[t+o];if(n|=(127&i)<65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l)}r.length>1024&&(o.push(String.fromCharCode.apply(null,r)),r.length=0)}return o.push(String.fromCharCode.apply(null,r)),o.join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shouldAutoStart=function(){return!(!document||!document.currentScript||"false"===document.currentScript.getAttribute("autostart"))}},,,,,,,,,,function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var a=n(3);n(23);var s=n(18),u=n(47),l=n(4),c=n(50),f=n(36),d=n(19),p=n(51),h=n(52),m=n(53),y=n(5),v=!1;function b(e){return r(this,void 0,void 0,(function(){var t,n,f,b,g,w,E,_,C=this;return o(this,(function(I){switch(I.label){case 0:if(v)throw new Error("Blazor has already started.");return v=!0,d.setEventDispatcher((function(e,t){u.monoPlatform.invokeWhenHeapUnlocked((function(){return a.DotNet.invokeMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","DispatchEvent",e,JSON.stringify(t))}))})),t=s.setPlatform(u.monoPlatform),window.Blazor.platform=t,window.Blazor._internal.renderBatch=function(e,t){y.profileStart("renderBatch");var n=u.monoPlatform.beginHeapLock();try{l.renderBatch(e,new c.SharedMemoryRenderBatch(t))}finally{n.release()}y.profileEnd("renderBatch")},n=window.Blazor._internal.navigationManager.getBaseURI,f=window.Blazor._internal.navigationManager.getLocationHref,window.Blazor._internal.navigationManager.getUnmarshalledBaseURI=function(){return BINDING.js_string_to_mono_string(n())},window.Blazor._internal.navigationManager.getUnmarshalledLocationHref=function(){return BINDING.js_string_to_mono_string(f())},window.Blazor._internal.navigationManager.listenForNavigationEvents((function(e,t){return r(C,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,a.DotNet.invokeMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChanged",e,t)];case 1:return n.sent(),[2]}}))}))})),b=null==e?void 0:e.environment,[4,m.BootConfigResult.initAsync(b)];case 1:return g=I.sent(),[4,Promise.all([p.WebAssemblyResourceLoader.initAsync(g.bootConfig,e||{}),h.WebAssemblyConfigLoader.initAsync(g)])];case 2:w=i.apply(void 0,[I.sent(),1]),E=w[0],I.label=3;case 3:return I.trys.push([3,5,,6]),[4,t.start(E)];case 4:return I.sent(),[3,6];case 5:throw _=I.sent(),new Error("Failed to start platform. Reason: "+_);case 6:return t.callEntryPoint(E.bootConfig.entryAssembly),[2]}}))}))}window.Blazor.start=b,f.shouldAutoStart()&&b().catch((function(e){"undefined"!=typeof Module&&Module.printErr?Module.printErr(e):console.error(e)}))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]>2]}t.monoPlatform={start:function(e){return new Promise((function(t,n){var f,d;s.attachDebuggerHotkey(e),c.initializeProfiling((function(e){v("Microsoft.AspNetCore.Components","Microsoft.AspNetCore.Components.Profiling.WebAssemblyComponentsProfiling","SetCapturing")(e)})),window.Browser={init:function(){}},f=function(){window.Module=function(e,t,n){var c=this,f=e.bootConfig.resources,d=window.Module||{},p=["DEBUGGING ENABLED"];d.print=function(e){return p.indexOf(e)<0&&console.log(e)},d.printErr=function(e){console.error(e),u.showErrorNotification()},d.preRun=d.preRun||[],d.postRun=d.postRun||[],d.preloadPlugins=[];var h,y=e.loadResources(f.assembly,(function(e){return"_framework/"+e}),"assembly"),w=e.loadResources(f.pdb||{},(function(e){return"_framework/"+e}),"pdb"),E=e.loadResource("dotnet.wasm","_framework/dotnet.wasm",e.bootConfig.resources.runtime["dotnet.wasm"],"dotnetwasm");return e.bootConfig.resources.runtime.hasOwnProperty("dotnet.timezones.dat")&&(h=e.loadResource("dotnet.timezones.dat","_framework/dotnet.timezones.dat",e.bootConfig.resources.runtime["dotnet.timezones.dat"],"timezonedata")),d.instantiateWasm=function(e,t){return r(c,void 0,void 0,(function(){var n,r;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,E];case 1:return[4,b(o.sent(),e)];case 2:return n=o.sent(),[3,4];case 3:throw r=o.sent(),d.printErr(r),r;case 4:return t(n),[2]}}))})),[]},d.preRun.push((function(){i=cwrap("mono_wasm_add_assembly",null,["string","number","number"]),MONO.loaded_files=[],h&&function(e){r(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return t="blazor:timezonedata",addRunDependency(t),[4,e.response];case 1:return[4,r.sent().arrayBuffer()];case 2:return n=r.sent(),l.loadTimezoneData(n),removeRunDependency(t),[2]}}))}))}(h),y.forEach((function(e){return _(e,function(e,t){var n=e.lastIndexOf(".");if(n<0)throw new Error("No extension to replace in '"+e+"'");return e.substr(0,n)+t}(e.name,".dll"))})),w.forEach((function(e){return _(e,e.name)})),window.Blazor._internal.dotNetCriticalError=function(e){d.printErr(BINDING.conv_string(e)||"(null)")},window.Blazor._internal.getSatelliteAssemblies=function(t){var n=BINDING.mono_array_to_js_array(t),i=e.bootConfig.resources.satelliteResources;if(i){var a=Promise.all(n.filter((function(e){return i.hasOwnProperty(e)})).map((function(t){return e.loadResources(i[t],(function(e){return"_framework/"+e}),"assembly")})).reduce((function(e,t){return e.concat(t)}),new Array).map((function(e){return r(c,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,e.response];case 1:return[2,t.sent().arrayBuffer()]}}))}))})));return BINDING.js_to_mono_obj(a.then((function(e){return e.length&&(window.Blazor._internal.readSatelliteAssemblies=function(){for(var t=BINDING.mono_obj_array_new(e.length),n=0;n>1];var n},readInt32Field:function(e,t){return h(e+(t||0))},readUint64Field:function(e,t){return function(e){var t=e>>2,n=Module.HEAPU32[t+1];if(n>d)throw new Error("Cannot read uint64 with high order part "+n+", because the result would exceed Number.MAX_SAFE_INTEGER.");return n*f+Module.HEAPU32[t]}(e+(t||0))},readFloatField:function(e,t){return n=e+(t||0),Module.HEAPF32[n>>2];var n},readObjectField:function(e,t){return h(e+(t||0))},readStringField:function(e,t,n){var r,o=h(e+(t||0));if(0===o)return null;if(n){var i=BINDING.unbox_mono_obj(o);return"boolean"==typeof i?i?"":null:i}return p?void 0===(r=p.stringCache.get(o))&&(r=BINDING.conv_string(o),p.stringCache.set(o,r)):r=BINDING.conv_string(o),r},readStructField:function(e,t){return e+(t||0)},beginHeapLock:function(){return g(),p=new w},invokeWhenHeapUnlocked:function(e){p?p.enqueuePostReleaseAction(e):e()}};var m=document.createElement("a");function y(e){return e+12}function v(e,t,n){var r="["+e+"] "+t+":"+n;return BINDING.bind_static_method(r)}function b(e,t){return r(this,void 0,void 0,(function(){var n,r;return o(this,(function(o){switch(o.label){case 0:if("function"!=typeof WebAssembly.instantiateStreaming)return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,WebAssembly.instantiateStreaming(e.response,t)];case 2:return[2,o.sent().instance];case 3:return n=o.sent(),console.info("Streaming compilation failed. Falling back to ArrayBuffer instantiation. ",n),[3,4];case 4:return[4,e.response.then((function(e){return e.arrayBuffer()}))];case 5:return r=o.sent(),[4,WebAssembly.instantiate(r,t)];case 6:return[2,o.sent().instance]}}))}))}function g(){if(p)throw new Error("Assertion failed - heap is currently locked")}var w=function(){function e(){this.stringCache=new Map}return e.prototype.enqueuePostReleaseAction=function(e){this.postReleaseActions||(this.postReleaseActions=[]),this.postReleaseActions.push(e)},e.prototype.release=function(){var e;if(p!==this)throw new Error("Trying to release a lock which isn't current");for(p=null;null===(e=this.postReleaseActions)||void 0===e?void 0:e.length;){this.postReleaseActions.shift()(),g()}},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=window.chrome&&navigator.userAgent.indexOf("Edge")<0,o=!1;function i(){return o&&r}t.hasDebuggingEnabled=i,t.attachDebuggerHotkey=function(e){o=!!e.bootConfig.resources.pdb;var t=navigator.platform.match(/^Mac/i)?"Cmd":"Alt";i()&&console.info("Debugging hotkey: Shift+"+t+"+D (when application has focus)"),document.addEventListener("keydown",(function(e){var t;e.shiftKey&&(e.metaKey||e.altKey)&&"KeyD"===e.code&&(o?r?((t=document.createElement("a")).href="_framework/debug?url="+encodeURIComponent(location.href),t.target="_blank",t.rel="noopener noreferrer",t.click()):console.error("Currently, only Microsoft Edge (80+), or Google Chrome, are supported for debugging."):console.error("Cannot start debugging, because the application was not compiled with debugging enabled."))}))}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i=n(34),a=n(35);t.loadTimezoneData=function(e){var t,n,s=new Uint8Array(e),u=i.readInt32LE(s,0);s=s.slice(4);var l=a.decodeUtf8(s.slice(0,u)),c=JSON.parse(l);s=s.slice(u),Module.FS_createPath("/","zoneinfo",!0,!0),new Set(c.map((function(e){return e[0].split("/")[0]}))).forEach((function(e){return Module.FS_createPath("/zoneinfo",e,!0,!0)}));try{for(var f=r(c),d=f.next();!d.done;d=f.next()){var p=o(d.value,2),h=p[0],m=p[1],y=s.slice(0,m);Module.FS_createDataFile("/zoneinfo/"+h,null,y,!0,!0,!0),s=s.slice(m)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(18),o=function(){function e(e){this.batchAddress=e,this.arrayRangeReader=i,this.arrayBuilderSegmentReader=a,this.diffReader=s,this.editReader=u,this.frameReader=l}return e.prototype.updatedComponents=function(){return r.platform.readStructField(this.batchAddress,0)},e.prototype.referenceFrames=function(){return r.platform.readStructField(this.batchAddress,i.structLength)},e.prototype.disposedComponentIds=function(){return r.platform.readStructField(this.batchAddress,2*i.structLength)},e.prototype.disposedEventHandlerIds=function(){return r.platform.readStructField(this.batchAddress,3*i.structLength)},e.prototype.updatedComponentsEntry=function(e,t){return c(e,t,s.structLength)},e.prototype.referenceFramesEntry=function(e,t){return c(e,t,l.structLength)},e.prototype.disposedComponentIdsEntry=function(e,t){var n=c(e,t,4);return r.platform.readInt32Field(n)},e.prototype.disposedEventHandlerIdsEntry=function(e,t){var n=c(e,t,8);return r.platform.readUint64Field(n)},e}();t.SharedMemoryRenderBatch=o;var i={structLength:8,values:function(e){return r.platform.readObjectField(e,0)},count:function(e){return r.platform.readInt32Field(e,4)}},a={structLength:12,values:function(e){var t=r.platform.readObjectField(e,0),n=r.platform.getObjectFieldsBaseAddress(t);return r.platform.readObjectField(n,0)},offset:function(e){return r.platform.readInt32Field(e,4)},count:function(e){return r.platform.readInt32Field(e,8)}},s={structLength:4+a.structLength,componentId:function(e){return r.platform.readInt32Field(e,0)},edits:function(e){return r.platform.readStructField(e,4)},editsEntry:function(e,t){return c(e,t,u.structLength)}},u={structLength:20,editType:function(e){return r.platform.readInt32Field(e,0)},siblingIndex:function(e){return r.platform.readInt32Field(e,4)},newTreeIndex:function(e){return r.platform.readInt32Field(e,8)},moveToSiblingIndex:function(e){return r.platform.readInt32Field(e,8)},removedAttributeName:function(e){return r.platform.readStringField(e,16)}},l={structLength:36,frameType:function(e){return r.platform.readInt16Field(e,4)},subtreeLength:function(e){return r.platform.readInt32Field(e,8)},elementReferenceCaptureId:function(e){return r.platform.readStringField(e,16)},componentId:function(e){return r.platform.readInt32Field(e,12)},elementName:function(e){return r.platform.readStringField(e,16)},textContent:function(e){return r.platform.readStringField(e,16)},markupContent:function(e){return r.platform.readStringField(e,16)},attributeName:function(e){return r.platform.readStringField(e,16)},attributeValue:function(e){return r.platform.readStringField(e,24,!0)},attributeEventHandlerId:function(e){return r.platform.readUint64Field(e,8)}};function c(e,t,n){return r.platform.getArrayEntryPtr(e,t,n)}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return r in e||(e[r]=[]),e}function s(e,t,n){var a=e;if(e instanceof Comment&&(l(a)&&l(a).length>0))throw new Error("Not implemented: inserting non-empty logical container");if(u(a))throw new Error("Not implemented: moving existing logical children");var i=l(t);if(n0;)e(r,0)}var a=r;a.parentNode.removeChild(a)},t.getLogicalParent=u,t.getLogicalSiblingEnd=function(e){return e[a]||null},t.getLogicalChild=function(e,t){return l(e)[t]},t.isSvgElement=function(e){return"http://www.w3.org/2000/svg"===c(e).namespaceURI},t.getLogicalChildrenArray=l,t.permuteLogicalChildren=function(e,t){var n=l(e);t.forEach((function(e){e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=function e(t){if(t instanceof Element)return t;var n=f(t);if(n)return n.previousSibling;var r=u(t);return r instanceof Element?r.lastChild:e(r)}(e.moveRangeStart)})),t.forEach((function(t){var r=t.moveToBeforeMarker=document.createComment("marker"),o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):d(r,e)})),t.forEach((function(e){for(var t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd,a=r;a;){var i=a.nextSibling;if(n.insertBefore(a,t),a===o)break;a=i}n.removeChild(t)})),t.forEach((function(e){n[e.toSiblingIndex]=e.moveRangeStart}))},t.getClosestDomElement=c},,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setPlatform=function(e){return t.platform=e,t.platform}},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.dispatchEvent=function(e,t){if(!r)throw new Error("eventDispatcher not initialized. Call 'setEventDispatcher' to configure it.");r(e,t)},t.setEventDispatcher=function(e){r=e}},,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=n(4),a=n(30);window.Blazor={navigateTo:r.navigateTo,_internal:{attachRootComponentToElement:o.attachRootComponentToElement,navigationManager:r.internalFunctions,domWrapper:a.domFunctions}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(25),o=n(26),a=n(12),i=n(29),s=n(18),u=n(7),l=document.createElement("template"),c=document.createElementNS("http://www.w3.org/2000/svg","g"),f={submit:!0},d={},p=function(){function e(e){var t=this;this.childComponentLocations={},this.browserRendererId=e,this.eventDelegator=new o.EventDelegator((function(e,n,r,o){!function(e,t,n,r,o){f[e.type]&&e.preventDefault();var a={browserRendererId:t,eventHandlerId:n,eventArgsType:r.type,eventFieldInfo:o};s.dispatchEvent(a,r.data)}(e,t.browserRendererId,n,r,o)})),u.attachToEventDelegator(this.eventDelegator)}return e.prototype.attachRootComponentToLogicalElement=function(e,t){this.attachComponentToElement(e,t),d[e]=t},e.prototype.updateComponent=function(e,t,n,r){var o=this.childComponentLocations[t];if(!o)throw new Error("No element is currently associated with component "+t);var i=d[t];if(i){var s=a.getLogicalSiblingEnd(i);delete d[t],s?function(e,t){var n=a.getLogicalParent(e);if(!n)throw new Error("Can't clear between nodes. The start node does not have a logical parent.");for(var r=a.getLogicalChildrenArray(n),o=r.indexOf(e)+1,i=r.indexOf(t),s=o;s<=i;s++)a.removeLogicalChild(n,o);e.textContent="!"}(i,s):function(e){var t;for(;t=e.firstChild;)e.removeChild(t)}(i)}var u=a.getClosestDomElement(o).ownerDocument,l=u&&u.activeElement;this.applyEdits(e,t,o,0,n,r),l instanceof HTMLElement&&u&&u.activeElement!==l&&l.focus()},e.prototype.disposeComponent=function(e){delete this.childComponentLocations[e]},e.prototype.disposeEventHandler=function(e){this.eventDelegator.removeListener(e)},e.prototype.attachComponentToElement=function(e,t){this.childComponentLocations[e]=t},e.prototype.applyEdits=function(e,t,n,o,i,s){for(var u,l=0,c=o,f=e.arrayBuilderSegmentReader,d=e.editReader,p=e.frameReader,h=f.values(i),m=f.offset(i),y=m+f.count(i),v=m;v0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]>>0)}t.readInt32LE=function(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24},t.readUint32LE=a,t.readUint64LE=function(e,t){var n=a(e,t+4);if(n>o)throw new Error("Cannot read uint64 with high order part "+n+", because the result would exceed Number.MAX_SAFE_INTEGER.");return n*r+a(e,t)},t.readLEB128=function(e,t){for(var n=0,r=0,o=0;o<4;o++){var a=e[t+o];if(n|=(127&a)<65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l)}r.length>1024&&(o.push(String.fromCharCode.apply(null,r)),r.length=0)}return o.push(String.fromCharCode.apply(null,r)),o.join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shouldAutoStart=function(){return!(!document||!document.currentScript||"false"===document.currentScript.getAttribute("autostart"))}},,,,,,,,,,function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{u(r.next(e))}catch(e){a(e)}}function s(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i};Object.defineProperty(t,"__esModule",{value:!0});var i=n(3);n(22);var s=n(17),u=n(45),l=n(4),c=n(48),f=n(34),d=n(18),p=n(49),h=n(50),m=n(51),y=!1;function v(e){return r(this,void 0,void 0,(function(){var t,n,f,v,b,g,w,E,_=this;return o(this,(function(I){switch(I.label){case 0:if(y)throw new Error("Blazor has already started.");return y=!0,d.setEventDispatcher((function(e,t){u.monoPlatform.invokeWhenHeapUnlocked((function(){return i.DotNet.invokeMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","DispatchEvent",e,JSON.stringify(t))}))})),t=s.setPlatform(u.monoPlatform),window.Blazor.platform=t,window.Blazor._internal.renderBatch=function(e,t){var n=u.monoPlatform.beginHeapLock();try{l.renderBatch(e,new c.SharedMemoryRenderBatch(t))}finally{n.release()}},n=window.Blazor._internal.navigationManager.getBaseURI,f=window.Blazor._internal.navigationManager.getLocationHref,window.Blazor._internal.navigationManager.getUnmarshalledBaseURI=function(){return BINDING.js_string_to_mono_string(n())},window.Blazor._internal.navigationManager.getUnmarshalledLocationHref=function(){return BINDING.js_string_to_mono_string(f())},window.Blazor._internal.navigationManager.listenForNavigationEvents((function(e,t){return r(_,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,i.DotNet.invokeMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChanged",e,t)];case 1:return n.sent(),[2]}}))}))})),v=null==e?void 0:e.environment,[4,m.BootConfigResult.initAsync(v)];case 1:return b=I.sent(),[4,Promise.all([p.WebAssemblyResourceLoader.initAsync(b.bootConfig,e||{}),h.WebAssemblyConfigLoader.initAsync(b)])];case 2:g=a.apply(void 0,[I.sent(),1]),w=g[0],I.label=3;case 3:return I.trys.push([3,5,,6]),[4,t.start(w)];case 4:return I.sent(),[3,6];case 5:throw E=I.sent(),new Error("Failed to start platform. Reason: "+E);case 6:return t.callEntryPoint(w.bootConfig.entryAssembly),[2]}}))}))}window.Blazor.start=v,f.shouldAutoStart()&&v().catch((function(e){"undefined"!=typeof Module&&Module.printErr?Module.printErr(e):console.error(e)}))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{u(r.next(e))}catch(e){a(e)}}function s(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]>2]}t.monoPlatform={start:function(e){return new Promise((function(t,n){var c,f;s.attachDebuggerHotkey(e),window.Browser={init:function(){}},c=function(){window.Module=function(e,t,n){var c=this,f=e.bootConfig.resources,d=window.Module||{},p=["DEBUGGING ENABLED"];d.print=function(e){return p.indexOf(e)<0&&console.log(e)},d.printErr=function(e){console.error(e),u.showErrorNotification()},d.preRun=d.preRun||[],d.postRun=d.postRun||[],d.preloadPlugins=[];var m,g=e.loadResources(f.assembly,(function(e){return"_framework/"+e}),"assembly"),w=e.loadResources(f.pdb||{},(function(e){return"_framework/"+e}),"pdb"),E=e.loadResource("dotnet.wasm","_framework/dotnet.wasm",e.bootConfig.resources.runtime["dotnet.wasm"],"dotnetwasm");return e.bootConfig.resources.runtime.hasOwnProperty("dotnet.timezones.dat")&&(m=e.loadResource("dotnet.timezones.dat","_framework/dotnet.timezones.dat",e.bootConfig.resources.runtime["dotnet.timezones.dat"],"timezonedata")),d.instantiateWasm=function(e,t){return r(c,void 0,void 0,(function(){var n,r;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,E];case 1:return[4,v(o.sent(),e)];case 2:return n=o.sent(),[3,4];case 3:throw r=o.sent(),d.printErr(r),r;case 4:return t(n),[2]}}))})),[]},d.preRun.push((function(){a=cwrap("mono_wasm_add_assembly",null,["string","number","number"]),MONO.loaded_files=[],m&&function(e){r(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return t="blazor:timezonedata",addRunDependency(t),[4,e.response];case 1:return[4,r.sent().arrayBuffer()];case 2:return n=r.sent(),l.loadTimezoneData(n),removeRunDependency(t),[2]}}))}))}(m),g.forEach((function(e){return _(e,function(e,t){var n=e.lastIndexOf(".");if(n<0)throw new Error("No extension to replace in '"+e+"'");return e.substr(0,n)+t}(e.name,".dll"))})),w.forEach((function(e){return _(e,e.name)})),window.Blazor._internal.dotNetCriticalError=function(e){d.printErr(BINDING.conv_string(e)||"(null)")},window.Blazor._internal.getSatelliteAssemblies=function(t){var n=BINDING.mono_array_to_js_array(t),a=e.bootConfig.resources.satelliteResources;if(a){var i=Promise.all(n.filter((function(e){return a.hasOwnProperty(e)})).map((function(t){return e.loadResources(a[t],(function(e){return"_framework/"+e}),"assembly")})).reduce((function(e,t){return e.concat(t)}),new Array).map((function(e){return r(c,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,e.response];case 1:return[2,t.sent().arrayBuffer()]}}))}))})));return BINDING.js_to_mono_obj(i.then((function(e){return e.length&&(window.Blazor._internal.readSatelliteAssemblies=function(){for(var t=BINDING.mono_obj_array_new(e.length),n=0;n>1];var n},readInt32Field:function(e,t){return p(e+(t||0))},readUint64Field:function(e,t){return function(e){var t=e>>2,n=Module.HEAPU32[t+1];if(n>f)throw new Error("Cannot read uint64 with high order part "+n+", because the result would exceed Number.MAX_SAFE_INTEGER.");return n*c+Module.HEAPU32[t]}(e+(t||0))},readFloatField:function(e,t){return n=e+(t||0),Module.HEAPF32[n>>2];var n},readObjectField:function(e,t){return p(e+(t||0))},readStringField:function(e,t,n){var r,o=p(e+(t||0));if(0===o)return null;if(n){var a=BINDING.unbox_mono_obj(o);return"boolean"==typeof a?a?"":null:a}return d?void 0===(r=d.stringCache.get(o))&&(r=BINDING.conv_string(o),d.stringCache.set(o,r)):r=BINDING.conv_string(o),r},readStructField:function(e,t){return e+(t||0)},beginHeapLock:function(){return b(),d=new g},invokeWhenHeapUnlocked:function(e){d?d.enqueuePostReleaseAction(e):e()}};var h=document.createElement("a");function m(e){return e+12}function y(e,t,n){var r="["+e+"] "+t+":"+n;return BINDING.bind_static_method(r)}function v(e,t){return r(this,void 0,void 0,(function(){var n,r;return o(this,(function(o){switch(o.label){case 0:if("function"!=typeof WebAssembly.instantiateStreaming)return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,WebAssembly.instantiateStreaming(e.response,t)];case 2:return[2,o.sent().instance];case 3:return n=o.sent(),console.info("Streaming compilation failed. Falling back to ArrayBuffer instantiation. ",n),[3,4];case 4:return[4,e.response.then((function(e){return e.arrayBuffer()}))];case 5:return r=o.sent(),[4,WebAssembly.instantiate(r,t)];case 6:return[2,o.sent().instance]}}))}))}function b(){if(d)throw new Error("Assertion failed - heap is currently locked")}var g=function(){function e(){this.stringCache=new Map}return e.prototype.enqueuePostReleaseAction=function(e){this.postReleaseActions||(this.postReleaseActions=[]),this.postReleaseActions.push(e)},e.prototype.release=function(){var e;if(d!==this)throw new Error("Trying to release a lock which isn't current");for(d=null;null===(e=this.postReleaseActions)||void 0===e?void 0:e.length;){this.postReleaseActions.shift()(),b()}},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=window.chrome&&navigator.userAgent.indexOf("Edge")<0,o=!1;function a(){return o&&r}t.hasDebuggingEnabled=a,t.attachDebuggerHotkey=function(e){o=!!e.bootConfig.resources.pdb;var t=navigator.platform.match(/^Mac/i)?"Cmd":"Alt";a()&&console.info("Debugging hotkey: Shift+"+t+"+D (when application has focus)"),document.addEventListener("keydown",(function(e){var t;e.shiftKey&&(e.metaKey||e.altKey)&&"KeyD"===e.code&&(o?r?((t=document.createElement("a")).href="_framework/debug?url="+encodeURIComponent(location.href),t.target="_blank",t.rel="noopener noreferrer",t.click()):console.error("Currently, only Microsoft Edge (80+), or Google Chrome, are supported for debugging."):console.error("Cannot start debugging, because the application was not compiled with debugging enabled."))}))}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i};Object.defineProperty(t,"__esModule",{value:!0});var a=n(32),i=n(33);t.loadTimezoneData=function(e){var t,n,s=new Uint8Array(e),u=a.readInt32LE(s,0);s=s.slice(4);var l=i.decodeUtf8(s.slice(0,u)),c=JSON.parse(l);s=s.slice(u),Module.FS_createPath("/","zoneinfo",!0,!0),new Set(c.map((function(e){return e[0].split("/")[0]}))).forEach((function(e){return Module.FS_createPath("/zoneinfo",e,!0,!0)}));try{for(var f=r(c),d=f.next();!d.done;d=f.next()){var p=o(d.value,2),h=p[0],m=p[1],y=s.slice(0,m);Module.FS_createDataFile("/zoneinfo/"+h,null,y,!0,!0,!0),s=s.slice(m)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(17),o=function(){function e(e){this.batchAddress=e,this.arrayRangeReader=a,this.arrayBuilderSegmentReader=i,this.diffReader=s,this.editReader=u,this.frameReader=l}return e.prototype.updatedComponents=function(){return r.platform.readStructField(this.batchAddress,0)},e.prototype.referenceFrames=function(){return r.platform.readStructField(this.batchAddress,a.structLength)},e.prototype.disposedComponentIds=function(){return r.platform.readStructField(this.batchAddress,2*a.structLength)},e.prototype.disposedEventHandlerIds=function(){return r.platform.readStructField(this.batchAddress,3*a.structLength)},e.prototype.updatedComponentsEntry=function(e,t){return c(e,t,s.structLength)},e.prototype.referenceFramesEntry=function(e,t){return c(e,t,l.structLength)},e.prototype.disposedComponentIdsEntry=function(e,t){var n=c(e,t,4);return r.platform.readInt32Field(n)},e.prototype.disposedEventHandlerIdsEntry=function(e,t){var n=c(e,t,8);return r.platform.readUint64Field(n)},e}();t.SharedMemoryRenderBatch=o;var a={structLength:8,values:function(e){return r.platform.readObjectField(e,0)},count:function(e){return r.platform.readInt32Field(e,4)}},i={structLength:12,values:function(e){var t=r.platform.readObjectField(e,0),n=r.platform.getObjectFieldsBaseAddress(t);return r.platform.readObjectField(n,0)},offset:function(e){return r.platform.readInt32Field(e,4)},count:function(e){return r.platform.readInt32Field(e,8)}},s={structLength:4+i.structLength,componentId:function(e){return r.platform.readInt32Field(e,0)},edits:function(e){return r.platform.readStructField(e,4)},editsEntry:function(e,t){return c(e,t,u.structLength)}},u={structLength:20,editType:function(e){return r.platform.readInt32Field(e,0)},siblingIndex:function(e){return r.platform.readInt32Field(e,4)},newTreeIndex:function(e){return r.platform.readInt32Field(e,8)},moveToSiblingIndex:function(e){return r.platform.readInt32Field(e,8)},removedAttributeName:function(e){return r.platform.readStringField(e,16)}},l={structLength:36,frameType:function(e){return r.platform.readInt16Field(e,4)},subtreeLength:function(e){return r.platform.readInt32Field(e,8)},elementReferenceCaptureId:function(e){return r.platform.readStringField(e,16)},componentId:function(e){return r.platform.readInt32Field(e,12)},elementName:function(e){return r.platform.readStringField(e,16)},textContent:function(e){return r.platform.readStringField(e,16)},markupContent:function(e){return r.platform.readStringField(e,16)},attributeName:function(e){return r.platform.readStringField(e,16)},attributeValue:function(e){return r.platform.readStringField(e,24,!0)},attributeEventHandlerId:function(e){return r.platform.readUint64Field(e,8)}};function c(e,t,n){return r.platform.getArrayEntryPtr(e,t,n)}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{u(r.next(e))}catch(e){a(e)}}function s(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]): Promise { throw new Error('Blazor has already started.'); } started = true; - initializeProfiling(null); // Establish options to be used const options = resolveOptions(userOptions); diff --git a/src/Components/Web.JS/src/Boot.WebAssembly.ts b/src/Components/Web.JS/src/Boot.WebAssembly.ts index b0e4546681e4..109539739008 100644 --- a/src/Components/Web.JS/src/Boot.WebAssembly.ts +++ b/src/Components/Web.JS/src/Boot.WebAssembly.ts @@ -11,7 +11,6 @@ import { WebAssemblyConfigLoader } from './Platform/WebAssemblyConfigLoader'; import { BootConfigResult } from './Platform/BootConfig'; import { Pointer } from './Platform/Platform'; import { WebAssemblyStartOptions } from './Platform/WebAssemblyStartOptions'; -import { profileStart, profileEnd } from './Platform/Profiling'; let started = false; @@ -34,8 +33,6 @@ async function boot(options?: Partial): Promise { const platform = Environment.setPlatform(monoPlatform); window['Blazor'].platform = platform; window['Blazor']._internal.renderBatch = (browserRendererId: number, batchAddress: Pointer) => { - profileStart('renderBatch'); - // We're going to read directly from the .NET memory heap, so indicate to the platform // that we don't want anything to modify the memory contents during this time. Currently this // is only guaranteed by the fact that .NET code doesn't run during this time, but in the @@ -47,8 +44,6 @@ async function boot(options?: Partial): Promise { } finally { heapLock.release(); } - - profileEnd('renderBatch'); }; // Configure navigation via JS Interop diff --git a/src/Components/Web.JS/src/GlobalExports.ts b/src/Components/Web.JS/src/GlobalExports.ts index 08f7557ba510..df7f9b18a842 100644 --- a/src/Components/Web.JS/src/GlobalExports.ts +++ b/src/Components/Web.JS/src/GlobalExports.ts @@ -1,7 +1,6 @@ import { navigateTo, internalFunctions as navigationManagerInternalFunctions } from './Services/NavigationManager'; import { attachRootComponentToElement } from './Rendering/Renderer'; import { domFunctions } from './DomWrapper'; -import { setProfilingEnabled } from './Platform/Profiling'; // Make the following APIs available in global scope for invocation from JS window['Blazor'] = { @@ -11,6 +10,5 @@ window['Blazor'] = { attachRootComponentToElement, navigationManager: navigationManagerInternalFunctions, domWrapper: domFunctions, - setProfilingEnabled: setProfilingEnabled, }, }; diff --git a/src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts b/src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts index ecad27cf6ee7..c2b6749a9f36 100644 --- a/src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts +++ b/src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts @@ -5,7 +5,6 @@ import { WebAssemblyResourceLoader, LoadingResource } from '../WebAssemblyResour import { Platform, System_Array, Pointer, System_Object, System_String, HeapLock } from '../Platform'; import { loadTimezoneData } from './TimezoneDataFile'; import { WebAssemblyBootResourceType } from '../WebAssemblyStartOptions'; -import { initializeProfiling } from '../Profiling'; let mono_wasm_add_assembly: (name: string, heapAddress: number, length: number) => void; const appBinDirName = 'appBinDir'; @@ -36,10 +35,6 @@ export const monoPlatform: Platform = { start: function start(resourceLoader: WebAssemblyResourceLoader) { return new Promise((resolve, reject) => { attachDebuggerHotkey(resourceLoader); - initializeProfiling(isCapturing => { - const setCapturingMethod = bindStaticMethod('Microsoft.AspNetCore.Components', 'Microsoft.AspNetCore.Components.Profiling.WebAssemblyComponentsProfiling', 'SetCapturing'); - setCapturingMethod(isCapturing); - }); // dotnet.js assumes the existence of this window['Browser'] = { diff --git a/src/Components/Web.JS/src/Platform/Profiling.ts b/src/Components/Web.JS/src/Platform/Profiling.ts deleted file mode 100644 index 4ae834b069d6..000000000000 --- a/src/Components/Web.JS/src/Platform/Profiling.ts +++ /dev/null @@ -1,137 +0,0 @@ -// Import type definitions to ensure that the global declaration -// is of BINDING is included when tests run -import './Mono/MonoTypes'; -import { System_String } from './Platform'; - -interface TimingEntry { - // To minimize overhead, don't even decode the strings that arrive from .NET. Assume they are compile-time constants - // and hence the memory address will be fixed, so we can just store the pointer value. - name: string | System_String; - type: 'start' | 'end'; - timestamp: number; -} - -interface TraceEvent { - // https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview - name: string; - cat: string; // Category - ph: 'B' | 'E'; // Phase - ts: number; // Timestamp in microseconds - pid: number; // Process ID - tid: number; // Thread ID -} - -let updateCapturingStateInHost: (isCapturing: boolean) => void; -let captureStartTime = 0; -const blazorProfilingEnabledKey = 'blazorProfilingEnabled'; -const profilingEnabled = !!localStorage[blazorProfilingEnabledKey]; -const entryLog: TimingEntry[] = []; -const openRegionsStack: (string | System_String)[] = []; - -export function setProfilingEnabled(enabled: boolean) { - // We only wire up the hotkeys etc. if the following localStorage entry is present during startup - // This is to ensure we're not interfering with any other hotkeys that developers might want to - // use for different purposes, plus it gives us a single point where we can notify .NET code during - // startup about whether profiling should be enabled. - localStorage[blazorProfilingEnabledKey] = (enabled !== false); - location.reload(); -} - -export function initializeProfiling(setCapturingCallback: ((isCapturing: boolean) => void) | null) { - if (!profilingEnabled) { - return; - } - - updateCapturingStateInHost = setCapturingCallback || (() => {}); - - // Attach hotkey (alt/cmd)+shift+p - const altKeyName = navigator.platform.match(/^Mac/i) ? 'Cmd' : 'Alt'; - console.info(`Profiling hotkey: Shift+${altKeyName}+P (when application has focus)`); - document.addEventListener('keydown', evt => { - if (evt.shiftKey && (evt.metaKey || evt.altKey) && evt.code === 'KeyP') { - toggleCaptureEnabled(); - } - }); -} - -export function profileStart(name: System_String | string) { - if (!captureStartTime) { - return; - } - - const startTime = performance.now(); - openRegionsStack.push(name); - entryLog.push({ name: name, type: 'start', timestamp: startTime }); -} - -export function profileEnd(name: System_String | string) { - if (!captureStartTime) { - return; - } - - const endTime = performance.now(); - const poppedRegionName = openRegionsStack.pop(); - if (!poppedRegionName) { - throw new Error(`Profiling mismatch: tried to end profiling for '${readJsString(name)}', but the stack was empty.`); - } else if (poppedRegionName !== name) { - throw new Error(`Profiling mismatch: tried to end profiling for '${readJsString(name)}', but the top stack item was '${readJsString(poppedRegionName)}'.`); - } - - entryLog.push({ name: name, type: 'end', timestamp: endTime }); -} - -function profileReset() { - openRegionsStack.length = 0; - entryLog.length = 0; - captureStartTime = 0; - updateCapturingStateInHost(false); -} - -function profileExport() { - const traceEvents: TraceEvent[] = entryLog.map(entry => ({ - name: readJsString(entry.name)!, - cat: 'PERF', - ph: entry.type === 'start' ? 'B': 'E', - ts: (entry.timestamp - captureStartTime) * 1000, - pid: 0, - tid: 0, - })); - const traceEventsJson = JSON.stringify(traceEvents); - const traceEventsBuffer = new TextEncoder().encode(traceEventsJson); - const anchorElement = document.createElement('a'); - anchorElement.href = URL.createObjectURL(new Blob([traceEventsBuffer])); - anchorElement.setAttribute('download', 'trace.json'); - anchorElement.click(); - URL.revokeObjectURL(anchorElement.href); -} - -function toggleCaptureEnabled() { - if (!captureStartTime) { - displayOverlayMessage('Started capturing performance profile...'); - updateCapturingStateInHost(true); - captureStartTime = performance.now(); - } else { - displayOverlayMessage('Finished capturing performance profile'); - profileExport(); - profileReset(); - } -} - -function displayOverlayMessage(message: string) { - const elem = document.createElement('div'); - elem.textContent = message; - elem.setAttribute('style', 'position: absolute; z-index: 99999; font-family: \'Sans Serif\'; top: 0; left: 0; padding: 4px; font-size: 12px; background-color: purple; color: white;'); - document.body.appendChild(elem); - setTimeout(() => document.body.removeChild(elem), 3000); -} - -function readJsString(str: string | System_String) { - // This is expensive, so don't do it while capturing timings. Only do it as part of the export process. - return typeof str === 'string' ? str : BINDING.conv_string(str); -} - -// These globals deliberately differ from our normal conventions for attaching functions inside Blazor.* -// because the intention is to minimize overhead in all reasonable ways. Having any dot-separators in the -// name would cause extra string allocations on every invocation. -window['_blazorProfileStart'] = profileStart; -window['_blazorProfileEnd'] = profileEnd; diff --git a/src/Components/Web.JS/src/Rendering/BrowserRenderer.ts b/src/Components/Web.JS/src/Rendering/BrowserRenderer.ts index a02e04e41c01..5c2433efc775 100644 --- a/src/Components/Web.JS/src/Rendering/BrowserRenderer.ts +++ b/src/Components/Web.JS/src/Rendering/BrowserRenderer.ts @@ -6,7 +6,6 @@ import { applyCaptureIdToElement } from './ElementReferenceCapture'; import { EventFieldInfo } from './EventFieldInfo'; import { dispatchEvent } from './RendererEventDispatcher'; import { attachToEventDelegator as attachNavigationManagerToEventDelegator } from '../Services/NavigationManager'; -import { profileEnd, profileStart } from '../Platform/Profiling'; const selectValuePropname = '_blazorSelectValue'; const sharedTemplateElemForParsing = document.createElement('template'); const sharedSvgElemForParsing = document.createElementNS('http://www.w3.org/2000/svg', 'g'); @@ -41,8 +40,6 @@ export class BrowserRenderer { } public updateComponent(batch: RenderBatch, componentId: number, edits: ArrayBuilderSegment, referenceFrames: ArrayValues): void { - profileStart('updateComponent'); - const element = this.childComponentLocations[componentId]; if (!element) { throw new Error(`No element is currently associated with component ${componentId}`); @@ -70,8 +67,6 @@ export class BrowserRenderer { if ((activeElementBefore instanceof HTMLElement) && ownerDocument && ownerDocument.activeElement !== activeElementBefore) { activeElementBefore.focus(); } - - profileEnd('updateComponent'); } public disposeComponent(componentId: number) { diff --git a/src/Components/Shared/src/WebAssemblyJSInteropInternalCalls.cs b/src/Components/WebAssembly/JSInterop/src/InternalCalls.cs similarity index 100% rename from src/Components/Shared/src/WebAssemblyJSInteropInternalCalls.cs rename to src/Components/WebAssembly/JSInterop/src/InternalCalls.cs diff --git a/src/Components/WebAssembly/JSInterop/src/Microsoft.JSInterop.WebAssembly.csproj b/src/Components/WebAssembly/JSInterop/src/Microsoft.JSInterop.WebAssembly.csproj index 64d0f52e1082..8b58eb02dd68 100644 --- a/src/Components/WebAssembly/JSInterop/src/Microsoft.JSInterop.WebAssembly.csproj +++ b/src/Components/WebAssembly/JSInterop/src/Microsoft.JSInterop.WebAssembly.csproj @@ -9,7 +9,6 @@ - From 5832d6628f2126a0102c9a8f066e7d55409ba3e2 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Fri, 31 Jul 2020 14:49:56 -0700 Subject: [PATCH 21/31] Update documentation on darc (#24487) * Update documentation on darc * Apply suggestions from code review Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> * Update code blocks in referenced assemblies Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> --- docs/ReferenceResolution.md | 74 ++++++++++++++++++++++++++++++------- 1 file changed, 61 insertions(+), 13 deletions(-) diff --git a/docs/ReferenceResolution.md b/docs/ReferenceResolution.md index c80d1a0acc03..8e94b2a86589 100644 --- a/docs/ReferenceResolution.md +++ b/docs/ReferenceResolution.md @@ -100,16 +100,64 @@ is changing to `Microsoft.AspNetCore.BetterThanOrange`, you would need to make t ``` -## Updating dependencies manually - -If the `dotnet-maestro` bot has not correctly updated the dependencies, it may be worthwhile running `darc` manually: - -1. Install `darc` as described in -2. Run `darc update-dependencies --channel '.NET Core 3.1 Release'` - * Use `'trigger-subscriptions'` to prod the bot to create a PR if you do not want to make local changes - * Use `'.NET 3 Eng''` to update dependencies from dotnet/arcade - * Use `'.NET Eng - Latest'` to update dependencies from dotnet/arcade in the `master` branch - * Use `'VS Master'` to update dependencies from dotnet/roslyn in the `master` branch - * Use `'.NET 5 Dev'` to update dependencies from dotnet/efcore or dotnet/runtime in the `master` branch -3. `git diff` to confirm the tool's changes -4. Proceed with usual commit and PR +## A darc cheatsheet + +`darc` is a command-line tool that is used for dependency management in the dotnet ecosystem of repos. `darc` can be installed using the `darc-init` scripts located inside the `eng/common` directory. Once `darc` is installed, you'll need to set up the appropriate access tokens as outlined [in the official Darc docs](https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#setting-up-your-darc-client). + +Once `darc` is installed and set-up, it can be used to modify the subscriptions and dependencies in a project. + +**Getting the list of subscriptions in a repo** + +Subscriptions are objects that define the ecosystem repos we are listening for updates to, the frequency we are looking for updates, and more. + +```bash +darc get-subscriptions --target-branch master --target-repo aspnetcore$ --regex +``` + +**Disable/enable a subscription** + +```bash +darc subscription-status --id {subscriptionIdHere} --enable +darc subscription-status --id {subscriptionIdHere} --disable +``` + +**Trigger a subscription** + +Triggering a subscription will search for updates in its dependencies and open a PR in the target repo via the dotnet-maestro bot with these changes. + +```bash +darc trigger-subscriptions --id {subscriptionIdHere} +``` + +**Manually update dependencies** + +If the `dotnet-maestro` bot has not correctly updated the dependencies, `darc update-dependencies` may be used to update the dependencies manually. Note, you'll need to run the commands below in a separate branch and submit a PR with the changes. These are the things that the bot should do for you if you use `trigger-subscriptions` or automatically (when the subscription fires e.g. about 15 minutes after a dependency's build completes if `Update Frequency: EveryBuild`). + +```bash +darc update-dependencies --channel '.NET Core 3.1 Release' +darc update-dependencies --channel '.NET 5 Dev' --source-repo efcore +``` + +Generally, using `trigger-subscriptions` is preferred for creating dependency updates instead of manually updating dependencies in your own PR. + +**Toggling batchability of subscription** + +Subscriptions can be batched. When a dependency update is detected, `darc` will bundle the commits for that update with existing dependency PRs. To toggle whether a subscription is batched or not, you will need to use the `update-subscription` command. + +```bash +darc update-subscription --id {subscriptionIdHere} +``` + +Your shell's default editor will open and allow you to edit the metadata of the subscription. + +To disable batching, set `Batchable` to `False` and update the `Merge Policies` section with the following YAML. + +``` + - Name: Standard + Properties: {} +``` + +To enable batching, set `Batchable` to `True` and remove any `Merge Policies` set on the subscription. + +Note: Merge policies can only be set on unbatched subscriptions. Be sure to set/unset the `Merge Policies` field properly as you toggle batchability. + From 71290fb95f8672aa555e06a9b6d49e9e67907a1c Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Sun, 2 Aug 2020 09:59:30 -0700 Subject: [PATCH 22/31] Update Blazor WebAssembly in-product survey link for .NET 5. (#24508) --- .../Client/Shared/SurveyPrompt.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Client/Shared/SurveyPrompt.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Client/Shared/SurveyPrompt.razor index 02714098eff1..67828b574bb9 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Client/Shared/SurveyPrompt.razor +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Client/Shared/SurveyPrompt.razor @@ -4,7 +4,7 @@ Please take our - brief survey + brief survey and tell us what you think. From 06075c4606f6864dd121651c40ef42af537841be Mon Sep 17 00:00:00 2001 From: Doug Bunting <6431421+dougbu@users.noreply.github.com> Date: Sun, 2 Aug 2020 11:46:10 -0700 Subject: [PATCH 23/31] Remove unused HTML files (#24488) - just a bit confusing to leave these around - the files haven't been used since @pakrym removed the resources in 56c064bd53ed --- .../src/compiler/resources/GenericError.html | 146 ------------------ .../resources/GenericError_Exception.html | 8 - .../resources/GenericError_Footer.html | 3 - .../resources/GenericError_Message.html | 3 - 4 files changed, 160 deletions(-) delete mode 100644 src/Hosting/Hosting/src/compiler/resources/GenericError.html delete mode 100644 src/Hosting/Hosting/src/compiler/resources/GenericError_Exception.html delete mode 100644 src/Hosting/Hosting/src/compiler/resources/GenericError_Footer.html delete mode 100644 src/Hosting/Hosting/src/compiler/resources/GenericError_Message.html diff --git a/src/Hosting/Hosting/src/compiler/resources/GenericError.html b/src/Hosting/Hosting/src/compiler/resources/GenericError.html deleted file mode 100644 index c6b24c57e852..000000000000 --- a/src/Hosting/Hosting/src/compiler/resources/GenericError.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - 500 Internal Server Error - - - - - - - - [[[0]]] - - [[[1]]] - - [[[2]]] - - diff --git a/src/Hosting/Hosting/src/compiler/resources/GenericError_Exception.html b/src/Hosting/Hosting/src/compiler/resources/GenericError_Exception.html deleted file mode 100644 index 012e05bee7df..000000000000 --- a/src/Hosting/Hosting/src/compiler/resources/GenericError_Exception.html +++ /dev/null @@ -1,8 +0,0 @@ -
- {0}
- {1}
- {2} -
- {3} -
-
diff --git a/src/Hosting/Hosting/src/compiler/resources/GenericError_Footer.html b/src/Hosting/Hosting/src/compiler/resources/GenericError_Footer.html deleted file mode 100644 index fe54861d8777..000000000000 --- a/src/Hosting/Hosting/src/compiler/resources/GenericError_Footer.html +++ /dev/null @@ -1,3 +0,0 @@ -
- {0} {1} v{2}   |   Microsoft.AspNetCore.Hosting version {3}   |   {4}   |   Need help? -
diff --git a/src/Hosting/Hosting/src/compiler/resources/GenericError_Message.html b/src/Hosting/Hosting/src/compiler/resources/GenericError_Message.html deleted file mode 100644 index 39a83d8754cd..000000000000 --- a/src/Hosting/Hosting/src/compiler/resources/GenericError_Message.html +++ /dev/null @@ -1,3 +0,0 @@ -
- {0}
-
From ab2565f08ee4a28fb5916ae509170ee05d4c2ed4 Mon Sep 17 00:00:00 2001 From: Doug Bunting <6431421+dougbu@users.noreply.github.com> Date: Sun, 2 Aug 2020 18:00:45 -0700 Subject: [PATCH 24/31] Increase main Helix job timeout (#24493) - now matches timeout in quarantined-pr.yml which uses the same queues - internal PRs may otherwise time out --- .azure/pipelines/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml index 62a8e30dc958..e3bc04b8715f 100644 --- a/.azure/pipelines/ci.yml +++ b/.azure/pipelines/ci.yml @@ -604,7 +604,7 @@ stages: jobName: Helix_x64 jobDisplayName: 'Tests: Helix x64' agentOs: Windows - timeoutInMinutes: 180 + timeoutInMinutes: 240 steps: # Build the shared framework - script: ./build.cmd -ci -nobl -all -pack -arch x64 /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log From 2a7702b4b8e23323d1813b5fc65c5c71abb25ae8 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Mon, 3 Aug 2020 06:54:03 -0700 Subject: [PATCH 25/31] Dipping toes into linker friendliness (#24458) - Annotated UseMiddleware and UseStartup to preserve constructors and public methods. - Annotated UseHub and MapHub preserve constructors and public methods. - Added a test to verify UseStartup and UseMiddleware works - The linker.xml preserves constructors all of the types that are registered in DI. This should be removed once we get the linker friendly DI changes. --- .../src/GenericHost/GenericWebHostBuilder.cs | 8 +- .../HostingStartupWebHostBuilder.cs | 6 +- .../src/GenericHost/ISupportsStartup.cs | 6 +- .../src/Internal/StartupLinkerOptions.cs | 13 +++ .../Hosting/src/Internal/StartupLoader.cs | 14 +-- .../Hosting/src/WebHostBuilderExtensions.cs | 9 +- .../Fakes/GenericWebHostBuilderWrapper.cs | 2 +- .../Hosting/test/WebHostBuilderTests.cs | 4 +- .../src/ApplicationPublisher.cs | 2 +- .../src/Common/DeploymentParameters.cs | 2 + .../FunctionalTests/LinkedApplicationTests.cs | 57 ++++++++++++ .../BasicLinkedApp/BasicLinkedApp.csproj | 31 +++++++ .../test/testassets/BasicLinkedApp/Linker.xml | 45 +++++++++ .../test/testassets/BasicLinkedApp/Program.cs | 38 ++++++++ .../test/testassets/BasicLinkedApp/Startup.cs | 29 ++++++ .../src/Extensions/UseMiddlewareExtensions.cs | 10 +- .../src/ConnectionBuilderExtensions.cs | 3 +- ...AspNetCore.Connections.Abstractions.csproj | 1 + .../DynamicallyAccessedMemberTypes.cs | 92 +++++++++++++++++++ .../DynamicallyAccessedMembersAttribute.cs | 48 ++++++++++ .../src/SignalRConnectionBuilderExtensions.cs | 5 +- .../src/HubEndpointRouteBuilderExtensions.cs | 7 +- 22 files changed, 405 insertions(+), 27 deletions(-) create mode 100644 src/Hosting/Hosting/src/Internal/StartupLinkerOptions.cs create mode 100644 src/Hosting/test/FunctionalTests/LinkedApplicationTests.cs create mode 100644 src/Hosting/test/testassets/BasicLinkedApp/BasicLinkedApp.csproj create mode 100644 src/Hosting/test/testassets/BasicLinkedApp/Linker.xml create mode 100644 src/Hosting/test/testassets/BasicLinkedApp/Program.cs create mode 100644 src/Hosting/test/testassets/BasicLinkedApp/Startup.cs create mode 100644 src/Shared/CodeAnalysis/DynamicallyAccessedMemberTypes.cs create mode 100644 src/Shared/CodeAnalysis/DynamicallyAccessedMembersAttribute.cs diff --git a/src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs b/src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs index a9625a7907a0..d3b97ca8f14a 100644 --- a/src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs +++ b/src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs @@ -4,11 +4,13 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; using System.Runtime.ExceptionServices; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting.Builder; +using Microsoft.AspNetCore.Hosting.Internal; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -196,7 +198,7 @@ public IWebHostBuilder UseDefaultServiceProvider(Action startupFactory) + public IWebHostBuilder UseStartup<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]TStartup>(Func startupFactory) { // Clear the startup type _startupObject = startupFactory; @@ -232,7 +234,7 @@ public IWebHostBuilder UseStartup(Func startupFac return this; } - private void UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, object instance = null) + private void UseStartup([DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType, HostBuilderContext context, IServiceCollection services, object instance = null) { var webHostBuilderContext = GetWebHostBuilderContext(context); var webHostOptions = (WebHostOptions)context.Properties[typeof(WebHostOptions)]; diff --git a/src/Hosting/Hosting/src/GenericHost/HostingStartupWebHostBuilder.cs b/src/Hosting/Hosting/src/GenericHost/HostingStartupWebHostBuilder.cs index f4034fc38bd6..ccffd884db22 100644 --- a/src/Hosting/Hosting/src/GenericHost/HostingStartupWebHostBuilder.cs +++ b/src/Hosting/Hosting/src/GenericHost/HostingStartupWebHostBuilder.cs @@ -2,7 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting.Internal; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -71,12 +73,12 @@ public IWebHostBuilder Configure(Action startupFactory) + public IWebHostBuilder UseStartup<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]TStartup>(Func startupFactory) { return _builder.UseStartup(startupFactory); } diff --git a/src/Hosting/Hosting/src/GenericHost/ISupportsStartup.cs b/src/Hosting/Hosting/src/GenericHost/ISupportsStartup.cs index 998f73d06bc0..360c3da631d4 100644 --- a/src/Hosting/Hosting/src/GenericHost/ISupportsStartup.cs +++ b/src/Hosting/Hosting/src/GenericHost/ISupportsStartup.cs @@ -2,14 +2,16 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting.Internal; namespace Microsoft.AspNetCore.Hosting { internal interface ISupportsStartup { IWebHostBuilder Configure(Action configure); - IWebHostBuilder UseStartup(Type startupType); - IWebHostBuilder UseStartup(Func startupFactory); + IWebHostBuilder UseStartup([DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType); + IWebHostBuilder UseStartup<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]TStartup>(Func startupFactory); } } diff --git a/src/Hosting/Hosting/src/Internal/StartupLinkerOptions.cs b/src/Hosting/Hosting/src/Internal/StartupLinkerOptions.cs new file mode 100644 index 000000000000..44ce693c3163 --- /dev/null +++ b/src/Hosting/Hosting/src/Internal/StartupLinkerOptions.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Diagnostics.CodeAnalysis; + +namespace Microsoft.AspNetCore.Hosting.Internal +{ + internal static class StartupLinkerOptions + { + // We're going to keep all public constructors and public methods on Startup classes + public const DynamicallyAccessedMemberTypes Accessibility = DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods; + } +} diff --git a/src/Hosting/Hosting/src/Internal/StartupLoader.cs b/src/Hosting/Hosting/src/Internal/StartupLoader.cs index 8c80884b83f8..8e8f235eae0b 100644 --- a/src/Hosting/Hosting/src/Internal/StartupLoader.cs +++ b/src/Hosting/Hosting/src/Internal/StartupLoader.cs @@ -3,9 +3,11 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; using System.Reflection; +using Microsoft.AspNetCore.Hosting.Internal; using Microsoft.Extensions.DependencyInjection; namespace Microsoft.AspNetCore.Hosting @@ -37,7 +39,7 @@ internal class StartupLoader // // If the Startup class ConfigureServices returns an and there is at least an registered we // throw as the filters can't be applied. - public static StartupMethods LoadMethods(IServiceProvider hostingServiceProvider, Type startupType, string environmentName, object instance = null) + public static StartupMethods LoadMethods(IServiceProvider hostingServiceProvider, [DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType, string environmentName, object instance = null) { var configureMethod = FindConfigureDelegate(startupType, environmentName); @@ -272,31 +274,31 @@ public static Type FindStartupType(string startupAssemblyName, string environmen return type; } - internal static ConfigureBuilder FindConfigureDelegate(Type startupType, string environmentName) + internal static ConfigureBuilder FindConfigureDelegate([DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType, string environmentName) { var configureMethod = FindMethod(startupType, "Configure{0}", environmentName, typeof(void), required: true); return new ConfigureBuilder(configureMethod); } - internal static ConfigureContainerBuilder FindConfigureContainerDelegate(Type startupType, string environmentName) + internal static ConfigureContainerBuilder FindConfigureContainerDelegate([DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType, string environmentName) { var configureMethod = FindMethod(startupType, "Configure{0}Container", environmentName, typeof(void), required: false); return new ConfigureContainerBuilder(configureMethod); } - internal static bool HasConfigureServicesIServiceProviderDelegate(Type startupType, string environmentName) + internal static bool HasConfigureServicesIServiceProviderDelegate([DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType, string environmentName) { return null != FindMethod(startupType, "Configure{0}Services", environmentName, typeof(IServiceProvider), required: false); } - internal static ConfigureServicesBuilder FindConfigureServicesDelegate(Type startupType, string environmentName) + internal static ConfigureServicesBuilder FindConfigureServicesDelegate([DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType, string environmentName) { var servicesMethod = FindMethod(startupType, "Configure{0}Services", environmentName, typeof(IServiceProvider), required: false) ?? FindMethod(startupType, "Configure{0}Services", environmentName, typeof(void), required: false); return new ConfigureServicesBuilder(servicesMethod); } - private static MethodInfo FindMethod(Type startupType, string methodName, string environmentName, Type returnType = null, bool required = true) + private static MethodInfo FindMethod([DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType, string methodName, string environmentName, Type returnType = null, bool required = true) { var methodNameWithEnv = string.Format(CultureInfo.InvariantCulture, methodName, environmentName); var methodNameWithNoEnv = string.Format(CultureInfo.InvariantCulture, methodName, ""); diff --git a/src/Hosting/Hosting/src/WebHostBuilderExtensions.cs b/src/Hosting/Hosting/src/WebHostBuilderExtensions.cs index 5d2b7133cc0b..20151ebe9ec7 100644 --- a/src/Hosting/Hosting/src/WebHostBuilderExtensions.cs +++ b/src/Hosting/Hosting/src/WebHostBuilderExtensions.cs @@ -2,8 +2,10 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Diagnostics.CodeAnalysis; using System.Reflection; using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting.Internal; using Microsoft.AspNetCore.Hosting.StaticWebAssets; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -67,7 +69,8 @@ private static IWebHostBuilder Configure(this IWebHostBuilder hostBuilder, Actio /// The to configure. /// A delegate that specifies a factory for the startup class. /// The . - public static IWebHostBuilder UseStartup(this IWebHostBuilder hostBuilder, Func startupFactory) + /// When using the il linker, all public methods of are preserved. This should match the Startup type directly (and not a base type). + public static IWebHostBuilder UseStartup<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]TStartup>(this IWebHostBuilder hostBuilder, Func startupFactory) where TStartup : class { if (startupFactory == null) { @@ -110,7 +113,7 @@ public static IWebHostBuilder UseStartup(this IWebHostBuilder hostBuilder, Func< /// The to configure. /// The to be used. /// The . - public static IWebHostBuilder UseStartup(this IWebHostBuilder hostBuilder, Type startupType) + public static IWebHostBuilder UseStartup(this IWebHostBuilder hostBuilder, [DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType) { if (startupType == null) { @@ -151,7 +154,7 @@ public static IWebHostBuilder UseStartup(this IWebHostBuilder hostBuilder, Type /// The to configure. /// The type containing the startup methods for the application. /// The . - public static IWebHostBuilder UseStartup(this IWebHostBuilder hostBuilder) where TStartup : class + public static IWebHostBuilder UseStartup<[DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)]TStartup>(this IWebHostBuilder hostBuilder) where TStartup : class { return hostBuilder.UseStartup(typeof(TStartup)); } diff --git a/src/Hosting/Hosting/test/Fakes/GenericWebHostBuilderWrapper.cs b/src/Hosting/Hosting/test/Fakes/GenericWebHostBuilderWrapper.cs index e87be3a9ad92..b0bf122d1b33 100644 --- a/src/Hosting/Hosting/test/Fakes/GenericWebHostBuilderWrapper.cs +++ b/src/Hosting/Hosting/test/Fakes/GenericWebHostBuilderWrapper.cs @@ -74,7 +74,7 @@ public IWebHostBuilder UseStartup(Type startupType) return this; } - public IWebHostBuilder UseStartup(Func startupFactory) + public IWebHostBuilder UseStartup(Func startupFactory) { _builder.UseStartup(startupFactory); return this; diff --git a/src/Hosting/Hosting/test/WebHostBuilderTests.cs b/src/Hosting/Hosting/test/WebHostBuilderTests.cs index 81a8ab494124..d6b9a5f1a6dc 100644 --- a/src/Hosting/Hosting/test/WebHostBuilderTests.cs +++ b/src/Hosting/Hosting/test/WebHostBuilderTests.cs @@ -85,7 +85,7 @@ public void UseStartupThrowsWhenFactoryIsNull(IWebHostBuilder builder) public void UseStartupThrowsWhenFactoryReturnsNull(IWebHostBuilder builder) { var server = new TestServer(); - var ex = Assert.Throws(() => builder.UseServer(server).UseStartup(context => null).Build()); + var ex = Assert.Throws(() => builder.UseServer(server).UseStartup(context => null).Build()); Assert.Equal("The specified factory returned null startup instance.", ex.Message); } @@ -96,7 +96,7 @@ public async Task MultipleUseStartupCallsLastWins(IWebHostBuilder builder) var server = new TestServer(); var host = builder.UseServer(server) .UseStartup() - .UseStartup(context => throw new InvalidOperationException("This doesn't run")) + .UseStartup(context => throw new InvalidOperationException("This doesn't run")) .Configure(app => { throw new InvalidOperationException("This doesn't run"); diff --git a/src/Hosting/Server.IntegrationTesting/src/ApplicationPublisher.cs b/src/Hosting/Server.IntegrationTesting/src/ApplicationPublisher.cs index ba5c545317d6..5ef431c2ce9b 100644 --- a/src/Hosting/Server.IntegrationTesting/src/ApplicationPublisher.cs +++ b/src/Hosting/Server.IntegrationTesting/src/ApplicationPublisher.cs @@ -38,7 +38,7 @@ public virtual Task Publish(DeploymentParameters deploymen // avoids triggering builds of dependencies of the test app which could cause issues like https://github.com/dotnet/arcade/issues/2941 + $" --no-dependencies" + $" /p:TargetArchitecture={deploymentParameters.RuntimeArchitecture}" - + " --no-restore"; + + (deploymentParameters.RestoreDependencies ? "" : " --no-restore"); if (deploymentParameters.ApplicationType == ApplicationType.Standalone) { diff --git a/src/Hosting/Server.IntegrationTesting/src/Common/DeploymentParameters.cs b/src/Hosting/Server.IntegrationTesting/src/Common/DeploymentParameters.cs index 1f7287d3a086..5002e8f53031 100644 --- a/src/Hosting/Server.IntegrationTesting/src/Common/DeploymentParameters.cs +++ b/src/Hosting/Server.IntegrationTesting/src/Common/DeploymentParameters.cs @@ -113,6 +113,8 @@ public DeploymentParameters(DeploymentParameters parameters) /// public string ApplicationBaseUriHint { get; set; } + public bool RestoreDependencies { get; set; } + /// /// Scheme used by the deployed application if is empty. /// diff --git a/src/Hosting/test/FunctionalTests/LinkedApplicationTests.cs b/src/Hosting/test/FunctionalTests/LinkedApplicationTests.cs new file mode 100644 index 000000000000..8bce9c2b4222 --- /dev/null +++ b/src/Hosting/test/FunctionalTests/LinkedApplicationTests.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.AspNetCore.Testing; +using Microsoft.Extensions.Logging; +using Xunit; + +namespace Microsoft.AspNetCore.Hosting.FunctionalTests +{ + public class LinkedApplicationTests : LoggedTest + { + [Fact] + public async Task LinkedApplicationWorks() + { + using (StartLog(out var loggerFactory)) + { + var logger = loggerFactory.CreateLogger("LinkedApplicationWorks"); + + // https://github.com/dotnet/aspnetcore/issues/8247 +#pragma warning disable 0618 + var applicationPath = Path.Combine(TestPathUtilities.GetSolutionRootDirectory("Hosting"), "test", "testassets", + "BasicLinkedApp"); +#pragma warning restore 0618 + + var deploymentParameters = new DeploymentParameters( + applicationPath, + ServerType.Kestrel, + RuntimeFlavor.CoreClr, + RuntimeArchitecture.x64) + { + TargetFramework = Tfm.Net50, + RuntimeArchitecture = RuntimeArchitecture.x64, + ApplicationType = ApplicationType.Standalone, + PublishApplicationBeforeDeployment = true, + RestoreDependencies = true, + StatusMessagesEnabled = false + }; + + using var deployer = new SelfHostDeployer(deploymentParameters, loggerFactory); + + var result = await deployer.DeployAsync(); + + // The app should have started up + Assert.False(deployer.HostProcess.HasExited); + + var response = await RetryHelper.RetryRequest(() => result.HttpClient.GetAsync("/"), logger, retryCount: 10); + var body = await response.Content.ReadAsStringAsync(); + + Assert.Equal("Hello World", body); + } + } + } +} diff --git a/src/Hosting/test/testassets/BasicLinkedApp/BasicLinkedApp.csproj b/src/Hosting/test/testassets/BasicLinkedApp/BasicLinkedApp.csproj new file mode 100644 index 000000000000..baf5d0e7d077 --- /dev/null +++ b/src/Hosting/test/testassets/BasicLinkedApp/BasicLinkedApp.csproj @@ -0,0 +1,31 @@ + + + + $(DefaultNetCoreTargetFramework) + Exe + true + link + + + + + + + + + + + + + + + + + link + + + + + + + diff --git a/src/Hosting/test/testassets/BasicLinkedApp/Linker.xml b/src/Hosting/test/testassets/BasicLinkedApp/Linker.xml new file mode 100644 index 000000000000..f3757db941e2 --- /dev/null +++ b/src/Hosting/test/testassets/BasicLinkedApp/Linker.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Hosting/test/testassets/BasicLinkedApp/Program.cs b/src/Hosting/test/testassets/BasicLinkedApp/Program.cs new file mode 100644 index 000000000000..d9dd26713527 --- /dev/null +++ b/src/Hosting/test/testassets/BasicLinkedApp/Program.cs @@ -0,0 +1,38 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Configuration; + +namespace BasicLinkedApp +{ + public class Program + { + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + // Do not change the signature of this method. It's used for tests. + private static IHostBuilder CreateWebHostBuilder(string[] args) + { + return new HostBuilder() + .ConfigureHostConfiguration(config => + { + config.AddCommandLine(args); + }) + .ConfigureLogging(logging => + { + logging.AddConsole(); + }) + .ConfigureWebHost(webHostBuilder => + { + webHostBuilder.UseKestrel().UseStartup(); + }); + } + } +} diff --git a/src/Hosting/test/testassets/BasicLinkedApp/Startup.cs b/src/Hosting/test/testassets/BasicLinkedApp/Startup.cs new file mode 100644 index 000000000000..d899b5352be2 --- /dev/null +++ b/src/Hosting/test/testassets/BasicLinkedApp/Startup.cs @@ -0,0 +1,29 @@ + +using System; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using System.Threading.Tasks; + +namespace BasicLinkedApp +{ + public class Startup + { + public void Configure(IApplicationBuilder app) + { + app.UseMiddleware(); + } + } + + public class HelloWorldMiddleware + { + public HelloWorldMiddleware(RequestDelegate next) + { + + } + + public Task InvokeAsync(HttpContext context) + { + return context.Response.WriteAsync("Hello World"); + } + } +} diff --git a/src/Http/Http.Abstractions/src/Extensions/UseMiddlewareExtensions.cs b/src/Http/Http.Abstractions/src/Extensions/UseMiddlewareExtensions.cs index f33707e67167..164b601d57f8 100644 --- a/src/Http/Http.Abstractions/src/Extensions/UseMiddlewareExtensions.cs +++ b/src/Http/Http.Abstractions/src/Extensions/UseMiddlewareExtensions.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Linq.Expressions; using System.Reflection; @@ -22,6 +23,9 @@ public static class UseMiddlewareExtensions private static readonly MethodInfo GetServiceInfo = typeof(UseMiddlewareExtensions).GetMethod(nameof(GetService), BindingFlags.NonPublic | BindingFlags.Static)!; + // We're going to keep all public constructors and public methods on middleware + private const DynamicallyAccessedMemberTypes MiddlewareAccessibility = DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods; + /// /// Adds a middleware type to the application's request pipeline. /// @@ -29,7 +33,7 @@ public static class UseMiddlewareExtensions /// The instance. /// The arguments to pass to the middleware type instance's constructor. /// The instance. - public static IApplicationBuilder UseMiddleware(this IApplicationBuilder app, params object[] args) + public static IApplicationBuilder UseMiddleware<[DynamicallyAccessedMembers(MiddlewareAccessibility)]TMiddleware>(this IApplicationBuilder app, params object[] args) { return app.UseMiddleware(typeof(TMiddleware), args); } @@ -41,7 +45,7 @@ public static IApplicationBuilder UseMiddleware(this IApplicationBu /// The middleware type. /// The arguments to pass to the middleware type instance's constructor. /// The instance. - public static IApplicationBuilder UseMiddleware(this IApplicationBuilder app, Type middleware, params object[] args) + public static IApplicationBuilder UseMiddleware(this IApplicationBuilder app, [DynamicallyAccessedMembers(MiddlewareAccessibility)] Type middleware, params object[] args) { if (typeof(IMiddleware).GetTypeInfo().IsAssignableFrom(middleware.GetTypeInfo())) { @@ -110,7 +114,7 @@ public static IApplicationBuilder UseMiddleware(this IApplicationBuilder app, Ty }); } - private static IApplicationBuilder UseMiddlewareInterface(IApplicationBuilder app, Type middlewareType) + private static IApplicationBuilder UseMiddlewareInterface(IApplicationBuilder app, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type middlewareType) { return app.Use(next => { diff --git a/src/Servers/Connections.Abstractions/src/ConnectionBuilderExtensions.cs b/src/Servers/Connections.Abstractions/src/ConnectionBuilderExtensions.cs index 55b0311eb977..937f36b57413 100644 --- a/src/Servers/Connections.Abstractions/src/ConnectionBuilderExtensions.cs +++ b/src/Servers/Connections.Abstractions/src/ConnectionBuilderExtensions.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; using Microsoft.Extensions.Internal; @@ -9,7 +10,7 @@ namespace Microsoft.AspNetCore.Connections { public static class ConnectionBuilderExtensions { - public static IConnectionBuilder UseConnectionHandler(this IConnectionBuilder connectionBuilder) where TConnectionHandler : ConnectionHandler + public static IConnectionBuilder UseConnectionHandler<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]TConnectionHandler>(this IConnectionBuilder connectionBuilder) where TConnectionHandler : ConnectionHandler { var handler = ActivatorUtilities.GetServiceOrCreateInstance(connectionBuilder.ApplicationServices); diff --git a/src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj b/src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj index fcea39596454..e83b0142a019 100644 --- a/src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj +++ b/src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj @@ -17,6 +17,7 @@ + diff --git a/src/Shared/CodeAnalysis/DynamicallyAccessedMemberTypes.cs b/src/Shared/CodeAnalysis/DynamicallyAccessedMemberTypes.cs new file mode 100644 index 000000000000..2edc474a0b39 --- /dev/null +++ b/src/Shared/CodeAnalysis/DynamicallyAccessedMemberTypes.cs @@ -0,0 +1,92 @@ +#if !NET5_0 +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Diagnostics.CodeAnalysis +{ + /// + /// Specifies the types of members that are dynamically accessed. + /// + /// This enumeration has a attribute that allows a + /// bitwise combination of its member values. + /// + [Flags] + internal enum DynamicallyAccessedMemberTypes + { + /// + /// Specifies no members. + /// + None = 0, + + /// + /// Specifies the default, parameterless public constructor. + /// + PublicParameterlessConstructor = 0x0001, + + /// + /// Specifies all public constructors. + /// + PublicConstructors = 0x0002 | PublicParameterlessConstructor, + + /// + /// Specifies all non-public constructors. + /// + NonPublicConstructors = 0x0004, + + /// + /// Specifies all public methods. + /// + PublicMethods = 0x0008, + + /// + /// Specifies all non-public methods. + /// + NonPublicMethods = 0x0010, + + /// + /// Specifies all public fields. + /// + PublicFields = 0x0020, + + /// + /// Specifies all non-public fields. + /// + NonPublicFields = 0x0040, + + /// + /// Specifies all public nested types. + /// + PublicNestedTypes = 0x0080, + + /// + /// Specifies all non-public nested types. + /// + NonPublicNestedTypes = 0x0100, + + /// + /// Specifies all public properties. + /// + PublicProperties = 0x0200, + + /// + /// Specifies all non-public properties. + /// + NonPublicProperties = 0x0400, + + /// + /// Specifies all public events. + /// + PublicEvents = 0x0800, + + /// + /// Specifies all non-public events. + /// + NonPublicEvents = 0x1000, + + /// + /// Specifies all members. + /// + All = ~None + } +} +#endif \ No newline at end of file diff --git a/src/Shared/CodeAnalysis/DynamicallyAccessedMembersAttribute.cs b/src/Shared/CodeAnalysis/DynamicallyAccessedMembersAttribute.cs new file mode 100644 index 000000000000..c0ae1c68629d --- /dev/null +++ b/src/Shared/CodeAnalysis/DynamicallyAccessedMembersAttribute.cs @@ -0,0 +1,48 @@ +#if !NET5_0 +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Diagnostics.CodeAnalysis +{ + /// + /// Indicates that certain members on a specified are accessed dynamically, + /// for example through . + /// + /// + /// This allows tools to understand which members are being accessed during the execution + /// of a program. + /// + /// This attribute is valid on members whose type is or . + /// + /// When this attribute is applied to a location of type , the assumption is + /// that the string represents a fully qualified type name. + /// + /// If the attribute is applied to a method it's treated as a special case and it implies + /// the attribute should be applied to the "this" parameter of the method. As such the attribute + /// should only be used on instance methods of types assignable to System.Type (or string, but no methods + /// will use it there). + /// + [AttributeUsage( + AttributeTargets.Field | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter | + AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Method, + Inherited = false)] + internal sealed class DynamicallyAccessedMembersAttribute : Attribute + { + /// + /// Initializes a new instance of the class + /// with the specified member types. + /// + /// The types of members dynamically accessed. + public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes) + { + MemberTypes = memberTypes; + } + + /// + /// Gets the which specifies the type + /// of members dynamically accessed. + /// + public DynamicallyAccessedMemberTypes MemberTypes { get; } + } +} +#endif \ No newline at end of file diff --git a/src/SignalR/server/Core/src/SignalRConnectionBuilderExtensions.cs b/src/SignalR/server/Core/src/SignalRConnectionBuilderExtensions.cs index 58888470cf6f..d06baed6047e 100644 --- a/src/SignalR/server/Core/src/SignalRConnectionBuilderExtensions.cs +++ b/src/SignalR/server/Core/src/SignalRConnectionBuilderExtensions.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.SignalR.Internal; using Microsoft.Extensions.DependencyInjection; @@ -13,13 +14,15 @@ namespace Microsoft.AspNetCore.SignalR /// public static class SignalRConnectionBuilderExtensions { + private const DynamicallyAccessedMemberTypes HubAccessibility = DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods; + /// /// Configure the connection to host the specified type. /// /// The type to host on the connection. /// The connection to configure. /// The same instance of the for chaining. - public static IConnectionBuilder UseHub(this IConnectionBuilder connectionBuilder) where THub : Hub + public static IConnectionBuilder UseHub<[DynamicallyAccessedMembers(HubAccessibility)]THub>(this IConnectionBuilder connectionBuilder) where THub : Hub { var marker = connectionBuilder.ApplicationServices.GetService(typeof(SignalRCoreMarkerService)); if (marker == null) diff --git a/src/SignalR/server/SignalR/src/HubEndpointRouteBuilderExtensions.cs b/src/SignalR/server/SignalR/src/HubEndpointRouteBuilderExtensions.cs index 553ea3f8ce12..3ac90b36f02c 100644 --- a/src/SignalR/server/SignalR/src/HubEndpointRouteBuilderExtensions.cs +++ b/src/SignalR/server/SignalR/src/HubEndpointRouteBuilderExtensions.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Http.Connections; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.SignalR; @@ -11,6 +12,8 @@ namespace Microsoft.AspNetCore.Builder { public static class HubEndpointRouteBuilderExtensions { + private const DynamicallyAccessedMemberTypes HubAccessibility = DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods; + /// /// Maps incoming requests with the specified path to the specified type. /// @@ -18,7 +21,7 @@ public static class HubEndpointRouteBuilderExtensions /// The to add the route to. /// The route pattern. /// An for endpoints associated with the connections. - public static HubEndpointConventionBuilder MapHub(this IEndpointRouteBuilder endpoints, string pattern) where THub : Hub + public static HubEndpointConventionBuilder MapHub<[DynamicallyAccessedMembers(HubAccessibility)]THub>(this IEndpointRouteBuilder endpoints, string pattern) where THub : Hub { return endpoints.MapHub(pattern, configureOptions: null); } @@ -31,7 +34,7 @@ public static HubEndpointConventionBuilder MapHub(this IEndpointRouteBuild /// The route pattern. /// A callback to configure dispatcher options. /// An for endpoints associated with the connections. - public static HubEndpointConventionBuilder MapHub(this IEndpointRouteBuilder endpoints, string pattern, Action configureOptions) where THub : Hub + public static HubEndpointConventionBuilder MapHub<[DynamicallyAccessedMembers(HubAccessibility)]THub>(this IEndpointRouteBuilder endpoints, string pattern, Action configureOptions) where THub : Hub { var marker = endpoints.ServiceProvider.GetService(); From 0ef7591e601c7b554d516a39e437a7b18df09b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Luthi?= Date: Mon, 3 Aug 2020 16:30:52 +0200 Subject: [PATCH 26/31] [HTTPS] Fix the CertificateManagerEventSource event ids (#24519) --- src/Shared/CertificateGeneration/CertificateManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Shared/CertificateGeneration/CertificateManager.cs b/src/Shared/CertificateGeneration/CertificateManager.cs index 1f2820b9bee2..cc63219bd9b6 100644 --- a/src/Shared/CertificateGeneration/CertificateManager.cs +++ b/src/Shared/CertificateGeneration/CertificateManager.cs @@ -853,13 +853,13 @@ public void ExportCertificateStart(string certificate, string path, bool include [Event(50, Level = EventLevel.Verbose)] public void WindowsRemoveCertificateFromRootStoreNotFound() => WriteEvent(50, "The certificate was not trusted."); - [Event(50, Level = EventLevel.Verbose)] + [Event(51, Level = EventLevel.Verbose)] public void CorrectCertificateStateStart(string certificate) => WriteEvent(51, $"Correcting the the certificate state for '{certificate}'"); - [Event(51, Level = EventLevel.Verbose)] + [Event(52, Level = EventLevel.Verbose)] public void CorrectCertificateStateEnd() => WriteEvent(52, "Finished correcting the certificate state"); - [Event(52, Level = EventLevel.Error)] + [Event(53, Level = EventLevel.Error)] public void CorrectCertificateStateError(string error) => WriteEvent(53, $"An error has ocurred while correcting the certificate state: {error}."); [Event(54, Level = EventLevel.Verbose)] From 9b0afdad96e4e490df206fc47126e7574e81fc48 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Mon, 3 Aug 2020 10:22:17 -0700 Subject: [PATCH 27/31] Run full helix matrix for crash dumps --- .azure/pipelines/helix-matrix.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.azure/pipelines/helix-matrix.yml b/.azure/pipelines/helix-matrix.yml index 5210cce65c4b..5d03337ead6c 100644 --- a/.azure/pipelines/helix-matrix.yml +++ b/.azure/pipelines/helix-matrix.yml @@ -1,5 +1,9 @@ # We only want to run full helix matrix on master -pr: none +pr: + autoCancel: true + branches: + include: + - '*' trigger: none schedules: - cron: "0 */12 * * *" From d9e0cf4ed27fadbd0573e0096f16e91ac3a3401f Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Mon, 3 Aug 2020 10:25:09 -0700 Subject: [PATCH 28/31] Try only uploading to root --- eng/helix/content/RunTests/TestRunner.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index cc89a4f9c879..0cdac1689395 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -322,9 +322,7 @@ public void UploadResults() // Combine the directory name + log name for the copied log file name to avoid overwriting duplicate test names in different test projects var logName = $"{Path.GetFileName(Path.GetDirectoryName(file))}_{Path.GetFileName(file)}"; Console.WriteLine($"Copying: {file} to {Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, logName)}"); - // Need to copy to HELIX_WORKITEM_UPLOAD_ROOT and HELIX_WORKITEM_UPLOAD_ROOT/../ in order for Azure Devops attachments to link properly and for Helix to store the logs File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, logName)); - File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, "..", logName)); } } else @@ -338,9 +336,7 @@ public void UploadResults() { var fileName = Path.GetFileName(file); Console.WriteLine($"Copying: {file} to {Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, fileName)}"); - // Need to copy to HELIX_WORKITEM_UPLOAD_ROOT and HELIX_WORKITEM_UPLOAD_ROOT/../ in order for Azure Devops attachments to link properly and for Helix to store the logs File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, fileName)); - File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, "..", fileName)); } } else From 3d85085c5a855f392cb82a767a33a41da2fd67c2 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 6 Aug 2020 18:03:18 -0700 Subject: [PATCH 29/31] Add trx logger and upload trx files --- eng/helix/content/RunTests/TestRunner.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index 0cdac1689395..36b01bd6f95e 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -247,7 +247,7 @@ public async Task RunTestsAsync() { // Timeout test run 5 minutes before the Helix job would timeout var cts = new CancellationTokenSource(Options.Timeout.Subtract(TimeSpan.FromMinutes(5))); - var commonTestArgs = $"test {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame \"CollectHangDump;TestTimeout=5m\""; + var commonTestArgs = $"test {Options.Target} --logger:trx --logger:xunit --logger:\"console;verbosity=normal\" --collect:execution --blame \"CollectHangDump;TestTimeout=5m\""; if (Options.Quarantined) { Console.WriteLine("Running quarantined tests."); @@ -343,6 +343,20 @@ public void UploadResults() { Console.WriteLine("No dmps found in TestResults"); } + Console.WriteLine($"Copying TestResults/**/*.trx to {HELIX_WORKITEM_UPLOAD_ROOT}/"); + if (Directory.Exists("TestResults")) + { + foreach (var file in Directory.EnumerateFiles("TestResults", "*.trx", SearchOption.AllDirectories)) + { + var fileName = Path.GetFileName(file); + Console.WriteLine($"Copying: {file} to {Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, fileName)}"); + File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, fileName)); + } + } + else + { + Console.WriteLine("No trx found in TestResults"); + } } } } From e2939c7f1a5c348ad446244a5da76df222510043 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 6 Aug 2020 23:27:06 -0700 Subject: [PATCH 30/31] Remove collector for now --- eng/helix/content/RunTests/TestRunner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index 36b01bd6f95e..a686437d358d 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -247,7 +247,7 @@ public async Task RunTestsAsync() { // Timeout test run 5 minutes before the Helix job would timeout var cts = new CancellationTokenSource(Options.Timeout.Subtract(TimeSpan.FromMinutes(5))); - var commonTestArgs = $"test {Options.Target} --logger:trx --logger:xunit --logger:\"console;verbosity=normal\" --collect:execution --blame \"CollectHangDump;TestTimeout=5m\""; + var commonTestArgs = $"test {Options.Target} --logger:trx --logger:xunit --logger:\"console;verbosity=normal\" --blame \"CollectHangDump;TestTimeout=5m\""; if (Options.Quarantined) { Console.WriteLine("Running quarantined tests."); From b9bf0235bb45c0591795ae15513eb849af4a5647 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Mon, 17 Aug 2020 10:40:39 -0700 Subject: [PATCH 31/31] Update TestRunner.cs --- eng/helix/content/RunTests/TestRunner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index a686437d358d..b9fb3172b8f2 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -247,7 +247,7 @@ public async Task RunTestsAsync() { // Timeout test run 5 minutes before the Helix job would timeout var cts = new CancellationTokenSource(Options.Timeout.Subtract(TimeSpan.FromMinutes(5))); - var commonTestArgs = $"test {Options.Target} --logger:trx --logger:xunit --logger:\"console;verbosity=normal\" --blame \"CollectHangDump;TestTimeout=5m\""; + var commonTestArgs = $"test {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame \"CollectHangDump;TestTimeout=5m\""; if (Options.Quarantined) { Console.WriteLine("Running quarantined tests.");