diff --git a/.azure/pipelines/jobs/default-build.yml b/.azure/pipelines/jobs/default-build.yml index 26c116582f..2c47005dfc 100644 --- a/.azure/pipelines/jobs/default-build.yml +++ b/.azure/pipelines/jobs/default-build.yml @@ -69,6 +69,11 @@ parameters: installJdk: true timeoutInMinutes: 180 + # We need longer than the default amount of 5 minutes to upload our logs/artifacts. (We currently take around 5 mins in the best case). + # This makes sure we have time to upload everything in the case of a build timeout - really important for investigating a build + # timeout due to test hangs. + cancelTimeoutInMinutes: 15 + jobs: - job: ${{ coalesce(parameters.jobName, parameters.agentOs) }} displayName: ${{ coalesce(parameters.jobDisplayName, parameters.agentOs) }} diff --git a/eng/ProjectReferences.props b/eng/ProjectReferences.props index a54507bbb0..5e50238a4b 100644 --- a/eng/ProjectReferences.props +++ b/eng/ProjectReferences.props @@ -101,7 +101,6 @@ - diff --git a/eng/SharedFramework.Local.props b/eng/SharedFramework.Local.props index a86f138f9f..a52c31e0ad 100644 --- a/eng/SharedFramework.Local.props +++ b/eng/SharedFramework.Local.props @@ -73,7 +73,6 @@ - diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9fd0c783a5..dc483752d9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -9,412 +9,412 @@ --> - + https://github.com/aspnet/Blazor - 2b834cef9e511554f9c580545a15d7107aea6cc0 + cd9254a05cfa52defeacd31697d25b2a4ed17510 - + https://github.com/aspnet/AspNetCore-Tooling - 3cbb59559b5c0488bab471c0b8c0f2ecf14d5767 + f039aa935462163dead64ca2d6f9c6d27f4e290b - + https://github.com/aspnet/AspNetCore-Tooling - 3cbb59559b5c0488bab471c0b8c0f2ecf14d5767 + f039aa935462163dead64ca2d6f9c6d27f4e290b - + https://github.com/aspnet/AspNetCore-Tooling - 3cbb59559b5c0488bab471c0b8c0f2ecf14d5767 + f039aa935462163dead64ca2d6f9c6d27f4e290b - + https://github.com/aspnet/AspNetCore-Tooling - 3cbb59559b5c0488bab471c0b8c0f2ecf14d5767 + f039aa935462163dead64ca2d6f9c6d27f4e290b - + https://github.com/aspnet/EntityFrameworkCore - d85ecc7c184862042033e38bee331b81fb6145d5 + 49f9f7632c742108e5652f182922cc35c19c9162 - + https://github.com/aspnet/EntityFrameworkCore - d85ecc7c184862042033e38bee331b81fb6145d5 + 49f9f7632c742108e5652f182922cc35c19c9162 - + https://github.com/aspnet/EntityFrameworkCore - d85ecc7c184862042033e38bee331b81fb6145d5 + 49f9f7632c742108e5652f182922cc35c19c9162 - + https://github.com/aspnet/EntityFrameworkCore - d85ecc7c184862042033e38bee331b81fb6145d5 + 49f9f7632c742108e5652f182922cc35c19c9162 - + https://github.com/aspnet/EntityFrameworkCore - d85ecc7c184862042033e38bee331b81fb6145d5 + 49f9f7632c742108e5652f182922cc35c19c9162 - + https://github.com/aspnet/EntityFrameworkCore - d85ecc7c184862042033e38bee331b81fb6145d5 + 49f9f7632c742108e5652f182922cc35c19c9162 - + https://github.com/aspnet/EntityFrameworkCore - d85ecc7c184862042033e38bee331b81fb6145d5 + 49f9f7632c742108e5652f182922cc35c19c9162 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 https://github.com/dotnet/corefx a28176b5ec68b6da1472934fe9493790d1665cae - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/dotnet/core-setup - c855ac718789051d5d67282c88decca445de7711 + d15a0adeb874801e7bfaa4fbbb306a2efa268497 - + https://github.com/dotnet/core-setup - c855ac718789051d5d67282c88decca445de7711 + d15a0adeb874801e7bfaa4fbbb306a2efa268497 - + https://github.com/dotnet/core-setup - c855ac718789051d5d67282c88decca445de7711 + d15a0adeb874801e7bfaa4fbbb306a2efa268497 - + https://github.com/dotnet/core-setup - c855ac718789051d5d67282c88decca445de7711 + d15a0adeb874801e7bfaa4fbbb306a2efa268497 - + https://github.com/dotnet/corefx - 7c56101d1829e8f317065f99d173834c38c2ec44 + 80f411d58df8338ccd9430900b541a037a9cb383 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 https://github.com/dotnet/arcade @@ -428,13 +428,13 @@ https://github.com/dotnet/arcade a190d4865fe3c86a168ec49c4fc61c90c96ae051 - + https://github.com/aspnet/Extensions - dea3f207c8ea27f2a13ab15880df58ff91b42dfa + 54d000fda95c2c1f05b13a2e910fc91994da8eb8 - + https://github.com/dotnet/roslyn - ef3a7a3863ae53b610a4b0c3682a35cad0829583 + e9b4c66fb2f26bca02d4a718c48c1c39e9963c9f diff --git a/eng/Versions.props b/eng/Versions.props index 97617e19c0..aa382cd021 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 3 0 0 - 8 + 9 preview$(PreReleasePreviewNumber) Preview $(PreReleasePreviewNumber) $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion) @@ -52,115 +52,115 @@ 1.0.0-beta.19369.2 - 3.3.0-beta2-19381-14 + 3.3.0-beta3-19401-01 - 3.0.0-preview8-28380-08 - 3.0.0-preview8-28380-08 - 3.0.0-preview8-28380-08 - 2.1.0-preview8-28380-08 + 3.0.0-preview8-28379-05 + 3.0.0-preview8-28379-05 + 3.0.0-preview8-28379-05 + 2.1.0-preview8-28379-05 - 1.0.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 + 1.0.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 4.7.0-preview6.19264.9 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 1.7.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 - 4.6.0-preview8.19379.7 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 1.7.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 + 4.6.0-preview8.19378.8 - 3.0.0-preview8.19379.7 + 3.0.0-preview8.19378.8 - 3.0.0-preview8.19380.1 + 3.0.0-preview9.19379.2 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 + 3.0.0-preview9.19401.2 - 3.0.0-preview8.19381.5 - 3.0.0-preview8.19381.5 - 3.0.0-preview8.19381.5 - 3.0.0-preview8.19381.5 - 3.0.0-preview8.19381.5 - 3.0.0-preview8.19381.5 - 3.0.0-preview8.19381.5 + 3.0.0-preview9.19402.9 + 3.0.0-preview9.19402.9 + 3.0.0-preview9.19402.9 + 3.0.0-preview9.19402.9 + 3.0.0-preview9.19402.9 + 3.0.0-preview9.19402.9 + 3.0.0-preview9.19402.9 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 - 3.0.0-preview8.19381.3 + 3.0.0-preview9.19402.1 + 3.0.0-preview9.19402.1 + 3.0.0-preview9.19402.1 + 3.0.0-preview9.19402.1 true + + + + false + diff --git a/eng/Workarounds.targets b/eng/Workarounds.targets index f2162e9e86..ed0324f744 100644 --- a/eng/Workarounds.targets +++ b/eng/Workarounds.targets @@ -15,11 +15,6 @@ $(MicrosoftNETCorePlatformsPackageVersion) - - - - - - - - - false - - @@ -54,21 +43,6 @@ - - - - - Microsoft.NETCore.App.Runtime.**RID** - - - - - diff --git a/src/Analyzers/Analyzers/test/TestFiles/CompilationFeatureDetectorTest/StartupWithMapBlazorHub.cs b/src/Analyzers/Analyzers/test/TestFiles/CompilationFeatureDetectorTest/StartupWithMapBlazorHub.cs index 685483a0b1..764ac23bd5 100644 --- a/src/Analyzers/Analyzers/test/TestFiles/CompilationFeatureDetectorTest/StartupWithMapBlazorHub.cs +++ b/src/Analyzers/Analyzers/test/TestFiles/CompilationFeatureDetectorTest/StartupWithMapBlazorHub.cs @@ -13,8 +13,12 @@ namespace Microsoft.AspNetCore.Analyzers.TestFiles.CompilationFeatureDetectorTes app.UseEndpoints(endpoints => { - endpoints.MapBlazorHub(); + endpoints.MapBlazorHub("app"); }); } + + public class App : Microsoft.AspNetCore.Components.ComponentBase + { + } } } diff --git a/src/Components/Analyzers/src/DiagnosticDescriptors.cs b/src/Components/Analyzers/src/DiagnosticDescriptors.cs index a34102f39b..e0ecbce055 100644 --- a/src/Components/Analyzers/src/DiagnosticDescriptors.cs +++ b/src/Components/Analyzers/src/DiagnosticDescriptors.cs @@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers new LocalizableResourceString(nameof(Resources.ComponentParameterSettersShouldBePublic_Title), Resources.ResourceManager, typeof(Resources)), new LocalizableResourceString(nameof(Resources.ComponentParameterSettersShouldBePublic_Format), Resources.ResourceManager, typeof(Resources)), "Encapsulation", - DiagnosticSeverity.Warning, + DiagnosticSeverity.Error, isEnabledByDefault: true, description: new LocalizableResourceString(nameof(Resources.ComponentParameterSettersShouldBePublic_Description), Resources.ResourceManager, typeof(Resources))); @@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers new LocalizableResourceString(nameof(Resources.ComponentParameterShouldBePublic_Title), Resources.ResourceManager, typeof(Resources)), new LocalizableResourceString(nameof(Resources.ComponentParameterShouldBePublic_Format), Resources.ResourceManager, typeof(Resources)), "Encapsulation", - DiagnosticSeverity.Warning, + DiagnosticSeverity.Error, isEnabledByDefault: true, description: new LocalizableResourceString(nameof(Resources.ComponentParametersShouldBePublic_Description), Resources.ResourceManager, typeof(Resources))); diff --git a/src/Components/Analyzers/test/ComponentParameterSettersShouldBePublicTest.cs b/src/Components/Analyzers/test/ComponentParameterSettersShouldBePublicTest.cs index 88b366fd74..f32bc6048e 100644 --- a/src/Components/Analyzers/test/ComponentParameterSettersShouldBePublicTest.cs +++ b/src/Components/Analyzers/test/ComponentParameterSettersShouldBePublicTest.cs @@ -78,7 +78,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers { Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id, Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty1' should have a public setter.", - Severity = DiagnosticSeverity.Warning, + Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 7, 39) @@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers { Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id, Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty2' should have a public setter.", - Severity = DiagnosticSeverity.Warning, + Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 8, 39) @@ -98,7 +98,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers { Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id, Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty3' should have a public setter.", - Severity = DiagnosticSeverity.Warning, + Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 9, 39) diff --git a/src/Components/Analyzers/test/ComponentParametersShouldBePublicCodeFixProviderTest.cs b/src/Components/Analyzers/test/ComponentParametersShouldBePublicCodeFixProviderTest.cs index 69a3f2e310..2e1ee00be0 100644 --- a/src/Components/Analyzers/test/ComponentParametersShouldBePublicCodeFixProviderTest.cs +++ b/src/Components/Analyzers/test/ComponentParametersShouldBePublicCodeFixProviderTest.cs @@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers.Test { Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id, Message = "Component parameter 'ConsoleApplication1.TypeName.BadProperty1' should be public.", - Severity = DiagnosticSeverity.Warning, + Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 8, 40) @@ -85,7 +85,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers.Test { Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id, Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty1' should have a public setter.", - Severity = DiagnosticSeverity.Warning, + Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 8, 39) @@ -95,7 +95,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers.Test { Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id, Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty2' should have a public setter.", - Severity = DiagnosticSeverity.Warning, + Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 9, 39) @@ -105,7 +105,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers.Test { Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id, Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty3' should have a public setter.", - Severity = DiagnosticSeverity.Warning, + Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 10, 39) diff --git a/src/Components/Analyzers/test/ComponentParametersShouldBePublicTest.cs b/src/Components/Analyzers/test/ComponentParametersShouldBePublicTest.cs index 2f03b9ea31..97b01c4699 100644 --- a/src/Components/Analyzers/test/ComponentParametersShouldBePublicTest.cs +++ b/src/Components/Analyzers/test/ComponentParametersShouldBePublicTest.cs @@ -63,7 +63,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers { Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id, Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty1' should be public.", - Severity = DiagnosticSeverity.Warning, + Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 7, 32) @@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers { Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id, Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty2' should be public.", - Severity = DiagnosticSeverity.Warning, + Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 8, 40) @@ -83,7 +83,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers { Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id, Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty3' should be public.", - Severity = DiagnosticSeverity.Warning, + Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 9, 42) @@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers { Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id, Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty4' should be public.", - Severity = DiagnosticSeverity.Warning, + Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 10, 41) diff --git a/src/Components/Blazor/Blazor/ref/Microsoft.AspNetCore.Blazor.netstandard2.0.cs b/src/Components/Blazor/Blazor/ref/Microsoft.AspNetCore.Blazor.netstandard2.0.cs index 3897a0bf62..d56360f9aa 100644 --- a/src/Components/Blazor/Blazor/ref/Microsoft.AspNetCore.Blazor.netstandard2.0.cs +++ b/src/Components/Blazor/Blazor/ref/Microsoft.AspNetCore.Blazor.netstandard2.0.cs @@ -1,6 +1,15 @@ // 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.Blazor +{ + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public static partial class JSInteropMethods + { + [Microsoft.JSInterop.JSInvokableAttribute("NotifyLocationChanged")] + public static void NotifyLocationChanged(string uri, bool isInterceptedLink) { } + } +} namespace Microsoft.AspNetCore.Blazor.Hosting { public static partial class BlazorWebAssemblyHost @@ -62,24 +71,12 @@ namespace Microsoft.AspNetCore.Blazor.Rendering public override Microsoft.AspNetCore.Components.Dispatcher Dispatcher { get { throw null; } } public System.Threading.Tasks.Task AddComponentAsync(System.Type componentType, string domElementSelector) { throw null; } public System.Threading.Tasks.Task AddComponentAsync(string domElementSelector) where TComponent : Microsoft.AspNetCore.Components.IComponent { throw null; } - public override System.Threading.Tasks.Task DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.Rendering.EventFieldInfo eventFieldInfo, Microsoft.AspNetCore.Components.UIEventArgs eventArgs) { throw null; } + public override System.Threading.Tasks.Task DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.Rendering.EventFieldInfo eventFieldInfo, System.EventArgs eventArgs) { throw null; } protected override void Dispose(bool disposing) { } protected override void HandleException(System.Exception exception) { } protected override System.Threading.Tasks.Task UpdateDisplayAsync(in Microsoft.AspNetCore.Components.Rendering.RenderBatch batch) { throw null; } } } -namespace Microsoft.AspNetCore.Blazor.Services -{ - public partial class WebAssemblyUriHelper : Microsoft.AspNetCore.Components.UriHelperBase - { - internal WebAssemblyUriHelper() { } - public static readonly Microsoft.AspNetCore.Blazor.Services.WebAssemblyUriHelper Instance; - protected override void EnsureInitialized() { } - protected override void NavigateToCore(string uri, bool forceLoad) { } - [Microsoft.JSInterop.JSInvokableAttribute("NotifyLocationChanged")] - public static void NotifyLocationChanged(string newAbsoluteUri, bool isInterceptedLink) { } - } -} namespace Microsoft.AspNetCore.Components.Builder { public static partial class ComponentsApplicationBuilderExtensions diff --git a/src/Components/Blazor/Blazor/src/Hosting/WebAssemblyHostBuilder.cs b/src/Components/Blazor/Blazor/src/Hosting/WebAssemblyHostBuilder.cs index 0b741cbd22..87bdc951c2 100644 --- a/src/Components/Blazor/Blazor/src/Hosting/WebAssemblyHostBuilder.cs +++ b/src/Components/Blazor/Blazor/src/Hosting/WebAssemblyHostBuilder.cs @@ -92,16 +92,16 @@ namespace Microsoft.AspNetCore.Blazor.Hosting services.AddSingleton(); services.AddSingleton(WebAssemblyJSRuntime.Instance); services.AddSingleton(); - services.AddSingleton(WebAssemblyUriHelper.Instance); + services.AddSingleton(WebAssemblyNavigationManager.Instance); services.AddSingleton(WebAssemblyNavigationInterception.Instance); services.AddSingleton(); services.AddSingleton(s => { // Creating the URI helper needs to wait until the JS Runtime is initialized, so defer it. - var uriHelper = s.GetRequiredService(); + var navigationManager = s.GetRequiredService(); return new HttpClient { - BaseAddress = new Uri(WebAssemblyUriHelper.Instance.GetBaseUri()) + BaseAddress = new Uri(navigationManager.BaseUri) }; }); diff --git a/src/Components/Blazor/Blazor/src/JSInteropMethods.cs b/src/Components/Blazor/Blazor/src/JSInteropMethods.cs new file mode 100644 index 0000000000..239dbb4952 --- /dev/null +++ b/src/Components/Blazor/Blazor/src/JSInteropMethods.cs @@ -0,0 +1,26 @@ +// 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.ComponentModel; +using Microsoft.AspNetCore.Blazor.Services; +using Microsoft.JSInterop; + +namespace Microsoft.AspNetCore.Blazor +{ + /// + /// Contains methods called by interop. Intended for framework use only, not supported for use in application + /// code. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static class JSInteropMethods + { + /// + /// For framework use only. + /// + [JSInvokable(nameof(NotifyLocationChanged))] + public static void NotifyLocationChanged(string uri, bool isInterceptedLink) + { + WebAssemblyNavigationManager.Instance.SetLocation(uri, isInterceptedLink); + } + } +} diff --git a/src/Components/Blazor/Blazor/src/Rendering/WebAssemblyRenderer.cs b/src/Components/Blazor/Blazor/src/Rendering/WebAssemblyRenderer.cs index 528816e492..d4e867621e 100644 --- a/src/Components/Blazor/Blazor/src/Rendering/WebAssemblyRenderer.cs +++ b/src/Components/Blazor/Blazor/src/Rendering/WebAssemblyRenderer.cs @@ -120,7 +120,7 @@ namespace Microsoft.AspNetCore.Blazor.Rendering } /// - public override Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo eventFieldInfo, UIEventArgs eventArgs) + public override Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo eventFieldInfo, EventArgs eventArgs) { // Be sure we only run one event handler at once. Although they couldn't run // simultaneously anyway (there's only one thread), they could run nested on @@ -185,10 +185,10 @@ namespace Microsoft.AspNetCore.Blazor.Rendering { public readonly ulong EventHandlerId; public readonly EventFieldInfo EventFieldInfo; - public readonly UIEventArgs EventArgs; + public readonly EventArgs EventArgs; public readonly TaskCompletionSource TaskCompletionSource; - public IncomingEventInfo(ulong eventHandlerId, EventFieldInfo eventFieldInfo, UIEventArgs eventArgs) + public IncomingEventInfo(ulong eventHandlerId, EventFieldInfo eventFieldInfo, EventArgs eventArgs) { EventHandlerId = eventHandlerId; EventFieldInfo = eventFieldInfo; diff --git a/src/Components/Blazor/Blazor/src/Services/WebAssemblyNavigationInterception.cs b/src/Components/Blazor/Blazor/src/Services/WebAssemblyNavigationInterception.cs index f7aac51137..74eacbc4f5 100644 --- a/src/Components/Blazor/Blazor/src/Services/WebAssemblyNavigationInterception.cs +++ b/src/Components/Blazor/Blazor/src/Services/WebAssemblyNavigationInterception.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Components.Routing; -using Interop = Microsoft.AspNetCore.Components.Web.BrowserUriHelperInterop; +using Interop = Microsoft.AspNetCore.Components.Web.BrowserNavigationManagerInterop; namespace Microsoft.AspNetCore.Blazor.Services { diff --git a/src/Components/Blazor/Blazor/src/Services/WebAssemblyNavigationManager.cs b/src/Components/Blazor/Blazor/src/Services/WebAssemblyNavigationManager.cs new file mode 100644 index 0000000000..9d52c8c9a2 --- /dev/null +++ b/src/Components/Blazor/Blazor/src/Services/WebAssemblyNavigationManager.cs @@ -0,0 +1,53 @@ +// 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.Components; +using Interop = Microsoft.AspNetCore.Components.Web.BrowserNavigationManagerInterop; + +namespace Microsoft.AspNetCore.Blazor.Services +{ + /// + /// Default client-side implementation of . + /// + internal class WebAssemblyNavigationManager : NavigationManager + { + /// + /// Gets the instance of . + /// + public static readonly WebAssemblyNavigationManager Instance = new WebAssemblyNavigationManager(); + + // For simplicity we force public consumption of the BrowserNavigationManager through + // a singleton. Only a single instance can be updated by the browser through + // interop. We can construct instances for testing. + internal WebAssemblyNavigationManager() + { + } + + protected override void EnsureInitialized() + { + // As described in the comment block above, BrowserNavigationManager is only for + // client-side (Mono) use, so it's OK to rely on synchronicity here. + var baseUri = WebAssemblyJSRuntime.Instance.Invoke(Interop.GetBaseUri); + var uri = WebAssemblyJSRuntime.Instance.Invoke(Interop.GetLocationHref); + Initialize(baseUri, uri); + } + + public void SetLocation(string uri, bool isInterceptedLink) + { + Uri = uri; + NotifyLocationChanged(isInterceptedLink); + } + + /// + protected override void NavigateToCore(string uri, bool forceLoad) + { + if (uri == null) + { + throw new ArgumentNullException(nameof(uri)); + } + + WebAssemblyJSRuntime.Instance.Invoke(Interop.NavigateTo, uri, forceLoad); + } + } +} diff --git a/src/Components/Blazor/Blazor/src/Services/WebAssemblyUriHelper.cs b/src/Components/Blazor/Blazor/src/Services/WebAssemblyUriHelper.cs deleted file mode 100644 index 957a2e760c..0000000000 --- a/src/Components/Blazor/Blazor/src/Services/WebAssemblyUriHelper.cs +++ /dev/null @@ -1,85 +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; -using Microsoft.AspNetCore.Components; -using Microsoft.JSInterop; -using Interop = Microsoft.AspNetCore.Components.Web.BrowserUriHelperInterop; - -namespace Microsoft.AspNetCore.Blazor.Services -{ - /// - /// Default client-side implementation of . - /// - public class WebAssemblyUriHelper : UriHelperBase - { - /// - /// Gets the instance of . - /// - public static readonly WebAssemblyUriHelper Instance = new WebAssemblyUriHelper(); - - // For simplicity we force public consumption of the BrowserUriHelper through - // a singleton. Only a single instance can be updated by the browser through - // interop. We can construct instances for testing. - internal WebAssemblyUriHelper() - { - } - - protected override void EnsureInitialized() - { - WebAssemblyJSRuntime.Instance.Invoke( - Interop.ListenForNavigationEvents, - typeof(WebAssemblyUriHelper).Assembly.GetName().Name, - nameof(NotifyLocationChanged)); - - // As described in the comment block above, BrowserUriHelper is only for - // client-side (Mono) use, so it's OK to rely on synchronicity here. - var baseUri = WebAssemblyJSRuntime.Instance.Invoke(Interop.GetBaseUri); - var uri = WebAssemblyJSRuntime.Instance.Invoke(Interop.GetLocationHref); - InitializeState(uri, baseUri); - } - - /// - protected override void NavigateToCore(string uri, bool forceLoad) - { - if (uri == null) - { - throw new ArgumentNullException(nameof(uri)); - } - - WebAssemblyJSRuntime.Instance.Invoke(Interop.NavigateTo, uri, forceLoad); - } - - /// - /// For framework use only. - /// - [JSInvokable(nameof(NotifyLocationChanged))] - public static void NotifyLocationChanged(string newAbsoluteUri, bool isInterceptedLink) - { - Instance.SetAbsoluteUri(newAbsoluteUri); - Instance.TriggerOnLocationChanged(isInterceptedLink); - } - - /// - /// Given the document's document.baseURI value, returns the URI - /// that can be prepended to relative URI paths to produce an absolute URI. - /// This is computed by removing anything after the final slash. - /// Internal for tests. - /// - /// The page's document.baseURI value. - /// The URI prefix - internal static string ToBaseUri(string absoluteBaseUri) - { - if (absoluteBaseUri != null) - { - var lastSlashIndex = absoluteBaseUri.LastIndexOf('/'); - if (lastSlashIndex >= 0) - { - return absoluteBaseUri.Substring(0, lastSlashIndex + 1); - } - } - - return "/"; - } - } -} diff --git a/src/Components/Blazor/Blazor/test/WebAssemblyUriHelperTest.cs b/src/Components/Blazor/Blazor/test/WebAssemblyUriHelperTest.cs deleted file mode 100644 index 2903d7fcd3..0000000000 --- a/src/Components/Blazor/Blazor/test/WebAssemblyUriHelperTest.cs +++ /dev/null @@ -1,57 +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; -using Xunit; - -namespace Microsoft.AspNetCore.Blazor.Services.Test -{ - public class WebAssemblyUriHelperTest - { - private WebAssemblyUriHelper _uriHelper = new WebAssemblyUriHelper(); - - [Theory] - [InlineData("scheme://host/", "scheme://host/")] - [InlineData("scheme://host:123/", "scheme://host:123/")] - [InlineData("scheme://host/path", "scheme://host/")] - [InlineData("scheme://host/path/", "scheme://host/path/")] - [InlineData("scheme://host/path/page?query=string&another=here", "scheme://host/path/")] - public void ComputesCorrectBaseUri(string baseUri, string expectedResult) - { - var actualResult = WebAssemblyUriHelper.ToBaseUri(baseUri); - Assert.Equal(expectedResult, actualResult); - } - - [Theory] - [InlineData("scheme://host/", "scheme://host", "")] - [InlineData("scheme://host/", "scheme://host/", "")] - [InlineData("scheme://host/", "scheme://host/path", "path")] - [InlineData("scheme://host/path/", "scheme://host/path/", "")] - [InlineData("scheme://host/path/", "scheme://host/path/more", "more")] - [InlineData("scheme://host/path/", "scheme://host/path", "")] - [InlineData("scheme://host/path/", "scheme://host/path#hash", "#hash")] - [InlineData("scheme://host/path/", "scheme://host/path/#hash", "#hash")] - [InlineData("scheme://host/path/", "scheme://host/path/more#hash", "more#hash")] - public void ComputesCorrectValidBaseRelativePaths(string baseUri, string absoluteUri, string expectedResult) - { - var actualResult = _uriHelper.ToBaseRelativePath(baseUri, absoluteUri); - Assert.Equal(expectedResult, actualResult); - } - - [Theory] - [InlineData("scheme://host/", "otherscheme://host/")] - [InlineData("scheme://host/", "scheme://otherhost/")] - [InlineData("scheme://host/path/", "scheme://host/")] - public void ThrowsForInvalidBaseRelativePaths(string baseUri, string absoluteUri) - { - var ex = Assert.Throws(() => - { - _uriHelper.ToBaseRelativePath(baseUri, absoluteUri); - }); - - Assert.Equal( - $"The URI '{absoluteUri}' is not contained by the base URI '{baseUri}'.", - ex.Message); - } - } -} diff --git a/src/Components/Blazor/Build/src/ReferenceFromSource.props b/src/Components/Blazor/Build/src/ReferenceFromSource.props index 6c708e4cab..927ec8c757 100644 --- a/src/Components/Blazor/Build/src/ReferenceFromSource.props +++ b/src/Components/Blazor/Build/src/ReferenceFromSource.props @@ -46,12 +46,11 @@ true TargetFramework + + false + + true + TargetFramework + - - - - true - diff --git a/src/Components/Blazor/Build/test/ComponentRenderingRazorIntegrationTest.cs b/src/Components/Blazor/Build/test/ComponentRenderingRazorIntegrationTest.cs index abfdd07793..6c0a7fab96 100644 --- a/src/Components/Blazor/Build/test/ComponentRenderingRazorIntegrationTest.cs +++ b/src/Components/Blazor/Build/test/ComponentRenderingRazorIntegrationTest.cs @@ -253,7 +253,7 @@ namespace Test public class MyComponent : ComponentBase { [Parameter] - public Action OnClick { get; set; } + public Action OnClick { get; set; } } } ")); @@ -263,7 +263,7 @@ namespace Test @code { private int counter; - private void Increment(UIEventArgs e) { + private void Increment(EventArgs e) { counter++; } }"); @@ -280,7 +280,7 @@ namespace Test AssertFrame.Attribute(frame, "OnClick", 1); // The handler will have been assigned to a lambda - var handler = Assert.IsType>(frame.AttributeValue); + var handler = Assert.IsType>(frame.AttributeValue); Assert.Equal("Test.TestComponent", handler.Target.GetType().FullName); Assert.Equal("Increment", handler.Method.Name); }); diff --git a/src/Components/Blazor/Build/test/RenderingRazorIntegrationTest.cs b/src/Components/Blazor/Build/test/RenderingRazorIntegrationTest.cs index 8b91c024b4..990ec1db18 100644 --- a/src/Components/Blazor/Build/test/RenderingRazorIntegrationTest.cs +++ b/src/Components/Blazor/Build/test/RenderingRazorIntegrationTest.cs @@ -332,7 +332,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test // Trigger the change event to show it updates the property // // This should always complete synchronously. - var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = "Modified value", })); + var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = "Modified value", })); Assert.Equal(TaskStatus.RanToCompletion, task.Status); await task; @@ -367,7 +367,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test // Trigger the change event to show it updates the property // // This should always complete synchronously. - var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = "Modified value", })); + var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = "Modified value", })); Assert.Equal(TaskStatus.RanToCompletion, task.Status); await task; @@ -404,7 +404,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test // // This should always complete synchronously. var newDateValue = new DateTime(2018, 3, 5, 4, 5, 6); - var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = newDateValue.ToString(), })); + var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = newDateValue.ToString(), })); Assert.Equal(TaskStatus.RanToCompletion, task.Status); await task; @@ -440,7 +440,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test // Trigger the change event to show it updates the property // // This should always complete synchronously. - var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = new DateTime(2018, 3, 5).ToString(testDateFormat), })); + var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = new DateTime(2018, 3, 5).ToString(testDateFormat), })); Assert.Equal(TaskStatus.RanToCompletion, task.Status); await task; @@ -559,7 +559,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test // Trigger the change event to show it updates the property // // This should always complete synchronously. - var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs() { Value = false, })); + var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs() { Value = false, })); Assert.Equal(TaskStatus.RanToCompletion, task.Status); await task; @@ -595,7 +595,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test // Trigger the change event to show it updates the property // // This should always complete synchronously. - var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = MyEnum.SecondValue.ToString(), })); + var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = MyEnum.SecondValue.ToString(), })); Assert.Equal(TaskStatus.RanToCompletion, task.Status); await task; diff --git a/src/Components/Blazor/Templates/src/Microsoft.AspNetCore.Blazor.Templates.csproj b/src/Components/Blazor/Templates/src/Microsoft.AspNetCore.Blazor.Templates.csproj index b0120ab08b..c91a32128d 100644 --- a/src/Components/Blazor/Templates/src/Microsoft.AspNetCore.Blazor.Templates.csproj +++ b/src/Components/Blazor/Templates/src/Microsoft.AspNetCore.Blazor.Templates.csproj @@ -1,5 +1,4 @@ - - + netstandard2.0 Microsoft.AspNetCore.Blazor.Templates.nuspec @@ -16,18 +15,31 @@ false - - + + + + + <_TemplateConfigMainFile Include="content\**\.template.config.src\template.json" /> - <_TemplateConfigDir Include="@(_TemplateConfigMainFile->'$([System.IO.Path]::GetDirectoryName('%(_TemplateConfigMainFile.FullPath)'))')" /> + <_TemplateConfigDir Include="@(_TemplateConfigMainFile->'$([System.IO.Path]::GetDirectoryName('%(_TemplateConfigMainFile.FullPath)'))')" /> <_TemplateConfigFileToCopy Include="%(_TemplateConfigDir.Identity)\**\*.*"> $([System.IO.Path]::GetDirectoryName('%(_TemplateConfigDir.Identity)'))\.template.config\ + + + + + @@ -49,8 +61,4 @@ - - - - diff --git a/src/Components/Blazor/Templates/src/content/BlazorWasm-CSharp/Client/App.razor b/src/Components/Blazor/Templates/src/content/BlazorWasm-CSharp/Client/App.razor index eb5c93b6de..c5ee6a53e2 100644 --- a/src/Components/Blazor/Templates/src/content/BlazorWasm-CSharp/Client/App.razor +++ b/src/Components/Blazor/Templates/src/content/BlazorWasm-CSharp/Client/App.razor @@ -1,5 +1,5 @@  - +

Sorry, there's nothing at this address.

-
+
diff --git a/src/Components/Components.sln b/src/Components/Components.sln index 2627baf699..e80d4396f9 100644 --- a/src/Components/Components.sln +++ b/src/Components/Components.sln @@ -208,8 +208,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\..\.editorconfig = ..\..\.editorconfig EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Components.Prerendering", "..\Mvc\Mvc.Components.Prerendering\src\Microsoft.AspNetCore.Mvc.Components.Prerendering.csproj", "{3A4132B6-60DA-43A0-8E7B-4BF346F3247C}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.SignalR.Protocols.Json", "..\SignalR\common\Protocols.Json\src\Microsoft.AspNetCore.SignalR.Protocols.Json.csproj", "{ED210157-461B-45BB-9D86-B81A62792C30}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.SignalR.Client", "..\SignalR\clients\csharp\Client\src\Microsoft.AspNetCore.SignalR.Client.csproj", "{DA137BD4-F7F1-4D53-855F-5EC40CEA36B0}" @@ -1330,18 +1328,6 @@ Global {9088E4E4-B855-457F-AE9E-D86709A5E1F4}.Release|x64.Build.0 = Debug|Any CPU {9088E4E4-B855-457F-AE9E-D86709A5E1F4}.Release|x86.ActiveCfg = Debug|Any CPU {9088E4E4-B855-457F-AE9E-D86709A5E1F4}.Release|x86.Build.0 = Debug|Any CPU - {3A4132B6-60DA-43A0-8E7B-4BF346F3247C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3A4132B6-60DA-43A0-8E7B-4BF346F3247C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3A4132B6-60DA-43A0-8E7B-4BF346F3247C}.Debug|x64.ActiveCfg = Debug|Any CPU - {3A4132B6-60DA-43A0-8E7B-4BF346F3247C}.Debug|x64.Build.0 = Debug|Any CPU - {3A4132B6-60DA-43A0-8E7B-4BF346F3247C}.Debug|x86.ActiveCfg = Debug|Any CPU - {3A4132B6-60DA-43A0-8E7B-4BF346F3247C}.Debug|x86.Build.0 = Debug|Any CPU - {3A4132B6-60DA-43A0-8E7B-4BF346F3247C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3A4132B6-60DA-43A0-8E7B-4BF346F3247C}.Release|Any CPU.Build.0 = Release|Any CPU - {3A4132B6-60DA-43A0-8E7B-4BF346F3247C}.Release|x64.ActiveCfg = Release|Any CPU - {3A4132B6-60DA-43A0-8E7B-4BF346F3247C}.Release|x64.Build.0 = Release|Any CPU - {3A4132B6-60DA-43A0-8E7B-4BF346F3247C}.Release|x86.ActiveCfg = Release|Any CPU - {3A4132B6-60DA-43A0-8E7B-4BF346F3247C}.Release|x86.Build.0 = Release|Any CPU {ED210157-461B-45BB-9D86-B81A62792C30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ED210157-461B-45BB-9D86-B81A62792C30}.Debug|Any CPU.Build.0 = Debug|Any CPU {ED210157-461B-45BB-9D86-B81A62792C30}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -1548,7 +1534,6 @@ Global {04262990-929C-42BF-85A9-21C25FA95617} = {2FC10057-7A0A-4E34-8302-879925BC0102} {DC47C40A-FC38-44E4-94A4-ADE794E76309} = {2FC10057-7A0A-4E34-8302-879925BC0102} {9088E4E4-B855-457F-AE9E-D86709A5E1F4} = {7260DED9-22A9-4E9D-92F4-5E8A4404DEAF} - {3A4132B6-60DA-43A0-8E7B-4BF346F3247C} = {2FC10057-7A0A-4E34-8302-879925BC0102} {ED210157-461B-45BB-9D86-B81A62792C30} = {2FC10057-7A0A-4E34-8302-879925BC0102} {DA137BD4-F7F1-4D53-855F-5EC40CEA36B0} = {2FC10057-7A0A-4E34-8302-879925BC0102} {0CDAB70B-71DC-43BE-ACB7-AD2EE3541FFB} = {2FC10057-7A0A-4E34-8302-879925BC0102} diff --git a/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs b/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs index a4d8a9c9be..4f317be0ff 100644 --- a/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs +++ b/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs @@ -119,6 +119,11 @@ namespace Microsoft.AspNetCore.Components public void Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { } public System.Threading.Tasks.Task SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView parameters) { throw null; } } + public partial class ChangeEventArgs : System.EventArgs + { + public ChangeEventArgs() { } + public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } public abstract partial class ComponentBase : Microsoft.AspNetCore.Components.IComponent, Microsoft.AspNetCore.Components.IHandleAfterRender, Microsoft.AspNetCore.Components.IHandleEvent { public ComponentBase() { } @@ -188,35 +193,35 @@ namespace Microsoft.AspNetCore.Components } public static partial class EventCallbackFactoryBinderExtensions { - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, bool existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, decimal existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, double existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, int existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, long existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, bool? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, decimal? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, double? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, int? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, long? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, float? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, float existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, string existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, T existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, bool existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, decimal existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, double existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, int existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, long existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, bool? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, decimal? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, double? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, int? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, long? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, float? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, float existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, string existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, T existingValue, System.Globalization.CultureInfo culture = null) { throw null; } } - public static partial class EventCallbackFactoryUIEventArgsExtensions + public static partial class EventCallbackFactoryEventArgsExtensions { - public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action callback) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action callback) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func callback) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func callback) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action callback) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action callback) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func callback) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func callback) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct EventCallbackWorkItem @@ -261,16 +266,6 @@ namespace Microsoft.AspNetCore.Components { public InjectAttribute() { } } - public partial interface IUriHelper - { - event System.EventHandler OnLocationChanged; - string GetAbsoluteUri(); - string GetBaseUri(); - void NavigateTo(string uri); - void NavigateTo(string uri, bool forceLoad); - System.Uri ToAbsoluteUri(string href); - string ToBaseRelativePath(string baseUri, string locationAbsolute); - } [System.AttributeUsageAttribute(System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)] public sealed partial class LayoutAttribute : System.Attribute { @@ -283,6 +278,10 @@ namespace Microsoft.AspNetCore.Components [Microsoft.AspNetCore.Components.ParameterAttribute] public Microsoft.AspNetCore.Components.RenderFragment Body { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } + public sealed partial class LocationChangeException : System.Exception + { + public LocationChangeException(string message, System.Exception innerException) { } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MarkupString { @@ -297,13 +296,40 @@ namespace Microsoft.AspNetCore.Components public NavigationException(string uri) { } public string Location { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } } + public abstract partial class NavigationManager + { + protected NavigationManager() { } + public string BaseUri { get { throw null; } protected set { } } + public string Uri { get { throw null; } protected set { } } + public event System.EventHandler LocationChanged { add { } remove { } } + protected virtual void EnsureInitialized() { } + protected void Initialize(string baseUri, string uri) { } + public void NavigateTo(string uri, bool forceLoad = false) { } + protected abstract void NavigateToCore(string uri, bool forceLoad); + protected void NotifyLocationChanged(bool isInterceptedLink) { } + public System.Uri ToAbsoluteUri(string relativeUri) { throw null; } + public string ToBaseRelativePath(string uri) { throw null; } + } + public abstract partial class OwningComponentBase : Microsoft.AspNetCore.Components.ComponentBase, System.IDisposable + { + protected OwningComponentBase() { } + protected bool IsDisposed { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + protected System.IServiceProvider ScopedServices { get { throw null; } } + protected virtual void Dispose(bool disposing) { } + void System.IDisposable.Dispose() { } + } + public abstract partial class OwningComponentBase : Microsoft.AspNetCore.Components.OwningComponentBase, System.IDisposable + { + protected OwningComponentBase() { } + protected TService Service { get { throw null; } } + } public partial class PageDisplay : Microsoft.AspNetCore.Components.IComponent { public PageDisplay() { } [Microsoft.AspNetCore.Components.ParameterAttribute] - public Microsoft.AspNetCore.Components.RenderFragment AuthorizingContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.AspNetCore.Components.RenderFragment Authorizing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Components.ParameterAttribute] - public Microsoft.AspNetCore.Components.RenderFragment NotAuthorizedContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.AspNetCore.Components.RenderFragment NotAuthorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Components.ParameterAttribute] public System.Type Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Components.ParameterAttribute] @@ -365,33 +391,6 @@ namespace Microsoft.AspNetCore.Components public RouteAttribute(string template) { } public string Template { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } } - public partial class UIChangeEventArgs : Microsoft.AspNetCore.Components.UIEventArgs - { - public UIChangeEventArgs() { } - public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public partial class UIEventArgs - { - public UIEventArgs() { } - public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public abstract partial class UriHelperBase : Microsoft.AspNetCore.Components.IUriHelper - { - protected UriHelperBase() { } - public event System.EventHandler OnLocationChanged { add { } remove { } } - protected virtual void EnsureInitialized() { } - public string GetAbsoluteUri() { throw null; } - public virtual string GetBaseUri() { throw null; } - public virtual void InitializeState(string uriAbsolute, string baseUriAbsolute) { } - public void NavigateTo(string uri) { } - public void NavigateTo(string uri, bool forceLoad) { } - protected abstract void NavigateToCore(string uri, bool forceLoad); - protected void SetAbsoluteBaseUri(string baseUri) { } - protected void SetAbsoluteUri(string uri) { } - public System.Uri ToAbsoluteUri(string href) { throw null; } - public string ToBaseRelativePath(string baseUri, string locationAbsolute) { throw null; } - protected void TriggerOnLocationChanged(bool isinterceptedLink) { } - } } namespace Microsoft.AspNetCore.Components.CompilerServices { @@ -419,8 +418,10 @@ namespace Microsoft.AspNetCore.Components.Forms public Microsoft.AspNetCore.Components.Forms.FieldIdentifier Field(string fieldName) { throw null; } public System.Collections.Generic.IEnumerable GetValidationMessages() { throw null; } public System.Collections.Generic.IEnumerable GetValidationMessages(Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { throw null; } + public System.Collections.Generic.IEnumerable GetValidationMessages(System.Linq.Expressions.Expression> accessor) { throw null; } public bool IsModified() { throw null; } public bool IsModified(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { throw null; } + public bool IsModified(System.Linq.Expressions.Expression> accessor) { throw null; } public void MarkAsUnmodified() { } public void MarkAsUnmodified(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { } public void NotifyFieldChanged(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { } @@ -431,24 +432,20 @@ namespace Microsoft.AspNetCore.Components.Forms { public static Microsoft.AspNetCore.Components.Forms.EditContext AddDataAnnotationsValidation(this Microsoft.AspNetCore.Components.Forms.EditContext editContext) { throw null; } } - public static partial class EditContextExpressionExtensions + public sealed partial class FieldChangedEventArgs : System.EventArgs { - public static System.Collections.Generic.IEnumerable GetValidationMessages(this Microsoft.AspNetCore.Components.Forms.EditContext editContext, System.Linq.Expressions.Expression> accessor) { throw null; } - public static bool IsModified(this Microsoft.AspNetCore.Components.Forms.EditContext editContext, System.Linq.Expressions.Expression> accessor) { throw null; } - } - public sealed partial class FieldChangedEventArgs - { - internal FieldChangedEventArgs() { } + public FieldChangedEventArgs(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { } public Microsoft.AspNetCore.Components.Forms.FieldIdentifier FieldIdentifier { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct FieldIdentifier + public readonly partial struct FieldIdentifier : System.IEquatable { private readonly object _dummy; public FieldIdentifier(object model, string fieldName) { throw null; } public string FieldName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public object Model { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public static Microsoft.AspNetCore.Components.Forms.FieldIdentifier Create(System.Linq.Expressions.Expression> accessor) { throw null; } + public bool Equals(Microsoft.AspNetCore.Components.Forms.FieldIdentifier otherIdentifier) { throw null; } public override bool Equals(object obj) { throw null; } public override int GetHashCode() { throw null; } } @@ -457,24 +454,23 @@ namespace Microsoft.AspNetCore.Components.Forms public ValidationMessageStore(Microsoft.AspNetCore.Components.Forms.EditContext editContext) { } public System.Collections.Generic.IEnumerable this[Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier] { get { throw null; } } public System.Collections.Generic.IEnumerable this[System.Linq.Expressions.Expression> accessor] { get { throw null; } } + public void Add(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier, System.Collections.Generic.IEnumerable messages) { } public void Add(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier, string message) { } - public void AddRange(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier, System.Collections.Generic.IEnumerable messages) { } + public void Add(System.Linq.Expressions.Expression> accessor, System.Collections.Generic.IEnumerable messages) { } + public void Add(System.Linq.Expressions.Expression> accessor, string message) { } public void Clear() { } public void Clear(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { } + public void Clear(System.Linq.Expressions.Expression> accessor) { } } - public static partial class ValidationMessageStoreExpressionExtensions + public sealed partial class ValidationRequestedEventArgs : System.EventArgs { - public static void Add(this Microsoft.AspNetCore.Components.Forms.ValidationMessageStore store, System.Linq.Expressions.Expression> accessor, string message) { } - public static void AddRange(this Microsoft.AspNetCore.Components.Forms.ValidationMessageStore store, System.Linq.Expressions.Expression> accessor, System.Collections.Generic.IEnumerable messages) { } - public static void Clear(this Microsoft.AspNetCore.Components.Forms.ValidationMessageStore store, System.Linq.Expressions.Expression> accessor) { } + public static readonly new Microsoft.AspNetCore.Components.Forms.ValidationRequestedEventArgs Empty; + public ValidationRequestedEventArgs() { } } - public sealed partial class ValidationRequestedEventArgs + public sealed partial class ValidationStateChangedEventArgs : System.EventArgs { - internal ValidationRequestedEventArgs() { } - } - public sealed partial class ValidationStateChangedEventArgs - { - internal ValidationStateChangedEventArgs() { } + public static readonly new Microsoft.AspNetCore.Components.Forms.ValidationStateChangedEventArgs Empty; + public ValidationStateChangedEventArgs() { } } } namespace Microsoft.AspNetCore.Components.Rendering @@ -519,7 +515,7 @@ namespace Microsoft.AspNetCore.Components.Rendering public event System.UnhandledExceptionEventHandler UnhandledSynchronizationException { add { } remove { } } protected internal virtual void AddToRenderQueue(int componentId, Microsoft.AspNetCore.Components.RenderFragment renderFragment) { } protected internal int AssignRootComponentId(Microsoft.AspNetCore.Components.IComponent component) { throw null; } - public virtual System.Threading.Tasks.Task DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.Rendering.EventFieldInfo fieldInfo, Microsoft.AspNetCore.Components.UIEventArgs eventArgs) { throw null; } + public virtual System.Threading.Tasks.Task DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.Rendering.EventFieldInfo fieldInfo, System.EventArgs eventArgs) { throw null; } public void Dispose() { } protected virtual void Dispose(bool disposing) { } protected abstract void HandleException(System.Exception exception); @@ -632,16 +628,17 @@ namespace Microsoft.AspNetCore.Components.RenderTree } namespace Microsoft.AspNetCore.Components.Routing { + public partial interface IHostEnvironmentNavigationManager + { + void Initialize(string baseUri, string uri); + } public partial interface INavigationInterception { System.Threading.Tasks.Task EnableNavigationInterceptionAsync(); } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct LocationChangedEventArgs + public partial class LocationChangedEventArgs : System.EventArgs { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public LocationChangedEventArgs(string location, bool isNavigationIntercepted) { throw null; } + public LocationChangedEventArgs(string location, bool isNavigationIntercepted) { } public bool IsNavigationIntercepted { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public string Location { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } } @@ -651,11 +648,11 @@ namespace Microsoft.AspNetCore.Components.Routing [Microsoft.AspNetCore.Components.ParameterAttribute] public System.Reflection.Assembly AppAssembly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Components.ParameterAttribute] - public Microsoft.AspNetCore.Components.RenderFragment AuthorizingContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.AspNetCore.Components.RenderFragment Authorizing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Components.ParameterAttribute] - public Microsoft.AspNetCore.Components.RenderFragment NotAuthorizedContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.AspNetCore.Components.RenderFragment NotAuthorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Components.ParameterAttribute] - public Microsoft.AspNetCore.Components.RenderFragment NotFoundContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.AspNetCore.Components.RenderFragment NotFound { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public void Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { } public void Dispose() { } System.Threading.Tasks.Task Microsoft.AspNetCore.Components.IHandleAfterRender.OnAfterRenderAsync() { throw null; } diff --git a/src/Components/Components/src/Auth/AuthorizeViewCore.cs b/src/Components/Components/src/Auth/AuthorizeViewCore.cs index 8581e6fb6d..8c60078184 100644 --- a/src/Components/Components/src/Auth/AuthorizeViewCore.cs +++ b/src/Components/Components/src/Auth/AuthorizeViewCore.cs @@ -58,8 +58,8 @@ namespace Microsoft.AspNetCore.Components } else if (isAuthorized) { - var authorizedContent = Authorized ?? ChildContent; - builder.AddContent(1, authorizedContent?.Invoke(currentAuthenticationState)); + var authorized = Authorized ?? ChildContent; + builder.AddContent(1, authorized?.Invoke(currentAuthenticationState)); } else { diff --git a/src/Components/Components/src/UIEventArgs.cs b/src/Components/Components/src/ChangeEventArgs.cs similarity index 58% rename from src/Components/Components/src/UIEventArgs.cs rename to src/Components/Components/src/ChangeEventArgs.cs index 8be500d2ae..e64e4c10c7 100644 --- a/src/Components/Components/src/UIEventArgs.cs +++ b/src/Components/Components/src/ChangeEventArgs.cs @@ -1,16 +1,19 @@ // 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; + namespace Microsoft.AspNetCore.Components { /// - /// Supplies information about an event that is being raised. + /// Supplies information about an change event that is being raised. /// - public class UIEventArgs + public class ChangeEventArgs : EventArgs { /// - /// Gets or sets the type of the event. + /// Gets or sets the new value. /// - public string Type { get; set; } + public object Value { get; set; } + } } diff --git a/src/Components/Components/src/EventCallbackFactoryBinderExtensions.cs b/src/Components/Components/src/EventCallbackFactoryBinderExtensions.cs index a007c47f09..99eac1965a 100644 --- a/src/Components/Components/src/EventCallbackFactoryBinderExtensions.cs +++ b/src/Components/Components/src/EventCallbackFactoryBinderExtensions.cs @@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -50,7 +50,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -107,7 +107,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -126,7 +126,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -145,7 +145,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -164,7 +164,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -183,7 +183,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -202,7 +202,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -221,7 +221,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -240,7 +240,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -259,7 +259,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -278,7 +278,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -298,7 +298,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -318,7 +318,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -338,7 +338,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -358,7 +358,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -378,7 +378,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -398,7 +398,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -418,7 +418,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -439,7 +439,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -449,14 +449,14 @@ namespace Microsoft.AspNetCore.Components return CreateBinderCore(factory, receiver, setter, culture, ParserDelegateCache.Get()); } - private static EventCallback CreateBinderCore( + private static EventCallback CreateBinderCore( this EventCallbackFactory factory, object receiver, Action setter, CultureInfo culture, BindConverter.BindParser converter) { - Action callback = e => + Action callback = e => { T value = default; var converted = false; @@ -489,10 +489,10 @@ namespace Microsoft.AspNetCore.Components setter(default); } }; - return factory.Create(receiver, callback); + return factory.Create(receiver, callback); } - private static EventCallback CreateBinderCore( + private static EventCallback CreateBinderCore( this EventCallbackFactory factory, object receiver, Action setter, @@ -500,7 +500,7 @@ namespace Microsoft.AspNetCore.Components string format, BindConverter.BindParserWithFormat converter) { - Action callback = e => + Action callback = e => { T value = default; var converted = false; @@ -533,7 +533,7 @@ namespace Microsoft.AspNetCore.Components setter(default); } }; - return factory.Create(receiver, callback); + return factory.Create(receiver, callback); } } } diff --git a/src/Components/Components/src/EventCallbackFactoryUIEventArgsExtensions.cs b/src/Components/Components/src/EventCallbackFactoryEventArgsExtensions.cs similarity index 74% rename from src/Components/Components/src/EventCallbackFactoryUIEventArgsExtensions.cs rename to src/Components/Components/src/EventCallbackFactoryEventArgsExtensions.cs index bf19b94c68..d0c4aec303 100644 --- a/src/Components/Components/src/EventCallbackFactoryUIEventArgsExtensions.cs +++ b/src/Components/Components/src/EventCallbackFactoryEventArgsExtensions.cs @@ -7,9 +7,9 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.Components { /// - /// Provides extension methods for and types. + /// Provides extension methods for and types. /// - public static class EventCallbackFactoryUIEventArgsExtensions + public static class EventCallbackFactoryEventArgsExtensions { /// /// Creates an for the provided and @@ -19,14 +19,14 @@ namespace Microsoft.AspNetCore.Components /// The event receiver. /// The event callback. /// The . - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) + public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } - return factory.Create(receiver, callback); + return factory.Create(receiver, callback); } /// @@ -37,14 +37,14 @@ namespace Microsoft.AspNetCore.Components /// The event receiver. /// The event callback. /// The . - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) + public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } - return factory.Create(receiver, callback); + return factory.Create(receiver, callback); } /// @@ -55,14 +55,14 @@ namespace Microsoft.AspNetCore.Components /// The event receiver. /// The event callback. /// The . - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) + public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } - return factory.Create(receiver, callback); + return factory.Create(receiver, callback); } /// @@ -73,14 +73,14 @@ namespace Microsoft.AspNetCore.Components /// The event receiver. /// The event callback. /// The . - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) + public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } - return factory.Create(receiver, callback); + return factory.Create(receiver, callback); } } } diff --git a/src/Components/Components/src/Forms/EditContext.cs b/src/Components/Components/src/Forms/EditContext.cs index fd09a241f4..caaf677c37 100644 --- a/src/Components/Components/src/Forms/EditContext.cs +++ b/src/Components/Components/src/Forms/EditContext.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Linq.Expressions; namespace Microsoft.AspNetCore.Components.Forms { @@ -158,6 +159,16 @@ namespace Microsoft.AspNetCore.Components.Forms } } + /// + /// Gets the current validation messages for the specified field. + /// + /// This method does not perform validation itself. It only returns messages determined by previous validation actions. + /// + /// Identifies the field whose current validation messages should be returned. + /// The current validation messages for the specified field. + public IEnumerable GetValidationMessages(Expression> accessor) + => GetValidationMessages(FieldIdentifier.Create(accessor)); + /// /// Determines whether the specified fields in this has been modified. /// @@ -167,6 +178,14 @@ namespace Microsoft.AspNetCore.Components.Forms ? state.IsModified : false; + /// + /// Determines whether the specified fields in this has been modified. + /// + /// Identifies the field whose current validation messages should be returned. + /// True if the field has been modified; otherwise false. + public bool IsModified(Expression> accessor) + => IsModified(FieldIdentifier.Create(accessor)); + /// /// Validates this . /// diff --git a/src/Components/Components/src/Forms/EditContextDataAnnotationsExtensions.cs b/src/Components/Components/src/Forms/EditContextDataAnnotationsExtensions.cs index 6542114a8d..9fce473a41 100644 --- a/src/Components/Components/src/Forms/EditContextDataAnnotationsExtensions.cs +++ b/src/Components/Components/src/Forms/EditContextDataAnnotationsExtensions.cs @@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.Components.Forms Validator.TryValidateProperty(propertyValue, validationContext, results); messages.Clear(fieldIdentifier); - messages.AddRange(fieldIdentifier, results.Select(result => result.ErrorMessage)); + messages.Add(fieldIdentifier, results.Select(result => result.ErrorMessage)); // We have to notify even if there were no messages before and are still no messages now, // because the "state" that changed might be the completion of some async validation task diff --git a/src/Components/Components/src/Forms/EditContextExpressionExtensions.cs b/src/Components/Components/src/Forms/EditContextExpressionExtensions.cs deleted file mode 100644 index 3d856e241f..0000000000 --- a/src/Components/Components/src/Forms/EditContextExpressionExtensions.cs +++ /dev/null @@ -1,35 +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; -using System.Collections.Generic; -using System.Linq.Expressions; - -namespace Microsoft.AspNetCore.Components.Forms -{ - /// - /// Provides extension methods to simplify using with expressions. - /// - public static class EditContextExpressionExtensions - { - /// - /// Gets the current validation messages for the specified field. - /// - /// This method does not perform validation itself. It only returns messages determined by previous validation actions. - /// - /// The . - /// Identifies the field whose current validation messages should be returned. - /// The current validation messages for the specified field. - public static IEnumerable GetValidationMessages(this EditContext editContext, Expression> accessor) - => editContext.GetValidationMessages(FieldIdentifier.Create(accessor)); - - /// - /// Determines whether the specified fields in this has been modified. - /// - /// The . - /// Identifies the field whose current validation messages should be returned. - /// True if the field has been modified; otherwise false. - public static bool IsModified(this EditContext editContext, Expression> accessor) - => editContext.IsModified(FieldIdentifier.Create(accessor)); - } -} diff --git a/src/Components/Components/src/Forms/FieldChangedEventArgs.cs b/src/Components/Components/src/Forms/FieldChangedEventArgs.cs index 9bf18dd486..780a91a01d 100644 --- a/src/Components/Components/src/Forms/FieldChangedEventArgs.cs +++ b/src/Components/Components/src/Forms/FieldChangedEventArgs.cs @@ -1,21 +1,27 @@ // 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; + namespace Microsoft.AspNetCore.Components.Forms { /// /// Provides information about the event. /// - public sealed class FieldChangedEventArgs + public sealed class FieldChangedEventArgs : EventArgs { + /// + /// Creates a new instance of . + /// + /// The + public FieldChangedEventArgs(in FieldIdentifier fieldIdentifier) + { + FieldIdentifier = fieldIdentifier; + } + /// /// Identifies the field whose value has changed. /// public FieldIdentifier FieldIdentifier { get; } - - internal FieldChangedEventArgs(in FieldIdentifier fieldIdentifier) - { - FieldIdentifier = fieldIdentifier; - } } } diff --git a/src/Components/Components/src/Forms/FieldIdentifier.cs b/src/Components/Components/src/Forms/FieldIdentifier.cs index a113cccbe7..fa3fb72dad 100644 --- a/src/Components/Components/src/Forms/FieldIdentifier.cs +++ b/src/Components/Components/src/Forms/FieldIdentifier.cs @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Components.Forms /// Uniquely identifies a single field that can be edited. This may correspond to a property on a /// model object, or can be any other named value. /// - public readonly struct FieldIdentifier + public readonly struct FieldIdentifier : IEquatable { /// /// Initializes a new instance of the structure. @@ -68,8 +68,15 @@ namespace Microsoft.AspNetCore.Components.Forms /// public override bool Equals(object obj) => obj is FieldIdentifier otherIdentifier - && otherIdentifier.Model == Model - && string.Equals(otherIdentifier.FieldName, FieldName, StringComparison.Ordinal); + && Equals(otherIdentifier); + + /// + public bool Equals(FieldIdentifier otherIdentifier) + { + return + otherIdentifier.Model == Model && + string.Equals(otherIdentifier.FieldName, FieldName, StringComparison.Ordinal); + } private static void ParseAccessor(Expression> accessor, out object model, out string fieldName) { diff --git a/src/Components/Components/src/Forms/ValidationMessageStore.cs b/src/Components/Components/src/Forms/ValidationMessageStore.cs index 2b520d68df..a8b0664bec 100644 --- a/src/Components/Components/src/Forms/ValidationMessageStore.cs +++ b/src/Components/Components/src/Forms/ValidationMessageStore.cs @@ -33,14 +33,30 @@ namespace Microsoft.AspNetCore.Components.Forms public void Add(in FieldIdentifier fieldIdentifier, string message) => GetOrCreateMessagesListForField(fieldIdentifier).Add(message); + /// + /// Adds a validation message for the specified field. + /// + /// Identifies the field for which to add the message. + /// The validation message. + public void Add(Expression> accessor, string message) + => Add(FieldIdentifier.Create(accessor), message); + /// /// Adds the messages from the specified collection for the specified field. /// /// The identifier for the field. /// The validation messages to be added. - public void AddRange(in FieldIdentifier fieldIdentifier, IEnumerable messages) + public void Add(in FieldIdentifier fieldIdentifier, IEnumerable messages) => GetOrCreateMessagesListForField(fieldIdentifier).AddRange(messages); + /// + /// Adds the messages from the specified collection for the specified field. + /// + /// Identifies the field for which to add the messages. + /// The validation messages to be added. + public void Add(Expression> accessor, IEnumerable messages) + => Add(FieldIdentifier.Create(accessor), messages); + /// /// Gets the validation messages within this for the specified field. /// @@ -74,6 +90,13 @@ namespace Microsoft.AspNetCore.Components.Forms _messages.Clear(); } + /// + /// Removes all messages within this for the specified field. + /// + /// Identifies the field for which to remove the messages. + public void Clear(Expression> accessor) + => Clear(FieldIdentifier.Create(accessor)); + /// /// Removes all messages within this for the specified field. /// diff --git a/src/Components/Components/src/Forms/ValidationMessageStoreExpressionExtensions.cs b/src/Components/Components/src/Forms/ValidationMessageStoreExpressionExtensions.cs deleted file mode 100644 index 6304c6e2c3..0000000000 --- a/src/Components/Components/src/Forms/ValidationMessageStoreExpressionExtensions.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 System; -using System.Collections.Generic; -using System.Linq.Expressions; - -namespace Microsoft.AspNetCore.Components.Forms -{ - /// - /// Provides extension methods to simplify using with expressions. - /// - public static class ValidationMessageStoreExpressionExtensions - { - /// - /// Adds a validation message for the specified field. - /// - /// The . - /// Identifies the field for which to add the message. - /// The validation message. - public static void Add(this ValidationMessageStore store, Expression> accessor, string message) - => store.Add(FieldIdentifier.Create(accessor), message); - - /// - /// Adds the messages from the specified collection for the specified field. - /// - /// The . - /// Identifies the field for which to add the messages. - /// The validation messages to be added. - public static void AddRange(this ValidationMessageStore store, Expression> accessor, IEnumerable messages) - => store.AddRange(FieldIdentifier.Create(accessor), messages); - - /// - /// Removes all messages within this for the specified field. - /// - /// The . - /// Identifies the field for which to remove the messages. - public static void Clear(this ValidationMessageStore store, Expression> accessor) - => store.Clear(FieldIdentifier.Create(accessor)); - } -} diff --git a/src/Components/Components/src/Forms/ValidationRequestedEventArgs.cs b/src/Components/Components/src/Forms/ValidationRequestedEventArgs.cs index cd7f0db2b6..52efde8de5 100644 --- a/src/Components/Components/src/Forms/ValidationRequestedEventArgs.cs +++ b/src/Components/Components/src/Forms/ValidationRequestedEventArgs.cs @@ -1,16 +1,24 @@ // 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; + namespace Microsoft.AspNetCore.Components.Forms { /// /// Provides information about the event. /// - public sealed class ValidationRequestedEventArgs + public sealed class ValidationRequestedEventArgs : EventArgs { - internal static readonly ValidationRequestedEventArgs Empty = new ValidationRequestedEventArgs(); + /// + /// Gets a shared empty instance of . + /// + public static new readonly ValidationRequestedEventArgs Empty = new ValidationRequestedEventArgs(); - internal ValidationRequestedEventArgs() + /// + /// Creates a new instance of . + /// + public ValidationRequestedEventArgs() { } } diff --git a/src/Components/Components/src/Forms/ValidationStateChangedEventArgs.cs b/src/Components/Components/src/Forms/ValidationStateChangedEventArgs.cs index 0ac4af6658..fd8dbb8d69 100644 --- a/src/Components/Components/src/Forms/ValidationStateChangedEventArgs.cs +++ b/src/Components/Components/src/Forms/ValidationStateChangedEventArgs.cs @@ -1,16 +1,24 @@ // 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; + namespace Microsoft.AspNetCore.Components.Forms { /// /// Provides information about the event. /// - public sealed class ValidationStateChangedEventArgs + public sealed class ValidationStateChangedEventArgs : EventArgs { - internal static readonly ValidationStateChangedEventArgs Empty = new ValidationStateChangedEventArgs(); + /// + /// Gets a shared empty instance of . + /// + public new static readonly ValidationStateChangedEventArgs Empty = new ValidationStateChangedEventArgs(); - internal ValidationStateChangedEventArgs() + /// + /// Creates a new instance of + /// + public ValidationStateChangedEventArgs() { } } diff --git a/src/Components/Components/src/IUriHelper.cs b/src/Components/Components/src/IUriHelper.cs deleted file mode 100644 index 6c4756f2d2..0000000000 --- a/src/Components/Components/src/IUriHelper.cs +++ /dev/null @@ -1,64 +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; -using Microsoft.AspNetCore.Components.Routing; - -namespace Microsoft.AspNetCore.Components -{ - /// - /// Helpers for working with URIs and navigation state. - /// - public interface IUriHelper - { - /// - /// Gets the current absolute URI. - /// - /// The current absolute URI. - string GetAbsoluteUri(); - - /// - /// An event that fires when the navigation location has changed. - /// - event EventHandler OnLocationChanged; - - /// - /// Converts a relative URI into an absolute one (by resolving it - /// relative to the current absolute URI). - /// - /// The relative URI. - /// The absolute URI. - Uri ToAbsoluteUri(string href); - - /// - /// Gets the base URI (with trailing slash) that can be prepended before relative URI paths to produce an absolute URI. - /// Typically this corresponds to the 'href' attribute on the document's <base> element. - /// - /// The URI prefix, which has a trailing slash. - string GetBaseUri(); - - /// - /// Given a base URI (e.g., one previously returned by ), - /// converts an absolute URI into one relative to the base URI prefix. - /// - /// The base URI prefix (e.g., previously returned by ). - /// An absolute URI that is within the space of the base URI. - /// A relative URI path. - string ToBaseRelativePath(string baseUri, string locationAbsolute); - - /// - /// Navigates to the specified URI. - /// - /// The destination URI. This can be absolute, or relative to the base URI - /// (as returned by ). - void NavigateTo(string uri); - - /// - /// Navigates to the specified URI. - /// - /// The destination URI. This can be absolute, or relative to the base URI - /// (as returned by ). - /// If true, bypasses client-side routing and forces the browser to load the new page from the server, whether or not the URI would normally be handled by the client-side router. - void NavigateTo(string uri, bool forceLoad); - } -} diff --git a/src/Components/Components/src/LocationChangeException.cs b/src/Components/Components/src/LocationChangeException.cs new file mode 100644 index 0000000000..13010eb5c1 --- /dev/null +++ b/src/Components/Components/src/LocationChangeException.cs @@ -0,0 +1,23 @@ +// 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; + +namespace Microsoft.AspNetCore.Components +{ + /// + /// An exception thrown when throws an exception. + /// + public sealed class LocationChangeException : Exception + { + /// + /// Creates a new instance of . + /// + /// The exception message. + /// The inner exception. + public LocationChangeException(string message, Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/src/Components/Components/src/NavigationException.cs b/src/Components/Components/src/NavigationException.cs index 2693ce39b0..5acb891e6f 100644 --- a/src/Components/Components/src/NavigationException.cs +++ b/src/Components/Components/src/NavigationException.cs @@ -6,7 +6,7 @@ using System; namespace Microsoft.AspNetCore.Components { /// - /// Exception thrown when an is not able to navigate to a different url. + /// Exception thrown when an is not able to navigate to a different url. /// public class NavigationException : Exception { diff --git a/src/Components/Components/src/NavigationManager.cs b/src/Components/Components/src/NavigationManager.cs new file mode 100644 index 0000000000..d75077026f --- /dev/null +++ b/src/Components/Components/src/NavigationManager.cs @@ -0,0 +1,269 @@ +// 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.Components.Routing; + +namespace Microsoft.AspNetCore.Components +{ + /// + /// Provides an abstraction for querying and mananging URI navigation. + /// + public abstract class NavigationManager + { + /// + /// An event that fires when the navigation location has changed. + /// + public event EventHandler LocationChanged + { + add + { + AssertInitialized(); + _locationChanged += value; + } + remove + { + AssertInitialized(); + _locationChanged -= value; + } + } + + private EventHandler _locationChanged; + + // For the baseUri it's worth storing as a System.Uri so we can do operations + // on that type. System.Uri gives us access to the original string anyway. + private Uri _baseUri; + + // The URI. Always represented an absolute URI. + private string _uri; + + private bool _isInitialized; + + /// + /// Gets or sets the current base URI. The is always represented as an absolute URI in string form with trailing slash. + /// Typically this corresponds to the 'href' attribute on the document's <base> element. + /// + /// + /// Setting will not trigger the event. + /// + public string BaseUri + { + get + { + AssertInitialized(); + return _baseUri.OriginalString; + } + protected set + { + if (value != null) + { + value = NormalizeBaseUri(value); + } + + _baseUri = new Uri(value, UriKind.Absolute); + } + } + + /// + /// Gets or sets the current URI. The is always represented as an absolute URI in string form. + /// + /// + /// Setting will not trigger the event. + /// + public string Uri + { + get + { + AssertInitialized(); + return _uri; + } + protected set + { + Validate(_baseUri, value); + _uri = value; + } + } + + /// + /// Navigates to the specified URI. + /// + /// The destination URI. This can be absolute, or relative to the base URI + /// (as returned by ). + /// If true, bypasses client-side routing and forces the browser to load the new page from the server, whether or not the URI would normally be handled by the client-side router. + public void NavigateTo(string uri, bool forceLoad = false) + { + AssertInitialized(); + NavigateToCore(uri, forceLoad); + } + + /// + /// Navigates to the specified URI. + /// + /// The destination URI. This can be absolute, or relative to the base URI + /// (as returned by ). + /// If true, bypasses client-side routing and forces the browser to load the new page from the server, whether or not the URI would normally be handled by the client-side router. + protected abstract void NavigateToCore(string uri, bool forceLoad); + + /// + /// Called to initialize BaseURI and current URI before these values are used for the first time. + /// Override and call this method to dynamically calculate these values. + /// + protected void Initialize(string baseUri, string uri) + { + // Make sure it's possible/safe to call this method from constructors of derived classes. + if (uri == null) + { + throw new ArgumentNullException(nameof(uri)); + } + + if (baseUri == null) + { + throw new ArgumentNullException(nameof(baseUri)); + } + + if (_isInitialized) + { + throw new InvalidOperationException($"'{GetType().Name}' already initialized."); + } + + _isInitialized = true; + + // Setting BaseUri before Uri so they get validated. + BaseUri = baseUri; + Uri = uri; + } + + /// + /// Allows derived classes to lazyly self-initialize. Implementations that support lazy-initialization should override + /// this method and call . + /// + protected virtual void EnsureInitialized() + { + } + + /// + /// Converts a relative URI into an absolute one (by resolving it + /// relative to the current absolute URI). + /// + /// The relative URI. + /// The absolute URI. + public Uri ToAbsoluteUri(string relativeUri) + { + AssertInitialized(); + return new Uri(_baseUri, relativeUri); + } + + /// + /// Given a base URI (e.g., one previously returned by ), + /// converts an absolute URI into one relative to the base URI prefix. + /// + /// An absolute URI that is within the space of the base URI. + /// A relative URI path. + public string ToBaseRelativePath(string uri) + { + if (uri.StartsWith(_baseUri.OriginalString, StringComparison.Ordinal)) + { + // The absolute URI must be of the form "{baseUri}something" (where + // baseUri ends with a slash), and from that we return "something" + return uri.Substring(_baseUri.OriginalString.Length); + } + + var hashIndex = uri.IndexOf('#'); + var uriWithoutHash = hashIndex < 0 ? uri : uri.Substring(0, hashIndex); + if ($"{uriWithoutHash}/".Equals(_baseUri.OriginalString, StringComparison.Ordinal)) + { + // Special case: for the base URI "/something/", if you're at + // "/something" then treat it as if you were at "/something/" (i.e., + // with the trailing slash). It's a bit ambiguous because we don't know + // whether the server would return the same page whether or not the + // slash is present, but ASP.NET Core at least does by default when + // using PathBase. + return uri.Substring(_baseUri.OriginalString.Length - 1); + } + + var message = $"The URI '{uri}' is not contained by the base URI '{_baseUri}'."; + throw new ArgumentException(message); + } + + internal static string NormalizeBaseUri(string baseUri) + { + var lastSlashIndex = baseUri.LastIndexOf('/'); + if (lastSlashIndex >= 0) + { + baseUri = baseUri.Substring(0, lastSlashIndex + 1); + } + + return baseUri; + } + + /// + /// Triggers the event with the current URI value. + /// + protected void NotifyLocationChanged(bool isInterceptedLink) + { + try + { + _locationChanged?.Invoke(this, new LocationChangedEventArgs(_uri, isInterceptedLink)); + } + catch (Exception ex) + { + throw new LocationChangeException("An exception occurred while dispatching a location changed event.", ex); + } + } + + private void AssertInitialized() + { + if (!_isInitialized) + { + EnsureInitialized(); + } + + if (!_isInitialized) + { + throw new InvalidOperationException($"'{GetType().Name}' has not been initialized."); + } + } + + private static bool TryGetLengthOfBaseUriPrefix(Uri baseUri, string uri, out int length) + { + if (uri.StartsWith(baseUri.OriginalString, StringComparison.Ordinal)) + { + // The absolute URI must be of the form "{baseUri}something" (where + // baseUri ends with a slash), and from that we return "something" + length = baseUri.OriginalString.Length; + return true; + } + + var hashIndex = uri.IndexOf('#'); + var uriWithoutHash = hashIndex < 0 ? uri : uri.Substring(0, hashIndex); + if ($"{uriWithoutHash}/".Equals(baseUri.OriginalString, StringComparison.Ordinal)) + { + // Special case: for the base URI "/something/", if you're at + // "/something" then treat it as if you were at "/something/" (i.e., + // with the trailing slash). It's a bit ambiguous because we don't know + // whether the server would return the same page whether or not the + // slash is present, but ASP.NET Core at least does by default when + // using PathBase. + length = baseUri.OriginalString.Length - 1; + return true; + } + + length = 0; + return false; + } + + private static void Validate(Uri baseUri, string uri) + { + if (baseUri == null || uri == null) + { + return; + } + + if (!TryGetLengthOfBaseUriPrefix(baseUri, uri, out _)) + { + var message = $"The URI '{uri}' is not contained by the base URI '{baseUri}'."; + throw new ArgumentException(message); + } + } + } +} diff --git a/src/Components/Components/src/OwningComponentBase.cs b/src/Components/Components/src/OwningComponentBase.cs new file mode 100644 index 0000000000..d5bcecb1f7 --- /dev/null +++ b/src/Components/Components/src/OwningComponentBase.cs @@ -0,0 +1,100 @@ +// 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.Extensions.DependencyInjection; + +namespace Microsoft.AspNetCore.Components +{ + /// + /// A base class that creates a service provider scope. + /// + /// + /// Use the class as a base class to author components that control + /// the lifetime of a service provider scope. This is useful when using a transient or scoped service that + /// requires disposal such as a repository or database abstraction. Using + /// as a base class ensures that the service provider scope is disposed with the component. + /// + public abstract class OwningComponentBase : ComponentBase, IDisposable + { + private IServiceScope _scope; + + [Inject] IServiceScopeFactory ScopeFactory { get; set; } + + /// + /// Gets a value determining if the component and associated services have been disposed. + /// + protected bool IsDisposed { get; private set; } + + /// + /// Gets the scoped that is associated with this component. + /// + protected IServiceProvider ScopedServices + { + get + { + if (ScopeFactory == null) + { + throw new InvalidOperationException("Services cannot be accessed before the component is initialized."); + } + + if (IsDisposed) + { + throw new ObjectDisposedException(GetType().Name); + } + + _scope ??= ScopeFactory.CreateScope(); + return _scope.ServiceProvider; + } + } + + void IDisposable.Dispose() + { + if (!IsDisposed) + { + _scope?.Dispose(); + _scope = null; + Dispose(disposing: true); + IsDisposed = true; + } + } + + /// + protected virtual void Dispose(bool disposing) + { + } + } + + /// + /// A base class that creates a service provider scope, and resolves a service of type . + /// + /// The service type. + /// + /// Use the class as a base class to author components that control + /// the lifetime of a service or multiple services. This is useful when using a transient or scoped service that + /// requires disposal such as a repository or database abstraction. Using + /// as a base class ensures that the service and relates services that share its scope are disposed with the component. + /// + public abstract class OwningComponentBase : OwningComponentBase, IDisposable + { + private TService _item; + + /// + /// Gets the that is associated with this component. + /// + protected TService Service + { + get + { + if (IsDisposed) + { + throw new ObjectDisposedException(GetType().Name); + } + + // We cache this because we don't know the lifetime. We have to assume that it could be transient. + _item ??= ScopedServices.GetRequiredService(); + return _item; + } + } + } +} diff --git a/src/Components/Components/src/PageDisplay.cs b/src/Components/Components/src/PageDisplay.cs index 61abc70697..14df824d13 100644 --- a/src/Components/Components/src/PageDisplay.cs +++ b/src/Components/Components/src/PageDisplay.cs @@ -36,13 +36,13 @@ namespace Microsoft.AspNetCore.Components /// The content that will be displayed if the user is not authorized. /// [Parameter] - public RenderFragment NotAuthorizedContent { get; set; } + public RenderFragment NotAuthorized { get; set; } /// /// The content that will be displayed while asynchronous authorization is in progress. /// [Parameter] - public RenderFragment AuthorizingContent { get; set; } + public RenderFragment Authorizing { get; set; } /// public void Attach(RenderHandle renderHandle) @@ -109,14 +109,14 @@ namespace Microsoft.AspNetCore.Components } // Some authorization data exists, so we do need to wrap the fragment - RenderFragment authorizedContent = context => pageFragment; + RenderFragment authorized = context => pageFragment; return builder => { builder.OpenComponent(0); builder.AddAttribute(1, nameof(AuthorizeViewWithSuppliedData.AuthorizeDataParam), authorizeData); - builder.AddAttribute(2, nameof(AuthorizeViewWithSuppliedData.Authorized), authorizedContent); - builder.AddAttribute(3, nameof(AuthorizeViewWithSuppliedData.NotAuthorized), NotAuthorizedContent ?? DefaultNotAuthorizedContent); - builder.AddAttribute(4, nameof(AuthorizeViewWithSuppliedData.Authorizing), AuthorizingContent); + builder.AddAttribute(2, nameof(AuthorizeViewWithSuppliedData.Authorized), authorized); + builder.AddAttribute(3, nameof(AuthorizeViewWithSuppliedData.NotAuthorized), NotAuthorized ?? DefaultNotAuthorized); + builder.AddAttribute(4, nameof(AuthorizeViewWithSuppliedData.Authorizing), Authorizing); builder.CloseComponent(); }; } @@ -133,7 +133,7 @@ namespace Microsoft.AspNetCore.Components // There has to be some default content. If we render blank by default, developers // will find it hard to guess why their UI isn't appearing. - private static RenderFragment DefaultNotAuthorizedContent(AuthenticationState authenticationState) + private static RenderFragment DefaultNotAuthorized(AuthenticationState authenticationState) => builder => builder.AddContent(0, "Not authorized"); } } diff --git a/src/Components/Components/src/RenderTree/RenderTreeDiffBuilder.cs b/src/Components/Components/src/RenderTree/RenderTreeDiffBuilder.cs index 517b4b65ab..bc6f82df29 100644 --- a/src/Components/Components/src/RenderTree/RenderTreeDiffBuilder.cs +++ b/src/Components/Components/src/RenderTree/RenderTreeDiffBuilder.cs @@ -99,6 +99,10 @@ namespace Microsoft.AspNetCore.Components.RenderTree if (oldKey != null || newKey != null) { #region "Get diff action by matching on key" + // Regardless of whether these two keys match, since you are using keys, we want to validate at this point that there are no clashes + // so ensure we've built the dictionary that will be used for lookups if any don't match + keyedItemInfos ??= BuildKeyToInfoLookup(diffContext, origOldStartIndex, oldEndIndexExcl, origNewStartIndex, newEndIndexExcl); + if (Equals(oldKey, newKey)) { // Keys match @@ -108,11 +112,6 @@ namespace Microsoft.AspNetCore.Components.RenderTree else { // Keys don't match - if (keyedItemInfos == null) - { - keyedItemInfos = BuildKeyToInfoLookup(diffContext, origOldStartIndex, oldEndIndexExcl, origNewStartIndex, newEndIndexExcl); - } - var oldKeyItemInfo = oldKey != null ? keyedItemInfos[oldKey] : new KeyedItemInfo(-1, -1); var newKeyItemInfo = newKey != null ? keyedItemInfos[newKey] : new KeyedItemInfo(-1, -1); var oldKeyIsInNewTree = oldKeyItemInfo.NewIndex >= 0; diff --git a/src/Components/Components/src/Rendering/HtmlRenderer.cs b/src/Components/Components/src/Rendering/HtmlRenderer.cs index c5c77e5169..5eb2e71095 100644 --- a/src/Components/Components/src/Rendering/HtmlRenderer.cs +++ b/src/Components/Components/src/Rendering/HtmlRenderer.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Runtime.ExceptionServices; +using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Components.RenderTree; using Microsoft.Extensions.Logging; @@ -21,6 +22,8 @@ namespace Microsoft.AspNetCore.Components.Rendering "area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr" }; + private static readonly Task CanceledRenderTask = Task.FromCanceled(new CancellationToken(canceled: true)); + private readonly Func _htmlEncoder; /// @@ -40,7 +43,19 @@ namespace Microsoft.AspNetCore.Components.Rendering /// protected override Task UpdateDisplayAsync(in RenderBatch renderBatch) { - return Task.CompletedTask; + // By default we return a canceled task. This has the effect of making it so that the + // OnAfterRenderAsync callbacks on components don't run by default. + // This way, by default prerendering gets the correct behavior and other renderers + // override the UpdateDisplayAsync method already, so those components can + // either complete a task when the client acknowledges the render, or return a canceled task + // when the renderer gets disposed. + + // We believe that returning a canceled task is the right behavior as we expect that any class + // that subclasses this class to provide an implementation for a given rendering scenario respects + // the contract that OnAfterRender should only be called when the display has successfully been updated + // and the application is interactive. (Element and component references are populated and JavaScript interop + // is available). + return CanceledRenderTask; } /// diff --git a/src/Components/Components/src/Rendering/Renderer.Log.cs b/src/Components/Components/src/Rendering/Renderer.Log.cs index 68a28b62a1..3b70f58973 100644 --- a/src/Components/Components/src/Rendering/Renderer.Log.cs +++ b/src/Components/Components/src/Rendering/Renderer.Log.cs @@ -56,9 +56,9 @@ namespace Microsoft.AspNetCore.Components.Rendering } } - internal static void HandlingEvent(ILogger logger, ulong eventHandlerId, UIEventArgs eventArgs) + internal static void HandlingEvent(ILogger logger, ulong eventHandlerId, EventArgs eventArgs) { - _handlingEvent(logger, eventHandlerId, eventArgs?.Type ?? "null", null); + _handlingEvent(logger, eventHandlerId, eventArgs?.GetType().Name ?? "null", null); } } } diff --git a/src/Components/Components/src/Rendering/Renderer.cs b/src/Components/Components/src/Rendering/Renderer.cs index 83505bd61e..6e0ed1633e 100644 --- a/src/Components/Components/src/Rendering/Renderer.cs +++ b/src/Components/Components/src/Rendering/Renderer.cs @@ -206,7 +206,7 @@ namespace Microsoft.AspNetCore.Components.Rendering /// A which will complete once all asynchronous processing related to the event /// has completed. /// - public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo fieldInfo, UIEventArgs eventArgs) + public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs) { EnsureSynchronizationContext(); @@ -445,8 +445,12 @@ namespace Microsoft.AspNetCore.Components.Rendering { if (updateDisplayTask.IsCanceled) { - // The display update was cancelled (maybe due to a timeout on the components server-side case or due - // to the renderer being disposed) + // The display update was canceled. + // This can be due to a timeout on the components server-side case, or the renderer being disposed. + + // The latter case is normal during prerendering, as the render never fully completes (the display never + // gets updated, no references get populated and JavaScript interop is not available) and we simply discard + // the renderer after producing the prerendered content. return Task.CompletedTask; } if (updateDisplayTask.IsFaulted) diff --git a/src/Components/Components/src/Routing/IHostEnvironmentNavigationManager.cs b/src/Components/Components/src/Routing/IHostEnvironmentNavigationManager.cs new file mode 100644 index 0000000000..89dac06e0f --- /dev/null +++ b/src/Components/Components/src/Routing/IHostEnvironmentNavigationManager.cs @@ -0,0 +1,19 @@ +// 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.Routing +{ + /// + /// An optional interface for implementations that must be initialized + /// by the host. + /// + public interface IHostEnvironmentNavigationManager + { + /// + /// Initializes the . + /// + /// The base URI. + /// The absolute URI. + void Initialize(string baseUri, string uri); + } +} diff --git a/src/Components/Components/src/Routing/LocationChangedEventArgs.cs b/src/Components/Components/src/Routing/LocationChangedEventArgs.cs index 1b3ab4cc64..7d1dca39e4 100644 --- a/src/Components/Components/src/Routing/LocationChangedEventArgs.cs +++ b/src/Components/Components/src/Routing/LocationChangedEventArgs.cs @@ -6,9 +6,9 @@ using System; namespace Microsoft.AspNetCore.Components.Routing { /// - /// for . + /// for . /// - public readonly struct LocationChangedEventArgs + public class LocationChangedEventArgs : EventArgs { /// /// Initializes a new instance of . diff --git a/src/Components/Components/src/Routing/Router.cs b/src/Components/Components/src/Routing/Router.cs index c1459063e7..96eca17322 100644 --- a/src/Components/Components/src/Routing/Router.cs +++ b/src/Components/Components/src/Routing/Router.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Components.Routing bool _navigationInterceptionEnabled; ILogger _logger; - [Inject] private IUriHelper UriHelper { get; set; } + [Inject] private NavigationManager NavigationManager { get; set; } [Inject] private INavigationInterception NavigationInterception { get; set; } @@ -41,17 +41,17 @@ namespace Microsoft.AspNetCore.Components.Routing /// /// Gets or sets the type of the component that should be used as a fallback when no match is found for the requested route. /// - [Parameter] public RenderFragment NotFoundContent { get; set; } + [Parameter] public RenderFragment NotFound { get; set; } /// /// The content that will be displayed if the user is not authorized. /// - [Parameter] public RenderFragment NotAuthorizedContent { get; set; } + [Parameter] public RenderFragment NotAuthorized { get; set; } /// /// The content that will be displayed while asynchronous authorization is in progress. /// - [Parameter] public RenderFragment AuthorizingContent { get; set; } + [Parameter] public RenderFragment Authorizing { get; set; } private RouteTable Routes { get; set; } @@ -60,9 +60,9 @@ namespace Microsoft.AspNetCore.Components.Routing { _logger = LoggerFactory.CreateLogger(); _renderHandle = renderHandle; - _baseUri = UriHelper.GetBaseUri(); - _locationAbsolute = UriHelper.GetAbsoluteUri(); - UriHelper.OnLocationChanged += OnLocationChanged; + _baseUri = NavigationManager.BaseUri; + _locationAbsolute = NavigationManager.Uri; + NavigationManager.LocationChanged += OnLocationChanged; } /// @@ -77,7 +77,7 @@ namespace Microsoft.AspNetCore.Components.Routing /// public void Dispose() { - UriHelper.OnLocationChanged -= OnLocationChanged; + NavigationManager.LocationChanged -= OnLocationChanged; } private string StringUntilAny(string str, char[] chars) @@ -94,14 +94,14 @@ namespace Microsoft.AspNetCore.Components.Routing builder.OpenComponent(0, typeof(PageDisplay)); builder.AddAttribute(1, nameof(PageDisplay.Page), handler); builder.AddAttribute(2, nameof(PageDisplay.PageParameters), parameters); - builder.AddAttribute(3, nameof(PageDisplay.NotAuthorizedContent), NotAuthorizedContent); - builder.AddAttribute(4, nameof(PageDisplay.AuthorizingContent), AuthorizingContent); + builder.AddAttribute(3, nameof(PageDisplay.NotAuthorized), NotAuthorized); + builder.AddAttribute(4, nameof(PageDisplay.Authorizing), Authorizing); builder.CloseComponent(); } private void Refresh(bool isNavigationIntercepted) { - var locationPath = UriHelper.ToBaseRelativePath(_baseUri, _locationAbsolute); + var locationPath = NavigationManager.ToBaseRelativePath(_locationAbsolute); locationPath = StringUntilAny(locationPath, _queryOrHashStartChar); var context = new RouteContext(locationPath); Routes.Route(context); @@ -120,19 +120,19 @@ namespace Microsoft.AspNetCore.Components.Routing } else { - if (!isNavigationIntercepted && NotFoundContent != null) + if (!isNavigationIntercepted && NotFound != null) { - Log.DisplayingNotFoundContent(_logger, locationPath, _baseUri); + Log.DisplayingNotFound(_logger, locationPath, _baseUri); // We did not find a Component that matches the route. - // Only show the NotFoundContent if the application developer programatically got us here i.e we did not + // Only show the NotFound if the application developer programatically got us here i.e we did not // intercept the navigation. In all other cases, force a browser navigation since this could be non-Blazor content. - _renderHandle.Render(NotFoundContent); + _renderHandle.Render(NotFound); } else { Log.NavigatingToExternalUri(_logger, _locationAbsolute, locationPath, _baseUri); - UriHelper.NavigateTo(_locationAbsolute, forceLoad: true); + NavigationManager.NavigateTo(_locationAbsolute, forceLoad: true); } } } @@ -159,8 +159,8 @@ namespace Microsoft.AspNetCore.Components.Routing private static class Log { - private static readonly Action _displayingNotFoundContent = - LoggerMessage.Define(LogLevel.Debug, new EventId(1, "DisplayingNotFoundContent"), $"Displaying {nameof(NotFoundContent)} because path '{{Path}}' with base URI '{{BaseUri}}' does not match any component route"); + private static readonly Action _displayingNotFound = + LoggerMessage.Define(LogLevel.Debug, new EventId(1, "DisplayingNotFound"), $"Displaying {nameof(NotFound)} because path '{{Path}}' with base URI '{{BaseUri}}' does not match any component route"); private static readonly Action _navigatingToComponent = LoggerMessage.Define(LogLevel.Debug, new EventId(2, "NavigatingToComponent"), "Navigating to component {ComponentType} in response to path '{Path}' with base URI '{BaseUri}'"); @@ -168,9 +168,9 @@ namespace Microsoft.AspNetCore.Components.Routing private static readonly Action _navigatingToExternalUri = LoggerMessage.Define(LogLevel.Debug, new EventId(3, "NavigatingToExternalUri"), "Navigating to non-component URI '{ExternalUri}' in response to path '{Path}' with base URI '{BaseUri}'"); - internal static void DisplayingNotFoundContent(ILogger logger, string path, string baseUri) + internal static void DisplayingNotFound(ILogger logger, string path, string baseUri) { - _displayingNotFoundContent(logger, path, baseUri, null); + _displayingNotFound(logger, path, baseUri, null); } internal static void NavigatingToComponent(ILogger logger, Type componentType, string path, string baseUri) diff --git a/src/Components/Components/src/UIChangeEventArgs.cs b/src/Components/Components/src/UIChangeEventArgs.cs deleted file mode 100644 index 79402eb55e..0000000000 --- a/src/Components/Components/src/UIChangeEventArgs.cs +++ /dev/null @@ -1,17 +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 -{ - /// - /// Supplies information about an input change event that is being raised. - /// - public class UIChangeEventArgs : UIEventArgs - { - /// - /// Gets or sets the new value of the input. This may be a - /// or a . - /// - public object Value { get; set; } - } -} diff --git a/src/Components/Components/src/UriHelperBase.cs b/src/Components/Components/src/UriHelperBase.cs deleted file mode 100644 index 3b8f091045..0000000000 --- a/src/Components/Components/src/UriHelperBase.cs +++ /dev/null @@ -1,230 +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; -using Microsoft.AspNetCore.Components.Routing; - -namespace Microsoft.AspNetCore.Components -{ - /// - /// A base class for implementations. - /// - public abstract class UriHelperBase : IUriHelper - { - private EventHandler _onLocationChanged; - - /// - /// An event that fires when the navigation location has changed. - /// - public event EventHandler OnLocationChanged - { - add - { - AssertInitialized(); - _onLocationChanged += value; - } - remove - { - _onLocationChanged -= value; - } - } - - // For the baseUri it's worth storing both the string form and Uri form and - // keeping them in sync. These are always represented as absolute URIs with - // a trailing slash. - private Uri _baseUri; - private string _baseUriString; - - // The URI. Always represented an absolute URI. - private string _uri; - - private bool _isInitialized; - - /// - /// Navigates to the specified URI. - /// - /// The destination URI. This can be absolute, or relative to the base URI - /// (as returned by ). - public void NavigateTo(string uri) - { - NavigateTo(uri, forceLoad: false); - } - - /// - /// Navigates to the specified URI. - /// - /// The destination URI. This can be absolute, or relative to the base URI - /// (as returned by ). - /// If true, bypasses client-side routing and forces the browser to load the new page from the server, whether or not the URI would normally be handled by the client-side router. - public void NavigateTo(string uri, bool forceLoad) - { - AssertInitialized(); - NavigateToCore(uri, forceLoad); - } - - /// - /// Navigates to the specified URI. - /// - /// The destination URI. This can be absolute, or relative to the base URI - /// (as returned by ). - /// If true, bypasses client-side routing and forces the browser to load the new page from the server, whether or not the URI would normally be handled by the client-side router. - protected abstract void NavigateToCore(string uri, bool forceLoad); - - /// - /// Called to initialize BaseURI and current URI before these values are used for the first time. - /// Override this method to dynamically calculate these values. - /// - public virtual void InitializeState(string uriAbsolute, string baseUriAbsolute) - { - if (uriAbsolute == null) - { - throw new ArgumentNullException(nameof(uriAbsolute)); - } - - if (baseUriAbsolute == null) - { - throw new ArgumentNullException(nameof(baseUriAbsolute)); - } - - if (_isInitialized) - { - throw new InvalidOperationException($"'{typeof(UriHelperBase).Name}' already initialized."); - } - _isInitialized = true; - - SetAbsoluteUri(uriAbsolute); - SetAbsoluteBaseUri(baseUriAbsolute); - } - - /// - /// Allows derived classes to lazyly self initialize. It does nothing unless overriden. - /// - protected virtual void EnsureInitialized() - { - } - - /// - /// Gets the current absolute URI. - /// - /// The current absolute URI. - public string GetAbsoluteUri() - { - AssertInitialized(); - return _uri; - } - - /// - /// Gets the base URI (with trailing slash) that can be prepended before relative URI paths to - /// produce an absolute URI. Typically this corresponds to the 'href' attribute on the - /// document's <base> element. - /// - /// The URI prefix, which has a trailing slash. - public virtual string GetBaseUri() - { - AssertInitialized(); - return _baseUriString; - } - - /// - /// Converts a relative URI into an absolute one (by resolving it - /// relative to the current absolute URI). - /// - /// The relative URI. - /// The absolute URI. - public Uri ToAbsoluteUri(string href) - { - AssertInitialized(); - return new Uri(_baseUri, href); - } - - /// - /// Given a base URI (e.g., one previously returned by ), - /// converts an absolute URI into one relative to the base URI prefix. - /// - /// - /// The base URI prefix (e.g., previously returned by ). - /// - /// An absolute URI that is within the space of the base URI. - /// A relative URI path. - public string ToBaseRelativePath(string baseUri, string locationAbsolute) - { - if (locationAbsolute.StartsWith(baseUri, StringComparison.Ordinal)) - { - // The absolute URI must be of the form "{baseUri}something" (where - // baseUri ends with a slash), and from that we return "something" - return locationAbsolute.Substring(baseUri.Length); - } - - var hashIndex = locationAbsolute.IndexOf('#'); - var locationAbsoluteNoHash = hashIndex < 0 ? locationAbsolute : locationAbsolute.Substring(0, hashIndex); - if ($"{locationAbsoluteNoHash}/".Equals(baseUri, StringComparison.Ordinal)) - { - // Special case: for the base URI "/something/", if you're at - // "/something" then treat it as if you were at "/something/" (i.e., - // with the trailing slash). It's a bit ambiguous because we don't know - // whether the server would return the same page whether or not the - // slash is present, but ASP.NET Core at least does by default when - // using PathBase. - return locationAbsolute.Substring(baseUri.Length - 1); - } - - var message = $"The URI '{locationAbsolute}' is not contained by the base URI '{baseUri}'."; - throw new ArgumentException(message); - } - - /// - /// Set the URI to the provided value. - /// - /// The URI. Must be an absolute URI. - /// - /// Calling does not trigger . - /// - protected void SetAbsoluteUri(string uri) - { - _uri = uri; - } - - /// - /// Sets the base URI to the provided value (after normalization). - /// - /// The base URI. Must be an absolute URI. - /// - /// Calling does not trigger . - /// - protected void SetAbsoluteBaseUri(string baseUri) - { - if (baseUri != null) - { - var lastSlashIndex = baseUri.LastIndexOf('/'); - if (lastSlashIndex >= 0) - { - baseUri = baseUri.Substring(0, lastSlashIndex + 1); - } - } - - _baseUriString = baseUri ?? "/"; - _baseUri = new Uri(_baseUriString); - } - - /// - /// Triggers the event with the current URI value. - /// - protected void TriggerOnLocationChanged(bool isinterceptedLink) - { - _onLocationChanged?.Invoke(this, new LocationChangedEventArgs(_uri, isinterceptedLink)); - } - - private void AssertInitialized() - { - if (!_isInitialized) - { - EnsureInitialized(); - } - - if (!_isInitialized) - { - throw new InvalidOperationException($"'{GetType().Name}' has not been initialized."); - } - } - } -} diff --git a/src/Components/Components/test/Auth/AuthorizeViewTest.cs b/src/Components/Components/test/Auth/AuthorizeViewTest.cs index 07633ea9e4..848e68e815 100644 --- a/src/Components/Components/test/Auth/AuthorizeViewTest.cs +++ b/src/Components/Components/test/Auth/AuthorizeViewTest.cs @@ -53,13 +53,13 @@ namespace Microsoft.AspNetCore.Components } [Fact] - public void RendersNotAuthorizedContentIfNotAuthorized() + public void RendersNotAuthorizedIfNotAuthorized() { // Arrange var authorizationService = new TestAuthorizationService(); var renderer = CreateTestRenderer(authorizationService); var rootComponent = WrapInAuthorizeView( - notAuthorizedContent: + notAuthorized: context => builder => builder.AddContent(0, $"You are not authorized, even though we know you are {context.User.Identity.Name}")); rootComponent.AuthenticationState = CreateAuthenticationState("Nellie"); @@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Components } [Fact] - public void RendersNothingIfAuthorizedButNoChildContentOrAuthorizedContentProvided() + public void RendersNothingIfAuthorizedButNoChildContentOrAuthorizedProvided() { // Arrange var authorizationService = new TestAuthorizationService(); @@ -152,14 +152,14 @@ namespace Microsoft.AspNetCore.Components } [Fact] - public void RendersAuthorizedContentIfAuthorized() + public void RendersAuthorizedIfAuthorized() { // Arrange var authorizationService = new TestAuthorizationService(); authorizationService.NextResult = AuthorizationResult.Success(); var renderer = CreateTestRenderer(authorizationService); var rootComponent = WrapInAuthorizeView( - authorizedContent: context => builder => + authorized: context => builder => builder.AddContent(0, $"You are authenticated as {context.User.Identity.Name}")); rootComponent.AuthenticationState = CreateAuthenticationState("Nellie"); @@ -235,13 +235,13 @@ namespace Microsoft.AspNetCore.Components } [Fact] - public void ThrowsIfBothChildContentAndAuthorizedContentProvided() + public void ThrowsIfBothChildContentAndAuthorizedProvided() { // Arrange var authorizationService = new TestAuthorizationService(); var renderer = CreateTestRenderer(authorizationService); var rootComponent = WrapInAuthorizeView( - authorizedContent: context => builder => { }, + authorized: context => builder => { }, childContent: context => builder => { }); // Act/Assert @@ -260,7 +260,7 @@ namespace Microsoft.AspNetCore.Components var renderer = CreateTestRenderer(authorizationService); renderer.OnUpdateDisplayComplete = () => { @event.Set(); }; var rootComponent = WrapInAuthorizeView( - notAuthorizedContent: + notAuthorized: context => builder => builder.AddContent(0, "You are not authorized")); var authTcs = new TaskCompletionSource(); rootComponent.AuthenticationState = authTcs.Task; @@ -293,7 +293,7 @@ namespace Microsoft.AspNetCore.Components } [Fact] - public void RendersAuthorizingContentUntilAuthorizationCompleted() + public void RendersAuthorizingUntilAuthorizationCompleted() { // Arrange var @event = new ManualResetEventSlim(); @@ -302,8 +302,8 @@ namespace Microsoft.AspNetCore.Components var renderer = CreateTestRenderer(authorizationService); renderer.OnUpdateDisplayComplete = () => { @event.Set(); }; var rootComponent = WrapInAuthorizeView( - authorizingContent: builder => builder.AddContent(0, "Auth pending..."), - authorizedContent: context => builder => builder.AddContent(0, $"Hello, {context.User.Identity.Name}!")); + authorizing: builder => builder.AddContent(0, "Auth pending..."), + authorized: context => builder => builder.AddContent(0, $"Hello, {context.User.Identity.Name}!")); var authTcs = new TaskCompletionSource(); rootComponent.AuthenticationState = authTcs.Task; @@ -447,9 +447,9 @@ namespace Microsoft.AspNetCore.Components private static TestAuthStateProviderComponent WrapInAuthorizeView( RenderFragment childContent = null, - RenderFragment authorizedContent = null, - RenderFragment notAuthorizedContent = null, - RenderFragment authorizingContent = null, + RenderFragment authorized = null, + RenderFragment notAuthorized = null, + RenderFragment authorizing = null, string policy = null, string roles = null, object resource = null) @@ -458,9 +458,9 @@ namespace Microsoft.AspNetCore.Components { builder.OpenComponent(0); builder.AddAttribute(1, nameof(AuthorizeView.ChildContent), childContent); - builder.AddAttribute(2, nameof(AuthorizeView.Authorized), authorizedContent); - builder.AddAttribute(3, nameof(AuthorizeView.NotAuthorized), notAuthorizedContent); - builder.AddAttribute(4, nameof(AuthorizeView.Authorizing), authorizingContent); + builder.AddAttribute(2, nameof(AuthorizeView.Authorized), authorized); + builder.AddAttribute(3, nameof(AuthorizeView.NotAuthorized), notAuthorized); + builder.AddAttribute(4, nameof(AuthorizeView.Authorizing), authorizing); builder.AddAttribute(5, nameof(AuthorizeView.Policy), policy); builder.AddAttribute(6, nameof(AuthorizeView.Roles), roles); builder.AddAttribute(7, nameof(AuthorizeView.Resource), resource); diff --git a/src/Components/Components/test/EventCallbackFactoryBinderExtensionsTest.cs b/src/Components/Components/test/EventCallbackFactoryBinderExtensionsTest.cs index 0a588259cc..8df5092112 100644 --- a/src/Components/Components/test/EventCallbackFactoryBinderExtensionsTest.cs +++ b/src/Components/Components/test/EventCallbackFactoryBinderExtensionsTest.cs @@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Components var binder = EventCallback.Factory.CreateBinder(component, setter, value); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "not-an-integer!", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "not-an-integer!", }); Assert.Equal(17, value); // Setter not called Assert.Equal(1, component.Count); @@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Components var binder = EventCallback.Factory.CreateBinder(component, setter, value); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = string.Empty, }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = string.Empty, }); Assert.Equal(0, value); // Calls setter to apply default value for this type Assert.Equal(1, component.Count); @@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.Components // Act await Assert.ThrowsAsync(() => { - return binder.InvokeAsync(new UIChangeEventArgs() { Value = "18", }); + return binder.InvokeAsync(new ChangeEventArgs() { Value = "18", }); }); Assert.Equal(1, component.Count); @@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Components var binder = EventCallback.Factory.CreateBinder(component, setter, value); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "not-an-integer!", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "not-an-integer!", }); Assert.Equal(17, value); // Setter not called Assert.Equal(1, component.Count); @@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Components var binder = EventCallback.Factory.CreateBinder(component, setter, value); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "", }); Assert.Null(value); // Setter called Assert.Equal(1, component.Count); @@ -111,7 +111,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = "bye"; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue, }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue, }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -130,7 +130,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = true; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = true, }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = true, }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -149,7 +149,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (bool?)true; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = true, }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = true, }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -168,7 +168,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = 42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -187,7 +187,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (int?)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -206,7 +206,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (long)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -225,7 +225,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (long?)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -244,7 +244,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (float)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -263,7 +263,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (float?)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -282,7 +282,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (double)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -301,7 +301,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (double?)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -320,7 +320,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (decimal)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -339,7 +339,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (decimal?)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -358,7 +358,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = AttributeTargets.Class; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -377,7 +377,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = AttributeTargets.Class; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -396,7 +396,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -415,7 +415,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -435,7 +435,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(format), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(format), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -455,7 +455,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(format), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(format), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -474,7 +474,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -493,7 +493,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -513,7 +513,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(format), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(format), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -533,7 +533,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(format), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(format), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -553,7 +553,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = Guid.NewGuid(); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -573,7 +573,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = Guid.NewGuid(); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -592,7 +592,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new SecretMessage() { Message = "TypeConverter may be old, but it still works!", }; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue.Message, value.Message); Assert.Equal(1, component.Count); @@ -627,7 +627,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = 42_000; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42 000,00", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42 000,00", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -646,7 +646,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = 42_000; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42,000.00", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42,000.00", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); diff --git a/src/Components/Components/test/EventCallbackTest.cs b/src/Components/Components/test/EventCallbackTest.cs index 6fc1e601ca..25405c2180 100644 --- a/src/Components/Components/test/EventCallbackTest.cs +++ b/src/Components/Components/test/EventCallbackTest.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Components public async Task EventCallbackOfT_Default() { // Arrange - var callback = default(EventCallback); + var callback = default(EventCallback); // Act & Assert (Does not throw) await callback.InvokeAsync(null); @@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Components { // Arrange int runCount = 0; - var callback = new EventCallback(null, (Action)(() => runCount++)); + var callback = new EventCallback(null, (Action)(() => runCount++)); // Act await callback.InvokeAsync(null); @@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.Components var callback = new EventCallback(component, (Action)(() => runCount++)); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert @@ -104,8 +104,8 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); // Act await callback.InvokeAsync(null); @@ -124,11 +124,11 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert @@ -164,8 +164,8 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); // Act & Assert await Assert.ThrowsAsync(() => @@ -202,7 +202,7 @@ namespace Microsoft.AspNetCore.Components var callback = new EventCallback(component, (Func)(() => { runCount++; return Task.CompletedTask; })); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert @@ -217,8 +217,8 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); // Act await callback.InvokeAsync(null); @@ -237,11 +237,11 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert @@ -277,8 +277,8 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); // Act & Assert await Assert.ThrowsAsync(() => @@ -294,7 +294,7 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - var callback = new EventCallback(component, (Action)(() => runCount++)); + var callback = new EventCallback(component, (Action)(() => runCount++)); // Act await callback.InvokeAsync(null); @@ -312,10 +312,10 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - var callback = new EventCallback(component, (Action)(() => runCount++)); + var callback = new EventCallback(component, (Action)(() => runCount++)); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert @@ -330,8 +330,8 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); // Act await callback.InvokeAsync(null); @@ -350,11 +350,11 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert @@ -370,7 +370,7 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - var callback = new EventCallback(component, (Func)(() => { runCount++; return Task.CompletedTask; })); + var callback = new EventCallback(component, (Func)(() => { runCount++; return Task.CompletedTask; })); // Act await callback.InvokeAsync(null); @@ -388,10 +388,10 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - var callback = new EventCallback(component, (Func)(() => { runCount++; return Task.CompletedTask; })); + var callback = new EventCallback(component, (Func)(() => { runCount++; return Task.CompletedTask; })); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert @@ -406,8 +406,8 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); // Act await callback.InvokeAsync(null); @@ -426,11 +426,11 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert diff --git a/src/Components/Components/test/Forms/ValidationMessageStoreTest.cs b/src/Components/Components/test/Forms/ValidationMessageStoreTest.cs index 75e4ef3452..5264e254bd 100644 --- a/src/Components/Components/test/Forms/ValidationMessageStoreTest.cs +++ b/src/Components/Components/test/Forms/ValidationMessageStoreTest.cs @@ -42,7 +42,7 @@ namespace Microsoft.AspNetCore.Components.Forms } [Fact] - public void CanAddMessagesByRange() + public void CanAddMessagesMultiple() { // Arrange var messages = new ValidationMessageStore(new EditContext(new object())); @@ -50,7 +50,7 @@ namespace Microsoft.AspNetCore.Components.Forms var entries = new[] { "A", "B", "C" }; // Act - messages.AddRange(field1, entries); + messages.Add(field1, entries); // Assert Assert.Equal(entries, messages[field1]); diff --git a/src/Components/Components/test/NavigationManagerTest.cs b/src/Components/Components/test/NavigationManagerTest.cs new file mode 100644 index 0000000000..9b857bb044 --- /dev/null +++ b/src/Components/Components/test/NavigationManagerTest.cs @@ -0,0 +1,117 @@ +// 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 Xunit; + +namespace Microsoft.AspNetCore.Components +{ + public class NavigationManagerTest + { + [Theory] + [InlineData("scheme://host/", "scheme://host/")] + [InlineData("scheme://host:123/", "scheme://host:123/")] + [InlineData("scheme://host/path", "scheme://host/")] + [InlineData("scheme://host/path/", "scheme://host/path/")] + [InlineData("scheme://host/path/page?query=string&another=here", "scheme://host/path/")] + public void ComputesCorrectBaseUri(string baseUri, string expectedResult) + { + var actualResult = NavigationManager.NormalizeBaseUri(baseUri); + Assert.Equal(expectedResult, actualResult); + } + + [Theory] + [InlineData("scheme://host/", "scheme://host", "")] + [InlineData("scheme://host/", "scheme://host/", "")] + [InlineData("scheme://host/", "scheme://host/path", "path")] + [InlineData("scheme://host/path/", "scheme://host/path/", "")] + [InlineData("scheme://host/path/", "scheme://host/path/more", "more")] + [InlineData("scheme://host/path/", "scheme://host/path", "")] + [InlineData("scheme://host/path/", "scheme://host/path#hash", "#hash")] + [InlineData("scheme://host/path/", "scheme://host/path/#hash", "#hash")] + [InlineData("scheme://host/path/", "scheme://host/path/more#hash", "more#hash")] + public void ComputesCorrectValidBaseRelativePaths(string baseUri, string uri, string expectedResult) + { + var navigationManager = new TestNavigationManager(baseUri); + + var actualResult = navigationManager.ToBaseRelativePath(uri); + Assert.Equal(expectedResult, actualResult); + } + + [Theory] + [InlineData("scheme://host/", "otherscheme://host/")] + [InlineData("scheme://host/", "scheme://otherhost/")] + [InlineData("scheme://host/path/", "scheme://host/")] + public void Initialize_ThrowsForInvalidBaseRelativePaths(string baseUri, string absoluteUri) + { + var navigationManager = new TestNavigationManager(); + + var ex = Assert.Throws(() => + { + navigationManager.Initialize(baseUri, absoluteUri); + }); + + Assert.Equal( + $"The URI '{absoluteUri}' is not contained by the base URI '{baseUri}'.", + ex.Message); + } + + [Theory] + [InlineData("scheme://host/", "otherscheme://host/")] + [InlineData("scheme://host/", "scheme://otherhost/")] + [InlineData("scheme://host/path/", "scheme://host/")] + public void Uri_ThrowsForInvalidBaseRelativePaths(string baseUri, string absoluteUri) + { + var navigationManager = new TestNavigationManager(baseUri); + + var ex = Assert.Throws(() => + { + navigationManager.ToBaseRelativePath(absoluteUri); + }); + + Assert.Equal( + $"The URI '{absoluteUri}' is not contained by the base URI '{baseUri}'.", + ex.Message); + } + + [Theory] + [InlineData("scheme://host/", "otherscheme://host/")] + [InlineData("scheme://host/", "scheme://otherhost/")] + [InlineData("scheme://host/path/", "scheme://host/")] + public void ToBaseRelativePath_ThrowsForInvalidBaseRelativePaths(string baseUri, string absoluteUri) + { + var navigationManager = new TestNavigationManager(baseUri); + + var ex = Assert.Throws(() => + { + navigationManager.ToBaseRelativePath(absoluteUri); + }); + + Assert.Equal( + $"The URI '{absoluteUri}' is not contained by the base URI '{baseUri}'.", + ex.Message); + } + + private class TestNavigationManager : NavigationManager + { + public TestNavigationManager() + { + } + + public TestNavigationManager(string baseUri = null, string uri = null) + { + Initialize(baseUri ?? "http://example.com/", uri ?? baseUri ?? "http://example.com/welcome-page"); + } + + public new void Initialize(string baseUri, string uri) + { + base.Initialize(baseUri, uri); + } + + protected override void NavigateToCore(string uri, bool forceLoad) + { + throw new System.NotImplementedException(); + } + } + } +} diff --git a/src/Components/Components/test/OwningComponentBaseTest.cs b/src/Components/Components/test/OwningComponentBaseTest.cs new file mode 100644 index 0000000000..155231b40b --- /dev/null +++ b/src/Components/Components/test/OwningComponentBaseTest.cs @@ -0,0 +1,61 @@ +// 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 System.Dynamic; +using System.Linq; +using Microsoft.AspNetCore.Components.RenderTree; +using Microsoft.AspNetCore.Components.Test.Helpers; +using Microsoft.Extensions.DependencyInjection; +using Xunit; + +namespace Microsoft.AspNetCore.Components +{ + public class OwningComponentBaseTest + { + [Fact] + public void CreatesScopeAndService() + { + var services = new ServiceCollection(); + services.AddSingleton(); + services.AddTransient(); + var serviceProvider = services.BuildServiceProvider(); + + var counter = serviceProvider.GetRequiredService(); + var renderer = new TestRenderer(serviceProvider); + var component1 = renderer.InstantiateComponent(); + + Assert.NotNull(component1.MyService); + Assert.Equal(1, counter.CreatedCount); + Assert.Equal(0, counter.DisposedCount); + + ((IDisposable)component1).Dispose(); + Assert.Equal(1, counter.CreatedCount); + Assert.Equal(1, counter.DisposedCount); + } + + private class Counter + { + public int CreatedCount { get; set; } + public int DisposedCount { get; set; } + } + + private class MyService : IDisposable + { + public MyService(Counter counter) + { + Counter = counter; + Counter.CreatedCount++; + } + + public Counter Counter { get; } + + void IDisposable.Dispose() => Counter.DisposedCount++; + } + + private class MyOwningComponent : OwningComponentBase + { + public MyService MyService => Service; + } + } +} diff --git a/src/Components/Components/test/RenderTreeBuilderTest.cs b/src/Components/Components/test/RenderTreeBuilderTest.cs index c90259f057..3e5cc0b969 100644 --- a/src/Components/Components/test/RenderTreeBuilderTest.cs +++ b/src/Components/Components/test/RenderTreeBuilderTest.cs @@ -216,7 +216,7 @@ namespace Microsoft.AspNetCore.Components.Test { // Arrange var builder = new RenderTreeBuilder(); - Action eventHandler = eventInfo => { }; + Action eventHandler = eventInfo => { }; // Act builder.OpenElement(0, "myelement"); // 0: eventHandler = eventInfo => { }; + Action eventHandler = eventInfo => { }; // Act builder.OpenElement(0, "myelement"); @@ -428,7 +428,7 @@ namespace Microsoft.AspNetCore.Components.Test { builder.OpenElement(0, "some element"); builder.AddContent(1, "hello"); - builder.AddAttribute(2, "name", new Action(eventInfo => { })); + builder.AddAttribute(2, "name", new Action(eventInfo => { })); }); } @@ -897,7 +897,7 @@ namespace Microsoft.AspNetCore.Components.Test // Arrange var builder = new RenderTreeBuilder(); - var value = new Action((e) => { }); + var value = new Action((e) => { }); // Act builder.OpenElement(0, "elem"); @@ -919,7 +919,7 @@ namespace Microsoft.AspNetCore.Components.Test // Act builder.OpenElement(0, "elem"); - builder.AddAttribute(1, "attr", (Action)null); + builder.AddAttribute(1, "attr", (Action)null); builder.CloseElement(); // Assert @@ -965,7 +965,7 @@ namespace Microsoft.AspNetCore.Components.Test frame => AssertFrame.Element(frame, "elem", 1, 0)); } - public static TheoryData> EventHandlerValues => new TheoryData> + public static TheoryData> EventHandlerValues => new TheoryData> { null, (e) => { }, @@ -973,7 +973,7 @@ namespace Microsoft.AspNetCore.Components.Test [Theory] [MemberData(nameof(EventHandlerValues))] - public void AddAttribute_Component_EventHandlerValue_SetsAttributeValue(Action value) + public void AddAttribute_Component_EventHandlerValue_SetsAttributeValue(Action value) { // Arrange var builder = new RenderTreeBuilder(); @@ -1241,7 +1241,7 @@ namespace Microsoft.AspNetCore.Components.Test // Arrange var builder = new RenderTreeBuilder(); - var value = new Action((e) => { }); + var value = new Action((e) => { }); // Act builder.OpenElement(0, "elem"); @@ -1261,7 +1261,7 @@ namespace Microsoft.AspNetCore.Components.Test // Arrange var builder = new RenderTreeBuilder(); - var value = new Action((e) => { }); + var value = new Action((e) => { }); // Act builder.OpenComponent(0); diff --git a/src/Components/Components/test/RenderTreeDiffBuilderTest.cs b/src/Components/Components/test/RenderTreeDiffBuilderTest.cs index 3c0edffd62..503d45155f 100644 --- a/src/Components/Components/test/RenderTreeDiffBuilderTest.cs +++ b/src/Components/Components/test/RenderTreeDiffBuilderTest.cs @@ -360,6 +360,23 @@ namespace Microsoft.AspNetCore.Components.Test Assert.Equal("More than one sibling has the same key value, 'key1'. Key values must be unique.", ex.Message); } + [Fact] + public void RejectsClashingKeysEvenIfAllPairsMatch() + { + // This sort of scenario would happen if you accidentally used a constant value for @key + + // Arrange + AddWithKey(oldTree, "key1", "attrib1a"); + AddWithKey(oldTree, "key1", "attrib1b"); + + AddWithKey(newTree, "key1", "attrib1a"); + AddWithKey(newTree, "key1", "attrib1b"); + + // Act/Assert + var ex = Assert.Throws(() => GetSingleUpdatedComponent()); + Assert.Equal("More than one sibling has the same key value, 'key1'. Key values must be unique.", ex.Message); + } + [Fact] public void HandlesInsertionOfUnkeyedItemsAroundKey() { @@ -835,9 +852,9 @@ namespace Microsoft.AspNetCore.Components.Test public void RecognizesAttributeEventHandlerValuesChanged() { // Arrange - Action retainedHandler = _ => { }; - Action removedHandler = _ => { }; - Action addedHandler = _ => { }; + Action retainedHandler = _ => { }; + Action removedHandler = _ => { }; + Action addedHandler = _ => { }; oldTree.OpenElement(0, "My element"); oldTree.AddAttribute(1, "onfoo", retainedHandler); oldTree.AddAttribute(2, "onbar", removedHandler); @@ -1575,7 +1592,7 @@ namespace Microsoft.AspNetCore.Components.Test public void PreservesEventHandlerIdsForRetainedEventHandlers() { // Arrange - Action retainedHandler = _ => { }; + Action retainedHandler = _ => { }; oldTree.OpenElement(0, "My element"); oldTree.AddAttribute(1, "ontest", retainedHandler); oldTree.CloseElement(); @@ -1601,7 +1618,7 @@ namespace Microsoft.AspNetCore.Components.Test public void PreservesEventHandlerIdsForRetainedEventHandlers_SlowPath() { // Arrange - Action retainedHandler = _ => { }; + Action retainedHandler = _ => { }; oldTree.OpenElement(0, "My element"); oldTree.AddAttribute(0, "ontest", retainedHandler); oldTree.CloseElement(); diff --git a/src/Components/Components/test/RendererTest.cs b/src/Components/Components/test/RendererTest.cs index c404e5360f..f895c47f10 100644 --- a/src/Components/Components/test/RendererTest.cs +++ b/src/Components/Components/test/RendererTest.cs @@ -430,7 +430,7 @@ namespace Microsoft.AspNetCore.Components.Test { // Arrange: Render a component with an event handler var renderer = new TestRenderer(); - UIEventArgs receivedArgs = null; + EventArgs receivedArgs = null; var component = new EventComponent { @@ -448,7 +448,7 @@ namespace Microsoft.AspNetCore.Components.Test Assert.Null(receivedArgs); // Act/Assert: Event can be fired - var eventArgs = new UIEventArgs(); + var eventArgs = new EventArgs(); var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs); // This should always be run synchronously @@ -460,7 +460,7 @@ namespace Microsoft.AspNetCore.Components.Test { // Arrange: Render a component with an event handler var renderer = new TestRenderer(); - UIEventArgs receivedArgs = null; + EventArgs receivedArgs = null; var component = new EventComponent { @@ -478,7 +478,7 @@ namespace Microsoft.AspNetCore.Components.Test Assert.Null(receivedArgs); // Act/Assert: Event can be fired - var eventArgs = new UIEventArgs(); + var eventArgs = new EventArgs(); var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs); Assert.True(renderTask.IsCompletedSuccessfully); Assert.Same(eventArgs, receivedArgs); @@ -508,7 +508,7 @@ namespace Microsoft.AspNetCore.Components.Test Assert.Empty(renderer.HandledExceptions); // Act/Assert: Event can be fired - var eventArgs = new UIEventArgs(); + var eventArgs = new EventArgs(); var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs); Assert.True(renderTask.IsCompletedSuccessfully); @@ -577,7 +577,7 @@ namespace Microsoft.AspNetCore.Components.Test [Fact] public void CanDispatchEventsToNestedComponents() { - UIEventArgs receivedArgs = null; + EventArgs receivedArgs = null; // Arrange: Render parent component var renderer = new TestRenderer(); @@ -608,7 +608,7 @@ namespace Microsoft.AspNetCore.Components.Test Assert.Null(receivedArgs); // Act/Assert: Event can be fired - var eventArgs = new UIEventArgs(); + var eventArgs = new EventArgs(); var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs); Assert.True(renderTask.IsCompletedSuccessfully); Assert.Same(eventArgs, receivedArgs); @@ -619,7 +619,7 @@ namespace Microsoft.AspNetCore.Components.Test { // Arrange: Render a component with an event handler var renderer = new TestRenderer(); - UIEventArgs receivedArgs = null; + EventArgs receivedArgs = null; var state = 0; var tcs = new TaskCompletionSource(); @@ -646,7 +646,7 @@ namespace Microsoft.AspNetCore.Components.Test Assert.Null(receivedArgs); // Act/Assert: Event can be fired - var eventArgs = new UIEventArgs(); + var eventArgs = new EventArgs(); var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs); Assert.Equal(1, state); Assert.Same(eventArgs, receivedArgs); @@ -746,7 +746,7 @@ namespace Microsoft.AspNetCore.Components.Test [Fact] public async Task CanAsyncDispatchEventsToNestedComponents() { - UIEventArgs receivedArgs = null; + EventArgs receivedArgs = null; var state = 0; var tcs = new TaskCompletionSource(); @@ -786,7 +786,7 @@ namespace Microsoft.AspNetCore.Components.Test Assert.Null(receivedArgs); // Act/Assert: Event can be fired - var eventArgs = new UIEventArgs(); + var eventArgs = new EventArgs(); var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs); Assert.Equal(1, state); Assert.Same(eventArgs, receivedArgs); @@ -1774,7 +1774,7 @@ namespace Microsoft.AspNetCore.Components.Test // Act/Assert await Assert.ThrowsAsync(() => { - return renderer.DispatchEventAsync(0, new UIEventArgs()); + return renderer.DispatchEventAsync(0, new EventArgs()); }); } @@ -2052,7 +2052,7 @@ namespace Microsoft.AspNetCore.Components.Test // Arrange var renderer = new TestRenderer(); var eventCount = 0; - Action origEventHandler = args => { eventCount++; }; + Action origEventHandler = args => { eventCount++; }; var component = new EventComponent { OnTest = origEventHandler }; var componentId = renderer.AssignRootComponentId(component); component.TriggerRender(); @@ -2094,7 +2094,7 @@ namespace Microsoft.AspNetCore.Components.Test // Arrange var renderer = new TestRenderer(); var eventCount = 0; - Action origEventHandler = args => { eventCount++; }; + Action origEventHandler = args => { eventCount++; }; var component = new EventComponent { OnTest = origEventHandler }; var componentId = renderer.AssignRootComponentId(component); component.TriggerRender(); @@ -2129,7 +2129,7 @@ namespace Microsoft.AspNetCore.Components.Test // Arrange var renderer = new TestRenderer(); var eventCount = 0; - Action origEventHandler = args => { eventCount++; }; + Action origEventHandler = args => { eventCount++; }; var component = new ConditionalParentComponent { IncludeChild = true, @@ -2180,7 +2180,7 @@ namespace Microsoft.AspNetCore.Components.Test // Arrange var renderer = new TestRenderer(); var eventCount = 0; - Action origEventHandler = args => { eventCount++; }; + Action origEventHandler = args => { eventCount++; }; var component = new EventComponent { OnTest = origEventHandler }; var componentId = renderer.AssignRootComponentId(component); component.TriggerRender(); @@ -2222,7 +2222,7 @@ namespace Microsoft.AspNetCore.Components.Test { builder.AddContent(0, "Child event count: " + eventCount); builder.OpenComponent(1); - builder.AddAttribute(2, nameof(EventComponent.OnTest), new Action(args => + builder.AddAttribute(2, nameof(EventComponent.OnTest), new Action(args => { eventCount++; rootComponent.TriggerRender(); @@ -2468,7 +2468,7 @@ namespace Microsoft.AspNetCore.Components.Test .AttributeEventHandlerId; // Act: Toggle the checkbox - var eventArgs = new UIChangeEventArgs { Value = true }; + var eventArgs = new ChangeEventArgs { Value = true }; var renderTask = renderer.DispatchEventAsync(checkboxChangeEventHandlerId, eventArgs); Assert.True(renderTask.IsCompletedSuccessfully); @@ -2713,7 +2713,7 @@ namespace Microsoft.AspNetCore.Components.Test }; var numEventsFired = 0; EventComponent component = null; - Action eventHandler = null; + Action eventHandler = null; eventHandler = _ => { @@ -2737,14 +2737,14 @@ namespace Microsoft.AspNetCore.Components.Test // Act/Assert 1: Event can be fired for the first time var render1TCS = new TaskCompletionSource(); renderer.NextUpdateDisplayReturnTask = render1TCS.Task; - await renderer.DispatchEventAsync(eventHandlerId, new UIEventArgs()); + await renderer.DispatchEventAsync(eventHandlerId, new EventArgs()); Assert.Equal(1, numEventsFired); // Act/Assert 2: *Same* event handler ID can be reused prior to completion of // preceding UI update var render2TCS = new TaskCompletionSource(); renderer.NextUpdateDisplayReturnTask = render2TCS.Task; - await renderer.DispatchEventAsync(eventHandlerId, new UIEventArgs()); + await renderer.DispatchEventAsync(eventHandlerId, new EventArgs()); Assert.Equal(2, numEventsFired); // Act/Assert 3: After we complete the first UI update in which a given @@ -2760,7 +2760,7 @@ namespace Microsoft.AspNetCore.Components.Test await awaitableTask; var ex = await Assert.ThrowsAsync(() => { - return renderer.DispatchEventAsync(eventHandlerId, new UIEventArgs()); + return renderer.DispatchEventAsync(eventHandlerId, new EventArgs()); }); Assert.Equal($"There is no event handler with ID {eventHandlerId}", ex.Message); Assert.Equal(2, numEventsFired); @@ -3318,7 +3318,7 @@ namespace Microsoft.AspNetCore.Components.Test FieldValue = "new property value", ComponentId = componentId }; - var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, eventFieldInfo, new UIChangeEventArgs + var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, eventFieldInfo, new ChangeEventArgs { Value = "new property value" }); @@ -3336,7 +3336,7 @@ namespace Microsoft.AspNetCore.Components.Test // show that the diff does *not* update the BoundString value attribute. Assert.Equal(RenderTreeEditType.SetAttribute, edit.Type); var attributeFrame = batch2.ReferenceFrames[edit.ReferenceFrameIndex]; - AssertFrame.Attribute(attributeFrame, "ontestevent", typeof(Action)); + AssertFrame.Attribute(attributeFrame, "ontestevent", typeof(Action)); Assert.NotEqual(default, attributeFrame.AttributeEventHandlerId); Assert.NotEqual(eventHandlerId, attributeFrame.AttributeEventHandlerId); }); @@ -3370,7 +3370,7 @@ namespace Microsoft.AspNetCore.Components.Test ComponentId = componentId, FieldValue = newPropertyValue, }; - var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, fieldInfo, new UIChangeEventArgs + var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, fieldInfo, new ChangeEventArgs { Value = newPropertyValue }); @@ -3388,7 +3388,7 @@ namespace Microsoft.AspNetCore.Components.Test // show that the diff does *not* update the BoundString value attribute. Assert.Equal(RenderTreeEditType.SetAttribute, edit.Type); var attributeFrame = latestBatch.ReferenceFrames[edit.ReferenceFrameIndex]; - AssertFrame.Attribute(attributeFrame, "ontestevent", typeof(Action)); + AssertFrame.Attribute(attributeFrame, "ontestevent", typeof(Action)); Assert.NotEqual(default, attributeFrame.AttributeEventHandlerId); Assert.NotEqual(eventHandlerId, attributeFrame.AttributeEventHandlerId); }); @@ -3507,10 +3507,10 @@ namespace Microsoft.AspNetCore.Components.Test private class EventComponent : AutoRenderComponent, IComponent, IHandleEvent { [Parameter] - public Action OnTest { get; set; } + public Action OnTest { get; set; } [Parameter] - public Func OnTestAsync { get; set; } + public Func OnTestAsync { get; set; } [Parameter] public Action OnClick { get; set; } @@ -3664,7 +3664,7 @@ namespace Microsoft.AspNetCore.Components.Test => _renderHandle.Render(builder => { builder.OpenElement(0, "my button"); - builder.AddAttribute(1, "my click handler", new Action(eventArgs => OnClick(eventArgs))); + builder.AddAttribute(1, "my click handler", new Action(eventArgs => OnClick(eventArgs))); builder.CloseElement(); }); } @@ -4095,7 +4095,7 @@ namespace Microsoft.AspNetCore.Components.Test builder.OpenElement(0, "element with event"); builder.AddAttribute(1, nameof(BoundString), BoundString); - builder.AddAttribute(2, "ontestevent", new Action((UIChangeEventArgs eventArgs) => + builder.AddAttribute(2, "ontestevent", new Action((ChangeEventArgs eventArgs) => { BoundString = (string)eventArgs.Value; TriggerRender(); @@ -4106,7 +4106,7 @@ namespace Microsoft.AspNetCore.Components.Test } } - private class DerivedEventArgs : UIEventArgs + private class DerivedEventArgs : EventArgs { } } diff --git a/src/Components/Components/test/Rendering/HtmlRendererTestBase.cs b/src/Components/Components/test/Rendering/HtmlRendererTestBase.cs index 894c8d4703..d12aaf32ad 100644 --- a/src/Components/Components/test/Rendering/HtmlRendererTestBase.cs +++ b/src/Components/Components/test/Rendering/HtmlRendererTestBase.cs @@ -343,7 +343,7 @@ namespace Microsoft.AspNetCore.Components.Rendering { rtb.OpenElement(0, "p"); rtb.OpenElement(1, "input"); - rtb.AddAttribute(2, "change", pc.GetValueOrDefault>("update")); + rtb.AddAttribute(2, "change", pc.GetValueOrDefault>("update")); rtb.AddAttribute(3, "value", pc.GetValueOrDefault("value")); rtb.CloseElement(); rtb.CloseElement(); @@ -354,7 +354,7 @@ namespace Microsoft.AspNetCore.Components.Rendering .BuildServiceProvider(); var htmlRenderer = GetHtmlRenderer(serviceProvider); - Action change = (UIChangeEventArgs changeArgs) => throw new InvalidOperationException(); + Action change = (ChangeEventArgs changeArgs) => throw new InvalidOperationException(); // Act var result = GetResult(htmlRenderer.Dispatcher.InvokeAsync(() => htmlRenderer.RenderComponentAsync( diff --git a/src/Components/Server/ref/Microsoft.AspNetCore.Components.Server.csproj b/src/Components/Server/ref/Microsoft.AspNetCore.Components.Server.csproj index e27f07cc33..491c5b8cff 100644 --- a/src/Components/Server/ref/Microsoft.AspNetCore.Components.Server.csproj +++ b/src/Components/Server/ref/Microsoft.AspNetCore.Components.Server.csproj @@ -7,11 +7,11 @@ - + diff --git a/src/Components/Server/ref/Microsoft.AspNetCore.Components.Server.netcoreapp3.0.cs b/src/Components/Server/ref/Microsoft.AspNetCore.Components.Server.netcoreapp3.0.cs index 6f6cba733d..7a89318f43 100644 --- a/src/Components/Server/ref/Microsoft.AspNetCore.Components.Server.netcoreapp3.0.cs +++ b/src/Components/Server/ref/Microsoft.AspNetCore.Components.Server.netcoreapp3.0.cs @@ -14,8 +14,6 @@ namespace Microsoft.AspNetCore.Builder } public static partial class ComponentEndpointRouteBuilderExtensions { - public static Microsoft.AspNetCore.Builder.ComponentEndpointConventionBuilder MapBlazorHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints) { throw null; } - public static Microsoft.AspNetCore.Builder.ComponentEndpointConventionBuilder MapBlazorHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, System.Action configureOptions) { throw null; } public static Microsoft.AspNetCore.Builder.ComponentEndpointConventionBuilder MapBlazorHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, System.Type type, string selector) { throw null; } public static Microsoft.AspNetCore.Builder.ComponentEndpointConventionBuilder MapBlazorHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, System.Type type, string selector, System.Action configureOptions) { throw null; } public static Microsoft.AspNetCore.Builder.ComponentEndpointConventionBuilder MapBlazorHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, System.Type componentType, string selector, string path) { throw null; } @@ -36,22 +34,6 @@ namespace Microsoft.AspNetCore.Components.Server public System.TimeSpan DisconnectedCircuitRetentionPeriod { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public System.TimeSpan JSInteropDefaultCallTimeout { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } - public partial class ComponentPrerenderingContext - { - public ComponentPrerenderingContext() { } - public System.Type ComponentType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.AspNetCore.Http.HttpContext Context { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.AspNetCore.Components.ParameterView Parameters { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public sealed partial class ComponentPrerenderResult - { - internal ComponentPrerenderResult() { } - public void WriteTo(System.IO.TextWriter writer) { } - } - public partial interface IComponentPrerenderer - { - System.Threading.Tasks.Task PrerenderComponentAsync(Microsoft.AspNetCore.Components.Server.ComponentPrerenderingContext context); - } } namespace Microsoft.AspNetCore.Components.Server.Circuits { @@ -69,15 +51,6 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits public virtual System.Threading.Tasks.Task OnConnectionDownAsync(Microsoft.AspNetCore.Components.Server.Circuits.Circuit circuit, System.Threading.CancellationToken cancellationToken) { throw null; } public virtual System.Threading.Tasks.Task OnConnectionUpAsync(Microsoft.AspNetCore.Components.Server.Circuits.Circuit circuit, System.Threading.CancellationToken cancellationToken) { throw null; } } - public partial class RemoteUriHelper : Microsoft.AspNetCore.Components.UriHelperBase - { - public RemoteUriHelper(Microsoft.Extensions.Logging.ILogger logger) { } - public bool HasAttachedJSRuntime { get { throw null; } } - public override void InitializeState(string uriAbsolute, string baseUriAbsolute) { } - protected override void NavigateToCore(string uri, bool forceLoad) { } - [Microsoft.JSInterop.JSInvokableAttribute("NotifyLocationChanged")] - public static void NotifyLocationChanged(string uriAbsolute, bool isInterceptedLink) { } - } } namespace Microsoft.Extensions.DependencyInjection { diff --git a/src/Components/Server/src/Builder/ComponentEndpointRouteBuilderExtensions.cs b/src/Components/Server/src/Builder/ComponentEndpointRouteBuilderExtensions.cs index 4248dae1d7..8af4ad37e8 100644 --- a/src/Components/Server/src/Builder/ComponentEndpointRouteBuilderExtensions.cs +++ b/src/Components/Server/src/Builder/ComponentEndpointRouteBuilderExtensions.cs @@ -15,42 +15,6 @@ namespace Microsoft.AspNetCore.Builder /// public static class ComponentEndpointRouteBuilderExtensions { - /// - /// Maps the Blazor to the default path. - /// - /// The . - /// The . - public static ComponentEndpointConventionBuilder MapBlazorHub(this IEndpointRouteBuilder endpoints) - { - if (endpoints == null) - { - throw new ArgumentNullException(nameof(endpoints)); - } - - return endpoints.MapBlazorHub(configureOptions: _ => { }); - } - - /// - /// Maps the Blazor to the default path. - /// - /// The . - /// A callback to configure dispatcher options. - /// The . - public static ComponentEndpointConventionBuilder MapBlazorHub(this IEndpointRouteBuilder endpoints, Action configureOptions) - { - if (endpoints == null) - { - throw new ArgumentNullException(nameof(endpoints)); - } - - if (configureOptions == null) - { - throw new ArgumentNullException(nameof(configureOptions)); - } - - return new ComponentEndpointConventionBuilder(endpoints.MapHub(ComponentHub.DefaultPath, configureOptions)); - } - /// ///Maps the Blazor to the default path and associates /// the component to this hub instance as the given DOM . diff --git a/src/Components/Server/src/Circuits/CircuitFactory.cs b/src/Components/Server/src/Circuits/CircuitFactory.cs index 05789adc4f..c91545d131 100644 --- a/src/Components/Server/src/Circuits/CircuitFactory.cs +++ b/src/Components/Server/src/Circuits/CircuitFactory.cs @@ -11,8 +11,8 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits public abstract CircuitHost CreateCircuitHost( HttpContext httpContext, CircuitClientProxy client, - string uriAbsolute, - string baseUriAbsolute, + string baseUri, + string uri, ClaimsPrincipal user); } } diff --git a/src/Components/Server/src/Circuits/CircuitHost.cs b/src/Components/Server/src/Circuits/CircuitHost.cs index 4f71c47775..563cacbff6 100644 --- a/src/Components/Server/src/Circuits/CircuitHost.cs +++ b/src/Components/Server/src/Circuits/CircuitHost.cs @@ -7,8 +7,6 @@ using System.Security.Claims; using System.Text.Json; using System.Threading; using System.Threading.Tasks; -using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.AspNetCore.Components.Routing; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.Web.Rendering; using Microsoft.Extensions.DependencyInjection; @@ -19,31 +17,28 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits { internal class CircuitHost : IAsyncDisposable { - private static readonly AsyncLocal _current = new AsyncLocal(); private readonly SemaphoreSlim HandlerLock = new SemaphoreSlim(1); private readonly IServiceScope _scope; private readonly CircuitHandler[] _circuitHandlers; private readonly ILogger _logger; private bool _initialized; - /// - /// Gets the current , if any. - /// - public static CircuitHost Current => _current.Value; - /// /// Sets the current . /// /// The . /// - /// Calling will store the circuit - /// and other related values such as the and + /// Calling will store related values such as the + /// and /// in the local execution context. Application code should not need to call this method, /// it is primarily used by the Server-Side Components infrastructure. /// public static void SetCurrentCircuitHost(CircuitHost circuitHost) { - _current.Value = circuitHost ?? throw new ArgumentNullException(nameof(circuitHost)); + if (circuitHost is null) + { + throw new ArgumentNullException(nameof(circuitHost)); + } JSInterop.JSRuntime.SetCurrentJSRuntime(circuitHost.JSRuntime); RendererRegistry.SetCurrentRendererRegistry(circuitHost.RendererRegistry); @@ -57,7 +52,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits CircuitClientProxy client, RendererRegistry rendererRegistry, RemoteRenderer renderer, - IList descriptors, + IReadOnlyList descriptors, RemoteJSRuntime jsRuntime, CircuitHandler[] circuitHandlers, ILogger logger) @@ -92,24 +87,10 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits public RendererRegistry RendererRegistry { get; } - public IList Descriptors { get; } + public IReadOnlyList Descriptors { get; } public IServiceProvider Services { get; } - public Task PrerenderComponentAsync(Type componentType, ParameterView parameters) - { - return Renderer.Dispatcher.InvokeAsync(async () => - { - var result = await Renderer.RenderComponentAsync(componentType, parameters); - - // When we prerender we start the circuit in a disconnected state. As such, we only call - // OnCircuitOpenenedAsync here and when the client reconnects we run OnConnectionUpAsync - await OnCircuitOpenedAsync(CancellationToken.None); - - return result; - }); - } - public void SetCircuitUser(ClaimsPrincipal user) { var authenticationStateProvider = Services.GetService() as IHostEnvironmentAuthenticationStateProvider; @@ -120,26 +101,6 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits } } - internal void InitializeCircuitAfterPrerender(UnhandledExceptionEventHandler unhandledException) - { - if (!_initialized) - { - _initialized = true; - UnhandledException += unhandledException; - var uriHelper = (RemoteUriHelper)Services.GetRequiredService(); - if (!uriHelper.HasAttachedJSRuntime) - { - uriHelper.AttachJsRuntime(JSRuntime); - } - - var navigationInterception = (RemoteNavigationInterception)Services.GetRequiredService(); - if (!navigationInterception.HasAttachedJSRuntime) - { - navigationInterception.AttachJSRuntime(JSRuntime); - } - } - } - internal void SendPendingBatches() { // Dispatch any buffered renders we accumulated during a disconnect. @@ -188,7 +149,6 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits return; } - await Renderer.Dispatcher.InvokeAsync(() => { SetCurrentCircuitHost(this); @@ -233,13 +193,11 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits // That's because AddComponentAsync waits for quiescence, which can take // arbitrarily long. In the meantime we might need to be receiving and // processing incoming JSInterop calls or similar. - for (var i = 0; i < Descriptors.Count; i++) + var count = Descriptors.Count; + for (var i = 0; i < count; i++) { - var (componentType, domElementSelector, prerendered) = Descriptors[i]; - if (!prerendered) - { - await Renderer.AddComponentAsync(componentType, domElementSelector); - } + var (componentType, domElementSelector) = Descriptors[i]; + await Renderer.AddComponentAsync(componentType, domElementSelector); } } catch (Exception ex) @@ -256,7 +214,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits try { AssertInitialized(); - if(assemblyName == "Microsoft.AspNetCore.Components.Web" && methodIdentifier == "DispatchEvent") + if (assemblyName == "Microsoft.AspNetCore.Components.Web" && methodIdentifier == "DispatchEvent") { Log.DispatchEventTroughJSInterop(_logger); return; @@ -271,6 +229,38 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits } catch (Exception ex) { + // We don't expect any of this code to actually throw, because DotNetDispatcher.BeginInvoke doesn't throw + // however, we still want this to get logged if we do. + UnhandledException?.Invoke(this, new UnhandledExceptionEventArgs(ex, isTerminating: false)); + } + } + + public async Task OnLocationChangedAsync(string uri, bool intercepted) + { + try + { + AssertInitialized(); + await Renderer.Dispatcher.InvokeAsync(() => + { + SetCurrentCircuitHost(this); + Log.LocationChange(_logger, CircuitId, uri); + var navigationManager = (RemoteNavigationManager)Services.GetRequiredService(); + navigationManager.NotifyLocationChanged(uri, intercepted); + Log.LocationChangeSucceeded(_logger, CircuitId, uri); + }); + } + catch (Exception ex) + { + // It's up to the NavigationManager implementation to validate the URI. + // + // Note that it's also possible that setting the URI could cause a failure in code that listens + // to NavigationManager.LocationChanged. + // + // In either case, a well-behaved client will not send invalid URIs, and we don't really + // want to continue processing with the circuit if setting the URI failed inside application + // code. The safest thing to do is consider it a critical failure since URI is global state, + // and a failure means that an update to global state was partially applied. + Log.LocationChangeFailed(_logger, CircuitId, uri, ex); UnhandledException?.Invoke(this, new UnhandledExceptionEventArgs(ex, isTerminating: false)); } } @@ -423,6 +413,9 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits private static readonly Action _dispatchEventFailedToParseEventDescriptor; private static readonly Action _dispatchEventFailedToDispatchEvent; private static readonly Action _dispatchEventThroughJSInterop; + private static readonly Action _locationChange; + private static readonly Action _locationChangeSucceeded; + private static readonly Action _locationChangeFailed; private static class EventIds { @@ -440,6 +433,9 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits public static readonly EventId EndInvokeJSFailed = new EventId(111, "EndInvokeJSFailed"); public static readonly EventId EndInvokeJSSucceeded = new EventId(112, "EndInvokeJSSucceeded"); public static readonly EventId DispatchEventThroughJSInterop = new EventId(113, "DispatchEventThroughJSInterop"); + public static readonly EventId LocationChange = new EventId(114, "LocationChange"); + public static readonly EventId LocationChangeSucceded = new EventId(115, "LocationChangeSucceeded"); + public static readonly EventId LocationChangeFailed = new EventId(116, "LocationChangeFailed"); } static Log() @@ -513,6 +509,21 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits LogLevel.Debug, EventIds.DispatchEventThroughJSInterop, "There was an intent to dispatch a browser event through JS interop."); + + _locationChange = LoggerMessage.Define( + LogLevel.Debug, + EventIds.LocationChange, + "Location changing to {URI} in {CircuitId}."); + + _locationChangeSucceeded = LoggerMessage.Define( + LogLevel.Debug, + EventIds.LocationChangeSucceded, + "Location change to {URI} in {CircuitId} succeded."); + + _locationChangeFailed = LoggerMessage.Define( + LogLevel.Debug, + EventIds.LocationChangeFailed, + "Location change to {URI} in {CircuitId} failed."); } public static void UnhandledExceptionInvokingCircuitHandler(ILogger logger, CircuitHandler handler, string handlerMethod, Exception exception) @@ -560,8 +571,13 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits } } - public static void DispatchEventTroughJSInterop(ILogger logger) => - _dispatchEventThroughJSInterop(logger, null); + public static void DispatchEventTroughJSInterop(ILogger logger) => _dispatchEventThroughJSInterop(logger, null); + + public static void LocationChange(ILogger logger, string circuitId, string uri) => _locationChange(logger, circuitId, uri, null); + + public static void LocationChangeSucceeded(ILogger logger, string circuitId, string uri) => _locationChangeSucceeded(logger, circuitId, uri, null); + + public static void LocationChangeFailed(ILogger logger, string circuitId, string uri, Exception exception) => _locationChangeFailed(logger, circuitId, uri, exception); } } } diff --git a/src/Components/Server/src/Circuits/CircuitPrerenderer.cs b/src/Components/Server/src/Circuits/CircuitPrerenderer.cs deleted file mode 100644 index 13917bad58..0000000000 --- a/src/Components/Server/src/Circuits/CircuitPrerenderer.cs +++ /dev/null @@ -1,207 +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; -using System.Linq; -using System.Runtime.ExceptionServices; -using System.Text.Json; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Extensions; - -namespace Microsoft.AspNetCore.Components.Server.Circuits -{ - internal class CircuitPrerenderer : IComponentPrerenderer - { - private static object CircuitHostKey = new object(); - private static object CancellationStatusKey = new object(); - private static readonly JsonSerializerOptions _jsonSerializationOptions = - new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; - - private readonly CircuitFactory _circuitFactory; - private readonly CircuitRegistry _registry; - - public CircuitPrerenderer( - CircuitFactory circuitFactory, - CircuitRegistry registry) - { - _circuitFactory = circuitFactory; - _registry = registry; - } - - public async Task PrerenderComponentAsync(ComponentPrerenderingContext prerenderingContext) - { - var context = prerenderingContext.Context; - var cancellationStatus = GetOrCreateCancellationStatus(context); - if (cancellationStatus.Canceled) - { - // Avoid creating a circuit host if other component earlier in the pipeline already triggered - // cancellation (e.g., by navigating or throwing). Instead render nothing. - return new ComponentPrerenderResult(Array.Empty()); - } - var circuitHost = GetOrCreateCircuitHost(context, cancellationStatus); - ComponentRenderedText renderResult; - try - { - renderResult = await circuitHost.PrerenderComponentAsync( - prerenderingContext.ComponentType, - prerenderingContext.Parameters); - } - catch (NavigationException navigationException) - { - // Cleanup the state as we won't need it any longer. - // Signal callbacks that we don't have to register the circuit. - await CleanupCircuitState(context, cancellationStatus, circuitHost); - - // Navigation was attempted during prerendering. - if (prerenderingContext.Context.Response.HasStarted) - { - // We can't perform a redirect as the server already started sending the response. - // This is considered an application error as the developer should buffer the response until - // all components have rendered. - throw new InvalidOperationException("A navigation command was attempted during prerendering after the server already started sending the response. " + - "Navigation commands can not be issued during server-side prerendering after the response from the server has started. Applications must buffer the" + - "reponse and avoid using features like FlushAsync() before all components on the page have been rendered to prevent failed navigation commands.", navigationException); - } - - context.Response.Redirect(navigationException.Location); - return new ComponentPrerenderResult(Array.Empty()); - } - catch - { - // If prerendering any component fails, cancel prerendering entirely and dispose the DI scope - await CleanupCircuitState(context, cancellationStatus, circuitHost); - throw; - } - - circuitHost.Descriptors.Add(new ComponentDescriptor - { - ComponentType = prerenderingContext.ComponentType, - Prerendered = true - }); - - var record = JsonSerializer.Serialize(new PrerenderedComponentRecord( - // We need to do this due to the fact that -- is not allowed within HTML comments and HTML doesn't encode '-'. - // We will never have '..' sequences because we Base64UrlEncode the circuit id - circuitHost.CircuitId.Replace("--", ".."), - circuitHost.Renderer.Id, - renderResult.ComponentId), - _jsonSerializationOptions); - - var result = (new[] { - $"", - }).Concat(renderResult.Tokens).Concat( - new[] { - $"" - }); - - return new ComponentPrerenderResult(result); - } - - private PrerenderingCancellationStatus GetOrCreateCancellationStatus(HttpContext context) - { - if (context.Items.TryGetValue(CancellationStatusKey, out var existingValue)) - { - return (PrerenderingCancellationStatus)existingValue; - } - else - { - var cancellationStatus = new PrerenderingCancellationStatus(); - context.Items[CancellationStatusKey] = cancellationStatus; - return cancellationStatus; - } - } - - private static async Task CleanupCircuitState(HttpContext context, PrerenderingCancellationStatus cancellationStatus, CircuitHost circuitHost) - { - cancellationStatus.Canceled = true; - context.Items.Remove(CircuitHostKey); - await circuitHost.DisposeAsync(); - } - - private CircuitHost GetOrCreateCircuitHost(HttpContext context, PrerenderingCancellationStatus cancellationStatus) - { - if (context.Items.TryGetValue(CircuitHostKey, out var existingHost)) - { - return (CircuitHost)existingHost; - } - else - { - var result = _circuitFactory.CreateCircuitHost( - context, - client: new CircuitClientProxy(), // This creates an "offline" client. - GetFullUri(context.Request), - GetFullBaseUri(context.Request), - context.User); - - result.UnhandledException += CircuitHost_UnhandledException; - context.Response.OnCompleted(() => - { - result.UnhandledException -= CircuitHost_UnhandledException; - if (!cancellationStatus.Canceled) - { - _registry.RegisterDisconnectedCircuit(result); - } - - return Task.CompletedTask; - }); - context.Items.Add(CircuitHostKey, result); - - return result; - } - } - - private void CircuitHost_UnhandledException(object sender, UnhandledExceptionEventArgs e) - { - // Throw all exceptions encountered during pre-rendering so the default developer - // error page can respond. - ExceptionDispatchInfo.Capture((Exception)e.ExceptionObject).Throw(); - } - - private string GetFullUri(HttpRequest request) - { - return UriHelper.BuildAbsolute( - request.Scheme, - request.Host, - request.PathBase, - request.Path, - request.QueryString); - } - - private string GetFullBaseUri(HttpRequest request) - { - var result = UriHelper.BuildAbsolute(request.Scheme, request.Host, request.PathBase); - - // PathBase may be "/" or "/some/thing", but to be a well-formed base URI - // it has to end with a trailing slash - if (!result.EndsWith('/')) - { - result += '/'; - } - - return result; - } - - private readonly struct PrerenderedComponentRecord - { - public PrerenderedComponentRecord(string circuitId, int rendererId, int componentId) - { - CircuitId = circuitId; - RendererId = rendererId; - ComponentId = componentId; - } - - public string CircuitId { get; } - - public int RendererId { get; } - - public int ComponentId { get; } - } - - private class PrerenderingCancellationStatus - { - public bool Canceled { get; set; } - } - } -} diff --git a/src/Components/Server/src/Circuits/CircuitRegistry.cs b/src/Components/Server/src/Circuits/CircuitRegistry.cs index 091d993548..9fe25c5b68 100644 --- a/src/Components/Server/src/Circuits/CircuitRegistry.cs +++ b/src/Components/Server/src/Circuits/CircuitRegistry.cs @@ -81,6 +81,15 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits } } + public void PermanentDisconnect(CircuitHost circuitHost) + { + if (ConnectedCircuits.TryRemove(circuitHost.CircuitId, out _)) + { + Log.CircuitDisconnectedPermanently(_logger, circuitHost.CircuitId); + circuitHost.Client.SetDisconnected(); + } + } + public virtual Task DisconnectAsync(CircuitHost circuitHost, string connectionId) { Log.CircuitDisconnectStarted(_logger, circuitHost.CircuitId, connectionId); @@ -314,6 +323,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits private static readonly Action _circuitNotActive; private static readonly Action _circuitConnectedToDifferentConnection; private static readonly Action _circuitMarkedDisconnected; + private static readonly Action _circuitDisconnectedPermanently; private static readonly Action _circuitEvicted; private static class EventIds @@ -330,6 +340,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits public static readonly EventId CircuitConnectedToDifferentConnection = new EventId(109, "CircuitConnectedToDifferentConnection"); public static readonly EventId CircuitMarkedDisconnected = new EventId(110, "CircuitMarkedDisconnected"); public static readonly EventId CircuitEvicted = new EventId(111, "CircuitEvicted"); + public static readonly EventId CircuitDisconnectedPermanently = new EventId(112, "CircuitDisconnectedPermanently"); } static Log() @@ -394,6 +405,11 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits EventIds.CircuitMarkedDisconnected, "Circuit with id {CircuitId} is disconnected."); + _circuitDisconnectedPermanently = LoggerMessage.Define( + LogLevel.Debug, + EventIds.CircuitDisconnectedPermanently, + "Circuit with id {CircuitId} has been removed from the registry for permanent disconnection."); + _circuitEvicted = LoggerMessage.Define( LogLevel.Debug, EventIds.CircuitEvicted, @@ -436,6 +452,9 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits public static void CircuitMarkedDisconnected(ILogger logger, string circuitId) => _circuitMarkedDisconnected(logger, circuitId, null); + public static void CircuitDisconnectedPermanently(ILogger logger, string circuitId) => + _circuitDisconnectedPermanently(logger, circuitId, null); + public static void CircuitEvicted(ILogger logger, string circuitId, EvictionReason evictionReason) => _circuitEvicted(logger, circuitId, evictionReason, null); } diff --git a/src/Components/Server/src/Circuits/DefaultCircuitFactory.cs b/src/Components/Server/src/Circuits/DefaultCircuitFactory.cs index 5d5a0118db..d353d5dc2c 100644 --- a/src/Components/Server/src/Circuits/DefaultCircuitFactory.cs +++ b/src/Components/Server/src/Circuits/DefaultCircuitFactory.cs @@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.JSInterop; +using System.Threading.Tasks; namespace Microsoft.AspNetCore.Components.Server.Circuits { @@ -38,10 +39,12 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits public override CircuitHost CreateCircuitHost( HttpContext httpContext, CircuitClientProxy client, - string uriAbsolute, - string baseUriAbsolute, + string baseUri, + string uri, ClaimsPrincipal user) { + // We do as much intialization as possible eagerly in this method, which makes the error handling + // story much simpler. If we throw from here, it's handled inside the initial hub method. var components = ResolveComponentMetadata(httpContext, client); var scope = _scopeFactory.CreateScope(); @@ -51,20 +54,25 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits jsRuntime.Initialize(client); componentContext.Initialize(client); - var uriHelper = (RemoteUriHelper)scope.ServiceProvider.GetRequiredService(); + var authenticationStateProvider = scope.ServiceProvider.GetService() as IHostEnvironmentAuthenticationStateProvider; + if (authenticationStateProvider != null) + { + var authenticationState = new AuthenticationState(httpContext.User); // TODO: Get this from the hub connection context instead + authenticationStateProvider.SetAuthenticationState(Task.FromResult(authenticationState)); + } + + var navigationManager = (RemoteNavigationManager)scope.ServiceProvider.GetRequiredService(); var navigationInterception = (RemoteNavigationInterception)scope.ServiceProvider.GetRequiredService(); if (client.Connected) { - uriHelper.AttachJsRuntime(jsRuntime); - uriHelper.InitializeState( - uriAbsolute, - baseUriAbsolute); + navigationManager.AttachJsRuntime(jsRuntime); + navigationManager.Initialize(baseUri, uri); navigationInterception.AttachJSRuntime(jsRuntime); } else { - uriHelper.InitializeState(uriAbsolute, baseUriAbsolute); + navigationManager.Initialize(baseUri, uri); } var rendererRegistry = new RendererRegistry(); @@ -100,7 +108,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits return circuitHost; } - internal static IList ResolveComponentMetadata(HttpContext httpContext, CircuitClientProxy client) + internal static List ResolveComponentMetadata(HttpContext httpContext, CircuitClientProxy client) { if (!client.Connected) { diff --git a/src/Components/Server/src/Circuits/RemoteNavigationInterception.cs b/src/Components/Server/src/Circuits/RemoteNavigationInterception.cs index 3609adf95d..1a689621e5 100644 --- a/src/Components/Server/src/Circuits/RemoteNavigationInterception.cs +++ b/src/Components/Server/src/Circuits/RemoteNavigationInterception.cs @@ -5,7 +5,7 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Components.Routing; using Microsoft.JSInterop; -using Interop = Microsoft.AspNetCore.Components.Web.BrowserUriHelperInterop; +using Interop = Microsoft.AspNetCore.Components.Web.BrowserNavigationManagerInterop; namespace Microsoft.AspNetCore.Components.Server.Circuits { diff --git a/src/Components/Server/src/Circuits/RemoteUriHelper.cs b/src/Components/Server/src/Circuits/RemoteNavigationManager.cs similarity index 57% rename from src/Components/Server/src/Circuits/RemoteUriHelper.cs rename to src/Components/Server/src/Circuits/RemoteNavigationManager.cs index b285868ab4..b57130c29a 100644 --- a/src/Components/Server/src/Circuits/RemoteUriHelper.cs +++ b/src/Components/Server/src/Circuits/RemoteNavigationManager.cs @@ -2,26 +2,26 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Components.Routing; using Microsoft.Extensions.Logging; using Microsoft.JSInterop; -using Interop = Microsoft.AspNetCore.Components.Web.BrowserUriHelperInterop; +using Interop = Microsoft.AspNetCore.Components.Web.BrowserNavigationManagerInterop; namespace Microsoft.AspNetCore.Components.Server.Circuits { /// - /// A Server-Side Components implementation of . + /// A Server-Side Blazor implementation of . /// - public class RemoteUriHelper : UriHelperBase + internal class RemoteNavigationManager : NavigationManager, IHostEnvironmentNavigationManager { - private readonly ILogger _logger; + private readonly ILogger _logger; private IJSRuntime _jsRuntime; /// - /// Creates a new instance. + /// Creates a new instance. /// /// The . - public RemoteUriHelper(ILogger logger) + public RemoteNavigationManager(ILogger logger) { _logger = logger; } @@ -32,21 +32,21 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits public bool HasAttachedJSRuntime => _jsRuntime != null; /// - /// Initializes the . + /// Initializes the . /// - /// The absolute URI of the current page. - /// The absolute base URI of the current page. - public override void InitializeState(string uriAbsolute, string baseUriAbsolute) + /// The base URI. + /// The absolute URI. + public new void Initialize(string baseUri, string uri) { - base.InitializeState(uriAbsolute, baseUriAbsolute); - TriggerOnLocationChanged(isinterceptedLink: false); + base.Initialize(baseUri, uri); + NotifyLocationChanged(isInterceptedLink: false); } /// - /// Initializes the . + /// Initializes the . /// /// The to use for interoperability. - internal void AttachJsRuntime(IJSRuntime jsRuntime) + public void AttachJsRuntime(IJSRuntime jsRuntime) { if (_jsRuntime != null) { @@ -54,31 +54,14 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits } _jsRuntime = jsRuntime; - - _jsRuntime.InvokeAsync( - Interop.ListenForNavigationEvents, - typeof(RemoteUriHelper).Assembly.GetName().Name, - nameof(NotifyLocationChanged)); } - /// - /// For framework use only. - /// - [JSInvokable(nameof(NotifyLocationChanged))] - public static void NotifyLocationChanged(string uriAbsolute, bool isInterceptedLink) + public void NotifyLocationChanged(string uri, bool intercepted) { - var circuit = CircuitHost.Current; - if (circuit == null) - { - var message = $"{nameof(NotifyLocationChanged)} called without a circuit."; - throw new InvalidOperationException(message); - } + Log.ReceivedLocationChangedNotification(_logger, uri, intercepted); - var uriHelper = (RemoteUriHelper)circuit.Services.GetRequiredService(); - Log.ReceivedLocationChangedNotification(uriHelper._logger, uriAbsolute, isInterceptedLink); - - uriHelper.SetAbsoluteUri(uriAbsolute); - uriHelper.TriggerOnLocationChanged(isInterceptedLink); + Uri = uri; + NotifyLocationChanged(intercepted); } /// diff --git a/src/Components/Server/src/Circuits/RemoteRenderer.cs b/src/Components/Server/src/Circuits/RemoteRenderer.cs index 198780db22..8b9ebb341a 100644 --- a/src/Components/Server/src/Circuits/RemoteRenderer.cs +++ b/src/Components/Server/src/Circuits/RemoteRenderer.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Concurrent; +using System.Diagnostics; using System.Linq; using System.Text.Encodings.Web; using System.Threading; @@ -10,6 +11,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Components.Rendering; using Microsoft.AspNetCore.Components.Server.Circuits; using Microsoft.AspNetCore.SignalR; +using Microsoft.Extensions.Internal; using Microsoft.Extensions.Logging; using Microsoft.JSInterop; @@ -138,7 +140,8 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering pendingRender = new UnacknowledgedRenderBatch( renderId, arrayBuilder, - new TaskCompletionSource()); + new TaskCompletionSource(), + ValueStopwatch.StartNew()); // Buffer the rendered batches no matter what. We'll send it down immediately when the client // is connected or right after the client reconnects. @@ -256,13 +259,14 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering private void ProcessPendingBatch(string errorMessageOrNull, UnacknowledgedRenderBatch entry) { + var elapsedTime = entry.ValueStopwatch.GetElapsedTime(); if (errorMessageOrNull == null) { - Log.CompletingBatchWithoutError(_logger, entry.BatchId); + Log.CompletingBatchWithoutError(_logger, entry.BatchId, elapsedTime); } else { - Log.CompletingBatchWithError(_logger, entry.BatchId, errorMessageOrNull); + Log.CompletingBatchWithError(_logger, entry.BatchId, errorMessageOrNull, elapsedTime); } entry.Data.Dispose(); @@ -283,16 +287,18 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering internal readonly struct UnacknowledgedRenderBatch { - public UnacknowledgedRenderBatch(long batchId, ArrayBuilder data, TaskCompletionSource completionSource) + public UnacknowledgedRenderBatch(long batchId, ArrayBuilder data, TaskCompletionSource completionSource, ValueStopwatch valueStopwatch) { BatchId = batchId; Data = data; CompletionSource = completionSource; + ValueStopwatch = valueStopwatch; } public long BatchId { get; } public ArrayBuilder Data { get; } public TaskCompletionSource CompletionSource { get; } + public ValueStopwatch ValueStopwatch { get; } } private void CaptureAsyncExceptions(Task task) @@ -312,8 +318,8 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering private static readonly Action _beginUpdateDisplayAsync; private static readonly Action _bufferingRenderDisconnectedClient; private static readonly Action _sendBatchDataFailed; - private static readonly Action _completingBatchWithError; - private static readonly Action _completingBatchWithoutError; + private static readonly Action _completingBatchWithError; + private static readonly Action _completingBatchWithoutError; private static readonly Action _receivedDuplicateBatchAcknowledgement; private static class EventIds @@ -349,15 +355,15 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering EventIds.SendBatchDataFailed, "Sending data for batch failed: {Message}"); - _completingBatchWithError = LoggerMessage.Define( + _completingBatchWithError = LoggerMessage.Define( LogLevel.Debug, EventIds.CompletingBatchWithError, - "Completing batch {BatchId} with error: {ErrorMessage}"); + "Completing batch {BatchId} with error: {ErrorMessage} in {ElapsedMilliseconds}ms."); - _completingBatchWithoutError = LoggerMessage.Define( + _completingBatchWithoutError = LoggerMessage.Define( LogLevel.Debug, EventIds.CompletingBatchWithoutError, - "Completing batch {BatchId} without error"); + "Completing batch {BatchId} without error in {ElapsedMilliseconds}ms."); _receivedDuplicateBatchAcknowledgement = LoggerMessage.Define( LogLevel.Debug, @@ -396,20 +402,22 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering null); } - public static void CompletingBatchWithError(ILogger logger, long batchId, string errorMessage) + public static void CompletingBatchWithError(ILogger logger, long batchId, string errorMessage, TimeSpan elapsedTime) { _completingBatchWithError( logger, batchId, errorMessage, + elapsedTime.TotalMilliseconds, null); } - public static void CompletingBatchWithoutError(ILogger logger, long batchId) + public static void CompletingBatchWithoutError(ILogger logger, long batchId, TimeSpan elapsedTime) { _completingBatchWithoutError( logger, batchId, + elapsedTime.TotalMilliseconds, null); } diff --git a/src/Components/Server/src/DependencyInjection/ComponentDescriptor.cs b/src/Components/Server/src/ComponentDescriptor.cs similarity index 81% rename from src/Components/Server/src/DependencyInjection/ComponentDescriptor.cs rename to src/Components/Server/src/ComponentDescriptor.cs index c97debe7db..30c6319974 100644 --- a/src/Components/Server/src/DependencyInjection/ComponentDescriptor.cs +++ b/src/Components/Server/src/ComponentDescriptor.cs @@ -11,13 +11,10 @@ namespace Microsoft.AspNetCore.Components.Server public string Selector { get; set; } - public bool Prerendered { get; set; } - - public void Deconstruct(out Type componentType, out string selector, out bool prerendered) + public void Deconstruct(out Type componentType, out string selector) { componentType = ComponentType; selector = Selector; - prerendered = Prerendered; } } } diff --git a/src/Components/Server/src/ComponentHub.cs b/src/Components/Server/src/ComponentHub.cs index ed796e73a1..4da9a3391e 100644 --- a/src/Components/Server/src/ComponentHub.cs +++ b/src/Components/Server/src/ComponentHub.cs @@ -48,6 +48,9 @@ namespace Microsoft.AspNetCore.Components.Server /// /// For unit testing only. /// + // We store the circuit host in Context.Items which is tied to the lifetime of the underlying + // SignalR connection. There's no need to clean this up, it's a non-owning reference and it + // will go away when the connection does. internal CircuitHost CircuitHost { get => (CircuitHost)Context.Items[CircuitKey]; @@ -65,14 +68,40 @@ namespace Microsoft.AspNetCore.Components.Server return Task.CompletedTask; } - CircuitHost = null; - return _circuitRegistry.DisconnectAsync(circuitHost, Context.ConnectionId); + if (exception != null) + { + return _circuitRegistry.DisconnectAsync(circuitHost, Context.ConnectionId); + } + else + { + // The client will gracefully disconnect when using websockets by correctly closing the TCP connection. + // This happens when the user closes a tab, navigates away from the page or reloads the page. + // In these situations we know the user is done with the circuit, so we can get rid of it at that point. + // This is important to be able to more efficiently manage resources, specially memory. + return TerminateCircuitGracefully(circuitHost); + } + } + + private async Task TerminateCircuitGracefully(CircuitHost circuitHost) + { + try + { + Log.CircuitTerminatedGracefully(_logger, circuitHost.CircuitId); + _circuitRegistry.PermanentDisconnect(circuitHost); + await circuitHost.DisposeAsync(); + } + catch (Exception e) + { + Log.UnhandledExceptionInCircuit(_logger, circuitHost.CircuitId, e); + } + + await _circuitRegistry.DisconnectAsync(circuitHost, Context.ConnectionId); } /// /// Intended for framework use only. Applications should not call this method directly. /// - public string StartCircuit(string uriAbsolute, string baseUriAbsolute) + public string StartCircuit(string baseUri, string uri) { if (CircuitHost != null) { @@ -81,6 +110,18 @@ namespace Microsoft.AspNetCore.Components.Server return null; } + if (baseUri == null || + uri == null || + !Uri.IsWellFormedUriString(baseUri, UriKind.Absolute) || + !Uri.IsWellFormedUriString(uri, UriKind.Absolute)) + { + // We do some really minimal validation here to prevent obviously wrong data from getting in + // without duplicating too much logic. + Log.InvalidInputData(_logger); + _ = NotifyClientError(Clients.Caller, $"The uris provided are invalid."); + return null; + } + var circuitClient = new CircuitClientProxy(Clients.Caller, Context.ConnectionId); if (DefaultCircuitFactory.ResolveComponentMetadata(Context.GetHttpContext(), circuitClient).Count == 0) { @@ -93,26 +134,35 @@ namespace Microsoft.AspNetCore.Components.Server return null; } - var circuitHost = _circuitFactory.CreateCircuitHost( - Context.GetHttpContext(), - circuitClient, - uriAbsolute, - baseUriAbsolute, - Context.User); + try + { + var circuitHost = _circuitFactory.CreateCircuitHost( + Context.GetHttpContext(), + circuitClient, + baseUri, + uri, + Context.User); - circuitHost.UnhandledException += CircuitHost_UnhandledException; + circuitHost.UnhandledException += CircuitHost_UnhandledException; - // Fire-and-forget the initialization process, because we can't block the - // SignalR message loop (we'd get a deadlock if any of the initialization - // logic relied on receiving a subsequent message from SignalR), and it will - // take care of its own errors anyway. - _ = circuitHost.InitializeAsync(Context.ConnectionAborted); + // Fire-and-forget the initialization process, because we can't block the + // SignalR message loop (we'd get a deadlock if any of the initialization + // logic relied on receiving a subsequent message from SignalR), and it will + // take care of its own errors anyway. + _ = circuitHost.InitializeAsync(Context.ConnectionAborted); - _circuitRegistry.Register(circuitHost); - - CircuitHost = circuitHost; - - return circuitHost.CircuitId; + // It's safe to *publish* the circuit now because nothing will be able + // to run inside it until after InitializeAsync completes. + _circuitRegistry.Register(circuitHost); + CircuitHost = circuitHost; + return circuitHost.CircuitId; + } + catch (Exception ex) + { + Log.CircuitInitializationFailed(_logger, ex); + NotifyClientError(Clients.Caller, "The circuit failed to initialize."); + return null; + } } /// @@ -124,8 +174,8 @@ namespace Microsoft.AspNetCore.Components.Server if (circuitHost != null) { CircuitHost = circuitHost; + CircuitHost.UnhandledException += CircuitHost_UnhandledException; - circuitHost.InitializeCircuitAfterPrerender(CircuitHost_UnhandledException); circuitHost.SetCircuitUser(Context.User); circuitHost.SendPendingBatches(); return true; @@ -195,6 +245,18 @@ namespace Microsoft.AspNetCore.Components.Server CircuitHost.Renderer.OnRenderCompleted(renderId, errorMessageOrNull); } + public void OnLocationChanged(string uri, bool intercepted) + { + if (CircuitHost == null) + { + Log.CircuitHostNotInitialized(_logger); + NotifyClientError(Clients.Caller, "Circuit not initialized."); + return; + } + + _ = CircuitHost.OnLocationChangedAsync(uri, intercepted); + } + private async void CircuitHost_UnhandledException(object sender, UnhandledExceptionEventArgs e) { var circuitHost = (CircuitHost)sender; @@ -246,8 +308,16 @@ namespace Microsoft.AspNetCore.Components.Server LoggerMessage.Define(LogLevel.Debug, new EventId(5, "CircuitAlreadyInitialized"), "The circuit host '{CircuitId}' has already been initialized"); private static readonly Action _circuitHostNotInitialized = - LoggerMessage.Define(LogLevel.Debug, new EventId(6, "CircuitHostNotInitialized"), "Call to '{CallSite}' received before the circuit host initialization."); + LoggerMessage.Define(LogLevel.Debug, new EventId(6, "CircuitHostNotInitialized"), "Call to '{CallSite}' received before the circuit host initialization"); + private static readonly Action _circuitTerminatedGracefully = + LoggerMessage.Define(LogLevel.Debug, new EventId(7, "CircuitTerminatedGracefully"), "Circuit '{CircuitId}' terminated gracefully"); + + private static readonly Action _invalidInputData = + LoggerMessage.Define(LogLevel.Debug, new EventId(8, "InvalidInputData"), "Call to '{CallSite}' received invalid input data"); + + private static readonly Action _circuitInitializationFailed = + LoggerMessage.Define(LogLevel.Debug, new EventId(9, "CircuitInitializationFailed"), "Circuit initialization failed"); public static void NoComponentsRegisteredInEndpoint(ILogger logger, string endpointDisplayName) { @@ -272,6 +342,12 @@ namespace Microsoft.AspNetCore.Components.Server public static void CircuitAlreadyInitialized(ILogger logger, string circuitId) => _circuitAlreadyInitialized(logger, circuitId, null); public static void CircuitHostNotInitialized(ILogger logger, [CallerMemberName] string callSite = "") => _circuitHostNotInitialized(logger, callSite, null); + + public static void CircuitTerminatedGracefully(ILogger logger, string circuitId) => _circuitTerminatedGracefully(logger, circuitId, null); + + public static void InvalidInputData(ILogger logger, [CallerMemberName] string callSite = "") => _invalidInputData(logger, callSite, null); + + public static void CircuitInitializationFailed(ILogger logger, Exception exception) => _circuitInitializationFailed(logger, exception); } } } diff --git a/src/Components/Server/src/DependencyInjection/ComponentServiceCollectionExtensions.cs b/src/Components/Server/src/DependencyInjection/ComponentServiceCollectionExtensions.cs index 7bb89a4144..50bf75132d 100644 --- a/src/Components/Server/src/DependencyInjection/ComponentServiceCollectionExtensions.cs +++ b/src/Components/Server/src/DependencyInjection/ComponentServiceCollectionExtensions.cs @@ -63,16 +63,10 @@ namespace Microsoft.Extensions.DependencyInjection services.TryAddSingleton(); - // We explicitly take over the prerendering and components services here. - // We can't have two separate component implementations coexisting at the - // same time, so when you register components (Circuits) it takes over - // all the abstractions. - services.AddScoped(); - - // Standard razor component services implementations + // Standard blazor hosting services implementations // // These intentionally replace the non-interactive versions included in MVC. - services.AddScoped(); + services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); diff --git a/src/Components/Server/src/Microsoft.AspNetCore.Components.Server.csproj b/src/Components/Server/src/Microsoft.AspNetCore.Components.Server.csproj index ffa9a5ffb4..3f87bd43af 100644 --- a/src/Components/Server/src/Microsoft.AspNetCore.Components.Server.csproj +++ b/src/Components/Server/src/Microsoft.AspNetCore.Components.Server.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.0 @@ -14,12 +14,13 @@ - + + diff --git a/src/Components/Server/src/Prerendering/ComponentPrerenderResult.cs b/src/Components/Server/src/Prerendering/ComponentPrerenderResult.cs deleted file mode 100644 index 3a8aa93632..0000000000 --- a/src/Components/Server/src/Prerendering/ComponentPrerenderResult.cs +++ /dev/null @@ -1,33 +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.Collections.Generic; -using System.IO; - -namespace Microsoft.AspNetCore.Components.Server -{ - /// - /// Represents the result of a prerendering an . - /// - public sealed class ComponentPrerenderResult - { - private readonly IEnumerable _result; - - internal ComponentPrerenderResult(IEnumerable result) - { - _result = result; - } - - /// - /// Writes the prerendering result to the given . - /// - /// The the results will be written to. - public void WriteTo(TextWriter writer) - { - foreach (var element in _result) - { - writer.Write(element); - } - } - } -} diff --git a/src/Components/Server/src/Prerendering/ComponentPrerenderingContext.cs b/src/Components/Server/src/Prerendering/ComponentPrerenderingContext.cs deleted file mode 100644 index f423bf9ce6..0000000000 --- a/src/Components/Server/src/Prerendering/ComponentPrerenderingContext.cs +++ /dev/null @@ -1,29 +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; -using Microsoft.AspNetCore.Http; - -namespace Microsoft.AspNetCore.Components.Server -{ - /// - /// The context for prerendering a component. - /// - public class ComponentPrerenderingContext - { - /// - /// Gets or sets the component type. - /// - public Type ComponentType { get; set; } - - /// - /// Gets or sets the parameters for the component. - /// - public ParameterView Parameters { get; set; } - - /// - /// Gets or sets the in which the prerendering has been initiated. - /// - public HttpContext Context { get; set; } - } -} diff --git a/src/Components/Server/src/Prerendering/IComponentPrerenderer.cs b/src/Components/Server/src/Prerendering/IComponentPrerenderer.cs deleted file mode 100644 index a8513af17d..0000000000 --- a/src/Components/Server/src/Prerendering/IComponentPrerenderer.cs +++ /dev/null @@ -1,20 +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.Threading.Tasks; - -namespace Microsoft.AspNetCore.Components.Server -{ - /// - /// Prerrenders instances. - /// - public interface IComponentPrerenderer - { - /// - /// Prerrenders the component . - /// - /// The context in which the prerrendering is happening. - /// that will complete when the prerendering is done. - Task PrerenderComponentAsync(ComponentPrerenderingContext context); - } -} diff --git a/src/Components/Server/test/Circuits/CircuitPrerendererTest.cs b/src/Components/Server/test/Circuits/CircuitPrerendererTest.cs deleted file mode 100644 index 8d54c3e257..0000000000 --- a/src/Components/Server/test/Circuits/CircuitPrerendererTest.cs +++ /dev/null @@ -1,253 +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; -using System.IO; -using System.Security.Claims; -using System.Text.Json; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components.Server.Circuits; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; -using Microsoft.Extensions.Options; -using Moq; -using Xunit; - -namespace Microsoft.AspNetCore.Components.Server.Tests.Circuits -{ - public class CircuitPrerendererTest - { - private static readonly Regex ContentWrapperRegex = new Regex( - "(?.*)", - RegexOptions.Compiled | RegexOptions.Singleline, TimeSpan.FromSeconds(1)); // Treat the entire input string as a single line - - private static readonly Regex CircuitInfoRegex = new Regex( - ".*", - RegexOptions.Compiled | RegexOptions.Singleline, TimeSpan.FromSeconds(1)); // Treat the entire input string as a single line - - // Because CircuitPrerenderer is a point of integration with HttpContext, - // it's not a good candidate for unit testing. The majority of prerendering - // unit tests should be elsewhere in HtmlRendererTests inside the - // Microsoft.AspNetCore.Components.Tests projects. - // - // The only unit tests added here should specifically be about how we're - // interacting with the HttpContext for configuring the prerenderer. - - [Fact] - public async Task ExtractsUriFromHttpContext_EmptyPathBase() - { - // Arrange - var circuitFactory = new TestCircuitFactory(); - var circuitRegistry = new CircuitRegistry( - Options.Create(new CircuitOptions()), - Mock.Of>(), - TestCircuitIdFactory.CreateTestFactory()); - var circuitPrerenderer = new CircuitPrerenderer(circuitFactory, circuitRegistry); - var httpContext = new DefaultHttpContext(); - var httpRequest = httpContext.Request; - httpRequest.Scheme = "https"; - httpRequest.Host = new HostString("example.com", 1234); - httpRequest.Path = "/some/path"; - - var prerenderingContext = new ComponentPrerenderingContext - { - ComponentType = typeof(UriDisplayComponent), - Parameters = ParameterView.Empty, - Context = httpContext - }; - - // Act - var result = await circuitPrerenderer.PrerenderComponentAsync(prerenderingContext); - // Assert - Assert.Equal(string.Join("", new[] - { - "The current URI is ", - "https://example.com:1234/some/path", - " within base URI ", - "https://example.com:1234/" - }), GetUnwrappedContent(result)); - } - - private string GetUnwrappedContent(ComponentPrerenderResult rawResult) - { - var writer = new StringWriter(); - rawResult.WriteTo(writer); - return ContentWrapperRegex.Match(writer.ToString()) - .Groups["content"].Value - .Replace("\r\n","\n"); - } - - private JsonDocument GetUnwrappedCircuitInfo(ComponentPrerenderResult rawResult) - { - var writer = new StringWriter(); - rawResult.WriteTo(writer); - var circuitInfo = CircuitInfoRegex.Match(writer.ToString()).Groups["info"].Value; - - return JsonDocument.Parse(circuitInfo); - } - - [Fact] - public async Task ExtractsUriFromHttpContext_NonemptyPathBase() - { - // Arrange - var circuitFactory = new TestCircuitFactory(); - var circuitRegistry = new CircuitRegistry( - Options.Create(new CircuitOptions()), - Mock.Of>(), - TestCircuitIdFactory.CreateTestFactory()); - var circuitPrerenderer = new CircuitPrerenderer(circuitFactory, circuitRegistry); - var httpContext = new DefaultHttpContext(); - var httpRequest = httpContext.Request; - httpRequest.Scheme = "https"; - httpRequest.Host = new HostString("example.com", 1234); - httpRequest.PathBase = "/my/dir"; - httpRequest.Path = "/some/path"; - - var prerenderingContext = new ComponentPrerenderingContext - { - ComponentType = typeof(UriDisplayComponent), - Parameters = ParameterView.Empty, - Context = httpContext - }; - - // Act - var result = await circuitPrerenderer.PrerenderComponentAsync(prerenderingContext); - - // Assert - Assert.Equal(string.Join("", new[] - { - "The current URI is ", - "https://example.com:1234/my/dir/some/path", - " within base URI ", - "https://example.com:1234/my/dir/" - }), GetUnwrappedContent(result)); - } - - [Fact] - public async Task ReplacesDashesWithDots_WhenTheyAppearInPairs() - { - // Arrange - var circuitFactory = new TestCircuitFactory(() => "--1234--"); - var circuitRegistry = new CircuitRegistry( - Options.Create(new CircuitOptions()), - Mock.Of>(), - TestCircuitIdFactory.CreateTestFactory()); - var circuitPrerenderer = new CircuitPrerenderer(circuitFactory, circuitRegistry); - var httpContext = new DefaultHttpContext(); - var httpRequest = httpContext.Request; - httpRequest.Scheme = "https"; - httpRequest.Host = new HostString("example.com", 1234); - httpRequest.Path = "/some/path"; - - var prerenderingContext = new ComponentPrerenderingContext - { - ComponentType = typeof(UriDisplayComponent), - Parameters = ParameterView.Empty, - Context = httpContext - }; - - // Act - var result = await circuitPrerenderer.PrerenderComponentAsync(prerenderingContext); - - // Assert - Assert.Equal("..1234..", GetUnwrappedCircuitInfo(result).RootElement.GetProperty("circuitId").GetString()); - } - - [Fact] - public async Task DisposesCircuitScopeEvenIfPrerenderingThrows() - { - // Arrange - var circuitFactory = new MockServiceScopeCircuitFactory(); - var circuitRegistry = new CircuitRegistry( - Options.Create(new CircuitOptions()), - Mock.Of>(), - TestCircuitIdFactory.CreateTestFactory()); - var httpContext = new DefaultHttpContext(); - var prerenderer = new CircuitPrerenderer(circuitFactory, circuitRegistry); - var prerenderingContext = new ComponentPrerenderingContext - { - ComponentType = typeof(ThrowExceptionComponent), - Parameters = ParameterView.Empty, - Context = httpContext - }; - - // Act - await Assert.ThrowsAsync(async () => - await prerenderer.PrerenderComponentAsync(prerenderingContext)); - - // Assert - circuitFactory.MockServiceScope.Verify(scope => scope.Dispose(), Times.Once()); - } - - class TestCircuitFactory : CircuitFactory - { - private readonly Func _circuitIdFactory; - - public TestCircuitFactory(Func circuitIdFactory = null) - { - _circuitIdFactory = circuitIdFactory ?? (() => Guid.NewGuid().ToString()); - } - - public override CircuitHost CreateCircuitHost(HttpContext httpContext, CircuitClientProxy client, string uriAbsolute, string baseUriAbsolute, ClaimsPrincipal user) - { - var serviceCollection = new ServiceCollection(); - serviceCollection.AddScoped(_ => - { - var uriHelper = new RemoteUriHelper(NullLogger.Instance); - uriHelper.InitializeState(uriAbsolute, baseUriAbsolute); - return uriHelper; - }); - var serviceScope = serviceCollection.BuildServiceProvider().CreateScope(); - return TestCircuitHost.Create(_circuitIdFactory(), serviceScope); - } - } - - class MockServiceScopeCircuitFactory : CircuitFactory - { - public Mock MockServiceScope { get; } - = new Mock(); - - public override CircuitHost CreateCircuitHost(HttpContext httpContext, CircuitClientProxy client, string uriAbsolute, string baseUriAbsolute, ClaimsPrincipal user) - { - return TestCircuitHost.Create(Guid.NewGuid().ToString(), MockServiceScope.Object); - } - } - - class UriDisplayComponent : IComponent - { - private RenderHandle _renderHandle; - - [Inject] IUriHelper UriHelper { get; set; } - - public void Attach(RenderHandle renderHandle) - { - _renderHandle = renderHandle; - } - - public Task SetParametersAsync(ParameterView parameters) - { - _renderHandle.Render(builder => - { - builder.AddContent(0, "The current URI is "); - builder.AddContent(1, UriHelper.GetAbsoluteUri()); - builder.AddContent(2, " within base URI "); - builder.AddContent(3, UriHelper.GetBaseUri()); - }); - - return Task.CompletedTask; - } - } - - class ThrowExceptionComponent : IComponent - { - public void Attach(RenderHandle renderHandle) - => throw new InvalidTimeZoneException(); - - public Task SetParametersAsync(ParameterView parameters) - => Task.CompletedTask; - } - } -} diff --git a/src/Components/Server/test/Circuits/TestCircuitHost.cs b/src/Components/Server/test/Circuits/TestCircuitHost.cs index 2d03c22e34..f8f5996d95 100644 --- a/src/Components/Server/test/Circuits/TestCircuitHost.cs +++ b/src/Components/Server/test/Circuits/TestCircuitHost.cs @@ -11,7 +11,6 @@ using Microsoft.AspNetCore.SignalR; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; -using Microsoft.Extensions.Logging.Testing; using Microsoft.Extensions.Options; using Moq; @@ -19,7 +18,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits { internal class TestCircuitHost : CircuitHost { - private TestCircuitHost(string circuitId, IServiceScope scope, CircuitClientProxy client, RendererRegistry rendererRegistry, RemoteRenderer renderer, IList descriptors, RemoteJSRuntime jsRuntime, CircuitHandler[] circuitHandlers, ILogger logger) + private TestCircuitHost(string circuitId, IServiceScope scope, CircuitClientProxy client, RendererRegistry rendererRegistry, RemoteRenderer renderer, IReadOnlyList descriptors, RemoteJSRuntime jsRuntime, CircuitHandler[] circuitHandlers, ILogger logger) : base(circuitId, scope, client, rendererRegistry, renderer, descriptors, jsRuntime, circuitHandlers, logger) { } diff --git a/src/Components/Server/test/ComponentEndpointRouteBuilderExtensionsTest.cs b/src/Components/Server/test/ComponentEndpointRouteBuilderExtensionsTest.cs index 456d9facd7..cba13e8581 100644 --- a/src/Components/Server/test/ComponentEndpointRouteBuilderExtensionsTest.cs +++ b/src/Components/Server/test/ComponentEndpointRouteBuilderExtensionsTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Diagnostics; +using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Moq; @@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Components.Server.Tests .UseRouting() .UseEndpoints(endpoints => { - endpoints.MapBlazorHub(dispatchOptions => called = true); + endpoints.MapBlazorHub("app", dispatchOptions => called = true); }).Build(); // Assert @@ -68,5 +68,18 @@ namespace Microsoft.AspNetCore.Components.Server.Tests return new ApplicationBuilder(serviceProvder); } + + private class MyComponent : IComponent + { + public void Attach(RenderHandle renderHandle) + { + throw new System.NotImplementedException(); + } + + public Task SetParametersAsync(ParameterView parameters) + { + throw new System.NotImplementedException(); + } + } } } diff --git a/src/Components/Shared/test/AssertFrame.cs b/src/Components/Shared/test/AssertFrame.cs index b0cff34f41..1fb2debbf2 100644 --- a/src/Components/Shared/test/AssertFrame.cs +++ b/src/Components/Shared/test/AssertFrame.cs @@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Components.Test.Helpers Assert.Equal(attributeValue, frame.AttributeValue); } - public static void Attribute(RenderTreeFrame frame, string attributeName, Action attributeEventHandlerValue, int? sequence = null) + public static void Attribute(RenderTreeFrame frame, string attributeName, Action attributeEventHandlerValue, int? sequence = null) { AssertFrame.Attribute(frame, attributeName, sequence); Assert.Equal(attributeEventHandlerValue, frame.AttributeValue); diff --git a/src/Components/Shared/test/TestRenderer.cs b/src/Components/Shared/test/TestRenderer.cs index 6b5f751818..d5ce07bf4b 100644 --- a/src/Components/Shared/test/TestRenderer.cs +++ b/src/Components/Shared/test/TestRenderer.cs @@ -60,10 +60,10 @@ namespace Microsoft.AspNetCore.Components.Test.Helpers public new Task RenderRootComponentAsync(int componentId, ParameterView parameters) => Dispatcher.InvokeAsync(() => base.RenderRootComponentAsync(componentId, parameters)); - public Task DispatchEventAsync(ulong eventHandlerId, UIEventArgs args) + public Task DispatchEventAsync(ulong eventHandlerId, EventArgs args) => Dispatcher.InvokeAsync(() => base.DispatchEventAsync(eventHandlerId, null, args)); - public new Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo eventFieldInfo, UIEventArgs args) + public new Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo eventFieldInfo, EventArgs args) => Dispatcher.InvokeAsync(() => base.DispatchEventAsync(eventHandlerId, eventFieldInfo, args)); private static Task UnwrapTask(Task task) diff --git a/src/Components/Web.JS/dist/Release/blazor.server.js b/src/Components/Web.JS/dist/Release/blazor.server.js index 7f9b325d4e..a79de53cec 100644 --- a/src/Components/Web.JS/dist/Release/blazor.server.js +++ b/src/Components/Web.JS/dist/Release/blazor.server.js @@ -1,15 +1,15 @@ -!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=49)}([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";n.d(t,"a",function(){return a}),n.d(t,"c",function(){return c}),n.d(t,"f",function(){return u}),n.d(t,"g",function(){return l}),n.d(t,"h",function(){return f}),n.d(t,"e",function(){return h}),n.d(t,"d",function(){return p}),n.d(t,"b",function(){return d});var r=n(0),o=n(7),i=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})},s=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=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}(),d=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(e,t,n){"use strict";n.r(t);var r,o,i=n(3),s=n(4),a=n(43),c=n(0),u=(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)}),l=function(e){function t(t){var n=e.call(this)||this;return n.logger=t,n}return u(t,e),t.prototype.send=function(e){var t=this;return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new i.a):e.method?e.url?new Promise(function(n,r){var o=new XMLHttpRequest;o.open(e.method,e.url,!0),o.withCredentials=!0,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.setRequestHeader("Content-Type","text/plain;charset=UTF-8");var a=e.headers;a&&Object.keys(a).forEach(function(e){o.setRequestHeader(e,a[e])}),e.responseType&&(o.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=function(){o.abort(),r(new i.a)}),e.timeout&&(o.timeout=e.timeout),o.onload=function(){e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?n(new s.b(o.status,o.statusText,o.response||o.responseText)):r(new i.b(o.statusText,o.status))},o.onerror=function(){t.logger.log(c.a.Warning,"Error from HTTP request. "+o.status+": "+o.statusText+"."),r(new i.b(o.statusText,o.status))},o.ontimeout=function(){t.logger.log(c.a.Warning,"Timeout from HTTP request."),r(new i.c)},o.send(e.content||"")}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t}(s.a),f=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)}}(),h=function(e){function t(t){var n=e.call(this)||this;return"undefined"!=typeof XMLHttpRequest?n.httpClient=new l(t):n.httpClient=new a.a(t),n}return f(t,e),t.prototype.send=function(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new i.a):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}(s.a),p=n(44);!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"}(o||(o={}));var d,g=n(1),y=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])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=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 E.WebSockets:if(!this.options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new A(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.WebSocket);case E.ServerSentEvents:if(!this.options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new O(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.EventSource);case E.LongPolling:return new P(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1);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=E[e.transport];if(null==r)return this.logger.log(c.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(c.a.Debug,"Skipping transport '"+E[r]+"' because it was disabled by the client."),new Error("'"+E[r]+"' is disabled by the client.");if(!(e.transferFormats.map(function(e){return S[e]}).indexOf(n)>=0))return this.logger.log(c.a.Debug,"Skipping transport '"+E[r]+"' because it does not support the requested transfer format '"+S[n]+"'."),new Error("'"+E[r]+"' does not support "+S[n]+".");if(r===E.WebSockets&&!this.options.WebSocket||r===E.ServerSentEvents&&!this.options.EventSource)return this.logger.log(c.a.Debug,"Skipping transport '"+E[r]+"' because it is not supported in your environment.'"),new Error("'"+E[r]+"' is not supported in your environment.");this.logger.log(c.a.Debug,"Selecting transport '"+E[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){if(this.logger.log(c.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){if("Disconnecting"===this.connectionState&&this.stopPromiseResolver(),e?this.logger.log(c.a.Error,"Connection disconnected with error '"+e+"'."):this.logger.log(c.a.Information,"Connection disconnected."),this.connectionId=void 0,this.connectionState="Disconnected",this.onclose&&this.connectionStarted){this.connectionStarted=!1;try{this.onclose(e)}catch(t){this.logger.log(c.a.Error,"HttpConnection.onclose("+e+") threw error '"+t+"'.")}}}else this.logger.log(c.a.Warning,"Call to HttpConnection.stopConnection("+e+") was ignored because the connection hasn't yet left the in the connecting state.");else this.logger.log(c.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(!g.c.isBrowser||!window.document)throw new Error("Cannot resolve '"+e+"'.");var t=window.document.createElement("a");return t.href=e,this.logger.log(c.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",n+=-1===t?"":e.substring(t)},e}();var q=function(){function e(e){this.transport=e,this.buffer=[],this.executing=!0,this.sendBufferedData=new W,this.transportResult=new W,this.sendLoopPromise=this.sendLoop()}return e.prototype.send=function(e){return this.bufferData(e),this.transportResult||(this.transportResult=new W),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 B(this,void 0,void 0,function(){var t,n,r;return j(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 W,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])){s=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}(),d=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(e,t,n){"use strict";n.r(t);var r,o,i=n(3),s=n(4),a=n(43),c=n(0),u=(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)}),l=function(e){function t(t){var n=e.call(this)||this;return n.logger=t,n}return u(t,e),t.prototype.send=function(e){var t=this;return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new i.a):e.method?e.url?new Promise(function(n,r){var o=new XMLHttpRequest;o.open(e.method,e.url,!0),o.withCredentials=!0,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.setRequestHeader("Content-Type","text/plain;charset=UTF-8");var a=e.headers;a&&Object.keys(a).forEach(function(e){o.setRequestHeader(e,a[e])}),e.responseType&&(o.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=function(){o.abort(),r(new i.a)}),e.timeout&&(o.timeout=e.timeout),o.onload=function(){e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?n(new s.b(o.status,o.statusText,o.response||o.responseText)):r(new i.b(o.statusText,o.status))},o.onerror=function(){t.logger.log(c.a.Warning,"Error from HTTP request. "+o.status+": "+o.statusText+"."),r(new i.b(o.statusText,o.status))},o.ontimeout=function(){t.logger.log(c.a.Warning,"Timeout from HTTP request."),r(new i.c)},o.send(e.content||"")}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t}(s.a),f=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)}}(),h=function(e){function t(t){var n=e.call(this)||this;return"undefined"!=typeof XMLHttpRequest?n.httpClient=new l(t):n.httpClient=new a.a(t),n}return f(t,e),t.prototype.send=function(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new i.a):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}(s.a),p=n(44);!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"}(o||(o={}));var d,g=n(1),y=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])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=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 E.WebSockets:if(!this.options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new A(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.WebSocket);case E.ServerSentEvents:if(!this.options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new O(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.EventSource);case E.LongPolling:return new x(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1);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=E[e.transport];if(null==r)return this.logger.log(c.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(c.a.Debug,"Skipping transport '"+E[r]+"' because it was disabled by the client."),new Error("'"+E[r]+"' is disabled by the client.");if(!(e.transferFormats.map(function(e){return S[e]}).indexOf(n)>=0))return this.logger.log(c.a.Debug,"Skipping transport '"+E[r]+"' because it does not support the requested transfer format '"+S[n]+"'."),new Error("'"+E[r]+"' does not support "+S[n]+".");if(r===E.WebSockets&&!this.options.WebSocket||r===E.ServerSentEvents&&!this.options.EventSource)return this.logger.log(c.a.Debug,"Skipping transport '"+E[r]+"' because it is not supported in your environment.'"),new Error("'"+E[r]+"' is not supported in your environment.");this.logger.log(c.a.Debug,"Selecting transport '"+E[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){if(this.logger.log(c.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){if("Disconnecting"===this.connectionState&&this.stopPromiseResolver(),e?this.logger.log(c.a.Error,"Connection disconnected with error '"+e+"'."):this.logger.log(c.a.Information,"Connection disconnected."),this.connectionId=void 0,this.connectionState="Disconnected",this.onclose&&this.connectionStarted){this.connectionStarted=!1;try{this.onclose(e)}catch(t){this.logger.log(c.a.Error,"HttpConnection.onclose("+e+") threw error '"+t+"'.")}}}else this.logger.log(c.a.Warning,"Call to HttpConnection.stopConnection("+e+") was ignored because the connection hasn't yet left the in the connecting state.");else this.logger.log(c.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(!g.c.isBrowser||!window.document)throw new Error("Cannot resolve '"+e+"'.");var t=window.document.createElement("a");return t.href=e,this.logger.log(c.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",n+=-1===t?"":e.substring(t)},e}();var q=function(){function e(e){this.transport=e,this.buffer=[],this.executing=!0,this.sendBufferedData=new W,this.transportResult=new W,this.sendLoopPromise=this.sendLoop()}return e.prototype.send=function(e){return this.bufferData(e),this.transportResult||(this.transportResult=new W),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 B(this,void 0,void 0,function(){var t,n,r;return j(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 W,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;o * @license MIT */ -var r=n(50),o=n(51),i=n(52);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().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=e[t];e[t]=e[n],e[n]=r}function y(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:v(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):v(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,o){var i,s=1,a=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;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var l=-1;for(i=n;ia&&(n=a-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 s=0;s>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 I(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],s=e[o+2],128==(192&i)&&128==(192&s)&&(c=(15&u)<<12|(63&i)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>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<=T)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.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 P(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return x(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(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),s=(n>>>=0)-(t>>>=0),a=Math.min(i,s),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 b(this,e,t,n);case"utf8":case"utf-8":return m(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(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)}};var T=4096;function k(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 O(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 M(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 L(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 A(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 B(e,t,n,r,i){return i||A(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function j(e,t,n,r,i){return i||A(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||D(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||D(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||D(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||D(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||D(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||D(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||D(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||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||D(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||D(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||D(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||D(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||D(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||D(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)||O(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||O(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||O(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||O(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):L(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||O(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):L(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);O(this,e,t,n,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i>0)-a&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);O(this,e,t,n,o-1,-o)}var i=n-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||O(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||O(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||O(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):L(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||O(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):L(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return j(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return j(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(s+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(10))},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(){}return e.prototype.log=function(e,t){},e.instance=new e,e}()},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(){}return e.write=function(t){return""+t+e.RecordSeparator},e.parse=function(t){if(t[t.length-1]!==e.RecordSeparator)throw new Error("Message is incomplete.");var n=t.split(e.RecordSeparator);return n.pop(),n},e.RecordSeparatorCode=30,e.RecordSeparator=String.fromCharCode(e.RecordSeparatorCode),e}()},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){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r=n(23),o=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var i=n(19);i.inherits=n(15);var s=n(36),a=n(41);i.inherits(f,s);for(var c=o(a.prototype),u=0;u=0,"must have a non-negative type"),o(s,"must have a decode function"),this.registerEncoder(function(e){return e instanceof t},function(t){var o=i(),s=r.allocUnsafe(1);return s.writeInt8(e,0),o.append(s),o.append(n(t)),o}),this.registerDecoder(e,s),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:s.encoder,decoder:s.decoder,buffer:!0,type:"msgpack5",IncompleteBufferError:a.IncompleteBufferError}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=p("_blazorLogicalChildren"),o=p("_blazorLogicalParent"),i=p("_blazorLogicalEnd");function s(e,t){if(e.childNodes.length>0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return e[r]=[],e}function a(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 s=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 s=i.nextSibling;if(n.insertBefore(i,t),i===o)break;i=s}n.removeChild(t)}),t.forEach(function(e){n[e.toSiblingIndex]=e.moveRangeStart})},t.getClosestDomElement=l},function(e,t,n){var r=n(6),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),i(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.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},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){"use strict";var r;!function(e){window.DotNet=e;var t=[],n={},r={},o=1,i=null;function s(e){t.push(e)}function a(e,t){for(var n=[],r=2;r1)for(var n=1;n0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]this.length)&&(r=this.length),n>=this.length)return e||i.alloc(0);if(r<=0)return e||i.alloc(0);var o,s,a=!!e,c=this._offset(n),u=r-n,l=u,f=a&&t||0,h=c[1];if(0===n&&r==this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:i.concat(this._bufs,this.length);for(s=0;s(o=this._bufs[s].length-h))){this._bufs[s].copy(e,f,h,h+l);break}this._bufs[s].copy(e,f,h),f+=o,l-=o,h&&(h=0)}return e},s.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 s(o)},s.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},s.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},s.prototype.duplicate=function(){for(var e=0,t=new s;e0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=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=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.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 s=Object.keys(n),a=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),S(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(n);if(0===s.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="",_=!1,I=["{","}"];(p(n)&&(_=!0,I=["[","]"]),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!==s.length||_&&0!=n.length?r<0?m(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),u=_?function(e,t,n,r,o){for(var i=[],s=0,a=t.length;s=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,I)):I[0]+w+I[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,o,i){var s,a,c;if((c=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),k(r,o)||(s="["+o+"]"),a||(e.seen.indexOf(c.value)<0?(a=g(n)?l(e,c.value,null):l(e,c.value,n-1)).indexOf("\n")>-1&&(a=i?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),b(s)){if(i&&o.match(/^\d+$/))return a;(s=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}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]"===_(e)}function w(e){return"object"==typeof e&&null!==e}function E(e){return w(e)&&"[object Date]"===_(e)}function S(e){return w(e)&&("[object Error]"===_(e)||e instanceof Error)}function C(e){return"function"==typeof e}function _(e){return Object.prototype.toString.call(e)}function I(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(),!s[n])if(new RegExp("\\b"+n+"\\b","i").test(i)){var r=e.pid;s[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else s[n]=function(){};return s[n]},t.inspect=a,a.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]},a.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(54);var T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,n;console.log("%s - %s",(e=new Date,n=[I(e.getHours()),I(e.getMinutes()),I(e.getSeconds())].join(":"),[e.getDate(),T[e.getMonth()],n].join(" ")),t.format.apply(t,arguments))},t.inherits=n(55),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 P(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||s.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),r?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):E(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?E(e,s,t,!1):T(e,s)):E(e,s,t,!1))):r||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=S?e=S:(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 _(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"),R(e)}function T(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(s===i.length?o+=i:o+=i.slice(0,e),0===(e-=s)){s===i.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(s));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,s=e>i.length?i.length:e;if(i.copy(n,n.length-e,0,s),0===(e-=s)){s===i.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(s));break}++o}return t.length-=o,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function O(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(M,t,e))}function M(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function L(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?O(this):_(this),null;if(0===(e=C(e,t))&&t.ended)return 0===t.length&&O(this),null;var r,o=t.needReadable;return p("need readable",o),(0===t.length||t.length-e0?D(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&O(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&&a(e,"data")&&(t.flowing=!0,R(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!==L(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===a(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]?s(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?this:(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&&s.length>o&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=function(){for(var e=[],t=0;t0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var u=c.length,l=d(c,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){s=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},a.prototype.listeners=function(e){return h(this,e,!0)},a.prototype.rawListeners=function(e){return h(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p,a.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(23);function o(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,i=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return i||s?(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(61).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=a,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 s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(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(23);function s(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 a,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(64)},f=n(38),h=n(14).Buffer,p=o.Uint8Array||function(){};var d,g=n(39);function y(){}function v(e,t){a=a||n(11),e=e||{};var r=t instanceof a;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(_,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(o(r),e._writableState.errorEmitted=!0,e.emit("error",r),_(e,t))}(e,n,r,t,o);else{var s=S(n);s||n.corked||n.bufferProcessing||!n.bufferedRequest||E(e,n),r?c(w,e,n,s,o):w(e,n,s,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 s(this)}function b(e){if(a=a||n(11),!(d.call(b,this)||this instanceof a))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,s){t.writelen=r,t.writecb=s,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(),_(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 a=0,c=!0;n;)o[a]=n,n.isBuf||(c=!1),n=n.next,a+=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 s(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"),_(e,t)})}function _(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,s=!1,a=!o.objectMode&&(r=e,h.isBuffer(r)||r instanceof p);return a&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?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):(a||function(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}(this,o,e,n))&&(o.pendingcb++,s=function(e,t,n,r,o,i){if(!n){var s=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n));return t}(t,r,o);r!==s&&(n=!0,o="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;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,_(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(18),n(62).setImmediate,n(10))},function(e,t,n){"use strict";e.exports=s;var r=n(11),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.length=200&&c.statusCode<300?r(new s.b(c.statusCode,c.statusMessage||"",u)):o(new i.b(c.statusMessage||"",c.statusCode||0))});t.abortSignal&&(t.abortSignal.onabort=function(){f.abort(),o(new i.a)})})},n.prototype.getCookieString=function(e){return this.cookieJar.getCookieString(e)},n}(s.a)}).call(this,n(6).Buffer)},function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return i});var r=n(8),o=n(1),i=function(){function t(){}return t.prototype.writeHandshakeRequest=function(e){return r.a.write(JSON.stringify(e))},t.prototype.parseHandshakeResponse=function(t){var n,i;if(Object(o.g)(t)||void 0!==e&&t instanceof e){var s=new Uint8Array(t);if(-1===(c=s.indexOf(r.a.RecordSeparatorCode)))throw new Error("Message is incomplete.");var a=c+1;n=String.fromCharCode.apply(null,s.slice(0,a)),i=s.byteLength>a?s.slice(a).buffer:null}else{var c,u=t;if(-1===(c=u.indexOf(r.a.RecordSeparator)))throw new Error("Message is incomplete.");a=c+1;n=u.substring(0,a),i=u.length>a?u.substring(a):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(6).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 s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)s.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 s},s=this&&this.__spread||function(){for(var e=[],t=0;t0?r-4:r,f=0;f>16&255,a[c++]=t>>8&255,a[c++]=255&t;2===s&&(t=o[e.charCodeAt(f)]<<2|o[e.charCodeAt(f+1)]>>4,a[c++]=255&t);1===s&&(t=o[e.charCodeAt(f)]<<10|o[e.charCodeAt(f+1)]<<4|o[e.charCodeAt(f+2)]>>2,a[c++]=t>>8&255,a[c++]=255&t);return a},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=0,a=n-o;sa?a:s+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,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a0)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,s=[],a=t;a>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,s,a=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+=a;l>0;i=256*i+e[t+f],f+=h,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),i-=u}return(p?-1:1)*s*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var s,a,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?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+f>=1?h/c:h*Math.pow(2,1-f))*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*c-1)*Math.pow(2,o),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,o),s=0));o>=8;e[n+p]=255&a,p+=d,a/=256,o-=8);for(s=s<0;e[n+p]=255&s,p+=d,s/=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(50),o=n(51),i=n(52);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().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=e[t];e[t]=e[n],e[n]=r}function y(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:v(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):v(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,o){var i,s=1,a=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;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var l=-1;for(i=n;ia&&(n=a-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 s=0;s>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 I(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],s=e[o+2],128==(192&i)&&128==(192&s)&&(c=(15&u)<<12|(63&i)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>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<=T)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.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 I(this,t,n);case"ascii":return k(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 R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(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),s=(n>>>=0)-(t>>>=0),a=Math.min(i,s),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 b(this,e,t,n);case"utf8":case"utf-8":return m(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(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)}};var T=4096;function k(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 O(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 M(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 L(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 A(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 B(e,t,n,r,i){return i||A(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function j(e,t,n,r,i){return i||A(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||D(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||D(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||D(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||D(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||D(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||D(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||D(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||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||D(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||D(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||D(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||D(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||D(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||D(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)||O(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||O(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||O(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||O(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):L(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||O(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):L(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);O(this,e,t,n,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i>0)-a&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);O(this,e,t,n,o-1,-o)}var i=n-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||O(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||O(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||O(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):L(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||O(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):L(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return j(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return j(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(s+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(10))},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(){}return e.prototype.log=function(e,t){},e.instance=new e,e}()},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(){}return e.write=function(t){return""+t+e.RecordSeparator},e.parse=function(t){if(t[t.length-1]!==e.RecordSeparator)throw new Error("Message is incomplete.");var n=t.split(e.RecordSeparator);return n.pop(),n},e.RecordSeparatorCode=30,e.RecordSeparator=String.fromCharCode(e.RecordSeparatorCode),e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(25),n(9);var r=n(26),o=n(16),i={},s=!1;function a(e,t,n){var o=i[e];o||(o=i[e]=new r.BrowserRenderer(e)),o.attachRootComponentToLogicalElement(n,t)}t.attachRootComponentToLogicalElement=a,t.attachRootComponentToElement=function(e,t,n){var r=document.querySelector(t);if(!r)throw new Error("Could not find any element matching selector '"+t+"'.");a(e,o.toLogicalElement(r,!0),n)},t.renderBatch=function(e,t){var n=i[e];if(!n)throw new Error("There is no browser renderer with ID "+e+".");for(var r=t.arrayRangeReader,o=t.updatedComponents(),a=r.values(o),c=r.count(o),u=t.referenceFrames(),l=r.values(u),f=t.diffReader,h=0;h=0,"must have a non-negative type"),o(s,"must have a decode function"),this.registerEncoder(function(e){return e instanceof t},function(t){var o=i(),s=r.allocUnsafe(1);return s.writeInt8(e,0),o.append(s),o.append(n(t)),o}),this.registerDecoder(e,s),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:s.encoder,decoder:s.decoder,buffer:!0,type:"msgpack5",IncompleteBufferError:a.IncompleteBufferError}}},function(e,t,n){var r=n(5),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),i(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.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},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){"use strict";var r;!function(e){window.DotNet=e;var t=[],n={},r={},o=1,i=null;function s(e){t.push(e)}function a(e,t){for(var n=[],r=2;r0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return e[r]=[],e}function a(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 s=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 s=i.nextSibling;if(n.insertBefore(i,t),i===o)break;i=s}n.removeChild(t)}),t.forEach(function(e){n[e.toSiblingIndex]=e.moveRangeStart})},t.getClosestDomElement=l},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.");return r(e,t)},t.setEventDispatcher=function(e){r=e}},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(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:s}catch(e){r=s}}();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=a(h);l=!0;for(var t=u.length;t;){for(c=u,u=[];++f1)for(var n=1;n0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]this.length)&&(r=this.length),n>=this.length)return e||i.alloc(0);if(r<=0)return e||i.alloc(0);var o,s,a=!!e,c=this._offset(n),u=r-n,l=u,f=a&&t||0,h=c[1];if(0===n&&r==this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:i.concat(this._bufs,this.length);for(s=0;s(o=this._bufs[s].length-h))){this._bufs[s].copy(e,f,h,h+l);break}this._bufs[s].copy(e,f,h),f+=o,l-=o,h&&(h=0)}return e},s.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 s(o)},s.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},s.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},s.prototype.duplicate=function(){for(var e=0,t=new s;e0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=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=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.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 s=Object.keys(n),a=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),S(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(n);if(0===s.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="",_=!1,I=["{","}"];(p(n)&&(_=!0,I=["[","]"]),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!==s.length||_&&0!=n.length?r<0?m(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),u=_?function(e,t,n,r,o){for(var i=[],s=0,a=t.length;s=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,I)):I[0]+w+I[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,o,i){var s,a,c;if((c=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),k(r,o)||(s="["+o+"]"),a||(e.seen.indexOf(c.value)<0?(a=g(n)?l(e,c.value,null):l(e,c.value,n-1)).indexOf("\n")>-1&&(a=i?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),b(s)){if(i&&o.match(/^\d+$/))return a;(s=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}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]"===_(e)}function w(e){return"object"==typeof e&&null!==e}function E(e){return w(e)&&"[object Date]"===_(e)}function S(e){return w(e)&&("[object Error]"===_(e)||e instanceof Error)}function C(e){return"function"==typeof e}function _(e){return Object.prototype.toString.call(e)}function I(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(),!s[n])if(new RegExp("\\b"+n+"\\b","i").test(i)){var r=e.pid;s[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else s[n]=function(){};return s[n]},t.inspect=a,a.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]},a.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(54);var T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,n;console.log("%s - %s",(e=new Date,n=[I(e.getHours()),I(e.getMinutes()),I(e.getSeconds())].join(":"),[e.getDate(),T[e.getMonth()],n].join(" ")),t.format.apply(t,arguments))},t.inherits=n(55),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 P="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function x(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(P&&e[P]){var t;if("function"!=typeof(t=e[P]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,P,{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||s.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),r?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):E(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?E(e,s,t,!1):T(e,s)):E(e,s,t,!1))):r||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=S?e=S:(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 _(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"),R(e)}function T(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(s===i.length?o+=i:o+=i.slice(0,e),0===(e-=s)){s===i.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(s));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,s=e>i.length?i.length:e;if(i.copy(n,n.length-e,0,s),0===(e-=s)){s===i.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(s));break}++o}return t.length-=o,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function O(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(M,t,e))}function M(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function L(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?O(this):_(this),null;if(0===(e=C(e,t))&&t.ended)return 0===t.length&&O(this),null;var r,o=t.needReadable;return p("need readable",o),(0===t.length||t.length-e0?D(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&O(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&&a(e,"data")&&(t.flowing=!0,R(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!==L(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===a(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]?s(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?this:(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&&s.length>o&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=function(){for(var e=[],t=0;t0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var u=c.length,l=d(c,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){s=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},a.prototype.listeners=function(e){return h(this,e,!0)},a.prototype.rawListeners=function(e){return h(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p,a.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(23);function o(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,i=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return i||s?(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(61).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=a,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 s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(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(23);function s(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 a,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(14);var l={deprecate:n(64)},f=n(38),h=n(13).Buffer,p=o.Uint8Array||function(){};var d,g=n(39);function y(){}function v(e,t){a=a||n(11),e=e||{};var r=t instanceof a;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(_,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(o(r),e._writableState.errorEmitted=!0,e.emit("error",r),_(e,t))}(e,n,r,t,o);else{var s=S(n);s||n.corked||n.bufferProcessing||!n.bufferedRequest||E(e,n),r?c(w,e,n,s,o):w(e,n,s,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 s(this)}function b(e){if(a=a||n(11),!(d.call(b,this)||this instanceof a))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,s){t.writelen=r,t.writecb=s,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(),_(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 a=0,c=!0;n;)o[a]=n,n.isBuf||(c=!1),n=n.next,a+=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 s(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"),_(e,t)})}function _(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,s=!1,a=!o.objectMode&&(r=e,h.isBuffer(r)||r instanceof p);return a&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?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):(a||function(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}(this,o,e,n))&&(o.pendingcb++,s=function(e,t,n,r,o,i){if(!n){var s=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n));return t}(t,r,o);r!==s&&(n=!0,o="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;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,_(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(18),n(62).setImmediate,n(10))},function(e,t,n){"use strict";e.exports=s;var r=n(11),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.length=200&&c.statusCode<300?r(new s.b(c.statusCode,c.statusMessage||"",u)):o(new i.b(c.statusMessage||"",c.statusCode||0))});t.abortSignal&&(t.abortSignal.onabort=function(){f.abort(),o(new i.a)})})},n.prototype.getCookieString=function(e){return this.cookieJar.getCookieString(e)},n}(s.a)}).call(this,n(5).Buffer)},function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return i});var r=n(7),o=n(1),i=function(){function t(){}return t.prototype.writeHandshakeRequest=function(e){return r.a.write(JSON.stringify(e))},t.prototype.parseHandshakeResponse=function(t){var n,i;if(Object(o.g)(t)||void 0!==e&&t instanceof e){var s=new Uint8Array(t);if(-1===(c=s.indexOf(r.a.RecordSeparatorCode)))throw new Error("Message is incomplete.");var a=c+1;n=String.fromCharCode.apply(null,s.slice(0,a)),i=s.byteLength>a?s.slice(a).buffer:null}else{var c,u=t;if(-1===(c=u.indexOf(r.a.RecordSeparator)))throw new Error("Message is incomplete.");a=c+1;n=u.substring(0,a),i=u.length>a?u.substring(a):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(5).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 s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)s.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 s},s=this&&this.__spread||function(){for(var e=[],t=0;t0?r-4:r,f=0;f>16&255,a[c++]=t>>8&255,a[c++]=255&t;2===s&&(t=o[e.charCodeAt(f)]<<2|o[e.charCodeAt(f+1)]>>4,a[c++]=255&t);1===s&&(t=o[e.charCodeAt(f)]<<10|o[e.charCodeAt(f+1)]<<4|o[e.charCodeAt(f+2)]>>2,a[c++]=t>>8&255,a[c++]=255&t);return a},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=0,a=n-o;sa?a:s+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,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a0)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,s=[],a=t;a>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,s,a=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+=a;l>0;i=256*i+e[t+f],f+=h,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),i-=u}return(p?-1:1)*s*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var s,a,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?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+f>=1?h/c:h*Math.pow(2,1-f))*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*c-1)*Math.pow(2,o),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,o),s=0));o>=8;e[n+p]=255&a,p+=d,a/=256,o-=8);for(s=s<0;e[n+p]=255&s,p+=d,s/=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){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -function r(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(c=l[u],!b(e[c],t[c],n,r))return!1;return!0}(e,t,n,s))}return n?e===t:e==t}function m(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function w(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 E(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&&y(o,n,"Missing expected exception"+r);var s="string"==typeof r,a=!e&&o&&!n;if((!e&&i.isError(o)&&s&&w(o,n)||a)&&y(o,n,"Got unwanted exception"+r),e&&o&&n&&!w(o,n)||!e&&o)throw o}f.AssertionError=function(e){var t;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=d(g((t=this).actual),128)+" "+t.operator+" "+d(g(t.expected),128),this.generatedMessage=!0);var n=e.stackStartFunction||y;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var o=r.stack,i=p(n),s=o.indexOf("\n"+i);if(s>=0){var a=o.indexOf("\n",s+1);o=o.substring(a+1)}this.stack=o}}},i.inherits(f.AssertionError,Error),f.fail=y,f.ok=v,f.equal=function(e,t,n){e!=t&&y(e,t,n,"==",f.equal)},f.notEqual=function(e,t,n){e==t&&y(e,t,n,"!=",f.notEqual)},f.deepEqual=function(e,t,n){b(e,t,!1)||y(e,t,n,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(e,t,n){b(e,t,!0)||y(e,t,n,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(e,t,n){b(e,t,!1)&&y(e,t,n,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function e(t,n,r){b(t,n,!0)&&y(t,n,r,"notDeepStrictEqual",e)},f.strictEqual=function(e,t,n){e!==t&&y(e,t,n,"===",f.strictEqual)},f.notStrictEqual=function(e,t,n){e===t&&y(e,t,n,"!==",f.notStrictEqual)},f.throws=function(e,t,n){E(!0,e,t,n)},f.doesNotThrow=function(e,t,n){E(!1,e,t,n)},f.ifError=function(e){if(e)throw e};var S=Object.keys||function(e){var t=[];for(var n in e)s.call(e,n)&&t.push(n);return t}}).call(this,n(10))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){e.exports=n(11)},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){},function(e,t,n){"use strict";var r=n(14).Buffer,o=n(60);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?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),s=this.head,a=0;s;)t=s.data,n=i,o=a,t.copy(n,o),a+=s.data.length,s=s.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(6),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),i(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.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},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.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(63),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(10))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o,i,s,a,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)}:(s="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&d(+t.data.slice(s.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),r=function(t){e.postMessage(s+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=a},function(e,t,n){(t=e.exports=n(36)).Stream=t,t.Readable=t,t.Writable=n(41),t.Duplex=n(11),t.Transform=n(42),t.PassThrough=n(67)},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(22);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 s=e.readUInt32BE(t+0),a=e.readUInt32BE(t+4);return(4294967296*s+a)*(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),s(e,r,i,3));case 221:return o<5?null:(i=e.readUInt32BE(r+1),s(e,r,i,5));case 222:return i=e.readUInt16BE(r+1),a(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 s(e,r,i=15&h,1);if(128==(240&h))return a(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 s(e,t,r,o){var s,a=[],c=0;for(t+=o,s=0;si)&&((n=r.allocUnsafe(9))[0]=203,n.writeDoubleBE(e,1)),n}e.exports=function(e,t,n,i){function a(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(a(t,!0)),e},o().append(l));else{if(!i&&"function"==typeof c.getDate)return function(e){var t,n=1*e,i=Math.floor(n/1e3),s=1e6*(n-1e3*i);if(s||i>4294967295){(t=new r(10))[0]=215,t[1]=-1;var a=4*s,c=i/Math.pow(2,32),u=a+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,s=-1,a=[];for(n=0;n>8),a.push(255&s)):(a.push(201),a.push(s>>24),a.push(s>>16&255),a.push(s>>8&255),a.push(255&s));return o().append(r.from(a)).append(i)}(c)||function(e){var t,n,i=[],s=0;for(t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&"function"!=typeof e[t]&&(++s,i.push(a(t,!0)),i.push(a(e[t],!0)));s<16?(n=r.allocUnsafe(1))[0]=128|s:((n=r.allocUnsafe(3))[0]=222,n.writeUInt16BE(s,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 s(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 s(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 s(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 s=1,a=t+7;a>=t;a--){var c=(255^e[a])+s;e[a]=255&c,s=c>>8}}(l,1,c)}}}if(!l)throw new Error("not implemented yet");return u?l:l.slice()}return a}},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 s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]this.nextBatchId?this.fatalError?(this.logger.log(a.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(a.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(a.LogLevel.Debug,"Applying batch "+e+"."),i.renderBatch(this.browserRendererId,new s.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(a.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(a.LogLevel.Warning,"Failed to deliver completion notification for render '"+t+"'."),[3,3];case 3:return[2]}})})},e.renderQueues=new Map,e}();t.RenderQueue=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(72),o=Math.pow(2,32),i=Math.pow(2,21)-1,s=function(){function e(e){this.batchData=e;var t=new l(e);this.arrayRangeReader=new f(e),this.arrayBuilderSegmentReader=new h(e),this.diffReader=new a(e),this.editReader=new c(e,t),this.frameReader=new u(e,t)}return e.prototype.updatedComponents=function(){return p(this.batchData,this.batchData.length-20)},e.prototype.referenceFrames=function(){return p(this.batchData,this.batchData.length-16)},e.prototype.disposedComponentIds=function(){return p(this.batchData,this.batchData.length-12)},e.prototype.disposedEventHandlerIds=function(){return p(this.batchData,this.batchData.length-8)},e.prototype.updatedComponentsEntry=function(e,t){var n=e+4*t;return p(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 p(this.batchData,n)},e.prototype.disposedEventHandlerIdsEntry=function(e,t){var n=e+8*t;return g(this.batchData,n)},e}();t.OutOfProcessRenderBatch=s;var a=function(){function e(e){this.batchDataUint8=e}return e.prototype.componentId=function(e){return p(this.batchDataUint8,e)},e.prototype.edits=function(e){return e+4},e.prototype.editsEntry=function(e,t){return e+16*t},e}(),c=function(){function e(e,t){this.batchDataUint8=e,this.stringReader=t}return e.prototype.editType=function(e){return p(this.batchDataUint8,e)},e.prototype.siblingIndex=function(e){return p(this.batchDataUint8,e+4)},e.prototype.newTreeIndex=function(e){return p(this.batchDataUint8,e+8)},e.prototype.moveToSiblingIndex=function(e){return p(this.batchDataUint8,e+8)},e.prototype.removedAttributeName=function(e){var t=p(this.batchDataUint8,e+12);return this.stringReader.readString(t)},e}(),u=function(){function e(e,t){this.batchDataUint8=e,this.stringReader=t}return e.prototype.frameType=function(e){return p(this.batchDataUint8,e)},e.prototype.subtreeLength=function(e){return p(this.batchDataUint8,e+4)},e.prototype.elementReferenceCaptureId=function(e){var t=p(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.componentId=function(e){return p(this.batchDataUint8,e+8)},e.prototype.elementName=function(e){var t=p(this.batchDataUint8,e+8);return this.stringReader.readString(t)},e.prototype.textContent=function(e){var t=p(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.markupContent=function(e){var t=p(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.attributeName=function(e){var t=p(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.attributeValue=function(e){var t=p(this.batchDataUint8,e+8);return this.stringReader.readString(t)},e.prototype.attributeEventHandlerId=function(e){return g(this.batchDataUint8,e+12)},e}(),l=function(){function e(e){this.batchDataUint8=e,this.stringTableStartIndex=p(e,e.length-4)}return e.prototype.readString=function(e){if(-1===e)return null;var t,n=p(this.batchDataUint8,this.stringTableStartIndex+4*e),o=function(e,t){for(var n=0,r=0,o=0;o<4;o++){var i=e[t+o];if(n|=(127&i)<>>0)}function g(e,t){var n=d(e,t+4);if(n>i)throw new Error("Cannot read uint64 with high order part "+n+", because the result would exceed Number.MAX_SAFE_INTEGER.");return n*o+d(e,t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof TextDecoder?new TextDecoder("utf-8"):null;t.decodeUtf8=r?r.decode.bind(r):function(e){var t=0,n=e.length,r=[],o=[];for(;t65535&&(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});var r=n(20),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 s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}},s=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),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.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 s};Object.defineProperty(t,"__esModule",{value:!0});var a=n(21),c=n(75),u=function(){function e(e,t){this.circuitId=e,this.components=t}return e.prototype.reconnect=function(e){return e.invoke("ConnectCircuit",this.circuitId)},e}();function l(e){if(e.nodeType===Node.COMMENT_NODE&&e.textContent){var t=/\W+M.A.C.Component:[^{]*(.*)$/.exec(e.textContent),n=t&&t[1];if(n){try{var r=JSON.parse(n),o=r.componentId,i=r.rendererId,s=r.circuitId;if(void 0!==o&&void 0!==i&&!!s)return{node:e,circuitId:s,rendererId:i,componentId:o}}catch(e){}throw new Error("Found malformed start component comment at "+e.textContent)}}}function f(e,t,n,r){for(var o=n;o0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]>=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+s))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+i,o+i+s):n.subarray(o+i,o+i+s)),o=o+i+s}return t},e}();var a=new Uint8Array([145,i.MessageType.Ping]),c=function(){function e(){this.name="messagepack",this.version=1,this.transferFormat=i.TransferFormat.Binary,this.errorResult=1,this.voidResult=2,this.nonVoidResult=3}return e.prototype.parseMessages=function(e,t){if(!(e instanceof r.Buffer||(n=e,n&&"undefined"!=typeof ArrayBuffer&&(n instanceof ArrayBuffer||n.constructor&&"ArrayBuffer"===n.constructor.name))))throw new Error("Invalid input for MessagePack hub protocol. Expected an ArrayBuffer or Buffer.");var n;null===t&&(t=i.NullLogger.instance);for(var o=[],a=0,c=s.parse(e);a=0;u--)if(l[u]!==f[u])return!1;for(u=l.length-1;u>=0;u--)if(c=l[u],!b(e[c],t[c],n,r))return!1;return!0}(e,t,n,s))}return n?e===t:e==t}function m(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function w(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 E(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&&y(o,n,"Missing expected exception"+r);var s="string"==typeof r,a=!e&&o&&!n;if((!e&&i.isError(o)&&s&&w(o,n)||a)&&y(o,n,"Got unwanted exception"+r),e&&o&&n&&!w(o,n)||!e&&o)throw o}f.AssertionError=function(e){var t;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=d(g((t=this).actual),128)+" "+t.operator+" "+d(g(t.expected),128),this.generatedMessage=!0);var n=e.stackStartFunction||y;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var o=r.stack,i=p(n),s=o.indexOf("\n"+i);if(s>=0){var a=o.indexOf("\n",s+1);o=o.substring(a+1)}this.stack=o}}},i.inherits(f.AssertionError,Error),f.fail=y,f.ok=v,f.equal=function(e,t,n){e!=t&&y(e,t,n,"==",f.equal)},f.notEqual=function(e,t,n){e==t&&y(e,t,n,"!=",f.notEqual)},f.deepEqual=function(e,t,n){b(e,t,!1)||y(e,t,n,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(e,t,n){b(e,t,!0)||y(e,t,n,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(e,t,n){b(e,t,!1)&&y(e,t,n,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function e(t,n,r){b(t,n,!0)&&y(t,n,r,"notDeepStrictEqual",e)},f.strictEqual=function(e,t,n){e!==t&&y(e,t,n,"===",f.strictEqual)},f.notStrictEqual=function(e,t,n){e===t&&y(e,t,n,"!==",f.notStrictEqual)},f.throws=function(e,t,n){E(!0,e,t,n)},f.doesNotThrow=function(e,t,n){E(!1,e,t,n)},f.ifError=function(e){if(e)throw e};var S=Object.keys||function(e){var t=[];for(var n in e)s.call(e,n)&&t.push(n);return t}}).call(this,n(10))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){e.exports=n(11)},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){},function(e,t,n){"use strict";var r=n(13).Buffer,o=n(60);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?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),s=this.head,a=0;s;)t=s.data,n=i,o=a,t.copy(n,o),a+=s.data.length,s=s.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(5),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),i(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.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},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.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(63),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(10))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o,i,s,a,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)}:(s="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&d(+t.data.slice(s.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),r=function(t){e.postMessage(s+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=a},function(e,t,n){(t=e.exports=n(36)).Stream=t,t.Readable=t,t.Writable=n(41),t.Duplex=n(11),t.Transform=n(42),t.PassThrough=n(67)},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(14),o.inherits(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){var r=n(22);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 s=e.readUInt32BE(t+0),a=e.readUInt32BE(t+4);return(4294967296*s+a)*(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),s(e,r,i,3));case 221:return o<5?null:(i=e.readUInt32BE(r+1),s(e,r,i,5));case 222:return i=e.readUInt16BE(r+1),a(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 s(e,r,i=15&h,1);if(128==(240&h))return a(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 s(e,t,r,o){var s,a=[],c=0;for(t+=o,s=0;si)&&((n=r.allocUnsafe(9))[0]=203,n.writeDoubleBE(e,1)),n}e.exports=function(e,t,n,i){function a(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(a(t,!0)),e},o().append(l));else{if(!i&&"function"==typeof c.getDate)return function(e){var t,n=1*e,i=Math.floor(n/1e3),s=1e6*(n-1e3*i);if(s||i>4294967295){(t=new r(10))[0]=215,t[1]=-1;var a=4*s,c=i/Math.pow(2,32),u=a+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,s=-1,a=[];for(n=0;n>8),a.push(255&s)):(a.push(201),a.push(s>>24),a.push(s>>16&255),a.push(s>>8&255),a.push(255&s));return o().append(r.from(a)).append(i)}(c)||function(e){var t,n,i=[],s=0;for(t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&"function"!=typeof e[t]&&(++s,i.push(a(t,!0)),i.push(a(e[t],!0)));s<16?(n=r.allocUnsafe(1))[0]=128|s:((n=r.allocUnsafe(3))[0]=222,n.writeUInt16BE(s,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 s(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 s(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 s(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 s=1,a=t+7;a>=t;a--){var c=(255^e[a])+s;e[a]=255&c,s=c>>8}}(l,1,c)}}}if(!l)throw new Error("not implemented yet");return u?l:l.slice()}return a}},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 s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]this.nextBatchId?this.fatalError?(this.logger.log(a.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(a.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(a.LogLevel.Debug,"Applying batch "+e+"."),i.renderBatch(this.browserRendererId,new s.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(a.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(a.LogLevel.Warning,"Failed to deliver completion notification for render '"+t+"'."),[3,3];case 3:return[2]}})})},e.renderQueues=new Map,e}();t.RenderQueue=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(72),o=Math.pow(2,32),i=Math.pow(2,21)-1,s=function(){function e(e){this.batchData=e;var t=new l(e);this.arrayRangeReader=new f(e),this.arrayBuilderSegmentReader=new h(e),this.diffReader=new a(e),this.editReader=new c(e,t),this.frameReader=new u(e,t)}return e.prototype.updatedComponents=function(){return p(this.batchData,this.batchData.length-20)},e.prototype.referenceFrames=function(){return p(this.batchData,this.batchData.length-16)},e.prototype.disposedComponentIds=function(){return p(this.batchData,this.batchData.length-12)},e.prototype.disposedEventHandlerIds=function(){return p(this.batchData,this.batchData.length-8)},e.prototype.updatedComponentsEntry=function(e,t){var n=e+4*t;return p(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 p(this.batchData,n)},e.prototype.disposedEventHandlerIdsEntry=function(e,t){var n=e+8*t;return g(this.batchData,n)},e}();t.OutOfProcessRenderBatch=s;var a=function(){function e(e){this.batchDataUint8=e}return e.prototype.componentId=function(e){return p(this.batchDataUint8,e)},e.prototype.edits=function(e){return e+4},e.prototype.editsEntry=function(e,t){return e+16*t},e}(),c=function(){function e(e,t){this.batchDataUint8=e,this.stringReader=t}return e.prototype.editType=function(e){return p(this.batchDataUint8,e)},e.prototype.siblingIndex=function(e){return p(this.batchDataUint8,e+4)},e.prototype.newTreeIndex=function(e){return p(this.batchDataUint8,e+8)},e.prototype.moveToSiblingIndex=function(e){return p(this.batchDataUint8,e+8)},e.prototype.removedAttributeName=function(e){var t=p(this.batchDataUint8,e+12);return this.stringReader.readString(t)},e}(),u=function(){function e(e,t){this.batchDataUint8=e,this.stringReader=t}return e.prototype.frameType=function(e){return p(this.batchDataUint8,e)},e.prototype.subtreeLength=function(e){return p(this.batchDataUint8,e+4)},e.prototype.elementReferenceCaptureId=function(e){var t=p(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.componentId=function(e){return p(this.batchDataUint8,e+8)},e.prototype.elementName=function(e){var t=p(this.batchDataUint8,e+8);return this.stringReader.readString(t)},e.prototype.textContent=function(e){var t=p(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.markupContent=function(e){var t=p(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.attributeName=function(e){var t=p(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.attributeValue=function(e){var t=p(this.batchDataUint8,e+8);return this.stringReader.readString(t)},e.prototype.attributeEventHandlerId=function(e){return g(this.batchDataUint8,e+12)},e}(),l=function(){function e(e){this.batchDataUint8=e,this.stringTableStartIndex=p(e,e.length-4)}return e.prototype.readString=function(e){if(-1===e)return null;var t,n=p(this.batchDataUint8,this.stringTableStartIndex+4*e),o=function(e,t){for(var n=0,r=0,o=0;o<4;o++){var i=e[t+o];if(n|=(127&i)<>>0)}function g(e,t){var n=d(e,t+4);if(n>i)throw new Error("Cannot read uint64 with high order part "+n+", because the result would exceed Number.MAX_SAFE_INTEGER.");return n*o+d(e,t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof TextDecoder?new TextDecoder("utf-8"):null;t.decodeUtf8=r?r.decode.bind(r):function(e){var t=0,n=e.length,r=[],o=[];for(;t65535&&(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});var r=n(20),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 s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]>=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+s))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+i,o+i+s):n.subarray(o+i,o+i+s)),o=o+i+s}return t},e}();var a=new Uint8Array([145,i.MessageType.Ping]),c=function(){function e(){this.name="messagepack",this.version=1,this.transferFormat=i.TransferFormat.Binary,this.errorResult=1,this.voidResult=2,this.nonVoidResult=3}return e.prototype.parseMessages=function(e,t){if(!(e instanceof r.Buffer||(n=e,n&&"undefined"!=typeof ArrayBuffer&&(n instanceof ArrayBuffer||n.constructor&&"ArrayBuffer"===n.constructor.name))))throw new Error("Invalid input for MessagePack hub protocol. Expected an ArrayBuffer or Buffer.");var n;null===t&&(t=i.NullLogger.instance);for(var o=[],a=0,c=s.parse(e);a0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return e[r]=[],e}function u(e,t,n){var a=e;if(e instanceof Comment&&(s(a)&&s(a).length>0))throw new Error("Not implemented: inserting non-empty logical container");if(l(a))throw new Error("Not implemented: moving existing logical children");var i=s(t);if(n0;)e(r,0);var a=r;a.parentNode.removeChild(a)},t.getLogicalParent=l,t.getLogicalSiblingEnd=function(e){return e[a]||null},t.getLogicalChild=function(e,t){return s(e)[t]},t.isSvgElement=function(e){return"http://www.w3.org/2000/svg"===c(e).namespaceURI},t.getLogicalChildrenArray=s,t.permuteLogicalChildren=function(e,t){var n=s(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=l(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";var r;!function(e){window.DotNet=e;var t=[],n={},r={},o=1,a=null;function i(e){t.push(e)}function u(e,t){for(var n=[],r=2;r0&&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]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]-1?a.substring(0,u):"",s=u>-1?a.substring(u+1):a,c=t.monoPlatform.findMethod(e,l,s,i);t.monoPlatform.callMethod(c,null,r)},callMethod:function(e,n,r){if(r.length>4)throw new Error("Currently, MonoPlatform supports passing a maximum of 4 arguments from JS to .NET. You tried to pass "+r.length+".");var o=Module.stackSave();try{for(var a=Module.stackAlloc(r.length),u=Module.stackAlloc(4),l=0;l>2,r=Module.HEAPU32[n+1];if(r>v)throw new Error("Cannot read uint64 with high order part "+r+", because the result would exceed Number.MAX_SAFE_INTEGER.");return r*h+Module.HEAPU32[n]},readFloatField:function(e,t){return Module.getValue(e+(t||0),"float")},readObjectField:function(e,t){return Module.getValue(e+(t||0),"i32")},readStringField:function(e,n){var r=Module.getValue(e+(n||0),"i32");return 0===r?null:t.monoPlatform.toJavaScriptString(r)},readStructField:function(e,t){return e+(t||0)}};var b=document.createElement("a");function w(e){return e+12}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(33),o=window.chrome&&navigator.userAgent.indexOf("Edge")<0,a=!1;function i(){return a&&o}t.hasDebuggingEnabled=i,t.attachDebuggerHotkey=function(e){a=e.some(function(e){return/\.pdb$/.test(r.getFileNameFromUrl(e))});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&&(a?o?((t=document.createElement("a")).href="_framework/debug?url="+encodeURIComponent(location.href),t.target="_blank",t.rel="noopener noreferrer",t.click()):console.error("Currently, only Chrome is supported for debugging."):console.error("Cannot start debugging, because the application was not compiled with debugging enabled."))})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=function(){function e(e){this.batchAddress=e,this.arrayRangeReader=a,this.arrayBuilderSegmentReader=i,this.diffReader=u,this.editReader=l,this.frameReader=s}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,u.structLength)},e.prototype.referenceFramesEntry=function(e,t){return c(e,t,s.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)}},u={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,l.structLength)}},l={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)}},s={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)},attributeEventHandlerId:function(e){return r.platform.readUint64Field(e,8)}};function c(e,t,n){return r.platform.getArrayEntryPtr(e,t,n)}}]); \ No newline at end of file +!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=45)}([,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(25),n(9);var r=n(26),o=n(16),a={},i=!1;function u(e,t,n){var o=a[e];o||(o=a[e]=new r.BrowserRenderer(e)),o.attachRootComponentToLogicalElement(n,t)}t.attachRootComponentToLogicalElement=u,t.attachRootComponentToElement=function(e,t,n){var r=document.querySelector(t);if(!r)throw new Error("Could not find any element matching selector '"+t+"'.");u(e,o.toLogicalElement(r,!0),n)},t.renderBatch=function(e,t){var n=a[e];if(!n)throw new Error("There is no browser renderer with ID "+e+".");for(var r=t.arrayRangeReader,o=t.updatedComponents(),u=r.values(o),l=r.count(o),s=t.referenceFrames(),c=r.values(s),f=t.diffReader,d=0;d0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return e[r]=[],e}function u(e,t,n){var a=e;if(e instanceof Comment&&(s(a)&&s(a).length>0))throw new Error("Not implemented: inserting non-empty logical container");if(l(a))throw new Error("Not implemented: moving existing logical children");var i=s(t);if(n0;)e(r,0);var a=r;a.parentNode.removeChild(a)},t.getLogicalParent=l,t.getLogicalSiblingEnd=function(e){return e[a]||null},t.getLogicalChild=function(e,t){return s(e)[t]},t.isSvgElement=function(e){return"http://www.w3.org/2000/svg"===c(e).namespaceURI},t.getLogicalChildrenArray=s,t.permuteLogicalChildren=function(e,t){var n=s(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=l(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";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.");return r(e,t)},t.setEventDispatcher=function(e){r=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{l(r.next(e))}catch(e){a(e)}}function u(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(i,u)}l((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:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){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=(o=i.trys).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]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]-1?a.substring(0,u):"",s=u>-1?a.substring(u+1):a,c=t.monoPlatform.findMethod(e,l,s,i);t.monoPlatform.callMethod(c,null,r)},callMethod:function(e,n,r){if(r.length>4)throw new Error("Currently, MonoPlatform supports passing a maximum of 4 arguments from JS to .NET. You tried to pass "+r.length+".");var o=Module.stackSave();try{for(var a=Module.stackAlloc(r.length),u=Module.stackAlloc(4),l=0;l>2,r=Module.HEAPU32[n+1];if(r>v)throw new Error("Cannot read uint64 with high order part "+r+", because the result would exceed Number.MAX_SAFE_INTEGER.");return r*h+Module.HEAPU32[n]},readFloatField:function(e,t){return Module.getValue(e+(t||0),"float")},readObjectField:function(e,t){return Module.getValue(e+(t||0),"i32")},readStringField:function(e,n){var r=Module.getValue(e+(n||0),"i32");return 0===r?null:t.monoPlatform.toJavaScriptString(r)},readStructField:function(e,t){return e+(t||0)}};var b=document.createElement("a");function w(e){return e+12}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(33),o=window.chrome&&navigator.userAgent.indexOf("Edge")<0,a=!1;function i(){return a&&o}t.hasDebuggingEnabled=i,t.attachDebuggerHotkey=function(e){a=e.some(function(e){return/\.pdb$/.test(r.getFileNameFromUrl(e))});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&&(a?o?((t=document.createElement("a")).href="_framework/debug?url="+encodeURIComponent(location.href),t.target="_blank",t.rel="noopener noreferrer",t.click()):console.error("Currently, only Chrome is supported for debugging."):console.error("Cannot start debugging, because the application was not compiled with debugging enabled."))})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=function(){function e(e){this.batchAddress=e,this.arrayRangeReader=a,this.arrayBuilderSegmentReader=i,this.diffReader=u,this.editReader=l,this.frameReader=s}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,u.structLength)},e.prototype.referenceFramesEntry=function(e,t){return c(e,t,s.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)}},u={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,l.structLength)}},l={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)}},s={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)},attributeEventHandlerId:function(e){return r.platform.readUint64Field(e,8)}};function c(e,t,n){return r.platform.getArrayEntryPtr(e,t,n)}}]); \ No newline at end of file diff --git a/src/Components/Web.JS/src/Boot.Server.ts b/src/Components/Web.JS/src/Boot.Server.ts index 4ac55b419f..df96f1031f 100644 --- a/src/Components/Web.JS/src/Boot.Server.ts +++ b/src/Components/Web.JS/src/Boot.Server.ts @@ -6,7 +6,7 @@ import { shouldAutoStart } from './BootCommon'; import { RenderQueue } from './Platform/Circuits/RenderQueue'; import { ConsoleLogger } from './Platform/Logging/Loggers'; import { LogLevel, Logger } from './Platform/Logging/Logger'; -import { discoverPrerenderedCircuits, startCircuit } from './Platform/Circuits/CircuitManager'; +import { startCircuit } from './Platform/Circuits/CircuitManager'; import { setEventDispatcher } from './Rendering/RendererEventDispatcher'; import { resolveOptions, BlazorOptions } from './Platform/Circuits/BlazorOptions'; import { DefaultReconnectionHandler } from './Platform/Circuits/DefaultReconnectionHandler'; @@ -27,32 +27,18 @@ async function boot(userOptions?: Partial): Promise { options.reconnectionHandler = options.reconnectionHandler || window['Blazor'].defaultReconnectionHandler; logger.log(LogLevel.Information, 'Starting up blazor server-side application.'); - // Initialize statefully prerendered circuits and their components - // Note: This will all be removed soon const initialConnection = await initializeConnection(options, logger); - const circuits = discoverPrerenderedCircuits(document); - for (let i = 0; i < circuits.length; i++) { - const circuit = circuits[i]; - for (let j = 0; j < circuit.components.length; j++) { - const component = circuit.components[j]; - component.initialize(); - } - } - const circuit = await startCircuit(initialConnection); - if (!circuit) { - logger.log(LogLevel.Information, 'No preregistered components to render.'); - } const reconnect = async (existingConnection?: signalR.HubConnection): Promise => { if (renderingFailed) { // We can't reconnect after a failure, so exit early. return false; } - const reconnection = existingConnection || await initializeConnection(options, logger); - const results = await Promise.all(circuits.map(circuit => circuit.reconnect(reconnection))); - if (reconnectionFailed(results)) { + const reconnection = existingConnection || await initializeConnection(options, logger); + if (!(await circuit.reconnect(reconnection))) { + logger.log(LogLevel.Information, 'Reconnection attempt failed.'); return false; } @@ -63,19 +49,7 @@ async function boot(userOptions?: Partial): Promise { window['Blazor'].reconnect = reconnect; - const reconnectTask = reconnect(initialConnection); - - if (circuit) { - circuits.push(circuit); - } - - await reconnectTask; - logger.log(LogLevel.Information, 'Blazor server-side application started.'); - - function reconnectionFailed(results: boolean[]): boolean { - return !results.reduce((current, next) => current && next, true); - } } async function initializeConnection(options: BlazorOptions, logger: Logger): Promise { @@ -94,6 +68,11 @@ async function initializeConnection(options: BlazorOptions, logger: Logger): Pro return connection.send('DispatchBrowserEvent', JSON.stringify(descriptor), JSON.stringify(args)); }); + // Configure navigation via SignalR + window['Blazor']._internal.navigationManager.listenForNavigationEvents((uri: string, intercepted: boolean): Promise => { + return connection.send('OnLocationChanged', uri, intercepted); + }); + connection.on('JS.BeginInvokeJS', DotNet.jsCallDispatcher.beginInvokeJSFromDotNet); connection.on('JS.EndInvokeDotNet', (args: string) => DotNet.jsCallDispatcher.endInvokeDotNetFromJS(...(JSON.parse(args) as [string, boolean, unknown]))); connection.on('JS.RenderBatch', (browserRendererId: number, batchId: number, batchData: Uint8Array) => { diff --git a/src/Components/Web.JS/src/Boot.WebAssembly.ts b/src/Components/Web.JS/src/Boot.WebAssembly.ts index 7d5eaf6869..ee990a10c2 100644 --- a/src/Components/Web.JS/src/Boot.WebAssembly.ts +++ b/src/Components/Web.JS/src/Boot.WebAssembly.ts @@ -27,6 +27,16 @@ async function boot(options?: any): Promise { renderBatch(browserRendererId, new SharedMemoryRenderBatch(batchAddress)); }; + // Configure navigation via JS Interop + window['Blazor']._internal.navigationManager.listenForNavigationEvents(async (uri: string, intercepted: boolean): Promise => { + await DotNet.invokeMethodAsync( + 'Microsoft.AspNetCore.Blazor', + 'NotifyLocationChanged', + uri, + intercepted + ); + }); + // Fetch the boot JSON file const bootConfig = await fetchBootConfigAsync(); const embeddedResourcesPromise = loadEmbeddedResourcesAsync(bootConfig); diff --git a/src/Components/Web.JS/src/GlobalExports.ts b/src/Components/Web.JS/src/GlobalExports.ts index 4ffb9f2ae6..005432545a 100644 --- a/src/Components/Web.JS/src/GlobalExports.ts +++ b/src/Components/Web.JS/src/GlobalExports.ts @@ -1,4 +1,4 @@ -import { navigateTo, internalFunctions as uriHelperInternalFunctions } from './Services/UriHelper'; +import { navigateTo, internalFunctions as navigationManagerInternalFunctions } from './Services/NavigationManager'; import { internalFunctions as httpInternalFunctions } from './Services/Http'; import { attachRootComponentToElement } from './Rendering/Renderer'; @@ -9,6 +9,6 @@ window['Blazor'] = { _internal: { attachRootComponentToElement, http: httpInternalFunctions, - uriHelper: uriHelperInternalFunctions, + navigationManager: navigationManagerInternalFunctions, }, }; diff --git a/src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts b/src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts index 44e351a8f1..c99ec42f08 100644 --- a/src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts +++ b/src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts @@ -1,14 +1,10 @@ -import { internalFunctions as uriHelperFunctions } from '../../Services/UriHelper'; -import { ComponentDescriptor, MarkupRegistrationTags, StartComponentComment, EndComponentComment } from './ComponentDescriptor'; +import { internalFunctions as navigationManagerFunctions } from '../../Services/NavigationManager'; export class CircuitDescriptor { public circuitId: string; - public components: ComponentDescriptor[]; - - public constructor(circuitId: string, components: ComponentDescriptor[]) { + public constructor(circuitId: string) { this.circuitId = circuitId; - this.components = components; } public reconnect(reconnection: signalR.HubConnection): Promise { @@ -16,115 +12,11 @@ export class CircuitDescriptor { } } - -export function discoverPrerenderedCircuits(document: Document): CircuitDescriptor[] { - const commentPairs = resolveCommentPairs(document); - const discoveredCircuits = new Map(); - for (let i = 0; i < commentPairs.length; i++) { - const pair = commentPairs[i]; - // We replace '--' on the server with '..' when we prerender due to the fact that this - // is not allowed in HTML comments and doesn't get encoded by default. - const circuitId = pair.start.circuitId.replace('..', '--'); - let circuit = discoveredCircuits.get(circuitId); - if (!circuit) { - circuit = []; - discoveredCircuits.set(circuitId, circuit); - } - const entry = new ComponentDescriptor(pair.start.componentId, circuitId, pair.start.rendererId, pair); - circuit.push(entry); - } - const circuits: CircuitDescriptor[] = []; - for (const [key, values] of discoveredCircuits) { - circuits.push(new CircuitDescriptor(key, values)); - } - return circuits; -} - -export async function startCircuit(connection: signalR.HubConnection): Promise { - const result = await connection.invoke('StartCircuit', uriHelperFunctions.getLocationHref(), uriHelperFunctions.getBaseURI()); +export async function startCircuit(connection: signalR.HubConnection): Promise { + const result = await connection.invoke('StartCircuit', navigationManagerFunctions.getBaseURI(), navigationManagerFunctions.getLocationHref()); if (result) { - return new CircuitDescriptor(result, []); + return new CircuitDescriptor(result); } else { - return undefined; + throw new Error('Circuit failed to start'); } } - -function resolveCommentPairs(node: Node): MarkupRegistrationTags[] { - if (!node.hasChildNodes()) { - return []; - } - const result: MarkupRegistrationTags[] = []; - const children = node.childNodes; - let i = 0; - const childrenLength = children.length; - while (i < childrenLength) { - const currentChildNode = children[i]; - const startComponent = getComponentStartComment(currentChildNode); - if (!startComponent) { - i++; - const childResults = resolveCommentPairs(currentChildNode); - for (let j = 0; j < childResults.length; j++) { - const childResult = childResults[j]; - result.push(childResult); - } - continue; - } - const endComponent = getComponentEndComment(startComponent, children, i + 1, childrenLength); - result.push({ start: startComponent, end: endComponent }); - i = endComponent.index + 1; - } - return result; -} -function getComponentStartComment(node: Node): StartComponentComment | undefined { - if (node.nodeType !== Node.COMMENT_NODE) { - return; - } - if (node.textContent) { - const componentStartComment = /\W+M.A.C.Component:[^{]*(.*)$/; - const definition = componentStartComment.exec(node.textContent); - const json = definition && definition[1]; - if (json) { - try { - const { componentId, rendererId, circuitId } = JSON.parse(json); - const allComponents = componentId !== undefined && rendererId !== undefined && !!circuitId; - if (allComponents) { - return { - node: node as Comment, - circuitId, - rendererId: rendererId, - componentId: componentId, - }; - } - } catch (error) { - } - throw new Error(`Found malformed start component comment at ${node.textContent}`); - } - } -} -function getComponentEndComment(component: StartComponentComment, children: NodeList, index: number, end: number): EndComponentComment { - for (let i = index; i < end; i++) { - const node = children[i]; - if (node.nodeType !== Node.COMMENT_NODE) { - continue; - } - if (!node.textContent) { - continue; - } - const componentEndComment = /\W+M.A.C.Component:\W+(\d+)\W+$/; - const definition = componentEndComment.exec(node.textContent); - const json = definition && definition[1]; - if (!json) { - continue; - } - try { - // The value is expected to be a JSON encoded number - const componentId = JSON.parse(json); - if (componentId === component.componentId) { - return { componentId, node: node as Comment, index: i }; - } - } catch (error) { - } - throw new Error(`Found malformed end component comment at ${node.textContent}`); - } - throw new Error(`End component comment not found for ${component.node}`); -} diff --git a/src/Components/Web.JS/src/Platform/Circuits/ComponentDescriptor.ts b/src/Components/Web.JS/src/Platform/Circuits/ComponentDescriptor.ts deleted file mode 100644 index 5f387cc2dc..0000000000 --- a/src/Components/Web.JS/src/Platform/Circuits/ComponentDescriptor.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { attachRootComponentToLogicalElement } from '../../Rendering/Renderer'; -import { toLogicalRootCommentElement } from '../../Rendering/LogicalElements'; - -export interface EndComponentComment { - componentId: number; - node: Comment; - index: number; -} - -export interface StartComponentComment { - node: Comment; - rendererId: number; - componentId: number; - circuitId: string; -} - -// Represent pairs of start end comments indicating a component that was registered -// in markup (such as a prerendered component) -export interface MarkupRegistrationTags { - start: StartComponentComment; - end: EndComponentComment; -} - -export class ComponentDescriptor { - public registrationTags: MarkupRegistrationTags; - - public componentId: number; - - public circuitId: string; - - public rendererId: number; - - public constructor(componentId: number, circuitId: string, rendererId: number, descriptor: MarkupRegistrationTags) { - this.componentId = componentId; - this.circuitId = circuitId; - this.rendererId = rendererId; - this.registrationTags = descriptor; - } - - public initialize(): void { - const startEndPair = { start: this.registrationTags.start.node, end: this.registrationTags.end.node }; - - const logicalElement = toLogicalRootCommentElement(startEndPair.start, startEndPair.end); - attachRootComponentToLogicalElement(this.rendererId, logicalElement, this.componentId); - } -} diff --git a/src/Components/Web.JS/src/Services/UriHelper.ts b/src/Components/Web.JS/src/Services/NavigationManager.ts similarity index 91% rename from src/Components/Web.JS/src/Services/UriHelper.ts rename to src/Components/Web.JS/src/Services/NavigationManager.ts index d4bb3434c0..3da8d11bef 100644 --- a/src/Components/Web.JS/src/Services/UriHelper.ts +++ b/src/Components/Web.JS/src/Services/NavigationManager.ts @@ -5,7 +5,7 @@ let hasRegisteredNavigationInterception = false; let hasRegisteredNavigationEventListeners = false; // Will be initialized once someone registers -let notifyLocationChangedCallback: { assemblyName: string; functionName: string } | null = null; +let notifyLocationChangedCallback: ((uri: string, intercepted: boolean) => Promise) | null = null; // These are the functions we're making available for invocation from .NET export const internalFunctions = { @@ -16,12 +16,12 @@ export const internalFunctions = { getLocationHref: () => location.href, }; -function listenForNavigationEvents(assemblyName: string, functionName: string) { +function listenForNavigationEvents(callback: (uri: string, intercepted: boolean) => Promise) { if (hasRegisteredNavigationEventListeners) { return; } - notifyLocationChangedCallback = { assemblyName, functionName }; + notifyLocationChangedCallback = callback; hasRegisteredNavigationEventListeners = true; window.addEventListener('popstate', () => notifyLocationChanged(false)); @@ -95,12 +95,7 @@ function performInternalNavigation(absoluteInternalHref: string, interceptedLink async function notifyLocationChanged(interceptedLink: boolean) { if (notifyLocationChangedCallback) { - await DotNet.invokeMethodAsync( - notifyLocationChangedCallback.assemblyName, - notifyLocationChangedCallback.functionName, - location.href, - interceptedLink - ); + await notifyLocationChangedCallback(location.href, interceptedLink); } } diff --git a/src/Components/Web.JS/tests/CircuitManager.test.ts b/src/Components/Web.JS/tests/CircuitManager.test.ts deleted file mode 100644 index 16017f19c4..0000000000 --- a/src/Components/Web.JS/tests/CircuitManager.test.ts +++ /dev/null @@ -1,146 +0,0 @@ -(global as any).DotNet = { attachReviver: jest.fn() }; - -import { discoverPrerenderedCircuits } from '../src/Platform/Circuits/CircuitManager'; -import { JSDOM } from 'jsdom'; - -describe('CircuitManager', () => { - - it('discoverPrerenderedCircuits returns discovered prerendered circuits', () => { - const dom = new JSDOM(` - - - Page - - -
Preamble
- -

Prerendered content

- -
- - `); - - const results = discoverPrerenderedCircuits(dom.window.document); - - expect(results.length).toEqual(1); - expect(results[0].components.length).toEqual(1); - const result = results[0].components[0]; - expect(result.circuitId).toEqual("1234"); - expect(result.rendererId).toEqual(2); - expect(result.componentId).toEqual(1); - - }); - - it('discoverPrerenderedCircuits returns discovers multiple prerendered circuits', () => { - const dom = new JSDOM(` - - - Page - - -
Preamble
- -

Prerendered content

- -
- -

Prerendered content

- -
- - `); - - const results = discoverPrerenderedCircuits(dom.window.document); - - expect(results.length).toEqual(1); - expect(results[0].components.length).toEqual(2); - const first = results[0].components[0]; - expect(first.circuitId).toEqual("1234"); - expect(first.rendererId).toEqual(2); - expect(first.componentId).toEqual(1); - - const second = results[0].components[1]; - expect(second.circuitId).toEqual("1234"); - expect(second.rendererId).toEqual(2); - expect(second.componentId).toEqual(2); - }); - - it('discoverPrerenderedCircuits throws for malformed circuits - improper nesting', () => { - const dom = new JSDOM(` - - - Page - - -
Preamble
- -

Prerendered content

- -
- -

Prerendered content

- -
- - `); - - expect(() => discoverPrerenderedCircuits(dom.window.document)) - .toThrow(); - }); - - - it('discoverPrerenderedCircuits throws for malformed circuits - mixed string and int', () => { - const dom = new JSDOM(` - - - Page - - -
Preamble
- -

Prerendered content

- -
- -

Prerendered content

- -
- - `); - - expect(() => discoverPrerenderedCircuits(dom.window.document)) - .toThrow(); - }); - - it('discoverPrerenderedCircuits initializes circuits', () => { - const dom = new JSDOM(` - - - Page - - -
Preamble
- -

Prerendered content

- -
- -

Prerendered content

- -
- - `); - - const results = discoverPrerenderedCircuits(dom.window.document); - - for (let i = 0; i < results.length; i++) { - const result = results[i]; - for (let j = 0; j < result.components.length; j++) { - const component = result.components[j]; - component.initialize(); - } - } - - }); - -}); diff --git a/src/Components/Web/ref/Microsoft.AspNetCore.Components.Web.netstandard2.0.cs b/src/Components/Web/ref/Microsoft.AspNetCore.Components.Web.netstandard2.0.cs index f577a47088..034b500218 100644 --- a/src/Components/Web/ref/Microsoft.AspNetCore.Components.Web.netstandard2.0.cs +++ b/src/Components/Web/ref/Microsoft.AspNetCore.Components.Web.netstandard2.0.cs @@ -6,7 +6,9 @@ namespace Microsoft.AspNetCore.Components [Microsoft.AspNetCore.Components.BindElementAttribute("select", null, "value", "onchange")] [Microsoft.AspNetCore.Components.BindElementAttribute("textarea", null, "value", "onchange")] [Microsoft.AspNetCore.Components.BindInputElementAttribute("checkbox", null, "checked", "onchange", false, null)] + [Microsoft.AspNetCore.Components.BindInputElementAttribute("date", "value", "value", "onchange", true, "yyyy-MM-dd")] [Microsoft.AspNetCore.Components.BindInputElementAttribute("date", null, "value", "onchange", true, "yyyy-MM-dd")] + [Microsoft.AspNetCore.Components.BindInputElementAttribute("number", "value", "value", "onchange", true, null)] [Microsoft.AspNetCore.Components.BindInputElementAttribute("number", null, "value", "onchange", true, null)] [Microsoft.AspNetCore.Components.BindInputElementAttribute("text", null, "value", "onchange", false, null)] [Microsoft.AspNetCore.Components.BindInputElementAttribute(null, "value", "value", "onchange", false, null)] @@ -51,23 +53,23 @@ namespace Microsoft.AspNetCore.Components public System.Type EventArgsType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } } [Microsoft.AspNetCore.Components.EventHandlerAttribute("onabort", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforeactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecopy", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecut", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforedeactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforepaste", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onactivate", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforeactivate", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecopy", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecut", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforedeactivate", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforepaste", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onblur", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplay", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplaythrough", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onchange", typeof(Microsoft.AspNetCore.Components.UIChangeEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplay", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplaythrough", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onchange", typeof(Microsoft.AspNetCore.Components.ChangeEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onclick", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncontextmenu", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncopy", typeof(Microsoft.AspNetCore.Components.UIClipboardEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncuechange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncuechange", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncut", typeof(Microsoft.AspNetCore.Components.UIClipboardEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondblclick", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondeactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondeactivate", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondrag", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragend", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragenter", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] @@ -75,24 +77,24 @@ namespace Microsoft.AspNetCore.Components [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragover", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragstart", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondrop", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondurationchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onemptied", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onended", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondurationchange", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onemptied", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onended", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onerror", typeof(Microsoft.AspNetCore.Components.UIErrorEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfocus", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfocusin", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfocusout", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenerror", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenchange", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenerror", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ongotpointercapture", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("oninput", typeof(Microsoft.AspNetCore.Components.UIChangeEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("oninvalid", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("oninput", typeof(Microsoft.AspNetCore.Components.ChangeEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("oninvalid", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onkeydown", typeof(Microsoft.AspNetCore.Components.UIKeyboardEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onkeypress", typeof(Microsoft.AspNetCore.Components.UIKeyboardEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onkeyup", typeof(Microsoft.AspNetCore.Components.UIKeyboardEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onload", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadeddata", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadedmetadata", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadeddata", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadedmetadata", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadend", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadstart", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onlostpointercapture", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] @@ -103,50 +105,51 @@ namespace Microsoft.AspNetCore.Components [Microsoft.AspNetCore.Components.EventHandlerAttribute("onmouseup", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onmousewheel", typeof(Microsoft.AspNetCore.Components.UIWheelEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpaste", typeof(Microsoft.AspNetCore.Components.UIClipboardEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpause", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onplay", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onplaying", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpause", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onplay", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onplaying", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointercancel", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerdown", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerenter", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerleave", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockerror", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockchange", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockerror", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointermove", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerout", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerover", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerup", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onprogress", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onratechange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onreadystatechange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onreset", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onscroll", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeked", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeking", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselect", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectionchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectstart", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onstalled", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onstop", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onsubmit", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onsuspend", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onratechange", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onreadystatechange", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onreset", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onscroll", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeked", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeking", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselect", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectionchange", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectstart", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onstalled", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onstop", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onsubmit", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onsuspend", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontimeout", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontimeupdate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontimeupdate", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchcancel", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchend", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchenter", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchleave", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchmove", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchstart", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onvolumechange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onwaiting", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onvolumechange", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onwaiting", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onwheel", typeof(Microsoft.AspNetCore.Components.UIWheelEventArgs))] public static partial class EventHandlers { } - public partial class UIClipboardEventArgs : Microsoft.AspNetCore.Components.UIEventArgs + public partial class UIClipboardEventArgs : System.EventArgs { public UIClipboardEventArgs() { } + public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } public partial class UIDataTransferItem { @@ -159,19 +162,21 @@ namespace Microsoft.AspNetCore.Components public UIDragEventArgs() { } public Microsoft.AspNetCore.Components.DataTransfer DataTransfer { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } - public partial class UIErrorEventArgs : Microsoft.AspNetCore.Components.UIEventArgs + public partial class UIErrorEventArgs : System.EventArgs { public UIErrorEventArgs() { } public int Colno { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public string Filename { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public int Lineno { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public string Message { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } - public partial class UIFocusEventArgs : Microsoft.AspNetCore.Components.UIEventArgs + public partial class UIFocusEventArgs : System.EventArgs { public UIFocusEventArgs() { } + public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } - public partial class UIKeyboardEventArgs : Microsoft.AspNetCore.Components.UIEventArgs + public partial class UIKeyboardEventArgs : System.EventArgs { public UIKeyboardEventArgs() { } public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } @@ -182,8 +187,9 @@ namespace Microsoft.AspNetCore.Components public bool MetaKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool Repeat { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } - public partial class UIMouseEventArgs : Microsoft.AspNetCore.Components.UIEventArgs + public partial class UIMouseEventArgs : System.EventArgs { public UIMouseEventArgs() { } public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } @@ -197,6 +203,7 @@ namespace Microsoft.AspNetCore.Components public double ScreenX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public double ScreenY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } public partial class UIPointerEventArgs : Microsoft.AspNetCore.Components.UIMouseEventArgs { @@ -210,14 +217,15 @@ namespace Microsoft.AspNetCore.Components public float TiltY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public float Width { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } - public partial class UIProgressEventArgs : Microsoft.AspNetCore.Components.UIEventArgs + public partial class UIProgressEventArgs : System.EventArgs { public UIProgressEventArgs() { } public bool LengthComputable { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public long Loaded { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public long Total { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } - public partial class UITouchEventArgs : Microsoft.AspNetCore.Components.UIEventArgs + public partial class UITouchEventArgs : System.EventArgs { public UITouchEventArgs() { } public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } @@ -228,6 +236,7 @@ namespace Microsoft.AspNetCore.Components public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public Microsoft.AspNetCore.Components.UITouchPoint[] TargetTouches { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public Microsoft.AspNetCore.Components.UITouchPoint[] Touches { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } public partial class UITouchPoint { @@ -276,8 +285,8 @@ namespace Microsoft.AspNetCore.Components.Forms { public static partial class EditContextFieldClassExtensions { - public static string FieldClass(this Microsoft.AspNetCore.Components.Forms.EditContext editContext, in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { throw null; } - public static string FieldClass(this Microsoft.AspNetCore.Components.Forms.EditContext editContext, System.Linq.Expressions.Expression> accessor) { throw null; } + public static string FieldCssClass(this Microsoft.AspNetCore.Components.Forms.EditContext editContext, in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { throw null; } + public static string FieldCssClass(this Microsoft.AspNetCore.Components.Forms.EditContext editContext, System.Linq.Expressions.Expression> accessor) { throw null; } } public partial class EditForm : Microsoft.AspNetCore.Components.ComponentBase { @@ -308,7 +317,6 @@ namespace Microsoft.AspNetCore.Components.Forms protected T CurrentValue { get { throw null; } set { } } protected string CurrentValueAsString { get { throw null; } set { } } protected Microsoft.AspNetCore.Components.Forms.EditContext EditContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - protected string FieldClass { get { throw null; } } protected Microsoft.AspNetCore.Components.Forms.FieldIdentifier FieldIdentifier { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Components.ParameterAttribute] public T Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } @@ -372,6 +380,7 @@ namespace Microsoft.AspNetCore.Components.Forms [Microsoft.AspNetCore.Components.ParameterAttribute] public System.Linq.Expressions.Expression> For { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { } + protected virtual void Dispose(bool disposing) { } protected override void OnParametersSet() { } void System.IDisposable.Dispose() { } } @@ -381,6 +390,7 @@ namespace Microsoft.AspNetCore.Components.Forms [Microsoft.AspNetCore.Components.ParameterAttribute(CaptureUnmatchedValues=true)] public System.Collections.Generic.IReadOnlyDictionary AdditionalAttributes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { } + protected virtual void Dispose(bool disposing) { } protected override void OnParametersSet() { } void System.IDisposable.Dispose() { } } diff --git a/src/Components/Web/src/BindAttributes.cs b/src/Components/Web/src/BindAttributes.cs index 69b4720b0a..91a1ee894c 100644 --- a/src/Components/Web/src/BindAttributes.cs +++ b/src/Components/Web/src/BindAttributes.cs @@ -24,9 +24,11 @@ namespace Microsoft.AspNetCore.Components // type="number" is invariant culture [BindInputElement("number", null, "value", "onchange", isInvariantCulture: true, format: null)] + [BindInputElement("number", "value", "value", "onchange", isInvariantCulture: true, format: null)] // type="date" is invariant culture with a specific format [BindInputElement("date", null, "value", "onchange", isInvariantCulture: true, format: "yyyy-MM-dd")] + [BindInputElement("date", "value", "value", "onchange", isInvariantCulture: true, format: "yyyy-MM-dd")] [BindElement("select", null, "value", "onchange")] [BindElement("textarea", null, "value", "onchange")] diff --git a/src/Components/Web/src/BrowserUriHelperInterop.cs b/src/Components/Web/src/BrowserNavigationManagerInterop.cs similarity index 79% rename from src/Components/Web/src/BrowserUriHelperInterop.cs rename to src/Components/Web/src/BrowserNavigationManagerInterop.cs index 3a22d5a4af..ddb3794b19 100644 --- a/src/Components/Web/src/BrowserUriHelperInterop.cs +++ b/src/Components/Web/src/BrowserNavigationManagerInterop.cs @@ -4,11 +4,9 @@ namespace Microsoft.AspNetCore.Components.Web { // Shared interop constants - internal static class BrowserUriHelperInterop + internal static class BrowserNavigationManagerInterop { - private static readonly string Prefix = "Blazor._internal.uriHelper."; - - public static readonly string ListenForNavigationEvents = Prefix + "listenForNavigationEvents"; + private static readonly string Prefix = "Blazor._internal.navigationManager."; public static readonly string EnableNavigationInterception = Prefix + "enableNavigationInterception"; diff --git a/src/Components/Web/src/EventHandlers.cs b/src/Components/Web/src/EventHandlers.cs index 0023ac1054..8df8102278 100644 --- a/src/Components/Web/src/EventHandlers.cs +++ b/src/Components/Web/src/EventHandlers.cs @@ -43,19 +43,19 @@ namespace Microsoft.AspNetCore.Components [EventHandler("onkeypress", typeof(UIKeyboardEventArgs))] // Input events - [EventHandler("onchange", typeof(UIChangeEventArgs))] - [EventHandler("oninput", typeof(UIChangeEventArgs))] - [EventHandler("oninvalid", typeof(UIEventArgs))] - [EventHandler("onreset", typeof(UIEventArgs))] - [EventHandler("onselect", typeof(UIEventArgs))] - [EventHandler("onselectstart", typeof(UIEventArgs))] - [EventHandler("onselectionchange", typeof(UIEventArgs))] - [EventHandler("onsubmit", typeof(UIEventArgs))] + [EventHandler("onchange", typeof(ChangeEventArgs))] + [EventHandler("oninput", typeof(ChangeEventArgs))] + [EventHandler("oninvalid", typeof(EventArgs))] + [EventHandler("onreset", typeof(EventArgs))] + [EventHandler("onselect", typeof(EventArgs))] + [EventHandler("onselectstart", typeof(EventArgs))] + [EventHandler("onselectionchange", typeof(EventArgs))] + [EventHandler("onsubmit", typeof(EventArgs))] // Clipboard events - [EventHandler("onbeforecopy", typeof(UIEventArgs))] - [EventHandler("onbeforecut", typeof(UIEventArgs))] - [EventHandler("onbeforepaste", typeof(UIEventArgs))] + [EventHandler("onbeforecopy", typeof(EventArgs))] + [EventHandler("onbeforecut", typeof(EventArgs))] + [EventHandler("onbeforepaste", typeof(EventArgs))] [EventHandler("oncopy", typeof(UIClipboardEventArgs))] [EventHandler("oncut", typeof(UIClipboardEventArgs))] [EventHandler("onpaste", typeof(UIClipboardEventArgs))] @@ -81,23 +81,23 @@ namespace Microsoft.AspNetCore.Components [EventHandler("onpointerup", typeof(UIPointerEventArgs))] // Media events - [EventHandler("oncanplay", typeof(UIEventArgs))] - [EventHandler("oncanplaythrough", typeof(UIEventArgs))] - [EventHandler("oncuechange", typeof(UIEventArgs))] - [EventHandler("ondurationchange", typeof(UIEventArgs))] - [EventHandler("onemptied", typeof(UIEventArgs))] - [EventHandler("onpause", typeof(UIEventArgs))] - [EventHandler("onplay", typeof(UIEventArgs))] - [EventHandler("onplaying", typeof(UIEventArgs))] - [EventHandler("onratechange", typeof(UIEventArgs))] - [EventHandler("onseeked", typeof(UIEventArgs))] - [EventHandler("onseeking", typeof(UIEventArgs))] - [EventHandler("onstalled", typeof(UIEventArgs))] - [EventHandler("onstop", typeof(UIEventArgs))] - [EventHandler("onsuspend", typeof(UIEventArgs))] - [EventHandler("ontimeupdate", typeof(UIEventArgs))] - [EventHandler("onvolumechange", typeof(UIEventArgs))] - [EventHandler("onwaiting", typeof(UIEventArgs))] + [EventHandler("oncanplay", typeof(EventArgs))] + [EventHandler("oncanplaythrough", typeof(EventArgs))] + [EventHandler("oncuechange", typeof(EventArgs))] + [EventHandler("ondurationchange", typeof(EventArgs))] + [EventHandler("onemptied", typeof(EventArgs))] + [EventHandler("onpause", typeof(EventArgs))] + [EventHandler("onplay", typeof(EventArgs))] + [EventHandler("onplaying", typeof(EventArgs))] + [EventHandler("onratechange", typeof(EventArgs))] + [EventHandler("onseeked", typeof(EventArgs))] + [EventHandler("onseeking", typeof(EventArgs))] + [EventHandler("onstalled", typeof(EventArgs))] + [EventHandler("onstop", typeof(EventArgs))] + [EventHandler("onsuspend", typeof(EventArgs))] + [EventHandler("ontimeupdate", typeof(EventArgs))] + [EventHandler("onvolumechange", typeof(EventArgs))] + [EventHandler("onwaiting", typeof(EventArgs))] // Progress events [EventHandler("onloadstart", typeof(UIProgressEventArgs))] @@ -109,19 +109,19 @@ namespace Microsoft.AspNetCore.Components [EventHandler("onerror", typeof(UIErrorEventArgs))] // General events - [EventHandler("onactivate", typeof(UIEventArgs))] - [EventHandler("onbeforeactivate", typeof(UIEventArgs))] - [EventHandler("onbeforedeactivate", typeof(UIEventArgs))] - [EventHandler("ondeactivate", typeof(UIEventArgs))] - [EventHandler("onended", typeof(UIEventArgs))] - [EventHandler("onfullscreenchange", typeof(UIEventArgs))] - [EventHandler("onfullscreenerror", typeof(UIEventArgs))] - [EventHandler("onloadeddata", typeof(UIEventArgs))] - [EventHandler("onloadedmetadata", typeof(UIEventArgs))] - [EventHandler("onpointerlockchange", typeof(UIEventArgs))] - [EventHandler("onpointerlockerror", typeof(UIEventArgs))] - [EventHandler("onreadystatechange", typeof(UIEventArgs))] - [EventHandler("onscroll", typeof(UIEventArgs))] + [EventHandler("onactivate", typeof(EventArgs))] + [EventHandler("onbeforeactivate", typeof(EventArgs))] + [EventHandler("onbeforedeactivate", typeof(EventArgs))] + [EventHandler("ondeactivate", typeof(EventArgs))] + [EventHandler("onended", typeof(EventArgs))] + [EventHandler("onfullscreenchange", typeof(EventArgs))] + [EventHandler("onfullscreenerror", typeof(EventArgs))] + [EventHandler("onloadeddata", typeof(EventArgs))] + [EventHandler("onloadedmetadata", typeof(EventArgs))] + [EventHandler("onpointerlockchange", typeof(EventArgs))] + [EventHandler("onpointerlockerror", typeof(EventArgs))] + [EventHandler("onreadystatechange", typeof(EventArgs))] + [EventHandler("onscroll", typeof(EventArgs))] public static class EventHandlers { } diff --git a/src/Components/Web/src/Forms/EditContextFieldClassExtensions.cs b/src/Components/Web/src/Forms/EditContextFieldClassExtensions.cs index bd92563535..687328043a 100644 --- a/src/Components/Web/src/Forms/EditContextFieldClassExtensions.cs +++ b/src/Components/Web/src/Forms/EditContextFieldClassExtensions.cs @@ -14,23 +14,23 @@ namespace Microsoft.AspNetCore.Components.Forms public static class EditContextFieldClassExtensions { /// - /// Gets a string that indicates the status of the specified field. This will include + /// Gets a string that indicates the status of the specified field as a CSS class. This will include /// some combination of "modified", "valid", or "invalid", depending on the status of the field. /// /// The . /// An identifier for the field. /// A string that indicates the status of the field. - public static string FieldClass(this EditContext editContext, Expression> accessor) - => FieldClass(editContext, FieldIdentifier.Create(accessor)); + public static string FieldCssClass(this EditContext editContext, Expression> accessor) + => FieldCssClass(editContext, FieldIdentifier.Create(accessor)); /// - /// Gets a string that indicates the status of the specified field. This will include + /// Gets a string that indicates the status of the specified field as a CSS class. This will include /// some combination of "modified", "valid", or "invalid", depending on the status of the field. /// /// The . /// An identifier for the field. /// A string that indicates the status of the field. - public static string FieldClass(this EditContext editContext, in FieldIdentifier fieldIdentifier) + public static string FieldCssClass(this EditContext editContext, in FieldIdentifier fieldIdentifier) { var isValid = !editContext.GetValidationMessages(fieldIdentifier).Any(); if (editContext.IsModified(fieldIdentifier)) diff --git a/src/Components/Web/src/Forms/InputBase.cs b/src/Components/Web/src/Forms/InputBase.cs index b103ad0d8b..4202aec396 100644 --- a/src/Components/Web/src/Forms/InputBase.cs +++ b/src/Components/Web/src/Forms/InputBase.cs @@ -143,8 +143,8 @@ namespace Microsoft.AspNetCore.Components.Forms /// Gets a string that indicates the status of the field being edited. This will include /// some combination of "modified", "valid", or "invalid", depending on the status of the field. ///
- protected string FieldClass - => EditContext.FieldClass(FieldIdentifier); + private string FieldClass + => EditContext.FieldCssClass(FieldIdentifier); /// /// Gets a CSS class string that combines the class attribute and diff --git a/src/Components/Web/src/Forms/ValidationMessage.cs b/src/Components/Web/src/Forms/ValidationMessage.cs index 6102843f44..f4676d7921 100644 --- a/src/Components/Web/src/Forms/ValidationMessage.cs +++ b/src/Components/Web/src/Forms/ValidationMessage.cs @@ -85,9 +85,14 @@ namespace Microsoft.AspNetCore.Components.Forms StateHasChanged(); } + protected virtual void Dispose(bool disposing) + { + } + void IDisposable.Dispose() { DetachValidationStateChangedListener(); + Dispose(disposing: true); } private void DetachValidationStateChangedListener() diff --git a/src/Components/Web/src/Forms/ValidationSummary.cs b/src/Components/Web/src/Forms/ValidationSummary.cs index dc119a4f36..b0ed6596cd 100644 --- a/src/Components/Web/src/Forms/ValidationSummary.cs +++ b/src/Components/Web/src/Forms/ValidationSummary.cs @@ -82,9 +82,14 @@ namespace Microsoft.AspNetCore.Components.Forms StateHasChanged(); } + protected virtual void Dispose(bool disposing) + { + } + void IDisposable.Dispose() { DetachValidationStateChangedListener(); + Dispose(disposing: true); } private void DetachValidationStateChangedListener() diff --git a/src/Components/Web/src/RendererRegistryEventDispatcher.cs b/src/Components/Web/src/RendererRegistryEventDispatcher.cs index ea4a5c0b46..7bffa1ec6e 100644 --- a/src/Components/Web/src/RendererRegistryEventDispatcher.cs +++ b/src/Components/Web/src/RendererRegistryEventDispatcher.cs @@ -54,12 +54,12 @@ namespace Microsoft.AspNetCore.Components.Web } } - private static UIEventArgs ParseEventArgsJson(string eventArgsType, string eventArgsJson) + private static EventArgs ParseEventArgsJson(string eventArgsType, string eventArgsJson) { switch (eventArgsType) { case "change": - return DeserializeUIEventChangeArgs(eventArgsJson); + return DeserializeChangeEventArgs(eventArgsJson); case "clipboard": return Deserialize(eventArgsJson); case "drag": @@ -79,7 +79,7 @@ namespace Microsoft.AspNetCore.Components.Web case "touch": return Deserialize(eventArgsJson); case "unknown": - return Deserialize(eventArgsJson); + return EventArgs.Empty; case "wheel": return Deserialize(eventArgsJson); default: @@ -92,9 +92,9 @@ namespace Microsoft.AspNetCore.Components.Web return JsonSerializer.Deserialize(eventArgsJson, JsonSerializerOptionsProvider.Options); } - private static UIChangeEventArgs DeserializeUIEventChangeArgs(string eventArgsJson) + private static ChangeEventArgs DeserializeChangeEventArgs(string eventArgsJson) { - var changeArgs = Deserialize(eventArgsJson); + var changeArgs = Deserialize(eventArgsJson); var jsonElement = (JsonElement)changeArgs.Value; switch (jsonElement.ValueKind) { @@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Components.Web changeArgs.Value = jsonElement.GetBoolean(); break; default: - throw new ArgumentException($"Unsupported {nameof(UIChangeEventArgs)} value {jsonElement}."); + throw new ArgumentException($"Unsupported {nameof(ChangeEventArgs)} value {jsonElement}."); } return changeArgs; } diff --git a/src/Components/Web/src/Routing/NavLink.cs b/src/Components/Web/src/Routing/NavLink.cs index 512f63020b..949904e4d4 100644 --- a/src/Components/Web/src/Routing/NavLink.cs +++ b/src/Components/Web/src/Routing/NavLink.cs @@ -51,13 +51,13 @@ namespace Microsoft.AspNetCore.Components.Routing [Parameter] public NavLinkMatch Match { get; set; } - [Inject] private IUriHelper UriHelper { get; set; } + [Inject] private NavigationManager NavigationManger { get; set; } /// protected override void OnInitialized() { // We'll consider re-rendering on each location change - UriHelper.OnLocationChanged += OnLocationChanged; + NavigationManger.LocationChanged += OnLocationChanged; } /// @@ -70,8 +70,8 @@ namespace Microsoft.AspNetCore.Components.Routing href = Convert.ToString(obj); } - _hrefAbsolute = href == null ? null : UriHelper.ToAbsoluteUri(href).AbsoluteUri; - _isActive = ShouldMatch(UriHelper.GetAbsoluteUri()); + _hrefAbsolute = href == null ? null : NavigationManger.ToAbsoluteUri(href).AbsoluteUri; + _isActive = ShouldMatch(NavigationManger.Uri); _class = (string)null; if (AdditionalAttributes != null && AdditionalAttributes.TryGetValue("class", out obj)) @@ -86,7 +86,7 @@ namespace Microsoft.AspNetCore.Components.Routing public void Dispose() { // To avoid leaking memory, it's important to detach any event handlers in Dispose() - UriHelper.OnLocationChanged -= OnLocationChanged; + NavigationManger.LocationChanged -= OnLocationChanged; } private void UpdateCssClass() diff --git a/src/Components/Web/src/UIClipboardEventArgs.cs b/src/Components/Web/src/UIClipboardEventArgs.cs index f4ed05d3f7..166d9221c1 100644 --- a/src/Components/Web/src/UIClipboardEventArgs.cs +++ b/src/Components/Web/src/UIClipboardEventArgs.cs @@ -1,12 +1,18 @@ // 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; + namespace Microsoft.AspNetCore.Components { /// /// Supplies information about an clipboard event that is being raised. /// - public class UIClipboardEventArgs : UIEventArgs + public class UIClipboardEventArgs : EventArgs { + /// + /// Gets or sets the type of the event. + /// + public string Type { get; set; } } } diff --git a/src/Components/Web/src/UIErrorEventArgs.cs b/src/Components/Web/src/UIErrorEventArgs.cs index c7b0b31a4a..6cf86b7553 100644 --- a/src/Components/Web/src/UIErrorEventArgs.cs +++ b/src/Components/Web/src/UIErrorEventArgs.cs @@ -1,12 +1,14 @@ // 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; + namespace Microsoft.AspNetCore.Components { /// /// Supplies information about an error event that is being raised. /// - public class UIErrorEventArgs : UIEventArgs + public class UIErrorEventArgs : EventArgs { /// /// Gets a a human-readable error message describing the problem. @@ -27,5 +29,10 @@ namespace Microsoft.AspNetCore.Components /// Gets the column number of the script file on which the error occurred. /// public int Colno { get; set; } + + /// + /// Gets or sets the type of the event. + /// + public string Type { get; set; } } } diff --git a/src/Components/Web/src/UIFocusEventArgs.cs b/src/Components/Web/src/UIFocusEventArgs.cs index 1260a9e088..b120e666a8 100644 --- a/src/Components/Web/src/UIFocusEventArgs.cs +++ b/src/Components/Web/src/UIFocusEventArgs.cs @@ -1,14 +1,21 @@ // 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; + namespace Microsoft.AspNetCore.Components { /// /// Supplies information about a focus event that is being raised. /// - public class UIFocusEventArgs : UIEventArgs + public class UIFocusEventArgs : EventArgs { // Not including support for 'relatedTarget' since we don't have a good way to represent it. // see: https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent + + /// + /// Gets or sets the type of the event. + /// + public string Type { get; set; } } } diff --git a/src/Components/Web/src/UIKeyboardEventArgs.cs b/src/Components/Web/src/UIKeyboardEventArgs.cs index fdcb5fd462..fd66247dc4 100644 --- a/src/Components/Web/src/UIKeyboardEventArgs.cs +++ b/src/Components/Web/src/UIKeyboardEventArgs.cs @@ -1,12 +1,14 @@ // 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; + namespace Microsoft.AspNetCore.Components { /// /// Supplies information about a keyboard event that is being raised. /// - public class UIKeyboardEventArgs : UIEventArgs + public class UIKeyboardEventArgs : EventArgs { /// /// The key value of the key represented by the event. @@ -51,5 +53,10 @@ namespace Microsoft.AspNetCore.Components /// true if the meta key was down when the event was fired. false otherwise. /// public bool MetaKey { get; set; } + + /// + /// Gets or sets the type of the event. + /// + public string Type { get; set; } } } diff --git a/src/Components/Web/src/UIMouseEventArgs.cs b/src/Components/Web/src/UIMouseEventArgs.cs index fa5327e1fd..da4d2a64ae 100644 --- a/src/Components/Web/src/UIMouseEventArgs.cs +++ b/src/Components/Web/src/UIMouseEventArgs.cs @@ -1,12 +1,14 @@ // 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; + namespace Microsoft.AspNetCore.Components { /// /// Supplies information about a mouse event that is being raised. /// - public class UIMouseEventArgs : UIEventArgs + public class UIMouseEventArgs : EventArgs { /// /// A count of consecutive clicks that happened in a short amount of time, incremented by one. @@ -73,5 +75,10 @@ namespace Microsoft.AspNetCore.Components /// true if the meta key was down when the event was fired. false otherwise. /// public bool MetaKey { get; set; } + + /// + /// Gets or sets the type of the event. + /// + public string Type { get; set; } } } diff --git a/src/Components/Web/src/UIProgressEventArgs.cs b/src/Components/Web/src/UIProgressEventArgs.cs index 9d57a357c8..e0273c665f 100644 --- a/src/Components/Web/src/UIProgressEventArgs.cs +++ b/src/Components/Web/src/UIProgressEventArgs.cs @@ -1,12 +1,14 @@ // 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; + namespace Microsoft.AspNetCore.Components { /// /// Supplies information about a progress event that is being raised. /// - public class UIProgressEventArgs : UIEventArgs + public class UIProgressEventArgs : EventArgs { /// /// Whether or not the total size of the transfer is known. @@ -24,5 +26,10 @@ namespace Microsoft.AspNetCore.Components /// If the total size is unknown, this value is zero. /// public long Total { get; set; } + + /// + /// Gets or sets the type of the event. + /// + public string Type { get; set; } } } diff --git a/src/Components/Web/src/UITouchEventArgs.cs b/src/Components/Web/src/UITouchEventArgs.cs index be5fe34da1..3be004b7f1 100644 --- a/src/Components/Web/src/UITouchEventArgs.cs +++ b/src/Components/Web/src/UITouchEventArgs.cs @@ -1,12 +1,14 @@ // 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; + namespace Microsoft.AspNetCore.Components { /// /// Supplies information about a touch event that is being raised. /// - public class UITouchEventArgs : UIEventArgs + public class UITouchEventArgs : EventArgs { /// /// A count of consecutive clicks that happened in a short amount of time, incremented by one. @@ -50,5 +52,10 @@ namespace Microsoft.AspNetCore.Components /// true if the meta key was down when the event was fired. false otherwise. /// public bool MetaKey { get; set; } + + /// + /// Gets or sets the type of the event. + /// + public string Type { get; set; } } } diff --git a/src/Components/Web/src/WebEventCallbackFactoryUIEventArgsExtensions.cs b/src/Components/Web/src/WebEventCallbackFactoryUIEventArgsExtensions.cs index 1966f20ddc..02bb5d6d58 100644 --- a/src/Components/Web/src/WebEventCallbackFactoryUIEventArgsExtensions.cs +++ b/src/Components/Web/src/WebEventCallbackFactoryUIEventArgsExtensions.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.Components { /// - /// Provides extension methods for and types. + /// Provides extension methods for and types. /// public static class WebEventCallbackFactoryUIEventArgsExtensions { diff --git a/src/Components/Web/test/Forms/InputBaseTest.cs b/src/Components/Web/test/Forms/InputBaseTest.cs index 71deade2b3..8be8525365 100644 --- a/src/Components/Web/test/Forms/InputBaseTest.cs +++ b/src/Components/Web/test/Forms/InputBaseTest.cs @@ -213,28 +213,23 @@ namespace Microsoft.AspNetCore.Components.Forms // Act/Assert: Initally, it's valid and unmodified var inputComponent = await RenderAndGetTestInputComponentAsync(rootComponent); - Assert.Equal("valid", inputComponent.FieldClass); - Assert.Equal("valid", inputComponent.CssClass); // Same because no Class was specified + Assert.Equal("valid", inputComponent.CssClass); // no Class was specified // Act/Assert: Modify the field rootComponent.EditContext.NotifyFieldChanged(fieldIdentifier); - Assert.Equal("modified valid", inputComponent.FieldClass); Assert.Equal("modified valid", inputComponent.CssClass); // Act/Assert: Make it invalid var messages = new ValidationMessageStore(rootComponent.EditContext); messages.Add(fieldIdentifier, "I do not like this value"); - Assert.Equal("modified invalid", inputComponent.FieldClass); Assert.Equal("modified invalid", inputComponent.CssClass); // Act/Assert: Clear the modification flag rootComponent.EditContext.MarkAsUnmodified(fieldIdentifier); - Assert.Equal("invalid", inputComponent.FieldClass); Assert.Equal("invalid", inputComponent.CssClass); // Act/Assert: Make it valid messages.Clear(); - Assert.Equal("valid", inputComponent.FieldClass); Assert.Equal("valid", inputComponent.CssClass); } @@ -256,12 +251,10 @@ namespace Microsoft.AspNetCore.Components.Forms // Act/Assert var inputComponent = await RenderAndGetTestInputComponentAsync(rootComponent); - Assert.Equal("valid", inputComponent.FieldClass); Assert.Equal("my-class other-class valid", inputComponent.CssClass); // Act/Assert: Retains custom class when changing field class rootComponent.EditContext.NotifyFieldChanged(fieldIdentifier); - Assert.Equal("modified valid", inputComponent.FieldClass); Assert.Equal("my-class other-class modified valid", inputComponent.CssClass); } @@ -393,8 +386,6 @@ namespace Microsoft.AspNetCore.Components.Forms public new FieldIdentifier FieldIdentifier => base.FieldIdentifier; - public new string FieldClass => base.FieldClass; - protected override bool TryParseValueFromString(string value, out T result, out string validationErrorMessage) { throw new NotImplementedException(); diff --git a/src/Components/test/E2ETest/Infrastructure/BasicTestAppTestBase.cs b/src/Components/test/E2ETest/Infrastructure/BasicTestAppTestBase.cs index e866d890d1..e9539fc9f9 100644 --- a/src/Components/test/E2ETest/Infrastructure/BasicTestAppTestBase.cs +++ b/src/Components/test/E2ETest/Infrastructure/BasicTestAppTestBase.cs @@ -1,13 +1,12 @@ // 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.Linq; using BasicTestApp; using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures; using Microsoft.AspNetCore.E2ETesting; using OpenQA.Selenium; using OpenQA.Selenium.Support.UI; -using System; -using System.Linq; using Xunit.Abstractions; namespace Microsoft.AspNetCore.Components.E2ETest.Infrastructure @@ -38,18 +37,10 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Infrastructure protected SelectElement WaitUntilTestSelectorReady() { var elemToFind = By.CssSelector("#test-selector > select"); - WaitUntilExists(elemToFind, timeoutSeconds: 30); + WaitUntilExists(elemToFind, timeoutSeconds: 30, throwOnError: true); return new SelectElement(Browser.FindElement(elemToFind)); } - protected IWebElement WaitUntilExists(By findBy, int timeoutSeconds = 10) - { - IWebElement result = null; - new WebDriverWait(Browser, TimeSpan.FromSeconds(timeoutSeconds)) - .Until(driver => (result = driver.FindElement(findBy)) != null); - return result; - } - protected void SignInAs(string usernameOrNull, string rolesOrNull, bool useSeparateTab = false) { const string authenticationPageUrl = "/Authentication"; diff --git a/src/Components/test/E2ETest/Infrastructure/ServerFixtures/ServerFixture.cs b/src/Components/test/E2ETest/Infrastructure/ServerFixtures/ServerFixture.cs index 3cd8539c61..742a83f12f 100644 --- a/src/Components/test/E2ETest/Infrastructure/ServerFixtures/ServerFixture.cs +++ b/src/Components/test/E2ETest/Infrastructure/ServerFixtures/ServerFixture.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.ExceptionServices; using System.Threading; namespace Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures @@ -52,13 +53,30 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures { var isDone = new ManualResetEvent(false); + ExceptionDispatchInfo edi = null; new Thread(() => { - action(); + try + { + action(); + } + catch (Exception ex) + { + edi = ExceptionDispatchInfo.Capture(ex); + } + isDone.Set(); }).Start(); - isDone.WaitOne(); + if (!isDone.WaitOne(TimeSpan.FromSeconds(10))) + { + throw new TimeoutException("Timed out waiting for: " + action); + } + + if (edi != null) + { + throw edi.SourceException; + } } } } diff --git a/src/Components/test/E2ETest/Infrastructure/ServerFixtures/ToggleExecutionModeServerFixture.cs b/src/Components/test/E2ETest/Infrastructure/ServerFixtures/ToggleExecutionModeServerFixture.cs index 56be3c9256..cda7c50420 100644 --- a/src/Components/test/E2ETest/Infrastructure/ServerFixtures/ToggleExecutionModeServerFixture.cs +++ b/src/Components/test/E2ETest/Infrastructure/ServerFixtures/ToggleExecutionModeServerFixture.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using Microsoft.AspNetCore.Hosting; namespace Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures { @@ -11,6 +12,8 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures { public string PathBase { get; set; } + public IWebHost Host { get; set; } + public ExecutionMode ExecutionMode { get; set; } = ExecutionMode.Client; private AspNetSiteServerFixture.BuildWebHost _buildWebHostMethod; @@ -32,7 +35,11 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures var underlying = new DevHostServerFixture(); underlying.PathBase = PathBase; _serverToDispose = underlying; - return underlying.RootUri.AbsoluteUri; + var uri = underlying.RootUri.AbsoluteUri; // As a side-effect, this starts the server + + Host = underlying.Host; + + return uri; } else { @@ -41,7 +48,11 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures underlying.AdditionalArguments.AddRange(AspNetFixtureAdditionalArguments); underlying.BuildWebHostMethod = _buildWebHostMethod; _serverToDispose = underlying; - return underlying.RootUri.AbsoluteUri; + var uri = underlying.RootUri.AbsoluteUri; // As a side-effect, this starts the server + + Host = underlying.Host; + + return uri; } } diff --git a/src/Components/test/E2ETest/Infrastructure/ServerFixtures/WebHostServerFixture.cs b/src/Components/test/E2ETest/Infrastructure/ServerFixtures/WebHostServerFixture.cs index 2408713ca8..1da2656b37 100644 --- a/src/Components/test/E2ETest/Infrastructure/ServerFixtures/WebHostServerFixture.cs +++ b/src/Components/test/E2ETest/Infrastructure/ServerFixtures/WebHostServerFixture.cs @@ -24,6 +24,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures { // This can be null if creating the webhost throws, we don't want to throw here and hide // the original exception. + Host?.Dispose(); Host?.StopAsync(); } diff --git a/src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj b/src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj index 9e85027c89..fc3a9c6dfa 100644 --- a/src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj +++ b/src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj @@ -7,12 +7,16 @@ netcoreapp3.0 Components.E2ETests - true false + + + true + + diff --git a/src/Components/test/E2ETest/ServerExecutionTests/CircuitGracefulTerminationTests.cs b/src/Components/test/E2ETest/ServerExecutionTests/CircuitGracefulTerminationTests.cs new file mode 100644 index 0000000000..f383818386 --- /dev/null +++ b/src/Components/test/E2ETest/ServerExecutionTests/CircuitGracefulTerminationTests.cs @@ -0,0 +1,111 @@ +// 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 System.Collections.Generic; +using System.Threading.Tasks; +using BasicTestApp; +using Microsoft.AspNetCore.Components.E2ETest.Infrastructure; +using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures; +using Microsoft.AspNetCore.E2ETesting; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging.Testing; +using OpenQA.Selenium; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests +{ + public class CircuitGracefulTerminationTests : BasicTestAppTestBase, IDisposable + { + public CircuitGracefulTerminationTests( + BrowserFixture browserFixture, + ToggleExecutionModeServerFixture serverFixture, + ITestOutputHelper output) + : base(browserFixture, serverFixture.WithServerExecution(), output) + { + } + + public TaskCompletionSource GracefulDisconnectCompletionSource { get; private set; } + public TestSink Sink { get; private set; } + public List<(Extensions.Logging.LogLevel level, string eventIdName)> Messages { get; private set; } + + public override async Task InitializeAsync() + { + // These tests manipulate the browser in ways that make it impossible to use the same browser + // instance across tests (One of the tests closes the browser). For that reason we simply create + // a new browser instance for every test in this class sos that there are no issues when running + // them together. + await base.InitializeAsync(Guid.NewGuid().ToString()); + } + + protected override void InitializeAsyncCore() + { + Navigate(ServerPathBase, noReload: false); + MountTestComponent(); + Browser.Equal("Current count: 0", () => Browser.FindElement(By.TagName("p")).Text); + + GracefulDisconnectCompletionSource = new TaskCompletionSource(TaskContinuationOptions.RunContinuationsAsynchronously); + Sink = _serverFixture.Host.Services.GetRequiredService(); + Messages = new List<(Extensions.Logging.LogLevel level, string eventIdName)>(); + Sink.MessageLogged += Log; + } + + [Fact] + public async Task ReloadingThePage_GracefullyDisconnects_TheCurrentCircuit() + { + // Arrange & Act + _ = ((IJavaScriptExecutor)Browser).ExecuteScript("location.reload()"); + await Task.WhenAny(Task.Delay(10000), GracefulDisconnectCompletionSource.Task); + + // Assert + Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitTerminatedGracefully"), Messages); + Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitDisconnectedPermanently"), Messages); + } + + [Fact] + public async Task ClosingTheBrowserWindow_GracefullyDisconnects_TheCurrentCircuit() + { + // Arrange & Act + Browser.Close(); + // Set to null so that other tests in this class can create a new browser if necessary so + // that tests don't fail when running together. + Browser = null; + + await Task.WhenAny(Task.Delay(10000), GracefulDisconnectCompletionSource.Task); + + // Assert + Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitTerminatedGracefully"), Messages); + Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitDisconnectedPermanently"), Messages); + } + + [Fact] + public async Task ClosingTheBrowserWindow_GracefullyDisconnects_WhenNavigatingAwayFromThePage() + { + // Arrange & Act + Browser.Navigate().GoToUrl("about:blank"); + await Task.WhenAny(Task.Delay(10000), GracefulDisconnectCompletionSource.Task); + + // Assert + Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitTerminatedGracefully"), Messages); + Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitDisconnectedPermanently"), Messages); + } + + private void Log(WriteContext wc) + { + if ((Extensions.Logging.LogLevel.Debug, "CircuitTerminatedGracefully") == (wc.LogLevel, wc.EventId.Name)) + { + GracefulDisconnectCompletionSource.TrySetResult(null); + } + Messages.Add((wc.LogLevel, wc.EventId.Name)); + } + + public void Dispose() + { + if (Sink != null) + { + Sink.MessageLogged -= Log; + } + } + } +} diff --git a/src/Components/test/E2ETest/ServerExecutionTests/ComponentHubReliabilityTest.cs b/src/Components/test/E2ETest/ServerExecutionTests/ComponentHubReliabilityTest.cs index 5ee3a8c6d1..deb353dd9c 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/ComponentHubReliabilityTest.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/ComponentHubReliabilityTest.cs @@ -60,8 +60,66 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests // Act await Client.ExpectCircuitError(() => Client.HubConnection.SendAsync( "StartCircuit", - baseUri.GetLeftPart(UriPartial.Authority), - baseUri)); + baseUri, + baseUri + "/home")); + + // Assert + var actualError = Assert.Single(Errors); + Assert.Matches(expectedError, actualError); + Assert.DoesNotContain(Logs, l => l.LogLevel > LogLevel.Information); + } + + [Fact] + public async Task CannotStartCircuitWithNullData() + { + // Arrange + var expectedError = "The uris provided are invalid."; + var rootUri = _serverFixture.RootUri; + var uri = new Uri(rootUri, "/subdir"); + Assert.True(await Client.ConnectAsync(uri, prerendered: false, connectAutomatically: false), "Couldn't connect to the app"); + + // Act + await Client.ExpectCircuitError(() => Client.HubConnection.SendAsync("StartCircuit", null, null)); + + // Assert + var actualError = Assert.Single(Errors); + Assert.Matches(expectedError, actualError); + Assert.DoesNotContain(Logs, l => l.LogLevel > LogLevel.Information); + } + + [Fact] + public async Task CannotStartCircuitWithInvalidUris() + { + // Arrange + var expectedError = "The uris provided are invalid."; + var rootUri = _serverFixture.RootUri; + var uri = new Uri(rootUri, "/subdir"); + Assert.True(await Client.ConnectAsync(uri, prerendered: false, connectAutomatically: false), "Couldn't connect to the app"); + + // Act + await Client.ExpectCircuitError(() => Client.HubConnection.SendAsync("StartCircuit", uri.AbsoluteUri, "/foo")); + + // Assert + var actualError = Assert.Single(Errors); + Assert.Matches(expectedError, actualError); + Assert.DoesNotContain(Logs, l => l.LogLevel > LogLevel.Information); + } + + // This is a hand-chosen example of something that will cause an exception in creating the circuit host. + // We want to test this case so that we know what happens when creating the circuit host blows up. + [Fact] + public async Task StartCircuitCausesInitializationError() + { + // Arrange + var expectedError = "The circuit failed to initialize."; + var rootUri = _serverFixture.RootUri; + var uri = new Uri(rootUri, "/subdir"); + Assert.True(await Client.ConnectAsync(uri, prerendered: false, connectAutomatically: false), "Couldn't connect to the app"); + + // Act + // + // These are valid URIs by the BaseUri doesn't contain the Uri - so it fails to initialize. + await Client.ExpectCircuitError(() => Client.HubConnection.SendAsync("StartCircuit", uri, "http://example.com"), TimeSpan.FromHours(1)); // Assert var actualError = Assert.Single(Errors); @@ -92,7 +150,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests var actualError = Assert.Single(Errors); Assert.Equal(expectedError, actualError); Assert.DoesNotContain(Logs, l => l.LogLevel > LogLevel.Information); - Assert.Contains(Logs, l => (l.LogLevel, l.Message) == (LogLevel.Debug, "Call to 'BeginInvokeDotNetFromJS' received before the circuit host initialization.")); + Assert.Contains(Logs, l => (l.LogLevel, l.Message) == (LogLevel.Debug, "Call to 'BeginInvokeDotNetFromJS' received before the circuit host initialization")); } [Fact] @@ -116,7 +174,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests var actualError = Assert.Single(Errors); Assert.Equal(expectedError, actualError); Assert.DoesNotContain(Logs, l => l.LogLevel > LogLevel.Information); - Assert.Contains(Logs, l => (l.LogLevel, l.Message) == (LogLevel.Debug, "Call to 'EndInvokeJSFromDotNet' received before the circuit host initialization.")); + Assert.Contains(Logs, l => (l.LogLevel, l.Message) == (LogLevel.Debug, "Call to 'EndInvokeJSFromDotNet' received before the circuit host initialization")); } [Fact] @@ -139,7 +197,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests var actualError = Assert.Single(Errors); Assert.Equal(expectedError, actualError); Assert.DoesNotContain(Logs, l => l.LogLevel > LogLevel.Information); - Assert.Contains(Logs, l => (l.LogLevel, l.Message) == (LogLevel.Debug, "Call to 'DispatchBrowserEvent' received before the circuit host initialization.")); + Assert.Contains(Logs, l => (l.LogLevel, l.Message) == (LogLevel.Debug, "Call to 'DispatchBrowserEvent' received before the circuit host initialization")); } [Fact] @@ -162,7 +220,30 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests var actualError = Assert.Single(Errors); Assert.Equal(expectedError, actualError); Assert.DoesNotContain(Logs, l => l.LogLevel > LogLevel.Information); - Assert.Contains(Logs, l => (l.LogLevel, l.Message) == (LogLevel.Debug, "Call to 'OnRenderCompleted' received before the circuit host initialization.")); + Assert.Contains(Logs, l => (l.LogLevel, l.Message) == (LogLevel.Debug, "Call to 'OnRenderCompleted' received before the circuit host initialization")); + } + + [Fact] + public async Task CannotInvokeOnLocationChangedBeforeInitialization() + { + // Arrange + var expectedError = "Circuit not initialized."; + var rootUri = _serverFixture.RootUri; + var baseUri = new Uri(rootUri, "/subdir"); + Assert.True(await Client.ConnectAsync(baseUri, prerendered: false, connectAutomatically: false)); + Assert.Empty(Batches); + + // Act + await Client.ExpectCircuitError(() => Client.HubConnection.SendAsync( + "OnLocationChanged", + baseUri.AbsoluteUri, + false)); + + // Assert + var actualError = Assert.Single(Errors); + Assert.Equal(expectedError, actualError); + Assert.DoesNotContain(Logs, l => l.LogLevel > LogLevel.Information); + Assert.Contains(Logs, l => (l.LogLevel, l.Message) == (LogLevel.Debug, "Call to 'OnLocationChanged' received before the circuit host initialization")); } public void Dispose() diff --git a/src/Components/test/E2ETest/ServerExecutionTests/InteropReliabilityTests.cs b/src/Components/test/E2ETest/ServerExecutionTests/InteropReliabilityTests.cs index 9d9cdfc46b..8b46ee7e0a 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/InteropReliabilityTests.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/InteropReliabilityTests.cs @@ -239,13 +239,15 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests // Act await Client.ClickAsync("triggerjsinterop-malformed"); - Assert.Single(interopCalls, (4, "sendMalformedCallbackReturn", (string)null)); + var call = interopCalls.FirstOrDefault(call => call.identifier == "sendMalformedCallbackReturn"); + Assert.NotEqual(default, call); + var id = call.id; await Client.HubConnection.InvokeAsync( "EndInvokeJSFromDotNet", - 4, + id, true, - "[4, true, \"{\"]"); + $"[{id}, true, \"{{\"]"); var text = Assert.Single( Client.FindElementById("errormessage-malformed").Children.OfType(), @@ -264,16 +266,19 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests var sink = _serverFixture.Host.Services.GetRequiredService(); var logEvents = new List<(LogLevel logLevel, string)>(); sink.MessageLogged += (wc) => logEvents.Add((wc.LogLevel, wc.EventId.Name)); + // Act await Client.ClickAsync("triggerjsinterop-malformed"); - Assert.Single(interopCalls, (4, "sendMalformedCallbackReturn", (string)null)); + var call = interopCalls.FirstOrDefault(call => call.identifier == "sendMalformedCallbackReturn"); + Assert.NotEqual(default, call); + var id = call.id; await Client.HubConnection.InvokeAsync( "EndInvokeJSFromDotNet", - 4, + id, true, - "[4, true, }"); + $"[{id}, true, }}"); // A completely malformed payload like the one above never gets to the application. Assert.Single( @@ -285,9 +290,9 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests await Client.ClickAsync("triggerjsinterop-success"); await Client.HubConnection.InvokeAsync( "EndInvokeJSFromDotNet", - 5, + id++, true, - "[5, true, null]"); + $"[{id}, true, null]"); Assert.Single( Client.FindElementById("errormessage-success").Children.OfType(), @@ -298,9 +303,9 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests await Client.ClickAsync("triggerjsinterop-failure"); await Client.HubConnection.InvokeAsync( "EndInvokeJSFromDotNet", - 6, + id++, false, - "[6, false, \"There was an error invoking sendFailureCallbackReturn\"]"); + $"[{id}, false, \"There was an error invoking sendFailureCallbackReturn\"]"); Assert.Single( Client.FindElementById("errormessage-failure").Children.OfType(), @@ -385,7 +390,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests } [Fact] - public async Task DispatchingEventsWithInvalidUIEventArgs() + public async Task DispatchingEventsWithInvalidEventArgs() { // Arrange var (interopCalls, dotNetCompletions, batches) = ConfigureClient(); @@ -534,7 +539,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests Assert.Equal(2, batches.Count); } - private (List<(int, string, string)>, List, List<(int, int, byte[])>) ConfigureClient() + private (List<(int id, string identifier, string args)>, List, List<(int, int, byte[])>) ConfigureClient() { var interopCalls = new List<(int, string, string)>(); Client.JSInterop += (int arg1, string arg2, string arg3) => interopCalls.Add((arg1, arg2, arg3)); diff --git a/src/Components/test/E2ETest/ServerExecutionTests/ServerAuthTest.cs b/src/Components/test/E2ETest/ServerExecutionTests/ServerAuthTest.cs index a596cbc036..6bbdfbfa54 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/ServerAuthTest.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/ServerAuthTest.cs @@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests { } - [Theory] + [Theory(Skip = "https://github.com/aspnet/AspNetCore/issues/12788")] [InlineData(null, null)] [InlineData(null, "Someone")] [InlineData("Someone", null)] diff --git a/src/Components/test/E2ETest/ServerExecutionTests/ServerSideAppTest.cs b/src/Components/test/E2ETest/ServerExecutionTests/ServerSideAppTest.cs index d61063b004..4dba75b10c 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/ServerSideAppTest.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/ServerSideAppTest.cs @@ -138,7 +138,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests } } - [Fact] + [Fact(Skip = "https://github.com/aspnet/AspNetCore/issues/12788")] public void ReconnectUI() { Browser.FindElement(By.LinkText("Counter")).Click(); @@ -155,7 +155,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests .Until(driver => reconnectionDialog.GetCssValue("display") == "none"); } - [Fact] + [Fact(Skip = "https://github.com/aspnet/AspNetCore/issues/12788")] public void RendersContinueAfterReconnect() { Browser.FindElement(By.LinkText("Ticker")).Click(); @@ -184,11 +184,14 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests _ => element.Text != currentValue); } + // Since we've removed stateful prerendering, the name which is passed in + // during prerendering cannot be retained. The first interactive render + // will remove it. [Fact] - public void RendersContinueAfterPrerendering() + public void RendersDoNotPreserveState() { Browser.FindElement(By.LinkText("Greeter")).Click(); - Browser.Equal("Hello Guest", () => Browser.FindElement(By.ClassName("greeting")).Text); + Browser.Equal("Hello", () => Browser.FindElement(By.ClassName("greeting")).Text); } [Fact] diff --git a/src/Components/test/E2ETest/Tests/RoutingTest.cs b/src/Components/test/E2ETest/Tests/RoutingTest.cs index f54506fab3..dd161bc7a3 100644 --- a/src/Components/test/E2ETest/Tests/RoutingTest.cs +++ b/src/Components/test/E2ETest/Tests/RoutingTest.cs @@ -369,9 +369,9 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Tests } [Fact] - public void UsingUriHelperWithoutRouterWorks() + public void UsingNavigationManagerWithoutRouterWorks() { - var app = MountTestComponent(); + var app = MountTestComponent(); var initialUrl = Browser.Url; Browser.Equal(Browser.Url, () => app.FindElement(By.Id("test-info")).Text); @@ -387,7 +387,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Tests [Fact] public void UriHelperCanReadAbsoluteUriIncludingHash() { - var app = MountTestComponent(); + var app = MountTestComponent(); Browser.Equal(Browser.Url, () => app.FindElement(By.Id("test-info")).Text); var uri = "/mytestpath?my=query&another#some/hash?tokens"; diff --git a/src/Components/test/testassets/BasicTestApp/AuthTest/AuthRouter.razor b/src/Components/test/testassets/BasicTestApp/AuthTest/AuthRouter.razor index 73a2b6260d..5ec7bbe529 100644 --- a/src/Components/test/testassets/BasicTestApp/AuthTest/AuthRouter.razor +++ b/src/Components/test/testassets/BasicTestApp/AuthTest/AuthRouter.razor @@ -1,5 +1,5 @@ @using Microsoft.AspNetCore.Components.Routing -@inject IUriHelper UriHelper +@inject NavigationManager NavigationManager @* This router is independent of any other router that may exist within the same project. @@ -10,12 +10,12 @@ - Authorizing... - + Authorizing... +
Sorry, @(context.User.Identity.Name ?? "anonymous"), you're not authorized.
-
+
@@ -27,11 +27,11 @@ { // Start at AuthHome, not at any other component in the same app that happens to // register itself for the route "" - var absoluteUriPath = new Uri(UriHelper.GetAbsoluteUri()).GetLeftPart(UriPartial.Path); - var relativeUri = UriHelper.ToBaseRelativePath(UriHelper.GetBaseUri(), absoluteUriPath); + var absoluteUriPath = new Uri(NavigationManager.Uri).GetLeftPart(UriPartial.Path); + var relativeUri = NavigationManager.ToBaseRelativePath(absoluteUriPath); if (relativeUri == string.Empty) { - UriHelper.NavigateTo("AuthHome"); + NavigationManager.NavigateTo("AuthHome"); } } } diff --git a/src/Components/test/testassets/BasicTestApp/BindCasesComponent.razor b/src/Components/test/testassets/BasicTestApp/BindCasesComponent.razor index 6f132f6f6a..5cdd9087ea 100644 --- a/src/Components/test/testassets/BasicTestApp/BindCasesComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/BindCasesComponent.razor @@ -1,5 +1,7 @@

Bind cases

+@* There are a mix of cases here using bind and bind-value for coverage *@ +

Textbox

Initially blank: @@ -32,7 +34,7 @@

Nullable int: - + @textboxNullableIntValue

@@ -50,7 +52,7 @@

float: - + @textboxFloatValue

@@ -74,7 +76,7 @@

decimal: - + @textboxDecimalValue

@@ -119,7 +121,7 @@

Nullable DateTime: - + @textboxNullableDateTimeValue

@@ -149,7 +151,7 @@

DateTime (format): - + @textboxDateTimeFormatValue

@@ -161,7 +163,7 @@

DateTime (format / invalid value): - + @textboxDateTimeFormatInvalidValue

diff --git a/src/Components/test/testassets/BasicTestApp/CulturePicker.razor b/src/Components/test/testassets/BasicTestApp/CulturePicker.razor index aacf90bb12..6e20528c69 100644 --- a/src/Components/test/testassets/BasicTestApp/CulturePicker.razor +++ b/src/Components/test/testassets/BasicTestApp/CulturePicker.razor @@ -1,4 +1,4 @@ -@inject IUriHelper UriHelper +@inject NavigationManager NavigationManager

Select your language

@code { - void OnSelected(UIChangeEventArgs e) + void OnSelected(ChangeEventArgs e) { // Included fragment to preserve choice of Blazor client or server. - var redirect = new Uri(UriHelper.GetAbsoluteUri()).GetComponents(UriComponents.PathAndQuery | UriComponents.Fragment, UriFormat.UriEscaped); + var redirect = new Uri(NavigationManager.Uri).GetComponents(UriComponents.PathAndQuery | UriComponents.Fragment, UriFormat.UriEscaped); var query = $"?culture={Uri.EscapeDataString((string)e.Value)}&redirectUri={redirect}"; - UriHelper.NavigateTo("/Culture/SetCulture" + query, forceLoad: true); + NavigationManager.NavigateTo("/Culture/SetCulture" + query, forceLoad: true); } } diff --git a/src/Components/test/testassets/BasicTestApp/DuplicateAttributesComponent.razor b/src/Components/test/testassets/BasicTestApp/DuplicateAttributesComponent.razor index 80f8521de7..8d7bcc2e33 100644 --- a/src/Components/test/testassets/BasicTestApp/DuplicateAttributesComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/DuplicateAttributesComponent.razor @@ -2,12 +2,12 @@ + UnmatchedValues="elementValues"/>
diff --git a/src/Components/test/testassets/BasicTestApp/DuplicateAttributesOnElementChildComponent.razor b/src/Components/test/testassets/BasicTestApp/DuplicateAttributesOnElementChildComponent.razor index 27048982f1..d68e5f0619 100644 --- a/src/Components/test/testassets/BasicTestApp/DuplicateAttributesOnElementChildComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/DuplicateAttributesOnElementChildComponent.razor @@ -14,10 +14,10 @@ else } @code { - [Parameter] public string StringAttributeBefore { get; private set; } - [Parameter] public bool BoolAttributeBefore { get; private set; } - [Parameter] public string StringAttributeAfter { get; private set; } - [Parameter] public bool? BoolAttributeAfter { get; private set; } + [Parameter] public string StringAttributeBefore { get; set; } + [Parameter] public bool BoolAttributeBefore { get; set; } + [Parameter] public string StringAttributeAfter { get; set; } + [Parameter] public bool? BoolAttributeAfter { get; set; } - [Parameter(CaptureUnmatchedValues = true)] public Dictionary UnmatchedValues { get; private set; } + [Parameter(CaptureUnmatchedValues = true)] public Dictionary UnmatchedValues { get; set; } } diff --git a/src/Components/test/testassets/BasicTestApp/FormsTest/NotifyPropertyChangedValidationComponent.razor b/src/Components/test/testassets/BasicTestApp/FormsTest/NotifyPropertyChangedValidationComponent.razor index 8cc8859ad9..1fd89a851f 100644 --- a/src/Components/test/testassets/BasicTestApp/FormsTest/NotifyPropertyChangedValidationComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/FormsTest/NotifyPropertyChangedValidationComponent.razor @@ -18,11 +18,11 @@

User name: - +

Accept terms: - +

diff --git a/src/Components/test/testassets/BasicTestApp/FormsTest/SimpleValidationComponent.razor b/src/Components/test/testassets/BasicTestApp/FormsTest/SimpleValidationComponent.razor index 5182f53a49..aa8ccfbe54 100644 --- a/src/Components/test/testassets/BasicTestApp/FormsTest/SimpleValidationComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/FormsTest/SimpleValidationComponent.razor @@ -5,10 +5,10 @@

- User name: + User name:

- Accept terms: + Accept terms:

diff --git a/src/Components/test/testassets/BasicTestApp/GlobalizationBindCases.razor b/src/Components/test/testassets/BasicTestApp/GlobalizationBindCases.razor index bc7a53c4a3..9f4dadf7a9 100644 --- a/src/Components/test/testassets/BasicTestApp/GlobalizationBindCases.razor +++ b/src/Components/test/testassets/BasicTestApp/GlobalizationBindCases.razor @@ -3,6 +3,8 @@

Globalization Bind Cases

Culture is: @System.Globalization.CultureInfo.CurrentCulture.Name

+@* There are a mix of cases here using bind and bind-value for coverage *@ +

Numbers using bind in text fields

@@ -10,7 +12,7 @@ @inputTypeTextInt
- decimal: + decimal: @inputTypeTextDecimal
@@ -22,7 +24,7 @@ @inputTypeTextDateTime
- DateTimeOffset: + DateTimeOffset: @inputTypeTextDateTimeOffset
@@ -34,7 +36,7 @@ @inputTypeNumberInt
- decimal: + decimal: @inputTypeNumberDecimal
@@ -47,7 +49,7 @@ @inputTypeDateDateTime
- DateTimeOffset: + DateTimeOffset: @inputTypeDateDateTimeOffset
diff --git a/src/Components/test/testassets/BasicTestApp/Index.razor b/src/Components/test/testassets/BasicTestApp/Index.razor index df71e0cb93..fe8608105c 100644 --- a/src/Components/test/testassets/BasicTestApp/Index.razor +++ b/src/Components/test/testassets/BasicTestApp/Index.razor @@ -57,9 +57,8 @@ + - - diff --git a/src/Components/test/testassets/BasicTestApp/PrerenderedRedirection.razor b/src/Components/test/testassets/BasicTestApp/PrerenderedRedirection.razor index da489e75c5..78bd99eabd 100644 --- a/src/Components/test/testassets/BasicTestApp/PrerenderedRedirection.razor +++ b/src/Components/test/testassets/BasicTestApp/PrerenderedRedirection.razor @@ -1,5 +1,5 @@ @page "/prerendered-redirection" -@inject IUriHelper UriHelper +@inject NavigationManager NavigationManager @{ throw new InvalidOperationException("The rendering logic should never be executed"); @@ -8,9 +8,9 @@ @code { protected override Task OnInitializedAsync() { - var uri = UriHelper.GetAbsoluteUri(); + var uri = NavigationManager.Uri; var destination = uri.Substring(uri.IndexOf("?destination=") + 13); - UriHelper.NavigateTo(destination); + NavigationManager.NavigateTo(destination); return Task.CompletedTask; } } diff --git a/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor b/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor index 1b4678dba4..c5a5626382 100644 --- a/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor +++ b/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor @@ -1,5 +1,5 @@ @using Microsoft.AspNetCore.Components.Routing -@inject Microsoft.AspNetCore.Components.IUriHelper uriHelper +@inject NavigationManager NavigationManager