From 3c6c5372de67a189dcf75377a6c249039a53cd2d Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sat, 27 Nov 2021 20:57:03 +0100 Subject: [PATCH 001/278] Support for Raspberry Pi Zero 2 W --- RaspberryDebugger/DebugHelper.cs | 3 ++- RaspberryDebugger/source.extension.vsixmanifest | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RaspberryDebugger/DebugHelper.cs b/RaspberryDebugger/DebugHelper.cs index f2dbb78..4afd667 100644 --- a/RaspberryDebugger/DebugHelper.cs +++ b/RaspberryDebugger/DebugHelper.cs @@ -542,7 +542,8 @@ public static async Task InitializeConnectionAsync(ConnectionInfo co // .NET Core only supports Raspberry models 3 and 4. if (!connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi 3 Model") && - !connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi 4 Model")) + !connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi 4 Model") && + !connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi Zero 2")) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); diff --git a/RaspberryDebugger/source.extension.vsixmanifest b/RaspberryDebugger/source.extension.vsixmanifest index 0496f3e..7d90785 100644 --- a/RaspberryDebugger/source.extension.vsixmanifest +++ b/RaspberryDebugger/source.extension.vsixmanifest @@ -1,12 +1,12 @@ - + Raspberry Debugger The Raspberry Debugger extension provides an easy way to debug your Raspberry .NET Core and .NET 5 applications on a real Raspberry Pi using Visual Studio. license.txt https://github.com/nforgeio/RaspberryDebugger - https://github.com/nforgeio/RaspberryDebugger/releases/tag/v1.6 + https://github.com/nforgeio/RaspberryDebugger/releases/tag/v1.7 packageicon.png raspberry pi debugger From f51a0f35da2f4ec8006752bf866d8dbce3b50c88 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Wed, 1 Dec 2021 17:48:03 +0100 Subject: [PATCH 002/278] Extend error message for Zero 2 --- RaspberryDebugger/DebugHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RaspberryDebugger/DebugHelper.cs b/RaspberryDebugger/DebugHelper.cs index 4afd667..fc821bf 100644 --- a/RaspberryDebugger/DebugHelper.cs +++ b/RaspberryDebugger/DebugHelper.cs @@ -548,7 +548,8 @@ public static async Task InitializeConnectionAsync(ConnectionInfo co await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); MessageBoxEx.Show( - $"Your [{connection.PiStatus.RaspberryModel}] is not supported. .NET Core requires a Raspberry Model 3 or 4.", + $"Your [{connection.PiStatus.RaspberryModel}] is not supported." + + $" .NET Core requires a Raspberry Model 3 or 4 or Pi Zero 2.", $"Raspberry Not Supported", MessageBoxButtons.OK, MessageBoxIcon.Error); From 1fa13148521670d8cc57a2643fbb6b81e8b837eb Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Wed, 1 Dec 2021 20:39:15 +0100 Subject: [PATCH 003/278] New SDK catalog with .NET 6.0 - no Studio install uri for the first --- RaspberryDebugger/sdk-catalog.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/RaspberryDebugger/sdk-catalog.json b/RaspberryDebugger/sdk-catalog.json index a1ced87..409bece 100644 --- a/RaspberryDebugger/sdk-catalog.json +++ b/RaspberryDebugger/sdk-catalog.json @@ -437,6 +437,20 @@ "Architecture": "ARM64", "Link": "https://download.visualstudio.microsoft.com/download/pr/c1f15b51-5e8c-4e6c-a803-241790159af3/b5cbcc59f67089d760e0ed4a714c47ed/dotnet-sdk-5.0.202-linux-arm64.tar.gz", "SHA512": "26ec125a0637e71acad20386474df89a101e9ae948921b5de0cd343f4bc0e84b4e7b2318e15978723eb3b9d321e89b790c3f0424a43c29b0015fc6f2b9e3e9d9" + }, + { + "Name": "6.0.100", + "Version": "6.0.0", + "Architecture": "ARM32", + "Link": "https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-6.0.100-linux-arm32-binaries", + "SHA512": "" + }, + { + "Name": "6.0.100", + "Version": "6.0.0", + "Architecture": "ARM64", + "Link": "https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-6.0.100-linux-arm64-binaries", + "SHA512": "" } ] } From b5b18fd261fd3e1bc565b3fb01b7fa94cae293b1 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Wed, 1 Dec 2021 20:39:34 +0100 Subject: [PATCH 004/278] Remove empty spaces --- RaspberryDebugger/DebugHelper.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/RaspberryDebugger/DebugHelper.cs b/RaspberryDebugger/DebugHelper.cs index fc821bf..846208f 100644 --- a/RaspberryDebugger/DebugHelper.cs +++ b/RaspberryDebugger/DebugHelper.cs @@ -540,7 +540,6 @@ public static async Task InitializeConnectionAsync(ConnectionInfo co var connection = await Connection.ConnectAsync(connectionInfo, projectSettings: projectSettings); // .NET Core only supports Raspberry models 3 and 4. - if (!connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi 3 Model") && !connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi 4 Model") && !connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi Zero 2")) From 1a6b14863fc15b6eb95039044a2fd79357df71d9 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Wed, 1 Dec 2021 20:39:53 +0100 Subject: [PATCH 005/278] Update to new Vs2022 SDK --- RaspberryDebugger/RaspberryDebugger.csproj | 20 +++++++++++--------- SdkCatalogChecker/SdkCatalogChecker.csproj | 6 +++--- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/RaspberryDebugger/RaspberryDebugger.csproj b/RaspberryDebugger/RaspberryDebugger.csproj index 7086266..b0dc015 100644 --- a/RaspberryDebugger/RaspberryDebugger.csproj +++ b/RaspberryDebugger/RaspberryDebugger.csproj @@ -135,30 +135,32 @@ 15.0.6142705 - 8.0.50728 + 17.0.31902.203 + + + compile; build; native; contentfiles; analyzers; buildtransitive - - 16.7.30329.38 + 17.0.31902.203 16.3.23 - + runtime; build; native; contentfiles; analyzers; buildtransitive all - 2.12.0 + 2.18.2 - 2.12.0 + 2.18.2 - 2.12.0 + 2.18.2 - 12.0.3 + 13.0.1 2.9.1 @@ -167,7 +169,7 @@ 2020.0.1 - 2.6.121 + 2.9.85 diff --git a/SdkCatalogChecker/SdkCatalogChecker.csproj b/SdkCatalogChecker/SdkCatalogChecker.csproj index 9d6ceb8..e9ef528 100644 --- a/SdkCatalogChecker/SdkCatalogChecker.csproj +++ b/SdkCatalogChecker/SdkCatalogChecker.csproj @@ -16,9 +16,9 @@ - - - + + + From 11fcb390be67c00d8ac1e65bef061fd665cfe33b Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Wed, 1 Dec 2021 21:25:33 +0100 Subject: [PATCH 006/278] Set new assembly version --- RaspberryDebugger/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RaspberryDebugger/Properties/AssemblyInfo.cs b/RaspberryDebugger/Properties/AssemblyInfo.cs index 55e260a..288f5e6 100644 --- a/RaspberryDebugger/Properties/AssemblyInfo.cs +++ b/RaspberryDebugger/Properties/AssemblyInfo.cs @@ -46,5 +46,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.6.0.0")] -[assembly: AssemblyFileVersion("1.6.0.0")] +[assembly: AssemblyVersion("1.8.0.0")] +[assembly: AssemblyFileVersion("1.8.0.0")] From 952706a2ee3a07abcf2e8ef332aff1fb0ead2a76 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Wed, 1 Dec 2021 21:26:07 +0100 Subject: [PATCH 007/278] Include only .NET 6 in SDK catalog --- RaspberryDebugger/sdk-catalog.json | 442 +---------------------------- 1 file changed, 2 insertions(+), 440 deletions(-) diff --git a/RaspberryDebugger/sdk-catalog.json b/RaspberryDebugger/sdk-catalog.json index 409bece..492fd7b 100644 --- a/RaspberryDebugger/sdk-catalog.json +++ b/RaspberryDebugger/sdk-catalog.json @@ -1,456 +1,18 @@ { "Items": [ - { - "Name": "3.1.100", - "Version": "3.1.0", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/67766a96-eb8c-4cd2-bca4-ea63d2cc115c/7bf13840aa2ed88793b7315d5e0d74e6/dotnet-sdk-3.1.100-linux-arm.tar.gz", - "SHA512": "9f4848b4bca649cc6131032de4b0115549a3dafb6bf90250930794aa69f7939bba82cedda67578348a83b50b7057e452846a400589bb4e9d4a2d1b33ce57c71c" - }, - { - "Name": "3.1.100", - "Version": "3.1.0", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/5a4c8f96-1c73-401c-a6de-8e100403188a/0ce6ab39747e2508366d498f9c0a0669/dotnet-sdk-3.1.100-linux-arm64.tar.gz", - "SHA512": "93634c555698ca5c3392332a93551b1548fa103328401c5c25e8955f085124b887b73736b70a139fc8eb8d622e47fcfc0aa25210b73a8f851906b32eaa8a9887" - }, - { - "Name": "3.1.101", - "Version": "3.1.1", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/d52fa156-1555-41d5-a5eb-234305fbd470/173cddb039d613c8f007c9f74371f8bb/dotnet-sdk-3.1.101-linux-arm.tar.gz", - "SHA512": "bd68786e16d59b18096658ccab2a662f35cd047065a6c87a9c6790a893a580a6aa81b1338360087e58d5b5e5fdca08269936281e41a7a7e7051667efb738a613" - }, - { - "Name": "3.1.101", - "Version": "3.1.1", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/cf54dd72-eab1-4f5c-ac1e-55e2a9006739/d66fc7e2d4ee6c709834dd31db23b743/dotnet-sdk-3.1.101-linux-arm64.tar.gz", - "SHA512": "03ea4cc342834a80f29b3b59ea1d7462e1814311dc6597bf2333359061b9b24f5ce98ed6ebf8d7ca05d42db31baba8ed8d4dec30a576fd818b3c0041c86d2937" - }, - { - "Name": "3.1.102", - "Version": "3.1.2", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/349f13f0-400e-476c-ba10-fe284b35b932/44a5863469051c5cf103129f1423ddb8/dotnet-sdk-3.1.102-linux-arm.tar.gz", - "SHA512": "b279185fd245c3a254f4bbdd4f743d4309fcf8e2d3a1eb42df2f464e40df9954257209a666287ad3d924f863ca09d0cd8638d394da9f990477a2fc6d71198550" - }, - { - "Name": "3.1.102", - "Version": "3.1.2", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/2ea7ea69-6110-4c39-a07c-bd4df663e49b/5d60f17a167a5696e63904f7a586d072/dotnet-sdk-3.1.102-linux-arm64.tar.gz", - "SHA512": "7ad682935158599aeff1f04228df65ce99aa7d34fbe096422a55d6b0c6b38a7de4b9d0af1b667f63728b051d355f0c69526ffa90bb4c4d8ded53fb4ba63233c9" - }, - { - "Name": "3.1.104", - "Version": "3.1.4", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/74e61bc8-e8b1-4728-9c56-7d978010e4dd/a3c8533ed97dcfea09fe64e6969cd60c/dotnet-sdk-3.1.104-linux-arm.tar.gz", - "SHA512": "18120f948651558f8b075017d42f075b97454c386ec9c7985f68169755a9b059110b5b52edebe8763ab0178ffd1bc453a70d9231d61213170b386ff899fc6463" - }, - { - "Name": "3.1.104", - "Version": "3.1.4", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/7148dc66-dc70-4d6f-ae3d-c65aa8443259/734885b4dafa4097c0b264ca20be7e26/dotnet-sdk-3.1.104-linux-arm64.tar.gz", - "SHA512": "a8bd5535af395dff4130d47e288837bda036b73a074f84755d1224d2c703304bcd36593dda5eb3f139a051060030a100516b5e8a2fd2fcdbb192eb04c1a341a8" - }, - { - "Name": "3.1.105", - "Version": "3.1.5", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/52f61afc-0897-4bc7-abf4-f936f9c6f637/8fca0abb8c378a32d966c1b762524c0d/dotnet-sdk-3.1.105-linux-arm.tar.gz", - "SHA512": "a5e7531445c5efc5d647a6dca3725bc13b92df19aa87b63163b01518de5eb29e22f02c124807f29edc5f07ab31c56b675a6c34a1eae50e090c4ddf930fb4bd9f" - }, - { - "Name": "3.1.105", - "Version": "3.1.5", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/a2de5fc2-1c17-4ea2-bf3f-77c404e9263e/f9c79b6067afc819656ba9f6e6a4ed73/dotnet-sdk-3.1.105-linux-arm64.tar.gz", - "SHA512": "10c13928f8f3b4a7bd0c782d3579e417b526f3497cb59deeef4ae9e7fae3228df2ecddfeb1c66f9c2d329204a62fa0c4bb759e2954a0e26ac00419b3efd6017e" - }, - { - "Name": "3.1.106", - "Version": "3.1.6", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/ad10d24d-9823-42fc-bf2a-1d598d8999c6/80f944ded4c6d3fd73cd6a00f6ae660f/dotnet-sdk-3.1.106-linux-arm.tar.gz", - "SHA512": "05830f3b9924706d40b9a310e5dc334029f7be080b0e69aaef17e470b9845e1cc708e52652537c2ead98ca4209fda4d53a0cd5200c6b7727ce42f808c54d50f6" - }, - { - "Name": "3.1.106", - "Version": "3.1.6", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/026fec12-345b-4c61-8731-1c0184594fc3/1738a6c43d2739dc6c2a9ec5caf0c41f/dotnet-sdk-3.1.106-linux-arm64.tar.gz", - "SHA512": "aa2cb7ce94a013b1204dd9523e4fa0051dd43545b5a881647e44f1cf998dd1aafc7e1c709f603306c25bcf064ffbd8295cb17e17fb974e9dfa469e2ecf991f92" - }, - { - "Name": "3.1.107", - "Version": "3.1.7", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/41775681-e8a1-4cdd-b1d2-967c25d2b5d6/7b968b58d157f7159ec4b6466c76ff02/dotnet-sdk-3.1.107-linux-arm.tar.gz", - "SHA512": "e36f8192127c6d52c34fe15dabc23d4b9cb6e48d88a44355f687d974b13fe4a56dcb142fcacd9d959e67469cc31455b10b1fad8a5fdebbfc3f6cebc99d63dc5d" - }, - { - "Name": "3.1.107", - "Version": "3.1.7", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/6e1897f2-8de1-41f2-828e-f2651d6448f9/c25e59f180ffb6a31d5e3f0a163391a0/dotnet-sdk-3.1.107-linux-arm64.tar.gz", - "SHA512": "80f980455452b3d63c55585b8009a5475331202dc60c2d8b6990bf4ef367a652e07dd29d1e2d879042f65f90ecebadd4178042f3446186dfbdf530c8e39237a5" - }, - { - "Name": "3.1.108", - "Version": "3.1.8", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/52fb935e-f2b3-42c3-9695-d53e7c693baa/6c38b8ac3bc97ea2f09a03a60cdacdc5/dotnet-sdk-3.1.108-linux-arm.tar.gz", - "SHA512": "b2f074cb6820f8859c61e04a355087828028f5c11912e0d1bcb0f93c5f3597eb60774542b0f3f3955f81fb459784036f2d4a9bcfcc0ba06965d671ed004e52ab" - }, - { - "Name": "3.1.108", - "Version": "3.1.8", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/572d9a06-dd1e-4349-a443-702b5382605c/dbe9647eceb84dea786af91cd11a9e3e/dotnet-sdk-3.1.108-linux-arm64.tar.gz", - "SHA512": "b83513ffcfcddaca679edbd731ec4dbe8d653c46e626f0e1dcb700559a16effe0859d8c9a9b4a5e79e3de23521e0f37f8794e493075018c0fd7b8df7bc889d54" - }, - { - "Name": "3.1.109", - "Version": "3.1.9", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/d9a0b670-88f8-44ac-a6b1-9020c783c518/8bbec2b438275789bc1dbc95b8f89adf/dotnet-sdk-3.1.109-linux-arm.tar.gz", - "SHA512": "035b00adc3aecc365017db44771a30300b0858c6eb480f7358fa5c9b931a1d7d2a8d3e44d88a3e7ef59efbdf1cfab1c9dbd52e8c31694a1fa9419805134e2b52" - }, - { - "Name": "3.1.109", - "Version": "3.1.9", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/27fdcb48-766c-4f0e-8032-9f2afa40d3af/f2c6dac373046fa2d70e9a41b4a7dadf/dotnet-sdk-3.1.109-linux-arm64.tar.gz", - "SHA512": "c3675edda58a8dc8ae9132fb1c5cea0b2a764d5c93ce2f94de0109676d4ef64f21f886d4354a10c441c522a2a8f13493c49501d62fc2c9e7a2f480eaff93cf56" - }, - { - "Name": "3.1.110", - "Version": "3.1.10", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/b4b0a624-a046-4ad5-a19b-82dd26c1ccdb/28af71681b300f3a8b7aa0841cce45cc/dotnet-sdk-3.1.110-linux-arm.tar.gz", - "SHA512": "af345605f4f795d90ca469b70ded4a62d8d3536cc1cf8856a856b576a438c1faff9f8b652c4657d7ca211306266d78f80da6ea1286e00812314bd742786d72d4" - }, - { - "Name": "3.1.110", - "Version": "3.1.10", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/af40aa01-90f9-47cb-8ed6-a186de459e6c/0cb13fba48e467e7788b1ccad83a5358/dotnet-sdk-3.1.110-linux-arm64.tar.gz", - "SHA512": "ad20fb6d23ce9967cbd88390510c8207172854ea9ef5a3eae78cfd04dd73b6e312aaaa2f999ce81542c15021b4c313238e9ec01c1b7fb5f39b086848d39a244f" - }, - { - "Name": "3.1.200", - "Version": "3.1.2", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/21a124fd-5bb7-403f-bdd2-489f9d21d695/b58fa90d19a5a5124d21dea94422868c/dotnet-sdk-3.1.200-linux-arm.tar.gz", - "SHA512": "5e8a5e5899cd3c635a4278c6c57b9f9c75ffee81734ccf85feaacf1c3799cc135fd24d401abb7e8783db40e2072769a1d2a012f3317ed39cc019d69712243266" - }, - { - "Name": "3.1.200", - "Version": "3.1.2", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/781cb53b-046c-45fb-b18e-97ad65ff61a0/5c6ce7f4e031dad7cca0fdd5bcf4335b/dotnet-sdk-3.1.200-linux-arm64.tar.gz", - "SHA512": "66ec47514d5bd5739db54c4469250e637f99e5792bca758783eb46722cab3a09920b02f7fe3873b1c430cd3ddea85075ce5e62e6f922a9be0c5f367ddf475b64" - }, - { - "Name": "3.1.201", - "Version": "3.1.3", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/ccbcbf70-9911-40b1-a8cf-e018a13e720e/03c0621c6510f9c6f4cca6951f2cc1a4/dotnet-sdk-3.1.201-linux-arm.tar.gz", - "SHA512": "f37d0e55c9f593c6951bea5a6bb1ea3194486956efe08a2a0f266b419d912cdcbf4ac279358976f0bfa1fe560c333ca5d5437f8e8c718bb5963991e4395e0cd7" - }, - { - "Name": "3.1.201", - "Version": "3.1.3", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/98a2e556-bedd-46c8-b3fa-96a9f1eb9556/09f60d50e3cbba0aa16d48ceec9dcb0b/dotnet-sdk-3.1.201-linux-arm64.tar.gz", - "SHA512": "2f4f6b7ae55802b0beaf5d62bcb64f23ce132c9e08d8ce0f0af8d9b0b1b2c2629b1d4e805e83f831575c9968a86d1495dfa5292d2592af0cd1ae4a385daf42e7" - }, - { - "Name": "3.1.202", - "Version": "3.1.4", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/647e322c-e198-4bff-ba2a-a1a5b8477033/87b7b0af543dba7048a57ee2ab5a31ee/dotnet-sdk-3.1.202-linux-arm.tar.gz", - "SHA512": "6a978081468458fb08f405e11d39067f2dab3ec1b9ed9d033f7e74ddf8e700eb15c9c3d86d8fba5dbcf44f03b06c7f4a5d84b531e7d57a75d7a4f4cdc7f98992" - }, - { - "Name": "3.1.202", - "Version": "3.1.4", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/15434752-2803-4722-b406-9a62d3e089d5/159bd7713f8a7ff82d7b2f756ae87f4f/dotnet-sdk-3.1.202-linux-arm64.tar.gz", - "SHA512": "b570a423522de777d05de67410cea7d6d54461b7e2b82a18f4ca21093897836447f215b2737df909ee581508fbd1a61993f3ea1d9856b9a883caed3f7086f0a6" - }, - { - "Name": "3.1.300", - "Version": "3.1.4", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/f2e1cb4a-0c70-49b6-871c-ebdea5ebf09d/acb1ea0c0dbaface9e19796083fe1a6b/dotnet-sdk-3.1.300-linux-arm.tar.gz", - "SHA512": "510de2931522633e5a35cfbaebac255704bb2a282e4980e7597c924531564b1a2f769cf67b3d1f196442ceca3d0d9a53e0a6dcb12adc9b0c6c1500742e7b1ee5" - }, - { - "Name": "3.1.300", - "Version": "3.1.4", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/e5e70860-a6d4-48cf-b0d1-eeba32657d80/2da3c605aaa65c7e4ac2ad0507a2e429/dotnet-sdk-3.1.300-linux-arm64.tar.gz", - "SHA512": "b1d806dd719e61ae27297515d26e6ef12e615da131db4fd1c29b2acc4d6a68a6b0e4ce94ead4f8f737c203328d596422068c78495eba331a5759f595ed9ed149" - }, - { - "Name": "3.1.301", - "Version": "3.1.5", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/dbf4ea18-70bf-4b0f-ae9c-65c8c88bcadd/115e84fb95170ddeeaf9bdb9222c964d/dotnet-sdk-3.1.301-linux-arm.tar.gz", - "SHA512": "732364b93caaa94ee96dfe24ed42e63ae59862afd0691760557c22019c67139f92db28cc5e730618a630c45a96b2468676867345e54ae93004567b470edf5f47" - }, - { - "Name": "3.1.301", - "Version": "3.1.5", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/fe5c0663-3ed1-4a93-95e1-fd068b89215b/14d1caad8fd2859d5f3514745a9bf6b3/dotnet-sdk-3.1.301-linux-arm64.tar.gz", - "SHA512": "834dc5829730ea7abcf5adfca5557458d5de534597933dbdcec99abbd7eff00f3e1d0084b7f3572de80b4d333dee6d32cffa2d1ead022faad3957c95e5a920a0" - }, - { - "Name": "3.1.302", - "Version": "3.1.6", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/56691c4c-341a-4bca-9869-409803d23cf8/d872d7a0c27a6c5e9b812e889de89956/dotnet-sdk-3.1.302-linux-arm.tar.gz", - "SHA512": "eccb9ba89eb745282cb749e505fcf2209e3b56f41d5ddbb383dbeae04eb58a9b367560d743bc78600c8adab4abb93bbabccaae33613b9d3fec2b150fca5dffc4" - }, - { - "Name": "3.1.302", - "Version": "3.1.6", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/5ee48114-19bf-4a28-89b6-37cab15ec3f2/f5d1f54ca93ceb8be7d8e37029c8e0f2/dotnet-sdk-3.1.302-linux-arm64.tar.gz", - "SHA512": "c2bebb673f217d9e7afb80b2b032c6f850d93e2419b5c0f9aa22676114a5c4fa91550a89b46757012fb9535405c1bb7902f0927f093769d4d055a8de84cfc5d8" - }, - { - "Name": "3.1.401", - "Version": "3.1.7", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/a92a6358-52c3-472b-ad6d-d2d80abdcef4/37a7551a4e2c9e455caed5ef777a8983/dotnet-sdk-3.1.401-linux-arm.tar.gz", - "SHA512": "2c84d8442fd872aafbdff7a1f131c4bacfb75ca69426d2aa2b9f3cf05a8e3a365923c14f7eb732113dd7a9fdc674c955e70817fb355aaabca25b79ed33356a15" - }, - { - "Name": "3.1.401", - "Version": "3.1.7", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/8c39349a-23d0-46b0-8206-8b573a404709/b42fd441c1911acc90aaddaa58d7103f/dotnet-sdk-3.1.401-linux-arm64.tar.gz", - "SHA512": "ab9afd226b920dce24bcd372cccb1965163829c26d1f11f1df3d8f9be5afb1d87f26b23e5fbeb58cf4ddaa040b8228fa00a786c379a454b9d99c2964197ab4cd" - }, - { - "Name": "3.1.402", - "Version": "3.1.8", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/8f0dffe3-18f0-4d32-beb0-dbcb9a0d91a1/abe9a34e3f8916478f0bd80402b01b38/dotnet-sdk-3.1.402-linux-arm.tar.gz", - "SHA512": "b4ada8bff572d39262c952506661d6f328d22dd963903ed81a1c7646e1dfbd54e8f6897e0ff189bfae29f69b76b3ddecc17001b5df1ddd9e8da4cf9eebdd22d7" - }, - { - "Name": "3.1.402", - "Version": "3.1.8", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/186257d9-bca2-4dda-be74-006205965ec9/b2b63d45482701473d9731abc41ecc2a/dotnet-sdk-3.1.402-linux-arm64.tar.gz", - "SHA512": "1704fb88a04cb5a00de5a22da4ad68237a7cce9aeaac608166f85082a4bfc86ba360b1d81c5ceb40c906cf7407e365aed73fa68a735d4ba90b334ab01a3a8455" - }, - { - "Name": "3.1.403", - "Version": "3.1.9", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/8a2da583-cac8-4490-bcca-2a3667d51142/6a0f7fb4b678904cdb79f3cd4d4767d5/dotnet-sdk-3.1.403-linux-arm.tar.gz", - "SHA512": "9f1293ef8f3abf5c6a8da7f963de4408d5aed6a9ee29a2c84655871574041980d8a4bb5b608ea129b1bd392890dc577d11c138bd54ce91745cb4960be697cb4e" - }, - { - "Name": "3.1.403", - "Version": "3.1.9", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/7a027d45-b442-4cc5-91e5-e5ea210ffc75/68c891aaae18468a25803ff7c105cf18/dotnet-sdk-3.1.403-linux-arm64.tar.gz", - "SHA512": "c0f5070deca932d67a80b06268a69146ca403f1657e49d509513b5fe15cb5224cdfb5bec9cd2e63db6c83a48f3cb64d23d8cc30fcd98c620d9936544dbb6ce0b" - }, - { - "Name": "3.1.404", - "Version": "3.1.10", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/2ebe1f4b-4423-4694-8f5b-57f22a315d66/4bceeffda88fc6f19fad7dfb2cd30487/dotnet-sdk-3.1.404-linux-arm.tar.gz", - "SHA512": "0aaed20c96c97fd51b8e0f525caf75ab95c5a51de561e76dc89dad5d3c18755c0c773b51be6f1f5b07dda02d2bb426c5b9c45bb5dd59914beb90199f41e5c59e" - }, - { - "Name": "3.1.404", - "Version": "3.1.10", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/de47cbe2-f75f-44c5-8250-7960a36d6591/76cfdbfb7bf17cce27378a9fddd969a6/dotnet-sdk-3.1.404-linux-arm64.tar.gz", - "SHA512": "b22b60a06f4a1a409eb8eb8f5aec26454ff393bef9677294f0a9d61367caeb2a55fff1e4e282af5250365d27cee3b5cf7c31db8ff1c224f1c7225263b0e4a9aa" - }, - { - "Name": "3.1.405", - "Version": "3.1.11", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/2178c8a1-ad48-4e51-9ddd-4e3ab64d1f0e/68746abefadf62be43ca525653c915a1/dotnet-sdk-3.1.405-linux-arm.tar.gz", - "SHA512": "110f595a835ebc5c974fcb24e5ed7b81461288ddcf6b3a0dcead3f22b6995698dab767304e0bd98d3c450a297db8f04b185bbaa0d310fc9f1d3f9c3157fdac06" - }, - { - "Name": "3.1.405", - "Version": "3.1.11", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/ebb398e7-06d1-48f9-94e7-ddae049b704f/6bb78627f0337b980ece2a3181963fbd/dotnet-sdk-3.1.405-linux-arm64.tar.gz", - "SHA512": "e720b7c6497da52ce4a927b1a29df5c180fbf5b4f800185de61a31092c0bfa18a78bb9c2fee744fabc78214c5be6e9277f3dc14ae1426b55274f9726997fc733" - }, - { - "Name": "3.1.406", - "Version": "3.1.12", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/9863a55b-2577-49d3-9888-ab853a4201cb/3110704f3265713f8d82aab157a23ed2/dotnet-sdk-3.1.406-linux-arm.tar.gz", - "SHA512": "b978d8f8dd6af16abb16f42b8c36c356d18e6e88309967ae9faa9a8009245e4a94183a4c2a6acad48ba342a7429de8055e4e32aca79f0c1d2f2c3bca1a318530" - }, - { - "Name": "3.1.406", - "Version": "3.1.12", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/fc9051ee-4071-4808-9e71-82d69328ab47/32ae2b7177d082fc52d89774e4f127fa/dotnet-sdk-3.1.406-linux-arm64.tar.gz", - "SHA512": "e460ac35329e572dbf4005254129b9799c897f19261d01ea77a0aa196b9e0fecf804996b1157cea92731e30e08b5827ccb0c2d280ea9ab2b04b46492ed5e12a3" - }, - { - "Name": "3.1.407", - "Version": "3.1.13", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/12a5b3f4-4960-4e1a-a82c-c782138807b2/62f01a300ac1007d2b62612fa1aa3f3d/dotnet-sdk-3.1.407-linux-arm.tar.gz", - "SHA512": "a60a272673842470ec3b32addd2ce2c3528b36315ba9c0b4237847b7e0b34914cb56b4b2f62410de2ccf231656327a7a3bbe2afa5c14672f1808df5cb4f9b8d8" - }, - { - "Name": "3.1.407", - "Version": "3.1.13", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/94a88a85-be1e-464a-8cdd-6eb23d8559a1/b715559dd50aec6097db76ca50e2154b/dotnet-sdk-3.1.407-linux-arm64.tar.gz", - "SHA512": "4ae1c92bd4cdf0ea459591e87aea0e2f560df9d2c406e68dcf6667576ebf7761817683b565d42aeca74a6f03cdb8342d3fd1f9c81a4657a78043a5f765dc549c" - }, - { - "Unusable": true, - "Name": "5.0.100", - "Version": "5.0.0", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/e8912d3b-483b-4d6f-bd3a-3066b3194313/20f2261fe4e16e55df4bbe03c65a7648/dotnet-sdk-5.0.100-linux-arm.tar.gz", - "SHA512": "c61a0910e34a5d7bffee46835242c24a153bf346e0ef1b048a47d12e60408aa722cec0a08fa1461ab615a4f0d09ef470c479d393f93929837f18699c745c1314" - }, - { - "Unusable": true, - "Name": "5.0.100", - "Version": "5.0.0", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/27840e8b-d61c-472d-8e11-c16784d40091/ae9780ccda4499405cf6f0924f6f036a/dotnet-sdk-5.0.100-linux-arm64.tar.gz", - "SHA512": "5fceac0a9468097d66af25516da597eb4836b294ed1647ba272ade5c8faea2ed977a95d9ce720c44d71607fa3a0cf9de55afe0e66c0c89ab1cc6736945978204" - }, - { - "Unusable": true, - "Name": "5.0.101", - "Version": "5.0.1", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/567a64a8-810b-4c3f-85e3-bc9f9e06311b/02664afe4f3992a4d558ed066d906745/dotnet-sdk-5.0.101-linux-arm.tar.gz", - "SHA512": "2b03ae553b59ad39aa22b5abb5b208318b15284889a86abdc3096e382853c28b0438e2922037f9bc974c85991320175ba48d7a6963bb112651d7027692bb5cde" - }, - { - "Unusable": true, - "Name": "5.0.101", - "Version": "5.0.1", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/2add7523-39ec-413a-b8a7-24361cc4e599/30489ebd7ebcc723da48a64669860fd0/dotnet-sdk-5.0.101-linux-arm64.tar.gz", - "SHA512": "b26beafd7649fd9081a914909aca6302e8629f24d97ac5d7ac4c7aace007aff93e920510f3fa5a871c71ad42f2e38241115339ccf01d2399b2c9000b53607a86" - }, - { - "Name": "5.0.102", - "Version": "5.0.2", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/726e260e-ce94-46c3-a169-57b2ebf5433d/5fb2a00b04b3509a0a6db63e302523a8/dotnet-sdk-5.0.102-linux-arm.tar.gz", - "SHA512": "23610a4193d8116109aaeebefa0bf023808f86d3e0a8ba52b89aa5b4b869385a5e57fc8458ff12f9ea8f359f6978498d47fd80d073ab79b2a7dfbc103b8ff903" - }, - { - "Name": "5.0.102", - "Version": "5.0.2", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/4fdd4708-8990-42db-998d-36ccfa593070/d67cb90c382e4eedbca8af1aebcbbe19/dotnet-sdk-5.0.102-linux-arm64.tar.gz", - "SHA512": "031272b86f435f88963b560c14342635d892345ac9a35d59ecaf6e425de8aab15ca5c3d0685c79027364e7a323927ba90568fe7ed8610f52ee5f961aef9fcf72" - }, - { - "Name": "5.0.103", - "Version": "5.0.3", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/cd11b0d1-8d79-493f-a702-3ecbadb040aa/d24855458a90944d251dd4c68041d0b7/dotnet-sdk-5.0.103-linux-arm.tar.gz", - "SHA512": "ad07c5921b79d3ea3fdd7af2d26f118dcf74aa8ab6e147e0cdfeef94e656606777df8832135d52d24f22b5f1ebe75f51ee78462aeaa262b675e89ad04d55c0bf" - }, - { - "Name": "5.0.103", - "Version": "5.0.3", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/5c2e5668-d7f9-4705-acb0-04ceeda6dadf/4eca3d1ffd92cb2b5f9152155a5529b4/dotnet-sdk-5.0.103-linux-arm64.tar.gz", - "SHA512": "179bcc4d280011a0d23f8f0d78349a372fe495e9c5aff106882c08025367ce49afe897f65c033c3f046bae2b1e49f7f6526edce273ab21e77812bbb8317d08a8" - }, - { - "Name": "5.0.200", - "Version": "5.0.3", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/8f09af48-e88e-4b91-bae1-08a5c9183559/e10eefacab56a4f4c1165d4e26a5f0f9/dotnet-sdk-5.0.200-linux-arm.tar.gz", - "SHA512": "01544d37e118dbe2bb38c00947b11c64756bd69809c7b2a0c615df6d7d31d432b792c84d39709fb364f73c51a16349829e7331ccfb9307e569c39150e0b802c9" - }, - { - "Name": "5.0.200", - "Version": "5.0.3", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/0a823585-f6ac-4b4f-994d-c073d16267c3/af8c9fcdf76492048b60abfe0b311e2e/dotnet-sdk-5.0.200-linux-arm64.tar.gz", - "SHA512": "684b2f3bc59f090c5be14b993480c2600d7ac6703fb6af098f371f6404df7298e0be283ceef5cb28383ba334e3828bb92825269bf3a6ad4b8b37c2e0b15be3bf" - }, - { - "Name": "5.0.104", - "Version": "5.0.4", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/2623e28a-df3b-44ec-9678-af3f1dbe1caa/097423ca07af1ac3e6e6a4af758ca340/dotnet-sdk-5.0.104-linux-arm.tar.gz", - "SHA512": "56405b06f95fb493e7dd5df40f4a7b0dcdd7019335de5722d4032396f554e56cc727c4ad811cfb45abdd41558775880a25114f29ac6f44e8a1e4463f2c6cce7d" - }, - { - "Name": "5.0.104", - "Version": "5.0.4", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/469fb27a-ffec-45ee-8a35-b0a65a5caec0/67e020db226d0dd11782099bb9ae4e7c/dotnet-sdk-5.0.104-linux-arm64.tar.gz", - "SHA512": "9f0cb4bdc70245bde541b26c67e4beb679923e9a68ba27585d9733f4a9f46c41bf0962c4bcd20027188f367ac6427e16e51ff6475f3be79deb1d9f734ecb7a8b" - }, - { - "Name": "5.0.201", - "Version": "5.0.4", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/1958def3-0dac-4243-8fb9-e906a7f14509/93af2ac9a973d60c7d2ebd168d752a92/dotnet-sdk-5.0.201-linux-arm.tar.gz", - "SHA512": "1be5abc37284441f528987ed6d07a9a6b9128445a8f615ae3eb4b593e2bce2c0732ee91ec2d2087a982af467a230cc826f63d8aa21748651db83085687f43fce" - }, - { - "Name": "5.0.201", - "Version": "5.0.4", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/2e5353f1-8818-4d87-af94-0e5cec730b40/58172cde97795b55bcfc7177dbcf3c68/dotnet-sdk-5.0.201-linux-arm64.tar.gz", - "SHA512": "6d3d8f5f41931615dcea1038dbe1fdf3b767481b62422f2e91b67b433d949d853d68c5ed7bc0a63b2157d05b9e0139f747fe8377f16a9caf21e5dd5691548777" - }, - { - "Name": "5.0.202", - "Version": "5.0.5", - "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/fada9b0c-202a-4720-817b-b8b92dddad99/fa6ace43156b7f73e5f7fb3cdfb5c302/dotnet-sdk-5.0.202-linux-arm.tar.gz", - "SHA512": "ac363bbc163100e49b2ad43dfded9bdd3444980d9dca1b51bcd65d6fab73a5fc2251f094fd5e6fa1c1c877251b2f26c684023c0e1b09d1956b9bb543f72c4f0b" - }, - { - "Name": "5.0.202", - "Version": "5.0.5", - "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/c1f15b51-5e8c-4e6c-a803-241790159af3/b5cbcc59f67089d760e0ed4a714c47ed/dotnet-sdk-5.0.202-linux-arm64.tar.gz", - "SHA512": "26ec125a0637e71acad20386474df89a101e9ae948921b5de0cd343f4bc0e84b4e7b2318e15978723eb3b9d321e89b790c3f0424a43c29b0015fc6f2b9e3e9d9" - }, { "Name": "6.0.100", "Version": "6.0.0", "Architecture": "ARM32", "Link": "https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-6.0.100-linux-arm32-binaries", - "SHA512": "" + "SHA512": "6b06e0eb7880ab8fbd8bdb02d9c94fa200ca07fe38dba1e272ae61dc02c79fa03f4653571fb3643820294314048105f401004aa356c087544ccce9bed6ce7eef" }, { "Name": "6.0.100", "Version": "6.0.0", "Architecture": "ARM64", "Link": "https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-6.0.100-linux-arm64-binaries", - "SHA512": "" + "SHA512": "112bfaea0543dfb1cd3cbd2511c159c0c32cee0f7e3b182c2a33a83c69fb8ff095a4f0b24ba16ae02de86b346d15650c511e6d408bde8cda62e2e5600163d153" } ] } From ea132982824236f16e7429eecd3678166177b48e Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Wed, 1 Dec 2021 21:27:10 +0100 Subject: [PATCH 008/278] Adapt VS2022 SDK --- RaspberryDebugger/DebugHelper.cs | 2 -- RaspberryDebugger/RaspberryDebuggerPackage.cs | 2 +- RaspberryDebugger/source.extension.vsixmanifest | 9 ++++----- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/RaspberryDebugger/DebugHelper.cs b/RaspberryDebugger/DebugHelper.cs index 846208f..088bd24 100644 --- a/RaspberryDebugger/DebugHelper.cs +++ b/RaspberryDebugger/DebugHelper.cs @@ -275,8 +275,6 @@ public static async Task PublishProjectAsync(DTE2 dte, Solution solution, Covenant.Assert(solutionService4 != null, $"Service [{typeof(SVsSolution).Name}] is not available."); } - solutionService4.EnsureProjectIsLoaded(ref projectGuid, (uint)__VSBSLFLAGS.VSBSLFLAGS_LoadAllPendingProjects); - // Build the project to ensure that there are no compile-time errors. Log.Info($"Building: {projectProperties.FullPath}"); diff --git a/RaspberryDebugger/RaspberryDebuggerPackage.cs b/RaspberryDebugger/RaspberryDebuggerPackage.cs index 0c9e96b..e6a1c30 100644 --- a/RaspberryDebugger/RaspberryDebuggerPackage.cs +++ b/RaspberryDebugger/RaspberryDebuggerPackage.cs @@ -111,7 +111,7 @@ public static void Log(string text) debugLogQueue.Enqueue(text); } - Instance.JoinableTaskFactory.RunAsync( + _ = Instance.JoinableTaskFactory.RunAsync( async () => { await Task.Yield(); // Get off of the callers stack diff --git a/RaspberryDebugger/source.extension.vsixmanifest b/RaspberryDebugger/source.extension.vsixmanifest index 7d90785..271e0cf 100644 --- a/RaspberryDebugger/source.extension.vsixmanifest +++ b/RaspberryDebugger/source.extension.vsixmanifest @@ -1,18 +1,17 @@ - + Raspberry Debugger - The Raspberry Debugger extension provides an easy way to debug your Raspberry .NET Core and .NET 5 applications on a real Raspberry Pi using Visual Studio. + The Raspberry Debugger extension provides an easy way to debug your Raspberry .NET Core and .NET5/ .NET 6 applications on a real Raspberry Pi using Visual Studio. license.txt https://github.com/nforgeio/RaspberryDebugger - https://github.com/nforgeio/RaspberryDebugger/releases/tag/v1.7 + https://github.com/nforgeio/RaspberryDebugger/releases/tag/v1.8 packageicon.png raspberry pi debugger - - + From 3f832d840e1288fade82637d21647e261064c1b6 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Wed, 1 Dec 2021 21:27:30 +0100 Subject: [PATCH 009/278] Set project to .NET 6 --- SdkCatalogChecker/SdkCatalogChecker.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SdkCatalogChecker/SdkCatalogChecker.csproj b/SdkCatalogChecker/SdkCatalogChecker.csproj index e9ef528..ec482e5 100644 --- a/SdkCatalogChecker/SdkCatalogChecker.csproj +++ b/SdkCatalogChecker/SdkCatalogChecker.csproj @@ -2,7 +2,7 @@ Exe - net5.0 + net6.0 From 30bbd33abd61c702aa3923e61f27fcaa18f27bae Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Wed, 1 Dec 2021 22:30:17 +0100 Subject: [PATCH 010/278] Set manifest to VS2022 --- RaspberryDebugger/source.extension.vsixmanifest | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/RaspberryDebugger/source.extension.vsixmanifest b/RaspberryDebugger/source.extension.vsixmanifest index 271e0cf..f978237 100644 --- a/RaspberryDebugger/source.extension.vsixmanifest +++ b/RaspberryDebugger/source.extension.vsixmanifest @@ -11,14 +11,24 @@ raspberry pi debugger - - + + x86 + + + amd64 + + + x86 + + + amd64 + - + From 544c9b2f6d4a7dd3bee63c8f80b5173c1af791d6 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Wed, 1 Dec 2021 22:30:52 +0100 Subject: [PATCH 011/278] Search for standard SSH implementation --- RaspberryDebugger/DebugHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RaspberryDebugger/DebugHelper.cs b/RaspberryDebugger/DebugHelper.cs index 088bd24..f4a78da 100644 --- a/RaspberryDebugger/DebugHelper.cs +++ b/RaspberryDebugger/DebugHelper.cs @@ -60,7 +60,7 @@ public static async Task EnsureOpenSshAsync() Log.Info("Checking for native Windows OpenSSH client"); - var openSshPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "Sysnative", "OpenSSH", "ssh.exe"); + var openSshPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "System32", "OpenSSH", "ssh.exe"); if (!File.Exists(openSshPath)) { From 01d23956619724a9482483a0a3b859082dd11e81 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Thu, 2 Dec 2021 00:16:11 +0100 Subject: [PATCH 012/278] Include .NET 6 uris for tar.gz files --- RaspberryDebugger/sdk-catalog.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RaspberryDebugger/sdk-catalog.json b/RaspberryDebugger/sdk-catalog.json index 492fd7b..92bbd08 100644 --- a/RaspberryDebugger/sdk-catalog.json +++ b/RaspberryDebugger/sdk-catalog.json @@ -4,15 +4,15 @@ "Name": "6.0.100", "Version": "6.0.0", "Architecture": "ARM32", - "Link": "https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-6.0.100-linux-arm32-binaries", - "SHA512": "6b06e0eb7880ab8fbd8bdb02d9c94fa200ca07fe38dba1e272ae61dc02c79fa03f4653571fb3643820294314048105f401004aa356c087544ccce9bed6ce7eef" + "Link": "https://download.visualstudio.microsoft.com/download/pr/1f85b038-9917-4d0a-8485-5dc86510eec7/a7555924fe292c6c2140893f066abe65/dotnet-sdk-6.0.100-linux-arm.tar.gz", + "SHA512": "c1e555893c48c4f4256d3e6b1d36b31d8a4d7763a6e958fb63dd31436c660648d481612b5e25d79a613e84a1954f5eac2c9c2b740bf410958172780f7bbeaeb3" }, { "Name": "6.0.100", "Version": "6.0.0", "Architecture": "ARM64", - "Link": "https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-6.0.100-linux-arm64-binaries", - "SHA512": "112bfaea0543dfb1cd3cbd2511c159c0c32cee0f7e3b182c2a33a83c69fb8ff095a4f0b24ba16ae02de86b346d15650c511e6d408bde8cda62e2e5600163d153" + "Link": "https://download.visualstudio.microsoft.com/download/pr/adcd9310-5072-4179-9b8b-16563b897995/15a7595966f488c74909e4a9273c0e24/dotnet-sdk-6.0.100-linux-arm64.tar.gz", + "SHA512": "e5983c1c599d6dc7c3c7496b9698e47c68247f04a5d0d1e3162969d071471297bce1c2fd3a1f9fb88645006c327ae79f880dcbdd8eefc9166fd717331f2716e7" } ] } From fe5ffe58915c43f44638be831cad931ae5d75247 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Thu, 2 Dec 2021 00:36:34 +0100 Subject: [PATCH 013/278] Open standard ssh in CreateLaunchSettingsAsync in settings --- RaspberryDebugger/Commands/DebugStartCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RaspberryDebugger/Commands/DebugStartCommand.cs b/RaspberryDebugger/Commands/DebugStartCommand.cs index 0583658..9645ac3 100644 --- a/RaspberryDebugger/Commands/DebugStartCommand.cs +++ b/RaspberryDebugger/Commands/DebugStartCommand.cs @@ -315,7 +315,7 @@ private async Task CreateLaunchSettingsAsync(ConnectionInfo connection new JObject ( new JProperty("version", "0.2.1"), - new JProperty("adapter", Path.Combine(systemRoot, "Sysnative", "OpenSSH", "ssh.exe")), + new JProperty("adapter", Path.Combine(systemRoot, "System32", "OpenSSH", "ssh.exe")), new JProperty("adapterArgs", $"-i \"{connectionInfo.PrivateKeyPath}\" -o \"StrictHostKeyChecking no\" {connectionInfo.User}@{connectionInfo.Host} {PackageHelper.RemoteDebuggerPath} --interpreter=vscode {engineLogging}"), new JProperty("configurations", new JArray From 7f7a7bf1e4107a328bd155689b4909b2527928f7 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Thu, 2 Dec 2021 00:48:58 +0100 Subject: [PATCH 014/278] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index de86a0a..322c4c5 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ _A Visual Studio Extension for debugging .NET Core applications remotely on a Ra --- -**IMPORTANT:** .NET 5.0 starting with the SDK 5.0.102 works now! +**IMPORTANT:** .NET 6.0 starting with the SDK 6.0.100 works now! --- @@ -13,15 +13,15 @@ The new **Raspberry Debugger** Visual Studio extension allows you to code your a ### Requirements -* Windows 10 -* Visual Studio 2019 Community Edition (or better) +* Windows 10/11 +* Visual Studio 2022 Community Edition (or better) * Raspberry Pi running 32-bit Raspberry Pi OS * Raspberry user allowed to `sudo` * [Windows Open SSH Client](https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse) (installed automatically when required) ### Features -* Supports Raspberry Pi 3+ devices +* Supports Raspberry Pi 3+ devices ans Zero 2 W * Raspberry Pi OS 32-bit (we haven't tested other operating systems) * Console and ASPNET .NET applications supported * Configures SSH 2048-bit RSA key pair automatically From eb6574a36f7371c9388efd1d7554c429267bcf99 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Thu, 2 Dec 2021 00:50:24 +0100 Subject: [PATCH 015/278] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 322c4c5..f03788c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Raspberry Debugger +# Raspberry Debugger forked from nforgeio/RaspberryDebugger _A Visual Studio Extension for debugging .NET Core applications remotely on a Raspberry Pi_ --- From 1a952a496e8b4e59130befbc46694508cc9b8281 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Thu, 2 Dec 2021 00:51:52 +0100 Subject: [PATCH 016/278] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f03788c..7f3b8ce 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ _A Visual Studio Extension for debugging .NET Core applications remotely on a Ra --- -**IMPORTANT:** .NET 6.0 starting with the SDK 6.0.100 works now! +**IMPORTANT:** Only .NET 6.0 starting with the SDK 6.0.100 works now and can be ONLY used in Visual Studio 2022 for the first! --- From a864ffecb2985493cdc3f2599b0e3cb908571775 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Thu, 2 Dec 2021 00:53:39 +0100 Subject: [PATCH 017/278] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f3b8ce..5aa5569 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The new **Raspberry Debugger** Visual Studio extension allows you to code your a ### Features -* Supports Raspberry Pi 3+ devices ans Zero 2 W +* Supports Raspberry Pi 3+ devices and Zero 2 W * Raspberry Pi OS 32-bit (we haven't tested other operating systems) * Console and ASPNET .NET applications supported * Configures SSH 2048-bit RSA key pair automatically From 723da02250f960944537c28d830cfb8c1ce2717a Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Thu, 2 Dec 2021 17:42:36 +0100 Subject: [PATCH 018/278] Extend MessageBox text to .NET 6 --- RaspberryDebugger/DebugHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RaspberryDebugger/DebugHelper.cs b/RaspberryDebugger/DebugHelper.cs index f4a78da..f50ac63 100644 --- a/RaspberryDebugger/DebugHelper.cs +++ b/RaspberryDebugger/DebugHelper.cs @@ -150,7 +150,7 @@ public static Project GetTargetProject(DTE2 dte) if (!projectProperties.IsNetCore) { MessageBox.Show( - "Only .NET Core 3.1 or .NET 5 projects are supported for Raspberry debugging.", + "Only .NET Core 3.1 or .NET 5 + 6 projects are supported for Raspberry debugging.", "Invalid Project Type", MessageBoxButtons.OK, MessageBoxIcon.Error); From 8156850deeb0da6e8b7b657b8ffd93b3fc8ec8e9 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Thu, 2 Dec 2021 18:00:26 +0100 Subject: [PATCH 019/278] Allow only Visual Studio 2022 --- RaspberryDebugger/source.extension.vsixmanifest | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/RaspberryDebugger/source.extension.vsixmanifest b/RaspberryDebugger/source.extension.vsixmanifest index f978237..b5b21d9 100644 --- a/RaspberryDebugger/source.extension.vsixmanifest +++ b/RaspberryDebugger/source.extension.vsixmanifest @@ -11,16 +11,16 @@ raspberry pi debugger - + x86 - + amd64 - + x86 - + amd64 @@ -28,7 +28,7 @@ - + From 0c30e504d1298fdac80f6b100b5fac17ca06f05a Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sat, 4 Dec 2021 12:57:11 +0100 Subject: [PATCH 020/278] Include actual .NET SDKs only --- RaspberryDebugger/sdk-catalog.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/RaspberryDebugger/sdk-catalog.json b/RaspberryDebugger/sdk-catalog.json index 92bbd08..2faa46b 100644 --- a/RaspberryDebugger/sdk-catalog.json +++ b/RaspberryDebugger/sdk-catalog.json @@ -1,5 +1,33 @@ { "Items": [ + { + "Name": "3.1.415", + "Version": "3.1.21", + "Architecture": "ARM32", + "Link": "https://download.visualstudio.microsoft.com/download/pr/e401b906-4681-437b-a1c5-21a2d7e0f83c/824371926ae334ac264b91d8234b350c/dotnet-sdk-3.1.415-linux-arm.tar.gz", + "SHA512": "b738f0b4455b926b8fafa9699525cebbf51eaad7bbe0e77267640a3fe33645ab4901552008de0a9916f55d0eff1de61c22ebd432a5a1fb5099f0cfa1b33a5e75" + }, + { + "Name": "3.1.415", + "Version": "3.1.21", + "Architecture": "ARM64", + "Link": "https://download.visualstudio.microsoft.com/download/pr/4a78a923-e891-40fe-88d2-4bff2c90519f/126bee4399caeabde4f34f4ace7f44e3/dotnet-sdk-3.1.415-linux-arm64.tar.gz", + "SHA512": "7a5b9922988bcbde63d39f97e283ca1d373d5521cca0ab8946e2f86deaef6e21f00244228a0d5d8c38c2b9634b38bc7338b61984f0e12dd8fdb8b2e6eed5dd34" + }, + { + "Name": "5.0.403", + "Version": "5.0.12", + "Architecture": "ARM32", + "Link": "https://download.visualstudio.microsoft.com/download/pr/93c86ea7-b04e-4d0f-b65a-3a982768e215/285ab1a46d5c4f2067f86f575262c79f/dotnet-sdk-5.0.403-linux-arm.tar.gz", + "SHA512": "1b7b4a8aea62a7fd1e1919710b2b35b41ae31a64f79b4cc056a3e5f4778bb6cc0b92999321e1632f29a1eb88d734e44fc42eea52ddfb8aa0424cafd9796a503c" + }, + { + "Name": "5.0.403", + "Version": "5.0.12", + "Architecture": "ARM64", + "Link": "https://download.visualstudio.microsoft.com/download/pr/91015c72-ce5a-4840-9e87-5bfa4bb80224/b39692ac418d790ff7a2e092eb07de98/dotnet-sdk-5.0.403-linux-arm64.tar.gz", + "SHA512": "6cc705fe45c0d8df6a493eb2923539ef5b62d048d5218859bf3af06fb3934c9c716c16f98ee1a28c818d77adff8430bf39a2ae54a59a1468b704b4ba192234ac" + }, { "Name": "6.0.100", "Version": "6.0.0", From 077debdef2b49c7c5550344c050a3cd8e1020a2b Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sat, 4 Dec 2021 12:58:36 +0100 Subject: [PATCH 021/278] Include Polly for http client exception handling and elasped download time --- SdkCatalogChecker/Program.cs | 50 ++++++++++++++++------ SdkCatalogChecker/SdkCatalogChecker.csproj | 1 + 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/SdkCatalogChecker/Program.cs b/SdkCatalogChecker/Program.cs index 511dc64..0787893 100644 --- a/SdkCatalogChecker/Program.cs +++ b/SdkCatalogChecker/Program.cs @@ -16,18 +16,19 @@ // limitations under the License. using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.Http; using System.Reflection; +using System.Threading; using System.Threading.Tasks; - +using System.Collections.Generic; +using Polly; using Neon.Common; using Neon.Cryptography; - using Newtonsoft.Json; using RaspberryDebugger; +using System.Diagnostics; namespace NetCoreCatalogChecker { @@ -140,6 +141,19 @@ public static async Task Main(string[] args) using (var client = new HttpClient()) { + // I've seen some transient issues with downloading SDKs from Microsoft: 404 & 503 + // We're going to retry up to 3 times. + // Wait 10 minutes for low download rates + + var timeOut = TimeSpan.FromMinutes(10); + client.Timeout = timeOut; + + var watch = new Stopwatch(); + + var retryPolicy = Policy + .Handle () + .WaitAndRetryAsync(3, attempt => timeOut); // retry 3 times + foreach (var item in catalog.Items .OrderByDescending(item => SemanticVersion.Parse(item.Version)) .ThenBy(item => item.Name) @@ -151,21 +165,24 @@ public static async Task Main(string[] args) Console.WriteLine($"SDK: {item.Name}/{item.Architecture} (v{item.Version})"); Console.WriteLine($"Link: {item.Link}"); - // I've seen some transient issues with downloading SDKs from Microsoft: 404 & 503 - // We're going to retry up to 5 times. - var binary = (byte[])null; - for (int i = 0; i < 5; i++) + try { - try - { - binary = await client.GetByteArraySafeAsync(item.Link); - } - catch (Exception e) + watch.Start(); + + await retryPolicy.ExecuteAsync(async () => { - Console.WriteLine(NeonHelper.ExceptionError(e)); - } + binary = await client.GetByteArraySafeAsync(item.Link); + }); + } + catch (Exception e) + { + Console.WriteLine(NeonHelper.ExceptionError(e)); + } + finally + { + watch.Stop(); } if (binary == null) @@ -179,6 +196,7 @@ public static async Task Main(string[] args) if (actualSha512 == expectedSha512) { Console.WriteLine("SHA512: Hashes match"); + Console.WriteLine($@"Time elapsed: {watch.Elapsed:m\:ss\.ff}"); } else { @@ -199,11 +217,15 @@ public static async Task Main(string[] args) if (ok) { Console.WriteLine("Catalog is OK"); + Console.WriteLine("Hit any key to close console"); + Console.ReadKey(); Environment.Exit(1); } else { Console.WriteLine("*** ERROR: One or more catalog items have issues"); + Console.WriteLine("Hit any key to close console"); + Console.ReadKey(); Environment.Exit(0); } } diff --git a/SdkCatalogChecker/SdkCatalogChecker.csproj b/SdkCatalogChecker/SdkCatalogChecker.csproj index ec482e5..d89654d 100644 --- a/SdkCatalogChecker/SdkCatalogChecker.csproj +++ b/SdkCatalogChecker/SdkCatalogChecker.csproj @@ -19,6 +19,7 @@ + From 5d5033da251a50472864222a3b9cd1b7bce4bb84 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sat, 4 Dec 2021 14:14:44 +0100 Subject: [PATCH 022/278] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5aa5569..2935be5 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ _A Visual Studio Extension for debugging .NET Core applications remotely on a Ra --- -**IMPORTANT:** Only .NET 6.0 starting with the SDK 6.0.100 works now and can be ONLY used in Visual Studio 2022 for the first! +**IMPORTANT:** .NET 6.0 starting with the SDK 6.0.100 works now and can be ONLY used in Visual Studio 2022 for the first! --- From 2b51f6dbe844a1513231406af9319a3ab36a9013 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Tue, 14 Dec 2021 14:15:59 +0100 Subject: [PATCH 023/278] -Move to localhost but using Raspi ip first -Integrate null pointer handling for serveral objects --- RaspberryDebugger.sln.DotSettings | 3 + .../Commands/DebugAttachToProcessCommand.cs | 2 +- .../Commands/DebugStartCommand.cs | 164 ++++++++---------- .../DebugStartWithoutDebuggingCommand.cs | 2 +- RaspberryDebugger/RaspberryDebuggerPackage.cs | 2 +- 5 files changed, 83 insertions(+), 90 deletions(-) create mode 100644 RaspberryDebugger.sln.DotSettings diff --git a/RaspberryDebugger.sln.DotSettings b/RaspberryDebugger.sln.DotSettings new file mode 100644 index 0000000..43e61f8 --- /dev/null +++ b/RaspberryDebugger.sln.DotSettings @@ -0,0 +1,3 @@ + + True + True \ No newline at end of file diff --git a/RaspberryDebugger/Commands/DebugAttachToProcessCommand.cs b/RaspberryDebugger/Commands/DebugAttachToProcessCommand.cs index 5c42ba1..e1a98b7 100644 --- a/RaspberryDebugger/Commands/DebugAttachToProcessCommand.cs +++ b/RaspberryDebugger/Commands/DebugAttachToProcessCommand.cs @@ -38,7 +38,7 @@ using Neon.Windows; using Newtonsoft.Json.Linq; - +using RaspberryDebugger.Commands; using Task = System.Threading.Tasks.Task; namespace RaspberryDebugger diff --git a/RaspberryDebugger/Commands/DebugStartCommand.cs b/RaspberryDebugger/Commands/DebugStartCommand.cs index 9645ac3..ebab53d 100644 --- a/RaspberryDebugger/Commands/DebugStartCommand.cs +++ b/RaspberryDebugger/Commands/DebugStartCommand.cs @@ -16,43 +16,29 @@ // limitations under the License. using System; -using System.Collections.Generic; using System.ComponentModel.Design; using System.Diagnostics.Contracts; -using System.Globalization; -using System.Net.Http; using System.IO; -using System.Net; -using System.Linq; using System.Text; -using System.Threading; using System.Threading.Tasks; -using System.Windows.Forms; - -using Microsoft.VisualStudio.Debugger.Interop; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; - using EnvDTE; using EnvDTE80; - +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Shell.Interop; using Neon.Common; using Neon.IO; using Neon.SSH; -using Neon.Windows; - using Newtonsoft.Json.Linq; - using Task = System.Threading.Tasks.Task; -namespace RaspberryDebugger +namespace RaspberryDebugger.Commands { /// /// Handles the Start Debugging command for Raspberry enabled projects. /// internal sealed class DebugStartCommand { - private DTE2 dte; + private readonly DTE2 dte; /// /// Command ID. @@ -64,11 +50,6 @@ internal sealed class DebugStartCommand /// public static readonly Guid CommandSet = RaspberryDebuggerPackage.CommandSet; - /// - /// VS Package that provides this command, not null. - /// - private readonly AsyncPackage package; - /// /// Initializes a new instance of the class. /// Adds our command handlers for menu (commands must exist in the command table file) @@ -82,13 +63,12 @@ private DebugStartCommand(AsyncPackage package, OleMenuCommandService commandSer ThreadHelper.ThrowIfNotOnUIThread(); - this.package = package; this.dte = (DTE2)Package.GetGlobalService(typeof(SDTE)); - var menuCommandID = new CommandID(CommandSet, CommandId); - var menuItem = new MenuCommand(this.Execute, menuCommandID); + var menuCommandId = new CommandID(CommandSet, CommandId); + var menuItem = new MenuCommand(Execute, menuCommandId); - commandService.AddCommand(menuItem); + commandService?.AddCommand(menuItem); } /// @@ -96,11 +76,6 @@ private DebugStartCommand(AsyncPackage package, OleMenuCommandService commandSer /// public static DebugStartCommand Instance { get; private set; } - /// - /// Gets the service provider from the owner package. - /// - private Microsoft.VisualStudio.Shell.IAsyncServiceProvider ServiceProvider => this.package; - /// /// Initializes the singleton instance of the command. /// @@ -121,9 +96,9 @@ public static async Task InitializeAsync(AsyncPackage package) /// /// Event sender. /// Event args. -#pragma warning disable VSTHRD100 +#pragma warning disable VSTHRD100 // Avoid async void methods private async void Execute(object sender, EventArgs e) -#pragma warning restore VSTHRD100 +#pragma warning restore VSTHRD100 // Avoid async void methods { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); @@ -181,66 +156,74 @@ private async void Execute(object sender, EventArgs e) using (var tempFile = await CreateLaunchSettingsAsync(connectionInfo, projectProperties)) { - dte.ExecuteCommand("DebugAdapterHost.Launch", $"/LaunchJson:\"{tempFile.Path}\""); + try + { + dte.ExecuteCommand("DebugAdapterHost.Launch", $"/LaunchJson:\"{tempFile.Path}\""); + } + catch (Exception exception) + { + Console.WriteLine(exception); + } } // Launch the browser for ASPNET apps if requested. Note that we're going to do this // on a background task to poll the Raspberry, waiting for the app to create the create // the LISTENING socket. - if (projectProperties.IsAspNet && projectProperties.AspLaunchBrowser) - { - var baseUri = $"http://{connectionInfo.Host}:{projectProperties.AspPort}"; - var launchReady = false; + if (!projectProperties.IsAspNet || !projectProperties.AspLaunchBrowser) return; + + //var baseUri = $"http://{connection.Address}:{projectProperties.AspPort}"; + var baseUri = $"http://{connection.Name}.local"; + var launchReady = false; - await NeonHelper.WaitForAsync( - async () => + await NeonHelper.WaitForAsync( + async () => + { + if (dte.Mode != vsIDEMode.vsIDEModeDebug) { - if (dte.Mode != vsIDEMode.vsIDEModeDebug) - { - // The developer must have stopped debugging before the ASPNET - // application was able to begin servicing requests. + // The developer must have stopped debugging before the ASPNET + // application was able to begin servicing requests. - return true; - } + return true; + } - try + try + { + var appListeningScript = + $@" + if lsof -i -P -n | grep --quiet 'TCP 127.0.0.1:{projectProperties.AspPort}' ; then + exit 0 + else + exit 1 + fi + "; + + var response = connection.SudoCommand(CommandBundle.FromScript(appListeningScript)); + + if (response.ExitCode != 0) { - var appListeningScript = -$@" -if lsof -i -P -n | grep --quiet 'TCP \*:{projectProperties.AspPort} (LISTEN)' ; then - exit 0 -else - exit 1 -fi -"; - var response = connection.SudoCommand(CommandBundle.FromScript(appListeningScript)); - - if (response.ExitCode != 0) - { - return false; - } + return false; + } // Wait just a bit longer to give the application a chance to // perform any additional initialization. await Task.Delay(TimeSpan.FromSeconds(1)); - launchReady = true; - return true; - } - catch - { - return false; - } - }, - timeout: TimeSpan.FromSeconds(30), - pollInterval: TimeSpan.FromSeconds(0.5)); + launchReady = true; + return true; + } + catch + { + return false; + } + }, + timeout: TimeSpan.FromSeconds(60), + pollInterval: TimeSpan.FromSeconds(0.5)); - if (launchReady) - { - NeonHelper.OpenBrowser($"{baseUri}{projectProperties.AspRelativeBrowserUri}"); - } + if (launchReady) + { + NeonHelper.OpenBrowser($"{baseUri}{projectProperties.AspRelativeBrowserUri}"); } } } @@ -258,7 +241,7 @@ private async Task CreateLaunchSettingsAsync(ConnectionInfo connection Covenant.Requires(projectProperties != null, nameof(projectProperties)); var systemRoot = Environment.GetFolderPath(Environment.SpecialFolder.Windows); - var debugFolder = LinuxPath.Combine(PackageHelper.RemoteDebugBinaryRoot(connectionInfo.User), projectProperties.Name); + var debugFolder = LinuxPath.Combine(PackageHelper.RemoteDebugBinaryRoot(connectionInfo?.User), projectProperties?.Name); // NOTE: // @@ -275,20 +258,27 @@ private async Task CreateLaunchSettingsAsync(ConnectionInfo connection // This means that we need add [program.dll] as the first argument, followed // by the program arguments. - var args = new JArray(); - - args.Add(LinuxPath.Combine(debugFolder, projectProperties.AssemblyName + ".dll")); + var args = new JArray + { + LinuxPath.Combine(debugFolder, projectProperties?.AssemblyName + ".dll") + }; - foreach (var arg in projectProperties.CommandLineArgs) + if (projectProperties?.CommandLineArgs != null) { - args.Add(arg); + foreach (var arg in projectProperties.CommandLineArgs) + { + args.Add(arg); + } } var environmentVariables = new JObject(); - foreach (var variable in projectProperties.EnvironmentVariables) + if (projectProperties?.EnvironmentVariables != null) { - environmentVariables.Add(variable.Key, variable.Value); + foreach (var variable in projectProperties.EnvironmentVariables) + { + environmentVariables.Add(variable.Key, variable.Value); + } } // For ASPNET apps, set the [ASPNETCORE_URLS] environment variable @@ -296,9 +286,9 @@ private async Task CreateLaunchSettingsAsync(ConnectionInfo connection // be reachable from the development workstation. Note that we don't // support HTTPS at this time. - if (projectProperties.IsAspNet) + if (projectProperties?.IsAspNet == true) { - environmentVariables["ASPNETCORE_URLS"] = $"http://0.0.0.0:{projectProperties.AspPort}"; + environmentVariables["ASPNETCORE_URLS"] = $"http://127.0.0.1:{projectProperties.AspPort}"; } // Construct the debug launch JSON file. @@ -316,7 +306,7 @@ private async Task CreateLaunchSettingsAsync(ConnectionInfo connection ( new JProperty("version", "0.2.1"), new JProperty("adapter", Path.Combine(systemRoot, "System32", "OpenSSH", "ssh.exe")), - new JProperty("adapterArgs", $"-i \"{connectionInfo.PrivateKeyPath}\" -o \"StrictHostKeyChecking no\" {connectionInfo.User}@{connectionInfo.Host} {PackageHelper.RemoteDebuggerPath} --interpreter=vscode {engineLogging}"), + new JProperty("adapterArgs", $"-i \"{connectionInfo?.PrivateKeyPath}\" -o \"StrictHostKeyChecking no\" {connectionInfo?.User}@{connectionInfo?.Host} {PackageHelper.RemoteDebuggerPath} --interpreter=vscode {engineLogging}"), new JProperty("configurations", new JArray ( diff --git a/RaspberryDebugger/Commands/DebugStartWithoutDebuggingCommand.cs b/RaspberryDebugger/Commands/DebugStartWithoutDebuggingCommand.cs index 9d1a46f..ca161fe 100644 --- a/RaspberryDebugger/Commands/DebugStartWithoutDebuggingCommand.cs +++ b/RaspberryDebugger/Commands/DebugStartWithoutDebuggingCommand.cs @@ -38,7 +38,7 @@ using Neon.Windows; using Newtonsoft.Json.Linq; - +using RaspberryDebugger.Commands; using Task = System.Threading.Tasks.Task; namespace RaspberryDebugger diff --git a/RaspberryDebugger/RaspberryDebuggerPackage.cs b/RaspberryDebugger/RaspberryDebuggerPackage.cs index e6a1c30..9b70405 100644 --- a/RaspberryDebugger/RaspberryDebuggerPackage.cs +++ b/RaspberryDebugger/RaspberryDebuggerPackage.cs @@ -32,7 +32,7 @@ using Neon.Common; using Neon.Diagnostics; - +using RaspberryDebugger.Commands; using Task = System.Threading.Tasks.Task; namespace RaspberryDebugger From 0be2136c920312e3c3963ab93f4bcb8b59838708 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sat, 5 Mar 2022 11:48:43 +0100 Subject: [PATCH 024/278] Update README.md Add known issues --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 2935be5..5bdea8f 100644 --- a/README.md +++ b/README.md @@ -173,3 +173,7 @@ The **Project/Raspberry Debug Settings** menu persists the settings to the new ` * _The Raspberry Debugger extension is compatible with Raspberry Pi_ * _Raspberry Pi is a trademark of the Raspberry Pi Foundation_ + +### Known Issues +* ASP.NET debugging not working because of .NET 6 error: Absolute Path required +* Only one project in an solution gets transferred to Raspberry Pi From 1d70501e50cbc110d9ccabe39d0a59c940d75fec Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sat, 5 Mar 2022 12:11:37 +0100 Subject: [PATCH 025/278] Edit vsix manifest for vs marketplace --- RaspberryDebugger/source.extension.vsixmanifest | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/RaspberryDebugger/source.extension.vsixmanifest b/RaspberryDebugger/source.extension.vsixmanifest index b5b21d9..f8d421e 100644 --- a/RaspberryDebugger/source.extension.vsixmanifest +++ b/RaspberryDebugger/source.extension.vsixmanifest @@ -1,14 +1,16 @@ - + Raspberry Debugger - The Raspberry Debugger extension provides an easy way to debug your Raspberry .NET Core and .NET5/ .NET 6 applications on a real Raspberry Pi using Visual Studio. + The Raspberry Debugger extension provides an easy way to debug your Raspberry .NET 6 applications on a real Raspberry Pi using Visual Studio 2022. +Raspberry Debugger forked from nforgeio/RaspberryDebugger + https://github.com/StanDeMan/RaspberryDebugger license.txt https://github.com/nforgeio/RaspberryDebugger - https://github.com/nforgeio/RaspberryDebugger/releases/tag/v1.8 + https://github.com/nforgeio/RaspberryDebugger/releases/tag/v2.0 packageicon.png - raspberry pi debugger + raspberry pi debugger for visual studio 2022 From 485ed3cf3ed2109d3ebf923b2bb6a28115f3183f Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sat, 5 Mar 2022 13:05:35 +0100 Subject: [PATCH 026/278] Reset publisher --- RaspberryDebugger/source.extension.vsixmanifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RaspberryDebugger/source.extension.vsixmanifest b/RaspberryDebugger/source.extension.vsixmanifest index f8d421e..ec18a2c 100644 --- a/RaspberryDebugger/source.extension.vsixmanifest +++ b/RaspberryDebugger/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Raspberry Debugger The Raspberry Debugger extension provides an easy way to debug your Raspberry .NET 6 applications on a real Raspberry Pi using Visual Studio 2022. Raspberry Debugger forked from nforgeio/RaspberryDebugger From e6f521707cb818f028e9819262e1d98cd43553c1 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sat, 5 Mar 2022 13:11:32 +0100 Subject: [PATCH 027/278] As mantainer: set owner of license --- RaspberryDebugger/license.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RaspberryDebugger/license.txt b/RaspberryDebugger/license.txt index 1528e22..8035c44 100644 --- a/RaspberryDebugger/license.txt +++ b/RaspberryDebugger/license.txt @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright [2022] [nforgeio] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 3296c0da0cba81b749d36f031ea2968b2cffdb3a Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sat, 5 Mar 2022 13:13:33 +0100 Subject: [PATCH 028/278] Change to new version in assembly info --- RaspberryDebugger/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RaspberryDebugger/Properties/AssemblyInfo.cs b/RaspberryDebugger/Properties/AssemblyInfo.cs index 288f5e6..2477e3a 100644 --- a/RaspberryDebugger/Properties/AssemblyInfo.cs +++ b/RaspberryDebugger/Properties/AssemblyInfo.cs @@ -46,5 +46,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.8.0.0")] -[assembly: AssemblyFileVersion("1.8.0.0")] +[assembly: AssemblyVersion("2.0.0.0")] +[assembly: AssemblyFileVersion("2.0.0.0")] From 779bfc3a85d347c5c986eedca153f6a2dd54ff47 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sat, 5 Mar 2022 13:23:45 +0100 Subject: [PATCH 029/278] Manifest guid change --- RaspberryDebugger/source.extension.vsixmanifest | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/RaspberryDebugger/source.extension.vsixmanifest b/RaspberryDebugger/source.extension.vsixmanifest index ec18a2c..fa08012 100644 --- a/RaspberryDebugger/source.extension.vsixmanifest +++ b/RaspberryDebugger/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Raspberry Debugger The Raspberry Debugger extension provides an easy way to debug your Raspberry .NET 6 applications on a real Raspberry Pi using Visual Studio 2022. Raspberry Debugger forked from nforgeio/RaspberryDebugger @@ -13,15 +13,9 @@ Raspberry Debugger forked from nforgeio/RaspberryDebugger raspberry pi debugger for visual studio 2022 - - x86 - amd64 - - x86 - amd64 From 5f3ddc26873bcf657bfb6c0ad9d577f96931d344 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sun, 6 Mar 2022 12:30:26 +0100 Subject: [PATCH 030/278] Update readme Issues explained and set higher --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5bdea8f..cc2ccfc 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,11 @@ You can use Visual Studio Code to develop and debug .NET Core applications eithe The new **Raspberry Debugger** Visual Studio extension allows you to code your application on a Windows workstation and then build and debug it on a Raspberry by just pressing **F5 - Start Debugging**. +### Known Issues +* ASP.NET debugging not working, because of this (ASP.NET 6?) error: Absolute Path required + - @community: feel free to solve this issue, please! +* Only one project in an solution gets transferred to Raspberry Pi + ### Requirements * Windows 10/11 @@ -173,7 +178,3 @@ The **Project/Raspberry Debug Settings** menu persists the settings to the new ` * _The Raspberry Debugger extension is compatible with Raspberry Pi_ * _Raspberry Pi is a trademark of the Raspberry Pi Foundation_ - -### Known Issues -* ASP.NET debugging not working because of .NET 6 error: Absolute Path required -* Only one project in an solution gets transferred to Raspberry Pi From 6a378b32d86f3f93fd6e92ab715990dd7e05bec7 Mon Sep 17 00:00:00 2001 From: MagicAndre1981 Date: Tue, 8 Mar 2022 14:02:56 +0100 Subject: [PATCH 031/278] added NuGet.Config with pre-release feeds of VS packages --- NuGet.Config | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 NuGet.Config diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 0000000..183b43b --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file From 2b865bb679b7fe0d293ac2299f3f1efe924c3a31 Mon Sep 17 00:00:00 2001 From: MagicAndre1981 Date: Tue, 8 Mar 2022 14:04:33 +0100 Subject: [PATCH 032/278] fixed #36 : Error NETSDK1129 for projects that multi target several frameworks --- RaspberryDebugger/DebugHelper.cs | 33 +- .../Models/VisualStudio/ProjectProperties.cs | 46 +- RaspberryDebugger/RaspberryDebugger.csproj | 423 +++++++++--------- 3 files changed, 286 insertions(+), 216 deletions(-) diff --git a/RaspberryDebugger/DebugHelper.cs b/RaspberryDebugger/DebugHelper.cs index f50ac63..18ca1c9 100644 --- a/RaspberryDebugger/DebugHelper.cs +++ b/RaspberryDebugger/DebugHelper.cs @@ -379,18 +379,39 @@ public static async Task PublishProjectAsync(DTE2 dte, Solution solution, try { - var response = await NeonHelper.ExecuteCaptureAsync( - "dotnet", - new object[] - { + ExecuteResponse response; + + if (!string.IsNullOrEmpty(projectProperties.Framework)) + { + response = await NeonHelper.ExecuteCaptureAsync( + "dotnet", + new object[] + { + "publish", + "--configuration", projectProperties.Configuration, + "--framework", projectProperties.Framework, + "--runtime", projectProperties.Runtime, + "--no-self-contained", + "--output", projectProperties.PublishFolder, + projectProperties.FullPath + }, + environmentVariables: environmentVariables).ConfigureAwait(false); + } + else + { + response = await NeonHelper.ExecuteCaptureAsync( + "dotnet", + new object[] + { "publish", "--configuration", projectProperties.Configuration, "--runtime", projectProperties.Runtime, "--no-self-contained", "--output", projectProperties.PublishFolder, projectProperties.FullPath - }, - environmentVariables: environmentVariables); + }, + environmentVariables: environmentVariables).ConfigureAwait(false); + } await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); diff --git a/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs b/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs index 89a261c..fbcb309 100644 --- a/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs +++ b/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs @@ -35,6 +35,9 @@ using Microsoft.VisualStudio; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; +using Microsoft.VisualStudio.ProjectSystem; +using Microsoft.VisualStudio.ProjectSystem.Debug; +using Microsoft.VisualStudio.ProjectSystem.Properties; using Neon.Common; using Neon.Net; @@ -42,7 +45,8 @@ using Newtonsoft.Json.Linq; using Task = System.Threading.Tasks.Task; - +using Microsoft.VisualStudio.Threading; + namespace RaspberryDebugger { /// @@ -80,6 +84,7 @@ public static ProjectProperties CopyFrom(Solution solution, Project project) { Name = project.Name, FullPath = project.FullName, + Framework = string.Empty, Configuration = null, IsNetCore = false, SdkVersion = null, @@ -108,6 +113,29 @@ public static ProjectProperties CopyFrom(Solution solution, Project project) // Read the properties we care about from the project. var targetFrameworkMonikers = (string)project.Properties.Item("TargetFrameworkMoniker").Value; + var targetFramework = string.Empty; + + if (!(project is IVsBrowseObjectContext context)) + { + context = project.Object as IVsBrowseObjectContext; + } + + var frameworkService = context.UnconfiguredProject.Services.ExportProvider.GetExportedValueOrDefault(); + if (null != frameworkService) + { + ThreadHelper.JoinableTaskFactory.Run(async delegate + { + var configuredProject = await frameworkService.GetConfiguredProjectForActiveFrameworkAsync().ConfigureAwait(false); + IProjectProperties properties = configuredProject.Services.ProjectPropertiesProvider.GetCommonProperties(); + + //targetFramework = configuredProject.ProjectConfiguration.Dimensions["TargetFramework"]; + var successful = configuredProject.ProjectConfiguration.Dimensions.TryGetValue("TargetFramework", out targetFramework); + + Log.Info($"configuredProject.ProjectConfiguration.Dimensions['TargetFramework']: {targetFramework}"); + + }); + } + var outputType = (int)project.Properties.Item("OutputType").Value; var monikers = targetFrameworkMonikers.Split(','); @@ -274,7 +302,7 @@ public static ProjectProperties CopyFrom(Solution solution, Project project) aspRelativeBrowserUri = launchUri; } } - catch + catch { // We'll fall back to "/" for any URI parsing errors. @@ -319,6 +347,7 @@ public static ProjectProperties CopyFrom(Solution solution, Project project) { Name = project.Name, FullPath = project.FullName, + Framework = targetFramework, Guid = projectGuid, Configuration = project.ConfigurationManager.ActiveConfiguration.ConfigurationName, IsNetCore = isNetCore, @@ -341,7 +370,7 @@ public static ProjectProperties CopyFrom(Solution solution, Project project) } /// - /// Parses command line arguments from a string, trying to handle things like + /// Parses command line arguments from a string, trying to handle things like /// double and single quotes as well as escaped characters. /// /// The source command line or null. @@ -456,7 +485,7 @@ private static List ParseArgs(string commandLine) args.Add(Regex.Unescape(arg)); } } - + return args; } @@ -514,7 +543,12 @@ private static List ParseArgs(string commandLine) /// /// Returns the publish runtime. /// - public string Runtime => "linux-arm"; + public string Runtime => "linux-arm"; + + /// + /// Returns the framework version. + /// + public string Framework { get; private set; } /// /// Returns the publication folder. @@ -537,7 +571,7 @@ private static List ParseArgs(string commandLine) public bool DebugEnabled { get; private set; } /// - /// Returns the connection name identifying the target Raspberry or null + /// Returns the connection name identifying the target Raspberry or null /// when the default Raspberry connection should be used. /// public string DebugConnectionName { get; private set; } diff --git a/RaspberryDebugger/RaspberryDebugger.csproj b/RaspberryDebugger/RaspberryDebugger.csproj index b0dc015..8bbdc3b 100644 --- a/RaspberryDebugger/RaspberryDebugger.csproj +++ b/RaspberryDebugger/RaspberryDebugger.csproj @@ -1,209 +1,224 @@ - - - - 16.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - false - - - - Debug - AnyCPU - 2.0 - {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - {80D6A0E0-A145-488C-976D-CE34A16D8533} - Library - Properties - RaspberryDebugger - RaspberryDebugger - v4.7.2 - true - true - true - false - false - true - true - Program - $(DevEnvDir)devenv.exe - /rootsuffix Exp - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - CS0414 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - CS0414 - - - - - - - - - - - - - Form - - - ConnectionDialog.cs - - - Form - - - KeysDialog.cs - - - - Form - - - SettingsDialog.cs - - - - - - - - - - - - - - UserControl - - - ConnectionsPanel.cs - - - Component - - - - - - - - KeysDialog.cs - - - SettingsDialog.cs - - - - Always - true - - - - Designer - - - - - - - - - - - - - - - - 15.0.6142705 - - - 17.0.31902.203 - - - compile; build; native; contentfiles; analyzers; buildtransitive - - - 17.0.31902.203 - - - 16.3.23 - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - 2.18.2 - - - 2.18.2 - - - 2.18.2 - - - 13.0.1 - - - 2.9.1 - - - 2020.0.1 - - - 2.9.85 - - - - - Menus.ctmenu - - - - - ConnectionsPanel.cs - - - ConnectionDialog.cs - - - - - - - - - - - Always - true - - - - - + --> \ No newline at end of file From 1d694ac71feda7489ff42e69ed43ae721dde23cc Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Thu, 10 Mar 2022 20:10:44 +0100 Subject: [PATCH 033/278] Update readme ASP.NET only with wwwroot not working --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc2ccfc..3a7415d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ You can use Visual Studio Code to develop and debug .NET Core applications eithe The new **Raspberry Debugger** Visual Studio extension allows you to code your application on a Windows workstation and then build and debug it on a Raspberry by just pressing **F5 - Start Debugging**. ### Known Issues -* ASP.NET debugging not working, because of this (ASP.NET 6?) error: Absolute Path required +* ASP.NET with wwwroot path - debugging not working, because of this (ASP.NET 6?) error: Absolute Path required - @community: feel free to solve this issue, please! * Only one project in an solution gets transferred to Raspberry Pi From 8cbedfec1612a553d0bac619a320ccc61a2ca02f Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sun, 3 Apr 2022 14:30:57 +0200 Subject: [PATCH 034/278] Update .NET SDKs to latest versions --- RaspberryDebugger/sdk-catalog.json | 48 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/RaspberryDebugger/sdk-catalog.json b/RaspberryDebugger/sdk-catalog.json index 2faa46b..2e23607 100644 --- a/RaspberryDebugger/sdk-catalog.json +++ b/RaspberryDebugger/sdk-catalog.json @@ -1,46 +1,46 @@ { "Items": [ { - "Name": "3.1.415", - "Version": "3.1.21", + "Name": "3.1.417", + "Version": "3.1.23", "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/e401b906-4681-437b-a1c5-21a2d7e0f83c/824371926ae334ac264b91d8234b350c/dotnet-sdk-3.1.415-linux-arm.tar.gz", - "SHA512": "b738f0b4455b926b8fafa9699525cebbf51eaad7bbe0e77267640a3fe33645ab4901552008de0a9916f55d0eff1de61c22ebd432a5a1fb5099f0cfa1b33a5e75" + "Link": "https://download.visualstudio.microsoft.com/download/pr/36a601f0-b88e-41ea-910b-4dde7b083e73/61ec8564d50fb391f9e3a10b226fdd0d/dotnet-sdk-3.1.417-linux-arm.tar.gz", + "SHA512": "d68f9b130f4a516cb199c9010a42acdda0c9e8c705bce0e72e9854587ee54f5a017b1cea5b84f15dae057531a8a619cffffa1e79f3413d376ba7d7226407574c" }, { - "Name": "3.1.415", - "Version": "3.1.21", + "Name": "3.1.417", + "Version": "3.1.23", "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/4a78a923-e891-40fe-88d2-4bff2c90519f/126bee4399caeabde4f34f4ace7f44e3/dotnet-sdk-3.1.415-linux-arm64.tar.gz", - "SHA512": "7a5b9922988bcbde63d39f97e283ca1d373d5521cca0ab8946e2f86deaef6e21f00244228a0d5d8c38c2b9634b38bc7338b61984f0e12dd8fdb8b2e6eed5dd34" + "Link": "https://download.visualstudio.microsoft.com/download/pr/d8cdb908-9a61-45e9-8cac-1899af7b49b4/0f815fae130481a31fed4d9d1ad5b217/dotnet-sdk-3.1.417-linux-x64.tar.gz", + "SHA512": "8eb1002ad829ddd17638b942d3f8da24ad71ccab268a92a1fa6af6a65d86a4ab7f885f663ea9c68127bb356462bce125222ec4f04dc928005cbbbb1a8658f107" }, { - "Name": "5.0.403", - "Version": "5.0.12", + "Name": "5.0.406", + "Version": "5.0.15", "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/93c86ea7-b04e-4d0f-b65a-3a982768e215/285ab1a46d5c4f2067f86f575262c79f/dotnet-sdk-5.0.403-linux-arm.tar.gz", - "SHA512": "1b7b4a8aea62a7fd1e1919710b2b35b41ae31a64f79b4cc056a3e5f4778bb6cc0b92999321e1632f29a1eb88d734e44fc42eea52ddfb8aa0424cafd9796a503c" + "Link": "https://download.visualstudio.microsoft.com/download/pr/2c48a0d4-02cc-4f2c-b1ae-2770e6cf5806/439af3e6ab59fbce0108ee65e151546c/dotnet-sdk-5.0.406-linux-arm.tar.gz", + "SHA512": "7ac3e2532de5a6b41f379fee445d85040bd033799d525d021b8d582e97c22cc24b3ddfac90e222944a36e6f01538b9906b58cb0bd3c09a8cc56fb82fed8f6a79" }, { - "Name": "5.0.403", - "Version": "5.0.12", + "Name": "5.0.406", + "Version": "5.0.15", "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/91015c72-ce5a-4840-9e87-5bfa4bb80224/b39692ac418d790ff7a2e092eb07de98/dotnet-sdk-5.0.403-linux-arm64.tar.gz", - "SHA512": "6cc705fe45c0d8df6a493eb2923539ef5b62d048d5218859bf3af06fb3934c9c716c16f98ee1a28c818d77adff8430bf39a2ae54a59a1468b704b4ba192234ac" + "Link": "https://download.visualstudio.microsoft.com/download/pr/c4ae19f7-103c-4723-a1a2-f379226664a2/cb31a7dbd166b7e0003129c44845843b/dotnet-sdk-5.0.406-linux-arm64.tar.gz", + "SHA512": "df52611b3135650322030d18c685fa6d0fc0adabae976ea9509ab3e4daa306098b3e4dca31f1950c573dbadf7cfcffacc6ad609c893ec31bbb4df897548651cf" }, { - "Name": "6.0.100", - "Version": "6.0.0", + "Name": "6.0.201", + "Version": "6.0.3", "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/1f85b038-9917-4d0a-8485-5dc86510eec7/a7555924fe292c6c2140893f066abe65/dotnet-sdk-6.0.100-linux-arm.tar.gz", - "SHA512": "c1e555893c48c4f4256d3e6b1d36b31d8a4d7763a6e958fb63dd31436c660648d481612b5e25d79a613e84a1954f5eac2c9c2b740bf410958172780f7bbeaeb3" + "Link": "https://download.visualstudio.microsoft.com/download/pr/eefec3fa-c4c3-454d-bd7d-8fda31d15e5f/62668641ffc94db5fa11187f14a981f8/dotnet-sdk-6.0.201-linux-arm.tar.gz", + "SHA512": "5a683430325a90dd1d8e0071a1868939fb01268f9eb389ca1dc40956fde6b9f45bec086553ad3333139e530dfe5afae48195bcdfec388b0b568989924a1f1dd7" }, { - "Name": "6.0.100", - "Version": "6.0.0", + "Name": "6.0.201", + "Version": "6.0.3", "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/adcd9310-5072-4179-9b8b-16563b897995/15a7595966f488c74909e4a9273c0e24/dotnet-sdk-6.0.100-linux-arm64.tar.gz", - "SHA512": "e5983c1c599d6dc7c3c7496b9698e47c68247f04a5d0d1e3162969d071471297bce1c2fd3a1f9fb88645006c327ae79f880dcbdd8eefc9166fd717331f2716e7" + "Link": "https://download.visualstudio.microsoft.com/download/pr/33c6e1e3-e81f-44e8-9de8-91934fba3c94/9105f95a9e37cda6bd0c33651be2b90a/dotnet-sdk-6.0.201-linux-arm64.tar.gz,", + "SHA512": "2ea443c27ab7ca9d566e4df0e842063642394fd22fe2a8620371171c8207ae6a4a72c8c54fc6af5b6b053be25cf9c09a74504f08b963e5bd84544619aed9afc2" } ] } From 4863c98bf27e18385acff929e02523a8f7953d61 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sun, 3 Apr 2022 14:32:58 +0200 Subject: [PATCH 035/278] - Verison upgrade on depending assemblies - Set some member to readonly --- .../Commands/DebugAttachToProcessCommand.cs | 6 +++++- RaspberryDebugger/Commands/DebugStartCommand.cs | 16 +++++++--------- RaspberryDebugger/RaspberryDebugger.csproj | 17 ++++++++++++----- RaspberryDebugger/RaspberryDebuggerPackage.cs | 10 ++++++---- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/RaspberryDebugger/Commands/DebugAttachToProcessCommand.cs b/RaspberryDebugger/Commands/DebugAttachToProcessCommand.cs index 5c42ba1..38b52d8 100644 --- a/RaspberryDebugger/Commands/DebugAttachToProcessCommand.cs +++ b/RaspberryDebugger/Commands/DebugAttachToProcessCommand.cs @@ -48,7 +48,9 @@ namespace RaspberryDebugger /// internal sealed class DebugAttachToProcessCommand { - private DTE2 dte; +#pragma warning disable IDE0052 // Remove unread private members + private readonly DTE2 dte; +#pragma warning restore IDE0052 // Remove unread private members /// /// Command ID. @@ -95,7 +97,9 @@ private DebugAttachToProcessCommand(AsyncPackage package, OleMenuCommandService /// /// Gets the service provider from the owner package. /// +#pragma warning disable IDE0051 // Remove unused private members private Microsoft.VisualStudio.Shell.IAsyncServiceProvider ServiceProvider => this.package; +#pragma warning restore IDE0051 // Remove unused private members /// /// Initializes the singleton instance of the command. diff --git a/RaspberryDebugger/Commands/DebugStartCommand.cs b/RaspberryDebugger/Commands/DebugStartCommand.cs index 9645ac3..17bade2 100644 --- a/RaspberryDebugger/Commands/DebugStartCommand.cs +++ b/RaspberryDebugger/Commands/DebugStartCommand.cs @@ -52,7 +52,7 @@ namespace RaspberryDebugger /// internal sealed class DebugStartCommand { - private DTE2 dte; + private readonly DTE2 dte; /// /// Command ID. @@ -67,7 +67,9 @@ internal sealed class DebugStartCommand /// /// VS Package that provides this command, not null. /// +#pragma warning disable IDE0052 // Remove unread private members private readonly AsyncPackage package; +#pragma warning restore IDE0052 // Remove unread private members /// /// Initializes a new instance of the class. @@ -96,11 +98,6 @@ private DebugStartCommand(AsyncPackage package, OleMenuCommandService commandSer /// public static DebugStartCommand Instance { get; private set; } - /// - /// Gets the service provider from the owner package. - /// - private Microsoft.VisualStudio.Shell.IAsyncServiceProvider ServiceProvider => this.package; - /// /// Initializes the singleton instance of the command. /// @@ -275,9 +272,10 @@ private async Task CreateLaunchSettingsAsync(ConnectionInfo connection // This means that we need add [program.dll] as the first argument, followed // by the program arguments. - var args = new JArray(); - - args.Add(LinuxPath.Combine(debugFolder, projectProperties.AssemblyName + ".dll")); + var args = new JArray + { + LinuxPath.Combine(debugFolder, projectProperties.AssemblyName + ".dll") + }; foreach (var arg in projectProperties.CommandLineArgs) { diff --git a/RaspberryDebugger/RaspberryDebugger.csproj b/RaspberryDebugger/RaspberryDebugger.csproj index 8bbdc3b..360c603 100644 --- a/RaspberryDebugger/RaspberryDebugger.csproj +++ b/RaspberryDebugger/RaspberryDebugger.csproj @@ -3,6 +3,7 @@ 16.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + false @@ -134,9 +135,15 @@ 4.1.0 + + 4.1.0 + 4.1.0 + + 4.1.0 + 4.1.0 @@ -144,7 +151,7 @@ 17.0.3-beta1-11028-06 - 17.0.32307.283 + 17.1.32210.191 17.0.1311-pre @@ -152,16 +159,16 @@ 17.0.3-beta1-11028-06 - + compile; build; native; contentfiles; analyzers; buildtransitive - 17.0.31902.203 + 17.1.32210.191 16.3.36 - + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -184,7 +191,7 @@ 2020.0.1 - 2.9.85 + 2.10.44 diff --git a/RaspberryDebugger/RaspberryDebuggerPackage.cs b/RaspberryDebugger/RaspberryDebuggerPackage.cs index e6a1c30..0456b55 100644 --- a/RaspberryDebugger/RaspberryDebuggerPackage.cs +++ b/RaspberryDebugger/RaspberryDebuggerPackage.cs @@ -70,9 +70,9 @@ internal sealed class RaspberryDebuggerPackage : AsyncPackage public const int DebugStartWithoutDebuggingCommandId = 0x0201; public const int DebugAttachToProcessCommandId = 0x0202; - private static object debugSyncLock = new object(); + private static readonly object debugSyncLock = new object(); private static IVsOutputWindowPane debugPane = null; - private static Queue debugLogQueue = new Queue(); + private static readonly Queue debugLogQueue = new Queue(); /// /// Returns the package instance. @@ -130,7 +130,7 @@ public static void Log(string text) while (debugLogQueue.Count > 0) { - debugPane.OutputString(debugLogQueue.Dequeue()); + _ = debugPane.OutputStringThreadSafe(debugLogQueue.Dequeue()); } } }); @@ -144,7 +144,9 @@ public static void Log(string text) private CommandEvents debugStartWithoutDebuggingCommandEvent; private CommandEvents debugAttachToProcessCommandEvent; private CommandEvents debugRestartCommandEvent; - private bool debugMode = false; +#pragma warning disable IDE0051 // Remove unused private members + private readonly bool debugMode = false; +#pragma warning restore IDE0051 // Remove unused private members /// /// Initializes the package. From 3e9dec02e57d2938480b16688b408c3d58d5acc0 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sun, 3 Apr 2022 15:16:39 +0200 Subject: [PATCH 036/278] Mark fields as readonly --- NuGet.Config | 6 ++++++ .../Commands/DebugAttachToProcessCommand.cs | 6 +++++- RaspberryDebugger/RaspberryDebuggerPackage.cs | 10 ++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 NuGet.Config diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 0000000..3f0e003 --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/RaspberryDebugger/Commands/DebugAttachToProcessCommand.cs b/RaspberryDebugger/Commands/DebugAttachToProcessCommand.cs index e1a98b7..845b10d 100644 --- a/RaspberryDebugger/Commands/DebugAttachToProcessCommand.cs +++ b/RaspberryDebugger/Commands/DebugAttachToProcessCommand.cs @@ -48,7 +48,9 @@ namespace RaspberryDebugger /// internal sealed class DebugAttachToProcessCommand { - private DTE2 dte; +#pragma warning disable IDE0052 // Remove unread private members + private readonly DTE2 dte; +#pragma warning restore IDE0052 // Remove unread private members /// /// Command ID. @@ -95,7 +97,9 @@ private DebugAttachToProcessCommand(AsyncPackage package, OleMenuCommandService /// /// Gets the service provider from the owner package. /// +#pragma warning disable IDE0051 // Remove unused private members private Microsoft.VisualStudio.Shell.IAsyncServiceProvider ServiceProvider => this.package; +#pragma warning restore IDE0051 // Remove unused private members /// /// Initializes the singleton instance of the command. diff --git a/RaspberryDebugger/RaspberryDebuggerPackage.cs b/RaspberryDebugger/RaspberryDebuggerPackage.cs index 9b70405..8f1ab33 100644 --- a/RaspberryDebugger/RaspberryDebuggerPackage.cs +++ b/RaspberryDebugger/RaspberryDebuggerPackage.cs @@ -70,9 +70,9 @@ internal sealed class RaspberryDebuggerPackage : AsyncPackage public const int DebugStartWithoutDebuggingCommandId = 0x0201; public const int DebugAttachToProcessCommandId = 0x0202; - private static object debugSyncLock = new object(); + private static readonly object debugSyncLock = new object(); private static IVsOutputWindowPane debugPane = null; - private static Queue debugLogQueue = new Queue(); + private static readonly Queue debugLogQueue = new Queue(); /// /// Returns the package instance. @@ -130,7 +130,7 @@ public static void Log(string text) while (debugLogQueue.Count > 0) { - debugPane.OutputString(debugLogQueue.Dequeue()); + debugPane.OutputStringThreadSafe(debugLogQueue.Dequeue()); } } }); @@ -144,7 +144,9 @@ public static void Log(string text) private CommandEvents debugStartWithoutDebuggingCommandEvent; private CommandEvents debugAttachToProcessCommandEvent; private CommandEvents debugRestartCommandEvent; - private bool debugMode = false; +#pragma warning disable IDE0051 // Remove unused private members + private readonly bool debugMode = false; +#pragma warning restore IDE0051 // Remove unused private members /// /// Initializes the package. From 206db44f51acde59a84adb76c924a3ac077aba17 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sun, 3 Apr 2022 16:35:09 +0200 Subject: [PATCH 037/278] Add NuGet manifest --- RaspberryDebugger/source.extension.vsixmanifest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RaspberryDebugger/source.extension.vsixmanifest b/RaspberryDebugger/source.extension.vsixmanifest index fa08012..7c3d85f 100644 --- a/RaspberryDebugger/source.extension.vsixmanifest +++ b/RaspberryDebugger/source.extension.vsixmanifest @@ -1,14 +1,14 @@ - + Raspberry Debugger The Raspberry Debugger extension provides an easy way to debug your Raspberry .NET 6 applications on a real Raspberry Pi using Visual Studio 2022. Raspberry Debugger forked from nforgeio/RaspberryDebugger https://github.com/StanDeMan/RaspberryDebugger license.txt https://github.com/nforgeio/RaspberryDebugger - https://github.com/nforgeio/RaspberryDebugger/releases/tag/v2.0 + https://github.com/nforgeio/RaspberryDebugger/releases/tag/v2.1 packageicon.png raspberry pi debugger for visual studio 2022 From e1486d27e6561d24c05f08f4791513c3c86f75d3 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sun, 3 Apr 2022 16:48:15 +0200 Subject: [PATCH 038/278] Upgrade to actual .net versions --- RaspberryDebugger/sdk-catalog.json | 50 +++++++++++++++--------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/RaspberryDebugger/sdk-catalog.json b/RaspberryDebugger/sdk-catalog.json index 2faa46b..c44c3e5 100644 --- a/RaspberryDebugger/sdk-catalog.json +++ b/RaspberryDebugger/sdk-catalog.json @@ -1,46 +1,46 @@ { "Items": [ { - "Name": "3.1.415", - "Version": "3.1.21", + "Name": "3.1.417", + "Version": "3.1.23", "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/e401b906-4681-437b-a1c5-21a2d7e0f83c/824371926ae334ac264b91d8234b350c/dotnet-sdk-3.1.415-linux-arm.tar.gz", - "SHA512": "b738f0b4455b926b8fafa9699525cebbf51eaad7bbe0e77267640a3fe33645ab4901552008de0a9916f55d0eff1de61c22ebd432a5a1fb5099f0cfa1b33a5e75" + "Link": "https://download.visualstudio.microsoft.com/download/pr/36a601f0-b88e-41ea-910b-4dde7b083e73/61ec8564d50fb391f9e3a10b226fdd0d/dotnet-sdk-3.1.417-linux-arm.tar.gz", + "SHA512": "d68f9b130f4a516cb199c9010a42acdda0c9e8c705bce0e72e9854587ee54f5a017b1cea5b84f15dae057531a8a619cffffa1e79f3413d376ba7d7226407574c" }, { - "Name": "3.1.415", - "Version": "3.1.21", + "Name": "3.1.417", + "Version": "3.1.23", "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/4a78a923-e891-40fe-88d2-4bff2c90519f/126bee4399caeabde4f34f4ace7f44e3/dotnet-sdk-3.1.415-linux-arm64.tar.gz", - "SHA512": "7a5b9922988bcbde63d39f97e283ca1d373d5521cca0ab8946e2f86deaef6e21f00244228a0d5d8c38c2b9634b38bc7338b61984f0e12dd8fdb8b2e6eed5dd34" + "Link": "https://download.visualstudio.microsoft.com/download/pr/d8cdb908-9a61-45e9-8cac-1899af7b49b4/0f815fae130481a31fed4d9d1ad5b217/dotnet-sdk-3.1.417-linux-x64.tar.gz", + "SHA512": "8eb1002ad829ddd17638b942d3f8da24ad71ccab268a92a1fa6af6a65d86a4ab7f885f663ea9c68127bb356462bce125222ec4f04dc928005cbbbb1a8658f107" }, { - "Name": "5.0.403", - "Version": "5.0.12", + "Name": "5.0.406", + "Version": "5.0.15", "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/93c86ea7-b04e-4d0f-b65a-3a982768e215/285ab1a46d5c4f2067f86f575262c79f/dotnet-sdk-5.0.403-linux-arm.tar.gz", - "SHA512": "1b7b4a8aea62a7fd1e1919710b2b35b41ae31a64f79b4cc056a3e5f4778bb6cc0b92999321e1632f29a1eb88d734e44fc42eea52ddfb8aa0424cafd9796a503c" + "Link": "https://download.visualstudio.microsoft.com/download/pr/2c48a0d4-02cc-4f2c-b1ae-2770e6cf5806/439af3e6ab59fbce0108ee65e151546c/dotnet-sdk-5.0.406-linux-arm.tar.gz", + "SHA512": "7ac3e2532de5a6b41f379fee445d85040bd033799d525d021b8d582e97c22cc24b3ddfac90e222944a36e6f01538b9906b58cb0bd3c09a8cc56fb82fed8f6a79" }, { - "Name": "5.0.403", - "Version": "5.0.12", + "Name": "5.0.406", + "Version": "5.0.15", "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/91015c72-ce5a-4840-9e87-5bfa4bb80224/b39692ac418d790ff7a2e092eb07de98/dotnet-sdk-5.0.403-linux-arm64.tar.gz", - "SHA512": "6cc705fe45c0d8df6a493eb2923539ef5b62d048d5218859bf3af06fb3934c9c716c16f98ee1a28c818d77adff8430bf39a2ae54a59a1468b704b4ba192234ac" + "Link": "https://download.visualstudio.microsoft.com/download/pr/c4ae19f7-103c-4723-a1a2-f379226664a2/cb31a7dbd166b7e0003129c44845843b/dotnet-sdk-5.0.406-linux-arm64.tar.gz", + "SHA512": "df52611b3135650322030d18c685fa6d0fc0adabae976ea9509ab3e4daa306098b3e4dca31f1950c573dbadf7cfcffacc6ad609c893ec31bbb4df897548651cf" }, { - "Name": "6.0.100", - "Version": "6.0.0", + "Name": "6.0.201", + "Version": "6.0.3", "Architecture": "ARM32", - "Link": "https://download.visualstudio.microsoft.com/download/pr/1f85b038-9917-4d0a-8485-5dc86510eec7/a7555924fe292c6c2140893f066abe65/dotnet-sdk-6.0.100-linux-arm.tar.gz", - "SHA512": "c1e555893c48c4f4256d3e6b1d36b31d8a4d7763a6e958fb63dd31436c660648d481612b5e25d79a613e84a1954f5eac2c9c2b740bf410958172780f7bbeaeb3" + "Link": "https://download.visualstudio.microsoft.com/download/pr/eefec3fa-c4c3-454d-bd7d-8fda31d15e5f/62668641ffc94db5fa11187f14a981f8/dotnet-sdk-6.0.201-linux-arm.tar.gz", + "SHA512": "5a683430325a90dd1d8e0071a1868939fb01268f9eb389ca1dc40956fde6b9f45bec086553ad3333139e530dfe5afae48195bcdfec388b0b568989924a1f1dd7" }, { - "Name": "6.0.100", - "Version": "6.0.0", + "Name": "6.0.201", + "Version": "6.0.3", "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/adcd9310-5072-4179-9b8b-16563b897995/15a7595966f488c74909e4a9273c0e24/dotnet-sdk-6.0.100-linux-arm64.tar.gz", - "SHA512": "e5983c1c599d6dc7c3c7496b9698e47c68247f04a5d0d1e3162969d071471297bce1c2fd3a1f9fb88645006c327ae79f880dcbdd8eefc9166fd717331f2716e7" + "Link": "https://download.visualstudio.microsoft.com/download/pr/33c6e1e3-e81f-44e8-9de8-91934fba3c94/9105f95a9e37cda6bd0c33651be2b90a/dotnet-sdk-6.0.201-linux-arm64.tar.gz,", + "SHA512": "2ea443c27ab7ca9d566e4df0e842063642394fd22fe2a8620371171c8207ae6a4a72c8c54fc6af5b6b053be25cf9c09a74504f08b963e5bd84544619aed9afc2" } ] -} +} \ No newline at end of file From da9acbcb4b2089925f4ac6bf013597bffb524662 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sun, 3 Apr 2022 20:05:25 +0200 Subject: [PATCH 039/278] App previous .NET 6 version --- RaspberryDebugger/sdk-catalog.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/RaspberryDebugger/sdk-catalog.json b/RaspberryDebugger/sdk-catalog.json index c44c3e5..2ee5a96 100644 --- a/RaspberryDebugger/sdk-catalog.json +++ b/RaspberryDebugger/sdk-catalog.json @@ -28,6 +28,13 @@ "Link": "https://download.visualstudio.microsoft.com/download/pr/c4ae19f7-103c-4723-a1a2-f379226664a2/cb31a7dbd166b7e0003129c44845843b/dotnet-sdk-5.0.406-linux-arm64.tar.gz", "SHA512": "df52611b3135650322030d18c685fa6d0fc0adabae976ea9509ab3e4daa306098b3e4dca31f1950c573dbadf7cfcffacc6ad609c893ec31bbb4df897548651cf" }, + { + "Name": "6.0.100", + "Version": "6.0.0", + "Architecture": "ARM32", + "Link": "https://download.visualstudio.microsoft.com/download/pr/1f85b038-9917-4d0a-8485-5dc86510eec7/a7555924fe292c6c2140893f066abe65/dotnet-sdk-6.0.100-linux-arm.tar.gz", + "SHA512": "c1e555893c48c4f4256d3e6b1d36b31d8a4d7763a6e958fb63dd31436c660648d481612b5e25d79a613e84a1954f5eac2c9c2b740bf410958172780f7bbeaeb3" + }, { "Name": "6.0.201", "Version": "6.0.3", From c6839a95fed20fbf075e600a49034ce21bc77330 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Mon, 4 Apr 2022 21:47:22 +0200 Subject: [PATCH 040/278] property hint RuntimeIdentifier property hint --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 3a7415d..ff6e36e 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,13 @@ _A Visual Studio Extension for debugging .NET Core applications remotely on a Ra **IMPORTANT:** .NET 6.0 starting with the SDK 6.0.100 works now and can be ONLY used in Visual Studio 2022 for the first! +For Asp.NET debugging set the runtime identifier project property to: + + + ... + linux-arm + + --- You can use Visual Studio Code to develop and debug .NET Core applications either directly on your Raspberry or remotely from another computer but until today, there's been no easy way to use regular Visual Studio to develop and debug applications for Raspberry. From 81e511b9a0a4cab5a2b009fe10b69156f8ce9edd Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Mon, 4 Apr 2022 21:48:11 +0200 Subject: [PATCH 041/278] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ff6e36e..d1aa0d0 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,10 @@ _A Visual Studio Extension for debugging .NET Core applications remotely on a Ra For Asp.NET debugging set the runtime identifier project property to: - - ... - linux-arm - +> +> ... +> linux-arm +> --- From 3cecad2fa8198453bf0ea3a5fdf69b20f31d23da Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Mon, 4 Apr 2022 21:49:48 +0200 Subject: [PATCH 042/278] Update README.md --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d1aa0d0..ce977b6 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,12 @@ _A Visual Studio Extension for debugging .NET Core applications remotely on a Ra For Asp.NET debugging set the runtime identifier project property to: -> -> ... -> linux-arm -> - +``` + + ... + linux-arm + +``` --- You can use Visual Studio Code to develop and debug .NET Core applications either directly on your Raspberry or remotely from another computer but until today, there's been no easy way to use regular Visual Studio to develop and debug applications for Raspberry. From 928910cd5c8c3244a70ababb7458b4066f22ca3a Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Mon, 4 Apr 2022 21:51:35 +0200 Subject: [PATCH 043/278] add link add link for RID explanation --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ce977b6..ba57241 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ For Asp.NET debugging set the runtime identifier project property to: linux-arm ``` +https://docs.microsoft.com/de-de/dotnet/core/rid-catalog --- You can use Visual Studio Code to develop and debug .NET Core applications either directly on your Raspberry or remotely from another computer but until today, there's been no easy way to use regular Visual Studio to develop and debug applications for Raspberry. From 25411f6ea4fdfe3441085365d6964e647e5ebd32 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Mon, 4 Apr 2022 21:52:24 +0200 Subject: [PATCH 044/278] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index ba57241..d68635f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ _A Visual Studio Extension for debugging .NET Core applications remotely on a Raspberry Pi_ --- - **IMPORTANT:** .NET 6.0 starting with the SDK 6.0.100 works now and can be ONLY used in Visual Studio 2022 for the first! For Asp.NET debugging set the runtime identifier project property to: @@ -13,8 +12,8 @@ For Asp.NET debugging set the runtime identifier project property to: linux-arm ``` -https://docs.microsoft.com/de-de/dotnet/core/rid-catalog --- +https://docs.microsoft.com/de-de/dotnet/core/rid-catalog You can use Visual Studio Code to develop and debug .NET Core applications either directly on your Raspberry or remotely from another computer but until today, there's been no easy way to use regular Visual Studio to develop and debug applications for Raspberry. From df28148ad42a92431a15089504ffbbbe7a7ad982 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Mon, 4 Apr 2022 21:54:08 +0200 Subject: [PATCH 045/278] update readme put link into important section --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d68635f..cfd3d46 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ For Asp.NET debugging set the runtime identifier project property to: linux-arm ``` ---- https://docs.microsoft.com/de-de/dotnet/core/rid-catalog +--- You can use Visual Studio Code to develop and debug .NET Core applications either directly on your Raspberry or remotely from another computer but until today, there's been no easy way to use regular Visual Studio to develop and debug applications for Raspberry. From 6d4a5ba7276d971e37992f68497613603d806105 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Mon, 4 Apr 2022 21:57:53 +0200 Subject: [PATCH 046/278] uodate readme -extend Asp.NET debugging with property info --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index cfd3d46..1eb0019 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,15 @@ When debugging .NET Core Console projects, you can pass command line arguments a When debugging ASPNET projects, you can pass command line arguments and environment variables to the remote program and you also have the option to start a browser on your workstation and have it display a page from your application. +For Asp.NET debugging set the runtime identifier project property to: + +``` + + ... + linux-arm + +``` + Your web application will be deployed on your Raspberry on all network interfaces, using the port specified by the **App URL**. ![Screenshot](/Doc/Images/GettingStarted/AspNetProperties.png?raw=true) From dd74352cc52977dbd1f824ac73b64363903bcca0 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Wed, 13 Apr 2022 23:47:12 +0200 Subject: [PATCH 047/278] Update readme remove known issue - solved --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 1eb0019..42d456b 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ You can use Visual Studio Code to develop and debug .NET Core applications eithe The new **Raspberry Debugger** Visual Studio extension allows you to code your application on a Windows workstation and then build and debug it on a Raspberry by just pressing **F5 - Start Debugging**. ### Known Issues -* ASP.NET with wwwroot path - debugging not working, because of this (ASP.NET 6?) error: Absolute Path required - - @community: feel free to solve this issue, please! * Only one project in an solution gets transferred to Raspberry Pi ### Requirements From 81f50e8503d80fda9b015658b2425faac61cd2fa Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sun, 1 May 2022 19:23:43 +0200 Subject: [PATCH 048/278] Typo: remove semicolon from sdk catalog --- RaspberryDebugger/sdk-catalog.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RaspberryDebugger/sdk-catalog.json b/RaspberryDebugger/sdk-catalog.json index 2ee5a96..d7688ac 100644 --- a/RaspberryDebugger/sdk-catalog.json +++ b/RaspberryDebugger/sdk-catalog.json @@ -43,11 +43,11 @@ "SHA512": "5a683430325a90dd1d8e0071a1868939fb01268f9eb389ca1dc40956fde6b9f45bec086553ad3333139e530dfe5afae48195bcdfec388b0b568989924a1f1dd7" }, { - "Name": "6.0.201", - "Version": "6.0.3", + "Name": "6.0.202", + "Version": "6.0.4", "Architecture": "ARM64", - "Link": "https://download.visualstudio.microsoft.com/download/pr/33c6e1e3-e81f-44e8-9de8-91934fba3c94/9105f95a9e37cda6bd0c33651be2b90a/dotnet-sdk-6.0.201-linux-arm64.tar.gz,", - "SHA512": "2ea443c27ab7ca9d566e4df0e842063642394fd22fe2a8620371171c8207ae6a4a72c8c54fc6af5b6b053be25cf9c09a74504f08b963e5bd84544619aed9afc2" + "Link": "https://download.visualstudio.microsoft.com/download/pr/952f5525-7227-496f-85e5-09cadfb44629/eefd0f6eb8f809bfaf4f0661809ed826/dotnet-sdk-6.0.202-linux-arm64.tar.gz", + "SHA512": "2d0021bb4cd221ffba6888dbd6300e459f45f4f9d3cf7323f3b97ee0f093ef678f5a36d1c982296f4e15bbcbd7275ced72c3e9b2fc754039ba663d0612ffd866" } ] } \ No newline at end of file From 47e80110a0867aef5483652bea5b569aaa51c0ae Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sun, 1 May 2022 19:25:13 +0200 Subject: [PATCH 049/278] Remove ARM32 architecture checks --- RaspberryDebugger/DebugHelper.cs | 7 ++----- RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/RaspberryDebugger/DebugHelper.cs b/RaspberryDebugger/DebugHelper.cs index f50ac63..a29fc28 100644 --- a/RaspberryDebugger/DebugHelper.cs +++ b/RaspberryDebugger/DebugHelper.cs @@ -490,16 +490,13 @@ public static Sdk GetTargetSdk(ProjectProperties projectProperties) // We're just going to return a matching SDK from the catalog (if it exists). // Note that there be maore than one match a standalone SDK or one that ships // with Visual Studio. We'll favor the standalone one if possible. + var sdkItem = PackageHelper.SdkGoodCatalog.Items.SingleOrDefault(item => item.Version == projectProperties.SdkVersion && item.IsStandalone); - var sdkItem = PackageHelper.SdkGoodCatalog.Items.SingleOrDefault(item => item.Version == projectProperties.SdkVersion && - item.IsStandalone && - item.Architecture == SdkArchitecture.ARM32); if (sdkItem == null) { // Look for a Visual Studio SDK instead. - sdkItem = PackageHelper.SdkGoodCatalog.Items.SingleOrDefault(item => item.Version == projectProperties.SdkVersion && - item.Architecture == SdkArchitecture.ARM32); + sdkItem = PackageHelper.SdkGoodCatalog.Items.SingleOrDefault(item => item.Version == projectProperties.SdkVersion); } if (sdkItem == null) diff --git a/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs b/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs index 89a261c..643558b 100644 --- a/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs +++ b/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs @@ -132,7 +132,7 @@ public static ProjectProperties CopyFrom(Solution solution, Project project) var targetSdkVersion = (SemanticVersion)null; foreach (var sdkItem in PackageHelper.SdkGoodCatalog.Items - .Where(item => item.IsStandalone && item.Architecture == SdkArchitecture.ARM32)) + .Where(item => item.IsStandalone)) { var sdkVersion = SemanticVersion.Parse(sdkItem.Version); @@ -144,7 +144,7 @@ public static ProjectProperties CopyFrom(Solution solution, Project project) if (targetSdkVersion == null || sdkVersion > targetSdkVersion) { targetSdkVersion = sdkVersion; - targetSdk = new Sdk(sdkItem.Name, sdkItem.Version);; + targetSdk = new Sdk(sdkItem.Name, sdkItem.Version); } } From 5854939326af36617200569a67f3c802f6408e9a Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Tue, 3 May 2022 02:57:40 +0200 Subject: [PATCH 050/278] Remove GetTargetSdk --- RaspberryDebugger/DebugHelper.cs | 49 +++----------------------------- 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/RaspberryDebugger/DebugHelper.cs b/RaspberryDebugger/DebugHelper.cs index a29fc28..47e3ac7 100644 --- a/RaspberryDebugger/DebugHelper.cs +++ b/RaspberryDebugger/DebugHelper.cs @@ -478,43 +478,6 @@ public static ConnectionInfo GetDebugConnectionInfo(ProjectProperties projectPro return connectionInfo; } - /// - /// Determine which .NET SDK we should target for the project. - /// - /// The project properties. - /// The target or null when one could not be located. - public static Sdk GetTargetSdk(ProjectProperties projectProperties) - { - Covenant.Requires(projectProperties != null, nameof(projectProperties)); - - // We're just going to return a matching SDK from the catalog (if it exists). - // Note that there be maore than one match a standalone SDK or one that ships - // with Visual Studio. We'll favor the standalone one if possible. - var sdkItem = PackageHelper.SdkGoodCatalog.Items.SingleOrDefault(item => item.Version == projectProperties.SdkVersion && item.IsStandalone); - - if (sdkItem == null) - { - // Look for a Visual Studio SDK instead. - - sdkItem = PackageHelper.SdkGoodCatalog.Items.SingleOrDefault(item => item.Version == projectProperties.SdkVersion); - } - - if (sdkItem == null) - { - MessageBoxEx.Show( - $".NET Core SDK [v{projectProperties.SdkVersion}] is unknown to the Raspberry Debugger. Please submit an issue at:\r\n\r\n{PackageHelper.GitHubIssuesUri}", - "Unknown .NET Core SDK", - MessageBoxButtons.OK, - MessageBoxIcon.Error); - - return null; - } - else - { - return new Sdk(sdkItem.Name, sdkItem.Version); - } - } - /// /// Establishes a connection to the Raspberry and ensures that the Raspberry has /// the target SDK, vsdbg installed and also handles uploading of the project @@ -525,10 +488,9 @@ public static Sdk GetTargetSdk(ProjectProperties projectProperties) /// The project properties. /// The project's Raspberry debug settings. /// The or null if there was an error. - public static async Task InitializeConnectionAsync(ConnectionInfo connectionInfo, Sdk targetSdk, ProjectProperties projectProperties, ProjectSettings projectSettings) + public static async Task InitializeConnectionAsync(ConnectionInfo connectionInfo, ProjectProperties projectProperties, ProjectSettings projectSettings) { Covenant.Requires(connectionInfo != null, nameof(connectionInfo)); - Covenant.Requires(targetSdk != null, nameof(targetSdk)); Covenant.Requires(projectProperties != null, nameof(projectProperties)); Covenant.Requires(projectSettings != null, nameof(projectSettings)); @@ -551,15 +513,14 @@ public static async Task InitializeConnectionAsync(ConnectionInfo co connection.Dispose(); return null; } - + // Ensure that the SDK is installed. - - if (!await connection.InstallSdkAsync(targetSdk.Version)) + if (!await connection.InstallSdkAsync()) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); MessageBoxEx.Show( - $"Cannot install the .NET SDK [v{targetSdk.Version}] on the Raspberry.\r\n\r\nCheck the Debug Output for more details.", + $"Cannot install the .NET SDK [v{connection.PiStatus}] on the Raspberry.\r\n\r\nCheck the Debug Output for more details.", "SDK Installation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -569,7 +530,6 @@ public static async Task InitializeConnectionAsync(ConnectionInfo co } // Ensure that the debugger is installed. - if (!await connection.InstallDebuggerAsync()) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); @@ -585,7 +545,6 @@ public static async Task InitializeConnectionAsync(ConnectionInfo co } // Upload the program binaries. - if (!await connection.UploadProgramAsync(projectProperties.Name, projectProperties.AssemblyName, projectProperties.PublishFolder)) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); From 490b0adbe4912c2d1c64d19755a8ed89618a99c2 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Tue, 3 May 2022 02:58:16 +0200 Subject: [PATCH 051/278] Extend Sdk with architecture --- RaspberryDebugger/Connection/Sdk.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/RaspberryDebugger/Connection/Sdk.cs b/RaspberryDebugger/Connection/Sdk.cs index a4d8a4f..74b236a 100644 --- a/RaspberryDebugger/Connection/Sdk.cs +++ b/RaspberryDebugger/Connection/Sdk.cs @@ -41,12 +41,14 @@ internal class Sdk /// /// The SDK name. /// The SDK version. - public Sdk(string name, string version) + /// The SDK bitness architecture. + public Sdk(string name, string version, SdkArchitecture architecture = SdkArchitecture.ARM32) { Covenant.Requires(!string.IsNullOrEmpty(name), nameof(name)); this.Name = name; this.Version = version; + this.Architecture = architecture; } /// @@ -58,5 +60,7 @@ public Sdk(string name, string version) /// Returns thge version of the SDK (like 3.1.8). /// public string Version { get; private set; } + + public SdkArchitecture Architecture { get; private set; } } } From 2296fc6335384a0894597ecc4331912bd0659547 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Tue, 3 May 2022 02:58:56 +0200 Subject: [PATCH 052/278] Create EnumMemberAttributeExtension --- RaspberryDebugger/Extensions/Extension.cs | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 RaspberryDebugger/Extensions/Extension.cs diff --git a/RaspberryDebugger/Extensions/Extension.cs b/RaspberryDebugger/Extensions/Extension.cs new file mode 100644 index 0000000..4d744fd --- /dev/null +++ b/RaspberryDebugger/Extensions/Extension.cs @@ -0,0 +1,26 @@ +using System; +using System.Linq; +using System.Reflection; +using System.Runtime.Serialization; + +namespace RaspberryDebugger.Extensions +{ + public static class EnumMemberAttributeExtension + { + /// + /// Gets the type of the attribute of. + /// + /// + /// The enum value. + /// value + public static T GetAttributeOfType(this Enum enumVal) where T : Attribute + { + var memInfo = enumVal.GetType().GetMember(enumVal.ToString()); + var attributes = memInfo[0].GetCustomAttributes(typeof(T), false); + + return (attributes.Length > 0) + ? (T)attributes[0] + : null; + } + } +} From 35a3d6dd627e52f26bc73df64f95030b7e9bc65e Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Tue, 3 May 2022 02:59:58 +0200 Subject: [PATCH 053/278] Extend with Platform enum for bitness --- .../Commands/DebugStartCommand.cs | 20 +- RaspberryDebugger/Connection/Connection.cs | 398 +++++++++--------- .../Models/Sdk/SdkArchitecture.cs | 15 + .../Models/VisualStudio/ProjectProperties.cs | 2 +- RaspberryDebugger/RaspberryDebugger.csproj | 2 + 5 files changed, 218 insertions(+), 219 deletions(-) diff --git a/RaspberryDebugger/Commands/DebugStartCommand.cs b/RaspberryDebugger/Commands/DebugStartCommand.cs index ebab53d..011643f 100644 --- a/RaspberryDebugger/Commands/DebugStartCommand.cs +++ b/RaspberryDebugger/Commands/DebugStartCommand.cs @@ -130,20 +130,8 @@ private async void Execute(object sender, EventArgs e) return; } - // Identify the most recent SDK installed on the workstation that has the same - // major and minor version numbers as the project. We'll ensure that the same - // SDK is installed on the Raspberry (further below). - - var targetSdk = DebugHelper.GetTargetSdk(projectProperties); - - if (targetSdk == null) - { - return; - } - // Establish a Raspberry connection to handle some things before we start the debugger. - - var connection = await DebugHelper.InitializeConnectionAsync(connectionInfo, targetSdk, projectProperties, PackageHelper.GetProjectSettings(dte.Solution, project)); + var connection = await DebugHelper.InitializeConnectionAsync(connectionInfo, projectProperties, PackageHelper.GetProjectSettings(dte.Solution, project)); if (connection == null) { @@ -169,10 +157,9 @@ private async void Execute(object sender, EventArgs e) // Launch the browser for ASPNET apps if requested. Note that we're going to do this // on a background task to poll the Raspberry, waiting for the app to create the create // the LISTENING socket. - - if (!projectProperties.IsAspNet || !projectProperties.AspLaunchBrowser) return; + if (!projectProperties.IsAspNet || !projectProperties.AspLaunchBrowser) + return; - //var baseUri = $"http://{connection.Address}:{projectProperties.AspPort}"; var baseUri = $"http://{connection.Name}.local"; var launchReady = false; @@ -183,7 +170,6 @@ await NeonHelper.WaitForAsync( { // The developer must have stopped debugging before the ASPNET // application was able to begin servicing requests. - return true; } diff --git a/RaspberryDebugger/Connection/Connection.cs b/RaspberryDebugger/Connection/Connection.cs index 7bec822..fb7c124 100644 --- a/RaspberryDebugger/Connection/Connection.cs +++ b/RaspberryDebugger/Connection/Connection.cs @@ -22,12 +22,14 @@ using System.IO; using System.Linq; using System.Net; +using System.Runtime.Serialization; using System.Threading.Tasks; using Neon.Common; using Neon.IO; using Neon.Net; using Neon.SSH; +using RaspberryDebugger.Extensions; using Renci.SshNet.Common; namespace RaspberryDebugger @@ -130,17 +132,18 @@ public static async Task ConnectAsync(ConnectionInfo connectionInfo, var homeFolder = LinuxPath.Combine("/", "home", connectionInfo.User); var publicKey = File.ReadAllText(connectionInfo.PublicKeyPath).Trim(); var keyScript = -$@" -mkdir -p {homeFolder}/.ssh -touch {homeFolder}/.ssh/authorized_keys + $@" + mkdir -p {homeFolder}/.ssh + touch {homeFolder}/.ssh/authorized_keys -if ! grep --quiet '{publicKey}' {homeFolder}/.ssh/authorized_keys ; then - echo '{publicKey}' >> {homeFolder}/.ssh/authorized_keys - exit $? -fi + if ! grep --quiet '{publicKey}' {homeFolder}/.ssh/authorized_keys ; then + echo '{publicKey}' >> {homeFolder}/.ssh/authorized_keys + exit $? + fi + + exit 0 + "; -exit 0 -"; connection.ThrowOnError(connection.RunCommand(CommandBundle.FromScript(keyScript))); return connection; } @@ -305,94 +308,95 @@ await PackageHelper.ExecuteWithProgressAsync( Log($"[{Name}]: Retrieving status"); var statusScript = -$@" -# This script will return the status information via STDOUT line-by-line -# in this order: -# -# Chip Architecture -# PATH environment variable -# Unzip Installed (""unzip"" or ""unzip-missing"") -# Debugger Installed (""debugger-installed"" or ""debugger-missing"") -# List of installed SDKs names (e.g. 3.1.108) separated by commas -# Raspberry Model like: Raspberry Pi 4 Model B Rev 1.2 -# Raspberry Revision like: c03112 -# -# This script also ensures that the [/lib/dotnet] directory exists, that -# it has reasonable permissions, and that the folder exists on the system -# PATH and that DOTNET_ROOT points to the folder. + $@" + # This script will return the status information via STDOUT line-by-line + # in this order: + # + # Chip Architecture + # PATH environment variable + # Unzip Installed (""unzip"" or ""unzip-missing"") + # Debugger Installed (""debugger-installed"" or ""debugger-missing"") + # List of installed SDKs names (e.g. 3.1.108) separated by commas + # Raspberry Model like: Raspberry Pi 4 Model B Rev 1.2 + # Raspberry Revision like: c03112 + # + # This script also ensures that the [/lib/dotnet] directory exists, that + # it has reasonable permissions, and that the folder exists on the system + # PATH and that DOTNET_ROOT points to the folder. + + # Set the SDK and debugger installation paths. -# Set the SDK and debugger installation paths. + DOTNET_ROOT={PackageHelper.RemoteDotnetFolder} + DEBUGFOLDER={PackageHelper.RemoteDebuggerFolder} -DOTNET_ROOT={PackageHelper.RemoteDotnetFolder} -DEBUGFOLDER={PackageHelper.RemoteDebuggerFolder} + # Get the chip architecture -# Get the chip architecture + uname -m -uname -m + # Get the current PATH -# Get the current PATH + echo $PATH -echo $PATH + # Detect whether [unzip] is installed. -# Detect whether [unzip] is installed. + if which unzip &> /dev/nul ; then + echo 'unzip' + else + echo 'unzip-missing' + fi -if which unzip &> /dev/nul ; then - echo 'unzip' -else - echo 'unzip-missing' -fi + # Detect whether the [vsdbg] debugger is installed. -# Detect whether the [vsdbg] debugger is installed. + if [ -d $DEBUGFOLDER ] ; then + echo 'debugger-installed' + else + echo 'debugger-missing' + fi -if [ -d $DEBUGFOLDER ] ; then - echo 'debugger-installed' -else - echo 'debugger-missing' -fi + # List the SDK folders. These folder names are the same as the + # corresponding SDK name. We'll list the files on one line + # with the SDK names separated by commas. We'll return a blank + # line if the SDK directory doesn't exist. -# List the SDK folders. These folder names are the same as the -# corresponding SDK name. We'll list the files on one line -# with the SDK names separated by commas. We'll return a blank -# line if the SDK directory doesn't exist. + if [ -d $DOTNET_ROOT/sdk ] ; then + ls -m $DOTNET_ROOT/sdk + else + echo '' + fi -if [ -d $DOTNET_ROOT/sdk ] ; then - ls -m $DOTNET_ROOT/sdk -else - echo '' -fi + # Output the Raspberry board model. -# Output the Raspberry board model. + cat /proc/cpuinfo | grep '^Model\s' | grep -o 'Raspberry.*$' -cat /proc/cpuinfo | grep '^Model\s' | grep -o 'Raspberry.*$' + # Output the Raspberry board revision. -# Output the Raspberry board revision. + cat /proc/cpuinfo | grep 'Revision\s' | grep -o '[0-9a-fA-F]*$' -cat /proc/cpuinfo | grep 'Revision\s' | grep -o '[0-9a-fA-F]*$' + # Ensure that the [/lib/dotnet] folder exists, that it's on the + # PATH and that DOTNET_ROOT are defined. -# Ensure that the [/lib/dotnet] folder exists, that it's on the -# PATH and that DOTNET_ROOT are defined. + mkdir -p /lib/dotnet + chown root:root /lib/dotnet + chmod 755 /lib/dotnet -mkdir -p /lib/dotnet -chown root:root /lib/dotnet -chmod 755 /lib/dotnet + # Set these for the current session: -# Set these for the current session: + export DOTNET_ROOT={PackageHelper.RemoteDotnetFolder} + export PATH=$PATH:$DOTNET_ROOT -export DOTNET_ROOT={PackageHelper.RemoteDotnetFolder} -export PATH=$PATH:$DOTNET_ROOT + # and for future sessions too: -# and for future sessions too: + if ! grep --quiet DOTNET_ROOT /etc/profile ; then -if ! grep --quiet DOTNET_ROOT /etc/profile ; then + echo """" >> /etc/profile + echo ""#------------------------------"" >> /etc/profile + echo ""# Raspberry Debugger:"" >> /etc/profile + echo ""export DOTNET_ROOT=$DOTNET_ROOT"" >> /etc/profile + echo ""export PATH=$PATH"" >> /etc/profile + echo ""#------------------------------"" >> /etc/profile + fi + "; - echo """" >> /etc/profile - echo ""#------------------------------"" >> /etc/profile - echo ""# Raspberry Debugger:"" >> /etc/profile - echo ""export DOTNET_ROOT=$DOTNET_ROOT"" >> /etc/profile - echo ""export PATH=$PATH"" >> /etc/profile - echo ""#------------------------------"" >> /etc/profile -fi -"; Log($"[{Name}]: Fetching status"); response = ThrowOnError(SudoCommand(CommandBundle.FromScript(statusScript))); @@ -417,23 +421,25 @@ chmod 755 /lib/dotnet Log($"[{Name}]: model: {model}"); Log($"[{Name}]: revision: {revision}"); - // Convert the comma separated SDK names into a [PiSdk] list. + // raspberry pi platform architecture + var architectur = architecture.Contains(Platform.Bitness32.GetAttributeOfType().Value) + ? SdkArchitecture.ARM32 + : SdkArchitecture.ARM64; + // Convert the comma separated SDK names into a [PiSdk] list. var sdks = new List(); foreach (var sdkName in sdkLine.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(sdk => sdk.Trim())) { - // $todo(jefflill): We're only supporting 32-bit SDKs at this time. - - var sdkCatalogItem = PackageHelper.SdkCatalog.Items.SingleOrDefault(item => item.Name == sdkName && item.Architecture == SdkArchitecture.ARM32); + var sdkCatalogItem = PackageHelper.SdkCatalog.Items.SingleOrDefault(item => item.Name == sdkName && item.Architecture == architectur); if (sdkCatalogItem != null) { - sdks.Add(new Sdk(sdkName, sdkCatalogItem.Version)); + sdks.Add(new Sdk(sdkName, sdkCatalogItem.Version, architectur)); } else { - LogWarning($".NET SDK [{sdkName}] is present on [{Name}] but is not known to the RaspberryDebugger extension. Consider updating the extension."); + LogWarning($".NET SDK [{sdkName}] is present on [{Name}] but is not known to the RaspberryDebugger extension. Consider updating the extension."); } } @@ -450,7 +456,6 @@ chmod 755 /lib/dotnet }); // Create and configure an SSH key for this connection if one doesn't already exist. - if (string.IsNullOrEmpty(connectionInfo.PrivateKeyPath) || !File.Exists(connectionInfo.PrivateKeyPath)) { await PackageHelper.ExecuteWithProgressAsync("Creating SSH keys...", @@ -472,21 +477,22 @@ await PackageHelper.ExecuteWithProgressAsync("Creating SSH keys...", try { var createKeyScript = -$@" -# Create the key pair + $@" + # Create the key pair -if ! ssh-keygen -t rsa -b 2048 -P '' -C '{workstationUser}@{workstationName}' -f {tempPrivateKeyPath} -m pem ; then - exit 1 -fi + if ! ssh-keygen -t rsa -b 2048 -P '' -C '{workstationUser}@{workstationName}' -f {tempPrivateKeyPath} -m pem ; then + exit 1 + fi -# Append the public key to the user's [authorized_keys] file to enable it. + # Append the public key to the user's [authorized_keys] file to enable it. -mkdir -p {homeFolder}/.ssh -touch {homeFolder}/.ssh/authorized_keys -cat {tempPublicKeyPath} >> {homeFolder}/.ssh/authorized_keys + mkdir -p {homeFolder}/.ssh + touch {homeFolder}/.ssh/authorized_keys + cat {tempPublicKeyPath} >> {homeFolder}/.ssh/authorized_keys + + exit 0 + "; -exit 0 -"; ThrowOnError(RunCommand(CommandBundle.FromScript(createKeyScript))); // Download the public and private keys, persist them to the workstation @@ -516,10 +522,11 @@ exit 0 // Delete the temporary key files on the Raspberry. var removeKeyScript = -$@" -rm -f {tempPrivateKeyPath} -rm -f {tempPublicKeyPath} -"; + $@" + rm -f {tempPrivateKeyPath} + rm -f {tempPublicKeyPath} + "; + ThrowOnError(SudoCommand(CommandBundle.FromScript(removeKeyScript))); } @@ -533,116 +540,104 @@ exit 0 /// /// The SDK version. /// true on success. - public async Task InstallSdkAsync(string sdkVersion) + public async Task InstallSdkAsync() { - Covenant.Requires(!string.IsNullOrEmpty(sdkVersion), nameof(sdkVersion)); - - // $todo(jefflill): - // - // Note that we're going to install that standalone SDK for the SDK - // version rather than the SDK that shipped with Visual Studio. I'm - // assuming that the Visual Studio SDKs might have extra stuff we don't - // need and it's also possible that the Visual Studio SDK for the SDK - // version may not have shipped yet. - // - // We may want to re-evaluate this in the future. + var sdkOnPi = PiStatus.InstalledSdks.FirstOrDefault(); + var sdkVersion = sdkOnPi?.Version ?? String.Empty; + var sdkArchitecture = sdkOnPi?.Architecture ?? SdkArchitecture.ARM32; if (PiStatus.InstalledSdks.Any(sdk => sdk.Version == sdkVersion)) { return await Task.FromResult(true); // Already installed } - - LogInfo($".NET Core SDK [v{sdkVersion}] is not installed."); - + // Locate the standalone SDK for the request .NET version. - - var targetSdk = PackageHelper.SdkGoodCatalog.Items.SingleOrDefault(item => item.IsStandalone && item.Version == sdkVersion && item.Architecture == SdkArchitecture.ARM32); - - if (targetSdk == null) - { - // Fall back to the Visual Studio SDK, if there is one. - - targetSdk = PackageHelper.SdkGoodCatalog.Items.SingleOrDefault(item => item.Version == sdkVersion); - LogInfo($"Cannot find standalone SDK for [{sdkVersion}] for falling back to [{targetSdk.Name}], version [v{targetSdk.Version}]."); - } + // TODO: figure out the latest + var targetSdk = PackageHelper.SdkGoodCatalog.Items + .OrderByDescending(item => item.Version) + .FirstOrDefault(item => item.Architecture == sdkArchitecture); if (targetSdk == null) { - LogError($"RasberryDebug is unaware of .NET Core SDK [v{sdkVersion}]."); + LogError($"RasberryDebug is unaware of .NET Core SDK."); LogError($"Try updating the RasberryDebug extension or report this issue at:"); LogError($"https://github.com/nforgeio/RaspberryDebugger/issues"); return await Task.FromResult(false); } + else + { + LogInfo($".NET Core SDK [v{targetSdk.Version}] is not installed."); + } // Install the SDK. - LogInfo($"Installing SDK v{targetSdk.Version}"); return await PackageHelper.ExecuteWithProgressAsync($"Download and install SDK for .NET v{targetSdk.Version} on Raspberry...", async () => { var installScript = -$@" -export DOTNET_ROOT={PackageHelper.RemoteDotnetFolder} + $@" + export DOTNET_ROOT={PackageHelper.RemoteDotnetFolder} + + # Ensure that the packages required by .NET Core are installed: + # + # https://docs.microsoft.com/en-us/dotnet/core/install/linux-debian#dependencies -# Ensure that the packages required by .NET Core are installed: -# -# https://docs.microsoft.com/en-us/dotnet/core/install/linux-debian#dependencies + if ! apt-get update ; then + exit 1 + fi -if ! apt-get update ; then - exit 1 -fi + if ! apt-get install -yq libc6 libgcc1 libgssapi-krb5-2 libicu-dev libssl1.1 libstdc++6 zlib1g libgdiplus ; then + exit 1 + fi -if ! apt-get install -yq libc6 libgcc1 libgssapi-krb5-2 libicu-dev libssl1.1 libstdc++6 zlib1g libgdiplus ; then - exit 1 -fi + # Remove any existing SDK download. This might be present if a + # previous installation attempt failed. -# Remove any existing SDK download. This might be present if a -# previous installation attempt failed. + if ! rm -f /tmp/dotnet-sdk.tar.gz ; then + exit 1 + fi -if ! rm -f /tmp/dotnet-sdk.tar.gz ; then - exit 1 -fi + # Download the SDK installation file to a temporary file. -# Download the SDK installation file to a temporary file. + if ! wget --quiet -O /tmp/dotnet-sdk.tar.gz {targetSdk.Link} ; then + exit 1 + fi -if ! wget --quiet -O /tmp/dotnet-sdk.tar.gz {targetSdk.Link} ; then - exit 1 -fi + # Verify the SHA512. -# Verify the SHA512. + orgDir=$cwd + cd /tmp -orgDir=$cwd -cd /tmp + if ! echo '{targetSdk.SHA512} dotnet-sdk.tar.gz' | sha512sum --check - ; then + cd $orgDir + exit 1 + fi -if ! echo '{targetSdk.SHA512} dotnet-sdk.tar.gz' | sha512sum --check - ; then - cd $orgDir - exit 1 -fi + cd $orgDir -cd $orgDir + # Make sure the installation directory exists. -# Make sure the installation directory exists. + if ! mkdir -p $DOTNET_ROOT ; then + exit 1 + fi -if ! mkdir -p $DOTNET_ROOT ; then - exit 1 -fi + # Unpack the SDK to the installation directory. -# Unpack the SDK to the installation directory. + if ! tar -zxf /tmp/dotnet-sdk.tar.gz -C $DOTNET_ROOT --no-same-owner ; then + exit 1 + fi -if ! tar -zxf /tmp/dotnet-sdk.tar.gz -C $DOTNET_ROOT --no-same-owner ; then - exit 1 -fi + # Remove the temporary installation file. -# Remove the temporary installation file. + if ! rm /tmp/dotnet-sdk.tar.gz ; then + exit 1 + fi -if ! rm /tmp/dotnet-sdk.tar.gz ; then - exit 1 -fi + exit 0 + "; -exit 0 -"; try { var response = SudoCommand(CommandBundle.FromScript(installScript)); @@ -651,7 +646,7 @@ exit 0 { // Add the newly installed SDK to the list of installed SDKs. - PiStatus.InstalledSdks.Add(new Sdk(targetSdk.Name, targetSdk.Version)); + PiStatus.InstalledSdks.Add(new Sdk(targetSdk.Name, targetSdk.Version, targetSdk.Architecture)); return await Task.FromResult(true); } else @@ -685,13 +680,14 @@ public async Task InstallDebuggerAsync() async () => { var installScript = -$@" -if ! curl -sSL https://aka.ms/getvsdbgsh | /bin/sh /dev/stdin -v latest -l {PackageHelper.RemoteDebuggerFolder} ; then - exit 1 -fi + $@" + if ! curl -sSL https://aka.ms/getvsdbgsh | /bin/sh /dev/stdin -v latest -l {PackageHelper.RemoteDebuggerFolder} ; then + exit 1 + fi + + exit 0 + "; -exit 0 -"; try { var response = SudoCommand(CommandBundle.FromScript(installScript)); @@ -743,47 +739,47 @@ public async Task UploadProgramAsync(string programName, string assemblyNa if (!string.IsNullOrEmpty(projectSettings.TargetGroup)) { groupScript = -$@" -# Add the program assembly to the user specified target group (if any). This -# defaults to [gpio] so users will be able to access the GPIO pins. - -if ! chgrp {projectSettings.TargetGroup} {debugFolder}/{assemblyName} ; then - exit 1 -fi -"; + $@" + # Add the program assembly to the user specified target group (if any). This + # defaults to [gpio] so users will be able to access the GPIO pins. + + if ! chgrp {projectSettings.TargetGroup} {debugFolder}/{assemblyName} ; then + exit 1 + fi + "; } var uploadScript = -$@" + $@" -# Ensure that the debug folder exists. + # Ensure that the debug folder exists. -if ! mkdir -p {debugFolder} ; then - exit 1 -fi + if ! mkdir -p {debugFolder} ; then + exit 1 + fi -# Clear all existing program files. + # Clear all existing program files. -if ! rm -rf {debugFolder}/* ; then - exit 1 -fi + if ! rm -rf {debugFolder}/* ; then + exit 1 + fi -# Unzip the binary and other files to the debug folder. + # Unzip the binary and other files to the debug folder. -if ! unzip program.zip -d {debugFolder} ; then - exit 1 -fi + if ! unzip program.zip -d {debugFolder} ; then + exit 1 + fi -# The program assembly needs execute permissions. + # The program assembly needs execute permissions. -if ! chmod 770 {debugFolder}/{assemblyName} ; then - exit 1 -fi -{groupScript} -exit 0 -"; - // I'm not going to do a progress dialog because this should be fast. + if ! chmod 770 {debugFolder}/{assemblyName} ; then + exit 1 + fi + {groupScript} + exit 0 + "; + // I'm not going to do a progress dialog because this should be fast. try { LogInfo($"Uploading program to: [{debugFolder}]"); diff --git a/RaspberryDebugger/Models/Sdk/SdkArchitecture.cs b/RaspberryDebugger/Models/Sdk/SdkArchitecture.cs index c5796eb..df4fc49 100644 --- a/RaspberryDebugger/Models/Sdk/SdkArchitecture.cs +++ b/RaspberryDebugger/Models/Sdk/SdkArchitecture.cs @@ -42,4 +42,19 @@ internal enum SdkArchitecture [EnumMember(Value = "ARM64")] ARM64 } + + internal enum Platform + { + /// + /// 32-bit ARM + /// + [EnumMember(Value = "32")] + Bitness32, + + /// + /// 64-bit ARM + /// + [EnumMember(Value = "64")] + Bitness64 + } } diff --git a/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs b/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs index 643558b..0046fda 100644 --- a/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs +++ b/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs @@ -144,7 +144,7 @@ public static ProjectProperties CopyFrom(Solution solution, Project project) if (targetSdkVersion == null || sdkVersion > targetSdkVersion) { targetSdkVersion = sdkVersion; - targetSdk = new Sdk(sdkItem.Name, sdkItem.Version); + targetSdk = new Sdk(sdkItem.Name, sdkItem.Version, sdkItem.Architecture); } } diff --git a/RaspberryDebugger/RaspberryDebugger.csproj b/RaspberryDebugger/RaspberryDebugger.csproj index b0dc015..f771ffa 100644 --- a/RaspberryDebugger/RaspberryDebugger.csproj +++ b/RaspberryDebugger/RaspberryDebugger.csproj @@ -78,6 +78,7 @@ SettingsDialog.cs + @@ -197,6 +198,7 @@ true + 'click') + event = event.replace(stripNameRegex, ''); + return customEvents[event] || event; + } - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ + const EventHandler = { + on(element, event, handler, delegationFn) { + addHandler(element, event, handler, delegationFn, false); + }, - var NAME$2 = 'carousel'; - var VERSION$2 = '4.3.1'; - var DATA_KEY$2 = 'bs.carousel'; - var EVENT_KEY$2 = "." + DATA_KEY$2; - var DATA_API_KEY$2 = '.data-api'; - var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2]; - var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key + one(element, event, handler, delegationFn) { + addHandler(element, event, handler, delegationFn, true); + }, - var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key + off(element, originalTypeEvent, handler, delegationFn) { + if (typeof originalTypeEvent !== 'string' || !element) { + return; + } - var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch + const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn); + const inNamespace = typeEvent !== originalTypeEvent; + const events = getEvent(element); + const isNamespace = originalTypeEvent.startsWith('.'); - var SWIPE_THRESHOLD = 40; - var Default = { - interval: 5000, + if (typeof originalHandler !== 'undefined') { + // Simplest case: handler is passed, remove that listener ONLY. + if (!events || !events[typeEvent]) { + return; + } + + removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null); + return; + } + + if (isNamespace) { + Object.keys(events).forEach(elementEvent => { + removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1)); + }); + } + + const storeElementEvent = events[typeEvent] || {}; + Object.keys(storeElementEvent).forEach(keyHandlers => { + const handlerKey = keyHandlers.replace(stripUidRegex, ''); + + if (!inNamespace || originalTypeEvent.includes(handlerKey)) { + const event = storeElementEvent[keyHandlers]; + removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); + } + }); + }, + + trigger(element, event, args) { + if (typeof event !== 'string' || !element) { + return null; + } + + const $ = getjQuery(); + const typeEvent = getTypeEvent(event); + const inNamespace = event !== typeEvent; + const isNative = nativeEvents.has(typeEvent); + let jQueryEvent; + let bubbles = true; + let nativeDispatch = true; + let defaultPrevented = false; + let evt = null; + + if (inNamespace && $) { + jQueryEvent = $.Event(event, args); + $(element).trigger(jQueryEvent); + bubbles = !jQueryEvent.isPropagationStopped(); + nativeDispatch = !jQueryEvent.isImmediatePropagationStopped(); + defaultPrevented = jQueryEvent.isDefaultPrevented(); + } + + if (isNative) { + evt = document.createEvent('HTMLEvents'); + evt.initEvent(typeEvent, bubbles, true); + } else { + evt = new CustomEvent(event, { + bubbles, + cancelable: true + }); + } // merge custom information in our event + + + if (typeof args !== 'undefined') { + Object.keys(args).forEach(key => { + Object.defineProperty(evt, key, { + get() { + return args[key]; + } + + }); + }); + } + + if (defaultPrevented) { + evt.preventDefault(); + } + + if (nativeDispatch) { + element.dispatchEvent(evt); + } + + if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') { + jQueryEvent.preventDefault(); + } + + return evt; + } + + }; + + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): dom/data.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + /** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + const elementMap = new Map(); + var Data = { + set(element, key, instance) { + if (!elementMap.has(element)) { + elementMap.set(element, new Map()); + } + + const instanceMap = elementMap.get(element); // make it clear we only want one instance per element + // can be removed later when multiple key/instances are fine to be used + + if (!instanceMap.has(key) && instanceMap.size !== 0) { + // eslint-disable-next-line no-console + console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`); + return; + } + + instanceMap.set(key, instance); + }, + + get(element, key) { + if (elementMap.has(element)) { + return elementMap.get(element).get(key) || null; + } + + return null; + }, + + remove(element, key) { + if (!elementMap.has(element)) { + return; + } + + const instanceMap = elementMap.get(element); + instanceMap.delete(key); // free up element references if there are no instances left for an element + + if (instanceMap.size === 0) { + elementMap.delete(element); + } + } + + }; + + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + /** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + + const VERSION = '5.1.0'; + + class BaseComponent { + constructor(element) { + element = getElement(element); + + if (!element) { + return; + } + + this._element = element; + Data.set(this._element, this.constructor.DATA_KEY, this); + } + + dispose() { + Data.remove(this._element, this.constructor.DATA_KEY); + EventHandler.off(this._element, this.constructor.EVENT_KEY); + Object.getOwnPropertyNames(this).forEach(propertyName => { + this[propertyName] = null; + }); + } + + _queueCallback(callback, element, isAnimated = true) { + executeAfterTransition(callback, element, isAnimated); + } + /** Static */ + + + static getInstance(element) { + return Data.get(getElement(element), this.DATA_KEY); + } + + static getOrCreateInstance(element, config = {}) { + return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null); + } + + static get VERSION() { + return VERSION; + } + + static get NAME() { + throw new Error('You have to implement the static method "NAME", for each component!'); + } + + static get DATA_KEY() { + return `bs.${this.NAME}`; + } + + static get EVENT_KEY() { + return `.${this.DATA_KEY}`; + } + + } + + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): util/component-functions.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + const enableDismissTrigger = (component, method = 'hide') => { + const clickEvent = `click.dismiss${component.EVENT_KEY}`; + const name = component.NAME; + EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) { + if (['A', 'AREA'].includes(this.tagName)) { + event.preventDefault(); + } + + if (isDisabled(this)) { + return; + } + + const target = getElementFromSelector(this) || this.closest(`.${name}`); + const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method + + instance[method](); + }); + }; + + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): alert.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + /** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + + const NAME$d = 'alert'; + const DATA_KEY$c = 'bs.alert'; + const EVENT_KEY$c = `.${DATA_KEY$c}`; + const EVENT_CLOSE = `close${EVENT_KEY$c}`; + const EVENT_CLOSED = `closed${EVENT_KEY$c}`; + const CLASS_NAME_FADE$5 = 'fade'; + const CLASS_NAME_SHOW$8 = 'show'; + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + + class Alert extends BaseComponent { + // Getters + static get NAME() { + return NAME$d; + } // Public + + + close() { + const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE); + + if (closeEvent.defaultPrevented) { + return; + } + + this._element.classList.remove(CLASS_NAME_SHOW$8); + + const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5); + + this._queueCallback(() => this._destroyElement(), this._element, isAnimated); + } // Private + + + _destroyElement() { + this._element.remove(); + + EventHandler.trigger(this._element, EVENT_CLOSED); + this.dispose(); + } // Static + + + static jQueryInterface(config) { + return this.each(function () { + const data = Alert.getOrCreateInstance(this); + + if (typeof config !== 'string') { + return; + } + + if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { + throw new TypeError(`No method named "${config}"`); + } + + data[config](this); + }); + } + + } + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + + + enableDismissTrigger(Alert, 'close'); + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Alert to jQuery only if jQuery is present + */ + + defineJQueryPlugin(Alert); + + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): button.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + /** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + + const NAME$c = 'button'; + const DATA_KEY$b = 'bs.button'; + const EVENT_KEY$b = `.${DATA_KEY$b}`; + const DATA_API_KEY$7 = '.data-api'; + const CLASS_NAME_ACTIVE$3 = 'active'; + const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]'; + const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$b}${DATA_API_KEY$7}`; + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + + class Button extends BaseComponent { + // Getters + static get NAME() { + return NAME$c; + } // Public + + + toggle() { + // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method + this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3)); + } // Static + + + static jQueryInterface(config) { + return this.each(function () { + const data = Button.getOrCreateInstance(this); + + if (config === 'toggle') { + data[config](); + } + }); + } + + } + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + + + EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => { + event.preventDefault(); + const button = event.target.closest(SELECTOR_DATA_TOGGLE$5); + const data = Button.getOrCreateInstance(button); + data.toggle(); + }); + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Button to jQuery only if jQuery is present + */ + + defineJQueryPlugin(Button); + + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): dom/manipulator.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + function normalizeData(val) { + if (val === 'true') { + return true; + } + + if (val === 'false') { + return false; + } + + if (val === Number(val).toString()) { + return Number(val); + } + + if (val === '' || val === 'null') { + return null; + } + + return val; + } + + function normalizeDataKey(key) { + return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`); + } + + const Manipulator = { + setDataAttribute(element, key, value) { + element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value); + }, + + removeDataAttribute(element, key) { + element.removeAttribute(`data-bs-${normalizeDataKey(key)}`); + }, + + getDataAttributes(element) { + if (!element) { + return {}; + } + + const attributes = {}; + Object.keys(element.dataset).filter(key => key.startsWith('bs')).forEach(key => { + let pureKey = key.replace(/^bs/, ''); + pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length); + attributes[pureKey] = normalizeData(element.dataset[key]); + }); + return attributes; + }, + + getDataAttribute(element, key) { + return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`)); + }, + + offset(element) { + const rect = element.getBoundingClientRect(); + return { + top: rect.top + window.pageYOffset, + left: rect.left + window.pageXOffset + }; + }, + + position(element) { + return { + top: element.offsetTop, + left: element.offsetLeft + }; + } + + }; + + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): dom/selector-engine.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + const NODE_TEXT = 3; + const SelectorEngine = { + find(selector, element = document.documentElement) { + return [].concat(...Element.prototype.querySelectorAll.call(element, selector)); + }, + + findOne(selector, element = document.documentElement) { + return Element.prototype.querySelector.call(element, selector); + }, + + children(element, selector) { + return [].concat(...element.children).filter(child => child.matches(selector)); + }, + + parents(element, selector) { + const parents = []; + let ancestor = element.parentNode; + + while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) { + if (ancestor.matches(selector)) { + parents.push(ancestor); + } + + ancestor = ancestor.parentNode; + } + + return parents; + }, + + prev(element, selector) { + let previous = element.previousElementSibling; + + while (previous) { + if (previous.matches(selector)) { + return [previous]; + } + + previous = previous.previousElementSibling; + } + + return []; + }, + + next(element, selector) { + let next = element.nextElementSibling; + + while (next) { + if (next.matches(selector)) { + return [next]; + } + + next = next.nextElementSibling; + } + + return []; + }, + + focusableChildren(element) { + const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', '); + return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el)); + } + + }; + + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): carousel.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + /** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + + const NAME$b = 'carousel'; + const DATA_KEY$a = 'bs.carousel'; + const EVENT_KEY$a = `.${DATA_KEY$a}`; + const DATA_API_KEY$6 = '.data-api'; + const ARROW_LEFT_KEY = 'ArrowLeft'; + const ARROW_RIGHT_KEY = 'ArrowRight'; + const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch + + const SWIPE_THRESHOLD = 40; + const Default$a = { + interval: 5000, keyboard: true, slide: false, pause: 'hover', wrap: true, touch: true }; - var DefaultType = { + const DefaultType$a = { interval: '(number|boolean)', keyboard: 'boolean', slide: '(boolean|string)', @@ -576,4007 +1096,3783 @@ wrap: 'boolean', touch: 'boolean' }; - var Direction = { - NEXT: 'next', - PREV: 'prev', - LEFT: 'left', - RIGHT: 'right' - }; - var Event$2 = { - SLIDE: "slide" + EVENT_KEY$2, - SLID: "slid" + EVENT_KEY$2, - KEYDOWN: "keydown" + EVENT_KEY$2, - MOUSEENTER: "mouseenter" + EVENT_KEY$2, - MOUSELEAVE: "mouseleave" + EVENT_KEY$2, - TOUCHSTART: "touchstart" + EVENT_KEY$2, - TOUCHMOVE: "touchmove" + EVENT_KEY$2, - TOUCHEND: "touchend" + EVENT_KEY$2, - POINTERDOWN: "pointerdown" + EVENT_KEY$2, - POINTERUP: "pointerup" + EVENT_KEY$2, - DRAG_START: "dragstart" + EVENT_KEY$2, - LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2, - CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2 - }; - var ClassName$2 = { - CAROUSEL: 'carousel', - ACTIVE: 'active', - SLIDE: 'slide', - RIGHT: 'carousel-item-right', - LEFT: 'carousel-item-left', - NEXT: 'carousel-item-next', - PREV: 'carousel-item-prev', - ITEM: 'carousel-item', - POINTER_EVENT: 'pointer-event' + const ORDER_NEXT = 'next'; + const ORDER_PREV = 'prev'; + const DIRECTION_LEFT = 'left'; + const DIRECTION_RIGHT = 'right'; + const KEY_TO_DIRECTION = { + [ARROW_LEFT_KEY]: DIRECTION_RIGHT, + [ARROW_RIGHT_KEY]: DIRECTION_LEFT }; - var Selector$2 = { - ACTIVE: '.active', - ACTIVE_ITEM: '.active.carousel-item', - ITEM: '.carousel-item', - ITEM_IMG: '.carousel-item img', - NEXT_PREV: '.carousel-item-next, .carousel-item-prev', - INDICATORS: '.carousel-indicators', - DATA_SLIDE: '[data-slide], [data-slide-to]', - DATA_RIDE: '[data-ride="carousel"]' - }; - var PointerType = { - TOUCH: 'touch', - PEN: 'pen' - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ + const EVENT_SLIDE = `slide${EVENT_KEY$a}`; + const EVENT_SLID = `slid${EVENT_KEY$a}`; + const EVENT_KEYDOWN = `keydown${EVENT_KEY$a}`; + const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$a}`; + const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$a}`; + const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$a}`; + const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$a}`; + const EVENT_TOUCHEND = `touchend${EVENT_KEY$a}`; + const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$a}`; + const EVENT_POINTERUP = `pointerup${EVENT_KEY$a}`; + const EVENT_DRAG_START = `dragstart${EVENT_KEY$a}`; + const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$a}${DATA_API_KEY$6}`; + const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`; + const CLASS_NAME_CAROUSEL = 'carousel'; + const CLASS_NAME_ACTIVE$2 = 'active'; + const CLASS_NAME_SLIDE = 'slide'; + const CLASS_NAME_END = 'carousel-item-end'; + const CLASS_NAME_START = 'carousel-item-start'; + const CLASS_NAME_NEXT = 'carousel-item-next'; + const CLASS_NAME_PREV = 'carousel-item-prev'; + const CLASS_NAME_POINTER_EVENT = 'pointer-event'; + const SELECTOR_ACTIVE$1 = '.active'; + const SELECTOR_ACTIVE_ITEM = '.active.carousel-item'; + const SELECTOR_ITEM = '.carousel-item'; + const SELECTOR_ITEM_IMG = '.carousel-item img'; + const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; + const SELECTOR_INDICATORS = '.carousel-indicators'; + const SELECTOR_INDICATOR = '[data-bs-target]'; + const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'; + const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'; + const POINTER_TYPE_TOUCH = 'touch'; + const POINTER_TYPE_PEN = 'pen'; + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + + class Carousel extends BaseComponent { + constructor(element, config) { + super(element); + this._items = null; + this._interval = null; + this._activeElement = null; + this._isPaused = false; + this._isSliding = false; + this.touchTimeout = null; + this.touchStartX = 0; + this.touchDeltaX = 0; + this._config = this._getConfig(config); + this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element); + this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; + this._pointerEvent = Boolean(window.PointerEvent); + + this._addEventListeners(); + } // Getters + + + static get Default() { + return Default$a; + } + + static get NAME() { + return NAME$b; + } // Public + + + next() { + this._slide(ORDER_NEXT); + } + + nextWhenVisible() { + // Don't call next when the page isn't visible + // or the carousel or its parent isn't visible + if (!document.hidden && isVisible(this._element)) { + this.next(); + } + } + + prev() { + this._slide(ORDER_PREV); + } + + pause(event) { + if (!event) { + this._isPaused = true; + } + + if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) { + triggerTransitionEnd(this._element); + this.cycle(true); + } + + clearInterval(this._interval); + this._interval = null; + } + + cycle(event) { + if (!event) { + this._isPaused = false; + } + + if (this._interval) { + clearInterval(this._interval); + this._interval = null; + } + + if (this._config && this._config.interval && !this._isPaused) { + this._updateInterval(); + + this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); + } + } + + to(index) { + this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); + + const activeIndex = this._getItemIndex(this._activeElement); + + if (index > this._items.length - 1 || index < 0) { + return; + } + + if (this._isSliding) { + EventHandler.one(this._element, EVENT_SLID, () => this.to(index)); + return; + } + + if (activeIndex === index) { + this.pause(); + this.cycle(); + return; + } - }; + const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV; - var Carousel = - /*#__PURE__*/ - function () { - function Carousel(element, config) { - this._items = null; - this._interval = null; - this._activeElement = null; - this._isPaused = false; - this._isSliding = false; - this.touchTimeout = null; - this.touchStartX = 0; + this._slide(order, this._items[index]); + } // Private + + + _getConfig(config) { + config = { ...Default$a, + ...Manipulator.getDataAttributes(this._element), + ...(typeof config === 'object' ? config : {}) + }; + typeCheckConfig(NAME$b, config, DefaultType$a); + return config; + } + + _handleSwipe() { + const absDeltax = Math.abs(this.touchDeltaX); + + if (absDeltax <= SWIPE_THRESHOLD) { + return; + } + + const direction = absDeltax / this.touchDeltaX; this.touchDeltaX = 0; - this._config = this._getConfig(config); - this._element = element; - this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS); - this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; - this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); - this._addEventListeners(); - } // Getters + if (!direction) { + return; + } + this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT); + } - var _proto = Carousel.prototype; + _addEventListeners() { + if (this._config.keyboard) { + EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event)); + } - // Public - _proto.next = function next() { - if (!this._isSliding) { - this._slide(Direction.NEXT); + if (this._config.pause === 'hover') { + EventHandler.on(this._element, EVENT_MOUSEENTER, event => this.pause(event)); + EventHandler.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event)); } - }; - _proto.nextWhenVisible = function nextWhenVisible() { - // Don't call next when the page isn't visible - // or the carousel or its parent isn't visible - if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') { - this.next(); + if (this._config.touch && this._touchSupported) { + this._addTouchEventListeners(); } - }; + } + + _addTouchEventListeners() { + const start = event => { + if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) { + this.touchStartX = event.clientX; + } else if (!this._pointerEvent) { + this.touchStartX = event.touches[0].clientX; + } + }; + + const move = event => { + // ensure swiping with one touch and not pinching + this.touchDeltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this.touchStartX; + }; + + const end = event => { + if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) { + this.touchDeltaX = event.clientX - this.touchStartX; + } + + this._handleSwipe(); + + if (this._config.pause === 'hover') { + // If it's a touch-enabled device, mouseenter/leave are fired as + // part of the mouse compatibility events on first tap - the carousel + // would stop cycling until user tapped out of it; + // here, we listen for touchend, explicitly pause the carousel + // (as if it's the second time we tap on it, mouseenter compat event + // is NOT fired) and after a timeout (to allow for mouse compatibility + // events to fire) we explicitly restart cycling + this.pause(); + + if (this.touchTimeout) { + clearTimeout(this.touchTimeout); + } + + this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval); + } + }; + + SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => { + EventHandler.on(itemImg, EVENT_DRAG_START, e => e.preventDefault()); + }); + + if (this._pointerEvent) { + EventHandler.on(this._element, EVENT_POINTERDOWN, event => start(event)); + EventHandler.on(this._element, EVENT_POINTERUP, event => end(event)); - _proto.prev = function prev() { - if (!this._isSliding) { - this._slide(Direction.PREV); + this._element.classList.add(CLASS_NAME_POINTER_EVENT); + } else { + EventHandler.on(this._element, EVENT_TOUCHSTART, event => start(event)); + EventHandler.on(this._element, EVENT_TOUCHMOVE, event => move(event)); + EventHandler.on(this._element, EVENT_TOUCHEND, event => end(event)); } - }; + } - _proto.pause = function pause(event) { - if (!event) { - this._isPaused = true; + _keydown(event) { + if (/input|textarea/i.test(event.target.tagName)) { + return; } - if (this._element.querySelector(Selector$2.NEXT_PREV)) { - Util.triggerTransitionEnd(this._element); - this.cycle(true); + const direction = KEY_TO_DIRECTION[event.key]; + + if (direction) { + event.preventDefault(); + + this._slide(direction); } + } - clearInterval(this._interval); - this._interval = null; - }; + _getItemIndex(element) { + this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : []; + return this._items.indexOf(element); + } - _proto.cycle = function cycle(event) { - if (!event) { - this._isPaused = false; + _getItemByOrder(order, activeElement) { + const isNext = order === ORDER_NEXT; + return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap); + } + + _triggerSlideEvent(relatedTarget, eventDirectionName) { + const targetIndex = this._getItemIndex(relatedTarget); + + const fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)); + + return EventHandler.trigger(this._element, EVENT_SLIDE, { + relatedTarget, + direction: eventDirectionName, + from: fromIndex, + to: targetIndex + }); + } + + _setActiveIndicatorElement(element) { + if (this._indicatorsElement) { + const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE$1, this._indicatorsElement); + activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2); + activeIndicator.removeAttribute('aria-current'); + const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement); + + for (let i = 0; i < indicators.length; i++) { + if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) { + indicators[i].classList.add(CLASS_NAME_ACTIVE$2); + indicators[i].setAttribute('aria-current', 'true'); + break; + } + } } + } - if (this._interval) { - clearInterval(this._interval); - this._interval = null; + _updateInterval() { + const element = this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); + + if (!element) { + return; } - if (this._config.interval && !this._isPaused) { - this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); + const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10); + + if (elementInterval) { + this._config.defaultInterval = this._config.defaultInterval || this._config.interval; + this._config.interval = elementInterval; + } else { + this._config.interval = this._config.defaultInterval || this._config.interval; } - }; + } - _proto.to = function to(index) { - var _this = this; + _slide(directionOrOrder, element) { + const order = this._directionToOrder(directionOrOrder); - this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); + const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); - var activeIndex = this._getItemIndex(this._activeElement); + const activeElementIndex = this._getItemIndex(activeElement); - if (index > this._items.length - 1 || index < 0) { + const nextElement = element || this._getItemByOrder(order, activeElement); + + const nextElementIndex = this._getItemIndex(nextElement); + + const isCycling = Boolean(this._interval); + const isNext = order === ORDER_NEXT; + const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END; + const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV; + + const eventDirectionName = this._orderToDirection(order); + + if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$2)) { + this._isSliding = false; return; } if (this._isSliding) { - $(this._element).one(Event$2.SLID, function () { - return _this.to(index); - }); return; } - if (activeIndex === index) { + const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); + + if (slideEvent.defaultPrevented) { + return; + } + + if (!activeElement || !nextElement) { + // Some weirdness is happening, so we bail + return; + } + + this._isSliding = true; + + if (isCycling) { this.pause(); + } + + this._setActiveIndicatorElement(nextElement); + + this._activeElement = nextElement; + + const triggerSlidEvent = () => { + EventHandler.trigger(this._element, EVENT_SLID, { + relatedTarget: nextElement, + direction: eventDirectionName, + from: activeElementIndex, + to: nextElementIndex + }); + }; + + if (this._element.classList.contains(CLASS_NAME_SLIDE)) { + nextElement.classList.add(orderClassName); + reflow(nextElement); + activeElement.classList.add(directionalClassName); + nextElement.classList.add(directionalClassName); + + const completeCallBack = () => { + nextElement.classList.remove(directionalClassName, orderClassName); + nextElement.classList.add(CLASS_NAME_ACTIVE$2); + activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName); + this._isSliding = false; + setTimeout(triggerSlidEvent, 0); + }; + + this._queueCallback(completeCallBack, activeElement, true); + } else { + activeElement.classList.remove(CLASS_NAME_ACTIVE$2); + nextElement.classList.add(CLASS_NAME_ACTIVE$2); + this._isSliding = false; + triggerSlidEvent(); + } + + if (isCycling) { this.cycle(); + } + } + + _directionToOrder(direction) { + if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) { + return direction; + } + + if (isRTL()) { + return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT; + } + + return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV; + } + + _orderToDirection(order) { + if (![ORDER_NEXT, ORDER_PREV].includes(order)) { + return order; + } + + if (isRTL()) { + return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT; + } + + return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT; + } // Static + + + static carouselInterface(element, config) { + const data = Carousel.getOrCreateInstance(element, config); + let { + _config + } = data; + + if (typeof config === 'object') { + _config = { ..._config, + ...config + }; + } + + const action = typeof config === 'string' ? config : _config.slide; + + if (typeof config === 'number') { + data.to(config); + } else if (typeof action === 'string') { + if (typeof data[action] === 'undefined') { + throw new TypeError(`No method named "${action}"`); + } + + data[action](); + } else if (_config.interval && _config.ride) { + data.pause(); + data.cycle(); + } + } + + static jQueryInterface(config) { + return this.each(function () { + Carousel.carouselInterface(this, config); + }); + } + + static dataApiClickHandler(event) { + const target = getElementFromSelector(this); + + if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) { return; } - var direction = index > activeIndex ? Direction.NEXT : Direction.PREV; + const config = { ...Manipulator.getDataAttributes(target), + ...Manipulator.getDataAttributes(this) + }; + const slideIndex = this.getAttribute('data-bs-slide-to'); - this._slide(direction, this._items[index]); - }; + if (slideIndex) { + config.interval = false; + } - _proto.dispose = function dispose() { - $(this._element).off(EVENT_KEY$2); - $.removeData(this._element, DATA_KEY$2); - this._items = null; - this._config = null; - this._element = null; - this._interval = null; - this._isPaused = null; - this._isSliding = null; - this._activeElement = null; - this._indicatorsElement = null; - } // Private - ; + Carousel.carouselInterface(target, config); + + if (slideIndex) { + Carousel.getInstance(target).to(slideIndex); + } + + event.preventDefault(); + } + + } + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + + + EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler); + EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => { + const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE); + + for (let i = 0, len = carousels.length; i < len; i++) { + Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i])); + } + }); + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Carousel to jQuery only if jQuery is present + */ + + defineJQueryPlugin(Carousel); + + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): collapse.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + /** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + + const NAME$a = 'collapse'; + const DATA_KEY$9 = 'bs.collapse'; + const EVENT_KEY$9 = `.${DATA_KEY$9}`; + const DATA_API_KEY$5 = '.data-api'; + const Default$9 = { + toggle: true, + parent: null + }; + const DefaultType$9 = { + toggle: 'boolean', + parent: '(null|element)' + }; + const EVENT_SHOW$5 = `show${EVENT_KEY$9}`; + const EVENT_SHOWN$5 = `shown${EVENT_KEY$9}`; + const EVENT_HIDE$5 = `hide${EVENT_KEY$9}`; + const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$9}`; + const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$9}${DATA_API_KEY$5}`; + const CLASS_NAME_SHOW$7 = 'show'; + const CLASS_NAME_COLLAPSE = 'collapse'; + const CLASS_NAME_COLLAPSING = 'collapsing'; + const CLASS_NAME_COLLAPSED = 'collapsed'; + const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'; + const WIDTH = 'width'; + const HEIGHT = 'height'; + const SELECTOR_ACTIVES = '.show, .collapsing'; + const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + + class Collapse extends BaseComponent { + constructor(element, config) { + super(element); + this._isTransitioning = false; + this._config = this._getConfig(config); + this._triggerArray = []; + const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4); + + for (let i = 0, len = toggleList.length; i < len; i++) { + const elem = toggleList[i]; + const selector = getSelectorFromElement(elem); + const filterElement = SelectorEngine.find(selector).filter(foundElem => foundElem === this._element); + + if (selector !== null && filterElement.length) { + this._selector = selector; + + this._triggerArray.push(elem); + } + } + + this._initializeChildren(); + + if (!this._config.parent) { + this._addAriaAndCollapsedClass(this._triggerArray, this._isShown()); + } + + if (this._config.toggle) { + this.toggle(); + } + } // Getters - _proto._getConfig = function _getConfig(config) { - config = _objectSpread({}, Default, config); - Util.typeCheckConfig(NAME$2, config, DefaultType); - return config; - }; - _proto._handleSwipe = function _handleSwipe() { - var absDeltax = Math.abs(this.touchDeltaX); + static get Default() { + return Default$9; + } + + static get NAME() { + return NAME$a; + } // Public + + + toggle() { + if (this._isShown()) { + this.hide(); + } else { + this.show(); + } + } - if (absDeltax <= SWIPE_THRESHOLD) { + show() { + if (this._isTransitioning || this._isShown()) { return; } - var direction = absDeltax / this.touchDeltaX; // swipe left - - if (direction > 0) { - this.prev(); - } // swipe right - + let actives = []; + let activesData; - if (direction < 0) { - this.next(); + if (this._config.parent) { + const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent); + actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth } - }; - _proto._addEventListeners = function _addEventListeners() { - var _this2 = this; - - if (this._config.keyboard) { - $(this._element).on(Event$2.KEYDOWN, function (event) { - return _this2._keydown(event); - }); - } + const container = SelectorEngine.findOne(this._selector); - if (this._config.pause === 'hover') { - $(this._element).on(Event$2.MOUSEENTER, function (event) { - return _this2.pause(event); - }).on(Event$2.MOUSELEAVE, function (event) { - return _this2.cycle(event); - }); - } + if (actives.length) { + const tempActiveData = actives.find(elem => container !== elem); + activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null; - if (this._config.touch) { - this._addTouchEventListeners(); + if (activesData && activesData._isTransitioning) { + return; + } } - }; - _proto._addTouchEventListeners = function _addTouchEventListeners() { - var _this3 = this; + const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$5); - if (!this._touchSupported) { + if (startEvent.defaultPrevented) { return; } - var start = function start(event) { - if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { - _this3.touchStartX = event.originalEvent.clientX; - } else if (!_this3._pointerEvent) { - _this3.touchStartX = event.originalEvent.touches[0].clientX; - } - }; - - var move = function move(event) { - // ensure swiping with one touch and not pinching - if (event.originalEvent.touches && event.originalEvent.touches.length > 1) { - _this3.touchDeltaX = 0; - } else { - _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX; + actives.forEach(elemActive => { + if (container !== elemActive) { + Collapse.getOrCreateInstance(elemActive, { + toggle: false + }).hide(); } - }; - var end = function end(event) { - if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { - _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX; + if (!activesData) { + Data.set(elemActive, DATA_KEY$9, null); } + }); - _this3._handleSwipe(); + const dimension = this._getDimension(); - if (_this3._config.pause === 'hover') { - // If it's a touch-enabled device, mouseenter/leave are fired as - // part of the mouse compatibility events on first tap - the carousel - // would stop cycling until user tapped out of it; - // here, we listen for touchend, explicitly pause the carousel - // (as if it's the second time we tap on it, mouseenter compat event - // is NOT fired) and after a timeout (to allow for mouse compatibility - // events to fire) we explicitly restart cycling - _this3.pause(); + this._element.classList.remove(CLASS_NAME_COLLAPSE); - if (_this3.touchTimeout) { - clearTimeout(_this3.touchTimeout); - } + this._element.classList.add(CLASS_NAME_COLLAPSING); - _this3.touchTimeout = setTimeout(function (event) { - return _this3.cycle(event); - }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); - } - }; + this._element.style[dimension] = 0; - $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) { - return e.preventDefault(); - }); + this._addAriaAndCollapsedClass(this._triggerArray, true); - if (this._pointerEvent) { - $(this._element).on(Event$2.POINTERDOWN, function (event) { - return start(event); - }); - $(this._element).on(Event$2.POINTERUP, function (event) { - return end(event); - }); + this._isTransitioning = true; - this._element.classList.add(ClassName$2.POINTER_EVENT); - } else { - $(this._element).on(Event$2.TOUCHSTART, function (event) { - return start(event); - }); - $(this._element).on(Event$2.TOUCHMOVE, function (event) { - return move(event); - }); - $(this._element).on(Event$2.TOUCHEND, function (event) { - return end(event); - }); - } - }; + const complete = () => { + this._isTransitioning = false; - _proto._keydown = function _keydown(event) { - if (/input|textarea/i.test(event.target.tagName)) { - return; - } + this._element.classList.remove(CLASS_NAME_COLLAPSING); - switch (event.which) { - case ARROW_LEFT_KEYCODE: - event.preventDefault(); - this.prev(); - break; + this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); - case ARROW_RIGHT_KEYCODE: - event.preventDefault(); - this.next(); - break; + this._element.style[dimension] = ''; + EventHandler.trigger(this._element, EVENT_SHOWN$5); + }; - default: - } - }; + const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); + const scrollSize = `scroll${capitalizedDimension}`; - _proto._getItemIndex = function _getItemIndex(element) { - this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : []; - return this._items.indexOf(element); - }; + this._queueCallback(complete, this._element, true); - _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { - var isNextDirection = direction === Direction.NEXT; - var isPrevDirection = direction === Direction.PREV; + this._element.style[dimension] = `${this._element[scrollSize]}px`; + } - var activeIndex = this._getItemIndex(activeElement); + hide() { + if (this._isTransitioning || !this._isShown()) { + return; + } - var lastItemIndex = this._items.length - 1; - var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; + const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$5); - if (isGoingToWrap && !this._config.wrap) { - return activeElement; + if (startEvent.defaultPrevented) { + return; } - var delta = direction === Direction.PREV ? -1 : 1; - var itemIndex = (activeIndex + delta) % this._items.length; - return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; - }; + const dimension = this._getDimension(); - _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { - var targetIndex = this._getItemIndex(relatedTarget); + this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`; + reflow(this._element); - var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM)); + this._element.classList.add(CLASS_NAME_COLLAPSING); - var slideEvent = $.Event(Event$2.SLIDE, { - relatedTarget: relatedTarget, - direction: eventDirectionName, - from: fromIndex, - to: targetIndex - }); - $(this._element).trigger(slideEvent); - return slideEvent; - }; + this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); - _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { - if (this._indicatorsElement) { - var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE)); - $(indicators).removeClass(ClassName$2.ACTIVE); + const triggerArrayLength = this._triggerArray.length; - var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; + for (let i = 0; i < triggerArrayLength; i++) { + const trigger = this._triggerArray[i]; + const elem = getElementFromSelector(trigger); - if (nextIndicator) { - $(nextIndicator).addClass(ClassName$2.ACTIVE); + if (elem && !this._isShown(elem)) { + this._addAriaAndCollapsedClass([trigger], false); } } - }; - _proto._slide = function _slide(direction, element) { - var _this4 = this; + this._isTransitioning = true; - var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); + const complete = () => { + this._isTransitioning = false; - var activeElementIndex = this._getItemIndex(activeElement); + this._element.classList.remove(CLASS_NAME_COLLAPSING); - var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); + this._element.classList.add(CLASS_NAME_COLLAPSE); - var nextElementIndex = this._getItemIndex(nextElement); + EventHandler.trigger(this._element, EVENT_HIDDEN$5); + }; - var isCycling = Boolean(this._interval); - var directionalClassName; - var orderClassName; - var eventDirectionName; + this._element.style[dimension] = ''; - if (direction === Direction.NEXT) { - directionalClassName = ClassName$2.LEFT; - orderClassName = ClassName$2.NEXT; - eventDirectionName = Direction.LEFT; - } else { - directionalClassName = ClassName$2.RIGHT; - orderClassName = ClassName$2.PREV; - eventDirectionName = Direction.RIGHT; - } + this._queueCallback(complete, this._element, true); + } - if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) { - this._isSliding = false; - return; - } + _isShown(element = this._element) { + return element.classList.contains(CLASS_NAME_SHOW$7); + } // Private - var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); - if (slideEvent.isDefaultPrevented()) { - return; - } + _getConfig(config) { + config = { ...Default$9, + ...Manipulator.getDataAttributes(this._element), + ...config + }; + config.toggle = Boolean(config.toggle); // Coerce string values - if (!activeElement || !nextElement) { - // Some weirdness is happening, so we bail - return; - } + config.parent = getElement(config.parent); + typeCheckConfig(NAME$a, config, DefaultType$9); + return config; + } - this._isSliding = true; + _getDimension() { + return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT; + } - if (isCycling) { - this.pause(); + _initializeChildren() { + if (!this._config.parent) { + return; } - this._setActiveIndicatorElement(nextElement); + const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent); + SelectorEngine.find(SELECTOR_DATA_TOGGLE$4, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => { + const selected = getElementFromSelector(element); - var slidEvent = $.Event(Event$2.SLID, { - relatedTarget: nextElement, - direction: eventDirectionName, - from: activeElementIndex, - to: nextElementIndex + if (selected) { + this._addAriaAndCollapsedClass([element], this._isShown(selected)); + } }); + } - if ($(this._element).hasClass(ClassName$2.SLIDE)) { - $(nextElement).addClass(orderClassName); - Util.reflow(nextElement); - $(activeElement).addClass(directionalClassName); - $(nextElement).addClass(directionalClassName); - var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10); + _addAriaAndCollapsedClass(triggerArray, isOpen) { + if (!triggerArray.length) { + return; + } - if (nextElementInterval) { - this._config.defaultInterval = this._config.defaultInterval || this._config.interval; - this._config.interval = nextElementInterval; + triggerArray.forEach(elem => { + if (isOpen) { + elem.classList.remove(CLASS_NAME_COLLAPSED); } else { - this._config.interval = this._config.defaultInterval || this._config.interval; + elem.classList.add(CLASS_NAME_COLLAPSED); } - var transitionDuration = Util.getTransitionDurationFromElement(activeElement); - $(activeElement).one(Util.TRANSITION_END, function () { - $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE); - $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName); - _this4._isSliding = false; - setTimeout(function () { - return $(_this4._element).trigger(slidEvent); - }, 0); - }).emulateTransitionEnd(transitionDuration); - } else { - $(activeElement).removeClass(ClassName$2.ACTIVE); - $(nextElement).addClass(ClassName$2.ACTIVE); - this._isSliding = false; - $(this._element).trigger(slidEvent); - } - - if (isCycling) { - this.cycle(); - } + elem.setAttribute('aria-expanded', isOpen); + }); } // Static - ; - Carousel._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY$2); - var _config = _objectSpread({}, Default, $(this).data()); + static jQueryInterface(config) { + return this.each(function () { + const _config = {}; - if (typeof config === 'object') { - _config = _objectSpread({}, _config, config); + if (typeof config === 'string' && /show|hide/.test(config)) { + _config.toggle = false; } - var action = typeof config === 'string' ? config : _config.slide; - - if (!data) { - data = new Carousel(this, _config); - $(this).data(DATA_KEY$2, data); - } + const data = Collapse.getOrCreateInstance(this, _config); - if (typeof config === 'number') { - data.to(config); - } else if (typeof action === 'string') { - if (typeof data[action] === 'undefined') { - throw new TypeError("No method named \"" + action + "\""); + if (typeof config === 'string') { + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`); } - data[action](); - } else if (_config.interval && _config.ride) { - data.pause(); - data.cycle(); + data[config](); } }); - }; + } + + } + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ - Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { - var selector = Util.getSelectorFromElement(this); - if (!selector) { - return; - } + EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function (event) { + // preventDefault only for elements (which change the URL) not inside the collapsible element + if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') { + event.preventDefault(); + } - var target = $(selector)[0]; + const selector = getSelectorFromElement(this); + const selectorElements = SelectorEngine.find(selector); + selectorElements.forEach(element => { + Collapse.getOrCreateInstance(element, { + toggle: false + }).toggle(); + }); + }); + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Collapse to jQuery only if jQuery is present + */ - if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) { - return; - } + defineJQueryPlugin(Collapse); + + var top = 'top'; + var bottom = 'bottom'; + var right = 'right'; + var left = 'left'; + var auto = 'auto'; + var basePlacements = [top, bottom, right, left]; + var start = 'start'; + var end = 'end'; + var clippingParents = 'clippingParents'; + var viewport = 'viewport'; + var popper = 'popper'; + var reference = 'reference'; + var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) { + return acc.concat([placement + "-" + start, placement + "-" + end]); + }, []); + var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) { + return acc.concat([placement, placement + "-" + start, placement + "-" + end]); + }, []); // modifiers that need to read the DOM + + var beforeRead = 'beforeRead'; + var read = 'read'; + var afterRead = 'afterRead'; // pure-logic modifiers + + var beforeMain = 'beforeMain'; + var main = 'main'; + var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state) + + var beforeWrite = 'beforeWrite'; + var write = 'write'; + var afterWrite = 'afterWrite'; + var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite]; + + function getNodeName(element) { + return element ? (element.nodeName || '').toLowerCase() : null; + } - var config = _objectSpread({}, $(target).data(), $(this).data()); + function getWindow(node) { + if (node == null) { + return window; + } - var slideIndex = this.getAttribute('data-slide-to'); + if (node.toString() !== '[object Window]') { + var ownerDocument = node.ownerDocument; + return ownerDocument ? ownerDocument.defaultView || window : window; + } - if (slideIndex) { - config.interval = false; - } + return node; + } - Carousel._jQueryInterface.call($(target), config); + function isElement(node) { + var OwnElement = getWindow(node).Element; + return node instanceof OwnElement || node instanceof Element; + } - if (slideIndex) { - $(target).data(DATA_KEY$2).to(slideIndex); - } + function isHTMLElement(node) { + var OwnElement = getWindow(node).HTMLElement; + return node instanceof OwnElement || node instanceof HTMLElement; + } - event.preventDefault(); - }; + function isShadowRoot(node) { + // IE 11 has no ShadowRoot + if (typeof ShadowRoot === 'undefined') { + return false; + } - _createClass(Carousel, null, [{ - key: "VERSION", - get: function get() { - return VERSION$2; - } - }, { - key: "Default", - get: function get() { - return Default; - } - }]); + var OwnElement = getWindow(node).ShadowRoot; + return node instanceof OwnElement || node instanceof ShadowRoot; + } - return Carousel; - }(); - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ + // and applies them to the HTMLElements such as popper and arrow + + function applyStyles(_ref) { + var state = _ref.state; + Object.keys(state.elements).forEach(function (name) { + var style = state.styles[name] || {}; + var attributes = state.attributes[name] || {}; + var element = state.elements[name]; // arrow is optional + virtual elements + + if (!isHTMLElement(element) || !getNodeName(element)) { + return; + } // Flow doesn't support to extend this property, but it's the most + // effective way to apply styles to an HTMLElement + // $FlowFixMe[cannot-write] - $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler); - $(window).on(Event$2.LOAD_DATA_API, function () { - var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE)); + Object.assign(element.style, style); + Object.keys(attributes).forEach(function (name) { + var value = attributes[name]; + + if (value === false) { + element.removeAttribute(name); + } else { + element.setAttribute(name, value === true ? '' : value); + } + }); + }); + } - for (var i = 0, len = carousels.length; i < len; i++) { - var $carousel = $(carousels[i]); + function effect$2(_ref2) { + var state = _ref2.state; + var initialStyles = { + popper: { + position: state.options.strategy, + left: '0', + top: '0', + margin: '0' + }, + arrow: { + position: 'absolute' + }, + reference: {} + }; + Object.assign(state.elements.popper.style, initialStyles.popper); + state.styles = initialStyles; - Carousel._jQueryInterface.call($carousel, $carousel.data()); + if (state.elements.arrow) { + Object.assign(state.elements.arrow.style, initialStyles.arrow); } - }); - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - $.fn[NAME$2] = Carousel._jQueryInterface; - $.fn[NAME$2].Constructor = Carousel; + return function () { + Object.keys(state.elements).forEach(function (name) { + var element = state.elements[name]; + var attributes = state.attributes[name] || {}; + var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them - $.fn[NAME$2].noConflict = function () { - $.fn[NAME$2] = JQUERY_NO_CONFLICT$2; - return Carousel._jQueryInterface; - }; + var style = styleProperties.reduce(function (style, property) { + style[property] = ''; + return style; + }, {}); // arrow is optional + virtual elements - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ + if (!isHTMLElement(element) || !getNodeName(element)) { + return; + } - var NAME$3 = 'collapse'; - var VERSION$3 = '4.3.1'; - var DATA_KEY$3 = 'bs.collapse'; - var EVENT_KEY$3 = "." + DATA_KEY$3; - var DATA_API_KEY$3 = '.data-api'; - var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3]; - var Default$1 = { - toggle: true, - parent: '' - }; - var DefaultType$1 = { - toggle: 'boolean', - parent: '(string|element)' - }; - var Event$3 = { - SHOW: "show" + EVENT_KEY$3, - SHOWN: "shown" + EVENT_KEY$3, - HIDE: "hide" + EVENT_KEY$3, - HIDDEN: "hidden" + EVENT_KEY$3, - CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3 - }; - var ClassName$3 = { - SHOW: 'show', - COLLAPSE: 'collapse', - COLLAPSING: 'collapsing', - COLLAPSED: 'collapsed' - }; - var Dimension = { - WIDTH: 'width', - HEIGHT: 'height' - }; - var Selector$3 = { - ACTIVES: '.show, .collapsing', - DATA_TOGGLE: '[data-toggle="collapse"]' - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ + Object.assign(element.style, style); + Object.keys(attributes).forEach(function (attribute) { + element.removeAttribute(attribute); + }); + }); + }; + } // eslint-disable-next-line import/no-unused-modules + + var applyStyles$1 = { + name: 'applyStyles', + enabled: true, + phase: 'write', + fn: applyStyles, + effect: effect$2, + requires: ['computeStyles'] }; - var Collapse = - /*#__PURE__*/ - function () { - function Collapse(element, config) { - this._isTransitioning = false; - this._element = element; - this._config = this._getConfig(config); - this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); - var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE)); - - for (var i = 0, len = toggleList.length; i < len; i++) { - var elem = toggleList[i]; - var selector = Util.getSelectorFromElement(elem); - var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) { - return foundElem === element; - }); + function getBasePlacement(placement) { + return placement.split('-')[0]; + } - if (selector !== null && filterElement.length > 0) { - this._selector = selector; + var round$1 = Math.round; + function getBoundingClientRect(element, includeScale) { + if (includeScale === void 0) { + includeScale = false; + } - this._triggerArray.push(elem); - } - } + var rect = element.getBoundingClientRect(); + var scaleX = 1; + var scaleY = 1; - this._parent = this._config.parent ? this._getParent() : null; + if (isHTMLElement(element) && includeScale) { + // Fallback to 1 in case both values are `0` + scaleX = rect.width / element.offsetWidth || 1; + scaleY = rect.height / element.offsetHeight || 1; + } - if (!this._config.parent) { - this._addAriaAndCollapsedClass(this._element, this._triggerArray); - } + return { + width: round$1(rect.width / scaleX), + height: round$1(rect.height / scaleY), + top: round$1(rect.top / scaleY), + right: round$1(rect.right / scaleX), + bottom: round$1(rect.bottom / scaleY), + left: round$1(rect.left / scaleX), + x: round$1(rect.left / scaleX), + y: round$1(rect.top / scaleY) + }; + } - if (this._config.toggle) { - this.toggle(); - } - } // Getters + // means it doesn't take into account transforms. + function getLayoutRect(element) { + var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed. + // Fixes https://github.com/popperjs/popper-core/issues/1223 - var _proto = Collapse.prototype; + var width = element.offsetWidth; + var height = element.offsetHeight; - // Public - _proto.toggle = function toggle() { - if ($(this._element).hasClass(ClassName$3.SHOW)) { - this.hide(); - } else { - this.show(); - } + if (Math.abs(clientRect.width - width) <= 1) { + width = clientRect.width; + } + + if (Math.abs(clientRect.height - height) <= 1) { + height = clientRect.height; + } + + return { + x: element.offsetLeft, + y: element.offsetTop, + width: width, + height: height }; + } + + function contains(parent, child) { + var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method + + if (parent.contains(child)) { + return true; + } // then fallback to custom implementation with Shadow DOM support + else if (rootNode && isShadowRoot(rootNode)) { + var next = child; + + do { + if (next && parent.isSameNode(next)) { + return true; + } // $FlowFixMe[prop-missing]: need a better way to handle this... + + + next = next.parentNode || next.host; + } while (next); + } // Give up, the result is false + + + return false; + } + + function getComputedStyle$1(element) { + return getWindow(element).getComputedStyle(element); + } + + function isTableElement(element) { + return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0; + } + + function getDocumentElement(element) { + // $FlowFixMe[incompatible-return]: assume body is always available + return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing] + element.document) || window.document).documentElement; + } + + function getParentNode(element) { + if (getNodeName(element) === 'html') { + return element; + } + + return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle + // $FlowFixMe[incompatible-return] + // $FlowFixMe[prop-missing] + element.assignedSlot || // step into the shadow DOM of the parent of a slotted node + element.parentNode || ( // DOM Element detected + isShadowRoot(element) ? element.host : null) || // ShadowRoot detected + // $FlowFixMe[incompatible-call]: HTMLElement is a Node + getDocumentElement(element) // fallback + + ); + } - _proto.show = function show() { - var _this = this; + function getTrueOffsetParent(element) { + if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837 + getComputedStyle$1(element).position === 'fixed') { + return null; + } - if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) { - return; - } + return element.offsetParent; + } // `.offsetParent` reports `null` for fixed elements, while absolute elements + // return the containing block - var actives; - var activesData; - if (this._parent) { - actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) { - if (typeof _this._config.parent === 'string') { - return elem.getAttribute('data-parent') === _this._config.parent; - } + function getContainingBlock(element) { + var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1; + var isIE = navigator.userAgent.indexOf('Trident') !== -1; - return elem.classList.contains(ClassName$3.COLLAPSE); - }); + if (isIE && isHTMLElement(element)) { + // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport + var elementCss = getComputedStyle$1(element); - if (actives.length === 0) { - actives = null; - } + if (elementCss.position === 'fixed') { + return null; } + } - if (actives) { - activesData = $(actives).not(this._selector).data(DATA_KEY$3); - - if (activesData && activesData._isTransitioning) { - return; - } - } + var currentNode = getParentNode(element); - var startEvent = $.Event(Event$3.SHOW); - $(this._element).trigger(startEvent); + while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) { + var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that + // create a containing block. + // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block - if (startEvent.isDefaultPrevented()) { - return; + if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') { + return currentNode; + } else { + currentNode = currentNode.parentNode; } + } - if (actives) { - Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide'); + return null; + } // Gets the closest ancestor positioned element. Handles some edge cases, + // such as table ancestors and cross browser bugs. - if (!activesData) { - $(actives).data(DATA_KEY$3, null); - } - } - var dimension = this._getDimension(); + function getOffsetParent(element) { + var window = getWindow(element); + var offsetParent = getTrueOffsetParent(element); - $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING); - this._element.style[dimension] = 0; + while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') { + offsetParent = getTrueOffsetParent(offsetParent); + } - if (this._triggerArray.length) { - $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true); - } + if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static')) { + return window; + } - this.setTransitioning(true); + return offsetParent || getContainingBlock(element) || window; + } - var complete = function complete() { - $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW); - _this._element.style[dimension] = ''; + function getMainAxisFromPlacement(placement) { + return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y'; + } - _this.setTransitioning(false); + var max = Math.max; + var min = Math.min; + var round = Math.round; - $(_this._element).trigger(Event$3.SHOWN); - }; + function within(min$1, value, max$1) { + return max(min$1, min(value, max$1)); + } - var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); - var scrollSize = "scroll" + capitalizedDimension; - var transitionDuration = Util.getTransitionDurationFromElement(this._element); - $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); - this._element.style[dimension] = this._element[scrollSize] + "px"; + function getFreshSideObject() { + return { + top: 0, + right: 0, + bottom: 0, + left: 0 }; + } - _proto.hide = function hide() { - var _this2 = this; + function mergePaddingObject(paddingObject) { + return Object.assign({}, getFreshSideObject(), paddingObject); + } - if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) { - return; - } + function expandToHashMap(value, keys) { + return keys.reduce(function (hashMap, key) { + hashMap[key] = value; + return hashMap; + }, {}); + } - var startEvent = $.Event(Event$3.HIDE); - $(this._element).trigger(startEvent); + var toPaddingObject = function toPaddingObject(padding, state) { + padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, { + placement: state.placement + })) : padding; + return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); + }; - if (startEvent.isDefaultPrevented()) { - return; - } + function arrow(_ref) { + var _state$modifiersData$; + + var state = _ref.state, + name = _ref.name, + options = _ref.options; + var arrowElement = state.elements.arrow; + var popperOffsets = state.modifiersData.popperOffsets; + var basePlacement = getBasePlacement(state.placement); + var axis = getMainAxisFromPlacement(basePlacement); + var isVertical = [left, right].indexOf(basePlacement) >= 0; + var len = isVertical ? 'height' : 'width'; - var dimension = this._getDimension(); + if (!arrowElement || !popperOffsets) { + return; + } - this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; - Util.reflow(this._element); - $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW); - var triggerArrayLength = this._triggerArray.length; + var paddingObject = toPaddingObject(options.padding, state); + var arrowRect = getLayoutRect(arrowElement); + var minProp = axis === 'y' ? top : left; + var maxProp = axis === 'y' ? bottom : right; + var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len]; + var startDiff = popperOffsets[axis] - state.rects.reference[axis]; + var arrowOffsetParent = getOffsetParent(arrowElement); + var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0; + var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is + // outside of the popper bounds + + var min = paddingObject[minProp]; + var max = clientSize - arrowRect[len] - paddingObject[maxProp]; + var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference; + var offset = within(min, center, max); // Prevents breaking syntax highlighting... + + var axisProp = axis; + state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$); + } - if (triggerArrayLength > 0) { - for (var i = 0; i < triggerArrayLength; i++) { - var trigger = this._triggerArray[i]; - var selector = Util.getSelectorFromElement(trigger); + function effect$1(_ref2) { + var state = _ref2.state, + options = _ref2.options; + var _options$element = options.element, + arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element; - if (selector !== null) { - var $elem = $([].slice.call(document.querySelectorAll(selector))); + if (arrowElement == null) { + return; + } // CSS selector - if (!$elem.hasClass(ClassName$3.SHOW)) { - $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false); - } - } - } - } - this.setTransitioning(true); + if (typeof arrowElement === 'string') { + arrowElement = state.elements.popper.querySelector(arrowElement); - var complete = function complete() { - _this2.setTransitioning(false); + if (!arrowElement) { + return; + } + } - $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN); - }; + if (!contains(state.elements.popper, arrowElement)) { - this._element.style[dimension] = ''; - var transitionDuration = Util.getTransitionDurationFromElement(this._element); - $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); - }; + return; + } - _proto.setTransitioning = function setTransitioning(isTransitioning) { - this._isTransitioning = isTransitioning; - }; + state.elements.arrow = arrowElement; + } // eslint-disable-next-line import/no-unused-modules - _proto.dispose = function dispose() { - $.removeData(this._element, DATA_KEY$3); - this._config = null; - this._parent = null; - this._element = null; - this._triggerArray = null; - this._isTransitioning = null; - } // Private - ; - _proto._getConfig = function _getConfig(config) { - config = _objectSpread({}, Default$1, config); - config.toggle = Boolean(config.toggle); // Coerce string values + var arrow$1 = { + name: 'arrow', + enabled: true, + phase: 'main', + fn: arrow, + effect: effect$1, + requires: ['popperOffsets'], + requiresIfExists: ['preventOverflow'] + }; - Util.typeCheckConfig(NAME$3, config, DefaultType$1); - return config; + var unsetSides = { + top: 'auto', + right: 'auto', + bottom: 'auto', + left: 'auto' + }; // Round the offsets to the nearest suitable subpixel based on the DPR. + // Zooming can change the DPR, but it seems to report a value that will + // cleanly divide the values into the appropriate subpixels. + + function roundOffsetsByDPR(_ref) { + var x = _ref.x, + y = _ref.y; + var win = window; + var dpr = win.devicePixelRatio || 1; + return { + x: round(round(x * dpr) / dpr) || 0, + y: round(round(y * dpr) / dpr) || 0 }; + } - _proto._getDimension = function _getDimension() { - var hasWidth = $(this._element).hasClass(Dimension.WIDTH); - return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; - }; + function mapToStyles(_ref2) { + var _Object$assign2; + + var popper = _ref2.popper, + popperRect = _ref2.popperRect, + placement = _ref2.placement, + offsets = _ref2.offsets, + position = _ref2.position, + gpuAcceleration = _ref2.gpuAcceleration, + adaptive = _ref2.adaptive, + roundOffsets = _ref2.roundOffsets; + + var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets, + _ref3$x = _ref3.x, + x = _ref3$x === void 0 ? 0 : _ref3$x, + _ref3$y = _ref3.y, + y = _ref3$y === void 0 ? 0 : _ref3$y; + + var hasX = offsets.hasOwnProperty('x'); + var hasY = offsets.hasOwnProperty('y'); + var sideX = left; + var sideY = top; + var win = window; + + if (adaptive) { + var offsetParent = getOffsetParent(popper); + var heightProp = 'clientHeight'; + var widthProp = 'clientWidth'; + + if (offsetParent === getWindow(popper)) { + offsetParent = getDocumentElement(popper); + + if (getComputedStyle$1(offsetParent).position !== 'static') { + heightProp = 'scrollHeight'; + widthProp = 'scrollWidth'; + } + } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it - _proto._getParent = function _getParent() { - var _this3 = this; - var parent; + offsetParent = offsetParent; - if (Util.isElement(this._config.parent)) { - parent = this._config.parent; // It's a jQuery object + if (placement === top) { + sideY = bottom; // $FlowFixMe[prop-missing] - if (typeof this._config.parent.jquery !== 'undefined') { - parent = this._config.parent[0]; - } - } else { - parent = document.querySelector(this._config.parent); + y -= offsetParent[heightProp] - popperRect.height; + y *= gpuAcceleration ? 1 : -1; } - var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; - var children = [].slice.call(parent.querySelectorAll(selector)); - $(children).each(function (i, element) { - _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); - }); - return parent; - }; - - _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { - var isOpen = $(element).hasClass(ClassName$3.SHOW); + if (placement === left) { + sideX = right; // $FlowFixMe[prop-missing] - if (triggerArray.length) { - $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); + x -= offsetParent[widthProp] - popperRect.width; + x *= gpuAcceleration ? 1 : -1; } - } // Static - ; - - Collapse._getTargetFromElement = function _getTargetFromElement(element) { - var selector = Util.getSelectorFromElement(element); - return selector ? document.querySelector(selector) : null; - }; - - Collapse._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var $this = $(this); - var data = $this.data(DATA_KEY$3); + } - var _config = _objectSpread({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {}); + var commonStyles = Object.assign({ + position: position + }, adaptive && unsetSides); - if (!data && _config.toggle && /show|hide/.test(config)) { - _config.toggle = false; - } + if (gpuAcceleration) { + var _Object$assign; - if (!data) { - data = new Collapse(this, _config); - $this.data(DATA_KEY$3, data); - } + return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign)); + } - if (typeof config === 'string') { - if (typeof data[config] === 'undefined') { - throw new TypeError("No method named \"" + config + "\""); - } + return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2)); + } - data[config](); - } - }); + function computeStyles(_ref4) { + var state = _ref4.state, + options = _ref4.options; + var _options$gpuAccelerat = options.gpuAcceleration, + gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, + _options$adaptive = options.adaptive, + adaptive = _options$adaptive === void 0 ? true : _options$adaptive, + _options$roundOffsets = options.roundOffsets, + roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets; + + var commonStyles = { + placement: getBasePlacement(state.placement), + popper: state.elements.popper, + popperRect: state.rects.popper, + gpuAcceleration: gpuAcceleration }; - _createClass(Collapse, null, [{ - key: "VERSION", - get: function get() { - return VERSION$3; - } - }, { - key: "Default", - get: function get() { - return Default$1; - } - }]); - - return Collapse; - }(); - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - - $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) { - // preventDefault only for elements (which change the URL) not inside the collapsible element - if (event.currentTarget.tagName === 'A') { - event.preventDefault(); + if (state.modifiersData.popperOffsets != null) { + state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, { + offsets: state.modifiersData.popperOffsets, + position: state.options.strategy, + adaptive: adaptive, + roundOffsets: roundOffsets + }))); } - var $trigger = $(this); - var selector = Util.getSelectorFromElement(this); - var selectors = [].slice.call(document.querySelectorAll(selector)); - $(selectors).each(function () { - var $target = $(this); - var data = $target.data(DATA_KEY$3); - var config = data ? 'toggle' : $trigger.data(); + if (state.modifiersData.arrow != null) { + state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, { + offsets: state.modifiersData.arrow, + position: 'absolute', + adaptive: false, + roundOffsets: roundOffsets + }))); + } - Collapse._jQueryInterface.call($target, config); + state.attributes.popper = Object.assign({}, state.attributes.popper, { + 'data-popper-placement': state.placement }); - }); - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ + } // eslint-disable-next-line import/no-unused-modules - $.fn[NAME$3] = Collapse._jQueryInterface; - $.fn[NAME$3].Constructor = Collapse; - $.fn[NAME$3].noConflict = function () { - $.fn[NAME$3] = JQUERY_NO_CONFLICT$3; - return Collapse._jQueryInterface; + var computeStyles$1 = { + name: 'computeStyles', + enabled: true, + phase: 'beforeWrite', + fn: computeStyles, + data: {} }; - /**! - * @fileOverview Kickass library to create and place poppers near their reference elements. - * @version 1.14.7 - * @license - * Copyright (c) 2016 Federico Zivolo and contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'; + var passive = { + passive: true + }; - var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; - var timeoutDuration = 0; - for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { - if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { - timeoutDuration = 1; - break; + function effect(_ref) { + var state = _ref.state, + instance = _ref.instance, + options = _ref.options; + var _options$scroll = options.scroll, + scroll = _options$scroll === void 0 ? true : _options$scroll, + _options$resize = options.resize, + resize = _options$resize === void 0 ? true : _options$resize; + var window = getWindow(state.elements.popper); + var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper); + + if (scroll) { + scrollParents.forEach(function (scrollParent) { + scrollParent.addEventListener('scroll', instance.update, passive); + }); + } + + if (resize) { + window.addEventListener('resize', instance.update, passive); } - } - function microtaskDebounce(fn) { - var called = false; return function () { - if (called) { - return; + if (scroll) { + scrollParents.forEach(function (scrollParent) { + scrollParent.removeEventListener('scroll', instance.update, passive); + }); } - called = true; - window.Promise.resolve().then(function () { - called = false; - fn(); - }); - }; - } - function taskDebounce(fn) { - var scheduled = false; - return function () { - if (!scheduled) { - scheduled = true; - setTimeout(function () { - scheduled = false; - fn(); - }, timeoutDuration); + if (resize) { + window.removeEventListener('resize', instance.update, passive); } }; - } + } // eslint-disable-next-line import/no-unused-modules - var supportsMicroTasks = isBrowser && window.Promise; - /** - * Create a debounced version of a method, that's asynchronously deferred - * but called in the minimum time possible. - * - * @method - * @memberof Popper.Utils - * @argument {Function} fn - * @returns {Function} - */ - var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; + var eventListeners = { + name: 'eventListeners', + enabled: true, + phase: 'write', + fn: function fn() {}, + effect: effect, + data: {} + }; - /** - * Check if the given variable is a function - * @method - * @memberof Popper.Utils - * @argument {Any} functionToCheck - variable to check - * @returns {Boolean} answer to: is a function? - */ - function isFunction(functionToCheck) { - var getType = {}; - return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; + var hash$1 = { + left: 'right', + right: 'left', + bottom: 'top', + top: 'bottom' + }; + function getOppositePlacement(placement) { + return placement.replace(/left|right|bottom|top/g, function (matched) { + return hash$1[matched]; + }); } - /** - * Get CSS computed property of the given element - * @method - * @memberof Popper.Utils - * @argument {Eement} element - * @argument {String} property - */ - function getStyleComputedProperty(element, property) { - if (element.nodeType !== 1) { - return []; - } - // NOTE: 1 DOM access here - var window = element.ownerDocument.defaultView; - var css = window.getComputedStyle(element, null); - return property ? css[property] : css; + var hash = { + start: 'end', + end: 'start' + }; + function getOppositeVariationPlacement(placement) { + return placement.replace(/start|end/g, function (matched) { + return hash[matched]; + }); } - /** - * Returns the parentNode or the host of the element - * @method - * @memberof Popper.Utils - * @argument {Element} element - * @returns {Element} parent - */ - function getParentNode(element) { - if (element.nodeName === 'HTML') { - return element; - } - return element.parentNode || element.host; + function getWindowScroll(node) { + var win = getWindow(node); + var scrollLeft = win.pageXOffset; + var scrollTop = win.pageYOffset; + return { + scrollLeft: scrollLeft, + scrollTop: scrollTop + }; } - /** - * Returns the scrolling parent of the given element - * @method - * @memberof Popper.Utils - * @argument {Element} element - * @returns {Element} scroll parent - */ - function getScrollParent(element) { - // Return body, `getScroll` will take care to get the correct `scrollTop` from it - if (!element) { - return document.body; - } + function getWindowScrollBarX(element) { + // If has a CSS width greater than the viewport, then this will be + // incorrect for RTL. + // Popper 1 is broken in this case and never had a bug report so let's assume + // it's not an issue. I don't think anyone ever specifies width on + // anyway. + // Browsers where the left scrollbar doesn't cause an issue report `0` for + // this (e.g. Edge 2019, IE11, Safari) + return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft; + } - switch (element.nodeName) { - case 'HTML': - case 'BODY': - return element.ownerDocument.body; - case '#document': - return element.body; + function getViewportRect(element) { + var win = getWindow(element); + var html = getDocumentElement(element); + var visualViewport = win.visualViewport; + var width = html.clientWidth; + var height = html.clientHeight; + var x = 0; + var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper + // can be obscured underneath it. + // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even + // if it isn't open, so if this isn't available, the popper will be detected + // to overflow the bottom of the screen too early. + + if (visualViewport) { + width = visualViewport.width; + height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently) + // In Chrome, it returns a value very close to 0 (+/-) but contains rounding + // errors due to floating point numbers, so we need to check precision. + // Safari returns a number <= 0, usually < -1 when pinch-zoomed + // Feature detection fails in mobile emulation mode in Chrome. + // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) < + // 0.001 + // Fallback here: "Not Safari" userAgent + + if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) { + x = visualViewport.offsetLeft; + y = visualViewport.offsetTop; + } } - // Firefox want us to check `-x` and `-y` variations as well + return { + width: width, + height: height, + x: x + getWindowScrollBarX(element), + y: y + }; + } + + // of the `` and `` rect bounds if horizontally scrollable - var _getStyleComputedProp = getStyleComputedProperty(element), - overflow = _getStyleComputedProp.overflow, - overflowX = _getStyleComputedProp.overflowX, - overflowY = _getStyleComputedProp.overflowY; + function getDocumentRect(element) { + var _element$ownerDocumen; - if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { - return element; + var html = getDocumentElement(element); + var winScroll = getWindowScroll(element); + var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body; + var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); + var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); + var x = -winScroll.scrollLeft + getWindowScrollBarX(element); + var y = -winScroll.scrollTop; + + if (getComputedStyle$1(body || html).direction === 'rtl') { + x += max(html.clientWidth, body ? body.clientWidth : 0) - width; } - return getScrollParent(getParentNode(element)); + return { + width: width, + height: height, + x: x, + y: y + }; } - var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); - var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); + function isScrollParent(element) { + // Firefox wants us to check `-x` and `-y` variations as well + var _getComputedStyle = getComputedStyle$1(element), + overflow = _getComputedStyle.overflow, + overflowX = _getComputedStyle.overflowX, + overflowY = _getComputedStyle.overflowY; - /** - * Determines if the browser is Internet Explorer - * @method - * @memberof Popper.Utils - * @param {Number} version to check - * @returns {Boolean} isIE - */ - function isIE(version) { - if (version === 11) { - return isIE11; - } - if (version === 10) { - return isIE10; - } - return isIE11 || isIE10; + return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX); } - /** - * Returns the offset parent of the given element - * @method - * @memberof Popper.Utils - * @argument {Element} element - * @returns {Element} offset parent - */ - function getOffsetParent(element) { - if (!element) { - return document.documentElement; + function getScrollParent(node) { + if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) { + // $FlowFixMe[incompatible-return]: assume body is always available + return node.ownerDocument.body; } - var noOffsetParent = isIE(10) ? document.body : null; - - // NOTE: 1 DOM access here - var offsetParent = element.offsetParent || null; - // Skip hidden elements which don't have an offsetParent - while (offsetParent === noOffsetParent && element.nextElementSibling) { - offsetParent = (element = element.nextElementSibling).offsetParent; + if (isHTMLElement(node) && isScrollParent(node)) { + return node; } - var nodeName = offsetParent && offsetParent.nodeName; + return getScrollParent(getParentNode(node)); + } - if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { - return element ? element.ownerDocument.documentElement : document.documentElement; - } + /* + given a DOM element, return the list of all scroll parents, up the list of ancesors + until we get to the top window object. This list is what we attach scroll listeners + to, because if any of these parent elements scroll, we'll need to re-calculate the + reference element's position. + */ + + function listScrollParents(element, list) { + var _element$ownerDocumen; - // .offsetParent will return the closest TH, TD or TABLE in case - // no offsetParent is present, I hate this job... - if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { - return getOffsetParent(offsetParent); + if (list === void 0) { + list = []; } - return offsetParent; + var scrollParent = getScrollParent(element); + var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body); + var win = getWindow(scrollParent); + var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent; + var updatedList = list.concat(target); + return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here + updatedList.concat(listScrollParents(getParentNode(target))); } - function isOffsetContainer(element) { - var nodeName = element.nodeName; - - if (nodeName === 'BODY') { - return false; - } - return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; + function rectToClientRect(rect) { + return Object.assign({}, rect, { + left: rect.x, + top: rect.y, + right: rect.x + rect.width, + bottom: rect.y + rect.height + }); } - /** - * Finds the root node (document, shadowDOM root) of the given element - * @method - * @memberof Popper.Utils - * @argument {Element} node - * @returns {Element} root node - */ - function getRoot(node) { - if (node.parentNode !== null) { - return getRoot(node.parentNode); - } - - return node; + function getInnerBoundingClientRect(element) { + var rect = getBoundingClientRect(element); + rect.top = rect.top + element.clientTop; + rect.left = rect.left + element.clientLeft; + rect.bottom = rect.top + element.clientHeight; + rect.right = rect.left + element.clientWidth; + rect.width = element.clientWidth; + rect.height = element.clientHeight; + rect.x = rect.left; + rect.y = rect.top; + return rect; } - /** - * Finds the offset parent common to the two provided nodes - * @method - * @memberof Popper.Utils - * @argument {Element} element1 - * @argument {Element} element2 - * @returns {Element} common offset parent - */ - function findCommonOffsetParent(element1, element2) { - // This check is needed to avoid errors in case one of the elements isn't defined for any reason - if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { - return document.documentElement; - } - - // Here we make sure to give as "start" the element that comes first in the DOM - var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; - var start = order ? element1 : element2; - var end = order ? element2 : element1; + function getClientRectFromMixedType(element, clippingParent) { + return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element))); + } // A "clipping parent" is an overflowable container with the characteristic of + // clipping (or hiding) overflowing elements with a position different from + // `initial` - // Get common ancestor container - var range = document.createRange(); - range.setStart(start, 0); - range.setEnd(end, 0); - var commonAncestorContainer = range.commonAncestorContainer; - // Both nodes are inside #document + function getClippingParents(element) { + var clippingParents = listScrollParents(getParentNode(element)); + var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0; + var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element; - if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { - if (isOffsetContainer(commonAncestorContainer)) { - return commonAncestorContainer; - } + if (!isElement(clipperElement)) { + return []; + } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414 - return getOffsetParent(commonAncestorContainer); - } - // one of the nodes is inside shadowDOM, find which one - var element1root = getRoot(element1); - if (element1root.host) { - return findCommonOffsetParent(element1root.host, element2); - } else { - return findCommonOffsetParent(element1, getRoot(element2).host); - } + return clippingParents.filter(function (clippingParent) { + return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body'; + }); + } // Gets the maximum area that the element is visible in due to any number of + // clipping parents + + + function getClippingRect(element, boundary, rootBoundary) { + var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary); + var clippingParents = [].concat(mainClippingParents, [rootBoundary]); + var firstClippingParent = clippingParents[0]; + var clippingRect = clippingParents.reduce(function (accRect, clippingParent) { + var rect = getClientRectFromMixedType(element, clippingParent); + accRect.top = max(rect.top, accRect.top); + accRect.right = min(rect.right, accRect.right); + accRect.bottom = min(rect.bottom, accRect.bottom); + accRect.left = max(rect.left, accRect.left); + return accRect; + }, getClientRectFromMixedType(element, firstClippingParent)); + clippingRect.width = clippingRect.right - clippingRect.left; + clippingRect.height = clippingRect.bottom - clippingRect.top; + clippingRect.x = clippingRect.left; + clippingRect.y = clippingRect.top; + return clippingRect; } - /** - * Gets the scroll value of the given element in the given side (top and left) - * @method - * @memberof Popper.Utils - * @argument {Element} element - * @argument {String} side `top` or `left` - * @returns {number} amount of scrolled pixels - */ - function getScroll(element) { - var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; + function getVariation(placement) { + return placement.split('-')[1]; + } - var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; - var nodeName = element.nodeName; + function computeOffsets(_ref) { + var reference = _ref.reference, + element = _ref.element, + placement = _ref.placement; + var basePlacement = placement ? getBasePlacement(placement) : null; + var variation = placement ? getVariation(placement) : null; + var commonX = reference.x + reference.width / 2 - element.width / 2; + var commonY = reference.y + reference.height / 2 - element.height / 2; + var offsets; + + switch (basePlacement) { + case top: + offsets = { + x: commonX, + y: reference.y - element.height + }; + break; - if (nodeName === 'BODY' || nodeName === 'HTML') { - var html = element.ownerDocument.documentElement; - var scrollingElement = element.ownerDocument.scrollingElement || html; - return scrollingElement[upperSide]; - } + case bottom: + offsets = { + x: commonX, + y: reference.y + reference.height + }; + break; - return element[upperSide]; - } + case right: + offsets = { + x: reference.x + reference.width, + y: commonY + }; + break; - /* - * Sum or subtract the element scroll values (left and top) from a given rect object - * @method - * @memberof Popper.Utils - * @param {Object} rect - Rect object you want to change - * @param {HTMLElement} element - The element from the function reads the scroll values - * @param {Boolean} subtract - set to true if you want to subtract the scroll values - * @return {Object} rect - The modifier rect object - */ - function includeScroll(rect, element) { - var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - var scrollTop = getScroll(element, 'top'); - var scrollLeft = getScroll(element, 'left'); - var modifier = subtract ? -1 : 1; - rect.top += scrollTop * modifier; - rect.bottom += scrollTop * modifier; - rect.left += scrollLeft * modifier; - rect.right += scrollLeft * modifier; - return rect; - } + case left: + offsets = { + x: reference.x - element.width, + y: commonY + }; + break; - /* - * Helper to detect borders of a given element - * @method - * @memberof Popper.Utils - * @param {CSSStyleDeclaration} styles - * Result of `getStyleComputedProperty` on the given element - * @param {String} axis - `x` or `y` - * @return {number} borders - The borders size of the given axis - */ + default: + offsets = { + x: reference.x, + y: reference.y + }; + } - function getBordersSize(styles, axis) { - var sideA = axis === 'x' ? 'Left' : 'Top'; - var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; + var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null; - return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10); - } + if (mainAxis != null) { + var len = mainAxis === 'y' ? 'height' : 'width'; - function getSize(axis, body, html, computedStyle) { - return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0); - } + switch (variation) { + case start: + offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2); + break; - function getWindowSizes(document) { - var body = document.body; - var html = document.documentElement; - var computedStyle = isIE(10) && getComputedStyle(html); + case end: + offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2); + break; + } + } - return { - height: getSize('Height', body, html, computedStyle), - width: getSize('Width', body, html, computedStyle) - }; + return offsets; } - var classCallCheck = function (instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - }; - - var createClass = function () { - function defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } + function detectOverflow(state, options) { + if (options === void 0) { + options = {}; } - return function (Constructor, protoProps, staticProps) { - if (protoProps) defineProperties(Constructor.prototype, protoProps); - if (staticProps) defineProperties(Constructor, staticProps); - return Constructor; + var _options = options, + _options$placement = _options.placement, + placement = _options$placement === void 0 ? state.placement : _options$placement, + _options$boundary = _options.boundary, + boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, + _options$rootBoundary = _options.rootBoundary, + rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, + _options$elementConte = _options.elementContext, + elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, + _options$altBoundary = _options.altBoundary, + altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, + _options$padding = _options.padding, + padding = _options$padding === void 0 ? 0 : _options$padding; + var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); + var altContext = elementContext === popper ? reference : popper; + var referenceElement = state.elements.reference; + var popperRect = state.rects.popper; + var element = state.elements[altBoundary ? altContext : elementContext]; + var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary); + var referenceClientRect = getBoundingClientRect(referenceElement); + var popperOffsets = computeOffsets({ + reference: referenceClientRect, + element: popperRect, + strategy: 'absolute', + placement: placement + }); + var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets)); + var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect + // 0 or negative = within the clipping rect + + var overflowOffsets = { + top: clippingClientRect.top - elementClientRect.top + paddingObject.top, + bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom, + left: clippingClientRect.left - elementClientRect.left + paddingObject.left, + right: elementClientRect.right - clippingClientRect.right + paddingObject.right }; - }(); + var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element + + if (elementContext === popper && offsetData) { + var offset = offsetData[placement]; + Object.keys(overflowOffsets).forEach(function (key) { + var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1; + var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x'; + overflowOffsets[key] += offset[axis] * multiply; + }); + } + return overflowOffsets; + } + function computeAutoPlacement(state, options) { + if (options === void 0) { + options = {}; + } + var _options = options, + placement = _options.placement, + boundary = _options.boundary, + rootBoundary = _options.rootBoundary, + padding = _options.padding, + flipVariations = _options.flipVariations, + _options$allowedAutoP = _options.allowedAutoPlacements, + allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP; + var variation = getVariation(placement); + var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) { + return getVariation(placement) === variation; + }) : basePlacements; + var allowedPlacements = placements$1.filter(function (placement) { + return allowedAutoPlacements.indexOf(placement) >= 0; + }); + if (allowedPlacements.length === 0) { + allowedPlacements = placements$1; + } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions... + + + var overflows = allowedPlacements.reduce(function (acc, placement) { + acc[placement] = detectOverflow(state, { + placement: placement, + boundary: boundary, + rootBoundary: rootBoundary, + padding: padding + })[getBasePlacement(placement)]; + return acc; + }, {}); + return Object.keys(overflows).sort(function (a, b) { + return overflows[a] - overflows[b]; + }); + } - var defineProperty = function (obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; + function getExpandedFallbackPlacements(placement) { + if (getBasePlacement(placement) === auto) { + return []; } - return obj; - }; + var oppositePlacement = getOppositePlacement(placement); + return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)]; + } - var _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; + function flip(_ref) { + var state = _ref.state, + options = _ref.options, + name = _ref.name; - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } + if (state.modifiersData[name]._skip) { + return; } - return target; - }; - - /** - * Given element offsets, generate an output similar to getBoundingClientRect - * @method - * @memberof Popper.Utils - * @argument {Object} offsets - * @returns {Object} ClientRect like output - */ - function getClientRect(offsets) { - return _extends({}, offsets, { - right: offsets.left + offsets.width, - bottom: offsets.top + offsets.height - }); - } + var _options$mainAxis = options.mainAxis, + checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, + _options$altAxis = options.altAxis, + checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, + specifiedFallbackPlacements = options.fallbackPlacements, + padding = options.padding, + boundary = options.boundary, + rootBoundary = options.rootBoundary, + altBoundary = options.altBoundary, + _options$flipVariatio = options.flipVariations, + flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, + allowedAutoPlacements = options.allowedAutoPlacements; + var preferredPlacement = state.options.placement; + var basePlacement = getBasePlacement(preferredPlacement); + var isBasePlacement = basePlacement === preferredPlacement; + var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement)); + var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) { + return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, { + placement: placement, + boundary: boundary, + rootBoundary: rootBoundary, + padding: padding, + flipVariations: flipVariations, + allowedAutoPlacements: allowedAutoPlacements + }) : placement); + }, []); + var referenceRect = state.rects.reference; + var popperRect = state.rects.popper; + var checksMap = new Map(); + var makeFallbackChecks = true; + var firstFittingPlacement = placements[0]; + + for (var i = 0; i < placements.length; i++) { + var placement = placements[i]; + + var _basePlacement = getBasePlacement(placement); + + var isStartVariation = getVariation(placement) === start; + var isVertical = [top, bottom].indexOf(_basePlacement) >= 0; + var len = isVertical ? 'width' : 'height'; + var overflow = detectOverflow(state, { + placement: placement, + boundary: boundary, + rootBoundary: rootBoundary, + altBoundary: altBoundary, + padding: padding + }); + var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top; - /** - * Get bounding client rect of given element - * @method - * @memberof Popper.Utils - * @param {HTMLElement} element - * @return {Object} client rect - */ - function getBoundingClientRect(element) { - var rect = {}; - - // IE10 10 FIX: Please, don't ask, the element isn't - // considered in DOM in some circumstances... - // This isn't reproducible in IE10 compatibility mode of IE11 - try { - if (isIE(10)) { - rect = element.getBoundingClientRect(); - var scrollTop = getScroll(element, 'top'); - var scrollLeft = getScroll(element, 'left'); - rect.top += scrollTop; - rect.left += scrollLeft; - rect.bottom += scrollTop; - rect.right += scrollLeft; - } else { - rect = element.getBoundingClientRect(); + if (referenceRect[len] > popperRect[len]) { + mainVariationSide = getOppositePlacement(mainVariationSide); } - } catch (e) {} - var result = { - left: rect.left, - top: rect.top, - width: rect.right - rect.left, - height: rect.bottom - rect.top - }; + var altVariationSide = getOppositePlacement(mainVariationSide); + var checks = []; - // subtract scrollbar size from sizes - var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {}; - var width = sizes.width || element.clientWidth || result.right - result.left; - var height = sizes.height || element.clientHeight || result.bottom - result.top; + if (checkMainAxis) { + checks.push(overflow[_basePlacement] <= 0); + } - var horizScrollbar = element.offsetWidth - width; - var vertScrollbar = element.offsetHeight - height; + if (checkAltAxis) { + checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0); + } - // if an hypothetical scrollbar is detected, we must be sure it's not a `border` - // we make this check conditional for performance reasons - if (horizScrollbar || vertScrollbar) { - var styles = getStyleComputedProperty(element); - horizScrollbar -= getBordersSize(styles, 'x'); - vertScrollbar -= getBordersSize(styles, 'y'); + if (checks.every(function (check) { + return check; + })) { + firstFittingPlacement = placement; + makeFallbackChecks = false; + break; + } - result.width -= horizScrollbar; - result.height -= vertScrollbar; + checksMap.set(placement, checks); } - return getClientRect(result); - } + if (makeFallbackChecks) { + // `2` may be desired in some cases – research later + var numberOfChecks = flipVariations ? 3 : 1; - function getOffsetRectRelativeToArbitraryNode(children, parent) { - var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - var isIE10 = isIE(10); - var isHTML = parent.nodeName === 'HTML'; - var childrenRect = getBoundingClientRect(children); - var parentRect = getBoundingClientRect(parent); - var scrollParent = getScrollParent(children); - - var styles = getStyleComputedProperty(parent); - var borderTopWidth = parseFloat(styles.borderTopWidth, 10); - var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10); - - // In cases where the parent is fixed, we must ignore negative scroll in offset calc - if (fixedPosition && isHTML) { - parentRect.top = Math.max(parentRect.top, 0); - parentRect.left = Math.max(parentRect.left, 0); - } - var offsets = getClientRect({ - top: childrenRect.top - parentRect.top - borderTopWidth, - left: childrenRect.left - parentRect.left - borderLeftWidth, - width: childrenRect.width, - height: childrenRect.height - }); - offsets.marginTop = 0; - offsets.marginLeft = 0; + var _loop = function _loop(_i) { + var fittingPlacement = placements.find(function (placement) { + var checks = checksMap.get(placement); - // Subtract margins of documentElement in case it's being used as parent - // we do this only on HTML because it's the only element that behaves - // differently when margins are applied to it. The margins are included in - // the box of the documentElement, in the other cases not. - if (!isIE10 && isHTML) { - var marginTop = parseFloat(styles.marginTop, 10); - var marginLeft = parseFloat(styles.marginLeft, 10); + if (checks) { + return checks.slice(0, _i).every(function (check) { + return check; + }); + } + }); - offsets.top -= borderTopWidth - marginTop; - offsets.bottom -= borderTopWidth - marginTop; - offsets.left -= borderLeftWidth - marginLeft; - offsets.right -= borderLeftWidth - marginLeft; + if (fittingPlacement) { + firstFittingPlacement = fittingPlacement; + return "break"; + } + }; - // Attach marginTop and marginLeft because in some circumstances we may need them - offsets.marginTop = marginTop; - offsets.marginLeft = marginLeft; - } + for (var _i = numberOfChecks; _i > 0; _i--) { + var _ret = _loop(_i); - if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { - offsets = includeScroll(offsets, parent); + if (_ret === "break") break; + } } - return offsets; - } + if (state.placement !== firstFittingPlacement) { + state.modifiersData[name]._skip = true; + state.placement = firstFittingPlacement; + state.reset = true; + } + } // eslint-disable-next-line import/no-unused-modules - function getViewportOffsetRectRelativeToArtbitraryNode(element) { - var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var html = element.ownerDocument.documentElement; - var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); - var width = Math.max(html.clientWidth, window.innerWidth || 0); - var height = Math.max(html.clientHeight, window.innerHeight || 0); + var flip$1 = { + name: 'flip', + enabled: true, + phase: 'main', + fn: flip, + requiresIfExists: ['offset'], + data: { + _skip: false + } + }; - var scrollTop = !excludeScroll ? getScroll(html) : 0; - var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; + function getSideOffsets(overflow, rect, preventedOffsets) { + if (preventedOffsets === void 0) { + preventedOffsets = { + x: 0, + y: 0 + }; + } - var offset = { - top: scrollTop - relativeOffset.top + relativeOffset.marginTop, - left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, - width: width, - height: height + return { + top: overflow.top - rect.height - preventedOffsets.y, + right: overflow.right - rect.width + preventedOffsets.x, + bottom: overflow.bottom - rect.height + preventedOffsets.y, + left: overflow.left - rect.width - preventedOffsets.x }; - - return getClientRect(offset); } - /** - * Check if the given element is fixed or is inside a fixed parent - * @method - * @memberof Popper.Utils - * @argument {Element} element - * @argument {Element} customContainer - * @returns {Boolean} answer to "isFixed?" - */ - function isFixed(element) { - var nodeName = element.nodeName; - if (nodeName === 'BODY' || nodeName === 'HTML') { - return false; - } - if (getStyleComputedProperty(element, 'position') === 'fixed') { - return true; - } - var parentNode = getParentNode(element); - if (!parentNode) { - return false; - } - return isFixed(parentNode); + function isAnySideFullyClipped(overflow) { + return [top, right, bottom, left].some(function (side) { + return overflow[side] >= 0; + }); } - /** - * Finds the first parent of an element that has a transformed property defined - * @method - * @memberof Popper.Utils - * @argument {Element} element - * @returns {Element} first transformed parent or documentElement - */ - - function getFixedPositionOffsetParent(element) { - // This check is needed to avoid errors in case one of the elements isn't defined for any reason - if (!element || !element.parentElement || isIE()) { - return document.documentElement; - } - var el = element.parentElement; - while (el && getStyleComputedProperty(el, 'transform') === 'none') { - el = el.parentElement; - } - return el || document.documentElement; - } + function hide(_ref) { + var state = _ref.state, + name = _ref.name; + var referenceRect = state.rects.reference; + var popperRect = state.rects.popper; + var preventedOffsets = state.modifiersData.preventOverflow; + var referenceOverflow = detectOverflow(state, { + elementContext: 'reference' + }); + var popperAltOverflow = detectOverflow(state, { + altBoundary: true + }); + var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect); + var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets); + var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets); + var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets); + state.modifiersData[name] = { + referenceClippingOffsets: referenceClippingOffsets, + popperEscapeOffsets: popperEscapeOffsets, + isReferenceHidden: isReferenceHidden, + hasPopperEscaped: hasPopperEscaped + }; + state.attributes.popper = Object.assign({}, state.attributes.popper, { + 'data-popper-reference-hidden': isReferenceHidden, + 'data-popper-escaped': hasPopperEscaped + }); + } // eslint-disable-next-line import/no-unused-modules - /** - * Computed the boundaries limits and return them - * @method - * @memberof Popper.Utils - * @param {HTMLElement} popper - * @param {HTMLElement} reference - * @param {number} padding - * @param {HTMLElement} boundariesElement - Element used to define the boundaries - * @param {Boolean} fixedPosition - Is in fixed position mode - * @returns {Object} Coordinates of the boundaries - */ - function getBoundaries(popper, reference, padding, boundariesElement) { - var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; - // NOTE: 1 DOM access here + var hide$1 = { + name: 'hide', + enabled: true, + phase: 'main', + requiresIfExists: ['preventOverflow'], + fn: hide + }; - var boundaries = { top: 0, left: 0 }; - var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); + function distanceAndSkiddingToXY(placement, rects, offset) { + var basePlacement = getBasePlacement(placement); + var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1; + + var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, { + placement: placement + })) : offset, + skidding = _ref[0], + distance = _ref[1]; + + skidding = skidding || 0; + distance = (distance || 0) * invertDistance; + return [left, right].indexOf(basePlacement) >= 0 ? { + x: distance, + y: skidding + } : { + x: skidding, + y: distance + }; + } - // Handle viewport case - if (boundariesElement === 'viewport') { - boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); - } else { - // Handle other cases based on DOM element used as boundaries - var boundariesNode = void 0; - if (boundariesElement === 'scrollParent') { - boundariesNode = getScrollParent(getParentNode(reference)); - if (boundariesNode.nodeName === 'BODY') { - boundariesNode = popper.ownerDocument.documentElement; - } - } else if (boundariesElement === 'window') { - boundariesNode = popper.ownerDocument.documentElement; - } else { - boundariesNode = boundariesElement; - } + function offset(_ref2) { + var state = _ref2.state, + options = _ref2.options, + name = _ref2.name; + var _options$offset = options.offset, + offset = _options$offset === void 0 ? [0, 0] : _options$offset; + var data = placements.reduce(function (acc, placement) { + acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset); + return acc; + }, {}); + var _data$state$placement = data[state.placement], + x = _data$state$placement.x, + y = _data$state$placement.y; + + if (state.modifiersData.popperOffsets != null) { + state.modifiersData.popperOffsets.x += x; + state.modifiersData.popperOffsets.y += y; + } - var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); + state.modifiersData[name] = data; + } // eslint-disable-next-line import/no-unused-modules - // In case of HTML, we need a different computation - if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { - var _getWindowSizes = getWindowSizes(popper.ownerDocument), - height = _getWindowSizes.height, - width = _getWindowSizes.width; - boundaries.top += offsets.top - offsets.marginTop; - boundaries.bottom = height + offsets.top; - boundaries.left += offsets.left - offsets.marginLeft; - boundaries.right = width + offsets.left; - } else { - // for all the other DOM elements, this one is good - boundaries = offsets; - } - } + var offset$1 = { + name: 'offset', + enabled: true, + phase: 'main', + requires: ['popperOffsets'], + fn: offset + }; - // Add paddings - padding = padding || 0; - var isPaddingNumber = typeof padding === 'number'; - boundaries.left += isPaddingNumber ? padding : padding.left || 0; - boundaries.top += isPaddingNumber ? padding : padding.top || 0; - boundaries.right -= isPaddingNumber ? padding : padding.right || 0; - boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; + function popperOffsets(_ref) { + var state = _ref.state, + name = _ref.name; + // Offsets are the actual position the popper needs to have to be + // properly positioned near its reference element + // This is the most basic placement, and will be adjusted by + // the modifiers in the next step + state.modifiersData[name] = computeOffsets({ + reference: state.rects.reference, + element: state.rects.popper, + strategy: 'absolute', + placement: state.placement + }); + } // eslint-disable-next-line import/no-unused-modules - return boundaries; - } - function getArea(_ref) { - var width = _ref.width, - height = _ref.height; + var popperOffsets$1 = { + name: 'popperOffsets', + enabled: true, + phase: 'read', + fn: popperOffsets, + data: {} + }; - return width * height; + function getAltAxis(axis) { + return axis === 'x' ? 'y' : 'x'; } - /** - * Utility used to transform the `auto` placement to the placement with more - * available space. - * @method - * @memberof Popper.Utils - * @argument {Object} data - The data object generated by update method - * @argument {Object} options - Modifiers configuration and options - * @returns {Object} The data object, properly modified - */ - function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { - var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; + function preventOverflow(_ref) { + var state = _ref.state, + options = _ref.options, + name = _ref.name; + var _options$mainAxis = options.mainAxis, + checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, + _options$altAxis = options.altAxis, + checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, + boundary = options.boundary, + rootBoundary = options.rootBoundary, + altBoundary = options.altBoundary, + padding = options.padding, + _options$tether = options.tether, + tether = _options$tether === void 0 ? true : _options$tether, + _options$tetherOffset = options.tetherOffset, + tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset; + var overflow = detectOverflow(state, { + boundary: boundary, + rootBoundary: rootBoundary, + padding: padding, + altBoundary: altBoundary + }); + var basePlacement = getBasePlacement(state.placement); + var variation = getVariation(state.placement); + var isBasePlacement = !variation; + var mainAxis = getMainAxisFromPlacement(basePlacement); + var altAxis = getAltAxis(mainAxis); + var popperOffsets = state.modifiersData.popperOffsets; + var referenceRect = state.rects.reference; + var popperRect = state.rects.popper; + var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, { + placement: state.placement + })) : tetherOffset; + var data = { + x: 0, + y: 0 + }; - if (placement.indexOf('auto') === -1) { - return placement; + if (!popperOffsets) { + return; } - var boundaries = getBoundaries(popper, reference, padding, boundariesElement); + if (checkMainAxis || checkAltAxis) { + var mainSide = mainAxis === 'y' ? top : left; + var altSide = mainAxis === 'y' ? bottom : right; + var len = mainAxis === 'y' ? 'height' : 'width'; + var offset = popperOffsets[mainAxis]; + var min$1 = popperOffsets[mainAxis] + overflow[mainSide]; + var max$1 = popperOffsets[mainAxis] - overflow[altSide]; + var additive = tether ? -popperRect[len] / 2 : 0; + var minLen = variation === start ? referenceRect[len] : popperRect[len]; + var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go + // outside the reference bounds + + var arrowElement = state.elements.arrow; + var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : { + width: 0, + height: 0 + }; + var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject(); + var arrowPaddingMin = arrowPaddingObject[mainSide]; + var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want + // to include its full size in the calculation. If the reference is small + // and near the edge of a boundary, the popper can overflow even if the + // reference is not overflowing as well (e.g. virtual elements with no + // width or height) - var rects = { - top: { - width: boundaries.width, - height: refRect.top - boundaries.top - }, - right: { - width: boundaries.right - refRect.right, - height: boundaries.height - }, - bottom: { - width: boundaries.width, - height: boundaries.bottom - refRect.bottom - }, - left: { - width: refRect.left - boundaries.left, - height: boundaries.height + var arrowLen = within(0, referenceRect[len], arrowRect[len]); + var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue; + var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue; + var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow); + var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0; + var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0; + var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset; + var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue; + + if (checkMainAxis) { + var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1); + popperOffsets[mainAxis] = preventedOffset; + data[mainAxis] = preventedOffset - offset; } - }; - var sortedAreas = Object.keys(rects).map(function (key) { - return _extends({ - key: key - }, rects[key], { - area: getArea(rects[key]) - }); - }).sort(function (a, b) { - return b.area - a.area; - }); + if (checkAltAxis) { + var _mainSide = mainAxis === 'x' ? top : left; - var filteredAreas = sortedAreas.filter(function (_ref2) { - var width = _ref2.width, - height = _ref2.height; - return width >= popper.clientWidth && height >= popper.clientHeight; - }); + var _altSide = mainAxis === 'x' ? bottom : right; - var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; + var _offset = popperOffsets[altAxis]; - var variation = placement.split('-')[1]; + var _min = _offset + overflow[_mainSide]; - return computedPlacement + (variation ? '-' + variation : ''); - } + var _max = _offset - overflow[_altSide]; - /** - * Get offsets to the reference element - * @method - * @memberof Popper.Utils - * @param {Object} state - * @param {Element} popper - the popper element - * @param {Element} reference - the reference element (the popper will be relative to this) - * @param {Element} fixedPosition - is in fixed position mode - * @returns {Object} An object containing the offsets which will be applied to the popper - */ - function getReferenceOffsets(state, popper, reference) { - var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; + var _preventedOffset = within(tether ? min(_min, tetherMin) : _min, _offset, tether ? max(_max, tetherMax) : _max); - var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); - return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); - } + popperOffsets[altAxis] = _preventedOffset; + data[altAxis] = _preventedOffset - _offset; + } + } - /** - * Get the outer sizes of the given element (offset size + margins) - * @method - * @memberof Popper.Utils - * @argument {Element} element - * @returns {Object} object containing width and height properties - */ - function getOuterSizes(element) { - var window = element.ownerDocument.defaultView; - var styles = window.getComputedStyle(element); - var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); - var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); - var result = { - width: element.offsetWidth + y, - height: element.offsetHeight + x + state.modifiersData[name] = data; + } // eslint-disable-next-line import/no-unused-modules + + + var preventOverflow$1 = { + name: 'preventOverflow', + enabled: true, + phase: 'main', + fn: preventOverflow, + requiresIfExists: ['offset'] + }; + + function getHTMLElementScroll(element) { + return { + scrollLeft: element.scrollLeft, + scrollTop: element.scrollTop }; - return result; } - /** - * Get the opposite placement of the given one - * @method - * @memberof Popper.Utils - * @argument {String} placement - * @returns {String} flipped placement - */ - function getOppositePlacement(placement) { - var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; - return placement.replace(/left|right|bottom|top/g, function (matched) { - return hash[matched]; - }); + function getNodeScroll(node) { + if (node === getWindow(node) || !isHTMLElement(node)) { + return getWindowScroll(node); + } else { + return getHTMLElementScroll(node); + } } - /** - * Get offsets to the popper - * @method - * @memberof Popper.Utils - * @param {Object} position - CSS position the Popper will get applied - * @param {HTMLElement} popper - the popper element - * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) - * @param {String} placement - one of the valid placement options - * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper - */ - function getPopperOffsets(popper, referenceOffsets, placement) { - placement = placement.split('-')[0]; - - // Get popper node sizes - var popperRect = getOuterSizes(popper); + function isElementScaled(element) { + var rect = element.getBoundingClientRect(); + var scaleX = rect.width / element.offsetWidth || 1; + var scaleY = rect.height / element.offsetHeight || 1; + return scaleX !== 1 || scaleY !== 1; + } // Returns the composite rect of an element relative to its offsetParent. + // Composite means it takes into account transforms as well as layout. - // Add position, width and height to our offsets object - var popperOffsets = { - width: popperRect.width, - height: popperRect.height - }; - - // depending by the popper placement we have to compute its offsets slightly differently - var isHoriz = ['right', 'left'].indexOf(placement) !== -1; - var mainSide = isHoriz ? 'top' : 'left'; - var secondarySide = isHoriz ? 'left' : 'top'; - var measurement = isHoriz ? 'height' : 'width'; - var secondaryMeasurement = !isHoriz ? 'height' : 'width'; - popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; - if (placement === secondarySide) { - popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; - } else { - popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; + function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) { + if (isFixed === void 0) { + isFixed = false; } - return popperOffsets; - } + var isOffsetParentAnElement = isHTMLElement(offsetParent); + var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent); + var documentElement = getDocumentElement(offsetParent); + var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled); + var scroll = { + scrollLeft: 0, + scrollTop: 0 + }; + var offsets = { + x: 0, + y: 0 + }; - /** - * Mimics the `find` method of Array - * @method - * @memberof Popper.Utils - * @argument {Array} arr - * @argument prop - * @argument value - * @returns index or -1 - */ - function find(arr, check) { - // use native find if supported - if (Array.prototype.find) { - return arr.find(check); + if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { + if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078 + isScrollParent(documentElement)) { + scroll = getNodeScroll(offsetParent); + } + + if (isHTMLElement(offsetParent)) { + offsets = getBoundingClientRect(offsetParent, true); + offsets.x += offsetParent.clientLeft; + offsets.y += offsetParent.clientTop; + } else if (documentElement) { + offsets.x = getWindowScrollBarX(documentElement); + } } - // use `filter` to obtain the same behavior of `find` - return arr.filter(check)[0]; + return { + x: rect.left + scroll.scrollLeft - offsets.x, + y: rect.top + scroll.scrollTop - offsets.y, + width: rect.width, + height: rect.height + }; } - /** - * Return the index of the matching object - * @method - * @memberof Popper.Utils - * @argument {Array} arr - * @argument prop - * @argument value - * @returns index or -1 - */ - function findIndex(arr, prop, value) { - // use native findIndex if supported - if (Array.prototype.findIndex) { - return arr.findIndex(function (cur) { - return cur[prop] === value; + function order(modifiers) { + var map = new Map(); + var visited = new Set(); + var result = []; + modifiers.forEach(function (modifier) { + map.set(modifier.name, modifier); + }); // On visiting object, check for its dependencies and visit them recursively + + function sort(modifier) { + visited.add(modifier.name); + var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []); + requires.forEach(function (dep) { + if (!visited.has(dep)) { + var depModifier = map.get(dep); + + if (depModifier) { + sort(depModifier); + } + } }); + result.push(modifier); } - // use `find` + `indexOf` if `findIndex` isn't supported - var match = find(arr, function (obj) { - return obj[prop] === value; + modifiers.forEach(function (modifier) { + if (!visited.has(modifier.name)) { + // check for visited object + sort(modifier); + } }); - return arr.indexOf(match); + return result; } - /** - * Loop trough the list of modifiers and run them in order, - * each of them will then edit the data object. - * @method - * @memberof Popper.Utils - * @param {dataObject} data - * @param {Array} modifiers - * @param {String} ends - Optional modifier name used as stopper - * @returns {dataObject} - */ - function runModifiers(modifiers, data, ends) { - var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); + function orderModifiers(modifiers) { + // order based on dependencies + var orderedModifiers = order(modifiers); // order based on phase - modifiersToRun.forEach(function (modifier) { - if (modifier['function']) { - // eslint-disable-line dot-notation - console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); - } - var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation - if (modifier.enabled && isFunction(fn)) { - // Add properties to offsets to make them a complete clientRect object - // we do this before each modifier to make sure the previous one doesn't - // mess with these values - data.offsets.popper = getClientRect(data.offsets.popper); - data.offsets.reference = getClientRect(data.offsets.reference); + return modifierPhases.reduce(function (acc, phase) { + return acc.concat(orderedModifiers.filter(function (modifier) { + return modifier.phase === phase; + })); + }, []); + } - data = fn(data, modifier); + function debounce(fn) { + var pending; + return function () { + if (!pending) { + pending = new Promise(function (resolve) { + Promise.resolve().then(function () { + pending = undefined; + resolve(fn()); + }); + }); } + + return pending; + }; + } + + function mergeByName(modifiers) { + var merged = modifiers.reduce(function (merged, current) { + var existing = merged[current.name]; + merged[current.name] = existing ? Object.assign({}, existing, current, { + options: Object.assign({}, existing.options, current.options), + data: Object.assign({}, existing.data, current.data) + }) : current; + return merged; + }, {}); // IE11 does not support Object.values + + return Object.keys(merged).map(function (key) { + return merged[key]; }); + } + + var DEFAULT_OPTIONS = { + placement: 'bottom', + modifiers: [], + strategy: 'absolute' + }; + + function areValidElements() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } - return data; + return !args.some(function (element) { + return !(element && typeof element.getBoundingClientRect === 'function'); + }); } - /** - * Updates the position of the popper, computing the new offsets and applying - * the new style.
- * Prefer `scheduleUpdate` over `update` because of performance reasons. - * @method - * @memberof Popper - */ - function update() { - // if popper is destroyed, don't perform any further update - if (this.state.isDestroyed) { - return; + function popperGenerator(generatorOptions) { + if (generatorOptions === void 0) { + generatorOptions = {}; } - var data = { - instance: this, - styles: {}, - arrowStyles: {}, - attributes: {}, - flipped: false, - offsets: {} - }; + var _generatorOptions = generatorOptions, + _generatorOptions$def = _generatorOptions.defaultModifiers, + defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, + _generatorOptions$def2 = _generatorOptions.defaultOptions, + defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2; + return function createPopper(reference, popper, options) { + if (options === void 0) { + options = defaultOptions; + } + + var state = { + placement: 'bottom', + orderedModifiers: [], + options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions), + modifiersData: {}, + elements: { + reference: reference, + popper: popper + }, + attributes: {}, + styles: {} + }; + var effectCleanupFns = []; + var isDestroyed = false; + var instance = { + state: state, + setOptions: function setOptions(options) { + cleanupModifierEffects(); + state.options = Object.assign({}, defaultOptions, state.options, options); + state.scrollParents = { + reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [], + popper: listScrollParents(popper) + }; // Orders the modifiers based on their dependencies and `phase` + // properties + + var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers + + state.orderedModifiers = orderedModifiers.filter(function (m) { + return m.enabled; + }); // Validate the provided modifiers so that the consumer will get warned + + runModifierEffects(); + return instance.update(); + }, + // Sync update – it will always be executed, even if not necessary. This + // is useful for low frequency updates where sync behavior simplifies the + // logic. + // For high frequency updates (e.g. `resize` and `scroll` events), always + // prefer the async Popper#update method + forceUpdate: function forceUpdate() { + if (isDestroyed) { + return; + } - // compute reference element offsets - data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); + var _state$elements = state.elements, + reference = _state$elements.reference, + popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements + // anymore - // compute auto placement, store placement inside the data object, - // modifiers will be able to edit `placement` if needed - // and refer to originalPlacement to know the original value - data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); + if (!areValidElements(reference, popper)) { - // store the computed placement inside `originalPlacement` - data.originalPlacement = data.placement; + return; + } // Store the reference and popper rects to be read by modifiers + + + state.rects = { + reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'), + popper: getLayoutRect(popper) + }; // Modifiers have the ability to reset the current update cycle. The + // most common use case for this is the `flip` modifier changing the + // placement, which then needs to re-run all the modifiers, because the + // logic was previously ran for the previous placement and is therefore + // stale/incorrect + + state.reset = false; + state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier + // is filled with the initial data specified by the modifier. This means + // it doesn't persist and is fresh on each update. + // To ensure persistent data, use `${name}#persistent` + + state.orderedModifiers.forEach(function (modifier) { + return state.modifiersData[modifier.name] = Object.assign({}, modifier.data); + }); - data.positionFixed = this.options.positionFixed; + for (var index = 0; index < state.orderedModifiers.length; index++) { - // compute the popper offsets - data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); + if (state.reset === true) { + state.reset = false; + index = -1; + continue; + } - data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; + var _state$orderedModifie = state.orderedModifiers[index], + fn = _state$orderedModifie.fn, + _state$orderedModifie2 = _state$orderedModifie.options, + _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, + name = _state$orderedModifie.name; + + if (typeof fn === 'function') { + state = fn({ + state: state, + options: _options, + name: name, + instance: instance + }) || state; + } + } + }, + // Async and optimistically optimized update – it will not be executed if + // not necessary (debounced to run at most once-per-tick) + update: debounce(function () { + return new Promise(function (resolve) { + instance.forceUpdate(); + resolve(state); + }); + }), + destroy: function destroy() { + cleanupModifierEffects(); + isDestroyed = true; + } + }; - // run the modifiers - data = runModifiers(this.modifiers, data); + if (!areValidElements(reference, popper)) { - // the first `update` will call `onCreate` callback - // the other ones will call `onUpdate` callback - if (!this.state.isCreated) { - this.state.isCreated = true; - this.options.onCreate(data); - } else { - this.options.onUpdate(data); - } + return instance; + } + + instance.setOptions(options).then(function (state) { + if (!isDestroyed && options.onFirstUpdate) { + options.onFirstUpdate(state); + } + }); // Modifiers have the ability to execute arbitrary code before the first + // update cycle runs. They will be executed in the same order as the update + // cycle. This is useful when a modifier adds some persistent data that + // other modifiers need to use, but the modifier is run after the dependent + // one. + + function runModifierEffects() { + state.orderedModifiers.forEach(function (_ref3) { + var name = _ref3.name, + _ref3$options = _ref3.options, + options = _ref3$options === void 0 ? {} : _ref3$options, + effect = _ref3.effect; + + if (typeof effect === 'function') { + var cleanupFn = effect({ + state: state, + name: name, + instance: instance, + options: options + }); + + var noopFn = function noopFn() {}; + + effectCleanupFns.push(cleanupFn || noopFn); + } + }); + } + + function cleanupModifierEffects() { + effectCleanupFns.forEach(function (fn) { + return fn(); + }); + effectCleanupFns = []; + } + + return instance; + }; } + var createPopper$2 = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules + + var defaultModifiers$1 = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1]; + var createPopper$1 = /*#__PURE__*/popperGenerator({ + defaultModifiers: defaultModifiers$1 + }); // eslint-disable-next-line import/no-unused-modules + + var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1]; + var createPopper = /*#__PURE__*/popperGenerator({ + defaultModifiers: defaultModifiers + }); // eslint-disable-next-line import/no-unused-modules + + var Popper = /*#__PURE__*/Object.freeze({ + __proto__: null, + popperGenerator: popperGenerator, + detectOverflow: detectOverflow, + createPopperBase: createPopper$2, + createPopper: createPopper, + createPopperLite: createPopper$1, + top: top, + bottom: bottom, + right: right, + left: left, + auto: auto, + basePlacements: basePlacements, + start: start, + end: end, + clippingParents: clippingParents, + viewport: viewport, + popper: popper, + reference: reference, + variationPlacements: variationPlacements, + placements: placements, + beforeRead: beforeRead, + read: read, + afterRead: afterRead, + beforeMain: beforeMain, + main: main, + afterMain: afterMain, + beforeWrite: beforeWrite, + write: write, + afterWrite: afterWrite, + modifierPhases: modifierPhases, + applyStyles: applyStyles$1, + arrow: arrow$1, + computeStyles: computeStyles$1, + eventListeners: eventListeners, + flip: flip$1, + hide: hide$1, + offset: offset$1, + popperOffsets: popperOffsets$1, + preventOverflow: preventOverflow$1 + }); /** - * Helper used to know if the given modifier is enabled. - * @method - * @memberof Popper.Utils - * @returns {Boolean} + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): dropdown.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- */ - function isModifierEnabled(modifiers, modifierName) { - return modifiers.some(function (_ref) { - var name = _ref.name, - enabled = _ref.enabled; - return enabled && name === modifierName; - }); - } - /** - * Get the prefixed supported property name - * @method - * @memberof Popper.Utils - * @argument {String} property (camelCase) - * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ */ - function getSupportedPropertyName(property) { - var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; - var upperProp = property.charAt(0).toUpperCase() + property.slice(1); - - for (var i = 0; i < prefixes.length; i++) { - var prefix = prefixes[i]; - var toCheck = prefix ? '' + prefix + upperProp : property; - if (typeof document.body.style[toCheck] !== 'undefined') { - return toCheck; - } - } - return null; - } + const NAME$9 = 'dropdown'; + const DATA_KEY$8 = 'bs.dropdown'; + const EVENT_KEY$8 = `.${DATA_KEY$8}`; + const DATA_API_KEY$4 = '.data-api'; + const ESCAPE_KEY$2 = 'Escape'; + const SPACE_KEY = 'Space'; + const TAB_KEY$1 = 'Tab'; + const ARROW_UP_KEY = 'ArrowUp'; + const ARROW_DOWN_KEY = 'ArrowDown'; + const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button + + const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`); + const EVENT_HIDE$4 = `hide${EVENT_KEY$8}`; + const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$8}`; + const EVENT_SHOW$4 = `show${EVENT_KEY$8}`; + const EVENT_SHOWN$4 = `shown${EVENT_KEY$8}`; + const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$8}${DATA_API_KEY$4}`; + const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$8}${DATA_API_KEY$4}`; + const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$8}${DATA_API_KEY$4}`; + const CLASS_NAME_SHOW$6 = 'show'; + const CLASS_NAME_DROPUP = 'dropup'; + const CLASS_NAME_DROPEND = 'dropend'; + const CLASS_NAME_DROPSTART = 'dropstart'; + const CLASS_NAME_NAVBAR = 'navbar'; + const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]'; + const SELECTOR_MENU = '.dropdown-menu'; + const SELECTOR_NAVBAR_NAV = '.navbar-nav'; + const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; + const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'; + const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'; + const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'; + const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'; + const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'; + const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'; + const Default$8 = { + offset: [0, 2], + boundary: 'clippingParents', + reference: 'toggle', + display: 'dynamic', + popperConfig: null, + autoClose: true + }; + const DefaultType$8 = { + offset: '(array|string|function)', + boundary: '(string|element)', + reference: '(string|element|object)', + display: 'string', + popperConfig: '(null|object|function)', + autoClose: '(boolean|string)' + }; /** - * Destroys the popper. - * @method - * @memberof Popper + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ */ - function destroy() { - this.state.isDestroyed = true; - // touch DOM only if `applyStyle` modifier is enabled - if (isModifierEnabled(this.modifiers, 'applyStyle')) { - this.popper.removeAttribute('x-placement'); - this.popper.style.position = ''; - this.popper.style.top = ''; - this.popper.style.left = ''; - this.popper.style.right = ''; - this.popper.style.bottom = ''; - this.popper.style.willChange = ''; - this.popper.style[getSupportedPropertyName('transform')] = ''; - } + class Dropdown extends BaseComponent { + constructor(element, config) { + super(element); + this._popper = null; + this._config = this._getConfig(config); + this._menu = this._getMenuElement(); + this._inNavbar = this._detectNavbar(); + } // Getters - this.disableEventListeners(); - // remove the popper if user explicity asked for the deletion on destroy - // do not use `remove` because IE11 doesn't support it - if (this.options.removeOnDestroy) { - this.popper.parentNode.removeChild(this.popper); + static get Default() { + return Default$8; } - return this; - } - /** - * Get the window associated with the element - * @argument {Element} element - * @returns {Window} - */ - function getWindow(element) { - var ownerDocument = element.ownerDocument; - return ownerDocument ? ownerDocument.defaultView : window; - } + static get DefaultType() { + return DefaultType$8; + } + + static get NAME() { + return NAME$9; + } // Public - function attachToScrollParents(scrollParent, event, callback, scrollParents) { - var isBody = scrollParent.nodeName === 'BODY'; - var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; - target.addEventListener(event, callback, { passive: true }); - if (!isBody) { - attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); + toggle() { + return this._isShown() ? this.hide() : this.show(); } - scrollParents.push(target); - } - /** - * Setup needed event listeners used to update the popper position - * @method - * @memberof Popper.Utils - * @private - */ - function setupEventListeners(reference, options, state, updateBound) { - // Resize event listener on window - state.updateBound = updateBound; - getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); - - // Scroll event listener on scroll parents - var scrollElement = getScrollParent(reference); - attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); - state.scrollElement = scrollElement; - state.eventsEnabled = true; - - return state; - } + show() { + if (isDisabled(this._element) || this._isShown(this._menu)) { + return; + } - /** - * It will add resize/scroll events and start recalculating - * position of the popper element when they are triggered. - * @method - * @memberof Popper - */ - function enableEventListeners() { - if (!this.state.eventsEnabled) { - this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); - } - } + const relatedTarget = { + relatedTarget: this._element + }; + const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, relatedTarget); - /** - * Remove event listeners used to update the popper position - * @method - * @memberof Popper.Utils - * @private - */ - function removeEventListeners(reference, state) { - // Remove resize event listener on window - getWindow(reference).removeEventListener('resize', state.updateBound); + if (showEvent.defaultPrevented) { + return; + } - // Remove scroll event listener on scroll parents - state.scrollParents.forEach(function (target) { - target.removeEventListener('scroll', state.updateBound); - }); + const parent = Dropdown.getParentFromElement(this._element); // Totally disable Popper for Dropdowns in Navbar - // Reset state - state.updateBound = null; - state.scrollParents = []; - state.scrollElement = null; - state.eventsEnabled = false; - return state; - } + if (this._inNavbar) { + Manipulator.setDataAttribute(this._menu, 'popper', 'none'); + } else { + this._createPopper(parent); + } // If this is a touch-enabled device we add extra + // empty mouseover listeners to the body's immediate children; + // only needed because of broken event delegation on iOS + // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html - /** - * It will remove resize/scroll events and won't recalculate popper position - * when they are triggered. It also won't trigger `onUpdate` callback anymore, - * unless you call `update` method manually. - * @method - * @memberof Popper - */ - function disableEventListeners() { - if (this.state.eventsEnabled) { - cancelAnimationFrame(this.scheduleUpdate); - this.state = removeEventListeners(this.reference, this.state); - } - } - /** - * Tells if a given input is a number - * @method - * @memberof Popper.Utils - * @param {*} input to check - * @return {Boolean} - */ - function isNumeric(n) { - return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); - } + if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) { + [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', noop)); + } - /** - * Set the style to the given popper - * @method - * @memberof Popper.Utils - * @argument {Element} element - Element to apply the style to - * @argument {Object} styles - * Object with a list of properties and values which will be applied to the element - */ - function setStyles(element, styles) { - Object.keys(styles).forEach(function (prop) { - var unit = ''; - // add unit if the value is numeric and is one of the following - if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { - unit = 'px'; - } - element.style[prop] = styles[prop] + unit; - }); - } + this._element.focus(); - /** - * Set the attributes to the given popper - * @method - * @memberof Popper.Utils - * @argument {Element} element - Element to apply the attributes to - * @argument {Object} styles - * Object with a list of properties and values which will be applied to the element - */ - function setAttributes(element, attributes) { - Object.keys(attributes).forEach(function (prop) { - var value = attributes[prop]; - if (value !== false) { - element.setAttribute(prop, attributes[prop]); - } else { - element.removeAttribute(prop); + this._element.setAttribute('aria-expanded', true); + + this._menu.classList.add(CLASS_NAME_SHOW$6); + + this._element.classList.add(CLASS_NAME_SHOW$6); + + EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget); + } + + hide() { + if (isDisabled(this._element) || !this._isShown(this._menu)) { + return; } - }); - } - /** - * @function - * @memberof Modifiers - * @argument {Object} data - The data object generated by `update` method - * @argument {Object} data.styles - List of style properties - values to apply to popper element - * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element - * @argument {Object} options - Modifiers configuration and options - * @returns {Object} The same data object - */ - function applyStyle(data) { - // any property present in `data.styles` will be applied to the popper, - // in this way we can make the 3rd party modifiers add custom styles to it - // Be aware, modifiers could override the properties defined in the previous - // lines of this modifier! - setStyles(data.instance.popper, data.styles); + const relatedTarget = { + relatedTarget: this._element + }; + + this._completeHide(relatedTarget); + } - // any property present in `data.attributes` will be applied to the popper, - // they will be set as HTML attributes of the element - setAttributes(data.instance.popper, data.attributes); + dispose() { + if (this._popper) { + this._popper.destroy(); + } - // if arrowElement is defined and arrowStyles has some properties - if (data.arrowElement && Object.keys(data.arrowStyles).length) { - setStyles(data.arrowElement, data.arrowStyles); + super.dispose(); } - return data; - } + update() { + this._inNavbar = this._detectNavbar(); - /** - * Set the x-placement attribute before everything else because it could be used - * to add margins to the popper margins needs to be calculated to get the - * correct popper offsets. - * @method - * @memberof Popper.modifiers - * @param {HTMLElement} reference - The reference element used to position the popper - * @param {HTMLElement} popper - The HTML element used as popper - * @param {Object} options - Popper.js options - */ - function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { - // compute reference element offsets - var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); + if (this._popper) { + this._popper.update(); + } + } // Private - // compute auto placement, store placement inside the data object, - // modifiers will be able to edit `placement` if needed - // and refer to originalPlacement to know the original value - var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); - popper.setAttribute('x-placement', placement); + _completeHide(relatedTarget) { + const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget); - // Apply `position` to popper before anything else because - // without the position applied we can't guarantee correct computations - setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); + if (hideEvent.defaultPrevented) { + return; + } // If this is a touch-enabled device we remove the extra + // empty mouseover listeners we added for iOS support - return options; - } - /** - * @function - * @memberof Popper.Utils - * @argument {Object} data - The data object generated by `update` method - * @argument {Boolean} shouldRound - If the offsets should be rounded at all - * @returns {Object} The popper's position offsets rounded - * - * The tale of pixel-perfect positioning. It's still not 100% perfect, but as - * good as it can be within reason. - * Discussion here: https://github.com/FezVrasta/popper.js/pull/715 - * - * Low DPI screens cause a popper to be blurry if not using full pixels (Safari - * as well on High DPI screens). - * - * Firefox prefers no rounding for positioning and does not have blurriness on - * high DPI screens. - * - * Only horizontal placement and left/right values need to be considered. - */ - function getRoundedOffsets(data, shouldRound) { - var _data$offsets = data.offsets, - popper = _data$offsets.popper, - reference = _data$offsets.reference; - var round = Math.round, - floor = Math.floor; - - var noRound = function noRound(v) { - return v; - }; + if ('ontouchstart' in document.documentElement) { + [].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', noop)); + } - var referenceWidth = round(reference.width); - var popperWidth = round(popper.width); + if (this._popper) { + this._popper.destroy(); + } - var isVertical = ['left', 'right'].indexOf(data.placement) !== -1; - var isVariation = data.placement.indexOf('-') !== -1; - var sameWidthParity = referenceWidth % 2 === popperWidth % 2; - var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; + this._menu.classList.remove(CLASS_NAME_SHOW$6); - var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; - var verticalToInteger = !shouldRound ? noRound : round; + this._element.classList.remove(CLASS_NAME_SHOW$6); - return { - left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), - top: verticalToInteger(popper.top), - bottom: verticalToInteger(popper.bottom), - right: horizontalToInteger(popper.right) - }; - } + this._element.setAttribute('aria-expanded', 'false'); - var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent); + Manipulator.removeDataAttribute(this._menu, 'popper'); + EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget); + } - /** - * @function - * @memberof Modifiers - * @argument {Object} data - The data object generated by `update` method - * @argument {Object} options - Modifiers configuration and options - * @returns {Object} The data object, properly modified - */ - function computeStyle(data, options) { - var x = options.x, - y = options.y; - var popper = data.offsets.popper; + _getConfig(config) { + config = { ...this.constructor.Default, + ...Manipulator.getDataAttributes(this._element), + ...config + }; + typeCheckConfig(NAME$9, config, this.constructor.DefaultType); - // Remove this legacy support in Popper.js v2 + if (typeof config.reference === 'object' && !isElement$1(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') { + // Popper virtual elements require a getBoundingClientRect method + throw new TypeError(`${NAME$9.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); + } - var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { - return modifier.name === 'applyStyle'; - }).gpuAcceleration; - if (legacyGpuAccelerationOption !== undefined) { - console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); + return config; } - var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; - var offsetParent = getOffsetParent(data.instance.popper); - var offsetParentRect = getBoundingClientRect(offsetParent); + _createPopper(parent) { + if (typeof Popper === 'undefined') { + throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)'); + } - // Styles - var styles = { - position: popper.position - }; + let referenceElement = this._element; - var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox); - - var sideA = x === 'bottom' ? 'top' : 'bottom'; - var sideB = y === 'right' ? 'left' : 'right'; - - // if gpuAcceleration is set to `true` and transform is supported, - // we use `translate3d` to apply the position to the popper we - // automatically use the supported prefixed version if needed - var prefixedProperty = getSupportedPropertyName('transform'); - - // now, let's make a step back and look at this code closely (wtf?) - // If the content of the popper grows once it's been positioned, it - // may happen that the popper gets misplaced because of the new content - // overflowing its reference element - // To avoid this problem, we provide two options (x and y), which allow - // the consumer to define the offset origin. - // If we position a popper on top of a reference element, we can set - // `x` to `top` to make the popper grow towards its top instead of - // its bottom. - var left = void 0, - top = void 0; - if (sideA === 'bottom') { - // when offsetParent is the positioning is relative to the bottom of the screen (excluding the scrollbar) - // and not the bottom of the html element - if (offsetParent.nodeName === 'HTML') { - top = -offsetParent.clientHeight + offsets.bottom; - } else { - top = -offsetParentRect.height + offsets.bottom; + if (this._config.reference === 'parent') { + referenceElement = parent; + } else if (isElement$1(this._config.reference)) { + referenceElement = getElement(this._config.reference); + } else if (typeof this._config.reference === 'object') { + referenceElement = this._config.reference; } - } else { - top = offsets.top; - } - if (sideB === 'right') { - if (offsetParent.nodeName === 'HTML') { - left = -offsetParent.clientWidth + offsets.right; - } else { - left = -offsetParentRect.width + offsets.right; + + const popperConfig = this._getPopperConfig(); + + const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false); + this._popper = createPopper(referenceElement, this._menu, popperConfig); + + if (isDisplayStatic) { + Manipulator.setDataAttribute(this._menu, 'popper', 'static'); } - } else { - left = offsets.left; } - if (gpuAcceleration && prefixedProperty) { - styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; - styles[sideA] = 0; - styles[sideB] = 0; - styles.willChange = 'transform'; - } else { - // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties - var invertTop = sideA === 'bottom' ? -1 : 1; - var invertLeft = sideB === 'right' ? -1 : 1; - styles[sideA] = top * invertTop; - styles[sideB] = left * invertLeft; - styles.willChange = sideA + ', ' + sideB; + + _isShown(element = this._element) { + return element.classList.contains(CLASS_NAME_SHOW$6); } - // Attributes - var attributes = { - 'x-placement': data.placement - }; + _getMenuElement() { + return SelectorEngine.next(this._element, SELECTOR_MENU)[0]; + } - // Update `data` attributes, styles and arrowStyles - data.attributes = _extends({}, attributes, data.attributes); - data.styles = _extends({}, styles, data.styles); - data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); + _getPlacement() { + const parentDropdown = this._element.parentNode; - return data; - } + if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) { + return PLACEMENT_RIGHT; + } - /** - * Helper used to know if the given modifier depends from another one.
- * It checks if the needed modifier is listed and enabled. - * @method - * @memberof Popper.Utils - * @param {Array} modifiers - list of modifiers - * @param {String} requestingName - name of requesting modifier - * @param {String} requestedName - name of requested modifier - * @returns {Boolean} - */ - function isModifierRequired(modifiers, requestingName, requestedName) { - var requesting = find(modifiers, function (_ref) { - var name = _ref.name; - return name === requestingName; - }); + if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) { + return PLACEMENT_LEFT; + } // We need to trim the value because custom properties can also include spaces - var isRequired = !!requesting && modifiers.some(function (modifier) { - return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; - }); - if (!isRequired) { - var _requesting = '`' + requestingName + '`'; - var requested = '`' + requestedName + '`'; - console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); - } - return isRequired; - } + const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'; - /** - * @function - * @memberof Modifiers - * @argument {Object} data - The data object generated by update method - * @argument {Object} options - Modifiers configuration and options - * @returns {Object} The data object, properly modified - */ - function arrow(data, options) { - var _data$offsets$arrow; + if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) { + return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP; + } - // arrow depends on keepTogether in order to work - if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { - return data; + return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM; } - var arrowElement = options.element; + _detectNavbar() { + return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null; + } - // if arrowElement is a string, suppose it's a CSS selector - if (typeof arrowElement === 'string') { - arrowElement = data.instance.popper.querySelector(arrowElement); + _getOffset() { + const { + offset + } = this._config; - // if arrowElement is not found, don't run the modifier - if (!arrowElement) { - return data; + if (typeof offset === 'string') { + return offset.split(',').map(val => Number.parseInt(val, 10)); } - } else { - // if the arrowElement isn't a query selector we must check that the - // provided DOM node is child of its popper node - if (!data.instance.popper.contains(arrowElement)) { - console.warn('WARNING: `arrow.element` must be child of its popper element!'); - return data; + + if (typeof offset === 'function') { + return popperData => offset(popperData, this._element); } + + return offset; } - var placement = data.placement.split('-')[0]; - var _data$offsets = data.offsets, - popper = _data$offsets.popper, - reference = _data$offsets.reference; + _getPopperConfig() { + const defaultBsPopperConfig = { + placement: this._getPlacement(), + modifiers: [{ + name: 'preventOverflow', + options: { + boundary: this._config.boundary + } + }, { + name: 'offset', + options: { + offset: this._getOffset() + } + }] + }; // Disable Popper if we have a static display - var isVertical = ['left', 'right'].indexOf(placement) !== -1; + if (this._config.display === 'static') { + defaultBsPopperConfig.modifiers = [{ + name: 'applyStyles', + enabled: false + }]; + } - var len = isVertical ? 'height' : 'width'; - var sideCapitalized = isVertical ? 'Top' : 'Left'; - var side = sideCapitalized.toLowerCase(); - var altSide = isVertical ? 'left' : 'top'; - var opSide = isVertical ? 'bottom' : 'right'; - var arrowElementSize = getOuterSizes(arrowElement)[len]; + return { ...defaultBsPopperConfig, + ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) + }; + } - // - // extends keepTogether behavior making sure the popper and its - // reference have enough pixels in conjunction - // + _selectMenuItem({ + key, + target + }) { + const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible); - // top/left side - if (reference[opSide] - arrowElementSize < popper[side]) { - data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); - } - // bottom/right side - if (reference[side] + arrowElementSize > popper[opSide]) { - data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; - } - data.offsets.popper = getClientRect(data.offsets.popper); + if (!items.length) { + return; + } // if target isn't included in items (e.g. when expanding the dropdown) + // allow cycling to get the last item in case key equals ARROW_UP_KEY - // compute center of the popper - var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; - // Compute the sideValue using the updated popper offsets - // take popper margin in account because we don't have this info available - var css = getStyleComputedProperty(data.instance.popper); - var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10); - var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10); - var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; + getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus(); + } // Static - // prevent arrowElement from being placed not contiguously to its popper - sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); - data.arrowElement = arrowElement; - data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); + static jQueryInterface(config) { + return this.each(function () { + const data = Dropdown.getOrCreateInstance(this, config); - return data; - } + if (typeof config !== 'string') { + return; + } - /** - * Get the opposite placement variation of the given one - * @method - * @memberof Popper.Utils - * @argument {String} placement variation - * @returns {String} flipped placement variation - */ - function getOppositeVariation(variation) { - if (variation === 'end') { - return 'start'; - } else if (variation === 'start') { - return 'end'; + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`); + } + + data[config](); + }); } - return variation; - } - /** - * List of accepted placements to use as values of the `placement` option.
- * Valid placements are: - * - `auto` - * - `top` - * - `right` - * - `bottom` - * - `left` - * - * Each placement can have a variation from this list: - * - `-start` - * - `-end` - * - * Variations are interpreted easily if you think of them as the left to right - * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` - * is right.
- * Vertically (`left` and `right`), `start` is top and `end` is bottom. - * - * Some valid examples are: - * - `top-end` (on top of reference, right aligned) - * - `right-start` (on right of reference, top aligned) - * - `bottom` (on bottom, centered) - * - `auto-end` (on the side with more space available, alignment depends by placement) - * - * @static - * @type {Array} - * @enum {String} - * @readonly - * @method placements - * @memberof Popper - */ - var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']; + static clearMenus(event) { + if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1)) { + return; + } - // Get rid of `auto` `auto-start` and `auto-end` - var validPlacements = placements.slice(3); + const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3); - /** - * Given an initial placement, returns all the subsequent placements - * clockwise (or counter-clockwise). - * - * @method - * @memberof Popper.Utils - * @argument {String} placement - A valid placement (it accepts variations) - * @argument {Boolean} counter - Set to true to walk the placements counterclockwise - * @returns {Array} placements including their variations - */ - function clockwise(placement) { - var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + for (let i = 0, len = toggles.length; i < len; i++) { + const context = Dropdown.getInstance(toggles[i]); - var index = validPlacements.indexOf(placement); - var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); - return counter ? arr.reverse() : arr; - } + if (!context || context._config.autoClose === false) { + continue; + } - var BEHAVIORS = { - FLIP: 'flip', - CLOCKWISE: 'clockwise', - COUNTERCLOCKWISE: 'counterclockwise' - }; + if (!context._isShown()) { + continue; + } - /** - * @function - * @memberof Modifiers - * @argument {Object} data - The data object generated by update method - * @argument {Object} options - Modifiers configuration and options - * @returns {Object} The data object, properly modified - */ - function flip(data, options) { - // if `inner` modifier is enabled, we can't use the `flip` modifier - if (isModifierEnabled(data.instance.modifiers, 'inner')) { - return data; - } + const relatedTarget = { + relatedTarget: context._element + }; - if (data.flipped && data.placement === data.originalPlacement) { - // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides - return data; - } + if (event) { + const composedPath = event.composedPath(); + const isMenuTarget = composedPath.includes(context._menu); - var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); + if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) { + continue; + } // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu - var placement = data.placement.split('-')[0]; - var placementOpposite = getOppositePlacement(placement); - var variation = data.placement.split('-')[1] || ''; - var flipOrder = []; + if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) { + continue; + } - switch (options.behavior) { - case BEHAVIORS.FLIP: - flipOrder = [placement, placementOpposite]; - break; - case BEHAVIORS.CLOCKWISE: - flipOrder = clockwise(placement); - break; - case BEHAVIORS.COUNTERCLOCKWISE: - flipOrder = clockwise(placement, true); - break; - default: - flipOrder = options.behavior; - } + if (event.type === 'click') { + relatedTarget.clickEvent = event; + } + } - flipOrder.forEach(function (step, index) { - if (placement !== step || flipOrder.length === index + 1) { - return data; + context._completeHide(relatedTarget); } + } - placement = data.placement.split('-')[0]; - placementOpposite = getOppositePlacement(placement); + static getParentFromElement(element) { + return getElementFromSelector(element) || element.parentNode; + } - var popperOffsets = data.offsets.popper; - var refOffsets = data.offsets.reference; + static dataApiKeydownHandler(event) { + // If not input/textarea: + // - And not a key in REGEXP_KEYDOWN => not a dropdown command + // If input/textarea: + // - If space key => not a dropdown command + // - If key is other than escape + // - If key is not up or down => not a dropdown command + // - If trigger inside the menu => not a dropdown command + if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY$2 && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) { + return; + } - // using floor because the reference offsets may contain decimals we are not going to consider here - var floor = Math.floor; - var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom); + const isActive = this.classList.contains(CLASS_NAME_SHOW$6); - var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); - var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); - var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); - var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); + if (!isActive && event.key === ESCAPE_KEY$2) { + return; + } - var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; + event.preventDefault(); + event.stopPropagation(); - // flip the variation if required - var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; - var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); + if (isDisabled(this)) { + return; + } - if (overlapsRef || overflowsBoundaries || flippedVariation) { - // this boolean to detect any flip loop - data.flipped = true; + const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0]; + const instance = Dropdown.getOrCreateInstance(getToggleButton); - if (overlapsRef || overflowsBoundaries) { - placement = flipOrder[index + 1]; - } + if (event.key === ESCAPE_KEY$2) { + instance.hide(); + return; + } - if (flippedVariation) { - variation = getOppositeVariation(variation); + if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) { + if (!isActive) { + instance.show(); } - data.placement = placement + (variation ? '-' + variation : ''); + instance._selectMenuItem(event); - // this object contains `position`, we want to preserve it along with - // any additional property we may add in the future - data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); + return; + } - data = runModifiers(data.instance.modifiers, data, 'flip'); + if (!isActive || event.key === SPACE_KEY) { + Dropdown.clearMenus(); } - }); - return data; + } + } + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + + + EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler); + EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler); + EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus); + EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus); + EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) { + event.preventDefault(); + Dropdown.getOrCreateInstance(this).toggle(); + }); + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Dropdown to jQuery only if jQuery is present + */ + + defineJQueryPlugin(Dropdown); /** - * @function - * @memberof Modifiers - * @argument {Object} data - The data object generated by update method - * @argument {Object} options - Modifiers configuration and options - * @returns {Object} The data object, properly modified + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): util/scrollBar.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- */ - function keepTogether(data) { - var _data$offsets = data.offsets, - popper = _data$offsets.popper, - reference = _data$offsets.reference; + const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; + const SELECTOR_STICKY_CONTENT = '.sticky-top'; - var placement = data.placement.split('-')[0]; - var floor = Math.floor; - var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; - var side = isVertical ? 'right' : 'bottom'; - var opSide = isVertical ? 'left' : 'top'; - var measurement = isVertical ? 'width' : 'height'; + class ScrollBarHelper { + constructor() { + this._element = document.body; + } - if (popper[side] < floor(reference[opSide])) { - data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; + getWidth() { + // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes + const documentWidth = document.documentElement.clientWidth; + return Math.abs(window.innerWidth - documentWidth); } - if (popper[opSide] > floor(reference[side])) { - data.offsets.popper[opSide] = floor(reference[side]); + + hide() { + const width = this.getWidth(); + + this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width + + + this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth + + + this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width); + + this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width); } - return data; - } + _disableOverFlow() { + this._saveInitialAttribute(this._element, 'overflow'); - /** - * Converts a string containing value + unit into a px value number - * @function - * @memberof {modifiers~offset} - * @private - * @argument {String} str - Value + unit string - * @argument {String} measurement - `height` or `width` - * @argument {Object} popperOffsets - * @argument {Object} referenceOffsets - * @returns {Number|String} - * Value in pixels, or original string if no values were extracted - */ - function toValue(str, measurement, popperOffsets, referenceOffsets) { - // separate value from unit - var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); - var value = +split[1]; - var unit = split[2]; - - // If it's not a number it's an operator, I guess - if (!value) { - return str; - } - - if (unit.indexOf('%') === 0) { - var element = void 0; - switch (unit) { - case '%p': - element = popperOffsets; - break; - case '%': - case '%r': - default: - element = referenceOffsets; - } - - var rect = getClientRect(element); - return rect[measurement] / 100 * value; - } else if (unit === 'vh' || unit === 'vw') { - // if is a vh or vw, we calculate the size based on the viewport - var size = void 0; - if (unit === 'vh') { - size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); - } else { - size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); - } - return size / 100 * value; - } else { - // if is an explicit pixel unit, we get rid of the unit and keep the value - // if is an implicit unit, it's px, and we return just the value - return value; + this._element.style.overflow = 'hidden'; } - } - /** - * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. - * @function - * @memberof {modifiers~offset} - * @private - * @argument {String} offset - * @argument {Object} popperOffsets - * @argument {Object} referenceOffsets - * @argument {String} basePlacement - * @returns {Array} a two cells array with x and y offsets in numbers - */ - function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { - var offsets = [0, 0]; - - // Use height if placement is left or right and index is 0 otherwise use width - // in this way the first offset will use an axis and the second one - // will use the other one - var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; - - // Split the offset string to obtain a list of values and operands - // The regex addresses values with the plus or minus sign in front (+10, -20, etc) - var fragments = offset.split(/(\+|\-)/).map(function (frag) { - return frag.trim(); - }); + _setElementAttributes(selector, styleProp, callback) { + const scrollbarWidth = this.getWidth(); - // Detect if the offset string contains a pair of values or a single one - // they could be separated by comma or space - var divider = fragments.indexOf(find(fragments, function (frag) { - return frag.search(/,|\s/) !== -1; - })); - - if (fragments[divider] && fragments[divider].indexOf(',') === -1) { - console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); - } - - // If divider is found, we divide the list of values and operands to divide - // them by ofset X and Y. - var splitRegex = /\s*,\s*|\s+/; - var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; - - // Convert the values with units to absolute pixels to allow our computations - ops = ops.map(function (op, index) { - // Most of the units rely on the orientation of the popper - var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; - var mergeWithPrevious = false; - return op - // This aggregates any `+` or `-` sign that aren't considered operators - // e.g.: 10 + +5 => [10, +, +5] - .reduce(function (a, b) { - if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { - a[a.length - 1] = b; - mergeWithPrevious = true; - return a; - } else if (mergeWithPrevious) { - a[a.length - 1] += b; - mergeWithPrevious = false; - return a; - } else { - return a.concat(b); + const manipulationCallBack = element => { + if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) { + return; } - }, []) - // Here we convert the string values into number values (in px) - .map(function (str) { - return toValue(str, measurement, popperOffsets, referenceOffsets); - }); - }); - // Loop trough the offsets arrays and execute the operations - ops.forEach(function (op, index) { - op.forEach(function (frag, index2) { - if (isNumeric(frag)) { - offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); - } - }); - }); - return offsets; - } + this._saveInitialAttribute(element, styleProp); - /** - * @function - * @memberof Modifiers - * @argument {Object} data - The data object generated by update method - * @argument {Object} options - Modifiers configuration and options - * @argument {Number|String} options.offset=0 - * The offset value as described in the modifier description - * @returns {Object} The data object, properly modified - */ - function offset(data, _ref) { - var offset = _ref.offset; - var placement = data.placement, - _data$offsets = data.offsets, - popper = _data$offsets.popper, - reference = _data$offsets.reference; - - var basePlacement = placement.split('-')[0]; - - var offsets = void 0; - if (isNumeric(+offset)) { - offsets = [+offset, 0]; - } else { - offsets = parseOffset(offset, popper, reference, basePlacement); + const calculatedValue = window.getComputedStyle(element)[styleProp]; + element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`; + }; + + this._applyManipulationCallback(selector, manipulationCallBack); } - if (basePlacement === 'left') { - popper.top += offsets[0]; - popper.left -= offsets[1]; - } else if (basePlacement === 'right') { - popper.top += offsets[0]; - popper.left += offsets[1]; - } else if (basePlacement === 'top') { - popper.left += offsets[0]; - popper.top -= offsets[1]; - } else if (basePlacement === 'bottom') { - popper.left += offsets[0]; - popper.top += offsets[1]; + reset() { + this._resetElementAttributes(this._element, 'overflow'); + + this._resetElementAttributes(this._element, 'paddingRight'); + + this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight'); + + this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight'); } - data.popper = popper; - return data; - } + _saveInitialAttribute(element, styleProp) { + const actualValue = element.style[styleProp]; - /** - * @function - * @memberof Modifiers - * @argument {Object} data - The data object generated by `update` method - * @argument {Object} options - Modifiers configuration and options - * @returns {Object} The data object, properly modified - */ - function preventOverflow(data, options) { - var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); - - // If offsetParent is the reference element, we really want to - // go one step up and use the next offsetParent as reference to - // avoid to make this modifier completely useless and look like broken - if (data.instance.reference === boundariesElement) { - boundariesElement = getOffsetParent(boundariesElement); - } - - // NOTE: DOM access here - // resets the popper's position so that the document size can be calculated excluding - // the size of the popper element itself - var transformProp = getSupportedPropertyName('transform'); - var popperStyles = data.instance.popper.style; // assignment to help minification - var top = popperStyles.top, - left = popperStyles.left, - transform = popperStyles[transformProp]; - - popperStyles.top = ''; - popperStyles.left = ''; - popperStyles[transformProp] = ''; - - var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); - - // NOTE: DOM access here - // restores the original style properties after the offsets have been computed - popperStyles.top = top; - popperStyles.left = left; - popperStyles[transformProp] = transform; - - options.boundaries = boundaries; - - var order = options.priority; - var popper = data.offsets.popper; - - var check = { - primary: function primary(placement) { - var value = popper[placement]; - if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { - value = Math.max(popper[placement], boundaries[placement]); - } - return defineProperty({}, placement, value); - }, - secondary: function secondary(placement) { - var mainSide = placement === 'right' ? 'left' : 'top'; - var value = popper[mainSide]; - if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { - value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); - } - return defineProperty({}, mainSide, value); + if (actualValue) { + Manipulator.setDataAttribute(element, styleProp, actualValue); } - }; + } - order.forEach(function (placement) { - var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; - popper = _extends({}, popper, check[side](placement)); - }); + _resetElementAttributes(selector, styleProp) { + const manipulationCallBack = element => { + const value = Manipulator.getDataAttribute(element, styleProp); - data.offsets.popper = popper; + if (typeof value === 'undefined') { + element.style.removeProperty(styleProp); + } else { + Manipulator.removeDataAttribute(element, styleProp); + element.style[styleProp] = value; + } + }; - return data; - } + this._applyManipulationCallback(selector, manipulationCallBack); + } - /** - * @function - * @memberof Modifiers - * @argument {Object} data - The data object generated by `update` method - * @argument {Object} options - Modifiers configuration and options - * @returns {Object} The data object, properly modified - */ - function shift(data) { - var placement = data.placement; - var basePlacement = placement.split('-')[0]; - var shiftvariation = placement.split('-')[1]; - - // if shift shiftvariation is specified, run the modifier - if (shiftvariation) { - var _data$offsets = data.offsets, - reference = _data$offsets.reference, - popper = _data$offsets.popper; - - var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; - var side = isVertical ? 'left' : 'top'; - var measurement = isVertical ? 'width' : 'height'; - - var shiftOffsets = { - start: defineProperty({}, side, reference[side]), - end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) - }; + _applyManipulationCallback(selector, callBack) { + if (isElement$1(selector)) { + callBack(selector); + } else { + SelectorEngine.find(selector, this._element).forEach(callBack); + } + } - data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); + isOverflowing() { + return this.getWidth() > 0; } - return data; } /** - * @function - * @memberof Modifiers - * @argument {Object} data - The data object generated by update method - * @argument {Object} options - Modifiers configuration and options - * @returns {Object} The data object, properly modified + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): util/backdrop.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * -------------------------------------------------------------------------- */ - function hide(data) { - if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { - return data; - } + const Default$7 = { + className: 'modal-backdrop', + isVisible: true, + // if false, we use the backdrop helper without adding any element to the dom + isAnimated: false, + rootElement: 'body', + // give the choice to place backdrop under different elements + clickCallback: null + }; + const DefaultType$7 = { + className: 'string', + isVisible: 'boolean', + isAnimated: 'boolean', + rootElement: '(element|string)', + clickCallback: '(function|null)' + }; + const NAME$8 = 'backdrop'; + const CLASS_NAME_FADE$4 = 'fade'; + const CLASS_NAME_SHOW$5 = 'show'; + const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$8}`; - var refRect = data.offsets.reference; - var bound = find(data.instance.modifiers, function (modifier) { - return modifier.name === 'preventOverflow'; - }).boundaries; + class Backdrop { + constructor(config) { + this._config = this._getConfig(config); + this._isAppended = false; + this._element = null; + } - if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { - // Avoid unnecessary DOM access if visibility hasn't changed - if (data.hide === true) { - return data; + show(callback) { + if (!this._config.isVisible) { + execute(callback); + return; } - data.hide = true; - data.attributes['x-out-of-boundaries'] = ''; - } else { - // Avoid unnecessary DOM access if visibility hasn't changed - if (data.hide === false) { - return data; + this._append(); + + if (this._config.isAnimated) { + reflow(this._getElement()); } - data.hide = false; - data.attributes['x-out-of-boundaries'] = false; + this._getElement().classList.add(CLASS_NAME_SHOW$5); + + this._emulateAnimation(() => { + execute(callback); + }); } - return data; - } + hide(callback) { + if (!this._config.isVisible) { + execute(callback); + return; + } - /** - * @function - * @memberof Modifiers - * @argument {Object} data - The data object generated by `update` method - * @argument {Object} options - Modifiers configuration and options - * @returns {Object} The data object, properly modified - */ - function inner(data) { - var placement = data.placement; - var basePlacement = placement.split('-')[0]; - var _data$offsets = data.offsets, - popper = _data$offsets.popper, - reference = _data$offsets.reference; + this._getElement().classList.remove(CLASS_NAME_SHOW$5); - var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; + this._emulateAnimation(() => { + this.dispose(); + execute(callback); + }); + } // Private - var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; - popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); + _getElement() { + if (!this._element) { + const backdrop = document.createElement('div'); + backdrop.className = this._config.className; - data.placement = getOppositePlacement(placement); - data.offsets.popper = getClientRect(popper); + if (this._config.isAnimated) { + backdrop.classList.add(CLASS_NAME_FADE$4); + } - return data; - } + this._element = backdrop; + } - /** - * Modifier function, each modifier can have a function of this type assigned - * to its `fn` property.
- * These functions will be called on each update, this means that you must - * make sure they are performant enough to avoid performance bottlenecks. - * - * @function ModifierFn - * @argument {dataObject} data - The data object generated by `update` method - * @argument {Object} options - Modifiers configuration and options - * @returns {dataObject} The data object, properly modified - */ + return this._element; + } - /** - * Modifiers are plugins used to alter the behavior of your poppers.
- * Popper.js uses a set of 9 modifiers to provide all the basic functionalities - * needed by the library. - * - * Usually you don't want to override the `order`, `fn` and `onLoad` props. - * All the other properties are configurations that could be tweaked. - * @namespace modifiers - */ - var modifiers = { - /** - * Modifier used to shift the popper on the start or end of its reference - * element.
- * It will read the variation of the `placement` property.
- * It can be one either `-end` or `-start`. - * @memberof modifiers - * @inner - */ - shift: { - /** @prop {number} order=100 - Index used to define the order of execution */ - order: 100, - /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ - enabled: true, - /** @prop {ModifierFn} */ - fn: shift - }, + _getConfig(config) { + config = { ...Default$7, + ...(typeof config === 'object' ? config : {}) + }; // use getElement() with the default "body" to get a fresh Element on each instantiation - /** - * The `offset` modifier can shift your popper on both its axis. - * - * It accepts the following units: - * - `px` or unit-less, interpreted as pixels - * - `%` or `%r`, percentage relative to the length of the reference element - * - `%p`, percentage relative to the length of the popper element - * - `vw`, CSS viewport width unit - * - `vh`, CSS viewport height unit - * - * For length is intended the main axis relative to the placement of the popper.
- * This means that if the placement is `top` or `bottom`, the length will be the - * `width`. In case of `left` or `right`, it will be the `height`. - * - * You can provide a single value (as `Number` or `String`), or a pair of values - * as `String` divided by a comma or one (or more) white spaces.
- * The latter is a deprecated method because it leads to confusion and will be - * removed in v2.
- * Additionally, it accepts additions and subtractions between different units. - * Note that multiplications and divisions aren't supported. - * - * Valid examples are: - * ``` - * 10 - * '10%' - * '10, 10' - * '10%, 10' - * '10 + 10%' - * '10 - 5vh + 3%' - * '-10px + 5vh, 5px - 6%' - * ``` - * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap - * > with their reference element, unfortunately, you will have to disable the `flip` modifier. - * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). - * - * @memberof modifiers - * @inner - */ - offset: { - /** @prop {number} order=200 - Index used to define the order of execution */ - order: 200, - /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ - enabled: true, - /** @prop {ModifierFn} */ - fn: offset, - /** @prop {Number|String} offset=0 - * The offset value as described in the modifier description - */ - offset: 0 - }, + config.rootElement = getElement(config.rootElement); + typeCheckConfig(NAME$8, config, DefaultType$7); + return config; + } - /** - * Modifier used to prevent the popper from being positioned outside the boundary. - * - * A scenario exists where the reference itself is not within the boundaries.
- * We can say it has "escaped the boundaries" — or just "escaped".
- * In this case we need to decide whether the popper should either: - * - * - detach from the reference and remain "trapped" in the boundaries, or - * - if it should ignore the boundary and "escape with its reference" - * - * When `escapeWithReference` is set to`true` and reference is completely - * outside its boundaries, the popper will overflow (or completely leave) - * the boundaries in order to remain attached to the edge of the reference. - * - * @memberof modifiers - * @inner - */ - preventOverflow: { - /** @prop {number} order=300 - Index used to define the order of execution */ - order: 300, - /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ - enabled: true, - /** @prop {ModifierFn} */ - fn: preventOverflow, - /** - * @prop {Array} [priority=['left','right','top','bottom']] - * Popper will try to prevent overflow following these priorities by default, - * then, it could overflow on the left and on top of the `boundariesElement` - */ - priority: ['left', 'right', 'top', 'bottom'], - /** - * @prop {number} padding=5 - * Amount of pixel used to define a minimum distance between the boundaries - * and the popper. This makes sure the popper always has a little padding - * between the edges of its container - */ - padding: 5, - /** - * @prop {String|HTMLElement} boundariesElement='scrollParent' - * Boundaries used by the modifier. Can be `scrollParent`, `window`, - * `viewport` or any DOM element. - */ - boundariesElement: 'scrollParent' - }, + _append() { + if (this._isAppended) { + return; + } - /** - * Modifier used to make sure the reference and its popper stay near each other - * without leaving any gap between the two. Especially useful when the arrow is - * enabled and you want to ensure that it points to its reference element. - * It cares only about the first axis. You can still have poppers with margin - * between the popper and its reference element. - * @memberof modifiers - * @inner - */ - keepTogether: { - /** @prop {number} order=400 - Index used to define the order of execution */ - order: 400, - /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ - enabled: true, - /** @prop {ModifierFn} */ - fn: keepTogether - }, + this._config.rootElement.append(this._getElement()); - /** - * This modifier is used to move the `arrowElement` of the popper to make - * sure it is positioned between the reference element and its popper element. - * It will read the outer size of the `arrowElement` node to detect how many - * pixels of conjunction are needed. - * - * It has no effect if no `arrowElement` is provided. - * @memberof modifiers - * @inner - */ - arrow: { - /** @prop {number} order=500 - Index used to define the order of execution */ - order: 500, - /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ - enabled: true, - /** @prop {ModifierFn} */ - fn: arrow, - /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ - element: '[x-arrow]' - }, + EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => { + execute(this._config.clickCallback); + }); + this._isAppended = true; + } - /** - * Modifier used to flip the popper's placement when it starts to overlap its - * reference element. - * - * Requires the `preventOverflow` modifier before it in order to work. - * - * **NOTE:** this modifier will interrupt the current update cycle and will - * restart it if it detects the need to flip the placement. - * @memberof modifiers - * @inner - */ - flip: { - /** @prop {number} order=600 - Index used to define the order of execution */ - order: 600, - /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ - enabled: true, - /** @prop {ModifierFn} */ - fn: flip, - /** - * @prop {String|Array} behavior='flip' - * The behavior used to change the popper's placement. It can be one of - * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid - * placements (with optional variations) - */ - behavior: 'flip', - /** - * @prop {number} padding=5 - * The popper will flip if it hits the edges of the `boundariesElement` - */ - padding: 5, - /** - * @prop {String|HTMLElement} boundariesElement='viewport' - * The element which will define the boundaries of the popper position. - * The popper will never be placed outside of the defined boundaries - * (except if `keepTogether` is enabled) - */ - boundariesElement: 'viewport' - }, + dispose() { + if (!this._isAppended) { + return; + } - /** - * Modifier used to make the popper flow toward the inner of the reference element. - * By default, when this modifier is disabled, the popper will be placed outside - * the reference element. - * @memberof modifiers - * @inner - */ - inner: { - /** @prop {number} order=700 - Index used to define the order of execution */ - order: 700, - /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ - enabled: false, - /** @prop {ModifierFn} */ - fn: inner - }, + EventHandler.off(this._element, EVENT_MOUSEDOWN); - /** - * Modifier used to hide the popper when its reference element is outside of the - * popper boundaries. It will set a `x-out-of-boundaries` attribute which can - * be used to hide with a CSS selector the popper when its reference is - * out of boundaries. - * - * Requires the `preventOverflow` modifier before it in order to work. - * @memberof modifiers - * @inner - */ - hide: { - /** @prop {number} order=800 - Index used to define the order of execution */ - order: 800, - /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ - enabled: true, - /** @prop {ModifierFn} */ - fn: hide - }, + this._element.remove(); - /** - * Computes the style that will be applied to the popper element to gets - * properly positioned. - * - * Note that this modifier will not touch the DOM, it just prepares the styles - * so that `applyStyle` modifier can apply it. This separation is useful - * in case you need to replace `applyStyle` with a custom implementation. - * - * This modifier has `850` as `order` value to maintain backward compatibility - * with previous versions of Popper.js. Expect the modifiers ordering method - * to change in future major versions of the library. - * - * @memberof modifiers - * @inner - */ - computeStyle: { - /** @prop {number} order=850 - Index used to define the order of execution */ - order: 850, - /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ - enabled: true, - /** @prop {ModifierFn} */ - fn: computeStyle, - /** - * @prop {Boolean} gpuAcceleration=true - * If true, it uses the CSS 3D transformation to position the popper. - * Otherwise, it will use the `top` and `left` properties - */ - gpuAcceleration: true, - /** - * @prop {string} [x='bottom'] - * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. - * Change this if your popper should grow in a direction different from `bottom` - */ - x: 'bottom', - /** - * @prop {string} [x='left'] - * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. - * Change this if your popper should grow in a direction different from `right` - */ - y: 'right' - }, + this._isAppended = false; + } - /** - * Applies the computed styles to the popper element. - * - * All the DOM manipulations are limited to this modifier. This is useful in case - * you want to integrate Popper.js inside a framework or view library and you - * want to delegate all the DOM manipulations to it. - * - * Note that if you disable this modifier, you must make sure the popper element - * has its position set to `absolute` before Popper.js can do its work! - * - * Just disable this modifier and define your own to achieve the desired effect. - * - * @memberof modifiers - * @inner - */ - applyStyle: { - /** @prop {number} order=900 - Index used to define the order of execution */ - order: 900, - /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ - enabled: true, - /** @prop {ModifierFn} */ - fn: applyStyle, - /** @prop {Function} */ - onLoad: applyStyleOnLoad, - /** - * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier - * @prop {Boolean} gpuAcceleration=true - * If true, it uses the CSS 3D transformation to position the popper. - * Otherwise, it will use the `top` and `left` properties - */ - gpuAcceleration: undefined + _emulateAnimation(callback) { + executeAfterTransition(callback, this._getElement(), this._config.isAnimated); } - }; - /** - * The `dataObject` is an object containing all the information used by Popper.js. - * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. - * @name dataObject - * @property {Object} data.instance The Popper.js instance - * @property {String} data.placement Placement applied to popper - * @property {String} data.originalPlacement Placement originally defined on init - * @property {Boolean} data.flipped True if popper has been flipped by flip modifier - * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper - * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier - * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) - * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) - * @property {Object} data.boundaries Offsets of the popper boundaries - * @property {Object} data.offsets The measurements of popper, reference and arrow elements - * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values - * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values - * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 - */ + } /** - * Default options provided to Popper.js constructor.
- * These can be overridden using the `options` argument of Popper.js.
- * To override an option, simply pass an object with the same - * structure of the `options` object, as the 3rd argument. For example: - * ``` - * new Popper(ref, pop, { - * modifiers: { - * preventOverflow: { enabled: false } - * } - * }) - * ``` - * @type {Object} - * @static - * @memberof Popper + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): util/focustrap.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * -------------------------------------------------------------------------- */ - var Defaults = { - /** - * Popper's placement. - * @prop {Popper.placements} placement='bottom' - */ - placement: 'bottom', - - /** - * Set this to true if you want popper to position it self in 'fixed' mode - * @prop {Boolean} positionFixed=false - */ - positionFixed: false, - - /** - * Whether events (resize, scroll) are initially enabled. - * @prop {Boolean} eventsEnabled=true - */ - eventsEnabled: true, - - /** - * Set to true if you want to automatically remove the popper when - * you call the `destroy` method. - * @prop {Boolean} removeOnDestroy=false - */ - removeOnDestroy: false, - - /** - * Callback called when the popper is created.
- * By default, it is set to no-op.
- * Access Popper.js instance with `data.instance`. - * @prop {onCreate} - */ - onCreate: function onCreate() {}, - - /** - * Callback called when the popper is updated. This callback is not called - * on the initialization/creation of the popper, but only on subsequent - * updates.
- * By default, it is set to no-op.
- * Access Popper.js instance with `data.instance`. - * @prop {onUpdate} - */ - onUpdate: function onUpdate() {}, - - /** - * List of modifiers used to modify the offsets before they are applied to the popper. - * They provide most of the functionalities of Popper.js. - * @prop {modifiers} - */ - modifiers: modifiers + const Default$6 = { + trapElement: null, + // The element to trap focus inside of + autofocus: true }; + const DefaultType$6 = { + trapElement: 'element', + autofocus: 'boolean' + }; + const NAME$7 = 'focustrap'; + const DATA_KEY$7 = 'bs.focustrap'; + const EVENT_KEY$7 = `.${DATA_KEY$7}`; + const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$7}`; + const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$7}`; + const TAB_KEY = 'Tab'; + const TAB_NAV_FORWARD = 'forward'; + const TAB_NAV_BACKWARD = 'backward'; + + class FocusTrap { + constructor(config) { + this._config = this._getConfig(config); + this._isActive = false; + this._lastTabNavDirection = null; + } - /** - * @callback onCreate - * @param {dataObject} data - */ + activate() { + const { + trapElement, + autofocus + } = this._config; - /** - * @callback onUpdate - * @param {dataObject} data - */ + if (this._isActive) { + return; + } - // Utils - // Methods - var Popper = function () { - /** - * Creates a new Popper.js instance. - * @class Popper - * @param {HTMLElement|referenceObject} reference - The reference element used to position the popper - * @param {HTMLElement} popper - The HTML element used as the popper - * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) - * @return {Object} instance - The generated Popper.js instance - */ - function Popper(reference, popper) { - var _this = this; - - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - classCallCheck(this, Popper); - - this.scheduleUpdate = function () { - return requestAnimationFrame(_this.update); - }; + if (autofocus) { + trapElement.focus(); + } - // make update() debounced, so that it only runs at most once-per-tick - this.update = debounce(this.update.bind(this)); + EventHandler.off(document, EVENT_KEY$7); // guard against infinite focus loop - // with {} we create a new object with the options inside it - this.options = _extends({}, Popper.Defaults, options); + EventHandler.on(document, EVENT_FOCUSIN$1, event => this._handleFocusin(event)); + EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event)); + this._isActive = true; + } - // init state - this.state = { - isDestroyed: false, - isCreated: false, - scrollParents: [] - }; + deactivate() { + if (!this._isActive) { + return; + } - // get reference and popper elements (allow jQuery wrappers) - this.reference = reference && reference.jquery ? reference[0] : reference; - this.popper = popper && popper.jquery ? popper[0] : popper; + this._isActive = false; + EventHandler.off(document, EVENT_KEY$7); + } // Private - // Deep merge modifiers options - this.options.modifiers = {}; - Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { - _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); - }); - // Refactoring modifiers' list (Object => Array) - this.modifiers = Object.keys(this.options.modifiers).map(function (name) { - return _extends({ - name: name - }, _this.options.modifiers[name]); - }) - // sort the modifiers by order - .sort(function (a, b) { - return a.order - b.order; - }); + _handleFocusin(event) { + const { + target + } = event; + const { + trapElement + } = this._config; - // modifiers have the ability to execute arbitrary code when Popper.js get inited - // such code is executed in the same order of its modifier - // they could add new properties to their options configuration - // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! - this.modifiers.forEach(function (modifierOptions) { - if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { - modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); - } - }); + if (target === document || target === trapElement || trapElement.contains(target)) { + return; + } - // fire the first update to position the popper in the right place - this.update(); + const elements = SelectorEngine.focusableChildren(trapElement); - var eventsEnabled = this.options.eventsEnabled; - if (eventsEnabled) { - // setup event listeners, they will take care of update the position in specific situations - this.enableEventListeners(); + if (elements.length === 0) { + trapElement.focus(); + } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) { + elements[elements.length - 1].focus(); + } else { + elements[0].focus(); } - - this.state.eventsEnabled = eventsEnabled; } - // We can't use class properties because they don't get listed in the - // class prototype and break stuff like Sinon stubs - - - createClass(Popper, [{ - key: 'update', - value: function update$$1() { - return update.call(this); - } - }, { - key: 'destroy', - value: function destroy$$1() { - return destroy.call(this); - } - }, { - key: 'enableEventListeners', - value: function enableEventListeners$$1() { - return enableEventListeners.call(this); - } - }, { - key: 'disableEventListeners', - value: function disableEventListeners$$1() { - return disableEventListeners.call(this); + _handleKeydown(event) { + if (event.key !== TAB_KEY) { + return; } - /** - * Schedules an update. It will run on the next UI update available. - * @method scheduleUpdate - * @memberof Popper - */ - + this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD; + } - /** - * Collection of utilities useful when writing custom modifiers. - * Starting from version 1.7, this method is available only if you - * include `popper-utils.js` before `popper.js`. - * - * **DEPRECATION**: This way to access PopperUtils is deprecated - * and will be removed in v2! Use the PopperUtils module directly instead. - * Due to the high instability of the methods contained in Utils, we can't - * guarantee them to follow semver. Use them at your own risk! - * @static - * @private - * @type {Object} - * @deprecated since version 1.8 - * @member Utils - * @memberof Popper - */ + _getConfig(config) { + config = { ...Default$6, + ...(typeof config === 'object' ? config : {}) + }; + typeCheckConfig(NAME$7, config, DefaultType$6); + return config; + } - }]); - return Popper; - }(); + } /** - * The `referenceObject` is an object that provides an interface compatible with Popper.js - * and lets you use it as replacement of a real DOM node.
- * You can use this method to position a popper relatively to a set of coordinates - * in case you don't have a DOM node to use as reference. - * - * ``` - * new Popper(referenceObject, popperNode); - * ``` - * - * NB: This feature isn't supported in Internet Explorer 10. - * @name referenceObject - * @property {Function} data.getBoundingClientRect - * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. - * @property {number} data.clientWidth - * An ES6 getter that will return the width of the virtual reference element. - * @property {number} data.clientHeight - * An ES6 getter that will return the height of the virtual reference element. + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): modal.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- */ - - - Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; - Popper.placements = placements; - Popper.Defaults = Defaults; - /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ - var NAME$4 = 'dropdown'; - var VERSION$4 = '4.3.1'; - var DATA_KEY$4 = 'bs.dropdown'; - var EVENT_KEY$4 = "." + DATA_KEY$4; - var DATA_API_KEY$4 = '.data-api'; - var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4]; - var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key - - var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key - - var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key - - var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key - - var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key - - var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) - - var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE); - var Event$4 = { - HIDE: "hide" + EVENT_KEY$4, - HIDDEN: "hidden" + EVENT_KEY$4, - SHOW: "show" + EVENT_KEY$4, - SHOWN: "shown" + EVENT_KEY$4, - CLICK: "click" + EVENT_KEY$4, - CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4, - KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4, - KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4 - }; - var ClassName$4 = { - DISABLED: 'disabled', - SHOW: 'show', - DROPUP: 'dropup', - DROPRIGHT: 'dropright', - DROPLEFT: 'dropleft', - MENURIGHT: 'dropdown-menu-right', - MENULEFT: 'dropdown-menu-left', - POSITION_STATIC: 'position-static' - }; - var Selector$4 = { - DATA_TOGGLE: '[data-toggle="dropdown"]', - FORM_CHILD: '.dropdown form', - MENU: '.dropdown-menu', - NAVBAR_NAV: '.navbar-nav', - VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)' - }; - var AttachmentMap = { - TOP: 'top-start', - TOPEND: 'top-end', - BOTTOM: 'bottom-start', - BOTTOMEND: 'bottom-end', - RIGHT: 'right-start', - RIGHTEND: 'right-end', - LEFT: 'left-start', - LEFTEND: 'left-end' - }; - var Default$2 = { - offset: 0, - flip: true, - boundary: 'scrollParent', - reference: 'toggle', - display: 'dynamic' + const NAME$6 = 'modal'; + const DATA_KEY$6 = 'bs.modal'; + const EVENT_KEY$6 = `.${DATA_KEY$6}`; + const DATA_API_KEY$3 = '.data-api'; + const ESCAPE_KEY$1 = 'Escape'; + const Default$5 = { + backdrop: true, + keyboard: true, + focus: true }; - var DefaultType$2 = { - offset: '(number|string|function)', - flip: 'boolean', - boundary: '(string|element)', - reference: '(string|element)', - display: 'string' - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - + const DefaultType$5 = { + backdrop: '(boolean|string)', + keyboard: 'boolean', + focus: 'boolean' }; + const EVENT_HIDE$3 = `hide${EVENT_KEY$6}`; + const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$6}`; + const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`; + const EVENT_SHOW$3 = `show${EVENT_KEY$6}`; + const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`; + const EVENT_RESIZE = `resize${EVENT_KEY$6}`; + const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$6}`; + const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`; + const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`; + const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`; + const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`; + const CLASS_NAME_OPEN = 'modal-open'; + const CLASS_NAME_FADE$3 = 'fade'; + const CLASS_NAME_SHOW$4 = 'show'; + const CLASS_NAME_STATIC = 'modal-static'; + const SELECTOR_DIALOG = '.modal-dialog'; + const SELECTOR_MODAL_BODY = '.modal-body'; + const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ - var Dropdown = - /*#__PURE__*/ - function () { - function Dropdown(element, config) { - this._element = element; - this._popper = null; + class Modal extends BaseComponent { + constructor(element, config) { + super(element); this._config = this._getConfig(config); - this._menu = this._getMenuElement(); - this._inNavbar = this._detectNavbar(); - - this._addEventListeners(); + this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element); + this._backdrop = this._initializeBackDrop(); + this._focustrap = this._initializeFocusTrap(); + this._isShown = false; + this._ignoreBackdropClick = false; + this._isTransitioning = false; + this._scrollBar = new ScrollBarHelper(); } // Getters - var _proto = Dropdown.prototype; - - // Public - _proto.toggle = function toggle() { - if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) { - return; - } + static get Default() { + return Default$5; + } - var parent = Dropdown._getParentFromElement(this._element); + static get NAME() { + return NAME$6; + } // Public - var isActive = $(this._menu).hasClass(ClassName$4.SHOW); - Dropdown._clearMenus(); + toggle(relatedTarget) { + return this._isShown ? this.hide() : this.show(relatedTarget); + } - if (isActive) { + show(relatedTarget) { + if (this._isShown || this._isTransitioning) { return; } - var relatedTarget = { - relatedTarget: this._element - }; - var showEvent = $.Event(Event$4.SHOW, relatedTarget); - $(parent).trigger(showEvent); + const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, { + relatedTarget + }); - if (showEvent.isDefaultPrevented()) { + if (showEvent.defaultPrevented) { return; - } // Disable totally Popper.js for Dropdown in Navbar + } + this._isShown = true; - if (!this._inNavbar) { - /** - * Check for Popper dependency - * Popper - https://popper.js.org - */ - if (typeof Popper === 'undefined') { - throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)'); - } + if (this._isAnimated()) { + this._isTransitioning = true; + } - var referenceElement = this._element; + this._scrollBar.hide(); - if (this._config.reference === 'parent') { - referenceElement = parent; - } else if (Util.isElement(this._config.reference)) { - referenceElement = this._config.reference; // Check if it's jQuery element + document.body.classList.add(CLASS_NAME_OPEN); - if (typeof this._config.reference.jquery !== 'undefined') { - referenceElement = this._config.reference[0]; - } - } // If boundary is not `scrollParent`, then set position to `static` - // to allow the menu to "escape" the scroll parent's boundaries - // https://github.com/twbs/bootstrap/issues/24251 + this._adjustDialog(); + this._setEscapeEvent(); - if (this._config.boundary !== 'scrollParent') { - $(parent).addClass(ClassName$4.POSITION_STATIC); - } + this._setResizeEvent(); - this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig()); - } // If this is a touch-enabled device we add extra - // empty mouseover listeners to the body's immediate children; - // only needed because of broken event delegation on iOS - // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html + EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => { + EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => { + if (event.target === this._element) { + this._ignoreBackdropClick = true; + } + }); + }); + this._showBackdrop(() => this._showElement(relatedTarget)); + } - if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) { - $(document.body).children().on('mouseover', null, $.noop); + hide() { + if (!this._isShown || this._isTransitioning) { + return; } - this._element.focus(); - - this._element.setAttribute('aria-expanded', true); - - $(this._menu).toggleClass(ClassName$4.SHOW); - $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget)); - }; + const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3); - _proto.show = function show() { - if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) { + if (hideEvent.defaultPrevented) { return; } - var relatedTarget = { - relatedTarget: this._element - }; - var showEvent = $.Event(Event$4.SHOW, relatedTarget); - - var parent = Dropdown._getParentFromElement(this._element); + this._isShown = false; - $(parent).trigger(showEvent); + const isAnimated = this._isAnimated(); - if (showEvent.isDefaultPrevented()) { - return; + if (isAnimated) { + this._isTransitioning = true; } - $(this._menu).toggleClass(ClassName$4.SHOW); - $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget)); - }; - - _proto.hide = function hide() { - if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) { - return; - } + this._setEscapeEvent(); - var relatedTarget = { - relatedTarget: this._element - }; - var hideEvent = $.Event(Event$4.HIDE, relatedTarget); + this._setResizeEvent(); - var parent = Dropdown._getParentFromElement(this._element); + this._focustrap.deactivate(); - $(parent).trigger(hideEvent); + this._element.classList.remove(CLASS_NAME_SHOW$4); - if (hideEvent.isDefaultPrevented()) { - return; - } + EventHandler.off(this._element, EVENT_CLICK_DISMISS); + EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS); - $(this._menu).toggleClass(ClassName$4.SHOW); - $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget)); - }; + this._queueCallback(() => this._hideModal(), this._element, isAnimated); + } - _proto.dispose = function dispose() { - $.removeData(this._element, DATA_KEY$4); - $(this._element).off(EVENT_KEY$4); - this._element = null; - this._menu = null; + dispose() { + [window, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6)); - if (this._popper !== null) { - this._popper.destroy(); + this._backdrop.dispose(); - this._popper = null; - } - }; + this._focustrap.deactivate(); - _proto.update = function update() { - this._inNavbar = this._detectNavbar(); + super.dispose(); + } - if (this._popper !== null) { - this._popper.scheduleUpdate(); - } + handleUpdate() { + this._adjustDialog(); } // Private - ; - _proto._addEventListeners = function _addEventListeners() { - var _this = this; - $(this._element).on(Event$4.CLICK, function (event) { - event.preventDefault(); - event.stopPropagation(); + _initializeBackDrop() { + return new Backdrop({ + isVisible: Boolean(this._config.backdrop), + // 'static' option will be translated to true, and booleans will keep their value + isAnimated: this._isAnimated() + }); + } - _this.toggle(); + _initializeFocusTrap() { + return new FocusTrap({ + trapElement: this._element }); - }; + } - _proto._getConfig = function _getConfig(config) { - config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config); - Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType); + _getConfig(config) { + config = { ...Default$5, + ...Manipulator.getDataAttributes(this._element), + ...(typeof config === 'object' ? config : {}) + }; + typeCheckConfig(NAME$6, config, DefaultType$5); return config; - }; - - _proto._getMenuElement = function _getMenuElement() { - if (!this._menu) { - var parent = Dropdown._getParentFromElement(this._element); + } - if (parent) { - this._menu = parent.querySelector(Selector$4.MENU); - } - } + _showElement(relatedTarget) { + const isAnimated = this._isAnimated(); - return this._menu; - }; + const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog); - _proto._getPlacement = function _getPlacement() { - var $parentDropdown = $(this._element.parentNode); - var placement = AttachmentMap.BOTTOM; // Handle dropup + if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { + // Don't move modal's DOM position + document.body.append(this._element); + } - if ($parentDropdown.hasClass(ClassName$4.DROPUP)) { - placement = AttachmentMap.TOP; + this._element.style.display = 'block'; - if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) { - placement = AttachmentMap.TOPEND; - } - } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) { - placement = AttachmentMap.RIGHT; - } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) { - placement = AttachmentMap.LEFT; - } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) { - placement = AttachmentMap.BOTTOMEND; - } + this._element.removeAttribute('aria-hidden'); - return placement; - }; + this._element.setAttribute('aria-modal', true); - _proto._detectNavbar = function _detectNavbar() { - return $(this._element).closest('.navbar').length > 0; - }; + this._element.setAttribute('role', 'dialog'); - _proto._getOffset = function _getOffset() { - var _this2 = this; + this._element.scrollTop = 0; - var offset = {}; + if (modalBody) { + modalBody.scrollTop = 0; + } - if (typeof this._config.offset === 'function') { - offset.fn = function (data) { - data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {}); - return data; - }; - } else { - offset.offset = this._config.offset; + if (isAnimated) { + reflow(this._element); } - return offset; - }; + this._element.classList.add(CLASS_NAME_SHOW$4); - _proto._getPopperConfig = function _getPopperConfig() { - var popperConfig = { - placement: this._getPlacement(), - modifiers: { - offset: this._getOffset(), - flip: { - enabled: this._config.flip - }, - preventOverflow: { - boundariesElement: this._config.boundary - } - } // Disable Popper.js if we have a static display + const transitionComplete = () => { + if (this._config.focus) { + this._focustrap.activate(); + } + this._isTransitioning = false; + EventHandler.trigger(this._element, EVENT_SHOWN$3, { + relatedTarget + }); }; - if (this._config.display === 'static') { - popperConfig.modifiers.applyStyle = { - enabled: false - }; - } + this._queueCallback(transitionComplete, this._dialog, isAnimated); + } - return popperConfig; - } // Static - ; + _setEscapeEvent() { + if (this._isShown) { + EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => { + if (this._config.keyboard && event.key === ESCAPE_KEY$1) { + event.preventDefault(); + this.hide(); + } else if (!this._config.keyboard && event.key === ESCAPE_KEY$1) { + this._triggerBackdropTransition(); + } + }); + } else { + EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1); + } + } - Dropdown._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY$4); + _setResizeEvent() { + if (this._isShown) { + EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog()); + } else { + EventHandler.off(window, EVENT_RESIZE); + } + } - var _config = typeof config === 'object' ? config : null; + _hideModal() { + this._element.style.display = 'none'; - if (!data) { - data = new Dropdown(this, _config); - $(this).data(DATA_KEY$4, data); - } + this._element.setAttribute('aria-hidden', true); - if (typeof config === 'string') { - if (typeof data[config] === 'undefined') { - throw new TypeError("No method named \"" + config + "\""); - } + this._element.removeAttribute('aria-modal'); - data[config](); - } - }); - }; + this._element.removeAttribute('role'); - Dropdown._clearMenus = function _clearMenus(event) { - if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { - return; - } + this._isTransitioning = false; - var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE)); + this._backdrop.hide(() => { + document.body.classList.remove(CLASS_NAME_OPEN); - for (var i = 0, len = toggles.length; i < len; i++) { - var parent = Dropdown._getParentFromElement(toggles[i]); + this._resetAdjustments(); - var context = $(toggles[i]).data(DATA_KEY$4); - var relatedTarget = { - relatedTarget: toggles[i] - }; + this._scrollBar.reset(); - if (event && event.type === 'click') { - relatedTarget.clickEvent = event; - } + EventHandler.trigger(this._element, EVENT_HIDDEN$3); + }); + } - if (!context) { - continue; + _showBackdrop(callback) { + EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => { + if (this._ignoreBackdropClick) { + this._ignoreBackdropClick = false; + return; } - var dropdownMenu = context._menu; - - if (!$(parent).hasClass(ClassName$4.SHOW)) { - continue; + if (event.target !== event.currentTarget) { + return; } - if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) { - continue; + if (this._config.backdrop === true) { + this.hide(); + } else if (this._config.backdrop === 'static') { + this._triggerBackdropTransition(); } + }); - var hideEvent = $.Event(Event$4.HIDE, relatedTarget); - $(parent).trigger(hideEvent); - - if (hideEvent.isDefaultPrevented()) { - continue; - } // If this is a touch-enabled device we remove the extra - // empty mouseover listeners we added for iOS support - - - if ('ontouchstart' in document.documentElement) { - $(document.body).children().off('mouseover', null, $.noop); - } + this._backdrop.show(callback); + } - toggles[i].setAttribute('aria-expanded', 'false'); - $(dropdownMenu).removeClass(ClassName$4.SHOW); - $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget)); - } - }; + _isAnimated() { + return this._element.classList.contains(CLASS_NAME_FADE$3); + } - Dropdown._getParentFromElement = function _getParentFromElement(element) { - var parent; - var selector = Util.getSelectorFromElement(element); + _triggerBackdropTransition() { + const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); - if (selector) { - parent = document.querySelector(selector); + if (hideEvent.defaultPrevented) { + return; } - return parent || element.parentNode; - } // eslint-disable-next-line complexity - ; + const { + classList, + scrollHeight, + style + } = this._element; + const isModalOverflowing = scrollHeight > document.documentElement.clientHeight; // return if the following background transition hasn't yet completed - Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { - // If not input/textarea: - // - And not a key in REGEXP_KEYDOWN => not a dropdown command - // If input/textarea: - // - If space key => not a dropdown command - // - If key is other than escape - // - If key is not up or down => not a dropdown command - // - If trigger inside the menu => not a dropdown command - if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { + if (!isModalOverflowing && style.overflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) { return; } - event.preventDefault(); - event.stopPropagation(); - - if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) { - return; + if (!isModalOverflowing) { + style.overflowY = 'hidden'; } - var parent = Dropdown._getParentFromElement(this); + classList.add(CLASS_NAME_STATIC); - var isActive = $(parent).hasClass(ClassName$4.SHOW); + this._queueCallback(() => { + classList.remove(CLASS_NAME_STATIC); - if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { - if (event.which === ESCAPE_KEYCODE) { - var toggle = parent.querySelector(Selector$4.DATA_TOGGLE); - $(toggle).trigger('focus'); + if (!isModalOverflowing) { + this._queueCallback(() => { + style.overflowY = ''; + }, this._dialog); } + }, this._dialog); + + this._element.focus(); + } // ---------------------------------------------------------------------- + // the following methods are used to handle overflowing modals + // ---------------------------------------------------------------------- - $(this).trigger('click'); - return; - } - var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)); + _adjustDialog() { + const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; - if (items.length === 0) { - return; - } + const scrollbarWidth = this._scrollBar.getWidth(); - var index = items.indexOf(event.target); + const isBodyOverflowing = scrollbarWidth > 0; - if (event.which === ARROW_UP_KEYCODE && index > 0) { - // Up - index--; + if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) { + this._element.style.paddingLeft = `${scrollbarWidth}px`; } - if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { - // Down - index++; + if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) { + this._element.style.paddingRight = `${scrollbarWidth}px`; } + } - if (index < 0) { - index = 0; - } + _resetAdjustments() { + this._element.style.paddingLeft = ''; + this._element.style.paddingRight = ''; + } // Static - items[index].focus(); - }; - _createClass(Dropdown, null, [{ - key: "VERSION", - get: function get() { - return VERSION$4; - } - }, { - key: "Default", - get: function get() { - return Default$2; - } - }, { - key: "DefaultType", - get: function get() { - return DefaultType$2; - } - }]); + static jQueryInterface(config, relatedTarget) { + return this.each(function () { + const data = Modal.getOrCreateInstance(this, config); + + if (typeof config !== 'string') { + return; + } + + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`); + } + + data[config](relatedTarget); + }); + } - return Dropdown; - }(); + } /** * ------------------------------------------------------------------------ * Data Api implementation @@ -4584,619 +4880,340 @@ */ - $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) { - event.preventDefault(); - event.stopPropagation(); + EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { + const target = getElementFromSelector(this); + + if (['A', 'AREA'].includes(this.tagName)) { + event.preventDefault(); + } + + EventHandler.one(target, EVENT_SHOW$3, showEvent => { + if (showEvent.defaultPrevented) { + // only register focus restorer if modal will actually get shown + return; + } - Dropdown._jQueryInterface.call($(this), 'toggle'); - }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) { - e.stopPropagation(); + EventHandler.one(target, EVENT_HIDDEN$3, () => { + if (isVisible(this)) { + this.focus(); + } + }); + }); + const data = Modal.getOrCreateInstance(target); + data.toggle(this); }); + enableDismissTrigger(Modal); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ + * add .Modal to jQuery only if jQuery is present */ - $.fn[NAME$4] = Dropdown._jQueryInterface; - $.fn[NAME$4].Constructor = Dropdown; - - $.fn[NAME$4].noConflict = function () { - $.fn[NAME$4] = JQUERY_NO_CONFLICT$4; - return Dropdown._jQueryInterface; - }; + defineJQueryPlugin(Modal); + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): offcanvas.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * -------------------------------------------------------------------------- + */ /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ - var NAME$5 = 'modal'; - var VERSION$5 = '4.3.1'; - var DATA_KEY$5 = 'bs.modal'; - var EVENT_KEY$5 = "." + DATA_KEY$5; - var DATA_API_KEY$5 = '.data-api'; - var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5]; - var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key - - var Default$3 = { + const NAME$5 = 'offcanvas'; + const DATA_KEY$5 = 'bs.offcanvas'; + const EVENT_KEY$5 = `.${DATA_KEY$5}`; + const DATA_API_KEY$2 = '.data-api'; + const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$5}${DATA_API_KEY$2}`; + const ESCAPE_KEY = 'Escape'; + const Default$4 = { backdrop: true, keyboard: true, - focus: true, - show: true + scroll: false }; - var DefaultType$3 = { - backdrop: '(boolean|string)', + const DefaultType$4 = { + backdrop: 'boolean', keyboard: 'boolean', - focus: 'boolean', - show: 'boolean' - }; - var Event$5 = { - HIDE: "hide" + EVENT_KEY$5, - HIDDEN: "hidden" + EVENT_KEY$5, - SHOW: "show" + EVENT_KEY$5, - SHOWN: "shown" + EVENT_KEY$5, - FOCUSIN: "focusin" + EVENT_KEY$5, - RESIZE: "resize" + EVENT_KEY$5, - CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5, - KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5, - MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5, - MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5, - CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5 - }; - var ClassName$5 = { - SCROLLABLE: 'modal-dialog-scrollable', - SCROLLBAR_MEASURER: 'modal-scrollbar-measure', - BACKDROP: 'modal-backdrop', - OPEN: 'modal-open', - FADE: 'fade', - SHOW: 'show' - }; - var Selector$5 = { - DIALOG: '.modal-dialog', - MODAL_BODY: '.modal-body', - DATA_TOGGLE: '[data-toggle="modal"]', - DATA_DISMISS: '[data-dismiss="modal"]', - FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', - STICKY_CONTENT: '.sticky-top' - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - + scroll: 'boolean' }; + const CLASS_NAME_SHOW$3 = 'show'; + const CLASS_NAME_BACKDROP = 'offcanvas-backdrop'; + const OPEN_SELECTOR = '.offcanvas.show'; + const EVENT_SHOW$2 = `show${EVENT_KEY$5}`; + const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`; + const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`; + const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`; + const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`; + const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`; + const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]'; + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ - var Modal = - /*#__PURE__*/ - function () { - function Modal(element, config) { + class Offcanvas extends BaseComponent { + constructor(element, config) { + super(element); this._config = this._getConfig(config); - this._element = element; - this._dialog = element.querySelector(Selector$5.DIALOG); - this._backdrop = null; this._isShown = false; - this._isBodyOverflowing = false; - this._ignoreBackdropClick = false; - this._isTransitioning = false; - this._scrollbarWidth = 0; + this._backdrop = this._initializeBackDrop(); + this._focustrap = this._initializeFocusTrap(); + + this._addEventListeners(); } // Getters - var _proto = Modal.prototype; + static get NAME() { + return NAME$5; + } - // Public - _proto.toggle = function toggle(relatedTarget) { - return this._isShown ? this.hide() : this.show(relatedTarget); - }; + static get Default() { + return Default$4; + } // Public - _proto.show = function show(relatedTarget) { - var _this = this; - if (this._isShown || this._isTransitioning) { - return; - } + toggle(relatedTarget) { + return this._isShown ? this.hide() : this.show(relatedTarget); + } - if ($(this._element).hasClass(ClassName$5.FADE)) { - this._isTransitioning = true; + show(relatedTarget) { + if (this._isShown) { + return; } - var showEvent = $.Event(Event$5.SHOW, { - relatedTarget: relatedTarget + const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, { + relatedTarget }); - $(this._element).trigger(showEvent); - if (this._isShown || showEvent.isDefaultPrevented()) { + if (showEvent.defaultPrevented) { return; } this._isShown = true; + this._element.style.visibility = 'visible'; - this._checkScrollbar(); + this._backdrop.show(); - this._setScrollbar(); + if (!this._config.scroll) { + new ScrollBarHelper().hide(); + } - this._adjustDialog(); + this._element.removeAttribute('aria-hidden'); - this._setEscapeEvent(); + this._element.setAttribute('aria-modal', true); - this._setResizeEvent(); + this._element.setAttribute('role', 'dialog'); - $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) { - return _this.hide(event); - }); - $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () { - $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) { - if ($(event.target).is(_this._element)) { - _this._ignoreBackdropClick = true; - } - }); - }); + this._element.classList.add(CLASS_NAME_SHOW$3); - this._showBackdrop(function () { - return _this._showElement(relatedTarget); - }); - }; + const completeCallBack = () => { + if (!this._config.scroll) { + this._focustrap.activate(); + } - _proto.hide = function hide(event) { - var _this2 = this; + EventHandler.trigger(this._element, EVENT_SHOWN$2, { + relatedTarget + }); + }; - if (event) { - event.preventDefault(); - } + this._queueCallback(completeCallBack, this._element, true); + } - if (!this._isShown || this._isTransitioning) { + hide() { + if (!this._isShown) { return; } - var hideEvent = $.Event(Event$5.HIDE); - $(this._element).trigger(hideEvent); + const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2); - if (!this._isShown || hideEvent.isDefaultPrevented()) { + if (hideEvent.defaultPrevented) { return; } - this._isShown = false; - var transition = $(this._element).hasClass(ClassName$5.FADE); - - if (transition) { - this._isTransitioning = true; - } - - this._setEscapeEvent(); - - this._setResizeEvent(); - - $(document).off(Event$5.FOCUSIN); - $(this._element).removeClass(ClassName$5.SHOW); - $(this._element).off(Event$5.CLICK_DISMISS); - $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS); - - if (transition) { - var transitionDuration = Util.getTransitionDurationFromElement(this._element); - $(this._element).one(Util.TRANSITION_END, function (event) { - return _this2._hideModal(event); - }).emulateTransitionEnd(transitionDuration); - } else { - this._hideModal(); - } - }; - - _proto.dispose = function dispose() { - [window, this._element, this._dialog].forEach(function (htmlElement) { - return $(htmlElement).off(EVENT_KEY$5); - }); - /** - * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API` - * Do not move `document` in `htmlElements` array - * It will remove `Event.CLICK_DATA_API` event that should remain - */ - - $(document).off(Event$5.FOCUSIN); - $.removeData(this._element, DATA_KEY$5); - this._config = null; - this._element = null; - this._dialog = null; - this._backdrop = null; - this._isShown = null; - this._isBodyOverflowing = null; - this._ignoreBackdropClick = null; - this._isTransitioning = null; - this._scrollbarWidth = null; - }; - - _proto.handleUpdate = function handleUpdate() { - this._adjustDialog(); - } // Private - ; - - _proto._getConfig = function _getConfig(config) { - config = _objectSpread({}, Default$3, config); - Util.typeCheckConfig(NAME$5, config, DefaultType$3); - return config; - }; - - _proto._showElement = function _showElement(relatedTarget) { - var _this3 = this; - - var transition = $(this._element).hasClass(ClassName$5.FADE); - - if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { - // Don't move modal's DOM position - document.body.appendChild(this._element); - } + this._focustrap.deactivate(); - this._element.style.display = 'block'; + this._element.blur(); - this._element.removeAttribute('aria-hidden'); + this._isShown = false; - this._element.setAttribute('aria-modal', true); + this._element.classList.remove(CLASS_NAME_SHOW$3); - if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE)) { - this._dialog.querySelector(Selector$5.MODAL_BODY).scrollTop = 0; - } else { - this._element.scrollTop = 0; - } + this._backdrop.hide(); - if (transition) { - Util.reflow(this._element); - } + const completeCallback = () => { + this._element.setAttribute('aria-hidden', true); - $(this._element).addClass(ClassName$5.SHOW); + this._element.removeAttribute('aria-modal'); - if (this._config.focus) { - this._enforceFocus(); - } + this._element.removeAttribute('role'); - var shownEvent = $.Event(Event$5.SHOWN, { - relatedTarget: relatedTarget - }); + this._element.style.visibility = 'hidden'; - var transitionComplete = function transitionComplete() { - if (_this3._config.focus) { - _this3._element.focus(); + if (!this._config.scroll) { + new ScrollBarHelper().reset(); } - _this3._isTransitioning = false; - $(_this3._element).trigger(shownEvent); + EventHandler.trigger(this._element, EVENT_HIDDEN$2); }; - if (transition) { - var transitionDuration = Util.getTransitionDurationFromElement(this._dialog); - $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); - } else { - transitionComplete(); - } - }; - - _proto._enforceFocus = function _enforceFocus() { - var _this4 = this; - - $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop - .on(Event$5.FOCUSIN, function (event) { - if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) { - _this4._element.focus(); - } - }); - }; - - _proto._setEscapeEvent = function _setEscapeEvent() { - var _this5 = this; - - if (this._isShown && this._config.keyboard) { - $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) { - if (event.which === ESCAPE_KEYCODE$1) { - event.preventDefault(); - - _this5.hide(); - } - }); - } else if (!this._isShown) { - $(this._element).off(Event$5.KEYDOWN_DISMISS); - } - }; - - _proto._setResizeEvent = function _setResizeEvent() { - var _this6 = this; - - if (this._isShown) { - $(window).on(Event$5.RESIZE, function (event) { - return _this6.handleUpdate(event); - }); - } else { - $(window).off(Event$5.RESIZE); - } - }; - - _proto._hideModal = function _hideModal() { - var _this7 = this; - - this._element.style.display = 'none'; - - this._element.setAttribute('aria-hidden', true); + this._queueCallback(completeCallback, this._element, true); + } - this._element.removeAttribute('aria-modal'); + dispose() { + this._backdrop.dispose(); - this._isTransitioning = false; + this._focustrap.deactivate(); - this._showBackdrop(function () { - $(document.body).removeClass(ClassName$5.OPEN); + super.dispose(); + } // Private - _this7._resetAdjustments(); - _this7._resetScrollbar(); + _getConfig(config) { + config = { ...Default$4, + ...Manipulator.getDataAttributes(this._element), + ...(typeof config === 'object' ? config : {}) + }; + typeCheckConfig(NAME$5, config, DefaultType$4); + return config; + } - $(_this7._element).trigger(Event$5.HIDDEN); + _initializeBackDrop() { + return new Backdrop({ + className: CLASS_NAME_BACKDROP, + isVisible: this._config.backdrop, + isAnimated: true, + rootElement: this._element.parentNode, + clickCallback: () => this.hide() }); - }; - - _proto._removeBackdrop = function _removeBackdrop() { - if (this._backdrop) { - $(this._backdrop).remove(); - this._backdrop = null; - } - }; - - _proto._showBackdrop = function _showBackdrop(callback) { - var _this8 = this; - - var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : ''; - - if (this._isShown && this._config.backdrop) { - this._backdrop = document.createElement('div'); - this._backdrop.className = ClassName$5.BACKDROP; - - if (animate) { - this._backdrop.classList.add(animate); - } - - $(this._backdrop).appendTo(document.body); - $(this._element).on(Event$5.CLICK_DISMISS, function (event) { - if (_this8._ignoreBackdropClick) { - _this8._ignoreBackdropClick = false; - return; - } - - if (event.target !== event.currentTarget) { - return; - } + } - if (_this8._config.backdrop === 'static') { - _this8._element.focus(); - } else { - _this8.hide(); - } - }); + _initializeFocusTrap() { + return new FocusTrap({ + trapElement: this._element + }); + } - if (animate) { - Util.reflow(this._backdrop); + _addEventListeners() { + EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => { + if (this._config.keyboard && event.key === ESCAPE_KEY) { + this.hide(); } + }); + } // Static - $(this._backdrop).addClass(ClassName$5.SHOW); - if (!callback) { - return; - } + static jQueryInterface(config) { + return this.each(function () { + const data = Offcanvas.getOrCreateInstance(this, config); - if (!animate) { - callback(); + if (typeof config !== 'string') { return; } - var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); - $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); - } else if (!this._isShown && this._backdrop) { - $(this._backdrop).removeClass(ClassName$5.SHOW); - - var callbackRemove = function callbackRemove() { - _this8._removeBackdrop(); - - if (callback) { - callback(); - } - }; - - if ($(this._element).hasClass(ClassName$5.FADE)) { - var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); - - $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); - } else { - callbackRemove(); + if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { + throw new TypeError(`No method named "${config}"`); } - } else if (callback) { - callback(); - } - } // ---------------------------------------------------------------------- - // the following methods are used to handle overflowing modals - // todo (fat): these should probably be refactored out of modal.js - // ---------------------------------------------------------------------- - ; - - _proto._adjustDialog = function _adjustDialog() { - var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; - - if (!this._isBodyOverflowing && isModalOverflowing) { - this._element.style.paddingLeft = this._scrollbarWidth + "px"; - } - - if (this._isBodyOverflowing && !isModalOverflowing) { - this._element.style.paddingRight = this._scrollbarWidth + "px"; - } - }; - _proto._resetAdjustments = function _resetAdjustments() { - this._element.style.paddingLeft = ''; - this._element.style.paddingRight = ''; - }; + data[config](this); + }); + } - _proto._checkScrollbar = function _checkScrollbar() { - var rect = document.body.getBoundingClientRect(); - this._isBodyOverflowing = rect.left + rect.right < window.innerWidth; - this._scrollbarWidth = this._getScrollbarWidth(); - }; + } + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ - _proto._setScrollbar = function _setScrollbar() { - var _this9 = this; - if (this._isBodyOverflowing) { - // Note: DOMNode.style.paddingRight returns the actual value or '' if not set - // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set - var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); - var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding + EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) { + const target = getElementFromSelector(this); - $(fixedContent).each(function (index, element) { - var actualPadding = element.style.paddingRight; - var calculatedPadding = $(element).css('padding-right'); - $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px"); - }); // Adjust sticky content margin + if (['A', 'AREA'].includes(this.tagName)) { + event.preventDefault(); + } - $(stickyContent).each(function (index, element) { - var actualMargin = element.style.marginRight; - var calculatedMargin = $(element).css('margin-right'); - $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px"); - }); // Adjust body padding + if (isDisabled(this)) { + return; + } - var actualPadding = document.body.style.paddingRight; - var calculatedPadding = $(document.body).css('padding-right'); - $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); + EventHandler.one(target, EVENT_HIDDEN$2, () => { + // focus on trigger when it is closed + if (isVisible(this)) { + this.focus(); } + }); // avoid conflict when clicking a toggler of an offcanvas, while another is open - $(document.body).addClass(ClassName$5.OPEN); - }; - - _proto._resetScrollbar = function _resetScrollbar() { - // Restore fixed content padding - var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); - $(fixedContent).each(function (index, element) { - var padding = $(element).data('padding-right'); - $(element).removeData('padding-right'); - element.style.paddingRight = padding ? padding : ''; - }); // Restore sticky content - - var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT)); - $(elements).each(function (index, element) { - var margin = $(element).data('margin-right'); - - if (typeof margin !== 'undefined') { - $(element).css('margin-right', margin).removeData('margin-right'); - } - }); // Restore body padding - - var padding = $(document.body).data('padding-right'); - $(document.body).removeData('padding-right'); - document.body.style.paddingRight = padding ? padding : ''; - }; - - _proto._getScrollbarWidth = function _getScrollbarWidth() { - // thx d.walsh - var scrollDiv = document.createElement('div'); - scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER; - document.body.appendChild(scrollDiv); - var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; - document.body.removeChild(scrollDiv); - return scrollbarWidth; - } // Static - ; - - Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { - return this.each(function () { - var data = $(this).data(DATA_KEY$5); - - var _config = _objectSpread({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {}); + const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR); - if (!data) { - data = new Modal(this, _config); - $(this).data(DATA_KEY$5, data); - } + if (allReadyOpen && allReadyOpen !== target) { + Offcanvas.getInstance(allReadyOpen).hide(); + } - if (typeof config === 'string') { - if (typeof data[config] === 'undefined') { - throw new TypeError("No method named \"" + config + "\""); - } + const data = Offcanvas.getOrCreateInstance(target); + data.toggle(this); + }); + EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show())); + enableDismissTrigger(Offcanvas); + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + */ - data[config](relatedTarget); - } else if (_config.show) { - data.show(relatedTarget); - } - }); - }; + defineJQueryPlugin(Offcanvas); - _createClass(Modal, null, [{ - key: "VERSION", - get: function get() { - return VERSION$5; - } - }, { - key: "Default", - get: function get() { - return Default$3; - } - }]); + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): util/sanitizer.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + const uriAttrs = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']); + const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; + /** + * A pattern that recognizes a commonly useful subset of URLs that are safe. + * + * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts + */ - return Modal; - }(); + const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i; /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ + * A pattern that matches safe data URLs. Only matches image, video and audio types. + * + * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts */ + const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; - $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) { - var _this10 = this; + const allowedAttribute = (attr, allowedAttributeList) => { + const attrName = attr.nodeName.toLowerCase(); - var target; - var selector = Util.getSelectorFromElement(this); + if (allowedAttributeList.includes(attrName)) { + if (uriAttrs.has(attrName)) { + return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)); + } - if (selector) { - target = document.querySelector(selector); + return true; } - var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data()); - - if (this.tagName === 'A' || this.tagName === 'AREA') { - event.preventDefault(); - } + const regExp = allowedAttributeList.filter(attrRegex => attrRegex instanceof RegExp); // Check if a regular expression validates the attribute. - var $target = $(target).one(Event$5.SHOW, function (showEvent) { - if (showEvent.isDefaultPrevented()) { - // Only register focus restorer if modal will actually get shown - return; + for (let i = 0, len = regExp.length; i < len; i++) { + if (regExp[i].test(attrName)) { + return true; } + } - $target.one(Event$5.HIDDEN, function () { - if ($(_this10).is(':visible')) { - _this10.focus(); - } - }); - }); - - Modal._jQueryInterface.call($(target), config, this); - }); - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME$5] = Modal._jQueryInterface; - $.fn[NAME$5].Constructor = Modal; - - $.fn[NAME$5].noConflict = function () { - $.fn[NAME$5] = JQUERY_NO_CONFLICT$5; - return Modal._jQueryInterface; + return false; }; - /** - * -------------------------------------------------------------------------- - * Bootstrap (v4.3.1): tools/sanitizer.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ - var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']; - var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; - var DefaultWhitelist = { + const DefaultAllowlist = { // Global attributes allowed on any supplied element below. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], a: ['target', 'href', 'title', 'rel'], @@ -5215,7 +5232,7 @@ h5: [], h6: [], i: [], - img: ['src', 'alt', 'title', 'width', 'height'], + img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], li: [], ol: [], p: [], @@ -5228,48 +5245,9 @@ strong: [], u: [], ul: [] - /** - * A pattern that recognizes a commonly useful subset of URLs that are safe. - * - * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts - */ - }; - var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; - /** - * A pattern that matches safe data URLs. Only matches image, video and audio types. - * - * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts - */ - - var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i; - - function allowedAttribute(attr, allowedAttributeList) { - var attrName = attr.nodeName.toLowerCase(); - - if (allowedAttributeList.indexOf(attrName) !== -1) { - if (uriAttrs.indexOf(attrName) !== -1) { - return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)); - } - - return true; - } - - var regExp = allowedAttributeList.filter(function (attrRegex) { - return attrRegex instanceof RegExp; - }); // Check if a regular expression validates the attribute. - - for (var i = 0, l = regExp.length; i < l; i++) { - if (attrName.match(regExp[i])) { - return true; - } - } - - return false; - } - - function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { - if (unsafeHtml.length === 0) { + function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) { + if (!unsafeHtml.length) { return unsafeHtml; } @@ -5277,53 +5255,50 @@ return sanitizeFn(unsafeHtml); } - var domParser = new window.DOMParser(); - var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); - var whitelistKeys = Object.keys(whiteList); - var elements = [].slice.call(createdDocument.body.querySelectorAll('*')); + const domParser = new window.DOMParser(); + const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); + const allowlistKeys = Object.keys(allowList); + const elements = [].concat(...createdDocument.body.querySelectorAll('*')); - var _loop = function _loop(i, len) { - var el = elements[i]; - var elName = el.nodeName.toLowerCase(); + for (let i = 0, len = elements.length; i < len; i++) { + const el = elements[i]; + const elName = el.nodeName.toLowerCase(); - if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) { - el.parentNode.removeChild(el); - return "continue"; + if (!allowlistKeys.includes(elName)) { + el.remove(); + continue; } - var attributeList = [].slice.call(el.attributes); - var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); - attributeList.forEach(function (attr) { - if (!allowedAttribute(attr, whitelistedAttributes)) { + const attributeList = [].concat(...el.attributes); + const allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []); + attributeList.forEach(attr => { + if (!allowedAttribute(attr, allowedAttributes)) { el.removeAttribute(attr.nodeName); } }); - }; - - for (var i = 0, len = elements.length; i < len; i++) { - var _ret = _loop(i, len); - - if (_ret === "continue") continue; } return createdDocument.body.innerHTML; } + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): tooltip.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ - var NAME$6 = 'tooltip'; - var VERSION$6 = '4.3.1'; - var DATA_KEY$6 = 'bs.tooltip'; - var EVENT_KEY$6 = "." + DATA_KEY$6; - var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6]; - var CLASS_PREFIX = 'bs-tooltip'; - var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); - var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; - var DefaultType$4 = { + const NAME$4 = 'tooltip'; + const DATA_KEY$4 = 'bs.tooltip'; + const EVENT_KEY$4 = `.${DATA_KEY$4}`; + const CLASS_PREFIX$1 = 'bs-tooltip'; + const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']); + const DefaultType$3 = { animation: 'boolean', template: 'string', title: '(string|element|function)', @@ -5332,88 +5307,79 @@ html: 'boolean', selector: '(string|boolean)', placement: '(string|function)', - offset: '(number|string|function)', + offset: '(array|string|function)', container: '(string|element|boolean)', - fallbackPlacement: '(string|array)', + fallbackPlacements: 'array', boundary: '(string|element)', + customClass: '(string|function)', sanitize: 'boolean', sanitizeFn: '(null|function)', - whiteList: 'object' + allowList: 'object', + popperConfig: '(null|object|function)' }; - var AttachmentMap$1 = { + const AttachmentMap = { AUTO: 'auto', TOP: 'top', - RIGHT: 'right', + RIGHT: isRTL() ? 'left' : 'right', BOTTOM: 'bottom', - LEFT: 'left' + LEFT: isRTL() ? 'right' : 'left' }; - var Default$4 = { + const Default$3 = { animation: true, - template: '', + template: '', trigger: 'hover focus', title: '', delay: 0, html: false, selector: false, placement: 'top', - offset: 0, + offset: [0, 0], container: false, - fallbackPlacement: 'flip', - boundary: 'scrollParent', + fallbackPlacements: ['top', 'right', 'bottom', 'left'], + boundary: 'clippingParents', + customClass: '', sanitize: true, sanitizeFn: null, - whiteList: DefaultWhitelist + allowList: DefaultAllowlist, + popperConfig: null }; - var HoverState = { - SHOW: 'show', - OUT: 'out' - }; - var Event$6 = { - HIDE: "hide" + EVENT_KEY$6, - HIDDEN: "hidden" + EVENT_KEY$6, - SHOW: "show" + EVENT_KEY$6, - SHOWN: "shown" + EVENT_KEY$6, - INSERTED: "inserted" + EVENT_KEY$6, - CLICK: "click" + EVENT_KEY$6, - FOCUSIN: "focusin" + EVENT_KEY$6, - FOCUSOUT: "focusout" + EVENT_KEY$6, - MOUSEENTER: "mouseenter" + EVENT_KEY$6, - MOUSELEAVE: "mouseleave" + EVENT_KEY$6 - }; - var ClassName$6 = { - FADE: 'fade', - SHOW: 'show' - }; - var Selector$6 = { - TOOLTIP: '.tooltip', - TOOLTIP_INNER: '.tooltip-inner', - ARROW: '.arrow' - }; - var Trigger = { - HOVER: 'hover', - FOCUS: 'focus', - CLICK: 'click', - MANUAL: 'manual' - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - + const Event$2 = { + HIDE: `hide${EVENT_KEY$4}`, + HIDDEN: `hidden${EVENT_KEY$4}`, + SHOW: `show${EVENT_KEY$4}`, + SHOWN: `shown${EVENT_KEY$4}`, + INSERTED: `inserted${EVENT_KEY$4}`, + CLICK: `click${EVENT_KEY$4}`, + FOCUSIN: `focusin${EVENT_KEY$4}`, + FOCUSOUT: `focusout${EVENT_KEY$4}`, + MOUSEENTER: `mouseenter${EVENT_KEY$4}`, + MOUSELEAVE: `mouseleave${EVENT_KEY$4}` }; + const CLASS_NAME_FADE$2 = 'fade'; + const CLASS_NAME_MODAL = 'modal'; + const CLASS_NAME_SHOW$2 = 'show'; + const HOVER_STATE_SHOW = 'show'; + const HOVER_STATE_OUT = 'out'; + const SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; + const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`; + const EVENT_MODAL_HIDE = 'hide.bs.modal'; + const TRIGGER_HOVER = 'hover'; + const TRIGGER_FOCUS = 'focus'; + const TRIGGER_CLICK = 'click'; + const TRIGGER_MANUAL = 'manual'; + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ - var Tooltip = - /*#__PURE__*/ - function () { - function Tooltip(element, config) { - /** - * Check for Popper dependency - * Popper - https://popper.js.org - */ + class Tooltip extends BaseComponent { + constructor(element, config) { if (typeof Popper === 'undefined') { - throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)'); - } // private + throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)'); + } + super(element); // private this._isEnabled = true; this._timeout = 0; @@ -5421,42 +5387,49 @@ this._activeTrigger = {}; this._popper = null; // Protected - this.element = element; - this.config = this._getConfig(config); + this._config = this._getConfig(config); this.tip = null; this._setListeners(); } // Getters - var _proto = Tooltip.prototype; + static get Default() { + return Default$3; + } + + static get NAME() { + return NAME$4; + } + + static get Event() { + return Event$2; + } + + static get DefaultType() { + return DefaultType$3; + } // Public + - // Public - _proto.enable = function enable() { + enable() { this._isEnabled = true; - }; + } - _proto.disable = function disable() { + disable() { this._isEnabled = false; - }; + } - _proto.toggleEnabled = function toggleEnabled() { + toggleEnabled() { this._isEnabled = !this._isEnabled; - }; + } - _proto.toggle = function toggle(event) { + toggle(event) { if (!this._isEnabled) { return; } if (event) { - var dataKey = this.constructor.DATA_KEY; - var context = $(event.currentTarget).data(dataKey); - - if (!context) { - context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(dataKey, context); - } + const context = this._initializeOnDelegatedTarget(event); context._activeTrigger.click = !context._activeTrigger.click; @@ -5466,7 +5439,7 @@ context._leave(null, context); } } else { - if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) { + if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$2)) { this._leave(null, this); return; @@ -5474,367 +5447,400 @@ this._enter(null, this); } - }; + } - _proto.dispose = function dispose() { + dispose() { clearTimeout(this._timeout); - $.removeData(this.element, this.constructor.DATA_KEY); - $(this.element).off(this.constructor.EVENT_KEY); - $(this.element).closest('.modal').off('hide.bs.modal'); + EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); if (this.tip) { - $(this.tip).remove(); + this.tip.remove(); } - this._isEnabled = null; - this._timeout = null; - this._hoverState = null; - this._activeTrigger = null; - - if (this._popper !== null) { + if (this._popper) { this._popper.destroy(); } - this._popper = null; - this.element = null; - this.config = null; - this.tip = null; - }; - - _proto.show = function show() { - var _this = this; + super.dispose(); + } - if ($(this.element).css('display') === 'none') { + show() { + if (this._element.style.display === 'none') { throw new Error('Please use show on visible elements'); } - var showEvent = $.Event(this.constructor.Event.SHOW); + if (!(this.isWithContent() && this._isEnabled)) { + return; + } - if (this.isWithContent() && this._isEnabled) { - $(this.element).trigger(showEvent); - var shadowRoot = Util.findShadowRoot(this.element); - var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); + const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW); + const shadowRoot = findShadowRoot(this._element); + const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element); - if (showEvent.isDefaultPrevented() || !isInTheDom) { - return; - } + if (showEvent.defaultPrevented || !isInTheDom) { + return; + } - var tip = this.getTipElement(); - var tipId = Util.getUID(this.constructor.NAME); - tip.setAttribute('id', tipId); - this.element.setAttribute('aria-describedby', tipId); - this.setContent(); + const tip = this.getTipElement(); + const tipId = getUID(this.constructor.NAME); + tip.setAttribute('id', tipId); - if (this.config.animation) { - $(tip).addClass(ClassName$6.FADE); - } + this._element.setAttribute('aria-describedby', tipId); - var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; + if (this._config.animation) { + tip.classList.add(CLASS_NAME_FADE$2); + } - var attachment = this._getAttachment(placement); + const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement; - this.addAttachmentClass(attachment); + const attachment = this._getAttachment(placement); - var container = this._getContainer(); + this._addAttachmentClass(attachment); - $(tip).data(this.constructor.DATA_KEY, this); + const { + container + } = this._config; + Data.set(tip, this.constructor.DATA_KEY, this); - if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) { - $(tip).appendTo(container); - } + if (!this._element.ownerDocument.documentElement.contains(this.tip)) { + container.append(tip); + EventHandler.trigger(this._element, this.constructor.Event.INSERTED); + } - $(this.element).trigger(this.constructor.Event.INSERTED); - this._popper = new Popper(this.element, tip, { - placement: attachment, - modifiers: { - offset: this._getOffset(), - flip: { - behavior: this.config.fallbackPlacement - }, - arrow: { - element: Selector$6.ARROW - }, - preventOverflow: { - boundariesElement: this.config.boundary - } - }, - onCreate: function onCreate(data) { - if (data.originalPlacement !== data.placement) { - _this._handlePopperPlacementChange(data); - } - }, - onUpdate: function onUpdate(data) { - return _this._handlePopperPlacementChange(data); - } - }); - $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra - // empty mouseover listeners to the body's immediate children; - // only needed because of broken event delegation on iOS - // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html + if (this._popper) { + this._popper.update(); + } else { + this._popper = createPopper(this._element, tip, this._getPopperConfig(attachment)); + } - if ('ontouchstart' in document.documentElement) { - $(document.body).children().on('mouseover', null, $.noop); - } + tip.classList.add(CLASS_NAME_SHOW$2); - var complete = function complete() { - if (_this.config.animation) { - _this._fixTransition(); - } + const customClass = this._resolvePossibleFunction(this._config.customClass); + + if (customClass) { + tip.classList.add(...customClass.split(' ')); + } // If this is a touch-enabled device we add extra + // empty mouseover listeners to the body's immediate children; + // only needed because of broken event delegation on iOS + // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html - var prevHoverState = _this._hoverState; - _this._hoverState = null; - $(_this.element).trigger(_this.constructor.Event.SHOWN); - if (prevHoverState === HoverState.OUT) { - _this._leave(null, _this); - } - }; + if ('ontouchstart' in document.documentElement) { + [].concat(...document.body.children).forEach(element => { + EventHandler.on(element, 'mouseover', noop); + }); + } - if ($(this.tip).hasClass(ClassName$6.FADE)) { - var transitionDuration = Util.getTransitionDurationFromElement(this.tip); - $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); - } else { - complete(); + const complete = () => { + const prevHoverState = this._hoverState; + this._hoverState = null; + EventHandler.trigger(this._element, this.constructor.Event.SHOWN); + + if (prevHoverState === HOVER_STATE_OUT) { + this._leave(null, this); } + }; + + const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2); + + this._queueCallback(complete, this.tip, isAnimated); + } + + hide() { + if (!this._popper) { + return; } - }; - _proto.hide = function hide(callback) { - var _this2 = this; + const tip = this.getTipElement(); - var tip = this.getTipElement(); - var hideEvent = $.Event(this.constructor.Event.HIDE); + const complete = () => { + if (this._isWithActiveTrigger()) { + return; + } - var complete = function complete() { - if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) { - tip.parentNode.removeChild(tip); + if (this._hoverState !== HOVER_STATE_SHOW) { + tip.remove(); } - _this2._cleanTipClass(); + this._cleanTipClass(); - _this2.element.removeAttribute('aria-describedby'); + this._element.removeAttribute('aria-describedby'); - $(_this2.element).trigger(_this2.constructor.Event.HIDDEN); + EventHandler.trigger(this._element, this.constructor.Event.HIDDEN); - if (_this2._popper !== null) { - _this2._popper.destroy(); - } + if (this._popper) { + this._popper.destroy(); - if (callback) { - callback(); + this._popper = null; } }; - $(this.element).trigger(hideEvent); + const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE); - if (hideEvent.isDefaultPrevented()) { + if (hideEvent.defaultPrevented) { return; } - $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra + tip.classList.remove(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we remove the extra // empty mouseover listeners we added for iOS support if ('ontouchstart' in document.documentElement) { - $(document.body).children().off('mouseover', null, $.noop); + [].concat(...document.body.children).forEach(element => EventHandler.off(element, 'mouseover', noop)); } - this._activeTrigger[Trigger.CLICK] = false; - this._activeTrigger[Trigger.FOCUS] = false; - this._activeTrigger[Trigger.HOVER] = false; + this._activeTrigger[TRIGGER_CLICK] = false; + this._activeTrigger[TRIGGER_FOCUS] = false; + this._activeTrigger[TRIGGER_HOVER] = false; + const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2); - if ($(this.tip).hasClass(ClassName$6.FADE)) { - var transitionDuration = Util.getTransitionDurationFromElement(tip); - $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); - } else { - complete(); - } + this._queueCallback(complete, this.tip, isAnimated); this._hoverState = ''; - }; + } - _proto.update = function update() { + update() { if (this._popper !== null) { - this._popper.scheduleUpdate(); + this._popper.update(); } } // Protected - ; - _proto.isWithContent = function isWithContent() { + + isWithContent() { return Boolean(this.getTitle()); - }; + } - _proto.addAttachmentClass = function addAttachmentClass(attachment) { - $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); - }; + getTipElement() { + if (this.tip) { + return this.tip; + } - _proto.getTipElement = function getTipElement() { - this.tip = this.tip || $(this.config.template)[0]; + const element = document.createElement('div'); + element.innerHTML = this._config.template; + const tip = element.children[0]; + this.setContent(tip); + tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2); + this.tip = tip; return this.tip; - }; + } - _proto.setContent = function setContent() { - var tip = this.getTipElement(); - this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle()); - $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW); - }; + setContent(tip) { + this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER); + } + + _sanitizeAndSetContent(template, content, selector) { + const templateElement = SelectorEngine.findOne(selector, template); + + if (!content && templateElement) { + templateElement.remove(); + return; + } // we use append for html objects to maintain js events - _proto.setElementContent = function setElementContent($element, content) { - if (typeof content === 'object' && (content.nodeType || content.jquery)) { - // Content is a DOM node or a jQuery - if (this.config.html) { - if (!$(content).parent().is($element)) { - $element.empty().append(content); + + this.setElementContent(templateElement, content); + } + + setElementContent(element, content) { + if (element === null) { + return; + } + + if (isElement$1(content)) { + content = getElement(content); // content is a DOM node or a jQuery + + if (this._config.html) { + if (content.parentNode !== element) { + element.innerHTML = ''; + element.append(content); } } else { - $element.text($(content).text()); + element.textContent = content.textContent; } return; } - if (this.config.html) { - if (this.config.sanitize) { - content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); + if (this._config.html) { + if (this._config.sanitize) { + content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn); } - $element.html(content); + element.innerHTML = content; } else { - $element.text(content); + element.textContent = content; } - }; + } + + getTitle() { + const title = this._element.getAttribute('data-bs-original-title') || this._config.title; + + return this._resolvePossibleFunction(title); + } - _proto.getTitle = function getTitle() { - var title = this.element.getAttribute('data-original-title'); + updateAttachment(attachment) { + if (attachment === 'right') { + return 'end'; + } - if (!title) { - title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; + if (attachment === 'left') { + return 'start'; } - return title; + return attachment; } // Private - ; - _proto._getOffset = function _getOffset() { - var _this3 = this; - var offset = {}; + _initializeOnDelegatedTarget(event, context) { + return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig()); + } - if (typeof this.config.offset === 'function') { - offset.fn = function (data) { - data.offsets = _objectSpread({}, data.offsets, _this3.config.offset(data.offsets, _this3.element) || {}); - return data; - }; - } else { - offset.offset = this.config.offset; + _getOffset() { + const { + offset + } = this._config; + + if (typeof offset === 'string') { + return offset.split(',').map(val => Number.parseInt(val, 10)); + } + + if (typeof offset === 'function') { + return popperData => offset(popperData, this._element); } return offset; - }; + } - _proto._getContainer = function _getContainer() { - if (this.config.container === false) { - return document.body; - } + _resolvePossibleFunction(content) { + return typeof content === 'function' ? content.call(this._element) : content; + } - if (Util.isElement(this.config.container)) { - return $(this.config.container); - } + _getPopperConfig(attachment) { + const defaultBsPopperConfig = { + placement: attachment, + modifiers: [{ + name: 'flip', + options: { + fallbackPlacements: this._config.fallbackPlacements + } + }, { + name: 'offset', + options: { + offset: this._getOffset() + } + }, { + name: 'preventOverflow', + options: { + boundary: this._config.boundary + } + }, { + name: 'arrow', + options: { + element: `.${this.constructor.NAME}-arrow` + } + }, { + name: 'onChange', + enabled: true, + phase: 'afterWrite', + fn: data => this._handlePopperPlacementChange(data) + }], + onFirstUpdate: data => { + if (data.options.placement !== data.placement) { + this._handlePopperPlacementChange(data); + } + } + }; + return { ...defaultBsPopperConfig, + ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) + }; + } - return $(document).find(this.config.container); - }; + _addAttachmentClass(attachment) { + this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`); + } - _proto._getAttachment = function _getAttachment(placement) { - return AttachmentMap$1[placement.toUpperCase()]; - }; + _getAttachment(placement) { + return AttachmentMap[placement.toUpperCase()]; + } - _proto._setListeners = function _setListeners() { - var _this4 = this; + _setListeners() { + const triggers = this._config.trigger.split(' '); - var triggers = this.config.trigger.split(' '); - triggers.forEach(function (trigger) { + triggers.forEach(trigger => { if (trigger === 'click') { - $(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function (event) { - return _this4.toggle(event); - }); - } else if (trigger !== Trigger.MANUAL) { - var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN; - var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT; - $(_this4.element).on(eventIn, _this4.config.selector, function (event) { - return _this4._enter(event); - }).on(eventOut, _this4.config.selector, function (event) { - return _this4._leave(event); - }); + EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event)); + } else if (trigger !== TRIGGER_MANUAL) { + const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN; + const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT; + EventHandler.on(this._element, eventIn, this._config.selector, event => this._enter(event)); + EventHandler.on(this._element, eventOut, this._config.selector, event => this._leave(event)); } }); - $(this.element).closest('.modal').on('hide.bs.modal', function () { - if (_this4.element) { - _this4.hide(); + + this._hideModalHandler = () => { + if (this._element) { + this.hide(); } - }); + }; - if (this.config.selector) { - this.config = _objectSpread({}, this.config, { + EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); + + if (this._config.selector) { + this._config = { ...this._config, trigger: 'manual', selector: '' - }); + }; } else { this._fixTitle(); } - }; + } - _proto._fixTitle = function _fixTitle() { - var titleType = typeof this.element.getAttribute('data-original-title'); + _fixTitle() { + const title = this._element.getAttribute('title'); - if (this.element.getAttribute('title') || titleType !== 'string') { - this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); - this.element.setAttribute('title', ''); - } - }; + const originalTitleType = typeof this._element.getAttribute('data-bs-original-title'); + + if (title || originalTitleType !== 'string') { + this._element.setAttribute('data-bs-original-title', title || ''); - _proto._enter = function _enter(event, context) { - var dataKey = this.constructor.DATA_KEY; - context = context || $(event.currentTarget).data(dataKey); + if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) { + this._element.setAttribute('aria-label', title); + } - if (!context) { - context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(dataKey, context); + this._element.setAttribute('title', ''); } + } + + _enter(event, context) { + context = this._initializeOnDelegatedTarget(event, context); if (event) { - context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; + context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; } - if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) { - context._hoverState = HoverState.SHOW; + if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$2) || context._hoverState === HOVER_STATE_SHOW) { + context._hoverState = HOVER_STATE_SHOW; return; } clearTimeout(context._timeout); - context._hoverState = HoverState.SHOW; + context._hoverState = HOVER_STATE_SHOW; - if (!context.config.delay || !context.config.delay.show) { + if (!context._config.delay || !context._config.delay.show) { context.show(); return; } - context._timeout = setTimeout(function () { - if (context._hoverState === HoverState.SHOW) { + context._timeout = setTimeout(() => { + if (context._hoverState === HOVER_STATE_SHOW) { context.show(); } - }, context.config.delay.show); - }; - - _proto._leave = function _leave(event, context) { - var dataKey = this.constructor.DATA_KEY; - context = context || $(event.currentTarget).data(dataKey); + }, context._config.delay.show); + } - if (!context) { - context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(dataKey, context); - } + _leave(event, context) { + context = this._initializeOnDelegatedTarget(event, context); if (event) { - context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false; + context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget); } if (context._isWithActiveTrigger()) { @@ -5842,38 +5848,42 @@ } clearTimeout(context._timeout); - context._hoverState = HoverState.OUT; + context._hoverState = HOVER_STATE_OUT; - if (!context.config.delay || !context.config.delay.hide) { + if (!context._config.delay || !context._config.delay.hide) { context.hide(); return; } - context._timeout = setTimeout(function () { - if (context._hoverState === HoverState.OUT) { + context._timeout = setTimeout(() => { + if (context._hoverState === HOVER_STATE_OUT) { context.hide(); } - }, context.config.delay.hide); - }; + }, context._config.delay.hide); + } - _proto._isWithActiveTrigger = function _isWithActiveTrigger() { - for (var trigger in this._activeTrigger) { + _isWithActiveTrigger() { + for (const trigger in this._activeTrigger) { if (this._activeTrigger[trigger]) { return true; } } return false; - }; + } - _proto._getConfig = function _getConfig(config) { - var dataAttributes = $(this.element).data(); - Object.keys(dataAttributes).forEach(function (dataAttr) { - if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { + _getConfig(config) { + const dataAttributes = Manipulator.getDataAttributes(this._element); + Object.keys(dataAttributes).forEach(dataAttr => { + if (DISALLOWED_ATTRIBUTES.has(dataAttr)) { delete dataAttributes[dataAttr]; } }); - config = _objectSpread({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {}); + config = { ...this.constructor.Default, + ...dataAttributes, + ...(typeof config === 'object' && config ? config : {}) + }; + config.container = config.container === false ? document.body : getElement(config.container); if (typeof config.delay === 'number') { config.delay = { @@ -5890,505 +5900,337 @@ config.content = config.content.toString(); } - Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType); + typeCheckConfig(NAME$4, config, this.constructor.DefaultType); if (config.sanitize) { - config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); + config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn); } return config; - }; + } - _proto._getDelegateConfig = function _getDelegateConfig() { - var config = {}; + _getDelegateConfig() { + const config = {}; - if (this.config) { - for (var key in this.config) { - if (this.constructor.Default[key] !== this.config[key]) { - config[key] = this.config[key]; - } + for (const key in this._config) { + if (this.constructor.Default[key] !== this._config[key]) { + config[key] = this._config[key]; } - } + } // In the future can be replaced with: + // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]]) + // `Object.fromEntries(keysWithDifferentValues)` + return config; - }; + } - _proto._cleanTipClass = function _cleanTipClass() { - var $tip = $(this.getTipElement()); - var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); + _cleanTipClass() { + const tip = this.getTipElement(); + const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g'); + const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex); - if (tabClass !== null && tabClass.length) { - $tip.removeClass(tabClass.join('')); + if (tabClass !== null && tabClass.length > 0) { + tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass)); } - }; - - _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { - var popperInstance = popperData.instance; - this.tip = popperInstance.popper; - - this._cleanTipClass(); + } - this.addAttachmentClass(this._getAttachment(popperData.placement)); - }; + _getBasicClassPrefix() { + return CLASS_PREFIX$1; + } - _proto._fixTransition = function _fixTransition() { - var tip = this.getTipElement(); - var initConfigAnimation = this.config.animation; + _handlePopperPlacementChange(popperData) { + const { + state + } = popperData; - if (tip.getAttribute('x-placement') !== null) { + if (!state) { return; } - $(tip).removeClass(ClassName$6.FADE); - this.config.animation = false; - this.hide(); - this.show(); - this.config.animation = initConfigAnimation; - } // Static - ; + this.tip = state.elements.popper; - Tooltip._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY$6); + this._cleanTipClass(); - var _config = typeof config === 'object' && config; + this._addAttachmentClass(this._getAttachment(state.placement)); + } // Static - if (!data && /dispose|hide/.test(config)) { - return; - } - if (!data) { - data = new Tooltip(this, _config); - $(this).data(DATA_KEY$6, data); - } + static jQueryInterface(config) { + return this.each(function () { + const data = Tooltip.getOrCreateInstance(this, config); if (typeof config === 'string') { if (typeof data[config] === 'undefined') { - throw new TypeError("No method named \"" + config + "\""); + throw new TypeError(`No method named "${config}"`); } data[config](); } }); - }; + } - _createClass(Tooltip, null, [{ - key: "VERSION", - get: function get() { - return VERSION$6; - } - }, { - key: "Default", - get: function get() { - return Default$4; - } - }, { - key: "NAME", - get: function get() { - return NAME$6; - } - }, { - key: "DATA_KEY", - get: function get() { - return DATA_KEY$6; - } - }, { - key: "Event", - get: function get() { - return Event$6; - } - }, { - key: "EVENT_KEY", - get: function get() { - return EVENT_KEY$6; - } - }, { - key: "DefaultType", - get: function get() { - return DefaultType$4; - } - }]); - - return Tooltip; - }(); + } /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ + * add .Tooltip to jQuery only if jQuery is present */ - $.fn[NAME$6] = Tooltip._jQueryInterface; - $.fn[NAME$6].Constructor = Tooltip; - - $.fn[NAME$6].noConflict = function () { - $.fn[NAME$6] = JQUERY_NO_CONFLICT$6; - return Tooltip._jQueryInterface; - }; + defineJQueryPlugin(Tooltip); + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): popover.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ - */ - - var NAME$7 = 'popover'; - var VERSION$7 = '4.3.1'; - var DATA_KEY$7 = 'bs.popover'; - var EVENT_KEY$7 = "." + DATA_KEY$7; - var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7]; - var CLASS_PREFIX$1 = 'bs-popover'; - var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); - - var Default$5 = _objectSpread({}, Tooltip.Default, { - placement: 'right', - trigger: 'click', - content: '', - template: '' - }); - - var DefaultType$5 = _objectSpread({}, Tooltip.DefaultType, { - content: '(string|element|function)' - }); + */ - var ClassName$7 = { - FADE: 'fade', - SHOW: 'show' + const NAME$3 = 'popover'; + const DATA_KEY$3 = 'bs.popover'; + const EVENT_KEY$3 = `.${DATA_KEY$3}`; + const CLASS_PREFIX = 'bs-popover'; + const Default$2 = { ...Tooltip.Default, + placement: 'right', + offset: [0, 8], + trigger: 'click', + content: '', + template: '' }; - var Selector$7 = { - TITLE: '.popover-header', - CONTENT: '.popover-body' + const DefaultType$2 = { ...Tooltip.DefaultType, + content: '(string|element|function)' }; - var Event$7 = { - HIDE: "hide" + EVENT_KEY$7, - HIDDEN: "hidden" + EVENT_KEY$7, - SHOW: "show" + EVENT_KEY$7, - SHOWN: "shown" + EVENT_KEY$7, - INSERTED: "inserted" + EVENT_KEY$7, - CLICK: "click" + EVENT_KEY$7, - FOCUSIN: "focusin" + EVENT_KEY$7, - FOCUSOUT: "focusout" + EVENT_KEY$7, - MOUSEENTER: "mouseenter" + EVENT_KEY$7, - MOUSELEAVE: "mouseleave" + EVENT_KEY$7 - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - + const Event$1 = { + HIDE: `hide${EVENT_KEY$3}`, + HIDDEN: `hidden${EVENT_KEY$3}`, + SHOW: `show${EVENT_KEY$3}`, + SHOWN: `shown${EVENT_KEY$3}`, + INSERTED: `inserted${EVENT_KEY$3}`, + CLICK: `click${EVENT_KEY$3}`, + FOCUSIN: `focusin${EVENT_KEY$3}`, + FOCUSOUT: `focusout${EVENT_KEY$3}`, + MOUSEENTER: `mouseenter${EVENT_KEY$3}`, + MOUSELEAVE: `mouseleave${EVENT_KEY$3}` }; + const SELECTOR_TITLE = '.popover-header'; + const SELECTOR_CONTENT = '.popover-body'; + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ - var Popover = - /*#__PURE__*/ - function (_Tooltip) { - _inheritsLoose(Popover, _Tooltip); - - function Popover() { - return _Tooltip.apply(this, arguments) || this; + class Popover extends Tooltip { + // Getters + static get Default() { + return Default$2; } - var _proto = Popover.prototype; - - // Overrides - _proto.isWithContent = function isWithContent() { - return this.getTitle() || this._getContent(); - }; - - _proto.addAttachmentClass = function addAttachmentClass(attachment) { - $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment); - }; + static get NAME() { + return NAME$3; + } - _proto.getTipElement = function getTipElement() { - this.tip = this.tip || $(this.config.template)[0]; - return this.tip; - }; + static get Event() { + return Event$1; + } - _proto.setContent = function setContent() { - var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events + static get DefaultType() { + return DefaultType$2; + } // Overrides - this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle()); - var content = this._getContent(); + isWithContent() { + return this.getTitle() || this._getContent(); + } - if (typeof content === 'function') { - content = content.call(this.element); - } + setContent(tip) { + this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE); - this.setElementContent($tip.find(Selector$7.CONTENT), content); - $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW); + this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT); } // Private - ; - _proto._getContent = function _getContent() { - return this.element.getAttribute('data-content') || this.config.content; - }; - _proto._cleanTipClass = function _cleanTipClass() { - var $tip = $(this.getTipElement()); - var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1); + _getContent() { + return this._resolvePossibleFunction(this._config.content); + } - if (tabClass !== null && tabClass.length > 0) { - $tip.removeClass(tabClass.join('')); - } + _getBasicClassPrefix() { + return CLASS_PREFIX; } // Static - ; - - Popover._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY$7); - - var _config = typeof config === 'object' ? config : null; - if (!data && /dispose|hide/.test(config)) { - return; - } - if (!data) { - data = new Popover(this, _config); - $(this).data(DATA_KEY$7, data); - } + static jQueryInterface(config) { + return this.each(function () { + const data = Popover.getOrCreateInstance(this, config); if (typeof config === 'string') { if (typeof data[config] === 'undefined') { - throw new TypeError("No method named \"" + config + "\""); + throw new TypeError(`No method named "${config}"`); } data[config](); } }); - }; + } - _createClass(Popover, null, [{ - key: "VERSION", - // Getters - get: function get() { - return VERSION$7; - } - }, { - key: "Default", - get: function get() { - return Default$5; - } - }, { - key: "NAME", - get: function get() { - return NAME$7; - } - }, { - key: "DATA_KEY", - get: function get() { - return DATA_KEY$7; - } - }, { - key: "Event", - get: function get() { - return Event$7; - } - }, { - key: "EVENT_KEY", - get: function get() { - return EVENT_KEY$7; - } - }, { - key: "DefaultType", - get: function get() { - return DefaultType$5; - } - }]); - - return Popover; - }(Tooltip); + } /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ + * add .Popover to jQuery only if jQuery is present */ - $.fn[NAME$7] = Popover._jQueryInterface; - $.fn[NAME$7].Constructor = Popover; - - $.fn[NAME$7].noConflict = function () { - $.fn[NAME$7] = JQUERY_NO_CONFLICT$7; - return Popover._jQueryInterface; - }; + defineJQueryPlugin(Popover); + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.0): scrollspy.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ - var NAME$8 = 'scrollspy'; - var VERSION$8 = '4.3.1'; - var DATA_KEY$8 = 'bs.scrollspy'; - var EVENT_KEY$8 = "." + DATA_KEY$8; - var DATA_API_KEY$6 = '.data-api'; - var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8]; - var Default$6 = { + const NAME$2 = 'scrollspy'; + const DATA_KEY$2 = 'bs.scrollspy'; + const EVENT_KEY$2 = `.${DATA_KEY$2}`; + const DATA_API_KEY$1 = '.data-api'; + const Default$1 = { offset: 10, method: 'auto', target: '' }; - var DefaultType$6 = { + const DefaultType$1 = { offset: 'number', method: 'string', target: '(string|element)' }; - var Event$8 = { - ACTIVATE: "activate" + EVENT_KEY$8, - SCROLL: "scroll" + EVENT_KEY$8, - LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6 - }; - var ClassName$8 = { - DROPDOWN_ITEM: 'dropdown-item', - DROPDOWN_MENU: 'dropdown-menu', - ACTIVE: 'active' - }; - var Selector$8 = { - DATA_SPY: '[data-spy="scroll"]', - ACTIVE: '.active', - NAV_LIST_GROUP: '.nav, .list-group', - NAV_LINKS: '.nav-link', - NAV_ITEMS: '.nav-item', - LIST_ITEMS: '.list-group-item', - DROPDOWN: '.dropdown', - DROPDOWN_ITEMS: '.dropdown-item', - DROPDOWN_TOGGLE: '.dropdown-toggle' - }; - var OffsetMethod = { - OFFSET: 'offset', - POSITION: 'position' - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - }; - - var ScrollSpy = - /*#__PURE__*/ - function () { - function ScrollSpy(element, config) { - var _this = this; + const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`; + const EVENT_SCROLL = `scroll${EVENT_KEY$2}`; + const EVENT_LOAD_DATA_API = `load${EVENT_KEY$2}${DATA_API_KEY$1}`; + const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; + const CLASS_NAME_ACTIVE$1 = 'active'; + const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]'; + const SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group'; + const SELECTOR_NAV_LINKS = '.nav-link'; + const SELECTOR_NAV_ITEMS = '.nav-item'; + const SELECTOR_LIST_ITEMS = '.list-group-item'; + const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`; + const SELECTOR_DROPDOWN$1 = '.dropdown'; + const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; + const METHOD_OFFSET = 'offset'; + const METHOD_POSITION = 'position'; + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ - this._element = element; - this._scrollElement = element.tagName === 'BODY' ? window : element; + class ScrollSpy extends BaseComponent { + constructor(element, config) { + super(element); + this._scrollElement = this._element.tagName === 'BODY' ? window : this._element; this._config = this._getConfig(config); - this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS); this._offsets = []; this._targets = []; this._activeTarget = null; this._scrollHeight = 0; - $(this._scrollElement).on(Event$8.SCROLL, function (event) { - return _this._process(event); - }); + EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process()); this.refresh(); this._process(); } // Getters - var _proto = ScrollSpy.prototype; + static get Default() { + return Default$1; + } + + static get NAME() { + return NAME$2; + } // Public - // Public - _proto.refresh = function refresh() { - var _this2 = this; - var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION; - var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; - var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; + refresh() { + const autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION; + const offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; + const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0; this._offsets = []; this._targets = []; this._scrollHeight = this._getScrollHeight(); - var targets = [].slice.call(document.querySelectorAll(this._selector)); - targets.map(function (element) { - var target; - var targetSelector = Util.getSelectorFromElement(element); - - if (targetSelector) { - target = document.querySelector(targetSelector); - } + const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target); + targets.map(element => { + const targetSelector = getSelectorFromElement(element); + const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null; if (target) { - var targetBCR = target.getBoundingClientRect(); + const targetBCR = target.getBoundingClientRect(); if (targetBCR.width || targetBCR.height) { - // TODO (fat): remove sketch reliance on jQuery position/offset - return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; + return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector]; } } return null; - }).filter(function (item) { - return item; - }).sort(function (a, b) { - return a[0] - b[0]; - }).forEach(function (item) { - _this2._offsets.push(item[0]); - - _this2._targets.push(item[1]); + }).filter(item => item).sort((a, b) => a[0] - b[0]).forEach(item => { + this._offsets.push(item[0]); + + this._targets.push(item[1]); }); - }; + } - _proto.dispose = function dispose() { - $.removeData(this._element, DATA_KEY$8); - $(this._scrollElement).off(EVENT_KEY$8); - this._element = null; - this._scrollElement = null; - this._config = null; - this._selector = null; - this._offsets = null; - this._targets = null; - this._activeTarget = null; - this._scrollHeight = null; + dispose() { + EventHandler.off(this._scrollElement, EVENT_KEY$2); + super.dispose(); } // Private - ; - _proto._getConfig = function _getConfig(config) { - config = _objectSpread({}, Default$6, typeof config === 'object' && config ? config : {}); - if (typeof config.target !== 'string') { - var id = $(config.target).attr('id'); - - if (!id) { - id = Util.getUID(NAME$8); - $(config.target).attr('id', id); - } - - config.target = "#" + id; - } - - Util.typeCheckConfig(NAME$8, config, DefaultType$6); + _getConfig(config) { + config = { ...Default$1, + ...Manipulator.getDataAttributes(this._element), + ...(typeof config === 'object' && config ? config : {}) + }; + config.target = getElement(config.target) || document.documentElement; + typeCheckConfig(NAME$2, config, DefaultType$1); return config; - }; + } - _proto._getScrollTop = function _getScrollTop() { + _getScrollTop() { return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; - }; + } - _proto._getScrollHeight = function _getScrollHeight() { + _getScrollHeight() { return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); - }; + } - _proto._getOffsetHeight = function _getOffsetHeight() { + _getOffsetHeight() { return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; - }; + } - _proto._process = function _process() { - var scrollTop = this._getScrollTop() + this._config.offset; + _process() { + const scrollTop = this._getScrollTop() + this._config.offset; - var scrollHeight = this._getScrollHeight(); + const scrollHeight = this._getScrollHeight(); - var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); + const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); if (this._scrollHeight !== scrollHeight) { this.refresh(); } if (scrollTop >= maxScroll) { - var target = this._targets[this._targets.length - 1]; + const target = this._targets[this._targets.length - 1]; if (this._activeTarget !== target) { this._activate(target); @@ -6405,90 +6247,65 @@ return; } - var offsetLength = this._offsets.length; - - for (var i = offsetLength; i--;) { - var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); + for (let i = this._offsets.length; i--;) { + const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); if (isActiveTarget) { this._activate(this._targets[i]); } } - }; + } - _proto._activate = function _activate(target) { + _activate(target) { this._activeTarget = target; this._clear(); - var queries = this._selector.split(',').map(function (selector) { - return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]"; - }); - - var $link = $([].slice.call(document.querySelectorAll(queries.join(',')))); + const queries = SELECTOR_LINK_ITEMS.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`); + const link = SelectorEngine.findOne(queries.join(','), this._config.target); + link.classList.add(CLASS_NAME_ACTIVE$1); - if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) { - $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE); - $link.addClass(ClassName$8.ACTIVE); + if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { + SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1); } else { - // Set triggered link as active - $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active - // With both
/// ProjectProperties + /// /// LinuxSshProxy /// true if running - private static async Task<(bool, WebServer)> SearchForRunningWebServerAsync( - ProjectProperties projectProperties, + private static async Task<(bool, WebServer)> SearchForRunningWebServerAsync(ProjectProperties projectProperties, + ProjectSettings projectSettings, LinuxSshProxy connection) { // Wait just a bit longer to give the application a // chance to perform any additional initialization. await Task.Delay(TimeSpan.FromMilliseconds(125)); + CommandResponse response; + var retryPolicy = Policy + .HandleResult(b => b.ExitCode != 0) + .WaitAndRetry(3, _ => TimeSpan.FromMilliseconds(200)); - // search for web server running as reverse proxy - var appWebServerListeningScript = - $@" + if (projectSettings.UseInternalProxy) + { + // search for web server running as reverse proxy + var appWebServerListeningScript = + $@" if lsof -i -P -n | grep --quiet 'TCP 127.0.0.1:{projectProperties.AspPort}' ; then exit 0 else @@ -282,21 +290,18 @@ exit 1 fi "; - var retryPolicy = Policy - .HandleResult(b => b.ExitCode != 0) - .WaitAndRetry(3, _ => TimeSpan.FromMilliseconds(200)); + response = retryPolicy.Execute(() => + connection.SudoCommand(CommandBundle.FromScript(appWebServerListeningScript))); - var response = retryPolicy.Execute(() => - connection.SudoCommand(CommandBundle.FromScript(appWebServerListeningScript))); - - if (response.ExitCode == 0) - { - return (true, WebServer.Other); + return response.ExitCode == 0 + ? (true, WebServer.Other) + : (false, WebServer.None); } - - // search for dotnet kestrel web server - var appKestrelListeningScript = - $@" + else + { + // search for dotnet kestrel web server + var appKestrelListeningScript = + $@" if lsof -i -P -n | grep --quiet 'dotnet\|TCP\|:{projectProperties.AspPort}' ; then exit 0 else @@ -304,12 +309,15 @@ exit 1 fi "; - response = retryPolicy.Execute(() => - response = connection.SudoCommand(CommandBundle.FromScript(appKestrelListeningScript))); + response = retryPolicy.Execute(() => + connection.SudoCommand(CommandBundle.FromScript(appKestrelListeningScript))); - return response.ExitCode == 0 - ? (true, WebServer.Kestrel) - : (false, WebServer.None); + return response.ExitCode == 0 + ? (true, WebServer.Kestrel) + : (false, WebServer.None); + } + + } /// @@ -318,8 +326,10 @@ exit 1 /// /// The connection information. /// The project properties. + /// /// The referencing the created launch file. - private async Task CreateLaunchSettingsAsync(ConnectionInfo connectionInfo, ProjectProperties projectProperties) + private async Task CreateLaunchSettingsAsync(ConnectionInfo connectionInfo, + ProjectProperties projectProperties, ProjectSettings projectSettings) { Covenant.Requires(connectionInfo != null, nameof(connectionInfo)); Covenant.Requires(projectProperties != null, nameof(projectProperties)); @@ -370,7 +380,14 @@ private async Task CreateLaunchSettingsAsync(ConnectionInfo connection // support HTTPS at this time. if (projectProperties?.IsAspNet == true) { - environmentVariables["ASPNETCORE_URLS"] = $"http://127.0.0.1:{projectProperties.AspPort}"; + if (projectSettings.UseInternalProxy) + { + environmentVariables["ASPNETCORE_URLS"] = $"http://127.0.0.1:{projectProperties.AspPort}"; + } + else + { + environmentVariables["ASPNETCORE_URLS"] = $"http://0.0.0.0:{projectProperties.AspPort}"; + } } // Construct the debug launch JSON file. diff --git a/RaspberryDebugger/Dialogs/SettingsDialog.Designer.cs b/RaspberryDebugger/Dialogs/SettingsDialog.Designer.cs index dd8bc87..bae4d17 100644 --- a/RaspberryDebugger/Dialogs/SettingsDialog.Designer.cs +++ b/RaspberryDebugger/Dialogs/SettingsDialog.Designer.cs @@ -36,30 +36,35 @@ private void InitializeComponent() this.instructionsTextBox = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.targetGroup = new System.Windows.Forms.TextBox(); + this.internalProxyLabel = new System.Windows.Forms.Label(); + this.internalProxyCheck = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); // // targetLabel // this.targetLabel.AutoSize = true; - this.targetLabel.Location = new System.Drawing.Point(12, 17); + this.targetLabel.Location = new System.Drawing.Point(16, 21); + this.targetLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.targetLabel.Name = "targetLabel"; - this.targetLabel.Size = new System.Drawing.Size(92, 13); + this.targetLabel.Size = new System.Drawing.Size(117, 16); this.targetLabel.TabIndex = 1; this.targetLabel.Text = "Target Raspberry:"; // // targetComboBox // this.targetComboBox.FormattingEnabled = true; - this.targetComboBox.Location = new System.Drawing.Point(106, 14); + this.targetComboBox.Location = new System.Drawing.Point(141, 17); + this.targetComboBox.Margin = new System.Windows.Forms.Padding(4); this.targetComboBox.Name = "targetComboBox"; - this.targetComboBox.Size = new System.Drawing.Size(239, 21); + this.targetComboBox.Size = new System.Drawing.Size(317, 24); this.targetComboBox.TabIndex = 2; // // okButton // - this.okButton.Location = new System.Drawing.Point(363, 13); + this.okButton.Location = new System.Drawing.Point(484, 16); + this.okButton.Margin = new System.Windows.Forms.Padding(4); this.okButton.Name = "okButton"; - this.okButton.Size = new System.Drawing.Size(75, 23); + this.okButton.Size = new System.Drawing.Size(100, 28); this.okButton.TabIndex = 6; this.okButton.Text = "OK"; this.okButton.UseVisualStyleBackColor = true; @@ -68,9 +73,10 @@ private void InitializeComponent() // cancelButton // this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.cancelButton.Location = new System.Drawing.Point(363, 44); + this.cancelButton.Location = new System.Drawing.Point(484, 54); + this.cancelButton.Margin = new System.Windows.Forms.Padding(4); this.cancelButton.Name = "cancelButton"; - this.cancelButton.Size = new System.Drawing.Size(75, 23); + this.cancelButton.Size = new System.Drawing.Size(100, 28); this.cancelButton.TabIndex = 7; this.cancelButton.Text = "Cancel"; this.cancelButton.UseVisualStyleBackColor = true; @@ -78,37 +84,61 @@ private void InitializeComponent() // // instructionsTextBox // - this.instructionsTextBox.Location = new System.Drawing.Point(15, 86); + this.instructionsTextBox.Location = new System.Drawing.Point(19, 149); + this.instructionsTextBox.Margin = new System.Windows.Forms.Padding(4); this.instructionsTextBox.Multiline = true; this.instructionsTextBox.Name = "instructionsTextBox"; this.instructionsTextBox.ReadOnly = true; - this.instructionsTextBox.Size = new System.Drawing.Size(330, 85); + this.instructionsTextBox.Size = new System.Drawing.Size(439, 104); this.instructionsTextBox.TabIndex = 5; this.instructionsTextBox.Text = resources.GetString("instructionsTextBox.Text"); // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(30, 49); + this.label1.Location = new System.Drawing.Point(43, 57); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(73, 13); + this.label1.Size = new System.Drawing.Size(90, 16); this.label1.TabIndex = 3; this.label1.Text = "Target Group:"; // // targetGroup // - this.targetGroup.Location = new System.Drawing.Point(106, 46); + this.targetGroup.Location = new System.Drawing.Point(141, 57); + this.targetGroup.Margin = new System.Windows.Forms.Padding(4); this.targetGroup.Name = "targetGroup"; - this.targetGroup.Size = new System.Drawing.Size(100, 20); + this.targetGroup.Size = new System.Drawing.Size(132, 22); this.targetGroup.TabIndex = 4; // + // internalProxyLabel + // + this.internalProxyLabel.AutoSize = true; + this.internalProxyLabel.Location = new System.Drawing.Point(15, 90); + this.internalProxyLabel.Name = "internalProxyLabel"; + this.internalProxyLabel.Size = new System.Drawing.Size(118, 16); + this.internalProxyLabel.TabIndex = 8; + this.internalProxyLabel.Text = "Use Internal Proxy:"; + // + // internalProxyCheck + // + this.internalProxyCheck.AutoSize = true; + this.internalProxyCheck.Location = new System.Drawing.Point(141, 89); + this.internalProxyCheck.Name = "internalProxyCheck"; + this.internalProxyCheck.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.internalProxyCheck.Size = new System.Drawing.Size(18, 17); + this.internalProxyCheck.TabIndex = 9; + this.internalProxyCheck.UseVisualStyleBackColor = true; + // // SettingsDialog // this.AcceptButton = this.okButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.cancelButton; - this.ClientSize = new System.Drawing.Size(450, 187); + this.ClientSize = new System.Drawing.Size(604, 289); + this.Controls.Add(this.internalProxyCheck); + this.Controls.Add(this.internalProxyLabel); this.Controls.Add(this.targetGroup); this.Controls.Add(this.label1); this.Controls.Add(this.instructionsTextBox); @@ -118,6 +148,7 @@ private void InitializeComponent() this.Controls.Add(this.targetLabel); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Margin = new System.Windows.Forms.Padding(4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "SettingsDialog"; @@ -137,5 +168,7 @@ private void InitializeComponent() private System.Windows.Forms.TextBox instructionsTextBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox targetGroup; + private System.Windows.Forms.Label internalProxyLabel; + private System.Windows.Forms.CheckBox internalProxyCheck; } } \ No newline at end of file diff --git a/RaspberryDebugger/Dialogs/SettingsDialog.cs b/RaspberryDebugger/Dialogs/SettingsDialog.cs index c57b22e..eb1afdc 100644 --- a/RaspberryDebugger/Dialogs/SettingsDialog.cs +++ b/RaspberryDebugger/Dialogs/SettingsDialog.cs @@ -14,13 +14,13 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +using RaspberryDebugger.Models.Project; using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; using System.Text.RegularExpressions; using System.Windows.Forms; -using RaspberryDebugger.Models.Project; namespace RaspberryDebugger.Dialogs { @@ -51,7 +51,7 @@ public SettingsDialog(ProjectSettings projectSettings) var connectionNameToIndex = new Dictionary(StringComparer.InvariantCultureIgnoreCase); var connections = PackageHelper.ReadConnections(disableLogging: true); - var index = 0; + var index = 0; targetComboBox.Items.Clear(); @@ -67,7 +67,7 @@ public SettingsDialog(ProjectSettings projectSettings) connectionNameToIndex.Add(connection.Name, index++); } - if (projectSettings != null && !projectSettings.EnableRemoteDebugging) + if (projectSettings is { EnableRemoteDebugging: false }) { targetComboBox.SelectedIndex = connectionNameToIndex[ProjectSettings.DisabledConnectionName]; } @@ -75,7 +75,7 @@ public SettingsDialog(ProjectSettings projectSettings) { // If the connection named in the settings exists select it, // otherwise select the default. - var selectedConnection = connections.FirstOrDefault(connection => projectSettings != null + var selectedConnection = connections.FirstOrDefault(connection => projectSettings != null && connection.Name.Equals(projectSettings.RemoteDebugTarget, StringComparison.InvariantCultureIgnoreCase)); if (projectSettings != null && (projectSettings.RemoteDebugTarget == null || selectedConnection == null)) @@ -91,7 +91,11 @@ public SettingsDialog(ProjectSettings projectSettings) } } - if (projectSettings != null) targetGroup.Text = projectSettings.TargetGroup; + if (projectSettings != null) + { + targetGroup.Text = projectSettings.TargetGroup; + internalProxyCheck.Checked = projectSettings.UseInternalProxy; + } } /// @@ -113,13 +117,13 @@ private void okButton_Click(object sender, EventArgs args) case ProjectSettings.DefaultConnectionName: projectSettings.EnableRemoteDebugging = true; - projectSettings.RemoteDebugTarget = null; // NULL means default + projectSettings.RemoteDebugTarget = null; // NULL means default break; default: projectSettings.EnableRemoteDebugging = true; - projectSettings.RemoteDebugTarget = selectedItem; + projectSettings.RemoteDebugTarget = selectedItem; break; } @@ -140,6 +144,7 @@ private void okButton_Click(object sender, EventArgs args) } projectSettings.TargetGroup = targetGroup.Text; + projectSettings.UseInternalProxy = internalProxyCheck.Checked; DialogResult = DialogResult.OK; } diff --git a/RaspberryDebugger/Models/Project/ProjectSettings.cs b/RaspberryDebugger/Models/Project/ProjectSettings.cs index 72e2bdf..60cd7d1 100644 --- a/RaspberryDebugger/Models/Project/ProjectSettings.cs +++ b/RaspberryDebugger/Models/Project/ProjectSettings.cs @@ -14,8 +14,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -using System.ComponentModel; using Newtonsoft.Json; +using System.ComponentModel; namespace RaspberryDebugger.Models.Project { @@ -32,7 +32,7 @@ internal class ProjectSettings /// /// Connection combo box item indicating that the default Raspberry connection should be used. /// - public const string DefaultConnectionName = "[DEFAULT]"; + public const string DefaultConnectionName = "[DEFAULT]"; /// /// Default constructor that returns settings with remote debugging disabled. @@ -40,7 +40,8 @@ internal class ProjectSettings public ProjectSettings() { EnableRemoteDebugging = false; - RemoteDebugTarget = null; + RemoteDebugTarget = null; + UseInternalProxy = true; } /// @@ -63,5 +64,9 @@ public ProjectSettings() [JsonProperty(PropertyName = "TargetGroup", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] [DefaultValue("gpio")] public string TargetGroup { get; set; } = "gpio"; + + [JsonProperty(PropertyName = "UseInternalProxy", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] + [DefaultValue(true)] + public bool UseInternalProxy { get; set; } } } diff --git a/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs b/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs index 56cfc67..13a3149 100644 --- a/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs +++ b/RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs @@ -1,4 +1,4 @@ -//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // FILE: ProjectProperties.cs // CONTRIBUTOR: Jeff Lill // COPYRIGHT: Copyright (c) 2021 by neonFORGE, LLC. All rights reserved. @@ -15,21 +15,18 @@ // See the License for the specific language governing permissions and // limitations under the License. // ReSharper disable UnusedAutoPropertyAccessor.Local -using System; -using System.IO; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.Text.RegularExpressions; - using EnvDTE; - using Microsoft.VisualStudio; using Microsoft.VisualStudio.Shell; - using Neon.Common; using Neon.Net; - using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; namespace RaspberryDebugger.Models.VisualStudio { @@ -92,7 +89,7 @@ public static ProjectProperties CopyFrom(Solution solution, EnvDTE.Project proje // Read the properties we care about from the project. var targetFrameworkMonikers = (string)project.Properties.Item("TargetFrameworkMoniker").Value; - var outputType = (int)project.Properties.Item("OutputType").Value; + var outputType = (int)project.Properties.Item("OutputType").Value; var monikers = targetFrameworkMonikers.Split(','); @@ -102,7 +99,7 @@ public static ProjectProperties CopyFrom(Solution solution, EnvDTE.Project proje var versionRegex = new Regex(@"(?[0-9\.]+)$"); var netVersion = SemanticVersion.Parse(versionRegex.Match(monikers[1]).Groups["version"].Value); - var targetSdk = (RaspberryDebugger.Connection.Sdk)null; + var targetSdk = (RaspberryDebugger.Connection.Sdk)null; var targetSdkVersion = (SemanticVersion)null; foreach (var sdkItem in PackageHelper.SdkCatalog.Items) @@ -110,15 +107,15 @@ public static ProjectProperties CopyFrom(Solution solution, EnvDTE.Project proje var sdkVersion = SemanticVersion.Parse(sdkItem.Name); if (sdkVersion.Major != netVersion.Major || - sdkVersion.Minor != netVersion.Minor) + sdkVersion.Minor != netVersion.Minor) continue; - if (targetSdkVersion != null && - sdkVersion <= targetSdkVersion) + if (targetSdkVersion != null && + sdkVersion <= targetSdkVersion) continue; targetSdkVersion = sdkVersion; - targetSdk = new RaspberryDebugger.Connection.Sdk(sdkItem.Name, sdkItem.Architecture); + targetSdk = new RaspberryDebugger.Connection.Sdk(sdkItem.Name, sdkItem.Architecture); } var sdkName = targetSdk?.Name; @@ -159,7 +156,7 @@ public static ProjectProperties CopyFrom(Solution solution, EnvDTE.Project proje { if (profile.Name == project.Name) { - var profileObject = (JObject)profile.Value; + var profileObject = (JObject)profile.Value; var environmentVariablesObject = (JObject)profileObject.Property("environmentVariables")?.Value; commandLineArgs = ParseArgs((string)profileObject.Property("commandLineArgs")?.Value); @@ -173,8 +170,8 @@ public static ProjectProperties CopyFrom(Solution solution, EnvDTE.Project proje } // Extract additional settings for ASPNET projects. - if (settings.Property("iisSettings") == null) continue; - + if (!profileObject.ContainsKey("applicationUrl")) continue; + isAspNet = true; // Note that we're going to fall back to port 5000 if there are any @@ -187,7 +184,8 @@ public static ProjectProperties CopyFrom(Solution solution, EnvDTE.Project proje { try { - var uri = new Uri((string)jProperty.Value); + var values = ((string)jProperty.Value).Split(';'); + var uri = new Uri(values.First(s => s.StartsWith("http:"))); aspPort = uri.Port; @@ -212,8 +210,10 @@ public static ProjectProperties CopyFrom(Solution solution, EnvDTE.Project proje { aspLaunchBrowser = (bool)jProperty.Value; } + + aspRelativeBrowserUri = SetLaunchUrl(profileObject); } - else if (profile.Name == "IIS Express") + else if (profile.Name == "IIS Express" && aspRelativeBrowserUri == "/") { // For ASPNET apps, this profile may include a "launchUrl" which // specifies the absolute or relative URI to display in a debug @@ -223,38 +223,45 @@ public static ProjectProperties CopyFrom(Solution solution, EnvDTE.Project proje // so we'll be able to launch the browser on the correct page. var profileObject = (JObject)profile.Value; - var jProperty = profileObject.Property("launchUrl"); + aspRelativeBrowserUri = SetLaunchUrl(profileObject); + } + } - if (jProperty == null || - jProperty.Value.Type != JTokenType.String) - continue; - - var launchUri = (string)jProperty.Value; + string SetLaunchUrl(JObject profileObject) + { + var jProperty = profileObject.Property("launchUrl"); - if (string.IsNullOrEmpty(launchUri)) continue; + if (jProperty == null || + jProperty.Value.Type != JTokenType.String) + return aspRelativeBrowserUri; - try - { - var uri = new Uri(launchUri, UriKind.RelativeOrAbsolute); + var launchUri = (string)jProperty.Value; - aspRelativeBrowserUri = uri.IsAbsoluteUri - ? uri.PathAndQuery - : launchUri; - } - catch - { - // We'll fall back to "/" for any URI parsing errors. - aspRelativeBrowserUri = "/"; - } + if (string.IsNullOrEmpty(launchUri)) return aspRelativeBrowserUri; + + try + { + var uri = new Uri(launchUri, UriKind.RelativeOrAbsolute); + + aspRelativeBrowserUri = uri.IsAbsoluteUri + ? uri.PathAndQuery + : launchUri; } + catch + { + // We'll fall back to "/" for any URI parsing errors. + aspRelativeBrowserUri = "/"; + } + + return aspRelativeBrowserUri; } } } // Get the target Raspberry from the debug settings. - var projects = PackageHelper.ReadRaspberryProjects(solution); - var projectSettings = projects[project.UniqueName]; - var debugEnabled = projectSettings.EnableRemoteDebugging; + var projects = PackageHelper.ReadRaspberryProjects(solution); + var projectSettings = projects[project.UniqueName]; + var debugEnabled = projectSettings.EnableRemoteDebugging; var debugConnectionName = projectSettings.RemoteDebugTarget; // Determine whether the referenced .NET Core SDK is currently supported. diff --git a/RaspberryDebugger/RaspberryDebugger.csproj b/RaspberryDebugger/RaspberryDebugger.csproj index 5c497fb..d945bb1 100644 --- a/RaspberryDebugger/RaspberryDebugger.csproj +++ b/RaspberryDebugger/RaspberryDebugger.csproj @@ -187,9 +187,6 @@ 7.2.3 - - 2020.0.2 - 2.11.35 From 1822443af734ba63ef480b1672516c531d86f93e Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Thu, 14 Jul 2022 00:18:12 +0200 Subject: [PATCH 262/278] Add tooltip and some more Asp.NET information --- .../Dialogs/SettingsDialog.Designer.cs | 69 +++++++++++-------- RaspberryDebugger/Dialogs/SettingsDialog.resx | 3 + 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/RaspberryDebugger/Dialogs/SettingsDialog.Designer.cs b/RaspberryDebugger/Dialogs/SettingsDialog.Designer.cs index bae4d17..6247ad1 100644 --- a/RaspberryDebugger/Dialogs/SettingsDialog.Designer.cs +++ b/RaspberryDebugger/Dialogs/SettingsDialog.Designer.cs @@ -28,6 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsDialog)); this.targetLabel = new System.Windows.Forms.Label(); this.targetComboBox = new System.Windows.Forms.ComboBox(); @@ -38,33 +39,32 @@ private void InitializeComponent() this.targetGroup = new System.Windows.Forms.TextBox(); this.internalProxyLabel = new System.Windows.Forms.Label(); this.internalProxyCheck = new System.Windows.Forms.CheckBox(); + this.toolTip = new System.Windows.Forms.ToolTip(this.components); + this.groupBox = new System.Windows.Forms.GroupBox(); this.SuspendLayout(); // // targetLabel // this.targetLabel.AutoSize = true; - this.targetLabel.Location = new System.Drawing.Point(16, 21); - this.targetLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.targetLabel.Location = new System.Drawing.Point(13, 17); this.targetLabel.Name = "targetLabel"; - this.targetLabel.Size = new System.Drawing.Size(117, 16); + this.targetLabel.Size = new System.Drawing.Size(92, 13); this.targetLabel.TabIndex = 1; this.targetLabel.Text = "Target Raspberry:"; // // targetComboBox // this.targetComboBox.FormattingEnabled = true; - this.targetComboBox.Location = new System.Drawing.Point(141, 17); - this.targetComboBox.Margin = new System.Windows.Forms.Padding(4); + this.targetComboBox.Location = new System.Drawing.Point(110, 14); this.targetComboBox.Name = "targetComboBox"; - this.targetComboBox.Size = new System.Drawing.Size(317, 24); + this.targetComboBox.Size = new System.Drawing.Size(267, 21); this.targetComboBox.TabIndex = 2; // // okButton // - this.okButton.Location = new System.Drawing.Point(484, 16); - this.okButton.Margin = new System.Windows.Forms.Padding(4); + this.okButton.Location = new System.Drawing.Point(395, 13); this.okButton.Name = "okButton"; - this.okButton.Size = new System.Drawing.Size(100, 28); + this.okButton.Size = new System.Drawing.Size(75, 23); this.okButton.TabIndex = 6; this.okButton.Text = "OK"; this.okButton.UseVisualStyleBackColor = true; @@ -73,10 +73,9 @@ private void InitializeComponent() // cancelButton // this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.cancelButton.Location = new System.Drawing.Point(484, 54); - this.cancelButton.Margin = new System.Windows.Forms.Padding(4); + this.cancelButton.Location = new System.Drawing.Point(395, 44); this.cancelButton.Name = "cancelButton"; - this.cancelButton.Size = new System.Drawing.Size(100, 28); + this.cancelButton.Size = new System.Drawing.Size(75, 23); this.cancelButton.TabIndex = 7; this.cancelButton.Text = "Cancel"; this.cancelButton.UseVisualStyleBackColor = true; @@ -84,59 +83,69 @@ private void InitializeComponent() // // instructionsTextBox // - this.instructionsTextBox.Location = new System.Drawing.Point(19, 149); - this.instructionsTextBox.Margin = new System.Windows.Forms.Padding(4); + this.instructionsTextBox.Location = new System.Drawing.Point(16, 121); this.instructionsTextBox.Multiline = true; this.instructionsTextBox.Name = "instructionsTextBox"; this.instructionsTextBox.ReadOnly = true; - this.instructionsTextBox.Size = new System.Drawing.Size(439, 104); + this.instructionsTextBox.Size = new System.Drawing.Size(454, 102); this.instructionsTextBox.TabIndex = 5; this.instructionsTextBox.Text = resources.GetString("instructionsTextBox.Text"); // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(43, 57); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(32, 48); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(90, 16); + this.label1.Size = new System.Drawing.Size(73, 13); this.label1.TabIndex = 3; this.label1.Text = "Target Group:"; // // targetGroup // - this.targetGroup.Location = new System.Drawing.Point(141, 57); - this.targetGroup.Margin = new System.Windows.Forms.Padding(4); + this.targetGroup.Location = new System.Drawing.Point(110, 44); this.targetGroup.Name = "targetGroup"; - this.targetGroup.Size = new System.Drawing.Size(132, 22); + this.targetGroup.Size = new System.Drawing.Size(100, 20); this.targetGroup.TabIndex = 4; // // internalProxyLabel // this.internalProxyLabel.AutoSize = true; - this.internalProxyLabel.Location = new System.Drawing.Point(15, 90); + this.internalProxyLabel.Location = new System.Drawing.Point(46, 91); + this.internalProxyLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.internalProxyLabel.Name = "internalProxyLabel"; - this.internalProxyLabel.Size = new System.Drawing.Size(118, 16); + this.internalProxyLabel.Size = new System.Drawing.Size(58, 13); this.internalProxyLabel.TabIndex = 8; - this.internalProxyLabel.Text = "Use Internal Proxy:"; + this.internalProxyLabel.Text = "Use Proxy:"; + this.toolTip.SetToolTip(this.internalProxyLabel, "Use an own configured proxy for Asp.NET"); // // internalProxyCheck // this.internalProxyCheck.AutoSize = true; - this.internalProxyCheck.Location = new System.Drawing.Point(141, 89); + this.internalProxyCheck.Location = new System.Drawing.Point(110, 92); + this.internalProxyCheck.Margin = new System.Windows.Forms.Padding(2); this.internalProxyCheck.Name = "internalProxyCheck"; this.internalProxyCheck.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.internalProxyCheck.Size = new System.Drawing.Size(18, 17); + this.internalProxyCheck.Size = new System.Drawing.Size(15, 14); this.internalProxyCheck.TabIndex = 9; + this.toolTip.SetToolTip(this.internalProxyCheck, "Use an own configured proxy for Asp.NET"); this.internalProxyCheck.UseVisualStyleBackColor = true; // + // groupBox + // + this.groupBox.Location = new System.Drawing.Point(15, 71); + this.groupBox.Name = "groupBox"; + this.groupBox.Size = new System.Drawing.Size(455, 44); + this.groupBox.TabIndex = 10; + this.groupBox.TabStop = false; + this.groupBox.Text = "Asp.NET solution/project only setting"; + // // SettingsDialog // this.AcceptButton = this.okButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.cancelButton; - this.ClientSize = new System.Drawing.Size(604, 289); + this.ClientSize = new System.Drawing.Size(482, 235); this.Controls.Add(this.internalProxyCheck); this.Controls.Add(this.internalProxyLabel); this.Controls.Add(this.targetGroup); @@ -146,9 +155,9 @@ private void InitializeComponent() this.Controls.Add(this.okButton); this.Controls.Add(this.targetComboBox); this.Controls.Add(this.targetLabel); + this.Controls.Add(this.groupBox); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "SettingsDialog"; @@ -170,5 +179,7 @@ private void InitializeComponent() private System.Windows.Forms.TextBox targetGroup; private System.Windows.Forms.Label internalProxyLabel; private System.Windows.Forms.CheckBox internalProxyCheck; + private System.Windows.Forms.ToolTip toolTip; + private System.Windows.Forms.GroupBox groupBox; } } \ No newline at end of file diff --git a/RaspberryDebugger/Dialogs/SettingsDialog.resx b/RaspberryDebugger/Dialogs/SettingsDialog.resx index e76546c..15f86eb 100644 --- a/RaspberryDebugger/Dialogs/SettingsDialog.resx +++ b/RaspberryDebugger/Dialogs/SettingsDialog.resx @@ -120,6 +120,9 @@ Raspberry connections are managed via [Tools/Options] on the [Raspberry Debugger] page.\r\n\r\nTo disable Raspberry debugging, select [debugging disabled] above otherwise, select [default connection] or the specific connection you want to use. + + 17, 17 + From 8574d69406f25ce97a5e6675627a9c70c012a4c7 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Thu, 14 Jul 2022 00:19:28 +0200 Subject: [PATCH 263/278] Rearrange in listen methods for krestel and reverse proxy --- RaspberryDebugger.sln.DotSettings | 1 + .../Commands/DebugStartCommand.cs | 85 ++++++++++++------- 2 files changed, 56 insertions(+), 30 deletions(-) diff --git a/RaspberryDebugger.sln.DotSettings b/RaspberryDebugger.sln.DotSettings index afa1e38..905bafd 100644 --- a/RaspberryDebugger.sln.DotSettings +++ b/RaspberryDebugger.sln.DotSettings @@ -7,6 +7,7 @@ True True True + True True True True diff --git a/RaspberryDebugger/Commands/DebugStartCommand.cs b/RaspberryDebugger/Commands/DebugStartCommand.cs index 2f417c2..2f960ed 100644 --- a/RaspberryDebugger/Commands/DebugStartCommand.cs +++ b/RaspberryDebugger/Commands/DebugStartCommand.cs @@ -273,51 +273,76 @@ private static void OpenWebBrowser( // Wait just a bit longer to give the application a // chance to perform any additional initialization. await Task.Delay(TimeSpan.FromMilliseconds(125)); - CommandResponse response; - var retryPolicy = Policy - .HandleResult(b => b.ExitCode != 0) - .WaitAndRetry(3, _ => TimeSpan.FromMilliseconds(200)); - if (projectSettings.UseInternalProxy) - { - // search for web server running as reverse proxy - var appWebServerListeningScript = - $@" - if lsof -i -P -n | grep --quiet 'TCP 127.0.0.1:{projectProperties.AspPort}' ; then + return projectSettings.UseInternalProxy + ? ListenForReverseProxy(projectProperties.AspPort, connection) + : ListenForKrestel(projectProperties.AspPort, connection); + } + + /// + /// Listen for Krestel + /// + /// Given ASP Port number + /// SSH proxy connection + /// true if found and which one detected + private static (bool, WebServer) ListenForKrestel(int aspPort, LinuxSshProxy connection) + { + // search for dotnet kestrel web server + var appKestrelListeningScript = + $@" + if lsof -i -P -n | grep --quiet 'dotnet\|TCP\|:{aspPort}' ; then exit 0 else exit 1 fi "; - response = retryPolicy.Execute(() => - connection.SudoCommand(CommandBundle.FromScript(appWebServerListeningScript))); + var response = ExecSudoCmd(appKestrelListeningScript, connection); - return response.ExitCode == 0 - ? (true, WebServer.Other) - : (false, WebServer.None); - } - else - { - // search for dotnet kestrel web server - var appKestrelListeningScript = - $@" - if lsof -i -P -n | grep --quiet 'dotnet\|TCP\|:{projectProperties.AspPort}' ; then + return response.ExitCode == 0 + ? (true, WebServer.Kestrel) + : (false, WebServer.None); + } + + /// + /// Listen for reverse proxy: Apache, NGiNX, etc. + /// + /// Given ASP port number + /// SSH proxy connection + /// true if found and which one detected + private static (bool, WebServer) ListenForReverseProxy(int aspPort, LinuxSshProxy connection) + { + // search for web server running as reverse proxy + var appWebServerListeningScript = + $@" + if lsof -i -P -n | grep --quiet 'TCP 127.0.0.1:{aspPort}' ; then exit 0 else exit 1 fi "; - response = retryPolicy.Execute(() => - connection.SudoCommand(CommandBundle.FromScript(appKestrelListeningScript))); + var response = ExecSudoCmd(appWebServerListeningScript, connection); - return response.ExitCode == 0 - ? (true, WebServer.Kestrel) - : (false, WebServer.None); - } - - + return response.ExitCode == 0 + ? (true, WebServer.Other) + : (false, WebServer.None); + } + + /// + /// Execute command with sudo and retries + /// + /// Execute this command + /// Linux ssh + /// Command response + private static CommandResponse ExecSudoCmd(string cmd, LinuxSshProxy connection) + { + var retryPolicy = Policy + .HandleResult(ret => ret.ExitCode != 0) + .WaitAndRetry(3, _ => TimeSpan.FromMilliseconds(200)); + + return retryPolicy.Execute(() => + connection.SudoCommand(CommandBundle.FromScript(cmd))); } /// From 463539e8eb58716715ea440b68edf8d7bc1c1441 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Mon, 18 Jul 2022 23:53:56 +0200 Subject: [PATCH 264/278] Implement proxy web server class and integrate it --- .../Commands/DebugStartCommand.cs | 82 +--------------- RaspberryDebugger/Commands/ProxyWebServer.cs | 96 +++++++++++++++++++ .../Dialogs/SettingsDialog.Designer.cs | 56 +++++------ RaspberryDebugger/Dialogs/SettingsDialog.cs | 4 +- .../Models/Project/ProjectSettings.cs | 6 +- RaspberryDebugger/RaspberryDebugger.csproj | 1 + 6 files changed, 134 insertions(+), 111 deletions(-) create mode 100644 RaspberryDebugger/Commands/ProxyWebServer.cs diff --git a/RaspberryDebugger/Commands/DebugStartCommand.cs b/RaspberryDebugger/Commands/DebugStartCommand.cs index 2f960ed..476c388 100644 --- a/RaspberryDebugger/Commands/DebugStartCommand.cs +++ b/RaspberryDebugger/Commands/DebugStartCommand.cs @@ -30,7 +30,6 @@ using Neon.IO; using Neon.SSH; using Newtonsoft.Json.Linq; -using Polly; using RaspberryDebugger.Extensions; using RaspberryDebugger.Models.Connection; using RaspberryDebugger.Models.Project; @@ -39,13 +38,6 @@ namespace RaspberryDebugger.Commands { - internal enum WebServer - { - None, - Kestrel, - Other - } - /// /// Handles the Start Debugging command for Raspberry enabled projects. /// @@ -274,75 +266,9 @@ private static void OpenWebBrowser( // chance to perform any additional initialization. await Task.Delay(TimeSpan.FromMilliseconds(125)); - return projectSettings.UseInternalProxy - ? ListenForReverseProxy(projectProperties.AspPort, connection) - : ListenForKrestel(projectProperties.AspPort, connection); - } - - /// - /// Listen for Krestel - /// - /// Given ASP Port number - /// SSH proxy connection - /// true if found and which one detected - private static (bool, WebServer) ListenForKrestel(int aspPort, LinuxSshProxy connection) - { - // search for dotnet kestrel web server - var appKestrelListeningScript = - $@" - if lsof -i -P -n | grep --quiet 'dotnet\|TCP\|:{aspPort}' ; then - exit 0 - else - exit 1 - fi - "; - - var response = ExecSudoCmd(appKestrelListeningScript, connection); - - return response.ExitCode == 0 - ? (true, WebServer.Kestrel) - : (false, WebServer.None); - } - - /// - /// Listen for reverse proxy: Apache, NGiNX, etc. - /// - /// Given ASP port number - /// SSH proxy connection - /// true if found and which one detected - private static (bool, WebServer) ListenForReverseProxy(int aspPort, LinuxSshProxy connection) - { - // search for web server running as reverse proxy - var appWebServerListeningScript = - $@" - if lsof -i -P -n | grep --quiet 'TCP 127.0.0.1:{aspPort}' ; then - exit 0 - else - exit 1 - fi - "; - - var response = ExecSudoCmd(appWebServerListeningScript, connection); - - return response.ExitCode == 0 - ? (true, WebServer.Other) - : (false, WebServer.None); - } - - /// - /// Execute command with sudo and retries - /// - /// Execute this command - /// Linux ssh - /// Command response - private static CommandResponse ExecSudoCmd(string cmd, LinuxSshProxy connection) - { - var retryPolicy = Policy - .HandleResult(ret => ret.ExitCode != 0) - .WaitAndRetry(3, _ => TimeSpan.FromMilliseconds(200)); - - return retryPolicy.Execute(() => - connection.SudoCommand(CommandBundle.FromScript(cmd))); + return projectSettings.UseWebServerProxy + ? ProxyWebServer.ListenFor(projectProperties.AspPort, connection, WebServer.Other) + : ProxyWebServer.ListenFor(projectProperties.AspPort, connection, WebServer.Kestrel); } /// @@ -405,7 +331,7 @@ private async Task CreateLaunchSettingsAsync(ConnectionInfo connection // support HTTPS at this time. if (projectProperties?.IsAspNet == true) { - if (projectSettings.UseInternalProxy) + if (projectSettings.UseWebServerProxy) { environmentVariables["ASPNETCORE_URLS"] = $"http://127.0.0.1:{projectProperties.AspPort}"; } diff --git a/RaspberryDebugger/Commands/ProxyWebServer.cs b/RaspberryDebugger/Commands/ProxyWebServer.cs new file mode 100644 index 0000000..155c032 --- /dev/null +++ b/RaspberryDebugger/Commands/ProxyWebServer.cs @@ -0,0 +1,96 @@ +using Neon.SSH; +using Polly; +using System; + +namespace RaspberryDebugger.Commands +{ + internal enum WebServer + { + None, + Kestrel, + Other + } + + internal static class ProxyWebServer + { + /// + /// Listen for proxy server or krestel + /// + /// Given ASP port number + /// SSH proxy connection + /// Which web server to listen for + /// true if found and which web server detected + public static (bool, WebServer) ListenFor(int aspPort, LinuxSshProxy connection, WebServer webServer) + { + return webServer == WebServer.Kestrel + ? SearchKrestel(aspPort, connection) + : SearchReverseProxy(aspPort, connection); + } + + /// + /// Search for Krestel + /// + /// Given ASP Port number + /// SSH proxy connection + /// true if found and which one detected + private static (bool, WebServer) SearchKrestel(int aspPort, LinuxSshProxy connection) + { + // search for dotnet kestrel web server + var appKestrelListeningScript = + $@" + if lsof -i -P -n | grep --quiet 'dotnet\|TCP\|:{aspPort}' ; then + exit 0 + else + exit 1 + fi + "; + + var response = ExecSudoCmd(appKestrelListeningScript, connection); + + return response.ExitCode == 0 + ? (true, WebServer.Kestrel) + : (false, WebServer.None); + } + + /// + /// Search for reverse proxy: Apache, NGiNX, etc. + /// + /// Given ASP port number + /// SSH proxy connection + /// true if found and which one detected + private static (bool, WebServer) SearchReverseProxy(int aspPort, LinuxSshProxy connection) + { + // search for web server running as reverse proxy + var appWebServerListeningScript = + $@" + if lsof -i -P -n | grep --quiet 'TCP 127.0.0.1:{aspPort}' ; then + exit 0 + else + exit 1 + fi + "; + + var response = ExecSudoCmd(appWebServerListeningScript, connection); + + return response.ExitCode == 0 + ? (true, WebServer.Other) + : (false, WebServer.None); + } + + /// + /// Execute command with sudo and retries + /// + /// Execute this command + /// Linux ssh + /// Command response + private static CommandResponse ExecSudoCmd(string cmd, LinuxSshProxy connection) + { + var retryPolicy = Policy + .HandleResult(ret => ret.ExitCode != 0) + .WaitAndRetry(3, _ => TimeSpan.FromMilliseconds(200)); + + return retryPolicy.Execute(() => + connection.SudoCommand(CommandBundle.FromScript(cmd))); + } + } +} diff --git a/RaspberryDebugger/Dialogs/SettingsDialog.Designer.cs b/RaspberryDebugger/Dialogs/SettingsDialog.Designer.cs index 6247ad1..31a9315 100644 --- a/RaspberryDebugger/Dialogs/SettingsDialog.Designer.cs +++ b/RaspberryDebugger/Dialogs/SettingsDialog.Designer.cs @@ -37,8 +37,8 @@ private void InitializeComponent() this.instructionsTextBox = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.targetGroup = new System.Windows.Forms.TextBox(); - this.internalProxyLabel = new System.Windows.Forms.Label(); - this.internalProxyCheck = new System.Windows.Forms.CheckBox(); + this.webServerProxyLabel = new System.Windows.Forms.Label(); + this.webServerProxyCheck = new System.Windows.Forms.CheckBox(); this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.groupBox = new System.Windows.Forms.GroupBox(); this.SuspendLayout(); @@ -107,28 +107,28 @@ private void InitializeComponent() this.targetGroup.Size = new System.Drawing.Size(100, 20); this.targetGroup.TabIndex = 4; // - // internalProxyLabel - // - this.internalProxyLabel.AutoSize = true; - this.internalProxyLabel.Location = new System.Drawing.Point(46, 91); - this.internalProxyLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.internalProxyLabel.Name = "internalProxyLabel"; - this.internalProxyLabel.Size = new System.Drawing.Size(58, 13); - this.internalProxyLabel.TabIndex = 8; - this.internalProxyLabel.Text = "Use Proxy:"; - this.toolTip.SetToolTip(this.internalProxyLabel, "Use an own configured proxy for Asp.NET"); - // - // internalProxyCheck - // - this.internalProxyCheck.AutoSize = true; - this.internalProxyCheck.Location = new System.Drawing.Point(110, 92); - this.internalProxyCheck.Margin = new System.Windows.Forms.Padding(2); - this.internalProxyCheck.Name = "internalProxyCheck"; - this.internalProxyCheck.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.internalProxyCheck.Size = new System.Drawing.Size(15, 14); - this.internalProxyCheck.TabIndex = 9; - this.toolTip.SetToolTip(this.internalProxyCheck, "Use an own configured proxy for Asp.NET"); - this.internalProxyCheck.UseVisualStyleBackColor = true; + // webServerProxyLabel + // + this.webServerProxyLabel.AutoSize = true; + this.webServerProxyLabel.Location = new System.Drawing.Point(46, 91); + this.webServerProxyLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.webServerProxyLabel.Name = "webServerProxyLabel"; + this.webServerProxyLabel.Size = new System.Drawing.Size(58, 13); + this.webServerProxyLabel.TabIndex = 8; + this.webServerProxyLabel.Text = "Use Proxy:"; + this.toolTip.SetToolTip(this.webServerProxyLabel, "Use an own configured proxy for Asp.NET"); + // + // webServerProxyCheck + // + this.webServerProxyCheck.AutoSize = true; + this.webServerProxyCheck.Location = new System.Drawing.Point(110, 92); + this.webServerProxyCheck.Margin = new System.Windows.Forms.Padding(2); + this.webServerProxyCheck.Name = "webServerProxyCheck"; + this.webServerProxyCheck.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.webServerProxyCheck.Size = new System.Drawing.Size(15, 14); + this.webServerProxyCheck.TabIndex = 9; + this.toolTip.SetToolTip(this.webServerProxyCheck, "Use an own configured proxy for Asp.NET"); + this.webServerProxyCheck.UseVisualStyleBackColor = true; // // groupBox // @@ -146,8 +146,8 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.cancelButton; this.ClientSize = new System.Drawing.Size(482, 235); - this.Controls.Add(this.internalProxyCheck); - this.Controls.Add(this.internalProxyLabel); + this.Controls.Add(this.webServerProxyCheck); + this.Controls.Add(this.webServerProxyLabel); this.Controls.Add(this.targetGroup); this.Controls.Add(this.label1); this.Controls.Add(this.instructionsTextBox); @@ -177,8 +177,8 @@ private void InitializeComponent() private System.Windows.Forms.TextBox instructionsTextBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox targetGroup; - private System.Windows.Forms.Label internalProxyLabel; - private System.Windows.Forms.CheckBox internalProxyCheck; + private System.Windows.Forms.Label webServerProxyLabel; + private System.Windows.Forms.CheckBox webServerProxyCheck; private System.Windows.Forms.ToolTip toolTip; private System.Windows.Forms.GroupBox groupBox; } diff --git a/RaspberryDebugger/Dialogs/SettingsDialog.cs b/RaspberryDebugger/Dialogs/SettingsDialog.cs index eb1afdc..6b10bf4 100644 --- a/RaspberryDebugger/Dialogs/SettingsDialog.cs +++ b/RaspberryDebugger/Dialogs/SettingsDialog.cs @@ -94,7 +94,7 @@ public SettingsDialog(ProjectSettings projectSettings) if (projectSettings != null) { targetGroup.Text = projectSettings.TargetGroup; - internalProxyCheck.Checked = projectSettings.UseInternalProxy; + webServerProxyCheck.Checked = projectSettings.UseWebServerProxy; } } @@ -144,7 +144,7 @@ private void okButton_Click(object sender, EventArgs args) } projectSettings.TargetGroup = targetGroup.Text; - projectSettings.UseInternalProxy = internalProxyCheck.Checked; + projectSettings.UseWebServerProxy = webServerProxyCheck.Checked; DialogResult = DialogResult.OK; } diff --git a/RaspberryDebugger/Models/Project/ProjectSettings.cs b/RaspberryDebugger/Models/Project/ProjectSettings.cs index 60cd7d1..5754b56 100644 --- a/RaspberryDebugger/Models/Project/ProjectSettings.cs +++ b/RaspberryDebugger/Models/Project/ProjectSettings.cs @@ -41,7 +41,7 @@ public ProjectSettings() { EnableRemoteDebugging = false; RemoteDebugTarget = null; - UseInternalProxy = true; + UseWebServerProxy = true; } /// @@ -65,8 +65,8 @@ public ProjectSettings() [DefaultValue("gpio")] public string TargetGroup { get; set; } = "gpio"; - [JsonProperty(PropertyName = "UseInternalProxy", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] + [JsonProperty(PropertyName = "UseWebServerProxy", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] [DefaultValue(true)] - public bool UseInternalProxy { get; set; } + public bool UseWebServerProxy { get; set; } } } diff --git a/RaspberryDebugger/RaspberryDebugger.csproj b/RaspberryDebugger/RaspberryDebugger.csproj index d945bb1..8b0fd8e 100644 --- a/RaspberryDebugger/RaspberryDebugger.csproj +++ b/RaspberryDebugger/RaspberryDebugger.csproj @@ -58,6 +58,7 @@ latest + From c9d87e1722b3fbf150f96067ff565548409cec70 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Tue, 19 Jul 2022 23:28:02 +0200 Subject: [PATCH 265/278] Minor: reduce nesting --- RaspberryDebugger/Dialogs/SettingsDialog.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/RaspberryDebugger/Dialogs/SettingsDialog.cs b/RaspberryDebugger/Dialogs/SettingsDialog.cs index 6b10bf4..bbb90d6 100644 --- a/RaspberryDebugger/Dialogs/SettingsDialog.cs +++ b/RaspberryDebugger/Dialogs/SettingsDialog.cs @@ -91,11 +91,9 @@ public SettingsDialog(ProjectSettings projectSettings) } } - if (projectSettings != null) - { - targetGroup.Text = projectSettings.TargetGroup; - webServerProxyCheck.Checked = projectSettings.UseWebServerProxy; - } + if (projectSettings == null) return; + targetGroup.Text = projectSettings.TargetGroup; + webServerProxyCheck.Checked = projectSettings.UseWebServerProxy; } /// From 21b2e9552d3a73b84c30a3d185206a2f2435a229 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Wed, 20 Jul 2022 18:40:46 +0200 Subject: [PATCH 266/278] Update readme Https is supported hint in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4a956a7..28d7503 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ The **Project/Raspberry Debug Settings** menu persists the settings to the new ` * Only LTS .NET Core SDKs supported: 3.1 and 6 (5 is not supported anymore) * **Start Without Debugging** or **Attach to Process...** are not supported (yet) * Raspberry debugging uses the default project debugging profile -* HTTPS is not currently supported for ASPNET debugging +* HTTPS is currently supported for ASPNET debugging (for reverse proxy and for Kestrel) * Program assembly names can't include spaces ### Disclosures From deba2a49f190362f2ed4926b7ca2d022203a83a1 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Thu, 21 Jul 2022 19:29:12 +0200 Subject: [PATCH 267/278] Change version feed address - need some space to host for free... --- RaspberryDebugger/Web/Request.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RaspberryDebugger/Web/Request.cs b/RaspberryDebugger/Web/Request.cs index 112b581..5d18781 100644 --- a/RaspberryDebugger/Web/Request.cs +++ b/RaspberryDebugger/Web/Request.cs @@ -6,7 +6,7 @@ namespace RaspberryDebugger.Web; public class Feed { - private string VersionsFeedUri { get; } = "https://dotnetversionfeed.azurewebsites.net/versions"; + private string VersionsFeedUri { get; } = "https://dotnetversionfeedservice.azurewebsites.net/versions"; public async Task ReadAsync(string uri = null) { From 3f114dd7ddef21db6b0acb04008038716354144b Mon Sep 17 00:00:00 2001 From: George Stephens Date: Mon, 1 Aug 2022 20:32:47 +0100 Subject: [PATCH 268/278] Raspberry Pi Compute Module 4 Support Adds support for Raspberry Pi Compute Module 4. --- RaspberryDebugger/DebugHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RaspberryDebugger/DebugHelper.cs b/RaspberryDebugger/DebugHelper.cs index 8d39167..9f9a27e 100644 --- a/RaspberryDebugger/DebugHelper.cs +++ b/RaspberryDebugger/DebugHelper.cs @@ -521,13 +521,14 @@ public static ConnectionInfo GetDebugConnectionInfo(ProjectProperties projectPro // .NET Core only supports Raspberry models 3 and 4. if (!connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi 3 Model") && !connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi 4 Model") && + !connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi Compute Module 4") && !connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi Zero 2")) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); MessageBoxEx.Show( $"Your [{connection.PiStatus.RaspberryModel}] is not supported." + - " .NET Core requires a Raspberry Model 3 or 4 or Pi Zero 2.", + " .NET Core requires a Raspberry Model 3 or 4, Pi Zero 2 or Compute Module 4.", "Raspberry Not Supported", MessageBoxButtons.OK, MessageBoxIcon.Error); From 62aaa8516a0994c1bbab1991518de0ab9b25e67e Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Tue, 2 Aug 2022 19:54:22 +0200 Subject: [PATCH 269/278] new vsix manifest --- RaspberryDebugger/source.extension.vsixmanifest | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RaspberryDebugger/source.extension.vsixmanifest b/RaspberryDebugger/source.extension.vsixmanifest index bc7a6c3..5100835 100644 --- a/RaspberryDebugger/source.extension.vsixmanifest +++ b/RaspberryDebugger/source.extension.vsixmanifest @@ -1,15 +1,15 @@ - + Raspberry Debugger The Raspberry Debugger extension provides an easy way to debug applications on a real Raspberry Pi using Visual Studio 2022. Supporting 32 and 64 bit raspbian operating system versions. Raspberry Debugger forked from nforgeio/RaspberryDebugger https://github.com/StanDeMan/RaspberryDebugger license.txt - https://github.com/nforgeio/RaspberryDebugger - https://github.com/nforgeio/RaspberryDebugger/releases/tag/v2.1 + https://github.com/StanDeMan/RaspberryDebugger + https://github.com/StanDeMan/RaspberryDebugger packageicon.png raspberry pi debugger for visual studio 2022 From 5fc7b117e470bcde210aa25cc0f69d729f409d22 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Tue, 2 Aug 2022 20:11:04 +0200 Subject: [PATCH 270/278] New version supporting compute module 4 --- RaspberryDebugger/source.extension.vsixmanifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RaspberryDebugger/source.extension.vsixmanifest b/RaspberryDebugger/source.extension.vsixmanifest index 5100835..faaac13 100644 --- a/RaspberryDebugger/source.extension.vsixmanifest +++ b/RaspberryDebugger/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Raspberry Debugger The Raspberry Debugger extension provides an easy way to debug applications on a real Raspberry Pi using Visual Studio 2022. Supporting 32 and 64 bit raspbian operating system versions. From 8086b5964f97a27b13f1b44fd1e487610962053b Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Tue, 2 Aug 2022 23:44:49 +0200 Subject: [PATCH 271/278] Set assembly version --- RaspberryDebugger/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RaspberryDebugger/Properties/AssemblyInfo.cs b/RaspberryDebugger/Properties/AssemblyInfo.cs index 2477e3a..6059dad 100644 --- a/RaspberryDebugger/Properties/AssemblyInfo.cs +++ b/RaspberryDebugger/Properties/AssemblyInfo.cs @@ -46,5 +46,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.0.0")] -[assembly: AssemblyFileVersion("2.0.0.0")] +[assembly: AssemblyVersion("3.2.0.0")] +[assembly: AssemblyFileVersion("3.2.0.0")] From 38a21971d2e5e1ab0a7e43d6f3c7d0d99d6900e1 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Tue, 2 Aug 2022 23:53:55 +0200 Subject: [PATCH 272/278] Remove unused using --- RaspberryDebugger/Properties/AssemblyInfo.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/RaspberryDebugger/Properties/AssemblyInfo.cs b/RaspberryDebugger/Properties/AssemblyInfo.cs index 6059dad..22bdae8 100644 --- a/RaspberryDebugger/Properties/AssemblyInfo.cs +++ b/RaspberryDebugger/Properties/AssemblyInfo.cs @@ -16,7 +16,6 @@ // limitations under the License. using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following From 767289224823fdb64abf47e4ed57cc7cbebb101e Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Wed, 3 Aug 2022 19:53:29 +0200 Subject: [PATCH 273/278] Extend raspberry pi model check --- RaspberryDebugger/DebugHelper.cs | 12 ++++---- .../Models/Raspberry/RaspberryModelCheck.cs | 30 +++++++++++++++++++ RaspberryDebugger/RaspberryDebugger.csproj | 1 + 3 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 RaspberryDebugger/Models/Raspberry/RaspberryModelCheck.cs diff --git a/RaspberryDebugger/DebugHelper.cs b/RaspberryDebugger/DebugHelper.cs index 9f9a27e..c46cb3d 100644 --- a/RaspberryDebugger/DebugHelper.cs +++ b/RaspberryDebugger/DebugHelper.cs @@ -34,6 +34,7 @@ using RaspberryDebugger.Dialogs; using RaspberryDebugger.Models.Connection; using RaspberryDebugger.Models.Project; +using RaspberryDebugger.Models.Raspberry; using RaspberryDebugger.Models.VisualStudio; using Task = System.Threading.Tasks.Task; @@ -518,17 +519,16 @@ public static ConnectionInfo GetDebugConnectionInfo(ProjectProperties projectPro // device not found if(connection == null) return null; + var raspberryModel = new RaspberryModelCheck(); + // .NET Core only supports Raspberry models 3 and 4. - if (!connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi 3 Model") && - !connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi 4 Model") && - !connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi Compute Module 4") && - !connection.PiStatus.RaspberryModel.StartsWith("Raspberry Pi Zero 2")) + if(raspberryModel.IsNotSupported(connection.PiStatus.RaspberryModel)) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); MessageBoxEx.Show( - $"Your [{connection.PiStatus.RaspberryModel}] is not supported." + - " .NET Core requires a Raspberry Model 3 or 4, Pi Zero 2 or Compute Module 4.", + $"Your [{raspberryModel.ActualType}] is not supported." + + $" This .NET version requires a {string.Join(" or ", raspberryModel.Supported)}.", "Raspberry Not Supported", MessageBoxButtons.OK, MessageBoxIcon.Error); diff --git a/RaspberryDebugger/Models/Raspberry/RaspberryModelCheck.cs b/RaspberryDebugger/Models/Raspberry/RaspberryModelCheck.cs new file mode 100644 index 0000000..d836187 --- /dev/null +++ b/RaspberryDebugger/Models/Raspberry/RaspberryModelCheck.cs @@ -0,0 +1,30 @@ +using System.Linq; +using System.Collections.Generic; + +namespace RaspberryDebugger.Models.Raspberry +{ + public class RaspberryModelCheck + { + public string ActualType { get; private set; } + + public List Supported { get; } + + public RaspberryModelCheck() + { + Supported = new List() + { + "Raspberry Pi 3 Model", + "Raspberry Pi 4 Model", + "Raspberry Pi Compute Module 4", + "Raspberry Pi Zero 2" + }; + } + + public bool IsNotSupported(string raspberryType) + { + ActualType = raspberryType; + + return !Supported.Any(raspberryType.StartsWith); + } + } +} diff --git a/RaspberryDebugger/RaspberryDebugger.csproj b/RaspberryDebugger/RaspberryDebugger.csproj index 8b0fd8e..7350d32 100644 --- a/RaspberryDebugger/RaspberryDebugger.csproj +++ b/RaspberryDebugger/RaspberryDebugger.csproj @@ -95,6 +95,7 @@ + From e70537b3416c3283222d27d29154477f0664b4f0 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Fri, 5 Aug 2022 18:31:16 +0200 Subject: [PATCH 274/278] Update readme Debugging options are for all projects the same --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 28d7503..502c143 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ _A Visual Studio Extension for debugging .NET Core applications remotely on a Ra --- **IMPORTANT:** Can be ONLY used in Visual Studio 2022! Actually the LTS .NET versions (3.1 amd 6) are supported. -For Asp.NET debugging set the runtime identifier project property to: +For debugging set the runtime identifier project property to: ``` From a62c31ae5b654c8ebb6faea6e50a0265500dcf41 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sun, 20 Nov 2022 15:18:42 +0100 Subject: [PATCH 275/278] Count up version. A new .NET is born and alive. --- RaspberryDebugger/source.extension.vsixmanifest | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RaspberryDebugger/source.extension.vsixmanifest b/RaspberryDebugger/source.extension.vsixmanifest index faaac13..0ecc8d1 100644 --- a/RaspberryDebugger/source.extension.vsixmanifest +++ b/RaspberryDebugger/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Raspberry Debugger The Raspberry Debugger extension provides an easy way to debug applications on a real Raspberry Pi using Visual Studio 2022. Supporting 32 and 64 bit raspbian operating system versions. @@ -14,10 +14,10 @@ Raspberry Debugger forked from nforgeio/RaspberryDebugger raspberry pi debugger for visual studio 2022 - + amd64 - + amd64 @@ -25,7 +25,7 @@ Raspberry Debugger forked from nforgeio/RaspberryDebugger - + From 19621ebb80baad25ab36c143e89dbb6b3f50c6d0 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sun, 20 Nov 2022 15:20:14 +0100 Subject: [PATCH 276/278] Take all new .NET version together with .NET 7.0 --- RaspberryDebugger/sdk-catalog.json | 280 +++++++++++++++++++++++++++++ 1 file changed, 280 insertions(+) diff --git a/RaspberryDebugger/sdk-catalog.json b/RaspberryDebugger/sdk-catalog.json index c1bf233..4ee5213 100644 --- a/RaspberryDebugger/sdk-catalog.json +++ b/RaspberryDebugger/sdk-catalog.json @@ -1,5 +1,40 @@ { "items": [ + { + "name": "3.1", + "release": "3.1.425", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/17fc9caa-076e-41c0-907c-f027140b081f/ac9ba7784bf06b63185ead3a2aa2f4f4/dotnet-sdk-3.1.425-linux-arm.tar.gz", + "sha512": "ca1d9e119dd72e3ed1afafd12b7e6b01ae98c1b5146008dff937d577426ff27069fcb912ab93bcbd064115eb69aca9ebc07b2fd84fccbed051c4f7c90a994df6" + }, + { + "name": "3.1", + "release": "3.1.424", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/abae2803-1012-48e2-a720-355795f80d79/47650a0b203a6f28019fe6f68215528e/dotnet-sdk-3.1.424-linux-arm.tar.gz", + "sha512": "4ca319e7cdfcd318cb0d649d83a93f1ac87a7a777f454a0a71ff7e87bae1ef8020e789edb4bfa172c091edc66b1e5dce0faa0950cb95a93953863c76721ce11f" + }, + { + "name": "3.1", + "release": "3.1.423", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/8f81b133-220b-4831-abe6-e8be161fd9a2/1af75b5e2ca89af2a31cf9981a976832/dotnet-sdk-3.1.423-linux-arm.tar.gz", + "sha512": "6b615ec6c1d66280c44ff28de0532ff6a4c21c77caf188101b04bdd58e8935436cb2b049ad9d831799476d421e25795184615c7e1caff8e550855e2f6ed5efd9" + }, + { + "name": "3.1", + "release": "3.1.422", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/e5ec7845-008a-4b7d-a247-c314f2407b8d/9117e05fa19f0217a030666df6b6eb9d/dotnet-sdk-3.1.422-linux-arm.tar.gz", + "sha512": "9cbccaf303f693657f797ae81eec2bd2ea55975b7ae71a8add04175a0104545208fa2f9c536b97d91fa48c6ea890678eb0772a448977bce4acbc97726ac47f83" + }, + { + "name": "3.1", + "release": "3.1.421", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/564f08f3-230e-4476-8ebe-7e1f02dceae4/9da37442bde3f45300c65e9f71e1b24a/dotnet-sdk-3.1.421-linux-arm.tar.gz", + "sha512": "412b30ee45554de69844e4297354680fdc5111c270b5e41af73db212117ee101878b87eb4592bda4c314ec0d7406ba8ab449d83466267f78198ce09fc32ef425" + }, { "name": "3.1", "release": "3.1.420", @@ -329,6 +364,41 @@ "link": "https://download.visualstudio.microsoft.com/download/pr/67766a96-eb8c-4cd2-bca4-ea63d2cc115c/7bf13840aa2ed88793b7315d5e0d74e6/dotnet-sdk-3.1.100-linux-arm.tar.gz", "sha512": "9f4848b4bca649cc6131032de4b0115549a3dafb6bf90250930794aa69f7939bba82cedda67578348a83b50b7057e452846a400589bb4e9d4a2d1b33ce57c71c" }, + { + "name": "3.1", + "release": "3.1.425", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/d4a8d050-e3d0-4f07-b222-5cadb21320f2/05d4d832757a78ec88fb56d8f9f4cc65/dotnet-sdk-3.1.425-linux-arm64.tar.gz", + "sha512": "f3c18acc094c19f3887f6598c34c9a2e1cfa94055f77aa4deae7e51e8d760ca87af7185cc9ed102e08f04d35f9a558894f04f7a44fa56b91232ccc895f4e5a5c" + }, + { + "name": "3.1", + "release": "3.1.424", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/dfe62f78-d4c1-4190-9d9d-44249e83a0c5/1fb0e84fb45e4e5d3207de6db85d99c3/dotnet-sdk-3.1.424-linux-arm64.tar.gz", + "sha512": "3bfd29233a3e0dfdbdc967f07808d4e239651f0f4f23f7c9e74f09271c9ded8044539ea4278bad070504ad782c4638a493bd9026ddbc97bbc657c5c12c27ccd2" + }, + { + "name": "3.1", + "release": "3.1.423", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/11abab07-d7a2-46b0-9ab5-19d5db67212f/783196073ecbd9fd64378fec412affbe/dotnet-sdk-3.1.423-linux-arm64.tar.gz", + "sha512": "ba4f82e939be43ed863f059f69cdfb80b6dfe7cf99638bd6e787b060c2c1c4934440b599c133f61e3a0995f73675ae5d927bb047597cdd6a15b9074891dfd62e" + }, + { + "name": "3.1", + "release": "3.1.422", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/fdf76122-e9d5-4f66-b96f-4dd0c64e5bea/d756ca70357442de960db145f9b4234d/dotnet-sdk-3.1.422-linux-arm64.tar.gz", + "sha512": "3eb7e066568dfc0135f2b3229d0259db90e1920bb413f7e175c9583570146ad593b50ac39c77fb67dd3f460b4621137f277c3b66c44206767b1d28e27bf47deb" + }, + { + "name": "3.1", + "release": "3.1.421", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/3aa1ef77-157e-4c54-bdc6-1cf589f3e3d1/590f24f95d808144bc18caa0c45b7d9f/dotnet-sdk-3.1.421-linux-arm64.tar.gz", + "sha512": "c584642469343c2c54fa02a7157009fa36bae9b304512db0a2b0069f71593ee2ba47070896212def0541460f37bf1b0a478b914e08a2c78b985cb2981e5ab6c6" + }, { "name": "3.1", "release": "3.1.420", @@ -658,6 +728,69 @@ "link": "https://download.visualstudio.microsoft.com/download/pr/5a4c8f96-1c73-401c-a6de-8e100403188a/0ce6ab39747e2508366d498f9c0a0669/dotnet-sdk-3.1.100-linux-arm64.tar.gz", "sha512": "93634c555698ca5c3392332a93551b1548fa103328401c5c25e8955f085124b887b73736b70a139fc8eb8d622e47fcfc0aa25210b73a8f851906b32eaa8a9887" }, + { + "name": "6.0", + "release": "6.0.403", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/10cadabb-4cb4-4cca-94db-67cb31cb6f3a/5b3d102b4198da0a25ed12d83ae5633d/dotnet-sdk-6.0.403-linux-arm.tar.gz", + "sha512": "b07423700a92e3cc79f4e9e02c40e923352c09958e3307fd2ce7fc882509460c65a4404e8080f1b3852af98458512699ba43b37683916756666b4e2532cc8f46" + }, + { + "name": "6.0", + "release": "6.0.402", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/7be1dda3-3412-4f9a-88f2-e6a8e5f118ff/7bd57a63288994da06e7a1b9a4e407e3/dotnet-sdk-6.0.402-linux-arm.tar.gz", + "sha512": "98b275af781ac7be20e22736d601ea667161640703b9d430340e517fb2c1bdcd6d06d5eb4f374cab1f6e29c9135005050ec89dd8dcf0ec97e7b0d9912e52f988" + }, + { + "name": "6.0", + "release": "6.0.401", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/451f282f-dd26-4acd-9395-36cc3a9758e4/f5399d2ebced2ad9640db6283aa9d714/dotnet-sdk-6.0.401-linux-arm.tar.gz", + "sha512": "7d3c32f510a7298b8e4c32a95e7d3c9b0475d94510732a405163c7bff589ffda8964f2e9336d560bd1dc37461e6cb3da5809337a586da0288bdcc71496013ba0" + }, + { + "name": "6.0", + "release": "6.0.400", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/5a24144e-0d7d-4cc9-b9d8-b4d32d6bb084/e882181e475e3c66f48a22fbfc7b19c0/dotnet-sdk-6.0.400-linux-arm.tar.gz", + "sha512": "a72aa70bfb15e21a20ddd90c2c3e37acb53e6f1e50f5b6948aac616b28f80ac81e1157e8db5688e21dc9a7496011ef0fcf06cdca74ddc7271f9a1c6268f4b1b2" + }, + { + "name": "6.0", + "release": "6.0.306", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/a752d876-ddea-41a9-b8c6-5326b48791e3/ade6f4c1672c5357f140c44bba1b9acd/dotnet-sdk-6.0.306-linux-arm.tar.gz", + "sha512": "9ea0273b8e9a7ba0650aa6d989933d959a75f0c6c2cae46b1e6ba23913ddd25c6546275d9a21d540b760a9202fa802a484f713cacd0312405345142dfe452c6e" + }, + { + "name": "6.0", + "release": "6.0.305", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/2f5729be-273f-45fd-a1ec-f91695951839/a26275ca2b4abf646c7783c5a409ff31/dotnet-sdk-6.0.305-linux-arm.tar.gz", + "sha512": "ae7ab7920e1ba2833ce55c44116e4400fdebd8ce48d3b193b590b938e25909a647a34706f32dd4fe2a8468ff61a8bc962d7c8dfde5404293b6254c5e980f46a6" + }, + { + "name": "6.0", + "release": "6.0.304", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/32139893-1030-4515-a6a6-e3392685e9af/5f4b8acdaabe97f6d6d105e38a5c1557/dotnet-sdk-6.0.304-linux-arm.tar.gz", + "sha512": "4cbcb1fe9d9c3be643d3d0247e5cb4eff95778429a4eeae38060d268b3d31ef4c51cd47357c03a4d4281c5eb20feaa07ac140d430ffe4270c0f37aba3af546b4" + }, + { + "name": "6.0", + "release": "6.0.303", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/89e0bd36-57eb-41e4-95c9-4e35569e0f6b/1e7b6862caa6488465ab74d7c44bf130/dotnet-sdk-6.0.303-linux-arm.tar.gz", + "sha512": "444b8055f6814d5282e320ae243244fa27fe8afe76356c7d06e03a399ae2d41806cefc523a7bf12f36931931da88964d6797f1758a9cf23671aae318f41d3167" + }, + { + "name": "6.0", + "release": "6.0.302", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/f35557f7-d5e1-43be-93b6-e59ee8bd823c/9dd2c25a4d7351412ff5902c355732ca/dotnet-sdk-6.0.302-linux-arm.tar.gz", + "sha512": "0d31c7e8ccf02c8dea92d7b60bcb15e15912d74e7ee2ab8fd88ee03c4fbd8f292c356357d08ec23c2aedc5e3e0803d42ce16f3fff36245739d0cac6634bc3387" + }, { "name": "6.0", "release": "6.0.301", @@ -700,6 +833,41 @@ "link": "https://download.visualstudio.microsoft.com/download/pr/4cfcfa53-f421-4257-8cd2-d4078f9ffe90/008804a5475fa0d46b9e8f03cb78bfcd/dotnet-sdk-6.0.200-linux-arm.tar.gz", "sha512": "c2950d5da671a50c955d07997b288c02076b1d69014d3ac3f5941179e29a67b4d56fc5acbde85fe13ffd46efa95ead05b39d90dc577d2a668f637e6a9547944a" }, + { + "name": "6.0", + "release": "6.0.111", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/f8693beb-cb52-4d0b-9362-c93f47f2e0f5/7fa339566925e191039a6db91de3d547/dotnet-sdk-6.0.111-linux-arm.tar.gz", + "sha512": "44388611a84620e09e3adea7ada8ce4e04ef675d54c3a6ef12017bbed25e7c5d100089a700c503e9edc8605f9c0f48995f3b4595bd3179910a6cf4e2c11b1a53" + }, + { + "name": "6.0", + "release": "6.0.110", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/ec48c241-aa98-44fb-8e9e-f8ec91f048ec/8c9b79c23058a1c0ad7b3e0fdc340d41/dotnet-sdk-6.0.110-linux-arm.tar.gz", + "sha512": "ed8a0a3c5edc42b6e82dc925c35ebd3ba0ddf94b98c97febb0f4ffa758b369b2c063935fa62cc5e18c1f26e64e0618daf2600d8a9946a0d44f6103d725d99091" + }, + { + "name": "6.0", + "release": "6.0.109", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/743cf42d-f201-4dd6-ada8-37bd46cef977/d3508390013604f9023dab6698492aea/dotnet-sdk-6.0.109-linux-arm.tar.gz", + "sha512": "b757ffdef4b87a9394ce0a367f5563b2900e9720eba6b071ce22e454eaddcb7983bde182d90ef552b5b903c2b5505af5ab642190c982dfc18649ea8ee8657886" + }, + { + "name": "6.0", + "release": "6.0.108", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/69439f13-034e-4961-b0ba-1ef3b7dfeada/b3afee58e324bcd2c0e2a124b7472635/dotnet-sdk-6.0.108-linux-arm.tar.gz", + "sha512": "c3726e053b447e7baec21e015a91dddb884a79a483c7d2a247f2fe143a5cff25e5d7e822944c6b12f0b030d39b4e71c1da437e2ee4c094dd1bcdeccad3c44568" + }, + { + "name": "6.0", + "release": "6.0.107", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/e69db7cd-ea5c-40ea-87cd-cc567cbd6c3f/0765ead789975a5f4359fe44e3e7596a/dotnet-sdk-6.0.107-linux-arm.tar.gz", + "sha512": "05364e5f3c3be3f66420310c1fe26550d639c6e95b43ed004ea79017ee8c973d73349ff87c5eca4c560f80fea55a435c1c22f3889d5c015b85474533395245f4" + }, { "name": "6.0", "release": "6.0.106", @@ -749,6 +917,69 @@ "link": "https://download.visualstudio.microsoft.com/download/pr/1f85b038-9917-4d0a-8485-5dc86510eec7/a7555924fe292c6c2140893f066abe65/dotnet-sdk-6.0.100-linux-arm.tar.gz", "sha512": "c1e555893c48c4f4256d3e6b1d36b31d8a4d7763a6e958fb63dd31436c660648d481612b5e25d79a613e84a1954f5eac2c9c2b740bf410958172780f7bbeaeb3" }, + { + "name": "6.0", + "release": "6.0.403", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/67ca3f83-3769-4cd8-882a-27ab0c191784/bf631a0229827de92f5c026055218cc0/dotnet-sdk-6.0.403-linux-arm64.tar.gz", + "sha512": "fe62f6eca80acb6774f0a80c472dd02851d88f7ec09cc7f1cadd9981ec0ee1ceb87224911fc0c544cb932c7f5a91c66471a0458b50f85c899154bc8c3605a88e" + }, + { + "name": "6.0", + "release": "6.0.402", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/234daf6a-5e12-4fa3-a73b-b12db44a3154/df7c012e5e4e2cc510de9226425dad88/dotnet-sdk-6.0.402-linux-arm64.tar.gz", + "sha512": "2f5351192e87c2dd196d975e7618bd7b0b542034d0b1bc932fe944d8cbabb0ed2599e98e88d9757e68f198559961ab3350d8eddfacc2951df00fbf6a7e44f244" + }, + { + "name": "6.0", + "release": "6.0.401", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/a567a07f-af9d-451a-834c-a746ac299e6b/1d9d74b54cf580f93cad71a6bf7b32be/dotnet-sdk-6.0.401-linux-arm64.tar.gz", + "sha512": "8c05f9e02e0a48fcc3e4534fa7225fe5b974c07f1a4788c46207e18e94031194e1c881e40452ee6c432764e92331c50ae47305d4aec5afa363fab3a8a6727cdf" + }, + { + "name": "6.0", + "release": "6.0.400", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/901f7928-5479-4d32-a9e5-ba66162ca0e4/d00b935ec4dc79a27f5bde00712ed3d7/dotnet-sdk-6.0.400-linux-arm64.tar.gz", + "sha512": "a21010f9e0e091bf0a4df9dfc4ec9893c056c2b07b10be093ea392a4fa5c8a38bad9535f66e570b45dc25165b685199fb729434b845bcfb35f8b79cceb22c632" + }, + { + "name": "6.0", + "release": "6.0.306", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/fb258146-ac1b-480d-99b2-fecb7a607705/66e827540def06412bf11da9e6accb61/dotnet-sdk-6.0.306-linux-arm64.tar.gz", + "sha512": "cc49223db9c6309c4f0f7e208dfa07a1e9bdde032c2047b9aa2711e03d8aa0da91da22d728b332c2c9adbc54f423bb7e1dcdcb3888ed9ceef899d6e74bd308b2" + }, + { + "name": "6.0", + "release": "6.0.305", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/031e2cdb-71ae-4f10-8862-e2883ff82f03/fdbd377c5d84c1c07c4b8d1c87cca6bc/dotnet-sdk-6.0.305-linux-arm64.tar.gz", + "sha512": "0d7eb35dc1b2ee8c31710bab2eeb1f6871819168bcdf7aff257074cd0c4eafc3ad52875a45cec38ad799a12e8c81bddc6267f6b608aadfd9607d435cb3e6ba6f" + }, + { + "name": "6.0", + "release": "6.0.304", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/6d879cce-4273-42d6-b39d-0cc4d3ab198e/3a63185d3aa4685be69aa395a0986f24/dotnet-sdk-6.0.304-linux-arm64.tar.gz", + "sha512": "69dbd86331002990d7f6c915b0fb832c5d8ba55bb4dacbd6a4065ca7d59e92902fb5052f6cd905a453e42355a655d526b5c12be8fb5d12255af2d345d5b12846" + }, + { + "name": "6.0", + "release": "6.0.303", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/625d6cbb-7d21-41ab-a474-3ba603770d1d/7016fc39dc1eb5c8c7c5e2cc36440212/dotnet-sdk-6.0.303-linux-arm64.tar.gz", + "sha512": "b6eed880882873a35fdda99f8cc4a3d7b72851004244cd9a2e8656b475c4e766da78cfb33e0f034e742da39200b583ae9970c284e1401f1a4645c9d9d4429282" + }, + { + "name": "6.0", + "release": "6.0.302", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/33389348-a7d7-41ae-850f-ec46d3ca9612/36bad11f948b05a4fa9faac93c35e574/dotnet-sdk-6.0.302-linux-arm64.tar.gz", + "sha512": "26e98a63665d707b1a7729f1794077316f9927edd88d12d82d0357fe597096b0d89b64a085fcdf0cf49807a443bbfebb48e10ea91cea890846cf4308e67c4ea5" + }, { "name": "6.0", "release": "6.0.301", @@ -791,6 +1022,41 @@ "link": "https://download.visualstudio.microsoft.com/download/pr/ad60a07c-d4f0-4225-9154-c3a2ec0f34cf/a588cd2b94db2214f6e5dcd02c4aa37a/dotnet-sdk-6.0.200-linux-arm64.tar.gz", "sha512": "4e2b8f65f4cd9d1e54233b377e7efef5202eee3fa5e4592131ff03ecab032bfccdc91f4e8c806064fb769c48f946634bf1e420afecd7fcd2d981d40eeec5a881" }, + { + "name": "6.0", + "release": "6.0.111", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/f83d8e86-8cc1-4787-b6a7-b318d19d9582/9eca68b2392ba2798b70d598d49837ec/dotnet-sdk-6.0.111-linux-arm64.tar.gz", + "sha512": "7473eef3715c83ff399adaaf2605ae28f0144186024e3a4a5661ca978cc376262203147d77c51476cd88b5d7bdd7b3700221f214083eb77838a41a1357766b7c" + }, + { + "name": "6.0", + "release": "6.0.110", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/1a0faccb-a85e-43b7-b2a6-78ee8b975855/572b91765e7db29d33887cf4b87bc86c/dotnet-sdk-6.0.110-linux-arm64.tar.gz", + "sha512": "da312773a6def29612ea6898c489b86b2546e5e52c7c890134712c64fb3c0e52dfab88d8589858f9a9b39c3d2c9fc39406d6da251e3cfca399eb93df0c9ad5c6" + }, + { + "name": "6.0", + "release": "6.0.109", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/5da20803-1c48-4e54-a87c-88cda79efd77/4e6cd608eca3e34540d89e1ec3df5e6b/dotnet-sdk-6.0.109-linux-arm64.tar.gz", + "sha512": "eb4a42a45cbf8a92d2f78d4299ec34ab11d6d8dbc28dcab9dbe95648e40895a0dc56675a99b4df9e1f5a42ab0f3368322ae17381810d9bac5cb8623066120b80" + }, + { + "name": "6.0", + "release": "6.0.108", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/f3162067-d239-4518-9423-32559f4b6ebe/e944b933ee94602074678b2ea1374b6e/dotnet-sdk-6.0.108-linux-arm64.tar.gz", + "sha512": "95f5c47fb27882f5554b0ee0befb813357875d6bfd19447c7c902ce225ed394bbb6cd945c5f7d5233fe0d3a16a1c006f47eba9d6be51cf8578fc5fbeba2806f0" + }, + { + "name": "6.0", + "release": "6.0.107", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/dd4f49ba-39b0-4358-bd82-18cb5b1350d1/ec891910fd6f13c22448a8162fe1f017/dotnet-sdk-6.0.107-linux-arm64.tar.gz", + "sha512": "946b43f0da3e5d94d20163d6a94fc4fcef66c1c18d6fa02530e769201d96c9e2125c0f35532ea87e0c5b4f3a491daa6d4b8d6dd23f4eb9da32625ca0a4065e14" + }, { "name": "6.0", "release": "6.0.106", @@ -839,6 +1105,20 @@ "architecture": "Arm64", "link": "https://download.visualstudio.microsoft.com/download/pr/adcd9310-5072-4179-9b8b-16563b897995/15a7595966f488c74909e4a9273c0e24/dotnet-sdk-6.0.100-linux-arm64.tar.gz", "sha512": "e5983c1c599d6dc7c3c7496b9698e47c68247f04a5d0d1e3162969d071471297bce1c2fd3a1f9fb88645006c327ae79f880dcbdd8eefc9166fd717331f2716e7" + }, + { + "name": "7.0", + "release": "7.0.100", + "architecture": "Arm32", + "link": "https://download.visualstudio.microsoft.com/download/pr/fd193b5b-f171-436e-8783-5eb77a7ad5ee/2a0af2a874f3c4f7da0199dc64996829/dotnet-sdk-7.0.100-linux-arm.tar.gz", + "sha512": "11c1150357a0a79095b563671bc038085f8bbbc678a47681c4decade22fcb18504e60732518e681a5688008e7ffbad69933a8ff3bd91c09ff4df66a80a596809" + }, + { + "name": "7.0", + "release": "7.0.100", + "architecture": "Arm64", + "link": "https://download.visualstudio.microsoft.com/download/pr/47337472-c910-4815-9d9b-80e1a30fcf16/14847f6a51a6a7e53a859d4a17edc311/dotnet-sdk-7.0.100-linux-arm64.tar.gz", + "sha512": "0a332df58891e808c9adc2b785e9b0e658b29b494963c8d501b0f8806ff5d3daad4614886349cbba86af638ed7ac76e78a2d05aeca13bac25d5f45fbe62b8251" } ] } \ No newline at end of file From 138668e6cf9098e9f00c38f22f81f38124e21102 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sun, 20 Nov 2022 17:57:06 +0100 Subject: [PATCH 277/278] Update readme Take .NET 7.0 into account --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 502c143..0063d0f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ _A Visual Studio Extension for debugging .NET Core applications remotely on a Raspberry Pi_ --- -**IMPORTANT:** Can be ONLY used in Visual Studio 2022! Actually the LTS .NET versions (3.1 amd 6) are supported. +**IMPORTANT:** Can be ONLY used in Visual Studio 2022! Actually the LTS .NET versions (3.1 + 6.0) and the STS 7.0 (version 3.3) are supported. For debugging set the runtime identifier project property to: @@ -182,7 +182,7 @@ The **Project/Raspberry Debug Settings** menu persists the settings to the new ` * .NET Core is not supported on Raspberry 1, 2, or Zero cards * 64-bit Raspberry Pi OS (Raspbian) is supported now -* Only LTS .NET Core SDKs supported: 3.1 and 6 (5 is not supported anymore) +* Only LTS .NET Core SDKs supported: LTS .NET versions (3.1 + 6.0) and latest STS 7.0 (debugger version 3.3) * **Start Without Debugging** or **Attach to Process...** are not supported (yet) * Raspberry debugging uses the default project debugging profile * HTTPS is currently supported for ASPNET debugging (for reverse proxy and for Kestrel) From fb1c4ea297b94e6c304ee3903aeb194fab740a61 Mon Sep 17 00:00:00 2001 From: StanDeMan Date: Sun, 20 Nov 2022 18:29:04 +0100 Subject: [PATCH 278/278] Generate new marketplace guid --- RaspberryDebugger/source.extension.vsixmanifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RaspberryDebugger/source.extension.vsixmanifest b/RaspberryDebugger/source.extension.vsixmanifest index 0ecc8d1..1763b08 100644 --- a/RaspberryDebugger/source.extension.vsixmanifest +++ b/RaspberryDebugger/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Raspberry Debugger The Raspberry Debugger extension provides an easy way to debug applications on a real Raspberry Pi using Visual Studio 2022. Supporting 32 and 64 bit raspbian operating system versions.