diff --git a/ClickToBuild.cmd b/ClickToBuild.cmd index 23cd2267d0a..53e1c8d6cab 100644 --- a/ClickToBuild.cmd +++ b/ClickToBuild.cmd @@ -23,13 +23,14 @@ echo "Unable to detect suitable environment. Build may not succeed." SET target=%1 SET project=%2 +SET solution=%3 IF "%target%" == "" SET target=Build -IF "%project%" =="" SET project=Orchard.proj +IF "%project%" == "" SET project=Orchard.proj +IF "%solution%" == "" SET solution=src\Orchard.sln -lib\nuget\nuget.exe restore .\src\Orchard.sln +lib\nuget\nuget.exe restore %solution% -msbuild /t:%target% %project% - -pause +msbuild /t:%target% %project% /p:Solution=%solution% +pause \ No newline at end of file diff --git a/ClickToBuildAzurePackage.cmd b/ClickToBuildAzurePackage.cmd index 5f6eb130076..c432229fd3a 100644 --- a/ClickToBuildAzurePackage.cmd +++ b/ClickToBuildAzurePackage.cmd @@ -2,5 +2,4 @@ SET target=%1 IF "%target%"=="" SET target=Build -ClickToBuild %target% AzurePackage.proj - +ClickToBuild %target% Orchard.proj src\Orchard.Azure\Orchard.Azure.sln \ No newline at end of file diff --git a/Orchard.proj b/Orchard.proj index 80ab256480c..d08fb50f881 100644 --- a/Orchard.proj +++ b/Orchard.proj @@ -6,6 +6,7 @@ $(MSBuildProjectDirectory)\lib $(MSBuildProjectDirectory)\src + $(SrcFolder)\Orchard.Azure $(MSBuildProjectDirectory)\build $(MSBuildProjectDirectory)\buildtasks $(MSBuildProjectDirectory)\artifacts @@ -28,21 +29,32 @@ x64 x86 Release + + $(SrcFolder)\Orchard.sln + $(AzureSrcFolder)\Orchard.Azure.sln + $(OrchardSolution) $(BUILD_NUMBER) + + + + + + - + - + @@ -95,19 +107,19 @@ - + - + - + @@ -115,16 +127,16 @@ - + - - - - - - - + - + - - - - - - + - + @@ -298,7 +299,6 @@ - - + @@ -350,11 +350,11 @@ $(MSBuildProjectDirectory)\**\*.hgignore; $(MSBuildProjectDirectory)\**\*.hg*\**\*; $(LibFolder)\nunit\addins\**\*; - " Exclude="$(MSBuildProjectDirectory)\src\Orchard.Azure\Orchard.Azure.CloudService\*Content\**\*" /> + " Exclude="$(AzureSrcFolder)\Orchard.Azure.CloudService\*Content\**\*" /> - + - - -

NUnit Acceptance Tests

-

- Developers love self-referential programs! Hence, NUnit has always run all it's - own tests, even those that are not really unit tests. -

Now, beginning with NUnit 2.4, NUnit has top-level tests using Ward Cunningham's - FIT framework. At this time, the tests are pretty rudimentary, but it's a start - and it's a framework for doing more. -

Running the Tests

-

Open a console or shell window and navigate to the NUnit bin directory, which - contains this file. To run the test under Microsoft .Net, enter the command -

    runFile NUnitFitTests.html TestResults.html .
- To run it under Mono, enter -
    mono runFile.exe NUnitFitTests.html TestResults.html .
- Note the space and dot at the end of each command. The results of your test - will be in TestResults.html in the same directory. -

Platform and CLR Version

- - - - -
NUnit.Fixtures.PlatformInfo
-

Verify Unit Tests

-

- Load and run the NUnit unit tests, verifying that the results are as expected. - When these tests are run on different platforms, different numbers of tests may - be skipped, so the values for Skipped and Run tests are informational only. -

- The number of tests in each assembly should be constant across all platforms - - any discrepancy usually means that one of the test source files was not - compiled on the platform. There should be no failures and no tests ignored. -

Note: - At the moment, the nunit.extensions.tests assembly is failing because the - fixture doesn't initialize addins in the test domain. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NUnit.Fixtures.AssemblyRunner
AssemblyTests()Run()Skipped()Ignored()Failures()
nunit.framework.tests.dll397  00
nunit.core.tests.dll355  00
nunit.util.tests.dll238  00
nunit.mocks.tests.dll43  00
nunit.extensions.tests.dll5  00
nunit-console.tests.dll40  00
nunit.uikit.tests.dll34  00
nunit-gui.tests.dll15  00
nunit.fixtures.tests.dll6  00
-

Code Snippet Tests

-

- These tests create a test assembly from a snippet of code and then load and run - the tests that it contains, verifying that the structure of the loaded tests is - as expected and that the number of tests run, skipped, ignored or failed is - correct. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NUnit.Fixtures.SnippetRunner
CodeTree()Run()Skipped()Ignored()Failures()
public class TestClass
-{
-}
-
EMPTY0000
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass
-{
-}
-
TestClass0000
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass
-{
-    [Test]
-    public void T1() { }
-    [Test]
-    public void T2() { }
-    [Test]
-    public void T3() { }
-}
-
TestClass
->T1
->T2
->T3
-
3000
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass1
-{
-    [Test]
-    public void T1() { }
-}
-
-[TestFixture]
-public class TestClass2
-{
-    [Test]
-    public void T2() { }
-    [Test]
-    public void T3() { }
-}
-
TestClass1
->T1
-TestClass2
->T2
->T3
-
3000
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass
-{
-    [Test]
-    public void T1() { }
-    [Test, Ignore]
-    public void T2() { }
-    [Test]
-    public void T3() { }
-}
-
TestClass
->T1
->T2
->T3
-
2010
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass
-{
-    [Test]
-    public void T1() { }
-    [Test, Explicit]
-    public void T2() { }
-    [Test]
-    public void T3() { }
-}
-
TestClass
->T1
->T2
->T3
-
2100
-

Summary Information

- - - - -
fit.Summary
- - diff --git a/lib/nunit/NUnitTests.config b/lib/nunit/NUnitTests.config deleted file mode 100644 index de8a656988d..00000000000 --- a/lib/nunit/NUnitTests.config +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/nunit/NUnitTests.nunit b/lib/nunit/NUnitTests.nunit deleted file mode 100644 index e7bb7f432a3..00000000000 --- a/lib/nunit/NUnitTests.nunit +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/lib/nunit/agent.conf b/lib/nunit/agent.conf deleted file mode 100644 index ddbcd8ea6d8..00000000000 --- a/lib/nunit/agent.conf +++ /dev/null @@ -1,4 +0,0 @@ - - 8080 - . - \ No newline at end of file diff --git a/lib/nunit/agent.log.conf b/lib/nunit/agent.log.conf deleted file mode 100644 index 4bd90ca4931..00000000000 --- a/lib/nunit/agent.log.conf +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/lib/nunit/clr.bat b/lib/nunit/clr.bat deleted file mode 100644 index 0a838482ca8..00000000000 --- a/lib/nunit/clr.bat +++ /dev/null @@ -1,96 +0,0 @@ -@echo off -rem Run a program under a particular version of the .Net framework -rem by setting the COMPLUS_Version environment variable. -rem -rem This command was written by Charlie Poole for the NUnit project. -rem You may use it separately from NUnit at your own risk. - -if "%1"=="/?" goto help -if "%1"=="?" goto help -if "%1"=="" goto GetVersion -if /I "%1"=="off" goto RemoveVersion -if "%2"=="" goto SetVersion -goto main - -:help -echo Control the version of the .Net framework that is used. The -echo command has several forms: -echo. -echo CLR -echo Reports the version of the CLR that has been set -echo. -echo CLR version -echo Sets the local shell environment to use a specific -echo version of the CLR for subsequent commands. -echo. -echo CLR version command [arguments] -echo Executes a single command using the specified CLR version. -echo. -echo CLR off -echo Turns off specific version selection for commands -echo. -echo The CLR version may be specified as vn.n.n or n.n.n. In addition, -echo the following shortcuts are recognized: -echo net-1.0, 1.0 For version 1.0.3705 -echo net-1.1, 1.1 For version 1.1.4322 -echo beta2 For version 2.0.50215 -echo net-2.0, 2.0 For version 2.0.50727 -echo. -echo NOTE: -echo Any specific settings for required or supported runtime in -echo the ^ section of a program's config file will -echo override the version specified by this command, and the -echo command will have no effect. -echo. -goto done - -:main - -setlocal -set CMD= -call :SetVersion %1 -shift /1 - -:loop 'Copy remaining arguments to form the command -if "%1"=="" goto run -set CMD=%CMD% %1 -shift /1 -goto :loop - -:run 'Execute the command -%CMD% -endlocal -goto done - -:SetVersion -set COMPLUS_Version=%1 - -rem Substitute proper format for certain names -if /I "%COMPLUS_Version:~0,1%"=="v" goto useit -if /I "%COMPLUS_Version%"=="net-1.0" set COMPLUS_Version=v1.0.3705&goto report -if /I "%COMPLUS_Version%"=="1.0" set COMPLUS_Version=v1.0.3705&goto report -if /I "%COMPLUS_Version%"=="net-1.1" set COMPLUS_Version=v1.1.4322&goto report -if /I "%COMPLUS_Version%"=="1.1" set COMPLUS_Version=v1.1.4322&goto report -if /I "%COMPLUS_Version%"=="beta2" set COMPLUS_Version=v2.0.50215&goto report -if /I "%COMPLUS_Version%"=="net-2.0" set COMPLUS_Version=v2.0.50727&goto report -if /I "%COMPLUS_Version%"=="2.0" set COMPLUS_Version=v2.0.50727&goto report - -rem Add additional substitutions here, branching to report - -rem assume it's a version number without 'v' -set COMPLUS_Version=v%COMPLUS_Version% - -:report -echo Setting CLR version to %COMPLUS_Version% -goto done - -:GetVersion -if "%COMPLUS_Version%"=="" echo CLR version is not set -if NOT "%COMPLUS_Version%"=="" echo CLR version is set to %COMPLUS_Version% -goto done - -:RemoveVersion -set COMPLUS_Version= -echo CLR version is no longer set - -:done \ No newline at end of file diff --git a/lib/nunit/launcher.log.conf b/lib/nunit/launcher.log.conf deleted file mode 100644 index 4bd90ca4931..00000000000 --- a/lib/nunit/launcher.log.conf +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/lib/nunit/lib/Failure.png b/lib/nunit/lib/Failure.png deleted file mode 100644 index 2e400b276fc..00000000000 Binary files a/lib/nunit/lib/Failure.png and /dev/null differ diff --git a/lib/nunit/lib/Ignored.png b/lib/nunit/lib/Ignored.png deleted file mode 100644 index 478efbf00be..00000000000 Binary files a/lib/nunit/lib/Ignored.png and /dev/null differ diff --git a/lib/nunit/lib/Inconclusive.png b/lib/nunit/lib/Inconclusive.png deleted file mode 100644 index 4807b7cedbc..00000000000 Binary files a/lib/nunit/lib/Inconclusive.png and /dev/null differ diff --git a/lib/nunit/lib/Skipped.png b/lib/nunit/lib/Skipped.png deleted file mode 100644 index 7c9fc64e387..00000000000 Binary files a/lib/nunit/lib/Skipped.png and /dev/null differ diff --git a/lib/nunit/lib/Success.png b/lib/nunit/lib/Success.png deleted file mode 100644 index 2a301508c65..00000000000 Binary files a/lib/nunit/lib/Success.png and /dev/null differ diff --git a/lib/nunit/lib/fit.dll b/lib/nunit/lib/fit.dll deleted file mode 100644 index 40bbef0e292..00000000000 Binary files a/lib/nunit/lib/fit.dll and /dev/null differ diff --git a/lib/nunit/lib/log4net.dll b/lib/nunit/lib/log4net.dll deleted file mode 100644 index 20a2e1c47de..00000000000 Binary files a/lib/nunit/lib/log4net.dll and /dev/null differ diff --git a/lib/nunit/lib/nunit-console-runner.dll b/lib/nunit/lib/nunit-console-runner.dll deleted file mode 100644 index 3f9c0e9316d..00000000000 Binary files a/lib/nunit/lib/nunit-console-runner.dll and /dev/null differ diff --git a/lib/nunit/lib/nunit-gui-runner.dll b/lib/nunit/lib/nunit-gui-runner.dll deleted file mode 100644 index 894c3383fda..00000000000 Binary files a/lib/nunit/lib/nunit-gui-runner.dll and /dev/null differ diff --git a/lib/nunit/lib/nunit.core.dll b/lib/nunit/lib/nunit.core.dll deleted file mode 100644 index 6fd79cf1469..00000000000 Binary files a/lib/nunit/lib/nunit.core.dll and /dev/null differ diff --git a/lib/nunit/lib/nunit.core.interfaces.dll b/lib/nunit/lib/nunit.core.interfaces.dll deleted file mode 100644 index 2794827b971..00000000000 Binary files a/lib/nunit/lib/nunit.core.interfaces.dll and /dev/null differ diff --git a/lib/nunit/lib/nunit.fixtures.dll b/lib/nunit/lib/nunit.fixtures.dll deleted file mode 100644 index 1658b3791b9..00000000000 Binary files a/lib/nunit/lib/nunit.fixtures.dll and /dev/null differ diff --git a/lib/nunit/lib/nunit.uiexception.dll b/lib/nunit/lib/nunit.uiexception.dll deleted file mode 100644 index 3f05866d919..00000000000 Binary files a/lib/nunit/lib/nunit.uiexception.dll and /dev/null differ diff --git a/lib/nunit/lib/nunit.uikit.dll b/lib/nunit/lib/nunit.uikit.dll deleted file mode 100644 index cb3cfdf9a6a..00000000000 Binary files a/lib/nunit/lib/nunit.uikit.dll and /dev/null differ diff --git a/lib/nunit/lib/nunit.util.dll b/lib/nunit/lib/nunit.util.dll deleted file mode 100644 index 71ca49bca56..00000000000 Binary files a/lib/nunit/lib/nunit.util.dll and /dev/null differ diff --git a/lib/nunit/license.txt b/lib/nunit/license.txt deleted file mode 100644 index 66a5ebf28bb..00000000000 --- a/lib/nunit/license.txt +++ /dev/null @@ -1,15 +0,0 @@ -Copyright 2002-2008 Charlie Poole -Copyright 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov -Copyright 2000-2002 Philip A. Craig - -This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment (see the following) in the product documentation is required. - -Portions Copyright 2002-2008 Charlie Poole or Copyright 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright 2000-2002 Philip A. Craig - -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution. diff --git a/lib/nunit/nunit-agent.exe b/lib/nunit/nunit-agent.exe deleted file mode 100644 index 9b189c1aab8..00000000000 Binary files a/lib/nunit/nunit-agent.exe and /dev/null differ diff --git a/lib/nunit/nunit-agent.exe.config b/lib/nunit/nunit-agent.exe.config deleted file mode 100644 index e33ec06e0e2..00000000000 --- a/lib/nunit/nunit-agent.exe.config +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/nunit/nunit-console-x86.exe b/lib/nunit/nunit-console-x86.exe deleted file mode 100644 index 83849f3afd2..00000000000 Binary files a/lib/nunit/nunit-console-x86.exe and /dev/null differ diff --git a/lib/nunit/nunit-console-x86.exe.config b/lib/nunit/nunit-console-x86.exe.config deleted file mode 100644 index bd83fb17113..00000000000 --- a/lib/nunit/nunit-console-x86.exe.config +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/nunit/nunit-console.exe b/lib/nunit/nunit-console.exe deleted file mode 100644 index 9f6190573ff..00000000000 Binary files a/lib/nunit/nunit-console.exe and /dev/null differ diff --git a/lib/nunit/nunit-console.exe.config b/lib/nunit/nunit-console.exe.config deleted file mode 100644 index 32956794162..00000000000 --- a/lib/nunit/nunit-console.exe.config +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/nunit/nunit-x86.exe b/lib/nunit/nunit-x86.exe deleted file mode 100644 index 13832377797..00000000000 Binary files a/lib/nunit/nunit-x86.exe and /dev/null differ diff --git a/lib/nunit/nunit-x86.exe.config b/lib/nunit/nunit-x86.exe.config deleted file mode 100644 index 9d5ca14e971..00000000000 --- a/lib/nunit/nunit-x86.exe.config +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/nunit/nunit.exe b/lib/nunit/nunit.exe deleted file mode 100644 index e3a0d28e1ae..00000000000 Binary files a/lib/nunit/nunit.exe and /dev/null differ diff --git a/lib/nunit/nunit.exe.config b/lib/nunit/nunit.exe.config deleted file mode 100644 index 9d5ca14e971..00000000000 --- a/lib/nunit/nunit.exe.config +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/nunit/nunit.framework.dll b/lib/nunit/nunit.framework.dll deleted file mode 100644 index 2729ddf2890..00000000000 Binary files a/lib/nunit/nunit.framework.dll and /dev/null differ diff --git a/lib/nunit/pnunit-agent.exe b/lib/nunit/pnunit-agent.exe deleted file mode 100644 index 7a559eb243e..00000000000 Binary files a/lib/nunit/pnunit-agent.exe and /dev/null differ diff --git a/lib/nunit/pnunit-agent.exe.config b/lib/nunit/pnunit-agent.exe.config deleted file mode 100644 index f4236b6dd1b..00000000000 --- a/lib/nunit/pnunit-agent.exe.config +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/nunit/pnunit-launcher.exe b/lib/nunit/pnunit-launcher.exe deleted file mode 100644 index 5251378d873..00000000000 Binary files a/lib/nunit/pnunit-launcher.exe and /dev/null differ diff --git a/lib/nunit/pnunit-launcher.exe.config b/lib/nunit/pnunit-launcher.exe.config deleted file mode 100644 index 87828f68deb..00000000000 --- a/lib/nunit/pnunit-launcher.exe.config +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/nunit/pnunit.framework.dll b/lib/nunit/pnunit.framework.dll deleted file mode 100644 index 494dc721cc3..00000000000 Binary files a/lib/nunit/pnunit.framework.dll and /dev/null differ diff --git a/lib/nunit/pnunit.tests.dll b/lib/nunit/pnunit.tests.dll deleted file mode 100644 index ac67a2b4f3c..00000000000 Binary files a/lib/nunit/pnunit.tests.dll and /dev/null differ diff --git a/lib/nunit/runFile.exe b/lib/nunit/runFile.exe deleted file mode 100644 index a7944586696..00000000000 Binary files a/lib/nunit/runFile.exe and /dev/null differ diff --git a/lib/nunit/runFile.exe.config b/lib/nunit/runFile.exe.config deleted file mode 100644 index f58f099b6a2..00000000000 --- a/lib/nunit/runFile.exe.config +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/nunit/runpnunit.bat b/lib/nunit/runpnunit.bat deleted file mode 100644 index a05cbb7d95b..00000000000 --- a/lib/nunit/runpnunit.bat +++ /dev/null @@ -1,2 +0,0 @@ -start pnunit-agent agent.conf -pnunit-launcher test.conf \ No newline at end of file diff --git a/lib/nunit/test.conf b/lib/nunit/test.conf deleted file mode 100644 index 14cd11307bf..00000000000 --- a/lib/nunit/test.conf +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Testing - - - Testing - pnunit.tests.dll - TestLibraries.Testing.EqualTo19 - localhost:8080 - - ..\server - - - - - - - - - - - \ No newline at end of file diff --git a/src/Orchard.Azure/Orchard.Azure.sln b/src/Orchard.Azure/Orchard.Azure.sln index 87820064bdd..25dfb7e6796 100644 --- a/src/Orchard.Azure/Orchard.Azure.sln +++ b/src/Orchard.Azure/Orchard.Azure.sln @@ -490,12 +490,12 @@ Global {C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {1C981BB3-26F7-494C-9005-CC27A5144233} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {05660F47-D649-48BD-9DED-DF4E01E7CFF9} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} - {8F116B06-1C0E-4E4C-9A0A-D2FAB851E768} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} + {8F116B06-1C0E-4E4C-9A0A-D2FAB851E768} = {B6092A92-1071-4C30-AD55-8E8D46BC2F14} {EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {194D3CCC-1153-474D-8176-FDE8D7D0D0BD} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {CB70A642-8CEC-4DDE-8C9F-AD08900EC98D} = {84650275-884D-4CBB-9CC0-67553996E211} {FBC8B571-ED50-49D8-8D9D-64AB7454A0D6} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} - {137906EA-15FE-4AD8-A6A0-27528F0477D6} = {B6092A92-1071-4C30-AD55-8E8D46BC2F14} + {137906EA-15FE-4AD8-A6A0-27528F0477D6} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {3420C92A-747F-4990-BA08-F2C9531E44AD} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {C889167C-E52C-4A65-A419-224B3D1B957D} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {99002B65-86F7-415E-BF4A-381AA8AB9CCC} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} @@ -507,14 +507,14 @@ Global {642A49D7-8752-4177-80D6-BFBBCFAD3DE0} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {6F759635-13D7-4E94-BCC9-80445D63F117} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {966EC390-3C7F-4D98-92A6-F0F30D02E9B1} = {B6092A92-1071-4C30-AD55-8E8D46BC2F14} - {3F72A4E9-7B72-4260-B010-C16EC54F9BAF} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} + {3F72A4E9-7B72-4260-B010-C16EC54F9BAF} = {B6092A92-1071-4C30-AD55-8E8D46BC2F14} {475B6C45-B27C-438B-8966-908B9D6D1077} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {66FCCD76-2761-47E3-8D11-B45D0001DDAA} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {3787DDE5-E5C8-4841-BDA7-DCB325388064} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {5531E894-D259-45A3-AA61-26DBE720C1CE} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {91BC2E7F-DA04-421C-98EF-76D37CEC130C} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {E826F796-8CE3-4B5B-8423-5AA5F81D2FC3} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} - {2CF067CA-064B-43C6-8B88-5E3B99A65F1D} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} + {2CF067CA-064B-43C6-8B88-5E3B99A65F1D} = {B6092A92-1071-4C30-AD55-8E8D46BC2F14} {F301EF7D-F19C-4D83-AA94-CB64F29C037D} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {FE5C5947-D2D5-42C5-992A-13D672946135} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {9CD5C81F-5828-4384-8474-2E2BE71D5EDD} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} diff --git a/src/Orchard.Core.Tests/Properties/AssemblyInfo.cs b/src/Orchard.Core.Tests/Properties/AssemblyInfo.cs index 2e3d2f71441..1ce9e62ce04 100644 --- a/src/Orchard.Core.Tests/Properties/AssemblyInfo.cs +++ b/src/Orchard.Core.Tests/Properties/AssemblyInfo.cs @@ -30,5 +30,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.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Profile/Properties/AssemblyInfo.cs b/src/Orchard.Profile/Properties/AssemblyInfo.cs index a420575c15d..3e5c2463486 100644 --- a/src/Orchard.Profile/Properties/AssemblyInfo.cs +++ b/src/Orchard.Profile/Properties/AssemblyInfo.cs @@ -30,5 +30,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.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs index 306fa0e8b47..6894b11faee 100644 --- a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs +++ b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs @@ -24,7 +24,7 @@ public void GivenIHaveInstalledOrchard(string virtualDirectory) { webApp.GivenIHaveACleanSiteWith( virtualDirectory, TableData( - new { extension = "Module", names = "Lucene, Markdown, Orchard.Alias, Orchard.AntiSpam, Orchard.ArchiveLater, Orchard.Autoroute, Orchard.Azure, Orchard.Blogs, Orchard.Caching, Orchard.CodeGeneration, Orchard.Comments, Orchard.ContentPermissions, Orchard.ContentPicker, Orchard.ContentTypes, Orchard.CustomForms, Orchard.DesignerTools, Orchard.Email, Orchard.Fields, Orchard.Forms, Orchard.ImageEditor, Orchard.ImportExport, Orchard.Indexing, Orchard.JobsQueue, Orchard.Resources, Orchard.Layouts, Orchard.Lists, Orchard.Localization, Orchard.Media, Orchard.MediaLibrary, Orchard.MediaPicker, Orchard.MediaProcessing, Orchard.Migrations, Orchard.Modules, Orchard.MultiTenancy, Orchard.OutputCache, Orchard.Packaging, Orchard.Pages, Orchard.Projections, Orchard.PublishLater, Orchard.Recipes, Orchard.Roles, Orchard.Rules, Orchard.Scripting, Orchard.Scripting.CSharp, Orchard.Scripting.Dlr, Orchard.Search, Orchard.SecureSocketsLayer, Orchard.Setup, Orchard.Tags, Orchard.TaskLease, Orchard.Taxonomies, Orchard.Templates, Orchard.Themes, Orchard.Tokens, Orchard.Users, Orchard.Warmup, Orchard.Widgets, Orchard.Workflows, Orchard.Conditions, SysCache, TinyMce, Upgrade" }, + new { extension = "Module", names = "Lucene, Markdown, Orchard.Alias, Orchard.AntiSpam, Orchard.ArchiveLater, Orchard.Autoroute, Orchard.Azure, Orchard.Blogs, Orchard.Caching, Orchard.CodeGeneration, Orchard.Comments, Orchard.ContentPermissions, Orchard.ContentPicker, Orchard.ContentTypes, Orchard.DesignerTools, Orchard.Email, Orchard.Fields, Orchard.Forms, Orchard.ImageEditor, Orchard.ImportExport, Orchard.Indexing, Orchard.JobsQueue, Orchard.Resources, Orchard.Layouts, Orchard.Lists, Orchard.Localization, Orchard.MediaLibrary, Orchard.MediaProcessing, Orchard.Migrations, Orchard.Modules, Orchard.MultiTenancy, Orchard.OutputCache, Orchard.Packaging, Orchard.Pages, Orchard.Projections, Orchard.PublishLater, Orchard.Recipes, Orchard.Roles, Orchard.Scripting, Orchard.Scripting.CSharp, Orchard.Scripting.Dlr, Orchard.Search, Orchard.SecureSocketsLayer, Orchard.Setup, Orchard.Tags, Orchard.Taxonomies, Orchard.Templates, Orchard.Themes, Orchard.Tokens, Orchard.Users, Orchard.Warmup, Orchard.Widgets, Orchard.Workflows, Orchard.Conditions, SysCache, TinyMce, Upgrade" }, new { extension = "Core", names = "Common, Containers, Contents, Dashboard, Feeds, Navigation, Scheduling, Settings, Shapes, Title, XmlRpc" }, new { extension = "Theme", names = "SafeMode, TheAdmin, TheThemeMachine" })); diff --git a/src/Orchard.Specs/Boolean.feature b/src/Orchard.Specs/Boolean.feature index c36d964ba51..5335a953f1e 100644 --- a/src/Orchard.Specs/Boolean.feature +++ b/src/Orchard.Specs/Boolean.feature @@ -53,7 +53,7 @@ Scenario: Creating and using Boolean fields And I go to "Admin/Contents/Create/Event" Then I should see "Check if the event is active" - # The default value should be selected + # The default value should be proposed on creation When I go to "Admin/ContentTypes/Edit/Event" And I fill in | name | value | @@ -65,14 +65,8 @@ Scenario: Creating and using Boolean fields # The value should be required When I go to "Admin/ContentTypes/Edit/Event" And I fill in - | name | value | - | Fields[0].BooleanFieldSettings.Optional | false | - And I fill in - | name | value | - | Fields[0].BooleanFieldSettings.NotSetLabel | May be | - And I fill in - | name | value | - | Fields[0].BooleanFieldSettings.SelectionMode | Radiobutton | + | name | value | + | Fields[0].BooleanFieldSettings.Optional | false | And I hit "Save" And I go to "Admin/Contents/Create/Event" And I fill in diff --git a/src/Orchard.Specs/Boolean.feature.cs b/src/Orchard.Specs/Boolean.feature.cs index f074e5cb270..937fa3e320f 100644 --- a/src/Orchard.Specs/Boolean.feature.cs +++ b/src/Orchard.Specs/Boolean.feature.cs @@ -195,40 +195,22 @@ public virtual void CreatingAndUsingBooleanFields() "false"}); #line 67 testRunner.And("I fill in", ((string)(null)), table6, "And "); -#line hidden - TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] { - "name", - "value"}); - table7.AddRow(new string[] { - "Fields[0].BooleanFieldSettings.NotSetLabel", - "May be"}); #line 70 - testRunner.And("I fill in", ((string)(null)), table7, "And "); -#line hidden - TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] { - "name", - "value"}); - table8.AddRow(new string[] { - "Fields[0].BooleanFieldSettings.SelectionMode", - "Radiobutton"}); -#line 73 - testRunner.And("I fill in", ((string)(null)), table8, "And "); -#line 76 testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 77 +#line 71 testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden - TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] { + TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] { "name", "value"}); - table9.AddRow(new string[] { + table7.AddRow(new string[] { "Event.Active.Value", ""}); -#line 78 - testRunner.And("I fill in", ((string)(null)), table9, "And "); -#line 81 +#line 72 + testRunner.And("I fill in", ((string)(null)), table7, "And "); +#line 75 testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 82 +#line 76 testRunner.Then("I should see \"The field Active is mandatory.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden this.ScenarioCleanup(); diff --git a/src/Orchard.Specs/DateTime.feature b/src/Orchard.Specs/DateTime.feature index ac4c8d2d8ec..d5861da701d 100644 --- a/src/Orchard.Specs/DateTime.feature +++ b/src/Orchard.Specs/DateTime.feature @@ -89,9 +89,9 @@ Scenario: Creating and using Date fields # Required & Date and Time When I go to "Admin/ContentTypes/Edit/Event" And I fill in - | name | value | - | Fields[0].DateTimeFieldSettings.Display | DateAndTime | - | Fields[0].DateTimeFieldSettings.Required | true | + | name | value | + | Fields[0].DateTimeFieldSettings.Display | DateAndTime | + | Fields[0].DateTimeFieldSettings.Required | true | And I hit "Save" And I go to "Admin/Contents/Create/Event" Then I should see "Event.EventDate.Editor.Date" @@ -139,6 +139,23 @@ Scenario: Creating and using Date fields When I hit "Save" Then I should see "Date of the event is required." + # The default value should be proposed on creation + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].DateTimeFieldSettings.Display | DateAndTime | + | Fields[0].DateTimeFieldSettings.Editor.Date | 01/31/2016 | + | Fields[0].DateTimeFieldSettings.Editor.Time | 10:00 AM | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should see "Event.EventDate.Editor.Date" + When I hit "Save" + And I am redirected + Then I should see "Your Event has been created." + When I go to "Admin/Contents/List" + Then I should see "Date of the event" + And I should see "1/31/2016 10:00" + Scenario: Creating and using date time fields in another culture # Creating an Event content type @@ -190,4 +207,4 @@ Scenario: Creating and using date time fields in another culture | Event.EventDate.Editor.Time | 18:00 | And I hit "Save" And I am redirected - Then I should see "Your Event has been created." + Then I should see "Your Event has been created." \ No newline at end of file diff --git a/src/Orchard.Specs/DateTime.feature.cs b/src/Orchard.Specs/DateTime.feature.cs index 8439bf7567e..1204750915f 100644 --- a/src/Orchard.Specs/DateTime.feature.cs +++ b/src/Orchard.Specs/DateTime.feature.cs @@ -350,6 +350,41 @@ public virtual void CreatingAndUsingDateFields() testRunner.When("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line 140 testRunner.Then("I should see \"Date of the event is required.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 143 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table15.AddRow(new string[] { + "Fields[0].DateTimeFieldSettings.Display", + "DateAndTime"}); + table15.AddRow(new string[] { + "Fields[0].DateTimeFieldSettings.Editor.Date", + "01/31/2016"}); + table15.AddRow(new string[] { + "Fields[0].DateTimeFieldSettings.Editor.Time", + "10:00 AM"}); +#line 144 + testRunner.And("I fill in", ((string)(null)), table15, "And "); +#line 149 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 150 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 151 + testRunner.Then("I should see \"Event.EventDate.Editor.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 152 + testRunner.When("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line 153 + testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 154 + testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 155 + testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line 156 + testRunner.Then("I should see \"Date of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 157 + testRunner.And("I should see \"1/31/2016 10:00\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden this.ScenarioCleanup(); } @@ -359,119 +394,119 @@ public virtual void CreatingAndUsingDateFields() public virtual void CreatingAndUsingDateTimeFieldsInAnotherCulture() { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Creating and using date time fields in another culture", ((string[])(null))); -#line 142 +#line 159 this.ScenarioSetup(scenarioInfo); -#line 145 +#line 162 testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line 146 +#line 163 testRunner.And("I have installed \"Orchard.Fields\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 147 +#line 164 testRunner.And("I have the file \"Content\\orchard.core.po\" in \"Core\\App_Data\\Localization\\fr-FR\\or" + "chard.core.po\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 148 +#line 165 testRunner.When("I go to \"Admin/ContentTypes\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line 149 +#line 166 testRunner.Then("I should see \"]*>.*?Create new type\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line 150 +#line 167 testRunner.When("I go to \"Admin/ContentTypes/Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden - TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] { + TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] { "name", "value"}); - table15.AddRow(new string[] { + table16.AddRow(new string[] { "DisplayName", "Event"}); - table15.AddRow(new string[] { + table16.AddRow(new string[] { "Name", "Event"}); -#line 151 - testRunner.And("I fill in", ((string)(null)), table15, "And "); -#line 155 +#line 168 + testRunner.And("I fill in", ((string)(null)), table16, "And "); +#line 172 testRunner.And("I hit \"Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 156 +#line 173 testRunner.And("I go to \"Admin/ContentTypes/\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 157 +#line 174 testRunner.Then("I should see \"Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line 160 +#line 177 testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line 161 +#line 178 testRunner.And("I follow \"Add Field\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden - TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] { + TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] { "name", "value"}); - table16.AddRow(new string[] { + table17.AddRow(new string[] { "DisplayName", "Date of the event"}); - table16.AddRow(new string[] { + table17.AddRow(new string[] { "Name", "EventDate"}); - table16.AddRow(new string[] { + table17.AddRow(new string[] { "FieldTypeName", "DateTimeField"}); -#line 162 - testRunner.And("I fill in", ((string)(null)), table16, "And "); -#line 167 +#line 179 + testRunner.And("I fill in", ((string)(null)), table17, "And "); +#line 184 testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 168 +#line 185 testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 169 +#line 186 testRunner.Then("I should see \"The \\\"Date of the event\\\" field has been added.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line 172 +#line 189 testRunner.When("I have \"fr-FR\" as the default culture", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line 173 +#line 190 testRunner.And("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden - TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] { + TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] { "name", "value"}); - table17.AddRow(new string[] { + table18.AddRow(new string[] { "Fields[0].DateTimeFieldSettings.Display", "DateAndTime"}); - table17.AddRow(new string[] { + table18.AddRow(new string[] { "Fields[0].DateTimeFieldSettings.Required", "true"}); -#line 174 - testRunner.And("I fill in", ((string)(null)), table17, "And "); -#line 178 +#line 191 + testRunner.And("I fill in", ((string)(null)), table18, "And "); +#line 195 testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 179 +#line 196 testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden - TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] { + TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] { "name", "value"}); - table18.AddRow(new string[] { + table19.AddRow(new string[] { "Event.EventDate.Editor.Date", "01/31/2012"}); - table18.AddRow(new string[] { + table19.AddRow(new string[] { "Event.EventDate.Editor.Time", "12:00 AM"}); -#line 180 - testRunner.And("I fill in", ((string)(null)), table18, "And "); -#line 184 +#line 197 + testRunner.And("I fill in", ((string)(null)), table19, "And "); +#line 201 testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 185 +#line 202 testRunner.Then("I should see \"Date of the event could not be parsed as a valid date and time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line 186 +#line 203 testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden - TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] { + TechTalk.SpecFlow.Table table20 = new TechTalk.SpecFlow.Table(new string[] { "name", "value"}); - table19.AddRow(new string[] { + table20.AddRow(new string[] { "Event.EventDate.Editor.Date", "31/01/2012"}); - table19.AddRow(new string[] { + table20.AddRow(new string[] { "Event.EventDate.Editor.Time", "18:00"}); -#line 187 - testRunner.And("I fill in", ((string)(null)), table19, "And "); -#line 191 +#line 204 + testRunner.And("I fill in", ((string)(null)), table20, "And "); +#line 208 testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 192 +#line 209 testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 193 +#line 210 testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden this.ScenarioCleanup(); diff --git a/src/Orchard.Specs/Enumeration.feature b/src/Orchard.Specs/Enumeration.feature index 6864b9a834c..bee7b46ecf5 100644 --- a/src/Orchard.Specs/Enumeration.feature +++ b/src/Orchard.Specs/Enumeration.feature @@ -107,3 +107,34 @@ Scenario: Creating and using Enumeration fields And I go to "Admin/Contents/Create/Event" And I hit "Save" Then I should see "The field Location is mandatory." + + # The default value should be proposed on creation + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].EnumerationFieldSettings.Options | Seattle | + | Fields[0].EnumerationFieldSettings.ListMode | Dropdown | + | Fields[0].EnumerationFieldSettings.DefaultValue | Seattle | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should see "selected=\"selected">Seattle" + + # The required attribute should be used + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].EnumerationFieldSettings.Required | true | + | Fields[0].EnumerationFieldSettings.ListMode | Listbox | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should see "required=\"required\"" + + # The required attribute should not be used + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].EnumerationFieldSettings.Required | false | + | Fields[0].EnumerationFieldSettings.ListMode | Listbox | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should not see "required=\"required\"" diff --git a/src/Orchard.Specs/Enumeration.feature.cs b/src/Orchard.Specs/Enumeration.feature.cs index 88a011d4f81..6f62ed7f9f8 100644 --- a/src/Orchard.Specs/Enumeration.feature.cs +++ b/src/Orchard.Specs/Enumeration.feature.cs @@ -273,6 +273,69 @@ public virtual void CreatingAndUsingEnumerationFields() testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 109 testRunner.Then("I should see \"The field Location is mandatory.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 112 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table11.AddRow(new string[] { + "Fields[0].EnumerationFieldSettings.Options", + "Seattle"}); + table11.AddRow(new string[] { + "Fields[0].EnumerationFieldSettings.ListMode", + "Dropdown"}); + table11.AddRow(new string[] { + "Fields[0].EnumerationFieldSettings.DefaultValue", + "Seattle"}); +#line 113 + testRunner.And("I fill in", ((string)(null)), table11, "And "); +#line 118 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 119 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 120 + testRunner.Then("I should see \"selected=\\\"selected\">Seattle\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 123 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table12.AddRow(new string[] { + "Fields[0].EnumerationFieldSettings.Required", + "true"}); + table12.AddRow(new string[] { + "Fields[0].EnumerationFieldSettings.ListMode", + "Listbox"}); +#line 124 + testRunner.And("I fill in", ((string)(null)), table12, "And "); +#line 128 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 129 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 130 + testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 133 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table13.AddRow(new string[] { + "Fields[0].EnumerationFieldSettings.Required", + "false"}); + table13.AddRow(new string[] { + "Fields[0].EnumerationFieldSettings.ListMode", + "Listbox"}); +#line 134 + testRunner.And("I fill in", ((string)(null)), table13, "And "); +#line 138 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 139 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 140 + testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden this.ScenarioCleanup(); } diff --git a/src/Orchard.Specs/Hosting/TraceEnabledDataServicesProviderFactory.cs b/src/Orchard.Specs/Hosting/TraceEnabledDataServicesProviderFactory.cs index 8e79f2b7a51..204e1e1eb8b 100644 --- a/src/Orchard.Specs/Hosting/TraceEnabledDataServicesProviderFactory.cs +++ b/src/Orchard.Specs/Hosting/TraceEnabledDataServicesProviderFactory.cs @@ -13,7 +13,8 @@ public TraceEnabledBuilder(string dataFolder, string connectionString) : base(da } public override IPersistenceConfigurer GetPersistenceConfigurer(bool createDatabase) { var config = (MsSqlCeConfiguration)base.GetPersistenceConfigurer(createDatabase); - config.ShowSql(); + // Uncomment to display SQL while running tests + // config.ShowSql(); return config; } } diff --git a/src/Orchard.Specs/Input.feature b/src/Orchard.Specs/Input.feature index 35a8e761c98..2db7cb2c259 100644 --- a/src/Orchard.Specs/Input.feature +++ b/src/Orchard.Specs/Input.feature @@ -128,3 +128,30 @@ Scenario: Creating and using Input fields When I go to "Admin/Contents/List" Then I should see "Contact:" And I should see "contact@orchardproject.net" + + # The default value should be proposed on creation + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].InputFieldSettings.DefaultValue | contact@orchardproject.net | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should see "value=\"contact@orchardproject.net\"" + + # The required attribute should be used + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].InputFieldSettings.Required | true | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should see "required=\"required\"" + + # The required attribute should not be used + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].InputFieldSettings.Required | false | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should not see "required=\"required\"" \ No newline at end of file diff --git a/src/Orchard.Specs/Input.feature.cs b/src/Orchard.Specs/Input.feature.cs index 2e9c5415871..7d3df6de0cd 100644 --- a/src/Orchard.Specs/Input.feature.cs +++ b/src/Orchard.Specs/Input.feature.cs @@ -297,6 +297,57 @@ public virtual void CreatingAndUsingInputFields() testRunner.Then("I should see \"Contact:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line 130 testRunner.And("I should see \"contact@orchardproject.net\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 133 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table13.AddRow(new string[] { + "Fields[0].InputFieldSettings.DefaultValue", + "contact@orchardproject.net"}); +#line 134 + testRunner.And("I fill in", ((string)(null)), table13, "And "); +#line 137 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 138 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 139 + testRunner.Then("I should see \"value=\\\"contact@orchardproject.net\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 142 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table14.AddRow(new string[] { + "Fields[0].InputFieldSettings.Required", + "true"}); +#line 143 + testRunner.And("I fill in", ((string)(null)), table14, "And "); +#line 146 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 147 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 148 + testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 151 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table15.AddRow(new string[] { + "Fields[0].InputFieldSettings.Required", + "false"}); +#line 152 + testRunner.And("I fill in", ((string)(null)), table15, "And "); +#line 155 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 156 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 157 + testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden this.ScenarioCleanup(); } diff --git a/src/Orchard.Specs/Link.feature b/src/Orchard.Specs/Link.feature index 9ae1de5389d..2916a0a05f7 100644 --- a/src/Orchard.Specs/Link.feature +++ b/src/Orchard.Specs/Link.feature @@ -67,4 +67,31 @@ Scenario: Creating and using Link fields | name | value | | Event.SiteUrl.Value | | And I hit "Save" - Then I should see "Url is required for Site Url." \ No newline at end of file + Then I should see "Url is required for Site Url." + + # The default value should be proposed on creation + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].LinkFieldSettings.DefaultValue | http://www.orchardproject.net | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should see "value=\"http://www.orchardproject.net\"" + + # The required attribute should be used + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].LinkFieldSettings.Required | true | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should see "required=\"required\"" + + # The required attribute should not be used + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].LinkFieldSettings.Required | false | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should not see "required=\"required\"" \ No newline at end of file diff --git a/src/Orchard.Specs/Link.feature.cs b/src/Orchard.Specs/Link.feature.cs index 84b100ed46f..6f3b58a639a 100644 --- a/src/Orchard.Specs/Link.feature.cs +++ b/src/Orchard.Specs/Link.feature.cs @@ -204,6 +204,57 @@ public virtual void CreatingAndUsingLinkFields() testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 70 testRunner.Then("I should see \"Url is required for Site Url.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 73 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table8.AddRow(new string[] { + "Fields[0].LinkFieldSettings.DefaultValue", + "http://www.orchardproject.net"}); +#line 74 + testRunner.And("I fill in", ((string)(null)), table8, "And "); +#line 77 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 78 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 79 + testRunner.Then("I should see \"value=\\\"http://www.orchardproject.net\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 82 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table9.AddRow(new string[] { + "Fields[0].LinkFieldSettings.Required", + "true"}); +#line 83 + testRunner.And("I fill in", ((string)(null)), table9, "And "); +#line 86 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 87 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 88 + testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 91 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table10.AddRow(new string[] { + "Fields[0].LinkFieldSettings.Required", + "false"}); +#line 92 + testRunner.And("I fill in", ((string)(null)), table10, "And "); +#line 95 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 96 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 97 + testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden this.ScenarioCleanup(); } diff --git a/src/Orchard.Specs/MultiTenancy.feature b/src/Orchard.Specs/MultiTenancy.feature index 7134c19c96e..4701fd9ef89 100644 --- a/src/Orchard.Specs/MultiTenancy.feature +++ b/src/Orchard.Specs/MultiTenancy.feature @@ -25,6 +25,7 @@ Scenario: A new tenant is created And I fill in | name | value | | Name | Scott | + | RequestUrlPrefix | scott | And I hit "Save" And I am redirected Then I should see "

Scott\s*

" @@ -37,6 +38,7 @@ Scenario: A new tenant is created with uninitialized state And I fill in | name | value | | Name | Scott | + | RequestUrlPrefix | scott | And I hit "Save" And I am redirected Then I should see "
  • " @@ -199,4 +201,4 @@ Scenario: Listing tenants from command line And I have tenant "Alpha" on "example.org" as "New-site-name" When I execute >tenant list Then I should see "Name: Alpha" - And I should see "Request URL host: example.org" \ No newline at end of file + And I should see "Request URL host: example.org" diff --git a/src/Orchard.Specs/MultiTenancy.feature.cs b/src/Orchard.Specs/MultiTenancy.feature.cs index f2867c62f62..5cee8d1d6ce 100644 --- a/src/Orchard.Specs/MultiTenancy.feature.cs +++ b/src/Orchard.Specs/MultiTenancy.feature.cs @@ -129,6 +129,9 @@ public virtual void ANewTenantIsCreated() table1.AddRow(new string[] { "Name", "Scott"}); + table1.AddRow(new string[] { + "RequestUrlPrefix", + "scott"}); #line 25 testRunner.And("I fill in", ((string)(null)), table1, "And "); #line 28 @@ -163,6 +166,9 @@ public virtual void ANewTenantIsCreatedWithUninitializedState() table2.AddRow(new string[] { "Name", "Scott"}); + table2.AddRow(new string[] { + "RequestUrlPrefix", + "scott"}); #line 37 testRunner.And("I fill in", ((string)(null)), table2, "And "); #line 40 diff --git a/src/Orchard.Specs/Numeric.feature b/src/Orchard.Specs/Numeric.feature index d01d96bc8ce..4e76bfd2fc8 100644 --- a/src/Orchard.Specs/Numeric.feature +++ b/src/Orchard.Specs/Numeric.feature @@ -96,4 +96,39 @@ Scenario: Creating and using numeric fields | Fields[0].NumericFieldSettings.Maximum | b | And I hit "Save" Then I should see "The value 'a' is not valid for Minimum." - And I should see "The value 'b' is not valid for Maximum." \ No newline at end of file + And I should see "The value 'b' is not valid for Maximum." + + # The value should be validated + When I go to "Admin/Contents/Create/Event" + And I fill in + | name | value | + | Event.Guests.Value | a | + And I hit "Save" + Then I should see "Guests is an invalid number" + + # The default value should be proposed on creation + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].NumericFieldSettings.DefaultValue | 1234 | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should see "value=\"1234\"" + + # The required attribute should be used + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].NumericFieldSettings.Required | true | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should see "required=\"required\"" + + # The required attribute should not be used + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].NumericFieldSettings.Required | false | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should not see "required=\"required\"" \ No newline at end of file diff --git a/src/Orchard.Specs/Numeric.feature.cs b/src/Orchard.Specs/Numeric.feature.cs index e90b2c1bf1d..4b7744a4405 100644 --- a/src/Orchard.Specs/Numeric.feature.cs +++ b/src/Orchard.Specs/Numeric.feature.cs @@ -265,6 +265,72 @@ public virtual void CreatingAndUsingNumericFields() testRunner.Then("I should see \"The value 'a' is not valid for Minimum.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line 99 testRunner.And("I should see \"The value 'b' is not valid for Maximum.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 102 + testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table11.AddRow(new string[] { + "Event.Guests.Value", + "a"}); +#line 103 + testRunner.And("I fill in", ((string)(null)), table11, "And "); +#line 106 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 107 + testRunner.Then("I should see \"Guests is an invalid number\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 110 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table12.AddRow(new string[] { + "Fields[0].NumericFieldSettings.DefaultValue", + "1234"}); +#line 111 + testRunner.And("I fill in", ((string)(null)), table12, "And "); +#line 114 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 115 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 116 + testRunner.Then("I should see \"value=\\\"1234\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 119 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table13.AddRow(new string[] { + "Fields[0].NumericFieldSettings.Required", + "true"}); +#line 120 + testRunner.And("I fill in", ((string)(null)), table13, "And "); +#line 123 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 124 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 125 + testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 128 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table14.AddRow(new string[] { + "Fields[0].NumericFieldSettings.Required", + "false"}); +#line 129 + testRunner.And("I fill in", ((string)(null)), table14, "And "); +#line 132 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 133 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 134 + testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden this.ScenarioCleanup(); } diff --git a/src/Orchard.Specs/Orchard.Specs.csproj b/src/Orchard.Specs/Orchard.Specs.csproj index 53136e1ea9e..40369c75248 100644 --- a/src/Orchard.Specs/Orchard.Specs.csproj +++ b/src/Orchard.Specs/Orchard.Specs.csproj @@ -205,6 +205,11 @@ True True + + Text.feature + True + True + Input.feature True @@ -371,6 +376,10 @@ HostComponents.config + + SpecFlowSingleFileGenerator + Text.feature.cs + SpecFlowSingleFileGenerator Input.feature.cs diff --git a/src/Orchard.Specs/Properties/AssemblyInfo.cs b/src/Orchard.Specs/Properties/AssemblyInfo.cs index 16d72e0d4b7..93ca9db20f5 100644 --- a/src/Orchard.Specs/Properties/AssemblyInfo.cs +++ b/src/Orchard.Specs/Properties/AssemblyInfo.cs @@ -30,5 +30,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.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Specs/Text.feature b/src/Orchard.Specs/Text.feature new file mode 100644 index 00000000000..0be4fc69351 --- /dev/null +++ b/src/Orchard.Specs/Text.feature @@ -0,0 +1,101 @@ +Feature: Text Field + In order to add Text content to my types + As an administrator + I want to create, edit and publish Text fields + +Scenario: Creating and using Text fields + + # Creating an Event content type + Given I have installed Orchard + And I have installed "Orchard.Fields" + When I go to "Admin/ContentTypes" + Then I should see "]*>.*?Create new type" + When I go to "Admin/ContentTypes/Create" + And I fill in + | name | value | + | DisplayName | Event | + | Name | Event | + And I hit "Create" + And I go to "Admin/ContentTypes/" + Then I should see "Event" + + # Adding a Text field + When I go to "Admin/ContentTypes/Edit/Event" + And I follow "Add Field" + And I fill in + | name | value | + | DisplayName | Subject | + | Name | Subject | + | FieldTypeName | TextField | + And I hit "Save" + And I am redirected + Then I should see "The \"Subject\" field has been added." + + # The display option should be effective + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].TextFieldSettingsEventsViewModel.Settings.Flavor | Large | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should see "class=\"text large\"" + + # The value should be required + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].TextFieldSettingsEventsViewModel.Settings.Required | true | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + And I fill in + | name | value | + | Event.Subject.Text | | + And I hit "Save" + Then I should see "The field Subject is mandatory." + + # The hint should be displayed + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].TextFieldSettingsEventsViewModel.Settings.Hint | Subject of the event | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should see "Subject of the event" + + # Creating an Event content item + When I go to "Admin/Contents/Create/Event" + Then I should see "Subject" + When I fill in + | name | value | + | Event.Subject.Text | Orchard Harvest 2015 | + And I hit "Save" + And I am redirected + Then I should see "Your Event has been created." + And I should see "Orchard Harvest 2015" + + # The default value should be proposed on creation + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].TextFieldSettingsEventsViewModel.Settings.DefaultValue | Orchard Harvest 2016 | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should see "value=\"Orchard Harvest 2016\"" + + # The required attribute should be used + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].TextFieldSettingsEventsViewModel.Settings.Required | true | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should see "required=\"required\"" + + # The required attribute should not be used + When I go to "Admin/ContentTypes/Edit/Event" + And I fill in + | name | value | + | Fields[0].TextFieldSettingsEventsViewModel.Settings.Required | false | + And I hit "Save" + And I go to "Admin/Contents/Create/Event" + Then I should not see "required=\"required\"" \ No newline at end of file diff --git a/src/Orchard.Specs/Text.feature.cs b/src/Orchard.Specs/Text.feature.cs new file mode 100644 index 00000000000..922a284917d --- /dev/null +++ b/src/Orchard.Specs/Text.feature.cs @@ -0,0 +1,268 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by SpecFlow (http://www.specflow.org/). +// SpecFlow Version:1.9.0.77 +// SpecFlow Generator Version:1.9.0.0 +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +#region Designer generated code +#pragma warning disable +namespace Orchard.Specs +{ + using TechTalk.SpecFlow; + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.9.0.77")] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [NUnit.Framework.TestFixtureAttribute()] + [NUnit.Framework.DescriptionAttribute("Text Field")] + public partial class TextFieldFeature + { + + private static TechTalk.SpecFlow.ITestRunner testRunner; + +#line 1 "Text.feature" +#line hidden + + [NUnit.Framework.TestFixtureSetUpAttribute()] + public virtual void FeatureSetup() + { + testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); + TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Text Field", " In order to add Text content to my types\r\n As an administrator\r\n I want to cr" + + "eate, edit and publish Text fields", ProgrammingLanguage.CSharp, ((string[])(null))); + testRunner.OnFeatureStart(featureInfo); + } + + [NUnit.Framework.TestFixtureTearDownAttribute()] + public virtual void FeatureTearDown() + { + testRunner.OnFeatureEnd(); + testRunner = null; + } + + [NUnit.Framework.SetUpAttribute()] + public virtual void TestInitialize() + { + } + + [NUnit.Framework.TearDownAttribute()] + public virtual void ScenarioTearDown() + { + testRunner.OnScenarioEnd(); + } + + public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) + { + testRunner.OnScenarioStart(scenarioInfo); + } + + public virtual void ScenarioCleanup() + { + testRunner.CollectScenarioErrors(); + } + + [NUnit.Framework.TestAttribute()] + [NUnit.Framework.DescriptionAttribute("Creating and using Text fields")] + public virtual void CreatingAndUsingTextFields() + { + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Creating and using Text fields", ((string[])(null))); +#line 6 +this.ScenarioSetup(scenarioInfo); +#line 9 + testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); +#line 10 + testRunner.And("I have installed \"Orchard.Fields\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 11 + testRunner.When("I go to \"Admin/ContentTypes\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line 12 + testRunner.Then("I should see \"]*>.*?Create new type\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 13 + testRunner.When("I go to \"Admin/ContentTypes/Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table1.AddRow(new string[] { + "DisplayName", + "Event"}); + table1.AddRow(new string[] { + "Name", + "Event"}); +#line 14 + testRunner.And("I fill in", ((string)(null)), table1, "And "); +#line 18 + testRunner.And("I hit \"Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 19 + testRunner.And("I go to \"Admin/ContentTypes/\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 20 + testRunner.Then("I should see \"Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 23 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line 24 + testRunner.And("I follow \"Add Field\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line hidden + TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table2.AddRow(new string[] { + "DisplayName", + "Subject"}); + table2.AddRow(new string[] { + "Name", + "Subject"}); + table2.AddRow(new string[] { + "FieldTypeName", + "TextField"}); +#line 25 + testRunner.And("I fill in", ((string)(null)), table2, "And "); +#line 30 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 31 + testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 32 + testRunner.Then("I should see \"The \\\"Subject\\\" field has been added.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 35 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table3.AddRow(new string[] { + "Fields[0].TextFieldSettingsEventsViewModel.Settings.Flavor", + "Large"}); +#line 36 + testRunner.And("I fill in", ((string)(null)), table3, "And "); +#line 39 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 40 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 41 + testRunner.Then("I should see \"class=\\\"text large\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 44 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table4.AddRow(new string[] { + "Fields[0].TextFieldSettingsEventsViewModel.Settings.Required", + "true"}); +#line 45 + testRunner.And("I fill in", ((string)(null)), table4, "And "); +#line 48 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 49 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line hidden + TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table5.AddRow(new string[] { + "Event.Subject.Text", + ""}); +#line 50 + testRunner.And("I fill in", ((string)(null)), table5, "And "); +#line 53 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 54 + testRunner.Then("I should see \"The field Subject is mandatory.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 57 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table6.AddRow(new string[] { + "Fields[0].TextFieldSettingsEventsViewModel.Settings.Hint", + "Subject of the event"}); +#line 58 + testRunner.And("I fill in", ((string)(null)), table6, "And "); +#line 61 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 62 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 63 + testRunner.Then("I should see \"Subject of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 66 + testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line 67 + testRunner.Then("I should see \"Subject\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line hidden + TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table7.AddRow(new string[] { + "Event.Subject.Text", + "Orchard Harvest 2015"}); +#line 68 + testRunner.When("I fill in", ((string)(null)), table7, "When "); +#line 71 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 72 + testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 73 + testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 74 + testRunner.And("I should see \"Orchard Harvest 2015\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 77 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table8.AddRow(new string[] { + "Fields[0].TextFieldSettingsEventsViewModel.Settings.DefaultValue", + "Orchard Harvest 2016"}); +#line 78 + testRunner.And("I fill in", ((string)(null)), table8, "And "); +#line 81 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 82 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 83 + testRunner.Then("I should see \"value=\\\"Orchard Harvest 2016\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 86 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table9.AddRow(new string[] { + "Fields[0].TextFieldSettingsEventsViewModel.Settings.Required", + "true"}); +#line 87 + testRunner.And("I fill in", ((string)(null)), table9, "And "); +#line 90 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 91 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 92 + testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 95 + testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden + TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table10.AddRow(new string[] { + "Fields[0].TextFieldSettingsEventsViewModel.Settings.Required", + "false"}); +#line 96 + testRunner.And("I fill in", ((string)(null)), table10, "And "); +#line 99 + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 100 + testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 101 + testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line hidden + this.ScenarioCleanup(); + } + } +} +#pragma warning restore +#endregion diff --git a/src/Orchard.Tests.Modules/Properties/AssemblyInfo.cs b/src/Orchard.Tests.Modules/Properties/AssemblyInfo.cs index a8924a7a7d1..942c0ba17bf 100644 --- a/src/Orchard.Tests.Modules/Properties/AssemblyInfo.cs +++ b/src/Orchard.Tests.Modules/Properties/AssemblyInfo.cs @@ -30,5 +30,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.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Tests/DataUtility.cs b/src/Orchard.Tests/DataUtility.cs index 20e12285c06..4c28290f807 100644 --- a/src/Orchard.Tests/DataUtility.cs +++ b/src/Orchard.Tests/DataUtility.cs @@ -23,7 +23,8 @@ public static ISessionFactory CreateSessionFactory(string fileName, params Type[ // .Conventions.AddFromAssemblyOf(); var persistenceModel = AbstractDataServicesProvider.CreatePersistenceModel(types.Select(t => new RecordBlueprint { TableName = "Test_" + t.Name, Type = t }).ToList()); var persistenceConfigurer = new SqlCeDataServicesProvider(fileName).GetPersistenceConfigurer(true/*createDatabase*/); - ((MsSqlCeConfiguration)persistenceConfigurer).ShowSql(); + // Uncomment to display SQL while running tests + // ((MsSqlCeConfiguration)persistenceConfigurer).ShowSql(); return Fluently.Configure() .Database(persistenceConfigurer) diff --git a/src/Orchard.Tests/FluentDbTests.cs b/src/Orchard.Tests/FluentDbTests.cs index 39a038cd44d..70f8df0b082 100644 --- a/src/Orchard.Tests/FluentDbTests.cs +++ b/src/Orchard.Tests/FluentDbTests.cs @@ -46,7 +46,8 @@ public void CreatingSchemaForStatedClassesInTempFile() { var fileName = "temp.sdf"; var persistenceConfigurer = new SqlCeDataServicesProvider(fileName).GetPersistenceConfigurer(true/*createDatabase*/); - ((MsSqlCeConfiguration)persistenceConfigurer).ShowSql(); + // Uncomment to display SQL while running tests + // ((MsSqlCeConfiguration)persistenceConfigurer).ShowSql(); var sessionFactory = Fluently.Configure() .Database(persistenceConfigurer) diff --git a/src/Orchard.Tests/Properties/AssemblyInfo.cs b/src/Orchard.Tests/Properties/AssemblyInfo.cs index 02b2f097a00..dc92960f126 100644 --- a/src/Orchard.Tests/Properties/AssemblyInfo.cs +++ b/src/Orchard.Tests/Properties/AssemblyInfo.cs @@ -33,5 +33,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.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.WarmupStarter/Properties/AssemblyInfo.cs b/src/Orchard.WarmupStarter/Properties/AssemblyInfo.cs index 409508a244f..83166cb9bac 100644 --- a/src/Orchard.WarmupStarter/Properties/AssemblyInfo.cs +++ b/src/Orchard.WarmupStarter/Properties/AssemblyInfo.cs @@ -32,8 +32,8 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] // Enable web application to call this assembly in Full Trust [assembly: AllowPartiallyTrustedCallers] diff --git a/src/Orchard.Web.Tests/Properties/AssemblyInfo.cs b/src/Orchard.Web.Tests/Properties/AssemblyInfo.cs index 266bef2aebf..203fbfe611a 100644 --- a/src/Orchard.Web.Tests/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web.Tests/Properties/AssemblyInfo.cs @@ -33,5 +33,5 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Config/HostComponents.config b/src/Orchard.Web/Config/HostComponents.config index 0e3fddd2570..e6866215114 100644 --- a/src/Orchard.Web/Config/HostComponents.config +++ b/src/Orchard.Web/Config/HostComponents.config @@ -95,7 +95,7 @@ - + @@ -120,5 +120,13 @@ + + + + + + + + diff --git a/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs b/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs index b0dec0d20bf..8b8b92abc94 100644 --- a/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs +++ b/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs @@ -45,10 +45,13 @@ protected override DriverResult Display(ContentPart part, TextField field, strin protected override DriverResult Editor(ContentPart part, TextField field, dynamic shapeHelper) { return ContentShape("Fields_Common_Text_Edit", GetDifferentiator(field, part), () => { + var settings = field.PartFieldDefinition.Settings.GetModel(); + var text = part.IsNew() ? settings.DefaultValue : field.Value; + var viewModel = new TextFieldDriverViewModel { Field = field, - Text = field.Value, - Settings = field.PartFieldDefinition.Settings.GetModel(), + Text = text, + Settings = settings, ContentItem = part.ContentItem }; @@ -58,28 +61,15 @@ protected override DriverResult Editor(ContentPart part, TextField field, dynami protected override DriverResult Editor(ContentPart part, TextField field, IUpdateModel updater, dynamic shapeHelper) { - var viewModel = new TextFieldDriverViewModel { - Field = field, - Text = field.Value, - Settings = field.PartFieldDefinition.Settings.GetModel(), - ContentItem = part.ContentItem - }; + var viewModel = new TextFieldDriverViewModel(); if (updater.TryUpdateModel(viewModel, GetPrefix(field, part), null, null)) { - if (viewModel.Settings.Required && string.IsNullOrWhiteSpace(viewModel.Text)) { - updater.AddModelError("Text", T("The field {0} is mandatory", T(field.DisplayName))); - return ContentShape("Fields_Common_Text_Edit", GetDifferentiator(field, part), - () => shapeHelper.EditorTemplate(TemplateName: "Fields.Common.Text.Edit", Model: viewModel, Prefix: GetPrefix(field, part))); - } + var settings = field.PartFieldDefinition.Settings.GetModel(); field.Value = viewModel.Text; - var settings = field.PartFieldDefinition.Settings.GetModel(); - if (String.IsNullOrEmpty(field.Value) && !String.IsNullOrEmpty(settings.DefaultValue)) { - field.Value = settings.DefaultValue; - } - else { - field.Value = viewModel.Text; + if (settings.Required && String.IsNullOrWhiteSpace(field.Value)) { + updater.AddModelError("Text", T("The field {0} is mandatory", T(field.DisplayName))); } } diff --git a/src/Orchard.Web/Core/Common/Module.txt b/src/Orchard.Web/Core/Common/Module.txt index c22491d28ca..c2ed93b80d9 100644 --- a/src/Orchard.Web/Core/Common/Module.txt +++ b/src/Orchard.Web/Core/Common/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The common module introduces content parts that are going to be used by most content types (common, body, identity). FeatureDescription: Core content parts. diff --git a/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml b/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml index bbd84d3504d..01bdbffded9 100644 --- a/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml +++ b/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml @@ -1,8 +1,6 @@ @model Orchard.Core.Common.ViewModels.TextFieldSettingsEventsViewModel -@* This is a token-less default value editor that can be overridden from features that can depend on Orchard.Tokens. *@ - @Html.TextBoxFor(m => m.Settings.DefaultValue, new { @class = "text large" }) -@T("Default value for the field. If there is no value given for the actual field, this will be filled in. (optional)") +@T("The default value proposed when creating a content item. (optional)") @Html.ValidationMessageFor(m => m.Settings.DefaultValue) \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml index de76c21bbd1..833887b1a7d 100644 --- a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml +++ b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml @@ -12,7 +12,4 @@ @if (HasText(Model.Settings.Hint)) { @Model.Settings.Hint } - @if (!String.IsNullOrWhiteSpace(Model.Settings.DefaultValue)) { - @T("If the field is left empty then the default value will be used.") - } \ No newline at end of file diff --git a/src/Orchard.Web/Core/Containers/Module.txt b/src/Orchard.Web/Core/Containers/Module.txt index 123205ff2b0..5dd850798b7 100644 --- a/src/Orchard.Web/Core/Containers/Module.txt +++ b/src/Orchard.Web/Core/Containers/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The containers module introduces container and containable behaviors for content items. FeatureDescription: Container and containable parts to enable parent-child relationships between content items. diff --git a/src/Orchard.Web/Core/Contents/Module.txt b/src/Orchard.Web/Core/Contents/Module.txt index ae1fd1e0d06..be6ee8d81f5 100644 --- a/src/Orchard.Web/Core/Contents/Module.txt +++ b/src/Orchard.Web/Core/Contents/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The contents module enables the creation of custom content types. Features: diff --git a/src/Orchard.Web/Core/Contents/Views/Admin/Create.cshtml b/src/Orchard.Web/Core/Contents/Views/Admin/Create.cshtml index 3a6d0e64ee3..6c52bf6a7db 100644 --- a/src/Orchard.Web/Core/Contents/Views/Admin/Create.cshtml +++ b/src/Orchard.Web/Core/Contents/Views/Admin/Create.cshtml @@ -8,7 +8,7 @@ Layout.Title = T("New {0}", Html.Raw(typeDisplayName)).Text; } -@using (Html.BeginFormAntiForgeryPost(Url.Action("Create", new { ReturnUrl = Request.QueryString["ReturnUrl"] }), FormMethod.Post, new { enctype = "multipart/form-data" })) { +@using (Html.BeginFormAntiForgeryPost(Url.Action("Create", new { ReturnUrl = Request.QueryString["ReturnUrl"] }), FormMethod.Post, new { enctype = "multipart/form-data", @class = "no-multisubmit" })) { @Html.ValidationSummary() // Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type @Display(Model) diff --git a/src/Orchard.Web/Core/Contents/Views/Admin/Edit.cshtml b/src/Orchard.Web/Core/Contents/Views/Admin/Edit.cshtml index 8361060cdee..a06041fc94f 100644 --- a/src/Orchard.Web/Core/Contents/Views/Admin/Edit.cshtml +++ b/src/Orchard.Web/Core/Contents/Views/Admin/Edit.cshtml @@ -8,7 +8,7 @@ Layout.Title = pageTitle; } -@using (Html.BeginFormAntiForgeryPost(Url.Action("Edit"), FormMethod.Post, new { enctype = "multipart/form-data" })) { +@using (Html.BeginFormAntiForgeryPost(Url.Action("Edit"), FormMethod.Post, new { enctype = "multipart/form-data", @class= "no-multisubmit" })) { @Html.ValidationSummary() // Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type @Display(Model) diff --git a/src/Orchard.Web/Core/Dashboard/Module.txt b/src/Orchard.Web/Core/Dashboard/Module.txt index 00c98816f5a..2af44b6bb82 100644 --- a/src/Orchard.Web/Core/Dashboard/Module.txt +++ b/src/Orchard.Web/Core/Dashboard/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The dashboard module is providing the dashboard screen of the admininstration UI of the application. FeatureDescription: Standard admin dashboard. diff --git a/src/Orchard.Web/Core/Feeds/Module.txt b/src/Orchard.Web/Core/Feeds/Module.txt index 65940b478a9..864977bad68 100644 --- a/src/Orchard.Web/Core/Feeds/Module.txt +++ b/src/Orchard.Web/Core/Feeds/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The Feeds module is providing RSS feeds to content items. FeatureDescription: RSS feeds for content items. diff --git a/src/Orchard.Web/Core/Navigation/Module.txt b/src/Orchard.Web/Core/Navigation/Module.txt index 080349f409d..af528f6259c 100644 --- a/src/Orchard.Web/Core/Navigation/Module.txt +++ b/src/Orchard.Web/Core/Navigation/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The navigation module creates and manages a simple navigation menu for the front-end of the application and allows you to add content items to the admin menu. FeatureDescription: Menu management. diff --git a/src/Orchard.Web/Core/Properties/AssemblyInfo.cs b/src/Orchard.Web/Core/Properties/AssemblyInfo.cs index 3fc2fad1c51..a5f74e88b4d 100644 --- a/src/Orchard.Web/Core/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Core/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Core/Reports/Module.txt b/src/Orchard.Web/Core/Reports/Module.txt index 0ecd0ca4e2b..7b9a61a2102 100644 --- a/src/Orchard.Web/Core/Reports/Module.txt +++ b/src/Orchard.Web/Core/Reports/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The dashboard module is providing the reports screen of the application. FeatureDescription: Reports management. diff --git a/src/Orchard.Web/Core/Scheduling/Module.txt b/src/Orchard.Web/Core/Scheduling/Module.txt index 29c407af70e..8ffc09edf53 100644 --- a/src/Orchard.Web/Core/Scheduling/Module.txt +++ b/src/Orchard.Web/Core/Scheduling/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The scheduling module enables background task scheduling. FeatureDescription: Scheduled background tasks. diff --git a/src/Orchard.Web/Core/Settings/Module.txt b/src/Orchard.Web/Core/Settings/Module.txt index 335b6d45c86..e02610c8887 100644 --- a/src/Orchard.Web/Core/Settings/Module.txt +++ b/src/Orchard.Web/Core/Settings/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The settings module creates site settings that other modules can contribute to. FeatureDescription: Site settings. diff --git a/src/Orchard.Web/Core/Shapes/Module.txt b/src/Orchard.Web/Core/Shapes/Module.txt index 91604839544..5254bf843f2 100644 --- a/src/Orchard.Web/Core/Shapes/Module.txt +++ b/src/Orchard.Web/Core/Shapes/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The shapes module contains core shape templates and display hooks. FeatureDescription: Core shape templates and display hooks. diff --git a/src/Orchard.Web/Core/Title/Module.txt b/src/Orchard.Web/Core/Title/Module.txt index d2817ffb372..7460786cf99 100644 --- a/src/Orchard.Web/Core/Title/Module.txt +++ b/src/Orchard.Web/Core/Title/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The title module enables content items to have titles. FeatureDescription: Title content part. diff --git a/src/Orchard.Web/Core/XmlRpc/Module.txt b/src/Orchard.Web/Core/XmlRpc/Module.txt index 7ead9857d0d..79849d9712f 100644 --- a/src/Orchard.Web/Core/XmlRpc/Module.txt +++ b/src/Orchard.Web/Core/XmlRpc/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The XmlRpc module enables creation of contents from client applications such as LiveWriter. FeatureDescription: XML-RPC opt-in implementation. diff --git a/src/Orchard.Web/Modules/Lucene/Models/LuceneSearchHit.cs b/src/Orchard.Web/Modules/Lucene/Models/LuceneSearchHit.cs index b2032ca4410..ed7949b284e 100644 --- a/src/Orchard.Web/Modules/Lucene/Models/LuceneSearchHit.cs +++ b/src/Orchard.Web/Modules/Lucene/Models/LuceneSearchHit.cs @@ -14,7 +14,7 @@ public LuceneSearchHit(Document document, float score) { _score = score; } - public int ContentItemId { get { return int.Parse(GetString("id")); } } + public int ContentItemId { get { return GetInt("id"); } } public int GetInt(string name) { var field = _doc.GetField(name); diff --git a/src/Orchard.Web/Modules/Lucene/Module.txt b/src/Orchard.Web/Modules/Lucene/Module.txt index f6788e5277c..c6ab9b0b405 100644 --- a/src/Orchard.Web/Modules/Lucene/Module.txt +++ b/src/Orchard.Web/Modules/Lucene/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The Lucene module enables the site to be indexed using Lucene.NET. The index generated by this module can then be used by the search module to provide an integrated full-text search experience to a web site. FeatureDescription: Lucene indexing services. diff --git a/src/Orchard.Web/Modules/Lucene/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Lucene/Properties/AssemblyInfo.cs index fa1a87479de..a768a60354a 100644 --- a/src/Orchard.Web/Modules/Lucene/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Lucene/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Markdown/Markdown.cs b/src/Orchard.Web/Modules/Markdown/Markdown.cs deleted file mode 100644 index 68d33db695a..00000000000 --- a/src/Orchard.Web/Modules/Markdown/Markdown.cs +++ /dev/null @@ -1,1829 +0,0 @@ -/* - * MarkdownSharp - * ------------- - * a C# Markdown processor - * - * Markdown is a text-to-HTML conversion tool for web writers - * Copyright (c) 2004 John Gruber - * http://daringfireball.net/projects/markdown/ - * - * Markdown.NET - * Copyright (c) 2004-2009 Milan Negovan - * http://www.aspnetresources.com - * http://aspnetresources.com/blog/markdown_announced.aspx - * - * MarkdownSharp - * Copyright (c) 2009-2011 Jeff Atwood - * http://stackoverflow.com - * http://www.codinghorror.com/blog/ - * http://code.google.com/p/markdownsharp/ - * - * History: Milan ported the Markdown processor to C#. He granted license to me so I can open source it - * and let the community contribute to and improve MarkdownSharp. - * - */ - -#region Copyright and license - -/* - -Copyright (c) 2009 - 2010 Jeff Atwood - -http://www.opensource.org/licenses/mit-license.php - -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. - -Copyright (c) 2003-2004 John Gruber - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* Neither the name "Markdown" nor the names of its contributors may - be used to endorse or promote products derived from this software - without specific prior written permission. - -This software is provided by the copyright holders and contributors "as -is" and any express or implied warranties, including, but not limited -to, the implied warranties of merchantability and fitness for a -particular purpose are disclaimed. In no event shall the copyright owner -or contributors be liable for any direct, indirect, incidental, special, -exemplary, or consequential damages (including, but not limited to, -procurement of substitute goods or services; loss of use, data, or -profits; or business interruption) however caused and on any theory of -liability, whether in contract, strict liability, or tort (including -negligence or otherwise) arising in any way out of the use of this -software, even if advised of the possibility of such damage. -*/ - -#endregion - -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Text; -using System.Text.RegularExpressions; - -namespace MarkdownSharp -{ - - public class MarkdownOptions - { - /// - /// when true, (most) bare plain URLs are auto-hyperlinked - /// WARNING: this is a significant deviation from the markdown spec - /// - public bool AutoHyperlink { get; set; } - /// - /// when true, RETURN becomes a literal newline - /// WARNING: this is a significant deviation from the markdown spec - /// - public bool AutoNewlines { get; set; } - /// - /// use ">" for HTML output, or " />" for XHTML output - /// - public string EmptyElementSuffix { get; set; } - /// - /// when false, email addresses will never be auto-linked - /// WARNING: this is a significant deviation from the markdown spec - /// - public bool LinkEmails { get; set; } - /// - /// when true, bold and italic require non-word characters on either side - /// WARNING: this is a significant deviation from the markdown spec - /// - public bool StrictBoldItalic { get; set; } - - /// - /// when true, asterisks may be used for intraword emphasis - /// this does nothing if StrictBoldItalic is false - /// - public bool AsteriskIntraWordEmphasis { get; set; } - } - - - /// - /// Markdown is a text-to-HTML conversion tool for web writers. - /// Markdown allows you to write using an easy-to-read, easy-to-write plain text format, - /// then convert it to structurally valid XHTML (or HTML). - /// - public class Markdown - { - private const string _version = "1.13"; - - #region Constructors and Options - - /// - /// Create a new Markdown instance using default options - /// - public Markdown() : this(false) - { - } - - /// - /// Create a new Markdown instance and optionally load options from a configuration - /// file. There they should be stored in the appSettings section, available options are: - /// - /// Markdown.StrictBoldItalic (true/false) - /// Markdown.EmptyElementSuffix (">" or " />" without the quotes) - /// Markdown.LinkEmails (true/false) - /// Markdown.AutoNewLines (true/false) - /// Markdown.AutoHyperlink (true/false) - /// Markdown.AsteriskIntraWordEmphasis (true/false) - /// - /// - public Markdown(bool loadOptionsFromConfigFile) - { - if (!loadOptionsFromConfigFile) return; - - var settings = ConfigurationManager.AppSettings; - foreach (string key in settings.Keys) - { - switch (key) - { - case "Markdown.AutoHyperlink": - _autoHyperlink = Convert.ToBoolean(settings[key]); - break; - case "Markdown.AutoNewlines": - _autoNewlines = Convert.ToBoolean(settings[key]); - break; - case "Markdown.EmptyElementSuffix": - _emptyElementSuffix = settings[key]; - break; - case "Markdown.LinkEmails": - _linkEmails = Convert.ToBoolean(settings[key]); - break; - case "Markdown.StrictBoldItalic": - _strictBoldItalic = Convert.ToBoolean(settings[key]); - break; - case "Markdown.AsteriskIntraWordEmphasis": - _asteriskIntraWordEmphasis = Convert.ToBoolean(settings[key]); - break; - } - } - } - - /// - /// Create a new Markdown instance and set the options from the MarkdownOptions object. - /// - public Markdown(MarkdownOptions options) - { - _autoHyperlink = options.AutoHyperlink; - _autoNewlines = options.AutoNewlines; - _emptyElementSuffix = options.EmptyElementSuffix; - _linkEmails = options.LinkEmails; - _strictBoldItalic = options.StrictBoldItalic; - _asteriskIntraWordEmphasis = options.AsteriskIntraWordEmphasis; - } - - - /// - /// use ">" for HTML output, or " />" for XHTML output - /// - public string EmptyElementSuffix - { - get { return _emptyElementSuffix; } - set { _emptyElementSuffix = value; } - } - private string _emptyElementSuffix = " />"; - - /// - /// when false, email addresses will never be auto-linked - /// WARNING: this is a significant deviation from the markdown spec - /// - public bool LinkEmails - { - get { return _linkEmails; } - set { _linkEmails = value; } - } - private bool _linkEmails = true; - - /// - /// when true, bold and italic require non-word characters on either side - /// WARNING: this is a significant deviation from the markdown spec - /// - public bool StrictBoldItalic - { - get { return _strictBoldItalic; } - set { _strictBoldItalic = value; } - } - private bool _strictBoldItalic = false; - - /// - /// when true, asterisks may be used for intraword emphasis - /// this does nothing if StrictBoldItalic is false - /// - public bool AsteriskIntraWordEmphasis - { - get { return _asteriskIntraWordEmphasis; } - set { _asteriskIntraWordEmphasis = value; } - } - private bool _asteriskIntraWordEmphasis = false; - - /// - /// when true, RETURN becomes a literal newline - /// WARNING: this is a significant deviation from the markdown spec - /// - public bool AutoNewLines - { - get { return _autoNewlines; } - set { _autoNewlines = value; } - } - private bool _autoNewlines = false; - - /// - /// when true, (most) bare plain URLs are auto-hyperlinked - /// WARNING: this is a significant deviation from the markdown spec - /// - public bool AutoHyperlink - { - get { return _autoHyperlink; } - set { _autoHyperlink = value; } - } - private bool _autoHyperlink = false; - - #endregion - - private enum TokenType { Text, Tag } - - private struct Token - { - public Token(TokenType type, string value) - { - this.Type = type; - this.Value = value; - } - public TokenType Type; - public string Value; - } - - /// - /// maximum nested depth of [] and () supported by the transform; implementation detail - /// - private const int _nestDepth = 6; - - /// - /// Tabs are automatically converted to spaces as part of the transform - /// this constant determines how "wide" those tabs become in spaces - /// - private const int _tabWidth = 4; - - private const string _markerUL = @"[*+-]"; - private const string _markerOL = @"\d+[.]"; - - private static readonly Dictionary _escapeTable; - private static readonly Dictionary _invertedEscapeTable; - private static readonly Dictionary _backslashEscapeTable; - - private readonly Dictionary _urls = new Dictionary(); - private readonly Dictionary _titles = new Dictionary(); - private readonly Dictionary _htmlBlocks = new Dictionary(); - - private int _listLevel; - private static string AutoLinkPreventionMarker = "\x1AP"; // temporarily replaces "://" where auto-linking shouldn't happen - - /// - /// In the static constuctor we'll initialize what stays the same across all transforms. - /// - static Markdown() - { - // Table of hash values for escaped characters: - _escapeTable = new Dictionary(); - _invertedEscapeTable = new Dictionary(); - // Table of hash value for backslash escaped characters: - _backslashEscapeTable = new Dictionary(); - - string backslashPattern = ""; - - foreach (char c in @"\`*_{}[]()>#+-.!/:") - { - string key = c.ToString(); - string hash = GetHashKey(key, isHtmlBlock: false); - _escapeTable.Add(key, hash); - _invertedEscapeTable.Add(hash, key); - _backslashEscapeTable.Add(@"\" + key, hash); - backslashPattern += Regex.Escape(@"\" + key) + "|"; - } - - _backslashEscapes = new Regex(backslashPattern.Substring(0, backslashPattern.Length - 1), RegexOptions.Compiled); - } - - /// - /// current version of MarkdownSharp; - /// see http://code.google.com/p/markdownsharp/ for the latest code or to contribute - /// - public string Version - { - get { return _version; } - } - - /// - /// Transforms the provided Markdown-formatted text to HTML; - /// see http://en.wikipedia.org/wiki/Markdown - /// - /// - /// The order in which other subs are called here is - /// essential. Link and image substitutions need to happen before - /// EscapeSpecialChars(), so that any *'s or _'s in the a - /// and img tags get encoded. - /// - public string Transform(string text) - { - if (String.IsNullOrEmpty(text)) return ""; - - Setup(); - - text = Normalize(text); - - text = HashHTMLBlocks(text); - text = StripLinkDefinitions(text); - text = RunBlockGamut(text); - text = Unescape(text); - - Cleanup(); - - return text + "\n"; - } - - - /// - /// Perform transformations that form block-level tags like paragraphs, headers, and list items. - /// - private string RunBlockGamut(string text, bool unhash = true) - { - text = DoHeaders(text); - text = DoHorizontalRules(text); - text = DoLists(text); - text = DoCodeBlocks(text); - text = DoBlockQuotes(text); - - // We already ran HashHTMLBlocks() before, in Markdown(), but that - // was to escape raw HTML in the original Markdown source. This time, - // we're escaping the markup we've just created, so that we don't wrap - //

    tags around block-level tags. - text = HashHTMLBlocks(text); - - text = FormParagraphs(text, unhash: unhash); - - return text; - } - - - ///

    - /// Perform transformations that occur *within* block-level tags like paragraphs, headers, and list items. - /// - private string RunSpanGamut(string text) - { - text = DoCodeSpans(text); - text = EscapeSpecialCharsWithinTagAttributes(text); - text = EscapeBackslashes(text); - - // Images must come first, because ![foo][f] looks like an anchor. - text = DoImages(text); - text = DoAnchors(text); - - // Must come after DoAnchors(), because you can use < and > - // delimiters in inline links like [this](). - text = DoAutoLinks(text); - - text = text.Replace(AutoLinkPreventionMarker, "://"); - - text = EncodeAmpsAndAngles(text); - text = DoItalicsAndBold(text); - text = DoHardBreaks(text); - - return text; - } - - private static Regex _newlinesLeadingTrailing = new Regex(@"^\n+|\n+\z", RegexOptions.Compiled); - private static Regex _newlinesMultiple = new Regex(@"\n{2,}", RegexOptions.Compiled); - private static Regex _leadingWhitespace = new Regex(@"^[ ]*", RegexOptions.Compiled); - - private static Regex _htmlBlockHash = new Regex("\x1AH\\d+H", RegexOptions.Compiled); - - /// - /// splits on two or more newlines, to form "paragraphs"; - /// each paragraph is then unhashed (if it is a hash and unhashing isn't turned off) or wrapped in HTML p tag - /// - private string FormParagraphs(string text, bool unhash = true) - { - // split on two or more newlines - string[] grafs = _newlinesMultiple.Split(_newlinesLeadingTrailing.Replace(text, "")); - - for (int i = 0; i < grafs.Length; i++) - { - if (grafs[i].StartsWith("\x1AH")) - { - // unhashify HTML blocks - if (unhash) - { - int sanityCheck = 50; // just for safety, guard against an infinite loop - bool keepGoing = true; // as long as replacements where made, keep going - while (keepGoing && sanityCheck > 0) - { - keepGoing = false; - grafs[i] = _htmlBlockHash.Replace(grafs[i], match => - { - keepGoing = true; - return _htmlBlocks[match.Value]; - }); - sanityCheck--; - } - /* if (keepGoing) - { - // Logging of an infinite loop goes here. - // If such a thing should happen, please open a new issue on http://code.google.com/p/markdownsharp/ - // with the input that caused it. - }*/ - } - } - else - { - // do span level processing inside the block, then wrap result in

    tags - grafs[i] = _leadingWhitespace.Replace(RunSpanGamut(grafs[i]), "

    ") + "

    "; - } - } - - return string.Join("\n\n", grafs); - } - - - private void Setup() - { - // Clear the global hashes. If we don't clear these, you get conflicts - // from other articles when generating a page which contains more than - // one article (e.g. an index page that shows the N most recent - // articles): - _urls.Clear(); - _titles.Clear(); - _htmlBlocks.Clear(); - _listLevel = 0; - } - - private void Cleanup() - { - Setup(); - } - - private static string _nestedBracketsPattern; - - /// - /// Reusable pattern to match balanced [brackets]. See Friedl's - /// "Mastering Regular Expressions", 2nd Ed., pp. 328-331. - /// - private static string GetNestedBracketsPattern() - { - // in other words [this] and [this[also]] and [this[also[too]]] - // up to _nestDepth - if (_nestedBracketsPattern == null) - _nestedBracketsPattern = - RepeatString(@" - (?> # Atomic matching - [^\[\]]+ # Anything other than brackets - | - \[ - ", _nestDepth) + RepeatString( - @" \] - )*" - , _nestDepth); - return _nestedBracketsPattern; - } - - private static string _nestedParensPattern; - - /// - /// Reusable pattern to match balanced (parens). See Friedl's - /// "Mastering Regular Expressions", 2nd Ed., pp. 328-331. - /// - private static string GetNestedParensPattern() - { - // in other words (this) and (this(also)) and (this(also(too))) - // up to _nestDepth - if (_nestedParensPattern == null) - _nestedParensPattern = - RepeatString(@" - (?> # Atomic matching - [^()\s]+ # Anything other than parens or whitespace - | - \( - ", _nestDepth) + RepeatString( - @" \) - )*" - , _nestDepth); - return _nestedParensPattern; - } - - private static Regex _linkDef = new Regex(string.Format(@" - ^[ ]{{0,{0}}}\[([^\[\]]+)\]: # id = $1 - [ ]* - \n? # maybe *one* newline - [ ]* - ? # url = $2 - [ ]* - \n? # maybe one newline - [ ]* - (?: - (?<=\s) # lookbehind for whitespace - [""(] - (.+?) # title = $3 - ["")] - [ ]* - )? # title is optional - (?:\n+|\Z)", _tabWidth - 1), RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled); - - /// - /// Strips link definitions from text, stores the URLs and titles in hash references. - /// - /// - /// ^[id]: url "optional title" - /// - private string StripLinkDefinitions(string text) - { - return _linkDef.Replace(text, new MatchEvaluator(LinkEvaluator)); - } - - private string LinkEvaluator(Match match) - { - string linkID = match.Groups[1].Value.ToLowerInvariant(); - _urls[linkID] = EncodeAmpsAndAngles(match.Groups[2].Value); - - if (match.Groups[3] != null && match.Groups[3].Length > 0) - _titles[linkID] = match.Groups[3].Value.Replace("\"", """); - - return ""; - } - - // compiling this monster regex results in worse performance. trust me. - private static Regex _blocksHtml = new Regex(GetBlockPattern(), RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace); - - - /// - /// derived pretty much verbatim from PHP Markdown - /// - private static string GetBlockPattern() - { - - // Hashify HTML blocks: - // We only want to do this for block-level HTML tags, such as headers, - // lists, and tables. That's because we still want to wrap

    s around - // "paragraphs" that are wrapped in non-block-level tags, such as anchors, - // phrase emphasis, and spans. The list of tags we're looking for is - // hard-coded: - // - // * List "a" is made of tags which can be both inline or block-level. - // These will be treated block-level when the start tag is alone on - // its line, otherwise they're not matched here and will be taken as - // inline later. - // * List "b" is made of tags which are always block-level; - // - string blockTagsA = "ins|del"; - string blockTagsB = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|script|noscript|form|fieldset|iframe|math"; - - // Regular expression for the content of a block tag. - string attr = @" - (?> # optional tag attributes - \s # starts with whitespace - (?> - [^>""/]+ # text outside quotes - | - /+(?!>) # slash not followed by > - | - ""[^""]*"" # text inside double quotes (tolerate >) - | - '[^']*' # text inside single quotes (tolerate >) - )* - )? - "; - - string content = RepeatString(@" - (?> - [^<]+ # content without tag - | - <\2 # nested opening tag - " + attr + @" # attributes - (?> - /> - | - >", _nestDepth) + // end of opening tag - ".*?" + // last level nested tag content - RepeatString(@" - # closing nested tag - ) - | - <(?!/\2\s*> # other tags with a different name - ) - )*", _nestDepth); - - string content2 = content.Replace(@"\2", @"\3"); - - // First, look for nested blocks, e.g.: - //

    - //
    - // tags for inner block must be indented. - //
    - //
    - // - // The outermost tags must start at the left margin for this to match, and - // the inner nested divs must be indented. - // We need to do this before the next, more liberal match, because the next - // match will start at the first `
    ` and stop at the first `
    `. - string pattern = @" - (?> - (?> - (?<=\n) # Starting at the beginning of a line - | # or - \A\n? # the beginning of the doc - ) - ( # save in $1 - - # Match from `\n` to `\n`, handling nested tags - # in between. - - <($block_tags_b_re) # start tag = $2 - $attr> # attributes followed by > and \n - $content # content, support nesting - # the matching end tag - [ ]* # trailing spaces - (?=\n+|\Z) # followed by a newline or end of document - - | # Special version for tags of group a. - - <($block_tags_a_re) # start tag = $3 - $attr>[ ]*\n # attributes followed by > - $content2 # content, support nesting - # the matching end tag - [ ]* # trailing spaces - (?=\n+|\Z) # followed by a newline or end of document - - | # Special case just for
    . It was easier to make a special - # case than to make the other regex more complicated. - - [ ]{0,$less_than_tab} -
    # the matching end tag - [ ]* - (?=\n{2,}|\Z) # followed by a blank line or end of document - - | # Special case for standalone HTML comments: - - (?<=\n\n|\A) # preceded by a blank line or start of document - [ ]{0,$less_than_tab} - (?s: - - ) - [ ]* - (?=\n{2,}|\Z) # followed by a blank line or end of document - - | # PHP and ASP-style processor instructions ( - ) - [ ]* - (?=\n{2,}|\Z) # followed by a blank line or end of document - - ) - )"; - - pattern = pattern.Replace("$less_than_tab", (_tabWidth - 1).ToString()); - pattern = pattern.Replace("$block_tags_b_re", blockTagsB); - pattern = pattern.Replace("$block_tags_a_re", blockTagsA); - pattern = pattern.Replace("$attr", attr); - pattern = pattern.Replace("$content2", content2); - pattern = pattern.Replace("$content", content); - - return pattern; - } - - /// - /// replaces any block-level HTML blocks with hash entries - /// - private string HashHTMLBlocks(string text) - { - return _blocksHtml.Replace(text, new MatchEvaluator(HtmlEvaluator)); - } - - private string HtmlEvaluator(Match match) - { - string text = match.Groups[1].Value; - string key = GetHashKey(text, isHtmlBlock: true); - _htmlBlocks[key] = text; - - return string.Concat("\n\n", key, "\n\n"); - } - - private static string GetHashKey(string s, bool isHtmlBlock) - { - var delim = isHtmlBlock ? 'H' : 'E'; - return "\x1A" + delim + Math.Abs(s.GetHashCode()).ToString() + delim; - } - - private static Regex _htmlTokens = new Regex(@" - ()| # match - (<\?.*?\?>)| # match " + - RepeatString(@" - (<[A-Za-z\/!$](?:[^<>]|", _nestDepth) + RepeatString(@")*>)", _nestDepth) + - " # match and ", - RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.ExplicitCapture | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled); - - /// - /// returns an array of HTML tokens comprising the input string. Each token is - /// either a tag (possibly with nested, tags contained therein, such - /// as <a href="<MTFoo>">, or a run of text between tags. Each element of the - /// array is a two-element array; the first is either 'tag' or 'text'; the second is - /// the actual value. - /// - private List TokenizeHTML(string text) - { - int pos = 0; - int tagStart = 0; - var tokens = new List(); - - // this regex is derived from the _tokenize() subroutine in Brad Choate's MTRegex plugin. - // http://www.bradchoate.com/past/mtregex.php - foreach (Match m in _htmlTokens.Matches(text)) - { - tagStart = m.Index; - - if (pos < tagStart) - tokens.Add(new Token(TokenType.Text, text.Substring(pos, tagStart - pos))); - - tokens.Add(new Token(TokenType.Tag, m.Value)); - pos = tagStart + m.Length; - } - - if (pos < text.Length) - tokens.Add(new Token(TokenType.Text, text.Substring(pos, text.Length - pos))); - - return tokens; - } - - - private static Regex _anchorRef = new Regex(string.Format(@" - ( # wrap whole match in $1 - \[ - ({0}) # link text = $2 - \] - - [ ]? # one optional space - (?:\n[ ]*)? # one optional newline followed by spaces - - \[ - (.*?) # id = $3 - \] - )", GetNestedBracketsPattern()), RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled); - - private static Regex _anchorInline = new Regex(string.Format(@" - ( # wrap whole match in $1 - \[ - ({0}) # link text = $2 - \] - \( # literal paren - [ ]* - ({1}) # href = $3 - [ ]* - ( # $4 - (['""]) # quote char = $5 - (.*?) # title = $6 - \5 # matching quote - [ ]* # ignore any spaces between closing quote and ) - )? # title is optional - \) - )", GetNestedBracketsPattern(), GetNestedParensPattern()), - RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled); - - private static Regex _anchorRefShortcut = new Regex(@" - ( # wrap whole match in $1 - \[ - ([^\[\]]+) # link text = $2; can't contain [ or ] - \] - )", RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled); - - /// - /// Turn Markdown link shortcuts into HTML anchor tags - /// - /// - /// [link text](url "title") - /// [link text][id] - /// [id] - /// - private string DoAnchors(string text) - { - if (!text.Contains("[")) - return text; - - // First, handle reference-style links: [link text] [id] - text = _anchorRef.Replace(text, new MatchEvaluator(AnchorRefEvaluator)); - - // Next, inline-style links: [link text](url "optional title") or [link text](url "optional title") - text = _anchorInline.Replace(text, new MatchEvaluator(AnchorInlineEvaluator)); - - // Last, handle reference-style shortcuts: [link text] - // These must come last in case you've also got [link test][1] - // or [link test](/foo) - text = _anchorRefShortcut.Replace(text, new MatchEvaluator(AnchorRefShortcutEvaluator)); - return text; - } - - private string SaveFromAutoLinking(string s) - { - return s.Replace("://", AutoLinkPreventionMarker); - } - - private string AnchorRefEvaluator(Match match) - { - string wholeMatch = match.Groups[1].Value; - string linkText = SaveFromAutoLinking(match.Groups[2].Value); - string linkID = match.Groups[3].Value.ToLowerInvariant(); - - string result; - - // for shortcut links like [this][]. - if (linkID == "") - linkID = linkText.ToLowerInvariant(); - - if (_urls.ContainsKey(linkID)) - { - string url = _urls[linkID]; - - url = AttributeSafeUrl(url); - - result = ""; - } - else - result = wholeMatch; - - return result; - } - - private string AnchorRefShortcutEvaluator(Match match) - { - string wholeMatch = match.Groups[1].Value; - string linkText = SaveFromAutoLinking(match.Groups[2].Value); - string linkID = Regex.Replace(linkText.ToLowerInvariant(), @"[ ]*\n[ ]*", " "); // lower case and remove newlines / extra spaces - - string result; - - if (_urls.ContainsKey(linkID)) - { - string url = _urls[linkID]; - - url = AttributeSafeUrl(url); - - result = ""; - } - else - result = wholeMatch; - - return result; - } - - - private string AnchorInlineEvaluator(Match match) - { - string linkText = SaveFromAutoLinking(match.Groups[2].Value); - string url = match.Groups[3].Value; - string title = match.Groups[6].Value; - string result; - - if (url.StartsWith("<") && url.EndsWith(">")) - url = url.Substring(1, url.Length - 2); // remove <>'s surrounding URL, if present - - url = AttributeSafeUrl(url); - - result = string.Format("{0}", linkText); - return result; - } - - private static Regex _imagesRef = new Regex(@" - ( # wrap whole match in $1 - !\[ - (.*?) # alt text = $2 - \] - - [ ]? # one optional space - (?:\n[ ]*)? # one optional newline followed by spaces - - \[ - (.*?) # id = $3 - \] - - )", RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.Compiled); - - private static Regex _imagesInline = new Regex(String.Format(@" - ( # wrap whole match in $1 - !\[ - (.*?) # alt text = $2 - \] - \s? # one optional whitespace character - \( # literal paren - [ ]* - ({0}) # href = $3 - [ ]* - ( # $4 - (['""]) # quote char = $5 - (.*?) # title = $6 - \5 # matching quote - [ ]* - )? # title is optional - \) - )", GetNestedParensPattern()), - RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.Compiled); - - /// - /// Turn Markdown image shortcuts into HTML img tags. - /// - /// - /// ![alt text][id] - /// ![alt text](url "optional title") - /// - private string DoImages(string text) - { - if (!text.Contains("![")) - return text; - - // First, handle reference-style labeled images: ![alt text][id] - text = _imagesRef.Replace(text, new MatchEvaluator(ImageReferenceEvaluator)); - - // Next, handle inline images: ![alt text](url "optional title") - // Don't forget: encode * and _ - text = _imagesInline.Replace(text, new MatchEvaluator(ImageInlineEvaluator)); - - return text; - } - - // This prevents the creation of horribly broken HTML when some syntax ambiguities - // collide. It likely still doesn't do what the user meant, but at least we're not - // outputting garbage. - private string EscapeImageAltText(string s) - { - s = EscapeBoldItalic(s); - s = Regex.Replace(s, @"[\[\]()]", m => _escapeTable[m.ToString()]); - return s; - } - - private string ImageReferenceEvaluator(Match match) - { - string wholeMatch = match.Groups[1].Value; - string altText = match.Groups[2].Value; - string linkID = match.Groups[3].Value.ToLowerInvariant(); - - // for shortcut links like ![this][]. - if (linkID == "") - linkID = altText.ToLowerInvariant(); - - if (_urls.ContainsKey(linkID)) - { - string url = _urls[linkID]; - string title = null; - - if (_titles.ContainsKey(linkID)) - title = _titles[linkID]; - - return ImageTag(url, altText, title); - } - else - { - // If there's no such link ID, leave intact: - return wholeMatch; - } - } - - private string ImageInlineEvaluator(Match match) - { - string alt = match.Groups[2].Value; - string url = match.Groups[3].Value; - string title = match.Groups[6].Value; - - if (url.StartsWith("<") && url.EndsWith(">")) - url = url.Substring(1, url.Length - 2); // Remove <>'s surrounding URL, if present - - return ImageTag(url, alt, title); - } - - private string ImageTag(string url, string altText, string title) - { - altText = EscapeImageAltText(AttributeEncode(altText)); - url = AttributeSafeUrl(url); - var result = string.Format("\"{1}\"", - /// Turn Markdown headers into HTML header tags - /// - /// - /// Header 1 - /// ======== - /// - /// Header 2 - /// -------- - /// - /// # Header 1 - /// ## Header 2 - /// ## Header 2 with closing hashes ## - /// ... - /// ###### Header 6 - /// - private string DoHeaders(string text) - { - text = _headerSetext.Replace(text, new MatchEvaluator(SetextHeaderEvaluator)); - text = _headerAtx.Replace(text, new MatchEvaluator(AtxHeaderEvaluator)); - return text; - } - - private string SetextHeaderEvaluator(Match match) - { - string header = match.Groups[1].Value; - int level = match.Groups[2].Value.StartsWith("=") ? 1 : 2; - return string.Format("{0}\n\n", RunSpanGamut(header), level); - } - - private string AtxHeaderEvaluator(Match match) - { - string header = match.Groups[2].Value; - int level = match.Groups[1].Value.Length; - return string.Format("{0}\n\n", RunSpanGamut(header), level); - } - - - private static Regex _horizontalRules = new Regex(@" - ^[ ]{0,3} # Leading space - ([-*_]) # $1: First marker - (?> # Repeated marker group - [ ]{0,2} # Zero, one, or two spaces. - \1 # Marker character - ){2,} # Group repeated at least twice - [ ]* # Trailing spaces - $ # End of line. - ", RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled); - - /// - /// Turn Markdown horizontal rules into HTML hr tags - /// - /// - /// *** - /// * * * - /// --- - /// - - - - /// - private string DoHorizontalRules(string text) - { - return _horizontalRules.Replace(text, " - /// Turn Markdown lists into HTML ul and ol and li tags - /// - private string DoLists(string text, bool isInsideParagraphlessListItem = false) - { - // We use a different prefix before nested lists than top-level lists. - // See extended comment in _ProcessListItems(). - if (_listLevel > 0) - text = _listNested.Replace(text, GetListEvaluator(isInsideParagraphlessListItem)); - else - text = _listTopLevel.Replace(text, GetListEvaluator(false)); - - return text; - } - - private MatchEvaluator GetListEvaluator(bool isInsideParagraphlessListItem = false) - { - return new MatchEvaluator(match => - { - string list = match.Groups[1].Value; - string marker = match.Groups[3].Value; - string listType = Regex.IsMatch(marker, _markerUL) ? "ul" : "ol"; - string result; - string start = ""; - if (listType == "ol") - { - var firstNumber = int.Parse(marker.Substring(0, marker.Length - 1)); - if (firstNumber != 1 && firstNumber != 0) - start = " start=\"" + firstNumber + "\""; - } - - result = ProcessListItems(list, listType == "ul" ? _markerUL : _markerOL, isInsideParagraphlessListItem); - - result = string.Format("<{0}{1}>\n{2}\n", listType, start, result); - return result; - }); - } - - /// - /// Process the contents of a single ordered or unordered list, splitting it - /// into individual list items. - /// - private string ProcessListItems(string list, string marker, bool isInsideParagraphlessListItem = false) - { - // The listLevel global keeps track of when we're inside a list. - // Each time we enter a list, we increment it; when we leave a list, - // we decrement. If it's zero, we're not in a list anymore. - - // We do this because when we're not inside a list, we want to treat - // something like this: - - // I recommend upgrading to version - // 8. Oops, now this line is treated - // as a sub-list. - - // As a single paragraph, despite the fact that the second line starts - // with a digit-period-space sequence. - - // Whereas when we're inside a list (or sub-list), that line will be - // treated as the start of a sub-list. What a kludge, huh? This is - // an aspect of Markdown's syntax that's hard to parse perfectly - // without resorting to mind-reading. Perhaps the solution is to - // change the syntax rules such that sub-lists must start with a - // starting cardinal number; e.g. "1." or "a.". - - _listLevel++; - - // Trim trailing blank lines: - list = Regex.Replace(list, @"\n{2,}\z", "\n"); - - string pattern = string.Format( - @"(^[ ]*) # leading whitespace = $1 - ({0}) [ ]+ # list marker = $2 - ((?s:.+?) # list item text = $3 - (\n+)) - (?= (\z | \1 ({0}) [ ]+))", marker); - - bool lastItemHadADoubleNewline = false; - - // has to be a closure, so subsequent invocations can share the bool - MatchEvaluator ListItemEvaluator = (Match match) => - { - string item = match.Groups[3].Value; - - bool endsWithDoubleNewline = item.EndsWith("\n\n"); - bool containsDoubleNewline = endsWithDoubleNewline || item.Contains("\n\n"); - - if (containsDoubleNewline || lastItemHadADoubleNewline) - // we could correct any bad indentation here.. - item = RunBlockGamut(Outdent(item) + "\n", unhash: false); - else - { - // recursion for sub-lists - item = DoLists(Outdent(item), isInsideParagraphlessListItem: true); - item = item.TrimEnd('\n'); - if (!isInsideParagraphlessListItem) // only the outer-most item should run this, otherwise it's run multiple times for the inner ones - item = RunSpanGamut(item); - } - lastItemHadADoubleNewline = endsWithDoubleNewline; - return string.Format("
  • {0}
  • \n", item); - }; - - list = Regex.Replace(list, pattern, new MatchEvaluator(ListItemEvaluator), - RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline); - _listLevel--; - return list; - } - - private static Regex _codeBlock = new Regex(string.Format(@" - (?:\n\n|\A\n?) - ( # $1 = the code block -- one or more lines, starting with a space - (?: - (?:[ ]{{{0}}}) # Lines must start with a tab-width of spaces - .*\n+ - )+ - ) - ((?=^[ ]{{0,{0}}}[^ \t\n])|\Z) # Lookahead for non-space at line-start, or end of doc", - _tabWidth), RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled); - - /// - /// /// Turn Markdown 4-space indented code into HTML pre code blocks - /// - private string DoCodeBlocks(string text) - { - text = _codeBlock.Replace(text, new MatchEvaluator(CodeBlockEvaluator)); - return text; - } - - private string CodeBlockEvaluator(Match match) - { - string codeBlock = match.Groups[1].Value; - - codeBlock = EncodeCode(Outdent(codeBlock)); - codeBlock = _newlinesLeadingTrailing.Replace(codeBlock, ""); - - return string.Concat("\n\n
    ", codeBlock, "\n
    \n\n"); - } - - private static Regex _codeSpan = new Regex(@" - (? - /// Turn Markdown `code spans` into HTML code tags - /// - private string DoCodeSpans(string text) - { - // * You can use multiple backticks as the delimiters if you want to - // include literal backticks in the code span. So, this input: - // - // Just type ``foo `bar` baz`` at the prompt. - // - // Will translate to: - // - //

    Just type foo `bar` baz at the prompt.

    - // - // There's no arbitrary limit to the number of backticks you - // can use as delimters. If you need three consecutive backticks - // in your code, use four for delimiters, etc. - // - // * You can use spaces to get literal backticks at the edges: - // - // ... type `` `bar` `` ... - // - // Turns to: - // - // ... type `bar` ... - // - - return _codeSpan.Replace(text, new MatchEvaluator(CodeSpanEvaluator)); - } - - private string CodeSpanEvaluator(Match match) - { - string span = match.Groups[2].Value; - span = Regex.Replace(span, @"^[ ]*", ""); // leading whitespace - span = Regex.Replace(span, @"[ ]*$", ""); // trailing whitespace - span = EncodeCode(span); - span = SaveFromAutoLinking(span); // to prevent auto-linking. Not necessary in code *blocks*, but in code spans. - - return string.Concat("", span, ""); - } - - private static Regex _bold = new Regex(@"(\*\*|__) (?=\S) (.+?[*_]*) (?<=\S) \1", - RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.Compiled); - private static Regex _semiStrictBold = new Regex(@"(?=.[*_]|[*_])(^|(?=\W__|(?!\*)[\W_]\*\*|\w\*\*\w).)(\*\*|__)(?!\2)(?=\S)((?:|.*?(?!\2).)(?=\S_|\w|\S\*\*(?:[\W_]|$)).)(?=__(?:\W|$)|\*\*(?:[^*]|$))\2", - RegexOptions.Singleline | RegexOptions.Compiled); - private static Regex _strictBold = new Regex(@"(^|[\W_])(?:(?!\1)|(?=^))(\*|_)\2(?=\S)(.*?\S)\2\2(?!\2)(?=[\W_]|$)", - RegexOptions.Singleline | RegexOptions.Compiled); - - private static Regex _italic = new Regex(@"(\*|_) (?=\S) (.+?) (?<=\S) \1", - RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.Compiled); - private static Regex _semiStrictItalic = new Regex(@"(?=.[*_]|[*_])(^|(?=\W_|(?!\*)(?:[\W_]\*|\D\*(?=\w)\D)).)(\*|_)(?!\2\2\2)(?=\S)((?:(?!\2).)*?(?=[^\s_]_|(?=\w)\D\*\D|[^\s*]\*(?:[\W_]|$)).)(?=_(?:\W|$)|\*(?:[^*]|$))\2", - RegexOptions.Singleline | RegexOptions.Compiled); - private static Regex _strictItalic = new Regex(@"(^|[\W_])(?:(?!\1)|(?=^))(\*|_)(?=\S)((?:(?!\2).)*?\S)\2(?!\2)(?=[\W_]|$)", - RegexOptions.Singleline | RegexOptions.Compiled); - - /// - /// Turn Markdown *italics* and **bold** into HTML strong and em tags - /// - private string DoItalicsAndBold(string text) - { - if (!(text.Contains("*") || text.Contains("_"))) - return text; - // must go first, then - if (_strictBoldItalic) - { - if (_asteriskIntraWordEmphasis) - { - text = _semiStrictBold.Replace(text, "$1$3"); - text = _semiStrictItalic.Replace(text, "$1$3"); - - } - else - { - text = _strictBold.Replace(text, "$1$3"); - text = _strictItalic.Replace(text, "$1$3"); - - } - } - else - { - text = _bold.Replace(text, "$2"); - text = _italic.Replace(text, "$2"); - } - return text; - } - - /// - /// Turn markdown line breaks (two space at end of line) into HTML break tags - /// - private string DoHardBreaks(string text) - { - if (_autoNewlines) - text = Regex.Replace(text, @"\n", string.Format("[ ]? # '>' at the start of a line - .+\n # rest of the first line - (.+\n)* # subsequent consecutive lines - \n* # blanks - )+ - )", RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline | RegexOptions.Compiled); - - /// - /// Turn Markdown > quoted blocks into HTML blockquote blocks - /// - private string DoBlockQuotes(string text) - { - return _blockquote.Replace(text, new MatchEvaluator(BlockQuoteEvaluator)); - } - - private string BlockQuoteEvaluator(Match match) - { - string bq = match.Groups[1].Value; - - bq = Regex.Replace(bq, @"^[ ]*>[ ]?", "", RegexOptions.Multiline); // trim one level of quoting - bq = Regex.Replace(bq, @"^[ ]+$", "", RegexOptions.Multiline); // trim whitespace-only lines - bq = RunBlockGamut(bq); // recurse - - bq = Regex.Replace(bq, @"^", " ", RegexOptions.Multiline); - - // These leading spaces screw with
     content, so we need to fix that:
    -            bq = Regex.Replace(bq, @"(\s*
    .+?
    )", new MatchEvaluator(BlockQuoteEvaluator2), RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline); - - bq = string.Format("
    \n{0}\n
    ", bq); - string key = GetHashKey(bq, isHtmlBlock: true); - _htmlBlocks[key] = bq; - - return "\n\n" + key + "\n\n"; - } - - private string BlockQuoteEvaluator2(Match match) - { - return Regex.Replace(match.Groups[1].Value, @"^ ", "", RegexOptions.Multiline); - } - - private const string _charInsideUrl = @"[-A-Z0-9+&@#/%?=~_|\[\]\(\)!:,\.;" + "\x1a]"; - private const string _charEndingUrl = "[-A-Z0-9+&@#/%=~_|\\[\\])]"; - - private static Regex _autolinkBare = new Regex(@"(<|="")?\b(https?|ftp)(://" + _charInsideUrl + "*" + _charEndingUrl + ")(?=$|\\W)", - RegexOptions.IgnoreCase | RegexOptions.Compiled); - - private static Regex _endCharRegex = new Regex(_charEndingUrl, RegexOptions.IgnoreCase | RegexOptions.Compiled); - - private static string handleTrailingParens(Match match) - { - // The first group is essentially a negative lookbehind -- if there's a < or a =", we don't touch this. - // We're not using a *real* lookbehind, because of links with in links, like - // With a real lookbehind, the full link would never be matched, and thus the http://www.google.com *would* be matched. - // With the simulated lookbehind, the full link *is* matched (just not handled, because of this early return), causing - // the google link to not be matched again. - if (match.Groups[1].Success) - return match.Value; - - var protocol = match.Groups[2].Value; - var link = match.Groups[3].Value; - if (!link.EndsWith(")")) - return "<" + protocol + link + ">"; - var level = 0; - foreach (Match c in Regex.Matches(link, "[()]")) - { - if (c.Value == "(") - { - if (level <= 0) - level = 1; - else - level++; - } - else - { - level--; - } - } - var tail = ""; - if (level < 0) - { - link = Regex.Replace(link, @"\){1," + (-level) + "}$", m => { tail = m.Value; return ""; }); - } - if (tail.Length > 0) - { - var lastChar = link[link.Length - 1]; - if (!_endCharRegex.IsMatch(lastChar.ToString())) - { - tail = lastChar + tail; - link = link.Substring(0, link.Length - 1); - } - } - return "<" + protocol + link + ">" + tail; - } - - /// - /// Turn angle-delimited URLs into HTML anchor tags - /// - /// - /// <http://www.example.com> - /// - private string DoAutoLinks(string text) - { - - if (_autoHyperlink) - { - // fixup arbitrary URLs by adding Markdown < > so they get linked as well - // note that at this point, all other URL in the text are already hyperlinked as - // *except* for the case - text = _autolinkBare.Replace(text, handleTrailingParens); - } - - // Hyperlinks: - text = Regex.Replace(text, "<((https?|ftp):[^'\">\\s]+)>", new MatchEvaluator(HyperlinkEvaluator)); - - if (_linkEmails) - { - // Email addresses: - string pattern = - @"< - (?:mailto:)? - ( - [-.\w]+ - \@ - [-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+ - ) - >"; - text = Regex.Replace(text, pattern, new MatchEvaluator(EmailEvaluator), RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); - } - - return text; - } - - private string HyperlinkEvaluator(Match match) - { - string link = match.Groups[1].Value; - string url = AttributeSafeUrl(link); - return string.Format("{1}", url, link); - } - - private string EmailEvaluator(Match match) - { - string email = Unescape(match.Groups[1].Value); - - // - // Input: an email address, e.g. "foo@example.com" - // - // Output: the email address as a mailto link, with each character - // of the address encoded as either a decimal or hex entity, in - // the hopes of foiling most address harvesting spam bots. E.g.: - // - // foo - // @example.com - // - // Based by a filter by Matthew Wickline, posted to the BBEdit-Talk - // mailing list: - // - email = "mailto:" + email; - - // leave ':' alone (to spot mailto: later) - email = EncodeEmailAddress(email); - - email = string.Format("{0}", email); - - // strip the mailto: from the visible part - email = Regex.Replace(email, "\">.+?:", "\">"); - return email; - } - - - private static Regex _outDent = new Regex(@"^[ ]{1," + _tabWidth + @"}", RegexOptions.Multiline | RegexOptions.Compiled); - - /// - /// Remove one level of line-leading spaces - /// - private string Outdent(string block) - { - return _outDent.Replace(block, ""); - } - - - #region Encoding and Normalization - - - /// - /// encodes email address randomly - /// roughly 10% raw, 45% hex, 45% dec - /// note that @ is always encoded and : never is - /// - private string EncodeEmailAddress(string addr) - { - var sb = new StringBuilder(addr.Length * 5); - var rand = new Random(); - int r; - foreach (char c in addr) - { - r = rand.Next(1, 100); - if ((r > 90 || c == ':') && c != '@') - sb.Append(c); // m - else if (r < 45) - sb.AppendFormat("&#x{0:x};", (int)c); // m - else - sb.AppendFormat("&#{0};", (int)c); // m - } - return sb.ToString(); - } - - private static Regex _codeEncoder = new Regex(@"&|<|>|\\|\*|_|\{|\}|\[|\]", RegexOptions.Compiled); - - /// - /// Encode/escape certain Markdown characters inside code blocks and spans where they are literals - /// - private string EncodeCode(string code) - { - return _codeEncoder.Replace(code, EncodeCodeEvaluator); - } - private string EncodeCodeEvaluator(Match match) - { - switch (match.Value) - { - // Encode all ampersands; HTML entities are not - // entities within a Markdown code span. - case "&": - return "&"; - // Do the angle bracket song and dance - case "<": - return "<"; - case ">": - return ">"; - // escape characters that are magic in Markdown - default: - return _escapeTable[match.Value]; - } - } - - - private static Regex _amps = new Regex(@"&(?!((#[0-9]+)|(#[xX][a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9]*));)", RegexOptions.ExplicitCapture | RegexOptions.Compiled); - private static Regex _angles = new Regex(@"<(?![A-Za-z/?\$!])", RegexOptions.ExplicitCapture | RegexOptions.Compiled); - - /// - /// Encode any ampersands (that aren't part of an HTML entity) and left or right angle brackets - /// - private string EncodeAmpsAndAngles(string s) - { - s = _amps.Replace(s, "&"); - s = _angles.Replace(s, "<"); - return s; - } - - private static Regex _backslashEscapes; - - /// - /// Encodes any escaped characters such as \`, \*, \[ etc - /// - private string EscapeBackslashes(string s) - { - return _backslashEscapes.Replace(s, new MatchEvaluator(EscapeBackslashesEvaluator)); - } - private string EscapeBackslashesEvaluator(Match match) - { - return _backslashEscapeTable[match.Value]; - } - - private static Regex _unescapes = new Regex("\x1A" + "E\\d+E", RegexOptions.Compiled); - - /// - /// swap back in all the special characters we've hidden - /// - private string Unescape(string s) - { - return _unescapes.Replace(s, new MatchEvaluator(UnescapeEvaluator)); - } - private string UnescapeEvaluator(Match match) - { - return _invertedEscapeTable[match.Value]; - } - - - /// - /// escapes Bold [ * ] and Italic [ _ ] characters - /// - private string EscapeBoldItalic(string s) - { - s = s.Replace("*", _escapeTable["*"]); - s = s.Replace("_", _escapeTable["_"]); - return s; - } - - private static string AttributeEncode(string s) - { - return s.Replace(">", ">").Replace("<", "<").Replace("\"", """).Replace("'", "'"); - } - - private static string AttributeSafeUrl(string s) - { - s = AttributeEncode(s); - foreach (var c in "*_:()[]") - s = s.Replace(c.ToString(), _escapeTable[c.ToString()]); - return s; - } - - /// - /// Within tags -- meaning between < and > -- encode [\ ` * _] so they - /// don't conflict with their use in Markdown for code, italics and strong. - /// We're replacing each such character with its corresponding hash - /// value; this is likely overkill, but it should prevent us from colliding - /// with the escape values by accident. - /// - private string EscapeSpecialCharsWithinTagAttributes(string text) - { - var tokens = TokenizeHTML(text); - - // now, rebuild text from the tokens - var sb = new StringBuilder(text.Length); - - foreach (var token in tokens) - { - string value = token.Value; - - if (token.Type == TokenType.Tag) - { - value = value.Replace(@"\", _escapeTable[@"\"]); - - if (_autoHyperlink && value.StartsWith("(?=.)", _escapeTable[@"`"]); - value = EscapeBoldItalic(value); - } - - sb.Append(value); - } - - return sb.ToString(); - } - - /// - /// convert all tabs to _tabWidth spaces; - /// standardizes line endings from DOS (CR LF) or Mac (CR) to UNIX (LF); - /// makes sure text ends with a couple of newlines; - /// removes any blank lines (only spaces) in the text - /// - private string Normalize(string text) - { - var output = new StringBuilder(text.Length); - var line = new StringBuilder(); - bool valid = false; - - for (int i = 0; i < text.Length; i++) - { - switch (text[i]) - { - case '\n': - if (valid) output.Append(line); - output.Append('\n'); - line.Length = 0; valid = false; - break; - case '\r': - if ((i < text.Length - 1) && (text[i + 1] != '\n')) - { - if (valid) output.Append(line); - output.Append('\n'); - line.Length = 0; valid = false; - } - break; - case '\t': - int width = (_tabWidth - line.Length % _tabWidth); - for (int k = 0; k < width; k++) - line.Append(' '); - break; - case '\x1A': - break; - default: - if (!valid && text[i] != ' ') valid = true; - line.Append(text[i]); - break; - } - } - - if (valid) output.Append(line); - output.Append('\n'); - - // add two newlines to the end before return - return output.Append("\n\n").ToString(); - } - - #endregion - - /// - /// this is to emulate what's evailable in PHP - /// - private static string RepeatString(string text, int count) - { - var sb = new StringBuilder(text.Length * count); - for (int i = 0; i < count; i++) - sb.Append(text); - return sb.ToString(); - } - - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Markdown/Markdown.csproj b/src/Orchard.Web/Modules/Markdown/Markdown.csproj index af053d362f9..8ea8612ee68 100644 --- a/src/Orchard.Web/Modules/Markdown/Markdown.csproj +++ b/src/Orchard.Web/Modules/Markdown/Markdown.csproj @@ -49,6 +49,10 @@ false + + ..\..\..\packages\StackExchange.MarkdownSharp.1.5.1.0\lib\net35\MarkdownSharp.dll + True + ..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll True @@ -150,7 +154,6 @@ - diff --git a/src/Orchard.Web/Modules/Markdown/Module.txt b/src/Orchard.Web/Modules/Markdown/Module.txt index 7c87c4b111b..d30066988d7 100644 --- a/src/Orchard.Web/Modules/Markdown/Module.txt +++ b/src/Orchard.Web/Modules/Markdown/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The Markdown module enables rich text contents to be created using the Markdown syntax. FeatureDescription: Markdown editor. diff --git a/src/Orchard.Web/Modules/Markdown/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Markdown/Properties/AssemblyInfo.cs index 4d1397b674d..8198dc1114c 100644 --- a/src/Orchard.Web/Modules/Markdown/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Markdown/Properties/AssemblyInfo.cs @@ -26,6 +26,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Markdown/packages.config b/src/Orchard.Web/Modules/Markdown/packages.config index 6729ced4977..cfadffb91ae 100644 --- a/src/Orchard.Web/Modules/Markdown/packages.config +++ b/src/Orchard.Web/Modules/Markdown/packages.config @@ -4,4 +4,5 @@ + \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Alias/AdminMenu.cs b/src/Orchard.Web/Modules/Orchard.Alias/AdminMenu.cs index 4ca50c2cd76..880ed2d0003 100644 --- a/src/Orchard.Web/Modules/Orchard.Alias/AdminMenu.cs +++ b/src/Orchard.Web/Modules/Orchard.Alias/AdminMenu.cs @@ -11,7 +11,6 @@ public class AdminMenu : INavigationProvider { public string MenuName { get { return "admin"; } } public void GetNavigation(NavigationBuilder builder) { - builder.AddImageSet("aliases"); builder.Add(T("Aliases"), "1.4.1", menu => { menu.LinkToFirstChild(true); @@ -20,4 +19,4 @@ public void GetNavigation(NavigationBuilder builder) { }); } } -} \ No newline at end of file +} diff --git a/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Updater/AliasHolderUpdaterTask.cs b/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Updater/AliasHolderUpdaterTask.cs deleted file mode 100644 index 186986bf7ac..00000000000 --- a/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Updater/AliasHolderUpdaterTask.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using Orchard.Environment; -using Orchard.Tasks; -using Orchard.Logging; - -namespace Orchard.Alias.Implementation.Updater { - public class AliasHolderUpdaterTask : IOrchardShellEvents, IBackgroundTask { - private readonly IAliasHolderUpdater _aliasHolderUpdater; - - public ILogger Logger { get; set; } - - public AliasHolderUpdaterTask(IAliasHolderUpdater aliasHolderUpdater) { - _aliasHolderUpdater = aliasHolderUpdater; - Logger = NullLogger.Instance; - } - - void IOrchardShellEvents.Activated() { - Refresh(); - } - - void IOrchardShellEvents.Terminating() { - } - - private void Refresh() { - try { - _aliasHolderUpdater.Refresh(); - } - catch (Exception ex) { - Logger.Error(ex, "Exception during Alias refresh"); - } - } - - public void Sweep() { - Refresh(); - } - } -} diff --git a/src/Orchard.Web/Modules/Orchard.Alias/Module.txt b/src/Orchard.Web/Modules/Orchard.Alias/Module.txt index 18be4459333..3e91ce806d5 100644 --- a/src/Orchard.Web/Modules/Orchard.Alias/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Alias/Module.txt @@ -2,7 +2,7 @@ Name: Alias AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: Maps friendly urls to specific module actions. FeatureDescription: Maps friendly urls to specific module actions. diff --git a/src/Orchard.Web/Modules/Orchard.Alias/Orchard.Alias.csproj b/src/Orchard.Web/Modules/Orchard.Alias/Orchard.Alias.csproj index c66bbaadd8a..647bbd846a9 100644 --- a/src/Orchard.Web/Modules/Orchard.Alias/Orchard.Alias.csproj +++ b/src/Orchard.Web/Modules/Orchard.Alias/Orchard.Alias.csproj @@ -135,7 +135,6 @@ - @@ -195,4 +194,4 @@ - \ No newline at end of file + diff --git a/src/Orchard.Web/Modules/Orchard.Alias/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Alias/Properties/AssemblyInfo.cs index a5f749ed451..f0cc542715d 100644 --- a/src/Orchard.Web/Modules/Orchard.Alias/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.Alias/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.AntiSpam/Module.txt b/src/Orchard.Web/Modules/Orchard.AntiSpam/Module.txt index 047d98737c3..8e7dc25a276 100644 --- a/src/Orchard.Web/Modules/Orchard.AntiSpam/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.AntiSpam/Module.txt @@ -2,7 +2,7 @@ Name: AntiSpam AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: Provides anti-spam services to protect your content from malicious submissions. Features: diff --git a/src/Orchard.Web/Modules/Orchard.AntiSpam/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.AntiSpam/Properties/AssemblyInfo.cs index a230f73b809..2e5c0e6ccdc 100644 --- a/src/Orchard.Web/Modules/Orchard.AntiSpam/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.AntiSpam/Properties/AssemblyInfo.cs @@ -29,6 +29,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.ArchiveLater/Module.txt b/src/Orchard.Web/Modules/Orchard.ArchiveLater/Module.txt index e91fbab8c68..e65c2eb1461 100644 --- a/src/Orchard.Web/Modules/Orchard.ArchiveLater/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.ArchiveLater/Module.txt @@ -3,7 +3,7 @@ Path: ArchiveLater AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The ArchiveLater module introduces scheduled archiving functionality. FeatureDescription: Scheduled archiving. diff --git a/src/Orchard.Web/Modules/Orchard.ArchiveLater/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.ArchiveLater/Properties/AssemblyInfo.cs index 2d6d6067bba..9e2a2fdc797 100644 --- a/src/Orchard.Web/Modules/Orchard.ArchiveLater/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.ArchiveLater/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.AuditTrail/Module.txt b/src/Orchard.Web/Modules/Orchard.AuditTrail/Module.txt index c783e426590..7a897560f08 100644 --- a/src/Orchard.Web/Modules/Orchard.AuditTrail/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.AuditTrail/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: Provides a log for recording and viewing back-end changes. Features: @@ -19,7 +19,7 @@ Features: Name: Audit Trail Trimming Description: Provides a background task that regularly deletes old audit trail records. Category: Security - Dependencies: Orchard.AuditTrail, Orchard.TaskLease + Dependencies: Orchard.AuditTrail Orchard.AuditTrail.Users: Name: Audit Trail User Events Description: Provides audit trail support for user related events. diff --git a/src/Orchard.Web/Modules/Orchard.AuditTrail/Orchard.AuditTrail.csproj b/src/Orchard.Web/Modules/Orchard.AuditTrail/Orchard.AuditTrail.csproj index ef72e6f09a0..e5c0173b42e 100644 --- a/src/Orchard.Web/Modules/Orchard.AuditTrail/Orchard.AuditTrail.csproj +++ b/src/Orchard.Web/Modules/Orchard.AuditTrail/Orchard.AuditTrail.csproj @@ -135,7 +135,7 @@ - + @@ -213,10 +213,6 @@ {d10ad48f-407d-4db5-a328-173ec7cb010f} Orchard.Roles - - {3f72a4e9-7b72-4260-b010-c16ec54f9baf} - Orchard.TaskLease - {79aed36e-abd0-4747-93d3-8722b042454b} Orchard.Users diff --git a/src/Orchard.Web/Modules/Orchard.AuditTrail/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.AuditTrail/Properties/AssemblyInfo.cs index 7823daea7df..fdf18925d8a 100644 --- a/src/Orchard.Web/Modules/Orchard.AuditTrail/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.AuditTrail/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.AuditTrail/Services/RecycleBin.cs b/src/Orchard.Web/Modules/Orchard.AuditTrail/Services/RecycleBin.cs index 4bc6711fd7b..778dff569e8 100644 --- a/src/Orchard.Web/Modules/Orchard.AuditTrail/Services/RecycleBin.cs +++ b/src/Orchard.Web/Modules/Orchard.AuditTrail/Services/RecycleBin.cs @@ -28,7 +28,7 @@ public IPageOfItems List(int page, int pageSize) where T: class, IContent var totalCount = query.List().Count; query.SetFirstResult((page - 1) * pageSize); - query.SetFetchSize(pageSize); + query.SetMaxResults(pageSize); var contentItems = LoadContentItems(query); diff --git a/src/Orchard.Web/Modules/Orchard.Autoroute/Drivers/AutoroutePartDriver.cs b/src/Orchard.Web/Modules/Orchard.Autoroute/Drivers/AutoroutePartDriver.cs index 268d81a57b3..06e6ae49666 100644 --- a/src/Orchard.Web/Modules/Orchard.Autoroute/Drivers/AutoroutePartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Autoroute/Drivers/AutoroutePartDriver.cs @@ -175,7 +175,7 @@ protected override void Exporting(AutoroutePart part, ExportContentContext conte context.Element(part.PartDefinition.Name).SetAttributeValue("CustomPattern", part.Record.CustomPattern); context.Element(part.PartDefinition.Name).SetAttributeValue("UseCustomPattern", part.Record.UseCustomPattern); context.Element(part.PartDefinition.Name).SetAttributeValue("UseCulturePattern", part.Record.UseCulturePattern); - context.Element(part.PartDefinition.Name).SetAttributeValue("PromoteToHomePage", part.UseCustomPattern); + context.Element(part.PartDefinition.Name).SetAttributeValue("PromoteToHomePage", part.PromoteToHomePage); } } } diff --git a/src/Orchard.Web/Modules/Orchard.Autoroute/Module.txt b/src/Orchard.Web/Modules/Orchard.Autoroute/Module.txt index 9a8bceb8d0b..cd073b38e98 100644 --- a/src/Orchard.Web/Modules/Orchard.Autoroute/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Autoroute/Module.txt @@ -2,7 +2,7 @@ Name: Autoroute AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: Description for the module Features: diff --git a/src/Orchard.Web/Modules/Orchard.Autoroute/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Autoroute/Properties/AssemblyInfo.cs index f7dd7c436c7..c8e79d52a2f 100644 --- a/src/Orchard.Web/Modules/Orchard.Autoroute/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.Autoroute/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Module.txt b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Module.txt index 0aeda74ac70..581f7265c24 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: Microsoft Open Technologies, Inc Website: http://msopentech.com -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: Provides integration of Microsoft Azure Media Services functionality into Orchard. Features: @@ -10,4 +10,4 @@ Features: Name: Microsoft Azure Media Services Description: Provides integration of Microsoft Azure Media Services functionality into Orchard. Category: Hosting - Dependencies: Orchard.MediaLibrary, Orchard.PublishLater, Orchard.TaskLease, Orchard.Resources + Dependencies: Orchard.MediaLibrary, Orchard.PublishLater, Orchard.Resources diff --git a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Orchard.Azure.MediaServices.csproj b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Orchard.Azure.MediaServices.csproj index 2237e3660f7..520eff940c3 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Orchard.Azure.MediaServices.csproj +++ b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Orchard.Azure.MediaServices.csproj @@ -276,7 +276,7 @@ - + @@ -307,10 +307,6 @@ {c889167c-e52c-4a65-a419-224b3d1b957d} Orchard.PublishLater - - {3f72a4e9-7b72-4260-b010-c16ec54f9baf} - Orchard.TaskLease - diff --git a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Properties/AssemblyInfo.cs index d290a4c706b..074fbef69b4 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/CloudVideo.Edit.Assets.cshtml b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/CloudVideo.Edit.Assets.cshtml index 2e802c05329..b4b8a709900 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/CloudVideo.Edit.Assets.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/CloudVideo.Edit.Assets.cshtml @@ -8,7 +8,7 @@ Style.Include("cloudmedia-progress.css", "cloudmedia-progress.min.css"); Script.Require("ShapesBase"); - Script.Require("JQuery"); + Script.Include("cloudmedia-admin-common.js", "cloudmedia-admin-common.min.js"); var cloudVideoPart = (CloudVideoPart)Model.CloudVideoPart; diff --git a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/CloudVideoPlayer.cshtml b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/CloudVideoPlayer.cshtml index 04bf2ec7d71..55489876e4c 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/CloudVideoPlayer.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/CloudVideoPlayer.cshtml @@ -6,7 +6,7 @@ @{ Style.Include("cloudmedia-videoplayer.css", "cloudmedia-videoplayer.min.css"); - Script.Require("JQuery").AtFoot(); + Script.Require("jQuery").AtFoot(); Script.Include("Lib/swfobject.js", "Lib/swfobject.min.js").AtFoot(); Script.Include("Lib/dash.all.js", "Lib/dash.all.min.js").AtFoot(); Script.Require("Uri").AtFoot(); diff --git a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/Job/Create.cshtml b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/Job/Create.cshtml index 22d4b21193b..e0110f62582 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/Job/Create.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/Job/Create.cshtml @@ -4,7 +4,7 @@ @using Orchard.Azure.MediaServices.ViewModels.Jobs @{ Style.Include("cloudmedia-admin-job.css", "cloudmedia-admin-job.min.css"); - Script.Require("JQuery"); + Script.Require("jQuery"); Script.Include("cloudmedia-admin-job.js", "cloudmedia-admin-job.min.js"); var taskProvider = (ITaskProvider)Model.TaskProvider; diff --git a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/Settings/Index.cshtml b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/Settings/Index.cshtml index 81181890f93..a005e0da667 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/Settings/Index.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/Settings/Index.cshtml @@ -6,7 +6,7 @@ Style.Include("cloudmedia-admin-settings.css", "cloudmedia-admin-settings.min.css"); Style.Include("cloudmedia-tabs.css", "cloudmedia-tabs.min.css"); - Script.Require("JQuery").AtFoot(); + Script.Require("jQueryUI").AtFoot(); Script.Require("jQueryUI_Tabs").AtFoot(); Script.Require("Knockout").AtFoot(); diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Module.txt b/src/Orchard.Web/Modules/Orchard.Azure/Module.txt index 6da671abd99..deefb6ec4f5 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Azure/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: Provides a set of Orchard service implementations targeting Microsoft Azure services. Category: Hosting diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Azure/Properties/AssemblyInfo.cs index 5b30a328b60..ea8efe11ce4 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.Azure/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/AzureFileSystem.cs b/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/AzureFileSystem.cs index 267d234ea1c..8b6a9e71738 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/AzureFileSystem.cs +++ b/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/AzureFileSystem.cs @@ -308,9 +308,9 @@ public IStorageFile CreateFile(string path) { public string GetPublicUrl(string path) { path = ConvertToRelativeUriPath(path); - var uri = new UriBuilder(Container.GetBlockBlobReference(String.Concat(_root, path)).Uri); - if (!string.IsNullOrEmpty(_publicHostName)) uri.Host = _publicHostName; - return uri.ToString(); + var uriBuilder = new UriBuilder(Container.GetBlockBlobReference(String.Concat(_root, path)).Uri); + if (!string.IsNullOrEmpty(_publicHostName)) uriBuilder.Host = _publicHostName; + return uriBuilder.Uri.ToString(); } private class AzureBlobFileStorage : IStorageFile { diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs b/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs index 618b57d31dc..483e77259da 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs +++ b/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs @@ -4,6 +4,7 @@ using Orchard.Environment.Configuration; using Orchard.Environment.Extensions; using Orchard.FileSystems.Media; +using System; namespace Orchard.Azure.Services.FileSystems.Media { @@ -64,8 +65,10 @@ public void SaveStream(string path, Stream inputStream) { /// The corresponding local path. public string GetStoragePath(string url) { EnsureInitialized(); - if (url.StartsWith(_absoluteRoot)) { - return HttpUtility.UrlDecode(url.Substring(Combine(_absoluteRoot, "/").Length)); + var rootUri = new Uri(_absoluteRoot); + var uri = new Uri(url); + if((uri.Host == rootUri.Host || (!string.IsNullOrEmpty(_publicHostName) && uri.Host == _publicHostName)) && uri.AbsolutePath.StartsWith(rootUri.AbsolutePath)) { + return HttpUtility.UrlDecode(uri.PathAndQuery.Substring(Combine(rootUri.AbsolutePath, "/").Length)); } return null; diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Module.txt b/src/Orchard.Web/Modules/Orchard.Blogs/Module.txt index 0d25339c4b7..9032044e6a9 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The Orchard Blogs module is implementing basic blogging features. FeatureDescription: A simple web log. diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Properties/AssemblyInfo.cs index 31a22e9e6d4..ca21df01aa5 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Properties/AssemblyInfo.cs @@ -29,6 +29,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.Caching/Module.txt b/src/Orchard.Web/Modules/Orchard.Caching/Module.txt index 34aca464cec..de0050dcbdb 100644 --- a/src/Orchard.Web/Modules/Orchard.Caching/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Caching/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: Sébastien Ros Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: Provides an API to cache business data. Features: diff --git a/src/Orchard.Web/Modules/Orchard.Caching/Orchard.Caching.csproj b/src/Orchard.Web/Modules/Orchard.Caching/Orchard.Caching.csproj index f6ed91401b6..5ce025dc4e1 100644 --- a/src/Orchard.Web/Modules/Orchard.Caching/Orchard.Caching.csproj +++ b/src/Orchard.Web/Modules/Orchard.Caching/Orchard.Caching.csproj @@ -90,7 +90,7 @@ - + diff --git a/src/Orchard.Web/Modules/Orchard.Caching/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Caching/Properties/AssemblyInfo.cs index 5996c63c370..86bf76f8bfa 100644 --- a/src/Orchard.Web/Modules/Orchard.Caching/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.Caching/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleAssemblyInfo.txt b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleAssemblyInfo.txt index 96ab238cad4..e493ab9bd95 100644 --- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleAssemblyInfo.txt +++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleAssemblyInfo.txt @@ -32,6 +32,6 @@ using System.Security; // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleCsProj.txt b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleCsProj.txt index 12138960a75..e26dd842d60 100644 --- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleCsProj.txt +++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleCsProj.txt @@ -69,7 +69,9 @@ - $$FileIncludes$$ + $$CompileIncludes$$ + $$ContentIncludes$$ + $$OrchardReferences$$ diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs index 972955ca0e0..0be4e98ab3c 100644 --- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs +++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs @@ -273,6 +273,7 @@ private void CreateFilesFromTemplates(string moduleName, string projectGuid) { string propertiesPath = modulePath + "Properties"; var content = new HashSet(); var folders = new HashSet(); + var compile = new HashSet(); foreach (var folder in _moduleDirectories) { Directory.CreateDirectory(modulePath + folder); @@ -297,27 +298,29 @@ private void CreateFilesFromTemplates(string moduleName, string projectGuid) { File.WriteAllText(modulePath + "Styles\\Web.config", File.ReadAllText(_codeGenTemplatePath + "StaticFilesWebConfig.txt")); content.Add(modulePath + "Styles\\Web.config"); - string templateText = File.ReadAllText(_codeGenTemplatePath + "ModuleAssemblyInfo.txt"); - templateText = templateText.Replace("$$ModuleName$$", moduleName); - templateText = templateText.Replace("$$ModuleTypeLibGuid$$", Guid.NewGuid().ToString()); - File.WriteAllText(propertiesPath + "\\AssemblyInfo.cs", templateText); - content.Add(propertiesPath + "\\AssemblyInfo.cs"); - - templateText = File.ReadAllText(_codeGenTemplatePath + "ModuleManifest.txt"); + string templateText = File.ReadAllText(_codeGenTemplatePath + "ModuleManifest.txt"); templateText = templateText.Replace("$$ModuleName$$", moduleName); File.WriteAllText(modulePath + "Module.txt", templateText, System.Text.Encoding.UTF8); content.Add(modulePath + "Module.txt"); - var itemGroup = CreateProjectItemGroup(modulePath, content, folders); + templateText = File.ReadAllText(_codeGenTemplatePath + "ModuleAssemblyInfo.txt"); + templateText = templateText.Replace("$$ModuleName$$", moduleName); + templateText = templateText.Replace("$$ModuleTypeLibGuid$$", Guid.NewGuid().ToString()); + File.WriteAllText(propertiesPath + "\\AssemblyInfo.cs", templateText); + compile.Add(propertiesPath + "\\AssemblyInfo.cs"); + + var contentItemGroup = CreateProjectItemGroup(modulePath, content, folders); + var compileItemGroup = CreateCompileItemGroup(modulePath, compile); - File.WriteAllText(modulePath + moduleName + ".csproj", CreateCsProject(moduleName, projectGuid, itemGroup)); + File.WriteAllText(modulePath + moduleName + ".csproj", CreateCsProject(moduleName, projectGuid, contentItemGroup, compileItemGroup)); } - private static string CreateCsProject(string projectName, string projectGuid, string itemGroup) { + private static string CreateCsProject(string projectName, string projectGuid, string contentItemGroup, string compileItemGroup) { string text = File.ReadAllText(_codeGenTemplatePath + "\\ModuleCsProj.txt"); text = text.Replace("$$ModuleName$$", projectName); text = text.Replace("$$ModuleProjectGuid$$", projectGuid); - text = text.Replace("$$FileIncludes$$", itemGroup ?? ""); + text = text.Replace("$$ContentIncludes$$", contentItemGroup ?? ""); + text = text.Replace("$$CompileIncludes$$", compileItemGroup ?? ""); text = text.Replace("$$OrchardReferences$$", GetOrchardReferences()); return text; } @@ -402,7 +405,7 @@ private void CreateThemeFromTemplates(TextWriter output, string themeName, strin // create new csproj for the theme if (projectGuid != null) { var itemGroup = CreateProjectItemGroup(themePath, createdFiles, createdFolders); - string projectText = CreateCsProject(themeName, projectGuid, itemGroup); + string projectText = CreateCsProject(themeName, projectGuid, itemGroup, null); File.WriteAllText(themePath + "\\" + themeName + ".csproj", projectText); } @@ -426,16 +429,23 @@ private void AddToSolution(TextWriter output, string projectName, string project var solutionPath = Directory.GetParent(_orchardWebProj).Parent.FullName + "\\Orchard.sln"; if (File.Exists(solutionPath)) { var projectReference = string.Format("EndProject\r\nProject(\"{{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}}\") = \"{0}\", \"Orchard.Web\\{2}\\{0}\\{0}.csproj\", \"{{{1}}}\"\r\n", projectName, projectGuid, containingFolder); - var projectConfiguationPlatforms = string.Format("GlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{{{0}}}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{{{0}}}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{{{0}}}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{{{0}}}.Release|Any CPU.Build.0 = Release|Any CPU\r\n", projectGuid); + var projectConfiguationPlatforms = string.Format("\t{{{0}}}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{{{0}}}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{{{0}}}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{{{0}}}.Release|Any CPU.Build.0 = Release|Any CPU\r\n\t", projectGuid); var solutionText = File.ReadAllText(solutionPath); - solutionText = solutionText.Insert(solutionText.LastIndexOf("EndProject\r\n"), projectReference).Replace("GlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n", projectConfiguationPlatforms); - solutionText = solutionText.Insert(solutionText.LastIndexOf("EndGlobalSection"), "\t{" + projectGuid + "} = {" + solutionFolderGuid + "}\r\n\t"); + solutionText = solutionText.Insert(solutionText.LastIndexOf("EndProject\r\n"), projectReference); + solutionText = AppendGlobalSection(solutionText, "ProjectConfigurationPlatforms", projectConfiguationPlatforms); + solutionText = AppendGlobalSection(solutionText, "NestedProjects", "\t{" + projectGuid + "} = {" + solutionFolderGuid + "}\r\n\t"); File.WriteAllText(solutionPath, solutionText); TouchSolution(output); } } } + private string AppendGlobalSection(string solutionText, string sectionName, string content) { + var sectionStart = solutionText.IndexOf(string.Format("GlobalSection({0})", sectionName)); + var sectionEnd = solutionText.IndexOf("EndGlobalSection", sectionStart); + return solutionText.Insert(sectionEnd, content); + } + private static string CreateProjectItemGroup(string relativeFromPath, HashSet content, HashSet folders) { var contentInclude = ""; if (relativeFromPath != null && !relativeFromPath.EndsWith("\\", StringComparison.OrdinalIgnoreCase)) { @@ -457,6 +467,23 @@ from file in content return string.Format(CultureInfo.InvariantCulture, "\r\n{0}\r\n \r\n ", contentInclude); } + private static string CreateCompileItemGroup(string relativeFromPath, HashSet compile) { + var compileInclude = ""; + if (relativeFromPath != null && !relativeFromPath.EndsWith("\\", StringComparison.OrdinalIgnoreCase)) { + relativeFromPath += "\\"; + } + else if (relativeFromPath == null) { + relativeFromPath = ""; + } + + if (compile != null && compile.Count > 0) { + compileInclude = string.Join("\r\n", + from file in compile + select " "); + } + return string.Format(CultureInfo.InvariantCulture, "\r\n{0}\r\n \r\n ", compileInclude); + } + private void AddFilesToOrchardThemesProject(TextWriter output, string itemGroup) { if (!File.Exists(_orchardThemesProj)) { output.WriteLine(T("Warning: Orchard.Themes project file could not be found at {0}", _orchardThemesProj)); diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Module.txt b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Module.txt index e9433b3b599..864e6d3f786 100644 --- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: Tools to create Orchard components. FeatureDescription: Tools to create Orchard components. diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Properties/AssemblyInfo.cs index 2add6a110b7..f6a7886d7aa 100644 --- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Module.txt b/src/Orchard.Web/Modules/Orchard.Comments/Module.txt index 840e0a0ed52..9614cd1bde8 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Comments/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The comments system implemented by this module can be applied to arbitrary Orchard content types, such as blogs and pages. It includes comment validation and spam protection through the Akismet service. Features: diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Comments/Properties/AssemblyInfo.cs index bb3597977de..7f7fbd8d0f0 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.Comments/Properties/AssemblyInfo.cs @@ -30,5 +30,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.Conditions/Module.txt b/src/Orchard.Web/Modules/Orchard.Conditions/Module.txt index 2c60ad94a0a..0257f3f43c8 100644 --- a/src/Orchard.Web/Modules/Orchard.Conditions/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Conditions/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.0 +Version: 1.10.1 OrchardVersion: 1.9 Description: Provides a rules API that evaluate to true or false. Features: diff --git a/src/Orchard.Web/Modules/Orchard.Conditions/Orchard.Conditions.csproj b/src/Orchard.Web/Modules/Orchard.Conditions/Orchard.Conditions.csproj index 5aae5faa9a3..cdf31e39ac4 100644 --- a/src/Orchard.Web/Modules/Orchard.Conditions/Orchard.Conditions.csproj +++ b/src/Orchard.Web/Modules/Orchard.Conditions/Orchard.Conditions.csproj @@ -93,7 +93,7 @@ - + diff --git a/src/Orchard.Web/Modules/Orchard.Conditions/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Conditions/Properties/AssemblyInfo.cs index fb44458d9dc..2bd36dba7bc 100644 --- a/src/Orchard.Web/Modules/Orchard.Conditions/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.Conditions/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.ContentPermissions/Module.txt b/src/Orchard.Web/Modules/Orchard.ContentPermissions/Module.txt index 2b7f988f66d..e5c0d08b2f3 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentPermissions/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.ContentPermissions/Module.txt @@ -2,7 +2,7 @@ Name: Orchard.ContentPermissions AntiForgery: enabled Author: Chris Pyle, Sbastien Ros Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: Allows item-level front end view permissions. Features: diff --git a/src/Orchard.Web/Modules/Orchard.ContentPermissions/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.ContentPermissions/Properties/AssemblyInfo.cs index e604ced65f2..e3900b10757 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentPermissions/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.ContentPermissions/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.ContentPicker/Module.txt b/src/Orchard.Web/Modules/Orchard.ContentPicker/Module.txt index 11712fb1a45..7bc8a95b77f 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentPicker/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.ContentPicker/Module.txt @@ -2,7 +2,7 @@ Name: Orchard.ContentPicker AntiForgery: enabled Author: The Orchard Team Website: https://github.com/OrchardCMS/Orchard -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: UI for selecting Content Items. Features: diff --git a/src/Orchard.Web/Modules/Orchard.ContentPicker/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.ContentPicker/Properties/AssemblyInfo.cs index 8b6f3b1dda3..20543296373 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentPicker/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.ContentPicker/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.ContentPicker/Views/EditorTemplates/Parts.ContentMenuItem.Edit.cshtml b/src/Orchard.Web/Modules/Orchard.ContentPicker/Views/EditorTemplates/Parts.ContentMenuItem.Edit.cshtml index bb6fdcb2584..8c5093df32f 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentPicker/Views/EditorTemplates/Parts.ContentMenuItem.Edit.cshtml +++ b/src/Orchard.Web/Modules/Orchard.ContentPicker/Views/EditorTemplates/Parts.ContentMenuItem.Edit.cshtml @@ -20,8 +20,8 @@ jQuery('#btn-@Html.FieldIdFor(m => m.ContentItemId)').trigger("orchard-admin-contentpicker-open", { callback: function(data) { + data = Array.isArray && Array.isArray(data) ? data[0] : data; jQuery('#@Html.FieldIdFor(m => m.ContentItemId)').val(data.id); - jQuery('#title-@Html.FieldIdFor(m => m.ContentItemId)').text(data.displayText); // define the menu text if it's empty @@ -35,4 +35,4 @@ }); //]]> -} \ No newline at end of file +} diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Module.txt b/src/Orchard.Web/Modules/Orchard.ContentTypes/Module.txt index 2b6da95d1c3..3dac6a5f372 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: ContentTypes modules enables the creation and alteration of content types not based on code. Dependencies: Contents diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.ContentTypes/Properties/AssemblyInfo.cs index a5612e54d84..da7fddd760f 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Styles/orchard-contenttypes-admin.css b/src/Orchard.Web/Modules/Orchard.ContentTypes/Styles/orchard-contenttypes-admin.css index 0f98c050a33..e8599792792 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Styles/orchard-contenttypes-admin.css +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Styles/orchard-contenttypes-admin.css @@ -1,6 +1,6 @@ .orchard-contenttypes #main h2 { - margin:42px 0 0; - border-bottom:1px solid #ccc; + margin: 42px 0 0; + border-bottom: 1px solid #ccc; } .orchard-contenttypes .summary .properties h3 { @@ -12,67 +12,100 @@ } #main .properties p { - margin:0; + margin: 0; } .manage.add-to-type { - margin-top:-32px; + margin-top: -32px; } -.manage-part { - margin-bottom:1em; + +.manage-part, .manage-field { + margin-bottom: 0; + padding:0; + border-bottom: 1px solid #EAEAEA; } + .manage-part h3, .manage-field h3 { - border-bottom:1px solid #EAEAEA; - display:relative; - line-height:1.4em; - padding-bottom:0; - padding-top:0; + display: relative; + line-height: 1.4em; + padding-bottom: 0; + padding-top: 0; } + .manage-part h3, .manage-field h3, .manage-part h4, .manage-type .manage-field .details, .manage-type .manage-part .manage-field, .manage-type .manage-part .settings { - padding-left:20px; + padding-left: 30px; + padding-right: 30px; } + +.manage-part h3, .manage-field h3 { + margin: 1em 0 !important; + padding-left: 30px; + width: 90%; +} + +.manage-part .expando-glyph, .manage-field .expando-glyph { + width:16px; + height:16px; +} + .manage-type .manage-field .settings { - padding-bottom:10px; - padding-left:0; + padding-bottom: 10px; + padding-left: 0; } + .manage-part h4 { - padding-left:0; + padding-left: 0; } + .manage-part .manage-field h4 { - line-height:1.8em; - padding-bottom:0; - padding-left:15px; + line-height: 1.8em; + padding-bottom: 0; + padding-left: 15px; +} + +.manage-part .settings #content { + margin-bottom: 15px; } + .manage-type .manage-part .manage, .manage-type .manage-field .manage, .manage-part .manage-field .manage { - margin-top:-2.4em; + margin-top: -2.9em; + padding-right: 20px; + position: relative; + z-index: 999; } + .manage-field .details, .manage-part .details { - overflow:auto; + overflow: auto; + margin-top: 20px; } + .manage-part .manage.minor { - margin:0 0 -1.2em; + margin: 0 0 -1.2em; } + .manage-part label, .manage-field label { - font-weight:normal; + font-weight: normal; } + .manage-field fieldset, .manage-part fieldset { - margin:.5em 0 1em; - padding:0; + margin: .5em 0 1em; + padding: 0; } + .manage-field .settings { - margin:0 0 0 15px; - padding-left:0; + margin: 0 0 0 15px; + padding-left: 0; } .manage-part .description { @@ -82,48 +115,56 @@ } .manage-part .settings { - overflow:auto; -} -.manage-part .settings fieldset { - padding-left:0; + overflow: auto; } + .manage-part .settings fieldset { + padding-left: 0; + } + fieldset.action { - margin-top:2em; + margin-top: 2em; } /* should pull this back into the base admin theme css, w/out the .manage-part of course */ .manage-part dl { - margin:0 0 1em; - overflow:auto; - padding:6px 0 0; + margin: 0 0 1em; + overflow: auto; + padding: 6px 0 0; } + .manage-part dt, .manage-part dd { - float:left; + float: left; } + .manage-part dt { - clear:left; -} -.manage-part dt::after { - content:":"; + clear: left; } + + .manage-part dt::after { + content: ":"; + } + .manage-part dd { - font-style:italic; - padding-left:.5em; + font-style: italic; + padding-left: .5em; } + .manage-part dl dl { - font-size:1em; - margin:0; - padding:0; + font-size: 1em; + margin: 0; + padding: 0; } + .manage-part dd dt { - clear:left; - float:left; + clear: left; + float: left; } + .manage-part dd dd { - float:left; - padding-left:.5em; + float: left; + padding-left: .5em; } .available-parts .part.hint { @@ -147,7 +188,7 @@ fieldset.action { background-color: #eee; background: #EEE url(images/move.gif) no-repeat 10px 15px; height: 30px; - padding: 10px 0px 0px 30px; + padding: 10px 0px 0px 30px; } #placement li .shape-editor { @@ -160,9 +201,8 @@ fieldset.action { margin-bottom: 10px; } -#placement fieldset -{ - float: inherit; /* prevent bad layout if float is defined to left in specific parts, e.g. datetimepicker */ +#placement fieldset { + float: inherit; /* prevent bad layout if float is defined to left in specific parts, e.g. datetimepicker */ height: auto; } @@ -170,4 +210,4 @@ fieldset.action { background: #FDF5BC; border: 1px solid #FDF5BC; height: 100px; -} \ No newline at end of file +} diff --git a/src/Orchard.Web/Modules/Orchard.CustomForms/Module.txt b/src/Orchard.Web/Modules/Orchard.CustomForms/Module.txt index 09d5fe53808..b6ee88bf66d 100644 --- a/src/Orchard.Web/Modules/Orchard.CustomForms/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.CustomForms/Module.txt @@ -2,7 +2,7 @@ Name: Custom Forms AntiForgery: enabled Author: The Orchard Team Website: https://github.com/OrchardCMS/Orchard -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 LifecycleStatus: Deprecated Description: Create custom forms like contact forms or content contributions. diff --git a/src/Orchard.Web/Modules/Orchard.CustomForms/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.CustomForms/Properties/AssemblyInfo.cs index 0265d0b40db..8f1efd48ca7 100644 --- a/src/Orchard.Web/Modules/Orchard.CustomForms/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.CustomForms/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Module.txt b/src/Orchard.Web/Modules/Orchard.Dashboards/Module.txt index dab7ea67b6e..c89dddb232a 100644 --- a/src/Orchard.Web/Modules/Orchard.Dashboards/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.0 +Version: 1.10.1 OrchardVersion: 1.9 Description: The Dashboards module enables administrators to customize the dashboard screen of the administration UI of the application. Features: diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Orchard.Dashboards.csproj b/src/Orchard.Web/Modules/Orchard.Dashboards/Orchard.Dashboards.csproj index d0653b95293..c426b514352 100644 --- a/src/Orchard.Web/Modules/Orchard.Dashboards/Orchard.Dashboards.csproj +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Orchard.Dashboards.csproj @@ -99,7 +99,7 @@ - + diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Properties/AssemblyInfo.cs index 8e7c239f964..da4339c40c8 100644 --- a/src/Orchard.Web/Modules/Orchard.Dashboards/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Module.txt b/src/Orchard.Web/Modules/Orchard.DesignerTools/Module.txt index 133880a70b7..fb1f8d6d449 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: Contains designer tools to ease the Themes development process FeatureName: Shape Tracing diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.DesignerTools/Properties/AssemblyInfo.cs index 727cdd933aa..26f564e4c27 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/BindingsElementDriver.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/BindingsElementDriver.cs index f30894420ba..fa7c2ee1355 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/BindingsElementDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/BindingsElementDriver.cs @@ -37,7 +37,7 @@ protected override EditorResult OnBuildEditor(FormElement element, ElementEditor var bindingsEditor = context.ShapeFactory.EditorTemplate(TemplateName: "FormBindings", Model: viewModel); - bindingsEditor.Metadata.Position = "Bindings:10"; + bindingsEditor.Metadata.Position = "Bindings:20"; return Editor(context, bindingsEditor); } diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/CheckboxElementDriver.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/CheckboxElementDriver.cs index 25392e55c11..beb915651d4 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/CheckboxElementDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/CheckboxElementDriver.cs @@ -45,9 +45,9 @@ protected override void DescribeForm(DescribeContext context) { _IsRequired: shape.Checkbox( Id: "IsMandatory", Name: "IsMandatory", - Title: "Mandatory", + Title: "Required", Value: "true", - Description: T("Tick this checkbox to make this check box element mandatory.")), + Description: T("Tick this checkbox to make this check box element required.")), _CustomValidationMessage: shape.Textbox( Id: "CustomValidationMessage", Name: "CustomValidationMessage", diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/FormElementDriver.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/FormElementDriver.cs index 16ad4c8faed..f054e4d4d0b 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/FormElementDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/FormElementDriver.cs @@ -82,7 +82,6 @@ protected override void DescribeForm(DescribeContext context) { Name: "HtmlEncode", Title: "Html Encode", Value: "true", - Checked: true, Description: T("Check this option to automatically HTML encode submitted values to prevent code injection.")), _CreateContent: shape.Checkbox( Id: "CreateContent", diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/RadioButtonElementDriver.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/RadioButtonElementDriver.cs index b65cd265c34..19f8f80f15d 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/RadioButtonElementDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/RadioButtonElementDriver.cs @@ -34,8 +34,14 @@ protected override void DescribeForm(DescribeContext context) { Name: "Value", Title: "Value", Classes: new[] { "text", "medium", "tokenized" }, - Description: T("The value of this radio button."))); - + Description: T("The value of this radio button.")), + _DefaultValue: + shape.Checkbox( + Id: "DefaultValue", + Name: "DefaultValue", + Title: "Default Value", + Value: "true", + Description: T("Sets default value to unchecked or checked."))); return form; }); } diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Elements/Form.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/Elements/Form.cs index 2c6c449960a..cd9c211db6c 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Elements/Form.cs +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Elements/Form.cs @@ -33,7 +33,7 @@ public bool? StoreSubmission { } public bool HtmlEncode { - get { return this.Retrieve(x => x.HtmlEncode, () => true); } + get { return this.Retrieve(x => x.HtmlEncode); } set { this.Store(x => x.HtmlEncode, value); } } diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Elements/RadioButton.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/Elements/RadioButton.cs index 4eccb01b340..dd03f75d3da 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Elements/RadioButton.cs +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Elements/RadioButton.cs @@ -1,7 +1,14 @@ -namespace Orchard.DynamicForms.Elements { +using Orchard.Layouts.Elements; +using Orchard.Layouts.Helpers; + +namespace Orchard.DynamicForms.Elements { public class RadioButton : LabeledFormElement { public override string ToolboxIcon { get { return "\uf192"; } } + public bool DefaultValue { + get { return this.Retrieve(x => x.DefaultValue); } + set { this.Store(x => x.DefaultValue, value); } + } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Module.txt b/src/Orchard.Web/Modules/Orchard.DynamicForms/Module.txt index ba30a561f9e..766b597bc11 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Module.txt @@ -2,7 +2,7 @@ Name: Dynamic Forms AntiForgery: enabled Author: The Orchard Team Website: http://www.orchardproject.net/ -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: Create custom forms like contact forms using layouts. Features: diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Orchard.DynamicForms.csproj b/src/Orchard.Web/Modules/Orchard.DynamicForms/Orchard.DynamicForms.csproj index 9ad4ccfe67d..e3133ef217a 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Orchard.DynamicForms.csproj +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Orchard.DynamicForms.csproj @@ -124,7 +124,7 @@ - + diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/Properties/AssemblyInfo.cs index a991834db9d..2bbf705d9f3 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/ValidationRules/Mandatory.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/ValidationRules/Mandatory.cs index b5092943cfe..9193fc953fe 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/ValidationRules/Mandatory.cs +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/ValidationRules/Mandatory.cs @@ -19,7 +19,7 @@ public override void RegisterClientAttributes(RegisterClientValidationAttributes private LocalizedString GetValidationMessage(ValidationContext context) { return String.IsNullOrWhiteSpace(ErrorMessage) - ? T("{0} is a mandatory field.", context.FieldName) + ? T("{0} is a required field.", context.FieldName) : T(ErrorMessage); } } diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/EditorTemplates/FormBindings.cshtml b/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/EditorTemplates/FormBindings.cshtml index 6fc93195b8e..66b68d91ecc 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/EditorTemplates/FormBindings.cshtml +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/EditorTemplates/FormBindings.cshtml @@ -22,8 +22,8 @@ @if (partDescriptor.BindingContexts.Any()) { foreach (var partBinding in partDescriptor.BindingContexts.SelectMany(x => x.Bindings)) { - var partBindingId = String.Format("binding-{0}-{1}", partDescriptor.Part.PartDefinition.Name.HtmlClassify(), partBinding.Name.HtmlClassify()); - var partBindingState = partState.Bindings.ElementAtOrDefault(partBindingIndex) ?? new BindingSettings(); + var partBindingId = String.Format("binding-{0}-{1}", partDescriptor.Part.PartDefinition.Name.HtmlClassify(), partBinding.Name.HtmlClassify()); + var partBindingState = partState.Bindings.FirstOrDefault(f => f.Name == partBinding.Name) ?? new BindingSettings(); @@ -36,7 +36,7 @@ } @foreach (var fieldDescriptor in partDescriptor.FieldBindings) { var fieldBindingIndex = 0; - var fieldState = partState.Fields.ElementAtOrDefault(fieldIndex) ?? new FieldBindingSettings(); + var fieldState = partState.Fields.FirstOrDefault(f=>f.Name == fieldDescriptor.Field.Name) ?? new FieldBindingSettings(); if (fieldDescriptor.BindingContexts.Any()) { foreach (var fieldBinding in fieldDescriptor.BindingContexts.SelectMany(x => x.Bindings)) { var fieldBindingId = String.Format("binding-{0}-{1}-{2}", partDescriptor.Part.PartDefinition.Name.HtmlClassify(), fieldDescriptor.Field.Name.HtmlClassify(), fieldBinding.Name.HtmlClassify()); diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/Elements/RadioButton.Design.cshtml b/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/Elements/RadioButton.Design.cshtml index c70c980d323..6c91df33067 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/Elements/RadioButton.Design.cshtml +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/Elements/RadioButton.Design.cshtml @@ -7,6 +7,9 @@ tagBuilder.Attributes["type"] = "radio"; tagBuilder.Attributes["name"] = element.Name; tagBuilder.Attributes["value"] = element.Value; + if (element.DefaultValue) { + tagBuilder.Attributes["checked"] = "checked"; + } } @if (element.ShowLabel) { @@ -178,9 +177,6 @@ - - - diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Fields/Properties/AssemblyInfo.cs index f4c8472e3c5..1bea5f40b24 100644 --- a/src/Orchard.Web/Modules/Orchard.Fields/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.Fields/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.Fields/ViewModels/DateTimeFieldViewModel.cs b/src/Orchard.Web/Modules/Orchard.Fields/ViewModels/DateTimeFieldViewModel.cs index 5fea628c6b8..d140dcbd0a4 100644 --- a/src/Orchard.Web/Modules/Orchard.Fields/ViewModels/DateTimeFieldViewModel.cs +++ b/src/Orchard.Web/Modules/Orchard.Fields/ViewModels/DateTimeFieldViewModel.cs @@ -6,6 +6,5 @@ public class DateTimeFieldViewModel { public string Hint { get; set; } public bool IsRequired { get; set; } public DateTimeEditor Editor { get; set; } - public bool HasDefaultValue { get; set; } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/DateTimeFieldSettings.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/DateTimeFieldSettings.cshtml index b6b72d30189..304fbce362b 100644 --- a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/DateTimeFieldSettings.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/DateTimeFieldSettings.cshtml @@ -32,7 +32,7 @@
    @Html.EditorFor(m => m.Editor) - @T("Pick a default date for the field. (optional)") + @T("Pick a default date to be proposed when creating a content item. (optional)") @Html.ValidationMessageFor(m => m.Editor)
    diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/EnumerationFieldSettings.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/EnumerationFieldSettings.cshtml index ffd253bffd5..3bb5e88d282 100644 --- a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/EnumerationFieldSettings.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/EnumerationFieldSettings.cshtml @@ -31,8 +31,9 @@
    - @Html.TextBoxFor(m => m.DefaultValue, new { @class = "text large tokenized ui-autocomplete-input" }) - @T("Enter a default option for the field. You can use tokens in this field. If there is no equivalent choice among Options, it will not be used. (optional)") + @Html.TextBoxFor(m => m.DefaultValue, new { @class = "text large" }) + @T("The default option proposed when creating a content item. If there is no equivalent choice among Options, it will not be used. (optional)") + @T("When using the Listbox or Checkbox List mode, you can define multiple options separated by a semicolon.") @Html.ValidationMessageFor(m => m.DefaultValue)
    \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/InputFieldSettings.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/InputFieldSettings.cshtml index d3746ffed6f..34fbee18fee 100644 --- a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/InputFieldSettings.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/InputFieldSettings.cshtml @@ -1,5 +1,4 @@ @model Orchard.Fields.Settings.InputFieldSettings -@using Orchard.Fields.Settings;
    @@ -80,8 +79,8 @@
    - @Html.TextBoxFor(m => m.DefaultValue, new { @class = "text large tokenized ui-autocomplete-input" }) - @T("A valid url as a default value, i.e. http://orchardproject.net, /content/file.pdf ... You can use tokens in this field. (optional)") + @Html.TextBoxFor(m => m.DefaultValue, new { @class = "text large" }) + @T("The default value proposed when creating a content item. (optional)") @Html.ValidationMessageFor(m => m.DefaultValue)
    -
    \ No newline at end of file +
    diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/LinkFieldSettings.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/LinkFieldSettings.cshtml index 9dad8f7b702..452e6b905ee 100644 --- a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/LinkFieldSettings.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/LinkFieldSettings.cshtml @@ -47,16 +47,16 @@
    - @Html.TextBoxFor(m => m.DefaultValue, new { @class = "text large tokenized ui-autocomplete-input" }) - @T("A valid url as a default value, i.e. http://orchardproject.net, /content/file.pdf ... You can use tokens in this field. (optional)") + @Html.TextBoxFor(m => m.DefaultValue, new { @class = "text large" }) + @T("A valid url proposed when creating a content item, i.e. http://orchardproject.net, /content/file.pdf, ... (optional)") @Html.ValidationMessageFor(m => m.DefaultValue)
    - @Html.TextBoxFor(m => m.TextDefaultValue, new { @class = "text large tokenized ui-autocomplete-input" }) - @T("If the Link text is set to Optional or Required, a default value can be set for it. You can use tokens in this field. (optional)") + @Html.TextBoxFor(m => m.TextDefaultValue, new { @class = "text large" }) + @T("The default link text proposed when creating a content item. (optional)") @Html.ValidationMessageFor(m => m.TextDefaultValue)
    \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/NumericFieldSettings.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/NumericFieldSettings.cshtml index 09cedb61ae6..6f49f4e1371 100644 --- a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/NumericFieldSettings.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/NumericFieldSettings.cshtml @@ -42,8 +42,8 @@
    - @Html.TextBoxFor(m => m.DefaultValue, new { @class = "text large tokenized ui-autocomplete-input" }) - @T("The default value for the field. It must be a number, and if not it will not shown. Make sure to set the Scale property if the value is not an integer. You can use tokens in this field. (optional)") + @Html.TextBoxFor(m => m.DefaultValue, new { @class = "text large" }) + @T("A valid number proposed when creating a content item. Make sure to set the Scale property if the value is not an integer. (optional)") @Html.ValidationMessageFor(m => m.DefaultValue)
    -
    \ No newline at end of file + diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml deleted file mode 100644 index a35bea69106..00000000000 --- a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml +++ /dev/null @@ -1,7 +0,0 @@ -@model Orchard.Core.Common.ViewModels.TextFieldSettingsEventsViewModel -@* This override is here so that the token helper can be used on the default value's textbox, which can not be used in Orchard.Core. *@ - - -@Html.TextBoxFor(m => m.Settings.DefaultValue, new { @class = "text large tokenized ui-autocomplete-input" }) -@T("Default value for the field. You can use tokens in this field. If there is no value given for the actual field, this will be filled in. (optional)") -@Html.ValidationMessageFor(m => m.Settings.DefaultValue) \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/DateTime.Edit.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/DateTime.Edit.cshtml index 5c2d90e4b85..999e87d9c0a 100644 --- a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/DateTime.Edit.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/DateTime.Edit.cshtml @@ -6,7 +6,4 @@ @if (HasText(Model.Hint)) { @Model.Hint } - @if (Model.HasDefaultValue) { - @T("If the field is left empty then the default value will be used if one is configured.") - } diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Enumeration.Edit.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Enumeration.Edit.cshtml index d3f4ebda4fd..1e2b077749b 100644 --- a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Enumeration.Edit.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Enumeration.Edit.cshtml @@ -5,45 +5,43 @@ string[] options = (!String.IsNullOrWhiteSpace(settings.Options)) ? settings.Options.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.None) : new string[] { T("Select an option").ToString() }; }
    - + @switch (settings.ListMode) { case ListMode.Dropdown: - @Html.DropDownListFor(m => m.Value, new SelectList(options, Model.Value), settings.Required ? new {required = "required"} : null) + @Html.DropDownListFor(m => m.Value, new SelectList(options, Model.Value), settings.Required ? new { required = "required" } : null) break; - + case ListMode.Radiobutton: foreach (var option in options) { - if (string.IsNullOrWhiteSpace(option)) { - - } + if (string.IsNullOrWhiteSpace(option)) { + } else { - - } + } } break; - + case ListMode.Listbox: - @Html.ListBoxFor(m => m.SelectedValues, new MultiSelectList(options, Model.SelectedValues), settings.Required ? new {required = "required"} : null) + @Html.ListBoxFor(m => m.SelectedValues, new MultiSelectList(options, Model.SelectedValues), settings.Required ? new { required = "required" } : null) break; case ListMode.Checkbox: int index = 0; - foreach (var option in options) { - index++; - if (!string.IsNullOrWhiteSpace(option)) { + foreach (var option in options) { + index++; + if (!string.IsNullOrWhiteSpace(option)) {
    - required="required" } /> - + +
    - } - } - break; + } + } + break; } - + @Html.ValidationMessageFor(m => m.SelectedValues) @if (HasText(settings.Hint)) { - @settings.Hint + @settings.Hint } -
    + \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Input.Edit.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Input.Edit.cshtml index 874372f87e7..5cdfd1bbf87 100644 --- a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Input.Edit.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Input.Edit.cshtml @@ -1,17 +1,13 @@ -@model Orchard.Fields.Fields.InputField -@using Orchard.Utility.Extensions; +@model InputField @using Orchard.Fields.Settings; @{ var settings = Model.PartFieldDefinition.Settings.GetModel(); }
    - - title="@settings.Title"} value="@Model.Value"@if(settings.Required) { required="required" }@if(settings.AutoFocus) { autofocus="autofocus" }@if(settings.AutoComplete) { autocomplete="on" }@if(!string.IsNullOrWhiteSpace(settings.Placeholder)) { placeholder="@settings.Placeholder"}@if(!string.IsNullOrEmpty(settings.Pattern)) { pattern="@settings.Pattern"}@if(!string.IsNullOrEmpty(settings.EditorCssClass)) { class="@settings.EditorCssClass"} else { class="text medium"} @if(settings.MaxLength > 1) { maxlength="@settings.MaxLength.ToString()"} /> + + title="@settings.Title" } value="@Model.Value" @if (settings.Required) { required="required" } @if (settings.AutoFocus) { autofocus="autofocus" } @if (settings.AutoComplete) { autocomplete="on" } @if (!String.IsNullOrWhiteSpace(settings.Placeholder)) { placeholder="@settings.Placeholder" } @if (!String.IsNullOrWhiteSpace(settings.Pattern)) { pattern="@settings.Pattern" } @if (!String.IsNullOrWhiteSpace(settings.EditorCssClass)) { class="@settings.EditorCssClass" } else { class="text medium" } @if (settings.MaxLength > 1) { maxlength="@settings.MaxLength.ToString()" } /> @Html.ValidationMessageFor(m => m.Value) @if (HasText(settings.Hint)) { - @settings.Hint - } - @if (!String.IsNullOrWhiteSpace(settings.DefaultValue)) { - @T("If the field is left empty then the default value will be used.") + @settings.Hint }
    diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Link.Edit.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Link.Edit.cshtml index f1c487f096d..89bcbfdbf47 100644 --- a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Link.Edit.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Link.Edit.cshtml @@ -2,7 +2,7 @@ @using Orchard.Fields.Settings; @{ var settings = Model.PartFieldDefinition.Settings.GetModel(); - string target = string.Empty; + string target = String.Empty; switch (settings.TargetMode) { case TargetMode.NewWindow: target = "_blank"; @@ -13,44 +13,36 @@ case TargetMode.Top: target = "_top"; break; - } + } }
    @if (HasText(settings.Hint)) { - @settings.Hint + @settings.Hint }
    - +
    - @Html.TextBoxFor(m => m.Value, new { @class = "text large" }) + @(settings.Required ? Html.TextBoxFor(m => m.Value, new { @class = "text large", required = "required" }) : Html.TextBoxFor(m => m.Value, new { @class = "text large" })) @T("A valid url, i.e. http://orchardproject.net, /content/file.pdf, ...")
    - @if (!String.IsNullOrWhiteSpace(settings.DefaultValue)) { - @T("If the field is left empty then the default value will be used.") - } @if (settings.LinkTextMode == LinkTextMode.Optional || settings.LinkTextMode == LinkTextMode.Required) {
    - +
    - @Html.TextBoxFor(m => m.Text, new { @class = "text medium" }) - @if (!String.IsNullOrWhiteSpace(settings.TextDefaultValue)) { - @T("If the field is left empty then the default value will be used.") - } - else { - @T("The text of the link. If left empty, the url will be used instead.") - } + @(settings.LinkTextMode == LinkTextMode.Required ? Html.TextBoxFor(m => m.Text, new { @class = "text medium", required = "required" }) : Html.TextBoxFor(m => m.Text, new { @class = "text medium" })) + @T("The text of the link. If left empty, the url will be used instead.")
    } - + @if (settings.TargetMode == TargetMode.UserChoice) {
    - @Html.TextBoxFor(m => m.Target, new { @class = "text"}) + @Html.TextBoxFor(m => m.Target, new { @class = "text" }) @T("A valid HTML target attribute value. e.g., _blank, _parent, _top, or an anchor. ")
    } diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Numeric.Edit.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Numeric.Edit.cshtml index baae80d67da..19dd7ac25d0 100644 --- a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Numeric.Edit.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Numeric.Edit.cshtml @@ -2,16 +2,27 @@ @using System.Globalization @using Orchard.Fields.Settings; +@{ + var attributes = new Dictionary(); + attributes.Add("class", "text-small"); attributes.Add("type", "text"); + attributes.Add("min", Model.Settings.Minimum.HasValue ? Model.Settings.Minimum.Value : 0); + attributes.Add("max", Model.Settings.Maximum.HasValue ? Model.Settings.Maximum.Value : 1000000); + attributes.Add("step", Math.Pow(10, 0 - Model.Settings.Scale).ToString(CultureInfo.InvariantCulture)); + + if (Model.Settings.Required) { + attributes.Add("required", "required"); + } + + if (!String.IsNullOrWhiteSpace(Model.Value)) { + attributes.Add("Value", Model.Value); + } +} +
    - - @(Model.Settings.Required - ? Html.TextBoxFor(m => m.Value, new {@class = "text-small", type = "text", min = (Model.Settings.Minimum.HasValue) ? Model.Settings.Minimum.Value : 0, max = (Model.Settings.Maximum.HasValue) ? Model.Settings.Maximum.Value : 1000000, step = Math.Pow(10, 0 - Model.Settings.Scale).ToString(CultureInfo.InvariantCulture), required = "required"}) - : Html.TextBoxFor(m => m.Value, new {@class = "text-small", type = "text", min = (Model.Settings.Minimum.HasValue) ? Model.Settings.Minimum.Value : 0, max = (Model.Settings.Maximum.HasValue) ? Model.Settings.Maximum.Value : 1000000, step = Math.Pow(10, 0 - Model.Settings.Scale).ToString(CultureInfo.InvariantCulture)})) + + @Html.TextBoxFor(m => m.Value, attributes) @Html.ValidationMessageFor(m => m.Value) @if (HasText(Model.Settings.Hint)) { - @Model.Settings.Hint - } - @if (!String.IsNullOrWhiteSpace(Model.Settings.DefaultValue)) { - @T("If the field is left empty then the default value will be used.") + @Model.Settings.Hint } -
    +
    \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Forms/Module.txt b/src/Orchard.Web/Modules/Orchard.Forms/Module.txt index c1fc658c15d..4eb7c478867 100644 --- a/src/Orchard.Web/Modules/Orchard.Forms/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Forms/Module.txt @@ -2,7 +2,7 @@ Name: Forms AntiForgery: enabled Author: The Orchard Team Website: https://github.com/OrchardCMS/Orchard -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: Provides a system to publish and alter html forms. Features: diff --git a/src/Orchard.Web/Modules/Orchard.Forms/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Forms/Properties/AssemblyInfo.cs index 4c1be4e9729..80ed8c3a1d8 100644 --- a/src/Orchard.Web/Modules/Orchard.Forms/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.Forms/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.ImageEditor/Module.txt b/src/Orchard.Web/Modules/Orchard.ImageEditor/Module.txt index 599484252ec..1968cdfd463 100644 --- a/src/Orchard.Web/Modules/Orchard.ImageEditor/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.ImageEditor/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: Adds a client side image editor for Media Library Features: diff --git a/src/Orchard.Web/Modules/Orchard.ImageEditor/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.ImageEditor/Properties/AssemblyInfo.cs index 4c1f31ff75a..22804a3a1cf 100644 --- a/src/Orchard.Web/Modules/Orchard.ImageEditor/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.ImageEditor/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.ImportExport/Module.txt b/src/Orchard.Web/Modules/Orchard.ImportExport/Module.txt index 8c2f36639a2..29df8d1f678 100644 --- a/src/Orchard.Web/Modules/Orchard.ImportExport/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.ImportExport/Module.txt @@ -3,7 +3,7 @@ Path: ImportExport AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: Provides content item data import and export capability. Features: diff --git a/src/Orchard.Web/Modules/Orchard.ImportExport/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.ImportExport/Properties/AssemblyInfo.cs index 5011fa7d0e2..24d90c2091a 100644 --- a/src/Orchard.Web/Modules/Orchard.ImportExport/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.ImportExport/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.ImportExport/Views/EditorTemplates/ImportActions/ExecuteRecipe.cshtml b/src/Orchard.Web/Modules/Orchard.ImportExport/Views/EditorTemplates/ImportActions/ExecuteRecipe.cshtml index f4a8a48523c..5033819e46b 100644 --- a/src/Orchard.Web/Modules/Orchard.ImportExport/Views/EditorTemplates/ImportActions/ExecuteRecipe.cshtml +++ b/src/Orchard.Web/Modules/Orchard.ImportExport/Views/EditorTemplates/ImportActions/ExecuteRecipe.cshtml @@ -29,7 +29,7 @@ } - @Html.Hint(T("Select wether you want to import the selected recipe into the current site or if you want to do a full site reset first.")) + @Html.Hint(T("Select whether you want to import the selected recipe into the current site or if you want to do a full site reset first."))
    m.ResetSite), "true")" style="display: none;">
    @T("This will delete your database tables. Please consider creating a backup first.")
    @@ -63,4 +63,4 @@ stepIndex++; } -} \ No newline at end of file +} diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Module.txt b/src/Orchard.Web/Modules/Orchard.Indexing/Module.txt index 1cefde7b32a..8141f7adc23 100644 --- a/src/Orchard.Web/Modules/Orchard.Indexing/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Indexing/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: The Indexing module enables the site to be indexed. The index generated by this module can then be used by the search module to provide an integrated full-text search experience to a web site. FeatureDescription: Indexing infrastructure. Requires an index implementation like the Lucene module. diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Indexing/Properties/AssemblyInfo.cs index 9ab131fb38a..7ed563bac34 100644 --- a/src/Orchard.Web/Modules/Orchard.Indexing/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.Indexing/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.JobsQueue/Module.txt b/src/Orchard.Web/Modules/Orchard.JobsQueue/Module.txt index 478e242fb73..b9dc23426da 100644 --- a/src/Orchard.Web/Modules/Orchard.JobsQueue/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.JobsQueue/Module.txt @@ -2,7 +2,7 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.10 +Version: 1.10.1 OrchardVersion: 1.9 Description: This module provides a jobs queue to process jobs asynchronously. Features: diff --git a/src/Orchard.Web/Modules/Orchard.JobsQueue/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.JobsQueue/Properties/AssemblyInfo.cs index 05c2b3d31b0..da7e0dad686 100644 --- a/src/Orchard.Web/Modules/Orchard.JobsQueue/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.JobsQueue/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.10")] -[assembly: AssemblyFileVersion("1.10")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Assets/JavaScript/LayoutEditor/Services/Clipboard.js b/src/Orchard.Web/Modules/Orchard.Layouts/Assets/JavaScript/LayoutEditor/Services/Clipboard.js index 013672249e2..fde06c7aa49 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Assets/JavaScript/LayoutEditor/Services/Clipboard.js +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Assets/JavaScript/LayoutEditor/Services/Clipboard.js @@ -12,8 +12,8 @@ self._wasInvoked = true; }; this.getData = function (contentType) { - return self._clipboardData[contentType]; self._wasInvoked = true; + return self._clipboardData[contentType]; }; this.disable = function() { self._isDisabled = true; diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Elements/Shape.cs b/src/Orchard.Web/Modules/Orchard.Layouts/Elements/Shape.cs index 83747669fd4..7712e55c747 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Elements/Shape.cs +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Elements/Shape.cs @@ -5,7 +5,7 @@ namespace Orchard.Layouts.Elements { public class Shape : Element { public override string Category { - get { return "Snippets"; } + get { return "Content"; } } public override LocalizedString Description { diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Framework/Drivers/FormsElementDriver.cs b/src/Orchard.Web/Modules/Orchard.Layouts/Framework/Drivers/FormsElementDriver.cs index 92281c0dc16..17885742a7f 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Framework/Drivers/FormsElementDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Framework/Drivers/FormsElementDriver.cs @@ -78,6 +78,12 @@ private void UpdateElementProperty(dynamic formElementShape, ElementEditorContex if (value != null) { context.Element.Data[name] = value.AttemptedValue; } + else if (formElementShape.Metadata.Type == "Checkbox") { + var shapeValue = formElementShape.Value as string; + if (shapeValue != null && shapeValue.ToLower() == "true") { + context.Element.Data[name] = "false"; + } + } } } @@ -87,4 +93,4 @@ public void Describe(DescribeContext context) { protected virtual void DescribeForm(DescribeContext context) { } } -} \ No newline at end of file +} diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Module.txt b/src/Orchard.Web/Modules/Orchard.Layouts/Module.txt index cedbb6f07dd..626a1a950e8 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Module.txt @@ -2,15 +2,15 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.0 +Version: 1.10.1 OrchardVersion: 1.9 -# Category: Layout -# Description: Provides tools to create layouts. +Category: Layout +Description: Provides tools to create layouts. Features: Orchard.Layouts: Name: Layouts Description: Provides tools to create layouts. - Dependencies: Common, Orchard.Forms, Orchard.Tokens, Orchard.MediaLibrary, Orchard.Conditions, Orchard.Resources + Dependencies: Common, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.MediaLibrary, Orchard.Conditions, Orchard.Resources Category: Layout Orchard.Layouts.Snippets: Name: Layout Snippets diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj b/src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj index 0a500141b9c..b661cd51795 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj @@ -102,6 +102,14 @@ + + ..\..\..\packages\YamlDotNet.3.8.0\lib\net35\YamlDotNet.dll + True + + + ..\..\..\packages\YamlDotNet.Dynamic.3.2.3\lib\net40\YamlDotNet.Dynamic.dll + True + @@ -173,7 +181,7 @@ - + diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Layouts/Properties/AssemblyInfo.cs index 6faf7f7a23a..d0e348a1e70 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Properties/AssemblyInfo.cs +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.10.1")] +[assembly: AssemblyFileVersion("1.10.1")] diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Providers/SnippetElementHarvester.cs b/src/Orchard.Web/Modules/Orchard.Layouts/Providers/SnippetElementHarvester.cs index 8cab0b828a1..3369c713250 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Providers/SnippetElementHarvester.cs +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Providers/SnippetElementHarvester.cs @@ -20,10 +20,11 @@ using Orchard.Themes.Services; using Orchard.Tokens; using Orchard.Utility.Extensions; +using YamlDotNet.Dynamic; namespace Orchard.Layouts.Providers { [OrchardFeature("Orchard.Layouts.Snippets")] - public class SnippetElementHarvester : Component, IElementHarvester { + public class SnippetElementHarvester : IElementHarvester { private const string SnippetShapeSuffix = "Snippet"; private readonly Work _shapeFactory; private readonly Work _siteThemeService; @@ -65,12 +66,13 @@ public IEnumerable HarvestElements(HarvestElementsContext con var shapeType = shapeDescriptor.Value.ShapeType; var elementName = GetDisplayName(shapeDescriptor.Value.BindingSource); var closureDescriptor = shapeDescriptor; - yield return new ElementDescriptor(elementType, shapeType, T(elementName), T("An element that renders the {0} shape.", shapeType), snippetElement.Category) { - Displaying = displayContext => Displaying(displayContext, closureDescriptor.Value), + var snippetDescriptor = ParseSnippetDescriptor(shapeDescriptor.Value.BindingSource); + yield return new ElementDescriptor(elementType, shapeType, new LocalizedString(elementName), new LocalizedString(String.Format("An element that renders the {0} shape.", shapeType)), snippetElement.Category) { + Displaying = displayContext => Displaying(displayContext, closureDescriptor.Value, snippetDescriptor), ToolboxIcon = "\uf10c", - EnableEditorDialog = HasSnippetFields(shapeDescriptor.Value), - Editor = ctx => Editor(DescribeSnippet(shapeType, snippetElement), ctx), - UpdateEditor = ctx => UpdateEditor(DescribeSnippet(shapeType, snippetElement), ctx) + EnableEditorDialog = snippetDescriptor != null || HasSnippetFields(shapeDescriptor.Value), + Editor = ctx => Editor(snippetDescriptor ?? DescribeSnippet(shapeType, snippetElement), ctx), + UpdateEditor = ctx => UpdateEditor(snippetDescriptor ?? DescribeSnippet(shapeType, snippetElement), ctx) }; } } @@ -113,22 +115,53 @@ private void UpdateEditor(SnippetDescriptor descriptor, ElementEditorContext con context.EditorResult.Add(snippetEditorShape); } - private void Displaying(ElementDisplayingContext context, ShapeDescriptor shapeDescriptor) { + private void Displaying(ElementDisplayingContext context, ShapeDescriptor shapeDescriptor, SnippetDescriptor snippetDescriptor) { var shapeType = shapeDescriptor.ShapeType; var shape = (dynamic)_shapeFactory.Value.Create(shapeType); shape.Element = context.Element; + if (snippetDescriptor != null) { + foreach (var fieldDescriptor in snippetDescriptor.Fields) { + var value = context.Element.Data.Get(fieldDescriptor.Name); + shape.Properties[fieldDescriptor.Name] = value; + } + } + ElementShapes.AddTokenizers(shape, _tokenizer.Value); context.ElementShape.Snippet = shape; } private string GetDisplayName(string bindingSource) { - var fileName = Path.GetFileNameWithoutExtension(bindingSource); + var fileName = Path.GetFileNameWithoutExtension(bindingSource) ?? ""; var lastIndex = fileName.IndexOf(SnippetShapeSuffix, StringComparison.OrdinalIgnoreCase); return fileName.Substring(0, lastIndex).CamelFriendly(); } + private SnippetDescriptor ParseSnippetDescriptor(string bindingSource) { + var physicalSourcePath = _wca.GetContext().HttpContext.Server.MapPath(bindingSource); + var paramsFileName = Path.Combine(Path.GetDirectoryName(physicalSourcePath) ?? "", Path.GetFileNameWithoutExtension(physicalSourcePath) + ".txt"); + + if (!File.Exists(paramsFileName)) + return null; + + var yaml = File.ReadAllText(paramsFileName); + var snippetConfig = Deserialize(yaml); + var fieldsConfig = snippetConfig.Fields != null ? snippetConfig.Fields.Children : new dynamic[0]; + var descriptor = new SnippetDescriptor(); + + foreach (var fieldConfig in fieldsConfig) { + descriptor.Fields.Add(new SnippetFieldDescriptor { + Name = (string)fieldConfig.Name, + Type = (string)fieldConfig.Type, + DisplayName = new LocalizedString((string)fieldConfig.DisplayName), + Description = new LocalizedString((string)fieldConfig.Description) + }); + } + + return descriptor; + } + private SnippetDescriptor DescribeSnippet(string shapeType, Snippet element) { var shape = (dynamic)_shapeFactory.Value.Create(shapeType); shape.Element = element; @@ -166,5 +199,9 @@ private bool HasSnippetFields(ShapeDescriptor shapeDescriptor) { var markup = File.ReadAllText(localFileName); return markup.Contains("@Html.SnippetField"); } + + private dynamic Deserialize(string yaml) { + return new DynamicYaml(yaml); + } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/LayoutEditor.js b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/LayoutEditor.js index 0e30fc120f3..da7dec35fef 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/LayoutEditor.js +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/LayoutEditor.js @@ -18,8 +18,8 @@ var LayoutEditor; self._wasInvoked = true; }; this.getData = function (contentType) { - return self._clipboardData[contentType]; self._wasInvoked = true; + return self._clipboardData[contentType]; }; this.disable = function() { self._isDisabled = true; @@ -964,4 +964,4 @@ angular }; } ]); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkxheW91dEVkaXRvci5qcyIsIk1vZHVsZS5qcyIsIkNsaXBib2FyZC5qcyIsIlNjb3BlQ29uZmlndXJhdG9yLmpzIiwiRWRpdG9yLmpzIiwiQ2FudmFzLmpzIiwiQ2hpbGQuanMiLCJDb2x1bW4uanMiLCJDb250ZW50LmpzIiwiR3JpZC5qcyIsIlJvdy5qcyIsIlBvcHVwLmpzIiwiVG9vbGJveC5qcyIsIlRvb2xib3hHcm91cC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsQUNMQTtBQ0FBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FDN0NBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQ2xWQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUN6SUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUNsQkE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FDZEE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQ25FQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQ3hCQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQ2xCQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FDbkJBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FDdkNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQzlNQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiTGF5b3V0RWRpdG9yLmpzIiwic291cmNlc0NvbnRlbnQiOltudWxsLCJhbmd1bGFyLm1vZHVsZShcIkxheW91dEVkaXRvclwiLCBbXCJuZ1Nhbml0aXplXCIsIFwibmdSZXNvdXJjZVwiLCBcInVpLnNvcnRhYmxlXCJdKTsiLCJ2YXIgTGF5b3V0RWRpdG9yO1xuKGZ1bmN0aW9uKExheW91dEVkaXRvcikge1xuXG4gICAgdmFyIENsaXBib2FyZCA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICB0aGlzLl9jbGlwYm9hcmREYXRhID0ge307XG4gICAgICAgIHRoaXMuX2lzRGlzYWJsZWQgPSBmYWxzZTtcbiAgICAgICAgdGhpcy5fd2FzSW52b2tlZCA9IGZhbHNlO1xuXG4gICAgICAgIHRoaXMuc2V0RGF0YSA9IGZ1bmN0aW9uKGNvbnRlbnRUeXBlLCBkYXRhKSB7XG4gICAgICAgICAgICBzZWxmLl9jbGlwYm9hcmREYXRhW2NvbnRlbnRUeXBlXSA9IGRhdGE7XG4gICAgICAgICAgICBzZWxmLl93YXNJbnZva2VkID0gdHJ1ZTtcbiAgICAgICAgfTtcbiAgICAgICAgdGhpcy5nZXREYXRhID0gZnVuY3Rpb24gKGNvbnRlbnRUeXBlKSB7XG4gICAgICAgICAgICByZXR1cm4gc2VsZi5fY2xpcGJvYXJkRGF0YVtjb250ZW50VHlwZV07XG4gICAgICAgICAgICBzZWxmLl93YXNJbnZva2VkID0gdHJ1ZTtcbiAgICAgICAgfTtcbiAgICAgICAgdGhpcy5kaXNhYmxlID0gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICBzZWxmLl9pc0Rpc2FibGVkID0gdHJ1ZTtcbiAgICAgICAgICAgIHNlbGYuX3dhc0ludm9rZWQgPSBmYWxzZTtcbiAgICAgICAgICAgIHNlbGYuX2NsaXBib2FyZERhdGEgPSB7fTtcbiAgICAgICAgfTtcbiAgICAgICAgdGhpcy5pc0Rpc2FibGVkID0gZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgcmV0dXJuIHNlbGYuX2lzRGlzYWJsZWQ7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy53YXNJbnZva2VkID0gZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgcmV0dXJuIHNlbGYuX3dhc0ludm9rZWQ7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBMYXlvdXRFZGl0b3IuQ2xpcGJvYXJkID0gbmV3IENsaXBib2FyZCgpO1xuXG4gICAgYW5ndWxhclxuICAgICAgICAubW9kdWxlKFwiTGF5b3V0RWRpdG9yXCIpXG4gICAgICAgIC5mYWN0b3J5KFwiY2xpcGJvYXJkXCIsIFtcbiAgICAgICAgICAgIGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgIHNldERhdGE6IExheW91dEVkaXRvci5DbGlwYm9hcmQuc2V0RGF0YSxcbiAgICAgICAgICAgICAgICAgICAgZ2V0RGF0YTogTGF5b3V0RWRpdG9yLkNsaXBib2FyZC5nZXREYXRhLFxuICAgICAgICAgICAgICAgICAgICBkaXNhYmxlOiBMYXlvdXRFZGl0b3IuQ2xpcGJvYXJkLmRpc2FibGUsXG4gICAgICAgICAgICAgICAgICAgIGlzRGlzYWJsZWQ6IExheW91dEVkaXRvci5DbGlwYm9hcmQuaXNEaXNhYmxlZCxcbiAgICAgICAgICAgICAgICAgICAgd2FzSW52b2tlZDogTGF5b3V0RWRpdG9yLkNsaXBib2FyZC53YXNJbnZva2VkXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgXSk7XG59KShMYXlvdXRFZGl0b3IgfHwgKExheW91dEVkaXRvciA9IHt9KSk7IiwiYW5ndWxhclxyXG4gICAgLm1vZHVsZShcIkxheW91dEVkaXRvclwiKVxyXG4gICAgLmZhY3RvcnkoXCJzY29wZUNvbmZpZ3VyYXRvclwiLCBbXCIkdGltZW91dFwiLCBcImNsaXBib2FyZFwiLFxyXG4gICAgICAgIGZ1bmN0aW9uICgkdGltZW91dCwgY2xpcGJvYXJkKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB7XHJcblxyXG4gICAgICAgICAgICAgICAgY29uZmlndXJlRm9yRWxlbWVudDogZnVuY3Rpb24gKCRzY29wZSwgJGVsZW1lbnQpIHtcclxuICAgICAgICAgICAgICAgIFxyXG4gICAgICAgICAgICAgICAgICAgICRlbGVtZW50LmZpbmQoXCIubGF5b3V0LXBhbmVsXCIpLmNsaWNrKGZ1bmN0aW9uIChlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGUuc3RvcFByb3BhZ2F0aW9uKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICRlbGVtZW50LnBhcmVudCgpLmtleWRvd24oZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGhhbmRsZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlc2V0Rm9jdXMgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSAkc2NvcGUuZWxlbWVudDtcclxuICAgICAgICAgICAgICAgICAgICBcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVsZW1lbnQuZWRpdG9yLmlzRHJhZ2dpbmcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiBuYXRpdmUgY2xpcGJvYXJkIHN1cHBvcnQgZXhpc3RzLCB0aGUgcHNldWRvLWNsaXBib2FyZCB3aWxsIGhhdmUgYmVlbiBkaXNhYmxlZC5cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFjbGlwYm9hcmQuaXNEaXNhYmxlZCgpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZm9jdXNlZEVsZW1lbnQgPSBlbGVtZW50LmVkaXRvci5mb2N1c2VkRWxlbWVudDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghIWZvY3VzZWRFbGVtZW50KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gUHNldWRvIGNsaXBib2FyZCBoYW5kbGluZyBmb3IgYnJvd3NlcnMgbm90IGFsbG93aW5nIHJlYWwgY2xpcGJvYXJkIG9wZXJhdGlvbnMuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuY3RybEtleSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUud2hpY2gpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA2NzogLy8gQ1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9jdXNlZEVsZW1lbnQuY29weShjbGlwYm9hcmQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgODg6IC8vIFhcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvY3VzZWRFbGVtZW50LmN1dChjbGlwYm9hcmQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgODY6IC8vIFZcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvY3VzZWRFbGVtZW50LnBhc3RlKGNsaXBib2FyZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlLmN0cmxLZXkgJiYgIWUuc2hpZnRLZXkgJiYgIWUuYWx0S2V5ICYmIGUud2hpY2ggPT0gNDYpIHsgLy8gRGVsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZGVsZXRlKGVsZW1lbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIWUuY3RybEtleSAmJiAhZS5zaGlmdEtleSAmJiAhZS5hbHRLZXkgJiYgKGUud2hpY2ggPT0gMzIgfHwgZS53aGljaCA9PSAyNykpIHsgLy8gU3BhY2Ugb3IgRXNjXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkZWxlbWVudC5maW5kKFwiLmxheW91dC1wYW5lbC1hY3Rpb24tcHJvcGVydGllc1wiKS5maXJzdCgpLmNsaWNrKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVsZW1lbnQudHlwZSA9PSBcIkNvbnRlbnRcIikgeyAvLyBUaGlzIGlzIGEgY29udGVudCBlbGVtZW50LlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlLmN0cmxLZXkgJiYgIWUuc2hpZnRLZXkgJiYgIWUuYWx0S2V5ICYmIGUud2hpY2ggPT0gMTMpIHsgLy8gRW50ZXJcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkZWxlbWVudC5maW5kKFwiLmxheW91dC1wYW5lbC1hY3Rpb24tZWRpdFwiKS5maXJzdCgpLmNsaWNrKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghIWVsZW1lbnQuY2hpbGRyZW4pIHsgLy8gVGhpcyBpcyBhIGNvbnRhaW5lci5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5jdHJsS2V5ICYmICFlLnNoaWZ0S2V5ICYmIGUuYWx0S2V5ICYmIGUud2hpY2ggPT0gNDApIHsgLy8gQWx0K0Rvd25cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZWxlbWVudC5jaGlsZHJlbi5sZW5ndGggPiAwKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmNoaWxkcmVuWzBdLnNldElzRm9jdXNlZCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbGVtZW50LnR5cGUgPT0gXCJDb2x1bW5cIikgeyAvLyBUaGlzIGlzIGEgY29sdW1uLlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjb25uZWN0QWRqYWNlbnQgPSAhZS5jdHJsS2V5O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLndoaWNoID09IDM3KSB7IC8vIExlZnRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuYWx0S2V5KVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5leHBhbmRMZWZ0KGNvbm5lY3RBZGphY2VudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLnNoaWZ0S2V5KVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5jb250cmFjdFJpZ2h0KGNvbm5lY3RBZGphY2VudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZS53aGljaCA9PSAzOSkgeyAvLyBSaWdodFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5hbHRLZXkpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmNvbnRyYWN0TGVmdChjb25uZWN0QWRqYWNlbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5zaGlmdEtleSlcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuZXhwYW5kUmlnaHQoY29ubmVjdEFkamFjZW50KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoISFlbGVtZW50LnBhcmVudCkgeyAvLyBUaGlzIGlzIGEgY2hpbGQuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5hbHRLZXkgJiYgZS53aGljaCA9PSAzOCkgeyAvLyBBbHQrVXBcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnBhcmVudC5zZXRJc0ZvY3VzZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZWxlbWVudC5wYXJlbnQudHlwZSA9PSBcIlJvd1wiKSB7IC8vIFBhcmVudCBpcyBhIGhvcml6b250YWwgY29udGFpbmVyLlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5jdHJsS2V5ICYmICFlLnNoaWZ0S2V5ICYmICFlLmFsdEtleSAmJiBlLndoaWNoID09IDM3KSB7IC8vIExlZnRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5wYXJlbnQubW92ZUZvY3VzUHJldkNoaWxkKGVsZW1lbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoIWUuY3RybEtleSAmJiAhZS5zaGlmdEtleSAmJiAhZS5hbHRLZXkgJiYgZS53aGljaCA9PSAzOSkgeyAvLyBSaWdodFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnBhcmVudC5tb3ZlRm9jdXNOZXh0Q2hpbGQoZWxlbWVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChlLmN0cmxLZXkgJiYgIWUuc2hpZnRLZXkgJiYgIWUuYWx0S2V5ICYmIGUud2hpY2ggPT0gMzcpIHsgLy8gQ3RybCtMZWZ0XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQubW92ZVVwKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc2V0Rm9jdXMgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZS5jdHJsS2V5ICYmICFlLnNoaWZ0S2V5ICYmICFlLmFsdEtleSAmJiBlLndoaWNoID09IDM5KSB7IC8vIEN0cmwrUmlnaHRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5tb3ZlRG93bigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsgLy8gUGFyZW50IGlzIGEgdmVydGljYWwgY29udGFpbmVyLlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5jdHJsS2V5ICYmICFlLnNoaWZ0S2V5ICYmICFlLmFsdEtleSAmJiBlLndoaWNoID09IDM4KSB7IC8vIFVwXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQucGFyZW50Lm1vdmVGb2N1c1ByZXZDaGlsZChlbGVtZW50KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCFlLmN0cmxLZXkgJiYgIWUuc2hpZnRLZXkgJiYgIWUuYWx0S2V5ICYmIGUud2hpY2ggPT0gNDApIHsgLy8gRG93blxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnBhcmVudC5tb3ZlRm9jdXNOZXh0Q2hpbGQoZWxlbWVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChlLmN0cmxLZXkgJiYgIWUuc2hpZnRLZXkgJiYgIWUuYWx0S2V5ICYmIGUud2hpY2ggPT0gMzgpIHsgLy8gQ3RybCtVcFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50Lm1vdmVVcCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNldEZvY3VzID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGUuY3RybEtleSAmJiAhZS5zaGlmdEtleSAmJiAhZS5hbHRLZXkgJiYgZS53aGljaCA9PSA0MCkgeyAvLyBDdHJsK0Rvd25cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5tb3ZlRG93bigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYW5kbGVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGUuc3RvcFByb3BhZ2F0aW9uKCk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuJGFwcGx5KCk7IC8vIEV2ZW50IGlzIG5vdCB0cmlnZ2VyZWQgYnkgQW5ndWxhciBkaXJlY3RpdmUgYnV0IHJhdyBldmVudCBoYW5kbGVyIG9uIGVsZW1lbnQuXHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBIQUNLOiBXb3JrYXJvdW5kIGJlY2F1c2Ugb2YgaG93IEFuZ3VsYXIgdHJlYXRzIHRoZSBET00gd2hlbiBlbGVtZW50cyBhcmUgc2hpZnRlZCBhcm91bmQgLSBpbnB1dCBmb2N1cyBpcyBzb21ldGltZXMgbG9zdC5cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlc2V0Rm9jdXMpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5zZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuJGFwcGx5KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5lZGl0b3IuZm9jdXNlZEVsZW1lbnQuc2V0SXNGb2N1c2VkKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICRzY29wZS5lbGVtZW50LnNldElzRm9jdXNlZEV2ZW50SGFuZGxlcnMucHVzaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRlbGVtZW50LnBhcmVudCgpLmZvY3VzKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICRzY29wZS5kZWxldGUgPSBmdW5jdGlvbiAoZWxlbWVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmRlbGV0ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCRzY29wZS5lbGVtZW50Lmhhc0VkaXRvcikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZWRpdCA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS4kcm9vdC5lZGl0RWxlbWVudCgkc2NvcGUuZWxlbWVudCkudGhlbihmdW5jdGlvbiAoYXJncykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS4kYXBwbHkoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYXJncy5jYW5jZWwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZWxlbWVudC5kYXRhID0gYXJncy5lbGVtZW50LmRhdGE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5lbGVtZW50LmFwcGx5RWxlbWVudEVkaXRvck1vZGVsKGFyZ3MuZWxlbWVudEVkaXRvck1vZGVsKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghISRzY29wZS5lbGVtZW50LnNldEh0bWwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZWxlbWVudC5zZXRIdG1sKGFyZ3MuZWxlbWVudC5odG1sKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0sXHJcblxyXG4gICAgICAgICAgICAgICAgY29uZmlndXJlRm9yQ29udGFpbmVyOiBmdW5jdGlvbiAoJHNjb3BlLCAkZWxlbWVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBlbGVtZW50ID0gJHNjb3BlLmVsZW1lbnQ7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIC8vJHNjb3BlLmlzUmVjZWl2aW5nID0gZmFsc2U7IC8vIFRydWUgd2hlbiBjb250YWluZXIgaXMgcmVjZWl2aW5nIGFuIGV4dGVybmFsIGVsZW1lbnQgdmlhIGRyYWcvZHJvcC5cclxuICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZ2V0U2hvd0NoaWxkcmVuUGxhY2Vob2xkZXIgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkc2NvcGUuZWxlbWVudC5jaGlsZHJlbi5sZW5ndGggPT09IDAgJiYgISRzY29wZS5lbGVtZW50LmdldElzRHJvcFRhcmdldCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICRzY29wZS5zb3J0YWJsZU9wdGlvbnMgPSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGN1cnNvcjogXCJtb3ZlXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGF5OiAxNTAsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRpc2FibGVkOiBlbGVtZW50LmdldElzU2VhbGVkKCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3RhbmNlOiA1LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2hhbmRsZTogZWxlbWVudC5jaGlsZHJlbi5sZW5ndGggPCAyID8gXCIuaW1hZ2luYXJ5LWNsYXNzXCIgOiBmYWxzZSwgLy8gRm9yIHNvbWUgcmVhc29uIGRvZXNuJ3QgZ2V0IHJlLWV2YWx1YXRlZCBhZnRlciBhZGRpbmcgbW9yZSBjaGlsZHJlbi5cclxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IGZ1bmN0aW9uIChlLCB1aSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLiRhcHBseShmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5zZXRJc0Ryb3BUYXJnZXQodHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5lZGl0b3IuaXNEcmFnZ2luZyA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIE1ha2UgdGhlIGRyb3AgdGFyZ2V0IHBsYWNlaG9sZGVyIGFzIGhpZ2ggYXMgdGhlIGl0ZW0gYmVpbmcgZHJhZ2dlZC5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpLnBsYWNlaG9sZGVyLmhlaWdodCh1aS5pdGVtLmhlaWdodCgpIC0gNCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aS5wbGFjZWhvbGRlci5jc3MoXCJtaW4taGVpZ2h0XCIsIDApO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzdG9wOiBmdW5jdGlvbiAoZSwgdWkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS4kYXBwbHkoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuZWRpdG9yLmlzRHJhZ2dpbmcgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnNldElzRHJvcFRhcmdldChmYWxzZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgb3ZlcjogZnVuY3Rpb24gKGUsIHVpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISF1aS5zZW5kZXIgJiYgISF1aS5zZW5kZXJbMF0uaXNUb29sYm94KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEhdWkuc2VuZGVyWzBdLmRyb3BUYXJnZXRUaW1lb3V0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0aW1lb3V0LmNhbmNlbCh1aS5zZW5kZXJbMF0uZHJvcFRhcmdldFRpbWVvdXQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aS5zZW5kZXJbMF0uZHJvcFRhcmdldFRpbWVvdXQgPSBudWxsO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGltZW91dChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbGVtZW50LnR5cGUgPT0gXCJSb3dcIikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgdGhlcmUgd2FzIGEgcHJldmlvdXMgZHJvcCB0YXJnZXQgYW5kIGl0IHdhcyBhIHJvdywgcm9sbCBiYWNrIGFueSBwZW5kaW5nIGNvbHVtbiBhZGRzIHRvIGl0LlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHByZXZpb3VzRHJvcFRhcmdldCA9IGVsZW1lbnQuZWRpdG9yLmRyb3BUYXJnZXRFbGVtZW50O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEhcHJldmlvdXNEcm9wVGFyZ2V0ICYmIHByZXZpb3VzRHJvcFRhcmdldC50eXBlID09IFwiUm93XCIpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJldmlvdXNEcm9wVGFyZ2V0LnJvbGxiYWNrQWRkQ29sdW1uKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5zZXRJc0Ryb3BUYXJnZXQoZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpLnNlbmRlclswXS5kcm9wVGFyZ2V0VGltZW91dCA9ICR0aW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVsZW1lbnQudHlwZSA9PSBcIlJvd1wiKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcmVjZWl2ZWRDb2x1bW4gPSB1aS5pdGVtLnNvcnRhYmxlLm1vZGVsO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlY2VpdmVkQ29sdW1uV2lkdGggPSBNYXRoLmZsb29yKDEyIC8gKGVsZW1lbnQuY2hpbGRyZW4ubGVuZ3RoICsgMSkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZWRDb2x1bW4ud2lkdGggPSByZWNlaXZlZENvbHVtbldpZHRoO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZWRDb2x1bW4ub2Zmc2V0ID0gMDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuYmVnaW5BZGRDb2x1bW4ocmVjZWl2ZWRDb2x1bW5XaWR0aCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBNYWtlIHRoZSBkcm9wIHRhcmdldCBwbGFjZWhvbGRlciB0aGUgY29ycmVjdCB3aWR0aCBhbmQgYXMgaGlnaCBhcyB0aGUgaGlnaGVzdCBleGlzdGluZyBjb2x1bW4gaW4gdGhlIHJvdy5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtYXhIZWlnaHQgPSBfLm1heChfKCRlbGVtZW50LmZpbmQoXCI+IC5sYXlvdXQtY2hpbGRyZW4gPiAubGF5b3V0LWNvbHVtbjpub3QoLnVpLXNvcnRhYmxlLXBsYWNlaG9sZGVyKVwiKSkubWFwKGZ1bmN0aW9uIChlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoZSkuaGVpZ2h0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAxOyBpIDw9IDEyOyBpKyspXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWkucGxhY2Vob2xkZXIucmVtb3ZlQ2xhc3MoXCJjb2wteHMtXCIgKyBpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpLnBsYWNlaG9sZGVyLmFkZENsYXNzKFwiY29sLXhzLVwiICsgcmVjZWl2ZWRDb2x1bW4ud2lkdGgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1heEhlaWdodCA+IDApIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aS5wbGFjZWhvbGRlci5oZWlnaHQobWF4SGVpZ2h0KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aS5wbGFjZWhvbGRlci5jc3MoXCJtaW4taGVpZ2h0XCIsIDApO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWkucGxhY2Vob2xkZXIuaGVpZ2h0KDApO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpLnBsYWNlaG9sZGVyLmNzcyhcIm1pbi1oZWlnaHRcIiwgXCJcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5zZXRJc0Ryb3BUYXJnZXQodHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTUwKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZTogZnVuY3Rpb24gKGUsIHVpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISF1aS5zZW5kZXIgJiYgISF1aS5zZW5kZXJbMF0uaXNUb29sYm94KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLiRhcHBseShmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByZWNlaXZlZEVsZW1lbnQgPSB1aS5pdGVtLnNvcnRhYmxlLm1vZGVsO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISFyZWNlaXZlZEVsZW1lbnQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbGVtZW50LnR5cGUgPT0gXCJSb3dcIilcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmNvbW1pdEFkZENvbHVtbigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gU2hvdWxkIGlkZWFsbHkgY2FsbCBMYXlvdXRFZGl0b3IuQ29udGFpbmVyLmFkZENoaWxkKCkgaW5zdGVhZCwgYnV0IHNpbmNlIHRoaXMgaGFuZGxlclxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gaXMgcnVuICpiZWZvcmUqIHRoZSB1aS1zb3J0YWJsZSBkaXJlY3RpdmUncyBoYW5kbGVyLCBpZiB3ZSB0cnkgdG8gYWRkIHRoZSBjaGlsZCB0byB0aGVcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFycmF5IHRoYXQgaGFuZGxlciB3aWxsIGdldCBhbiBleGNlcHRpb24gd2hlbiB0cnlpbmcgdG8gZG8gdGhlIHNhbWUuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBCZWNhdXNlIG9mIHRoaXMsIHdlIG5lZWQgdG8gaW52b2tlIFwic2V0UGFyZW50XCIgc28gdGhhdCBzcGVjaWZpYyBjb250YWluZXIgdHlwZXMgY2FuIHBlcmZvcm0gZWxlbWVudCBzcGVmaWNpYyBpbml0aWFsaXphdGlvbi5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlY2VpdmVkRWxlbWVudC5zZXRFZGl0b3IoZWxlbWVudC5lZGl0b3IpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZWRFbGVtZW50LnNldFBhcmVudChlbGVtZW50KTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISFyZWNlaXZlZEVsZW1lbnQuaGFzRWRpdG9yKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLiRyb290LmVkaXRFbGVtZW50KHJlY2VpdmVkRWxlbWVudCkudGhlbihmdW5jdGlvbiAoYXJncykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWFyZ3MuY2FuY2VsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWNlaXZlZEVsZW1lbnQuZGF0YSA9IGFyZ3MuZWxlbWVudC5kYXRhO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZWRFbGVtZW50LmFwcGx5RWxlbWVudEVkaXRvck1vZGVsKGFyZ3MuZWxlbWVudEVkaXRvck1vZGVsKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISFyZWNlaXZlZEVsZW1lbnQuc2V0SHRtbClcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWNlaXZlZEVsZW1lbnQuc2V0SHRtbChhcmdzLmVsZW1lbnQuaHRtbCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEhYXJncy5jYW5jZWwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZWRFbGVtZW50LmRlbGV0ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlY2VpdmVkRWxlbWVudC5zZXRJc0ZvY3VzZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vJHNjb3BlLmlzUmVjZWl2aW5nID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnNldElzRHJvcFRhcmdldChmYWxzZSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0aW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vJHNjb3BlLmlzUmVjZWl2aW5nID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnNldElzRHJvcFRhcmdldChmYWxzZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISFyZWNlaXZlZEVsZW1lbnQpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZWRFbGVtZW50LnNldElzRm9jdXNlZCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICRzY29wZS5jbGljayA9IGZ1bmN0aW9uIChjaGlsZCwgZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWNoaWxkLmVkaXRvci5pc0RyYWdnaW5nKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGQuc2V0SXNGb2N1c2VkKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGUuc3RvcFByb3BhZ2F0aW9uKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmdldENsYXNzZXMgPSBmdW5jdGlvbiAoY2hpbGQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlc3VsdCA9IFtcImxheW91dC1lbGVtZW50XCJdO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEhY2hpbGQuY2hpbGRyZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKFwibGF5b3V0LWNvbnRhaW5lclwiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaGlsZC5nZXRJc1NlYWxlZCgpKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKFwibGF5b3V0LWNvbnRhaW5lci1zZWFsZWRcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKFwibGF5b3V0LVwiICsgY2hpbGQudHlwZS50b0xvd2VyQ2FzZSgpKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghIWNoaWxkLmRyb3BUYXJnZXRDbGFzcylcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKGNoaWxkLmRyb3BUYXJnZXRDbGFzcyk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBUT0RPOiBNb3ZlIHRoZXNlIHRvIGVpdGhlciB0aGUgQ29sdW1uIGRpcmVjdGl2ZSBvciB0aGUgQ29sdW1uIG1vZGVsIGNsYXNzLlxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2hpbGQudHlwZSA9PSBcIlJvd1wiKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaChcInJvd1wiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghY2hpbGQuY2FuQWRkQ29sdW1uKCkpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJsYXlvdXQtcm93LWZ1bGxcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoaWxkLnR5cGUgPT0gXCJDb2x1bW5cIikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJjb2wteHMtXCIgKyBjaGlsZC53aWR0aCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaChcImNvbC14cy1vZmZzZXQtXCIgKyBjaGlsZC5vZmZzZXQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaGlsZC50eXBlID09IFwiQ29udGVudFwiKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJsYXlvdXQtY29udGVudC1cIiArIGNoaWxkLmNvbnRlbnRUeXBlQ2xhc3MpO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoaWxkLmdldElzQWN0aXZlKCkpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaChcImxheW91dC1lbGVtZW50LWFjdGl2ZVwiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoaWxkLmdldElzRm9jdXNlZCgpKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJsYXlvdXQtZWxlbWVudC1mb2N1c2VkXCIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2hpbGQuZ2V0SXNTZWxlY3RlZCgpKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJsYXlvdXQtZWxlbWVudC1zZWxlY3RlZFwiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoaWxkLmdldElzRHJvcFRhcmdldCgpKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJsYXlvdXQtZWxlbWVudC1kcm9wdGFyZ2V0XCIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2hpbGQuaXNUZW1wbGF0ZWQpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaChcImxheW91dC1lbGVtZW50LXRlbXBsYXRlZFwiKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XHJcbiAgICAgICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuICAgICAgICB9XHJcbiAgICBdKTsiLCJhbmd1bGFyXG4gICAgLm1vZHVsZShcIkxheW91dEVkaXRvclwiKVxuICAgIC5kaXJlY3RpdmUoXCJvcmNMYXlvdXRFZGl0b3JcIiwgW1wiZW52aXJvbm1lbnRcIixcbiAgICAgICAgZnVuY3Rpb24gKGVudmlyb25tZW50KSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIHJlc3RyaWN0OiBcIkVcIixcbiAgICAgICAgICAgICAgICBzY29wZToge30sXG4gICAgICAgICAgICAgICAgY29udHJvbGxlcjogW1wiJHNjb3BlXCIsIFwiJGVsZW1lbnRcIiwgXCIkYXR0cnNcIiwgXCIkY29tcGlsZVwiLCBcImNsaXBib2FyZFwiLFxuICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoJHNjb3BlLCAkZWxlbWVudCwgJGF0dHJzLCAkY29tcGlsZSwgY2xpcGJvYXJkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoISEkYXR0cnMubW9kZWwpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmVsZW1lbnQgPSBldmFsKCRhdHRycy5tb2RlbCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVGhlICdtb2RlbCcgYXR0cmlidXRlIG11c3QgZXZhbHVhdGUgdG8gYSBMYXlvdXRFZGl0b3IuRWRpdG9yIG9iamVjdC5cIik7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5jbGljayA9IGZ1bmN0aW9uIChjYW52YXMsIGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWNhbnZhcy5lZGl0b3IuaXNEcmFnZ2luZylcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FudmFzLnNldElzRm9jdXNlZCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc3RvcFByb3BhZ2F0aW9uKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZ2V0Q2xhc3NlcyA9IGZ1bmN0aW9uIChjYW52YXMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcmVzdWx0ID0gW1wibGF5b3V0LWVsZW1lbnRcIiwgXCJsYXlvdXQtY29udGFpbmVyXCIsIFwibGF5b3V0LWNhbnZhc1wiXTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjYW52YXMuZ2V0SXNBY3RpdmUoKSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJsYXlvdXQtZWxlbWVudC1hY3RpdmVcIik7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNhbnZhcy5nZXRJc0ZvY3VzZWQoKSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJsYXlvdXQtZWxlbWVudC1mb2N1c2VkXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjYW52YXMuZ2V0SXNTZWxlY3RlZCgpKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaChcImxheW91dC1lbGVtZW50LXNlbGVjdGVkXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjYW52YXMuZ2V0SXNEcm9wVGFyZ2V0KCkpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKFwibGF5b3V0LWVsZW1lbnQtZHJvcHRhcmdldFwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2FudmFzLmlzVGVtcGxhdGVkKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaChcImxheW91dC1lbGVtZW50LXRlbXBsYXRlZFwiKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBBbiB1bmZvcnR1bmF0ZSBzaWRlLWVmZmVjdCBvZiB0aGUgbmV4dCBoYWNrIG9uIGxpbmUgNTQgaXMgdGhhdCB0aGUgY3JlYXRlZCBlbGVtZW50cyBhcmVuJ3QgYWRkZWQgdG8gdGhlIERPTSB5ZXQsIHNvIHdlIGNhbid0IHVzZSBpdCB0byBnZXQgdG8gdGhlIHBhcmVudCBcIi5sYXlvdXQtZGVzaWdlclwiIGVsZW1lbnQuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBXb3JrIGFyb3VuZDogYWNjZXNzIHRoYXQgZWxlbWVudCBkaXJlY3RseSAod2hpY2ggZWZlY3RpdmVseSB0dXJucyBtdWx0aXBsZSBsYXlvdXQgZWRpdG9ycyBvbiBhIHNpbmdsZSBwYWdlIGltcG9zc2libGUpLiBcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIC8vdmFyIGxheW91dERlc2lnbmVySG9zdCA9ICRlbGVtZW50LmNsb3Nlc3QoXCIubGF5b3V0LWRlc2lnbmVyXCIpLmRhdGEoXCJsYXlvdXQtZGVzaWduZXItaG9zdFwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsYXlvdXREZXNpZ25lckhvc3QgPSAkKFwiLmxheW91dC1kZXNpZ25lclwiKS5kYXRhKFwibGF5b3V0LWRlc2lnbmVyLWhvc3RcIik7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS4kcm9vdC5sYXlvdXREZXNpZ25lckhvc3QgPSBsYXlvdXREZXNpZ25lckhvc3Q7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIGxheW91dERlc2lnbmVySG9zdC5lbGVtZW50Lm9uKFwicmVwbGFjZWNhbnZhc1wiLCBmdW5jdGlvbiAoZSwgYXJncykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlZGl0b3IgPSAkc2NvcGUuZWxlbWVudDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgY2FudmFzRGF0YSA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogYXJncy5jYW52YXMuZGF0YSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHRtbElkOiBhcmdzLmNhbnZhcy5odG1sSWQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxDbGFzczogYXJncy5jYW52YXMuaHRtbENsYXNzLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBodG1sU3R5bGU6IGFyZ3MuY2FudmFzLmh0bWxTdHlsZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNUZW1wbGF0ZWQ6IGFyZ3MuY2FudmFzLmlzVGVtcGxhdGVkLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZHJlbjogYXJncy5jYW52YXMuY2hpbGRyZW5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gSEFDSzogSW5zdGVhZCBvZiBzaW1wbHkgdXBkYXRpbmcgdGhlICRzY29wZS5lbGVtZW50IHdpdGggYSBuZXcgaW5zdGFuY2UsIHdlIG5lZWQgdG8gcmVwbGFjZSB0aGUgZW50aXJlIG9yYy1sYXlvdXQtZWRpdG9yIG1hcmt1cFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGluIG9yZGVyIGZvciBhbmd1bGFyIHRvIHJlYmluZCBzdGFydGluZyB3aXRoIHRoZSBDYW52YXMgZWxlbWVudC4gT3RoZXJ3aXNlLCBmb3Igc29tZSByZWFzb24sIGl0IHdpbGwgcmViaW5kIHN0YXJ0aW5nIHdpdGggdGhlIGZpcnN0IGNoaWxkIG9mIENhbnZhcy5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBZb3UgY2FuIHNlZSB0aGlzIGhhcHBlbmluZyB3aGVuIHNldHRpbmcgYSBicmVha3BvaW50IGluIFNjb3BlQ29uZmlndXJhdG9yIHdoZXJlIGNvbnRhaW5lcnMgYXJlIGluaXRpYWxpemVkIHdpdGggZHJhZyAmIGRyb3A6IG9uIHBhZ2UgbG9hZCwgdGhlIGZpcnN0IGVsZW1lbnRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBpcyBhIENhbnZhcyAoZ29vZCksIGJ1dCBhZnRlciBoYXZpbmcgc2VsZWN0ZWQgYW5vdGhlciB0ZW1wbGF0ZSwgdGhlIGZpcnN0IGVsZW1lbnQgaXMgKHR5cGljYWxseSkgYSBHcmlkIChiYWQpLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFNpbXBseSByZWNvbXBpbGluZyB0aGUgb3JjLWxheW91dC1lZGl0b3IgZGlyZWN0aXZlIHdpbGwgY2F1c2UgdGhlIGVudGlyZSB0aGluZyB0byBiZSBnZW5lcmF0ZWQsIHdoaWNoIHdvcmtzIGp1c3QgZmluZSBhcyB3ZWxsIChldmVuIHRob3VnaCBub3QgaXMgbmljZSBhcyBzaW1wbHkgbGV2ZXJhZ2luZyBtb2RlbCBiaW5kaW5nKS5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXlvdXREZXNpZ25lckhvc3QuZWRpdG9yID0gd2luZG93LmxheW91dEVkaXRvciA9IG5ldyBMYXlvdXRFZGl0b3IuRWRpdG9yKGVkaXRvci5jb25maWcsIGNhbnZhc0RhdGEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ZW1wbGF0ZSA9IFwiPG9yYy1sYXlvdXQtZWRpdG9yXCIgKyBcIiBtb2RlbD0nd2luZG93LmxheW91dEVkaXRvcicgLz5cIjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaHRtbCA9ICRjb21waWxlKHRlbXBsYXRlKSgkc2NvcGUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICQoXCIubGF5b3V0LWVkaXRvci1ob2xkZXJcIikuaHRtbChodG1sKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuJHJvb3QuZWRpdEVsZW1lbnQgPSBmdW5jdGlvbiAoZWxlbWVudCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBob3N0ID0gJHNjb3BlLiRyb290LmxheW91dERlc2lnbmVySG9zdDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaG9zdC5lZGl0RWxlbWVudChlbGVtZW50KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS4kcm9vdC5hZGRFbGVtZW50ID0gZnVuY3Rpb24gKGNvbnRlbnRUeXBlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGhvc3QgPSAkc2NvcGUuJHJvb3QubGF5b3V0RGVzaWduZXJIb3N0O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBob3N0LmFkZEVsZW1lbnQoY29udGVudFR5cGUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgJChkb2N1bWVudCkub24oXCJjdXQgY29weSBwYXN0ZVwiLCBmdW5jdGlvbiAoZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIHRoZSBwc2V1ZG8gY2xpcGJvYXJkIHdhcyBhbHJlYWR5IGludm9rZWQgKHdoaWNoIGhhcHBlbnMgb24gdGhlIGZpcnN0IGNsaXBib2FyZFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9wZXJhdGlvbiBhZnRlciBwYWdlIGxvYWQgZXZlbiBpZiBuYXRpdmUgY2xpcGJvYXJkIHN1cHBvcnQgZXhpc3RzKSB0aGVuIHNpdCB0aGlzXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gb25lIG9wZXJhdGlvbiBvdXQsIGJ1dCBtYWtlIHN1cmUgd2hhdGV2ZXIgaXMgb24gdGhlIHBzZXVkbyBjbGlwYm9hcmQgZ2V0cyBtaWdyYXRlZFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRvIHRoZSBuYXRpdmUgY2xpcGJvYXJkIGZvciBzdWJzZXF1ZW50IG9wZXJhdGlvbnMuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNsaXBib2FyZC53YXNJbnZva2VkKCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5vcmlnaW5hbEV2ZW50LmNsaXBib2FyZERhdGEuc2V0RGF0YShcInRleHQvcGxhaW5cIiwgY2xpcGJvYXJkLmdldERhdGEoXCJ0ZXh0L3BsYWluXCIpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5vcmlnaW5hbEV2ZW50LmNsaXBib2FyZERhdGEuc2V0RGF0YShcInRleHQvanNvblwiLCBjbGlwYm9hcmQuZ2V0RGF0YShcInRleHQvanNvblwiKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmb2N1c2VkRWxlbWVudCA9ICRzY29wZS5lbGVtZW50LmZvY3VzZWRFbGVtZW50O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISFmb2N1c2VkRWxlbWVudCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLiRhcHBseShmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnR5cGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcImNvcHlcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvY3VzZWRFbGVtZW50LmNvcHkoZS5vcmlnaW5hbEV2ZW50LmNsaXBib2FyZERhdGEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJjdXRcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvY3VzZWRFbGVtZW50LmN1dChlLm9yaWdpbmFsRXZlbnQuY2xpcGJvYXJkRGF0YSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcInBhc3RlXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb2N1c2VkRWxlbWVudC5wYXN0ZShlLm9yaWdpbmFsRXZlbnQuY2xpcGJvYXJkRGF0YSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gSEFDSzogV29ya2Fyb3VuZCBiZWNhdXNlIG9mIGhvdyBBbmd1bGFyIHRyZWF0cyB0aGUgRE9NIHdoZW4gZWxlbWVudHMgYXJlIHNoaWZ0ZWQgYXJvdW5kIC0gaW5wdXQgZm9jdXMgaXMgc29tZXRpbWVzIGxvc3QuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLiRhcHBseShmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghISRzY29wZS5lbGVtZW50LmZvY3VzZWRFbGVtZW50KVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmVsZW1lbnQuZm9jdXNlZEVsZW1lbnQuc2V0SXNGb2N1c2VkKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBOYXRpdmUgY2xpcGJvYXJkIHN1cHBvcnQgb2J2aW91c2x5IGV4aXN0cywgc28gZGlzYWJsZSB0aGUgcGV1ZG8gY2xpcGJvYXJkIGZyb20gbm93IG9uLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaXBib2FyZC5kaXNhYmxlKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIF0sXG4gICAgICAgICAgICAgICAgdGVtcGxhdGVVcmw6IGVudmlyb25tZW50LnRlbXBsYXRlVXJsKFwiRWRpdG9yXCIpLFxuICAgICAgICAgICAgICAgIHJlcGxhY2U6IHRydWUsXG4gICAgICAgICAgICAgICAgbGluazogZnVuY3Rpb24gKHNjb3BlLCBlbGVtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIE5vIGNsaWNrcyBzaG91bGQgcHJvcGFnYXRlIGZyb20gdGhlIFRpbnlNQ0UgdG9vbGJhcnMuXG4gICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuZmluZChcIi5sYXlvdXQtdG9vbGJhci1jb250YWluZXJcIikuY2xpY2soZnVuY3Rpb24gKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGUuc3RvcFByb3BhZ2F0aW9uKCk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAvLyBVbmZvY3VzIGFuZCB1bnNlbGVjdCBldmVyeXRoaW5nIG9uIGNsaWNrIG91dHNpZGUgb2YgY2FudmFzLlxuICAgICAgICAgICAgICAgICAgICAkKHdpbmRvdykuY2xpY2soZnVuY3Rpb24gKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlLiRhcHBseShmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuZWxlbWVudC5hY3RpdmVFbGVtZW50ID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZS5lbGVtZW50LmZvY3VzZWRFbGVtZW50ID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgXSk7IiwiYW5ndWxhclxuICAgIC5tb2R1bGUoXCJMYXlvdXRFZGl0b3JcIilcbiAgICAuZGlyZWN0aXZlKFwib3JjTGF5b3V0Q2FudmFzXCIsIFtcInNjb3BlQ29uZmlndXJhdG9yXCIsIFwiZW52aXJvbm1lbnRcIixcbiAgICAgICAgZnVuY3Rpb24gKHNjb3BlQ29uZmlndXJhdG9yLCBlbnZpcm9ubWVudCkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICByZXN0cmljdDogXCJFXCIsXG4gICAgICAgICAgICAgICAgc2NvcGU6IHsgZWxlbWVudDogXCI9XCIgfSxcbiAgICAgICAgICAgICAgICBjb250cm9sbGVyOiBbXCIkc2NvcGVcIiwgXCIkZWxlbWVudFwiLCBcIiRhdHRyc1wiLFxuICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoJHNjb3BlLCAkZWxlbWVudCwgJGF0dHJzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzY29wZUNvbmZpZ3VyYXRvci5jb25maWd1cmVGb3JFbGVtZW50KCRzY29wZSwgJGVsZW1lbnQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGVDb25maWd1cmF0b3IuY29uZmlndXJlRm9yQ29udGFpbmVyKCRzY29wZSwgJGVsZW1lbnQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLnNvcnRhYmxlT3B0aW9uc1tcImF4aXNcIl0gPSBcInlcIjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIF0sXG4gICAgICAgICAgICAgICAgdGVtcGxhdGVVcmw6IGVudmlyb25tZW50LnRlbXBsYXRlVXJsKFwiQ2FudmFzXCIpLFxuICAgICAgICAgICAgICAgIHJlcGxhY2U6IHRydWVcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICBdKTsiLCJhbmd1bGFyXG4gICAgLm1vZHVsZShcIkxheW91dEVkaXRvclwiKVxuICAgIC5kaXJlY3RpdmUoXCJvcmNMYXlvdXRDaGlsZFwiLCBbXCIkY29tcGlsZVwiLFxuICAgICAgICBmdW5jdGlvbiAoJGNvbXBpbGUpIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgcmVzdHJpY3Q6IFwiRVwiLFxuICAgICAgICAgICAgICAgIHNjb3BlOiB7IGVsZW1lbnQ6IFwiPVwiIH0sXG4gICAgICAgICAgICAgICAgbGluazogZnVuY3Rpb24gKHNjb3BlLCBlbGVtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciB0ZW1wbGF0ZSA9IFwiPG9yYy1sYXlvdXQtXCIgKyBzY29wZS5lbGVtZW50LnR5cGUudG9Mb3dlckNhc2UoKSArIFwiIGVsZW1lbnQ9J2VsZW1lbnQnIC8+XCI7XG4gICAgICAgICAgICAgICAgICAgIHZhciBodG1sID0gJGNvbXBpbGUodGVtcGxhdGUpKHNjb3BlKTtcbiAgICAgICAgICAgICAgICAgICAgJChlbGVtZW50KS5yZXBsYWNlV2l0aChodG1sKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgXSk7IiwiYW5ndWxhclxuICAgIC5tb2R1bGUoXCJMYXlvdXRFZGl0b3JcIilcbiAgICAuZGlyZWN0aXZlKFwib3JjTGF5b3V0Q29sdW1uXCIsIFtcIiRjb21waWxlXCIsIFwic2NvcGVDb25maWd1cmF0b3JcIiwgXCJlbnZpcm9ubWVudFwiLFxuICAgICAgICBmdW5jdGlvbiAoJGNvbXBpbGUsIHNjb3BlQ29uZmlndXJhdG9yLCBlbnZpcm9ubWVudCkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICByZXN0cmljdDogXCJFXCIsXG4gICAgICAgICAgICAgICAgc2NvcGU6IHsgZWxlbWVudDogXCI9XCIgfSxcbiAgICAgICAgICAgICAgICBjb250cm9sbGVyOiBbXCIkc2NvcGVcIiwgXCIkZWxlbWVudFwiLFxuICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoJHNjb3BlLCAkZWxlbWVudCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGVDb25maWd1cmF0b3IuY29uZmlndXJlRm9yRWxlbWVudCgkc2NvcGUsICRlbGVtZW50KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlQ29uZmlndXJhdG9yLmNvbmZpZ3VyZUZvckNvbnRhaW5lcigkc2NvcGUsICRlbGVtZW50KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5zb3J0YWJsZU9wdGlvbnNbXCJheGlzXCJdID0gXCJ5XCI7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBdLFxuICAgICAgICAgICAgICAgIHRlbXBsYXRlVXJsOiBlbnZpcm9ubWVudC50ZW1wbGF0ZVVybChcIkNvbHVtblwiKSxcbiAgICAgICAgICAgICAgICByZXBsYWNlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGxpbms6IGZ1bmN0aW9uIChzY29wZSwgZWxlbWVudCwgYXR0cnMpIHtcbiAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5maW5kKFwiLmxheW91dC1jb2x1bW4tcmVzaXplLWJhclwiKS5kcmFnZ2FibGUoe1xuICAgICAgICAgICAgICAgICAgICAgICAgYXhpczogXCJ4XCIsXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWxwZXI6IFwiY2xvbmVcIixcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldmVydDogdHJ1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0OiBmdW5jdGlvbiAoZSwgdWkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZS4kYXBwbHkoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZS5lbGVtZW50LmVkaXRvci5pc1Jlc2l6aW5nID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICBkcmFnOiBmdW5jdGlvbiAoZSwgdWkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgY29sdW1uRWxlbWVudCA9IGVsZW1lbnQucGFyZW50KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGNvbHVtblNpemUgPSBjb2x1bW5FbGVtZW50LndpZHRoKCkgLyBzY29wZS5lbGVtZW50LndpZHRoO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjb25uZWN0QWRqYWNlbnQgPSAhZS5jdHJsS2V5O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkKGUudGFyZ2V0KS5oYXNDbGFzcyhcImxheW91dC1jb2x1bW4tcmVzaXplLWJhci1sZWZ0XCIpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkZWx0YSA9IHVpLm9mZnNldC5sZWZ0IC0gY29sdW1uRWxlbWVudC5vZmZzZXQoKS5sZWZ0O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGVsdGEgPCAtY29sdW1uU2l6ZSAmJiBzY29wZS5lbGVtZW50LmNhbkV4cGFuZExlZnQoY29ubmVjdEFkamFjZW50KSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuJGFwcGx5KGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZS5lbGVtZW50LmV4cGFuZExlZnQoY29ubmVjdEFkamFjZW50KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGRlbHRhID4gY29sdW1uU2l6ZSAmJiBzY29wZS5lbGVtZW50LmNhbkNvbnRyYWN0TGVmdChjb25uZWN0QWRqYWNlbnQpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZS4kYXBwbHkoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlLmVsZW1lbnQuY29udHJhY3RMZWZ0KGNvbm5lY3RBZGphY2VudCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgkKGUudGFyZ2V0KS5oYXNDbGFzcyhcImxheW91dC1jb2x1bW4tcmVzaXplLWJhci1yaWdodFwiKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZGVsdGEgPSB1aS5vZmZzZXQubGVmdCAtIGNvbHVtbkVsZW1lbnQud2lkdGgoKSAtIGNvbHVtbkVsZW1lbnQub2Zmc2V0KCkubGVmdDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRlbHRhID4gY29sdW1uU2l6ZSAmJiBzY29wZS5lbGVtZW50LmNhbkV4cGFuZFJpZ2h0KGNvbm5lY3RBZGphY2VudCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlLiRhcHBseShmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuZWxlbWVudC5leHBhbmRSaWdodChjb25uZWN0QWRqYWNlbnQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZGVsdGEgPCAtY29sdW1uU2l6ZSAmJiBzY29wZS5lbGVtZW50LmNhbkNvbnRyYWN0UmlnaHQoY29ubmVjdEFkamFjZW50KSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuJGFwcGx5KGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZS5lbGVtZW50LmNvbnRyYWN0UmlnaHQoY29ubmVjdEFkamFjZW50KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RvcDogZnVuY3Rpb24gKGUsIHVpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuJGFwcGx5KGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlLmVsZW1lbnQuZWRpdG9yLmlzUmVzaXppbmcgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIF0pOyIsImFuZ3VsYXJcclxuICAgIC5tb2R1bGUoXCJMYXlvdXRFZGl0b3JcIilcclxuICAgIC5kaXJlY3RpdmUoXCJvcmNMYXlvdXRDb250ZW50XCIsIFtcIiRzY2VcIiwgXCJzY29wZUNvbmZpZ3VyYXRvclwiLCBcImVudmlyb25tZW50XCIsXHJcbiAgICAgICAgZnVuY3Rpb24gKCRzY2UsIHNjb3BlQ29uZmlndXJhdG9yLCBlbnZpcm9ubWVudCkge1xyXG4gICAgICAgICAgICByZXR1cm4ge1xyXG4gICAgICAgICAgICAgICAgcmVzdHJpY3Q6IFwiRVwiLFxyXG4gICAgICAgICAgICAgICAgc2NvcGU6IHsgZWxlbWVudDogXCI9XCIgfSxcclxuICAgICAgICAgICAgICAgIGNvbnRyb2xsZXI6IFtcIiRzY29wZVwiLCBcIiRlbGVtZW50XCIsXHJcbiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKCRzY29wZSwgJGVsZW1lbnQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGVDb25maWd1cmF0b3IuY29uZmlndXJlRm9yRWxlbWVudCgkc2NvcGUsICRlbGVtZW50KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIE92ZXJ3cml0ZSB0aGUgc2V0SHRtbCBmdW5jdGlvbiBzbyB0aGF0IHdlIGNhbiB1c2UgdGhlICRzY2Ugc2VydmljZSB0byB0cnVzdCB0aGUgaHRtbCAoYW5kIG5vdCBoYXZlIHRoZSBodG1sIGJpbmRpbmcgc3RyaXAgY2VydGFpbiB0YWdzKS5cclxuICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmVsZW1lbnQuc2V0SHRtbCA9IGZ1bmN0aW9uIChodG1sKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZWxlbWVudC5odG1sID0gaHRtbDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5lbGVtZW50Lmh0bWxVbnNhZmUgPSAkc2NlLnRydXN0QXNIdG1sKGh0bWwpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmVsZW1lbnQuc2V0SHRtbCgkc2NvcGUuZWxlbWVudC5odG1sKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICAgICAgdGVtcGxhdGVVcmw6IGVudmlyb25tZW50LnRlbXBsYXRlVXJsKFwiQ29udGVudFwiKSxcclxuICAgICAgICAgICAgICAgIHJlcGxhY2U6IHRydWVcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICB9XHJcbiAgICBdKTsiLCJhbmd1bGFyXG4gICAgLm1vZHVsZShcIkxheW91dEVkaXRvclwiKVxuICAgIC5kaXJlY3RpdmUoXCJvcmNMYXlvdXRHcmlkXCIsIFtcIiRjb21waWxlXCIsIFwic2NvcGVDb25maWd1cmF0b3JcIiwgXCJlbnZpcm9ubWVudFwiLFxuICAgICAgICBmdW5jdGlvbiAoJGNvbXBpbGUsIHNjb3BlQ29uZmlndXJhdG9yLCBlbnZpcm9ubWVudCkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICByZXN0cmljdDogXCJFXCIsXG4gICAgICAgICAgICAgICAgc2NvcGU6IHsgZWxlbWVudDogXCI9XCIgfSxcbiAgICAgICAgICAgICAgICBjb250cm9sbGVyOiBbXCIkc2NvcGVcIiwgXCIkZWxlbWVudFwiLFxuICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoJHNjb3BlLCAkZWxlbWVudCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGVDb25maWd1cmF0b3IuY29uZmlndXJlRm9yRWxlbWVudCgkc2NvcGUsICRlbGVtZW50KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlQ29uZmlndXJhdG9yLmNvbmZpZ3VyZUZvckNvbnRhaW5lcigkc2NvcGUsICRlbGVtZW50KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5zb3J0YWJsZU9wdGlvbnNbXCJheGlzXCJdID0gXCJ5XCI7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBdLFxuICAgICAgICAgICAgICAgIHRlbXBsYXRlVXJsOiBlbnZpcm9ubWVudC50ZW1wbGF0ZVVybChcIkdyaWRcIiksXG4gICAgICAgICAgICAgICAgcmVwbGFjZTogdHJ1ZVxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIF0pOyIsImFuZ3VsYXJcbiAgICAubW9kdWxlKFwiTGF5b3V0RWRpdG9yXCIpXG4gICAgLmRpcmVjdGl2ZShcIm9yY0xheW91dFJvd1wiLCBbXCIkY29tcGlsZVwiLCBcInNjb3BlQ29uZmlndXJhdG9yXCIsIFwiZW52aXJvbm1lbnRcIixcbiAgICAgICAgZnVuY3Rpb24gKCRjb21waWxlLCBzY29wZUNvbmZpZ3VyYXRvciwgZW52aXJvbm1lbnQpIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgcmVzdHJpY3Q6IFwiRVwiLFxuICAgICAgICAgICAgICAgIHNjb3BlOiB7IGVsZW1lbnQ6IFwiPVwiIH0sXG4gICAgICAgICAgICAgICAgY29udHJvbGxlcjogW1wiJHNjb3BlXCIsIFwiJGVsZW1lbnRcIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKCRzY29wZSwgJGVsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlQ29uZmlndXJhdG9yLmNvbmZpZ3VyZUZvckVsZW1lbnQoJHNjb3BlLCAkZWxlbWVudCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBzY29wZUNvbmZpZ3VyYXRvci5jb25maWd1cmVGb3JDb250YWluZXIoJHNjb3BlLCAkZWxlbWVudCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuc29ydGFibGVPcHRpb25zW1wiYXhpc1wiXSA9IFwieFwiO1xuICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLnNvcnRhYmxlT3B0aW9uc1tcInVpLWZsb2F0aW5nXCJdID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIF0sXG4gICAgICAgICAgICAgICAgdGVtcGxhdGVVcmw6IGVudmlyb25tZW50LnRlbXBsYXRlVXJsKFwiUm93XCIpLFxuICAgICAgICAgICAgICAgIHJlcGxhY2U6IHRydWVcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICBdKTsiLCJhbmd1bGFyXG4gICAgLm1vZHVsZShcIkxheW91dEVkaXRvclwiKVxuICAgIC5kaXJlY3RpdmUoXCJvcmNMYXlvdXRQb3B1cFwiLCBbXG4gICAgICAgIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgcmVzdHJpY3Q6IFwiQVwiLFxuICAgICAgICAgICAgICAgIGxpbms6IGZ1bmN0aW9uIChzY29wZSwgZWxlbWVudCwgYXR0cnMpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBvcHVwID0gJChlbGVtZW50KTtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHRyaWdnZXIgPSBwb3B1cC5jbG9zZXN0KFwiLmxheW91dC1wb3B1cC10cmlnZ2VyXCIpO1xuICAgICAgICAgICAgICAgICAgICB2YXIgcGFyZW50RWxlbWVudCA9IHBvcHVwLmNsb3Nlc3QoXCIubGF5b3V0LWVsZW1lbnRcIik7XG4gICAgICAgICAgICAgICAgICAgIHRyaWdnZXIuY2xpY2soZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcG9wdXAudG9nZ2xlKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocG9wdXAuaXMoXCI6dmlzaWJsZVwiKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvcHVwLnBvc2l0aW9uKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbXk6IGF0dHJzLm9yY0xheW91dFBvcHVwTXkgfHwgXCJsZWZ0IHRvcFwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdDogYXR0cnMub3JjTGF5b3V0UG9wdXBBdCB8fCBcImxlZnQgYm90dG9tKzRweFwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvZjogdHJpZ2dlclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvcHVwLmZpbmQoXCJpbnB1dFwiKS5maXJzdCgpLmZvY3VzKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICBwb3B1cC5jbGljayhmdW5jdGlvbiAoZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgZS5zdG9wUHJvcGFnYXRpb24oKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIHBhcmVudEVsZW1lbnQuY2xpY2soZnVuY3Rpb24gKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBvcHVwLmhpZGUoKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIHBvcHVwLmtleWRvd24oZnVuY3Rpb24gKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5jdHJsS2V5ICYmICFlLnNoaWZ0S2V5ICYmICFlLmFsdEtleSAmJiBlLndoaWNoID09IDI3KSAvLyBFc2NcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb3B1cC5oaWRlKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbigpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgcG9wdXAub24oXCJjdXQgY29weSBwYXN0ZVwiLCBmdW5jdGlvbiAoZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gQWxsb3cgY2xpcGJvYXJkIG9wZXJhdGlvbnMgaW4gcG9wdXAgd2l0aG91dCBpbnZva2luZyBjbGlwYm9hcmQgZXZlbnQgaGFuZGxlcnMgb24gcGFyZW50IGVsZW1lbnQuXG4gICAgICAgICAgICAgICAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbigpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgXSk7IiwiYW5ndWxhclxuICAgIC5tb2R1bGUoXCJMYXlvdXRFZGl0b3JcIilcbiAgICAuZGlyZWN0aXZlKFwib3JjTGF5b3V0VG9vbGJveFwiLCBbXCIkY29tcGlsZVwiLCBcImVudmlyb25tZW50XCIsXG4gICAgICAgIGZ1bmN0aW9uICgkY29tcGlsZSwgZW52aXJvbm1lbnQpIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgcmVzdHJpY3Q6IFwiRVwiLFxuICAgICAgICAgICAgICAgIGNvbnRyb2xsZXI6IFtcIiRzY29wZVwiLCBcIiRlbGVtZW50XCIsXG4gICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICgkc2NvcGUsICRlbGVtZW50KSB7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5yZXNldEVsZW1lbnRzID0gZnVuY3Rpb24gKCkge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmdyaWRFbGVtZW50cyA9IFtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0RWRpdG9yLkdyaWQuZnJvbSh7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94SWNvbjogXCJcXHVmMDBhXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94TGFiZWw6IFwiR3JpZFwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveERlc2NyaXB0aW9uOiBcIkVtcHR5IGdyaWQuXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZHJlbjogW11cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLnJvd0VsZW1lbnRzID0gW1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMYXlvdXRFZGl0b3IuUm93LmZyb20oe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveEljb246IFwiXFx1ZjBjOVwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveExhYmVsOiBcIlJvdyAoMSBjb2x1bW4pXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94RGVzY3JpcHRpb246IFwiUm93IHdpdGggMSBjb2x1bW4uXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZHJlbjogTGF5b3V0RWRpdG9yLkNvbHVtbi50aW1lcygxKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0RWRpdG9yLlJvdy5mcm9tKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hJY29uOiBcIlxcdWYwYzlcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hMYWJlbDogXCJSb3cgKDIgY29sdW1ucylcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hEZXNjcmlwdGlvbjogXCJSb3cgd2l0aCAyIGNvbHVtbnMuXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZHJlbjogTGF5b3V0RWRpdG9yLkNvbHVtbi50aW1lcygyKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0RWRpdG9yLlJvdy5mcm9tKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hJY29uOiBcIlxcdWYwYzlcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hMYWJlbDogXCJSb3cgKDMgY29sdW1ucylcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hEZXNjcmlwdGlvbjogXCJSb3cgd2l0aCAzIGNvbHVtbnMuXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZHJlbjogTGF5b3V0RWRpdG9yLkNvbHVtbi50aW1lcygzKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0RWRpdG9yLlJvdy5mcm9tKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hJY29uOiBcIlxcdWYwYzlcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hMYWJlbDogXCJSb3cgKDQgY29sdW1ucylcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hEZXNjcmlwdGlvbjogXCJSb3cgd2l0aCA0IGNvbHVtbnMuXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZHJlbjogTGF5b3V0RWRpdG9yLkNvbHVtbi50aW1lcyg0KVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0RWRpdG9yLlJvdy5mcm9tKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hJY29uOiBcIlxcdWYwYzlcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hMYWJlbDogXCJSb3cgKDYgY29sdW1ucylcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hEZXNjcmlwdGlvbjogXCJSb3cgd2l0aCA2IGNvbHVtbnMuXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZHJlbjogTGF5b3V0RWRpdG9yLkNvbHVtbi50aW1lcyg2KVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0RWRpdG9yLlJvdy5mcm9tKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hJY29uOiBcIlxcdWYwYzlcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hMYWJlbDogXCJSb3cgKDEyIGNvbHVtbnMpXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94RGVzY3JpcHRpb246IFwiUm93IHdpdGggMTIgY29sdW1ucy5cIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuOiBMYXlvdXRFZGl0b3IuQ29sdW1uLnRpbWVzKDEyKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgTGF5b3V0RWRpdG9yLlJvdy5mcm9tKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hJY29uOiBcIlxcdWYwYzlcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hMYWJlbDogXCJSb3cgKGVtcHR5KVwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveERlc2NyaXB0aW9uOiBcIkVtcHR5IHJvdy5cIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuOiBbXVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuY29sdW1uRWxlbWVudHMgPSBbXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExheW91dEVkaXRvci5Db2x1bW4uZnJvbSh7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94SWNvbjogXCJcXHVmMGRiXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94TGFiZWw6IFwiQ29sdW1uXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94RGVzY3JpcHRpb246IFwiRW1wdHkgY29sdW1uLlwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IDEsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvZmZzZXQ6IDAsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZHJlbjogW11cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmNhbnZhc0VsZW1lbnRzID0gW1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMYXlvdXRFZGl0b3IuQ2FudmFzLmZyb20oe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveEljb246IFwiXFx1ZjA0NFwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveExhYmVsOiBcIkNhbnZhc1wiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveERlc2NyaXB0aW9uOiBcIkVtcHR5IGNhbnZhcy5cIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuOiBbXVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuY29udGVudEVsZW1lbnRDYXRlZ29yaWVzID0gXygkc2NvcGUuZWxlbWVudC5jb25maWcuY2F0ZWdvcmllcykubWFwKGZ1bmN0aW9uIChjYXRlZ29yeSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogY2F0ZWdvcnkubmFtZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRzOiBfKGNhdGVnb3J5LmNvbnRlbnRUeXBlcykubWFwKGZ1bmN0aW9uIChjb250ZW50VHlwZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0eXBlID0gY29udGVudFR5cGUudHlwZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZmFjdG9yeSA9IExheW91dEVkaXRvci5mYWN0b3JpZXNbdHlwZV0gfHwgTGF5b3V0RWRpdG9yLmZhY3Rvcmllc1tcIkNvbnRlbnRcIl07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGl0ZW0gPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzVGVtcGxhdGVkOiBmYWxzZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFR5cGU6IGNvbnRlbnRUeXBlLmlkLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50VHlwZUxhYmVsOiBjb250ZW50VHlwZS5sYWJlbCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFR5cGVDbGFzczogY29udGVudFR5cGUudHlwZUNsYXNzLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBudWxsLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNFZGl0b3I6IGNvbnRlbnRUeXBlLmhhc0VkaXRvcixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHRtbDogY29udGVudFR5cGUuaHRtbFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSBmYWN0b3J5KGl0ZW0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQudG9vbGJveEljb24gPSBjb250ZW50VHlwZS5pY29uIHx8IFwiXFx1ZjFjOVwiO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQudG9vbGJveExhYmVsID0gY29udGVudFR5cGUubGFiZWw7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC50b29sYm94RGVzY3JpcHRpb24gPSBjb250ZW50VHlwZS5kZXNjcmlwdGlvbjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWxlbWVudDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5yZXNldEVsZW1lbnRzKCk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5nZXRTb3J0YWJsZU9wdGlvbnMgPSBmdW5jdGlvbiAodHlwZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlZGl0b3JJZCA9ICRlbGVtZW50LmNsb3Nlc3QoXCIubGF5b3V0LWVkaXRvclwiKS5hdHRyKFwiaWRcIik7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHBhcmVudENsYXNzZXM7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHBsYWNlaG9sZGVyQ2xhc3NlcztcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZmxvYXRpbmcgPSBmYWxzZTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodHlwZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiR3JpZFwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyZW50Q2xhc3NlcyA9IFtcIi5sYXlvdXQtY2FudmFzXCIsIFwiLmxheW91dC1jb2x1bW5cIiwgXCIubGF5b3V0LWNvbW1vbi1ob2xkZXJcIl07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwbGFjZWhvbGRlckNsYXNzZXMgPSBcImxheW91dC1lbGVtZW50IGxheW91dC1jb250YWluZXIgbGF5b3V0LWdyaWQgdWktc29ydGFibGUtcGxhY2Vob2xkZXJcIjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiUm93XCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJlbnRDbGFzc2VzID0gW1wiLmxheW91dC1ncmlkXCJdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGxhY2Vob2xkZXJDbGFzc2VzID0gXCJsYXlvdXQtZWxlbWVudCBsYXlvdXQtY29udGFpbmVyIGxheW91dC1yb3cgcm93IHVpLXNvcnRhYmxlLXBsYWNlaG9sZGVyXCI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcIkNvbHVtblwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyZW50Q2xhc3NlcyA9IFtcIi5sYXlvdXQtcm93Om5vdCgubGF5b3V0LXJvdy1mdWxsKVwiXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBsYWNlaG9sZGVyQ2xhc3NlcyA9IFwibGF5b3V0LWVsZW1lbnQgbGF5b3V0LWNvbnRhaW5lciBsYXlvdXQtY29sdW1uIHVpLXNvcnRhYmxlLXBsYWNlaG9sZGVyXCI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdGluZyA9IHRydWU7IC8vIFRvIGVuc3VyZSBhIHNtb290aCBob3Jpem9udGFsLWxpc3QgcmVvcmRlcmluZy4gaHR0cHM6Ly9naXRodWIuY29tL2FuZ3VsYXItdWkvdWktc29ydGFibGUjZmxvYXRpbmdcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiQ29udGVudFwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyZW50Q2xhc3NlcyA9IFtcIi5sYXlvdXQtY2FudmFzXCIsIFwiLmxheW91dC1jb2x1bW5cIiwgXCIubGF5b3V0LWNvbW1vbi1ob2xkZXJcIl07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwbGFjZWhvbGRlckNsYXNzZXMgPSBcImxheW91dC1lbGVtZW50IGxheW91dC1jb250ZW50IHVpLXNvcnRhYmxlLXBsYWNlaG9sZGVyXCI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcIkNhbnZhc1wiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyZW50Q2xhc3NlcyA9IFtcIi5sYXlvdXQtY2FudmFzXCIsIFwiLmxheW91dC1jb2x1bW5cIiwgXCIubGF5b3V0LWNvbW1vbi1ob2xkZXJcIl07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwbGFjZWhvbGRlckNsYXNzZXMgPSBcImxheW91dC1lbGVtZW50IGxheW91dC1jb250YWluZXIgbGF5b3V0LWdyaWQgdWktc29ydGFibGUtcGxhY2Vob2xkZXJcIjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnNvcjogXCJtb3ZlXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbm5lY3RXaXRoOiBfKHBhcmVudENsYXNzZXMpLm1hcChmdW5jdGlvbiAoZSkgeyByZXR1cm4gXCIjXCIgKyBlZGl0b3JJZCArIFwiIFwiICsgZSArIFwiOm5vdCgubGF5b3V0LWNvbnRhaW5lci1zZWFsZWQpID4gLmxheW91dC1lbGVtZW50LXdyYXBwZXIgPiAubGF5b3V0LWNoaWxkcmVuXCI7IH0pLmpvaW4oXCIsIFwiKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGxhY2Vob2xkZXI6IHBsYWNlaG9sZGVyQ2xhc3NlcyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ1aS1mbG9hdGluZ1wiOiBmbG9hdGluZyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlYXRlOiBmdW5jdGlvbiAoZSwgdWkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUudGFyZ2V0LmlzVG9vbGJveCA9IHRydWU7IC8vIFdpbGwgaW5kaWNhdGUgdG8gY29ubmVjdGVkIHNvcnRhYmxlcyB0aGF0IGRyb3BwZWQgaXRlbXMgd2VyZSBzZW50IGZyb20gdG9vbGJveC5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IGZ1bmN0aW9uIChlLCB1aSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLiRhcHBseShmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmVsZW1lbnQuaXNEcmFnZ2luZyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcDogZnVuY3Rpb24gKGUsIHVpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuJGFwcGx5KGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZWxlbWVudC5pc0RyYWdnaW5nID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLnJlc2V0RWxlbWVudHMoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdmVyOiBmdW5jdGlvbiAoZSwgdWkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS4kYXBwbHkoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5lbGVtZW50LmNhbnZhcy5zZXRJc0Ryb3BUYXJnZXQoZmFsc2UpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGxheW91dElzQ29sbGFwc2VkQ29va2llTmFtZSA9IFwibGF5b3V0VG9vbGJveENhdGVnb3J5X0xheW91dF9Jc0NvbGxhcHNlZFwiO1xuICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmxheW91dElzQ29sbGFwc2VkID0gJC5jb29raWUobGF5b3V0SXNDb2xsYXBzZWRDb29raWVOYW1lKSA9PT0gXCJ0cnVlXCI7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS50b2dnbGVMYXlvdXRJc0NvbGxhcHNlZCA9IGZ1bmN0aW9uIChlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmxheW91dElzQ29sbGFwc2VkID0gISRzY29wZS5sYXlvdXRJc0NvbGxhcHNlZDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkLmNvb2tpZShsYXlvdXRJc0NvbGxhcHNlZENvb2tpZU5hbWUsICRzY29wZS5sYXlvdXRJc0NvbGxhcHNlZCwgeyBleHBpcmVzOiAzNjUgfSk7IC8vIFJlbWVtYmVyIGNvbGxhcHNlZCBzdGF0ZSBmb3IgYSB5ZWFyLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbigpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIF0sXG4gICAgICAgICAgICAgICAgdGVtcGxhdGVVcmw6IGVudmlyb25tZW50LnRlbXBsYXRlVXJsKFwiVG9vbGJveFwiKSxcbiAgICAgICAgICAgICAgICByZXBsYWNlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGxpbms6IGZ1bmN0aW9uIChzY29wZSwgZWxlbWVudCkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgdG9vbGJveCA9IGVsZW1lbnQuZmluZChcIi5sYXlvdXQtdG9vbGJveFwiKTtcbiAgICAgICAgICAgICAgICAgICAgJCh3aW5kb3cpLm9uKFwicmVzaXplIHNjcm9sbFwiLCBmdW5jdGlvbiAoZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGNhbnZhcyA9IGVsZW1lbnQucGFyZW50KCkuZmluZChcIi5sYXlvdXQtY2FudmFzXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgdGhlIGNhbnZhcyBpcyB0YWxsZXIgdGhhbiB0aGUgdG9vbGJveCwgbWFrZSB0aGUgdG9vbGJveCBzdGlja3ktcG9zaXRpb25lZCB3aXRoaW4gdGhlIGVkaXRvclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gdG8gaGVscCB0aGUgdXNlciBhdm9pZCBleGNlc3NpdmUgdmVydGljYWwgc2Nyb2xsaW5nLlxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGNhbnZhc0lzVGFsbGVyID0gISFjYW52YXMgJiYgY2FudmFzLmhlaWdodCgpID4gdG9vbGJveC5oZWlnaHQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB3aW5kb3dQb3MgPSAkKHdpbmRvdykuc2Nyb2xsVG9wKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2FudmFzSXNUYWxsZXIgJiYgd2luZG93UG9zID4gZWxlbWVudC5vZmZzZXQoKS50b3AgKyBlbGVtZW50LmhlaWdodCgpIC0gdG9vbGJveC5oZWlnaHQoKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3guYWRkQ2xhc3MoXCJzdGlja3ktYm90dG9tXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3gucmVtb3ZlQ2xhc3MoXCJzdGlja3ktdG9wXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoY2FudmFzSXNUYWxsZXIgJiYgd2luZG93UG9zID4gZWxlbWVudC5vZmZzZXQoKS50b3ApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94LmFkZENsYXNzKFwic3RpY2t5LXRvcFwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94LnJlbW92ZUNsYXNzKFwic3RpY2t5LWJvdHRvbVwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3gucmVtb3ZlQ2xhc3MoXCJzdGlja3ktdG9wXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3gucmVtb3ZlQ2xhc3MoXCJzdGlja3ktYm90dG9tXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgXSk7IiwiYW5ndWxhclxuICAgIC5tb2R1bGUoXCJMYXlvdXRFZGl0b3JcIilcbiAgICAuZGlyZWN0aXZlKFwib3JjTGF5b3V0VG9vbGJveEdyb3VwXCIsIFtcIiRjb21waWxlXCIsIFwiZW52aXJvbm1lbnRcIixcbiAgICAgICAgZnVuY3Rpb24gKCRjb21waWxlLCBlbnZpcm9ubWVudCkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICByZXN0cmljdDogXCJFXCIsXG4gICAgICAgICAgICAgICAgc2NvcGU6IHsgY2F0ZWdvcnk6IFwiPVwiIH0sXG4gICAgICAgICAgICAgICAgY29udHJvbGxlcjogW1wiJHNjb3BlXCIsIFwiJGVsZW1lbnRcIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKCRzY29wZSwgJGVsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpc0NvbGxhcHNlZENvb2tpZU5hbWUgPSBcImxheW91dFRvb2xib3hDYXRlZ29yeV9cIiArICRzY29wZS5jYXRlZ29yeS5uYW1lICsgXCJfSXNDb2xsYXBzZWRcIjtcbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5pc0NvbGxhcHNlZCA9ICQuY29va2llKGlzQ29sbGFwc2VkQ29va2llTmFtZSkgPT09IFwidHJ1ZVwiO1xuICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLnRvZ2dsZUlzQ29sbGFwc2VkID0gZnVuY3Rpb24gKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuaXNDb2xsYXBzZWQgPSAhJHNjb3BlLmlzQ29sbGFwc2VkO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICQuY29va2llKGlzQ29sbGFwc2VkQ29va2llTmFtZSwgJHNjb3BlLmlzQ29sbGFwc2VkLCB7IGV4cGlyZXM6IDM2NSB9KTsgLy8gUmVtZW1iZXIgY29sbGFwc2VkIHN0YXRlIGZvciBhIHllYXIuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc3RvcFByb3BhZ2F0aW9uKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgXSxcbiAgICAgICAgICAgICAgICB0ZW1wbGF0ZVVybDogZW52aXJvbm1lbnQudGVtcGxhdGVVcmwoXCJUb29sYm94R3JvdXBcIiksXG4gICAgICAgICAgICAgICAgcmVwbGFjZTogdHJ1ZVxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIF0pOyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ== +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkxheW91dEVkaXRvci5qcyIsIk1vZHVsZS5qcyIsIkNsaXBib2FyZC5qcyIsIlNjb3BlQ29uZmlndXJhdG9yLmpzIiwiRWRpdG9yLmpzIiwiQ2FudmFzLmpzIiwiQ2hpbGQuanMiLCJDb2x1bW4uanMiLCJDb250ZW50LmpzIiwiR3JpZC5qcyIsIlJvdy5qcyIsIlBvcHVwLmpzIiwiVG9vbGJveC5qcyIsIlRvb2xib3hHcm91cC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsQUNMQTtBQ0FBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FDN0NBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQ2xWQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUN6SUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUNsQkE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FDZEE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQ25FQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQ3hCQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQ2xCQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FDbkJBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FDdkNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQzlNQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiTGF5b3V0RWRpdG9yLmpzIiwic291cmNlc0NvbnRlbnQiOltudWxsLCJhbmd1bGFyLm1vZHVsZShcIkxheW91dEVkaXRvclwiLCBbXCJuZ1Nhbml0aXplXCIsIFwibmdSZXNvdXJjZVwiLCBcInVpLnNvcnRhYmxlXCJdKTsiLCJ2YXIgTGF5b3V0RWRpdG9yO1xyXG4oZnVuY3Rpb24oTGF5b3V0RWRpdG9yKSB7XHJcblxyXG4gICAgdmFyIENsaXBib2FyZCA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgdGhpcy5fY2xpcGJvYXJkRGF0YSA9IHt9O1xyXG4gICAgICAgIHRoaXMuX2lzRGlzYWJsZWQgPSBmYWxzZTtcclxuICAgICAgICB0aGlzLl93YXNJbnZva2VkID0gZmFsc2U7XHJcblxyXG4gICAgICAgIHRoaXMuc2V0RGF0YSA9IGZ1bmN0aW9uKGNvbnRlbnRUeXBlLCBkYXRhKSB7XHJcbiAgICAgICAgICAgIHNlbGYuX2NsaXBib2FyZERhdGFbY29udGVudFR5cGVdID0gZGF0YTtcclxuICAgICAgICAgICAgc2VsZi5fd2FzSW52b2tlZCA9IHRydWU7XHJcbiAgICAgICAgfTtcclxuICAgICAgICB0aGlzLmdldERhdGEgPSBmdW5jdGlvbiAoY29udGVudFR5cGUpIHtcclxuICAgICAgICAgICAgc2VsZi5fd2FzSW52b2tlZCA9IHRydWU7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLl9jbGlwYm9hcmREYXRhW2NvbnRlbnRUeXBlXTtcclxuICAgICAgICB9O1xyXG4gICAgICAgIHRoaXMuZGlzYWJsZSA9IGZ1bmN0aW9uKCkge1xyXG4gICAgICAgICAgICBzZWxmLl9pc0Rpc2FibGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgc2VsZi5fd2FzSW52b2tlZCA9IGZhbHNlO1xyXG4gICAgICAgICAgICBzZWxmLl9jbGlwYm9hcmREYXRhID0ge307XHJcbiAgICAgICAgfTtcclxuICAgICAgICB0aGlzLmlzRGlzYWJsZWQgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLl9pc0Rpc2FibGVkO1xyXG4gICAgICAgIH1cclxuICAgICAgICB0aGlzLndhc0ludm9rZWQgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLl93YXNJbnZva2VkO1xyXG4gICAgICAgIH1cclxuICAgIH1cclxuXHJcbiAgICBMYXlvdXRFZGl0b3IuQ2xpcGJvYXJkID0gbmV3IENsaXBib2FyZCgpO1xyXG5cclxuICAgIGFuZ3VsYXJcclxuICAgICAgICAubW9kdWxlKFwiTGF5b3V0RWRpdG9yXCIpXHJcbiAgICAgICAgLmZhY3RvcnkoXCJjbGlwYm9hcmRcIiwgW1xyXG4gICAgICAgICAgICBmdW5jdGlvbigpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2V0RGF0YTogTGF5b3V0RWRpdG9yLkNsaXBib2FyZC5zZXREYXRhLFxyXG4gICAgICAgICAgICAgICAgICAgIGdldERhdGE6IExheW91dEVkaXRvci5DbGlwYm9hcmQuZ2V0RGF0YSxcclxuICAgICAgICAgICAgICAgICAgICBkaXNhYmxlOiBMYXlvdXRFZGl0b3IuQ2xpcGJvYXJkLmRpc2FibGUsXHJcbiAgICAgICAgICAgICAgICAgICAgaXNEaXNhYmxlZDogTGF5b3V0RWRpdG9yLkNsaXBib2FyZC5pc0Rpc2FibGVkLFxyXG4gICAgICAgICAgICAgICAgICAgIHdhc0ludm9rZWQ6IExheW91dEVkaXRvci5DbGlwYm9hcmQud2FzSW52b2tlZFxyXG4gICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIF0pO1xyXG59KShMYXlvdXRFZGl0b3IgfHwgKExheW91dEVkaXRvciA9IHt9KSk7IiwiYW5ndWxhclxyXG4gICAgLm1vZHVsZShcIkxheW91dEVkaXRvclwiKVxyXG4gICAgLmZhY3RvcnkoXCJzY29wZUNvbmZpZ3VyYXRvclwiLCBbXCIkdGltZW91dFwiLCBcImNsaXBib2FyZFwiLFxyXG4gICAgICAgIGZ1bmN0aW9uICgkdGltZW91dCwgY2xpcGJvYXJkKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB7XHJcblxyXG4gICAgICAgICAgICAgICAgY29uZmlndXJlRm9yRWxlbWVudDogZnVuY3Rpb24gKCRzY29wZSwgJGVsZW1lbnQpIHtcclxuICAgICAgICAgICAgICAgIFxyXG4gICAgICAgICAgICAgICAgICAgICRlbGVtZW50LmZpbmQoXCIubGF5b3V0LXBhbmVsXCIpLmNsaWNrKGZ1bmN0aW9uIChlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGUuc3RvcFByb3BhZ2F0aW9uKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICRlbGVtZW50LnBhcmVudCgpLmtleWRvd24oZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGhhbmRsZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlc2V0Rm9jdXMgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSAkc2NvcGUuZWxlbWVudDtcclxuICAgICAgICAgICAgICAgICAgICBcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVsZW1lbnQuZWRpdG9yLmlzRHJhZ2dpbmcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiBuYXRpdmUgY2xpcGJvYXJkIHN1cHBvcnQgZXhpc3RzLCB0aGUgcHNldWRvLWNsaXBib2FyZCB3aWxsIGhhdmUgYmVlbiBkaXNhYmxlZC5cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFjbGlwYm9hcmQuaXNEaXNhYmxlZCgpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZm9jdXNlZEVsZW1lbnQgPSBlbGVtZW50LmVkaXRvci5mb2N1c2VkRWxlbWVudDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghIWZvY3VzZWRFbGVtZW50KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gUHNldWRvIGNsaXBib2FyZCBoYW5kbGluZyBmb3IgYnJvd3NlcnMgbm90IGFsbG93aW5nIHJlYWwgY2xpcGJvYXJkIG9wZXJhdGlvbnMuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuY3RybEtleSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUud2hpY2gpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA2NzogLy8gQ1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9jdXNlZEVsZW1lbnQuY29weShjbGlwYm9hcmQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgODg6IC8vIFhcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvY3VzZWRFbGVtZW50LmN1dChjbGlwYm9hcmQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgODY6IC8vIFZcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvY3VzZWRFbGVtZW50LnBhc3RlKGNsaXBib2FyZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlLmN0cmxLZXkgJiYgIWUuc2hpZnRLZXkgJiYgIWUuYWx0S2V5ICYmIGUud2hpY2ggPT0gNDYpIHsgLy8gRGVsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZGVsZXRlKGVsZW1lbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIWUuY3RybEtleSAmJiAhZS5zaGlmdEtleSAmJiAhZS5hbHRLZXkgJiYgKGUud2hpY2ggPT0gMzIgfHwgZS53aGljaCA9PSAyNykpIHsgLy8gU3BhY2Ugb3IgRXNjXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkZWxlbWVudC5maW5kKFwiLmxheW91dC1wYW5lbC1hY3Rpb24tcHJvcGVydGllc1wiKS5maXJzdCgpLmNsaWNrKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVsZW1lbnQudHlwZSA9PSBcIkNvbnRlbnRcIikgeyAvLyBUaGlzIGlzIGEgY29udGVudCBlbGVtZW50LlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlLmN0cmxLZXkgJiYgIWUuc2hpZnRLZXkgJiYgIWUuYWx0S2V5ICYmIGUud2hpY2ggPT0gMTMpIHsgLy8gRW50ZXJcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkZWxlbWVudC5maW5kKFwiLmxheW91dC1wYW5lbC1hY3Rpb24tZWRpdFwiKS5maXJzdCgpLmNsaWNrKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghIWVsZW1lbnQuY2hpbGRyZW4pIHsgLy8gVGhpcyBpcyBhIGNvbnRhaW5lci5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5jdHJsS2V5ICYmICFlLnNoaWZ0S2V5ICYmIGUuYWx0S2V5ICYmIGUud2hpY2ggPT0gNDApIHsgLy8gQWx0K0Rvd25cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZWxlbWVudC5jaGlsZHJlbi5sZW5ndGggPiAwKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmNoaWxkcmVuWzBdLnNldElzRm9jdXNlZCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbGVtZW50LnR5cGUgPT0gXCJDb2x1bW5cIikgeyAvLyBUaGlzIGlzIGEgY29sdW1uLlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjb25uZWN0QWRqYWNlbnQgPSAhZS5jdHJsS2V5O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLndoaWNoID09IDM3KSB7IC8vIExlZnRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuYWx0S2V5KVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5leHBhbmRMZWZ0KGNvbm5lY3RBZGphY2VudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLnNoaWZ0S2V5KVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5jb250cmFjdFJpZ2h0KGNvbm5lY3RBZGphY2VudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZS53aGljaCA9PSAzOSkgeyAvLyBSaWdodFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5hbHRLZXkpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmNvbnRyYWN0TGVmdChjb25uZWN0QWRqYWNlbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5zaGlmdEtleSlcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuZXhwYW5kUmlnaHQoY29ubmVjdEFkamFjZW50KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoISFlbGVtZW50LnBhcmVudCkgeyAvLyBUaGlzIGlzIGEgY2hpbGQuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5hbHRLZXkgJiYgZS53aGljaCA9PSAzOCkgeyAvLyBBbHQrVXBcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnBhcmVudC5zZXRJc0ZvY3VzZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZWxlbWVudC5wYXJlbnQudHlwZSA9PSBcIlJvd1wiKSB7IC8vIFBhcmVudCBpcyBhIGhvcml6b250YWwgY29udGFpbmVyLlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5jdHJsS2V5ICYmICFlLnNoaWZ0S2V5ICYmICFlLmFsdEtleSAmJiBlLndoaWNoID09IDM3KSB7IC8vIExlZnRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5wYXJlbnQubW92ZUZvY3VzUHJldkNoaWxkKGVsZW1lbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoIWUuY3RybEtleSAmJiAhZS5zaGlmdEtleSAmJiAhZS5hbHRLZXkgJiYgZS53aGljaCA9PSAzOSkgeyAvLyBSaWdodFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnBhcmVudC5tb3ZlRm9jdXNOZXh0Q2hpbGQoZWxlbWVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChlLmN0cmxLZXkgJiYgIWUuc2hpZnRLZXkgJiYgIWUuYWx0S2V5ICYmIGUud2hpY2ggPT0gMzcpIHsgLy8gQ3RybCtMZWZ0XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQubW92ZVVwKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc2V0Rm9jdXMgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZS5jdHJsS2V5ICYmICFlLnNoaWZ0S2V5ICYmICFlLmFsdEtleSAmJiBlLndoaWNoID09IDM5KSB7IC8vIEN0cmwrUmlnaHRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5tb3ZlRG93bigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsgLy8gUGFyZW50IGlzIGEgdmVydGljYWwgY29udGFpbmVyLlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5jdHJsS2V5ICYmICFlLnNoaWZ0S2V5ICYmICFlLmFsdEtleSAmJiBlLndoaWNoID09IDM4KSB7IC8vIFVwXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQucGFyZW50Lm1vdmVGb2N1c1ByZXZDaGlsZChlbGVtZW50KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCFlLmN0cmxLZXkgJiYgIWUuc2hpZnRLZXkgJiYgIWUuYWx0S2V5ICYmIGUud2hpY2ggPT0gNDApIHsgLy8gRG93blxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnBhcmVudC5tb3ZlRm9jdXNOZXh0Q2hpbGQoZWxlbWVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChlLmN0cmxLZXkgJiYgIWUuc2hpZnRLZXkgJiYgIWUuYWx0S2V5ICYmIGUud2hpY2ggPT0gMzgpIHsgLy8gQ3RybCtVcFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50Lm1vdmVVcCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNldEZvY3VzID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGUuY3RybEtleSAmJiAhZS5zaGlmdEtleSAmJiAhZS5hbHRLZXkgJiYgZS53aGljaCA9PSA0MCkgeyAvLyBDdHJsK0Rvd25cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5tb3ZlRG93bigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYW5kbGVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGUuc3RvcFByb3BhZ2F0aW9uKCk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuJGFwcGx5KCk7IC8vIEV2ZW50IGlzIG5vdCB0cmlnZ2VyZWQgYnkgQW5ndWxhciBkaXJlY3RpdmUgYnV0IHJhdyBldmVudCBoYW5kbGVyIG9uIGVsZW1lbnQuXHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBIQUNLOiBXb3JrYXJvdW5kIGJlY2F1c2Ugb2YgaG93IEFuZ3VsYXIgdHJlYXRzIHRoZSBET00gd2hlbiBlbGVtZW50cyBhcmUgc2hpZnRlZCBhcm91bmQgLSBpbnB1dCBmb2N1cyBpcyBzb21ldGltZXMgbG9zdC5cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlc2V0Rm9jdXMpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5zZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuJGFwcGx5KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5lZGl0b3IuZm9jdXNlZEVsZW1lbnQuc2V0SXNGb2N1c2VkKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICRzY29wZS5lbGVtZW50LnNldElzRm9jdXNlZEV2ZW50SGFuZGxlcnMucHVzaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRlbGVtZW50LnBhcmVudCgpLmZvY3VzKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICRzY29wZS5kZWxldGUgPSBmdW5jdGlvbiAoZWxlbWVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmRlbGV0ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCRzY29wZS5lbGVtZW50Lmhhc0VkaXRvcikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZWRpdCA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS4kcm9vdC5lZGl0RWxlbWVudCgkc2NvcGUuZWxlbWVudCkudGhlbihmdW5jdGlvbiAoYXJncykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS4kYXBwbHkoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYXJncy5jYW5jZWwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZWxlbWVudC5kYXRhID0gYXJncy5lbGVtZW50LmRhdGE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5lbGVtZW50LmFwcGx5RWxlbWVudEVkaXRvck1vZGVsKGFyZ3MuZWxlbWVudEVkaXRvck1vZGVsKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghISRzY29wZS5lbGVtZW50LnNldEh0bWwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZWxlbWVudC5zZXRIdG1sKGFyZ3MuZWxlbWVudC5odG1sKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0sXHJcblxyXG4gICAgICAgICAgICAgICAgY29uZmlndXJlRm9yQ29udGFpbmVyOiBmdW5jdGlvbiAoJHNjb3BlLCAkZWxlbWVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBlbGVtZW50ID0gJHNjb3BlLmVsZW1lbnQ7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIC8vJHNjb3BlLmlzUmVjZWl2aW5nID0gZmFsc2U7IC8vIFRydWUgd2hlbiBjb250YWluZXIgaXMgcmVjZWl2aW5nIGFuIGV4dGVybmFsIGVsZW1lbnQgdmlhIGRyYWcvZHJvcC5cclxuICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZ2V0U2hvd0NoaWxkcmVuUGxhY2Vob2xkZXIgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkc2NvcGUuZWxlbWVudC5jaGlsZHJlbi5sZW5ndGggPT09IDAgJiYgISRzY29wZS5lbGVtZW50LmdldElzRHJvcFRhcmdldCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICRzY29wZS5zb3J0YWJsZU9wdGlvbnMgPSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGN1cnNvcjogXCJtb3ZlXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGF5OiAxNTAsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRpc2FibGVkOiBlbGVtZW50LmdldElzU2VhbGVkKCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3RhbmNlOiA1LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2hhbmRsZTogZWxlbWVudC5jaGlsZHJlbi5sZW5ndGggPCAyID8gXCIuaW1hZ2luYXJ5LWNsYXNzXCIgOiBmYWxzZSwgLy8gRm9yIHNvbWUgcmVhc29uIGRvZXNuJ3QgZ2V0IHJlLWV2YWx1YXRlZCBhZnRlciBhZGRpbmcgbW9yZSBjaGlsZHJlbi5cclxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IGZ1bmN0aW9uIChlLCB1aSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLiRhcHBseShmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5zZXRJc0Ryb3BUYXJnZXQodHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5lZGl0b3IuaXNEcmFnZ2luZyA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIE1ha2UgdGhlIGRyb3AgdGFyZ2V0IHBsYWNlaG9sZGVyIGFzIGhpZ2ggYXMgdGhlIGl0ZW0gYmVpbmcgZHJhZ2dlZC5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpLnBsYWNlaG9sZGVyLmhlaWdodCh1aS5pdGVtLmhlaWdodCgpIC0gNCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aS5wbGFjZWhvbGRlci5jc3MoXCJtaW4taGVpZ2h0XCIsIDApO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzdG9wOiBmdW5jdGlvbiAoZSwgdWkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS4kYXBwbHkoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuZWRpdG9yLmlzRHJhZ2dpbmcgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnNldElzRHJvcFRhcmdldChmYWxzZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgb3ZlcjogZnVuY3Rpb24gKGUsIHVpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISF1aS5zZW5kZXIgJiYgISF1aS5zZW5kZXJbMF0uaXNUb29sYm94KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEhdWkuc2VuZGVyWzBdLmRyb3BUYXJnZXRUaW1lb3V0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0aW1lb3V0LmNhbmNlbCh1aS5zZW5kZXJbMF0uZHJvcFRhcmdldFRpbWVvdXQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aS5zZW5kZXJbMF0uZHJvcFRhcmdldFRpbWVvdXQgPSBudWxsO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGltZW91dChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbGVtZW50LnR5cGUgPT0gXCJSb3dcIikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgdGhlcmUgd2FzIGEgcHJldmlvdXMgZHJvcCB0YXJnZXQgYW5kIGl0IHdhcyBhIHJvdywgcm9sbCBiYWNrIGFueSBwZW5kaW5nIGNvbHVtbiBhZGRzIHRvIGl0LlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHByZXZpb3VzRHJvcFRhcmdldCA9IGVsZW1lbnQuZWRpdG9yLmRyb3BUYXJnZXRFbGVtZW50O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEhcHJldmlvdXNEcm9wVGFyZ2V0ICYmIHByZXZpb3VzRHJvcFRhcmdldC50eXBlID09IFwiUm93XCIpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJldmlvdXNEcm9wVGFyZ2V0LnJvbGxiYWNrQWRkQ29sdW1uKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5zZXRJc0Ryb3BUYXJnZXQoZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpLnNlbmRlclswXS5kcm9wVGFyZ2V0VGltZW91dCA9ICR0aW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVsZW1lbnQudHlwZSA9PSBcIlJvd1wiKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcmVjZWl2ZWRDb2x1bW4gPSB1aS5pdGVtLnNvcnRhYmxlLm1vZGVsO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlY2VpdmVkQ29sdW1uV2lkdGggPSBNYXRoLmZsb29yKDEyIC8gKGVsZW1lbnQuY2hpbGRyZW4ubGVuZ3RoICsgMSkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZWRDb2x1bW4ud2lkdGggPSByZWNlaXZlZENvbHVtbldpZHRoO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZWRDb2x1bW4ub2Zmc2V0ID0gMDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuYmVnaW5BZGRDb2x1bW4ocmVjZWl2ZWRDb2x1bW5XaWR0aCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBNYWtlIHRoZSBkcm9wIHRhcmdldCBwbGFjZWhvbGRlciB0aGUgY29ycmVjdCB3aWR0aCBhbmQgYXMgaGlnaCBhcyB0aGUgaGlnaGVzdCBleGlzdGluZyBjb2x1bW4gaW4gdGhlIHJvdy5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtYXhIZWlnaHQgPSBfLm1heChfKCRlbGVtZW50LmZpbmQoXCI+IC5sYXlvdXQtY2hpbGRyZW4gPiAubGF5b3V0LWNvbHVtbjpub3QoLnVpLXNvcnRhYmxlLXBsYWNlaG9sZGVyKVwiKSkubWFwKGZ1bmN0aW9uIChlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoZSkuaGVpZ2h0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAxOyBpIDw9IDEyOyBpKyspXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWkucGxhY2Vob2xkZXIucmVtb3ZlQ2xhc3MoXCJjb2wteHMtXCIgKyBpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpLnBsYWNlaG9sZGVyLmFkZENsYXNzKFwiY29sLXhzLVwiICsgcmVjZWl2ZWRDb2x1bW4ud2lkdGgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1heEhlaWdodCA+IDApIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aS5wbGFjZWhvbGRlci5oZWlnaHQobWF4SGVpZ2h0KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aS5wbGFjZWhvbGRlci5jc3MoXCJtaW4taGVpZ2h0XCIsIDApO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWkucGxhY2Vob2xkZXIuaGVpZ2h0KDApO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpLnBsYWNlaG9sZGVyLmNzcyhcIm1pbi1oZWlnaHRcIiwgXCJcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5zZXRJc0Ryb3BUYXJnZXQodHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTUwKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZTogZnVuY3Rpb24gKGUsIHVpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISF1aS5zZW5kZXIgJiYgISF1aS5zZW5kZXJbMF0uaXNUb29sYm94KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLiRhcHBseShmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByZWNlaXZlZEVsZW1lbnQgPSB1aS5pdGVtLnNvcnRhYmxlLm1vZGVsO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISFyZWNlaXZlZEVsZW1lbnQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbGVtZW50LnR5cGUgPT0gXCJSb3dcIilcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmNvbW1pdEFkZENvbHVtbigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gU2hvdWxkIGlkZWFsbHkgY2FsbCBMYXlvdXRFZGl0b3IuQ29udGFpbmVyLmFkZENoaWxkKCkgaW5zdGVhZCwgYnV0IHNpbmNlIHRoaXMgaGFuZGxlclxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gaXMgcnVuICpiZWZvcmUqIHRoZSB1aS1zb3J0YWJsZSBkaXJlY3RpdmUncyBoYW5kbGVyLCBpZiB3ZSB0cnkgdG8gYWRkIHRoZSBjaGlsZCB0byB0aGVcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFycmF5IHRoYXQgaGFuZGxlciB3aWxsIGdldCBhbiBleGNlcHRpb24gd2hlbiB0cnlpbmcgdG8gZG8gdGhlIHNhbWUuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBCZWNhdXNlIG9mIHRoaXMsIHdlIG5lZWQgdG8gaW52b2tlIFwic2V0UGFyZW50XCIgc28gdGhhdCBzcGVjaWZpYyBjb250YWluZXIgdHlwZXMgY2FuIHBlcmZvcm0gZWxlbWVudCBzcGVmaWNpYyBpbml0aWFsaXphdGlvbi5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlY2VpdmVkRWxlbWVudC5zZXRFZGl0b3IoZWxlbWVudC5lZGl0b3IpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZWRFbGVtZW50LnNldFBhcmVudChlbGVtZW50KTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISFyZWNlaXZlZEVsZW1lbnQuaGFzRWRpdG9yKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLiRyb290LmVkaXRFbGVtZW50KHJlY2VpdmVkRWxlbWVudCkudGhlbihmdW5jdGlvbiAoYXJncykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWFyZ3MuY2FuY2VsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWNlaXZlZEVsZW1lbnQuZGF0YSA9IGFyZ3MuZWxlbWVudC5kYXRhO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZWRFbGVtZW50LmFwcGx5RWxlbWVudEVkaXRvck1vZGVsKGFyZ3MuZWxlbWVudEVkaXRvck1vZGVsKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISFyZWNlaXZlZEVsZW1lbnQuc2V0SHRtbClcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWNlaXZlZEVsZW1lbnQuc2V0SHRtbChhcmdzLmVsZW1lbnQuaHRtbCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEhYXJncy5jYW5jZWwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZWRFbGVtZW50LmRlbGV0ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlY2VpdmVkRWxlbWVudC5zZXRJc0ZvY3VzZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vJHNjb3BlLmlzUmVjZWl2aW5nID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnNldElzRHJvcFRhcmdldChmYWxzZSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0aW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vJHNjb3BlLmlzUmVjZWl2aW5nID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnNldElzRHJvcFRhcmdldChmYWxzZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISFyZWNlaXZlZEVsZW1lbnQpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZWRFbGVtZW50LnNldElzRm9jdXNlZCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICRzY29wZS5jbGljayA9IGZ1bmN0aW9uIChjaGlsZCwgZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWNoaWxkLmVkaXRvci5pc0RyYWdnaW5nKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGQuc2V0SXNGb2N1c2VkKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGUuc3RvcFByb3BhZ2F0aW9uKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmdldENsYXNzZXMgPSBmdW5jdGlvbiAoY2hpbGQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlc3VsdCA9IFtcImxheW91dC1lbGVtZW50XCJdO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEhY2hpbGQuY2hpbGRyZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKFwibGF5b3V0LWNvbnRhaW5lclwiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaGlsZC5nZXRJc1NlYWxlZCgpKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKFwibGF5b3V0LWNvbnRhaW5lci1zZWFsZWRcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKFwibGF5b3V0LVwiICsgY2hpbGQudHlwZS50b0xvd2VyQ2FzZSgpKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghIWNoaWxkLmRyb3BUYXJnZXRDbGFzcylcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKGNoaWxkLmRyb3BUYXJnZXRDbGFzcyk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBUT0RPOiBNb3ZlIHRoZXNlIHRvIGVpdGhlciB0aGUgQ29sdW1uIGRpcmVjdGl2ZSBvciB0aGUgQ29sdW1uIG1vZGVsIGNsYXNzLlxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2hpbGQudHlwZSA9PSBcIlJvd1wiKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaChcInJvd1wiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghY2hpbGQuY2FuQWRkQ29sdW1uKCkpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJsYXlvdXQtcm93LWZ1bGxcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoaWxkLnR5cGUgPT0gXCJDb2x1bW5cIikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJjb2wteHMtXCIgKyBjaGlsZC53aWR0aCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaChcImNvbC14cy1vZmZzZXQtXCIgKyBjaGlsZC5vZmZzZXQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaGlsZC50eXBlID09IFwiQ29udGVudFwiKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJsYXlvdXQtY29udGVudC1cIiArIGNoaWxkLmNvbnRlbnRUeXBlQ2xhc3MpO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoaWxkLmdldElzQWN0aXZlKCkpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaChcImxheW91dC1lbGVtZW50LWFjdGl2ZVwiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoaWxkLmdldElzRm9jdXNlZCgpKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJsYXlvdXQtZWxlbWVudC1mb2N1c2VkXCIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2hpbGQuZ2V0SXNTZWxlY3RlZCgpKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJsYXlvdXQtZWxlbWVudC1zZWxlY3RlZFwiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoaWxkLmdldElzRHJvcFRhcmdldCgpKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJsYXlvdXQtZWxlbWVudC1kcm9wdGFyZ2V0XCIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2hpbGQuaXNUZW1wbGF0ZWQpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaChcImxheW91dC1lbGVtZW50LXRlbXBsYXRlZFwiKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XHJcbiAgICAgICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuICAgICAgICB9XHJcbiAgICBdKTsiLCJhbmd1bGFyXHJcbiAgICAubW9kdWxlKFwiTGF5b3V0RWRpdG9yXCIpXHJcbiAgICAuZGlyZWN0aXZlKFwib3JjTGF5b3V0RWRpdG9yXCIsIFtcImVudmlyb25tZW50XCIsXHJcbiAgICAgICAgZnVuY3Rpb24gKGVudmlyb25tZW50KSB7XHJcbiAgICAgICAgICAgIHJldHVybiB7XHJcbiAgICAgICAgICAgICAgICByZXN0cmljdDogXCJFXCIsXHJcbiAgICAgICAgICAgICAgICBzY29wZToge30sXHJcbiAgICAgICAgICAgICAgICBjb250cm9sbGVyOiBbXCIkc2NvcGVcIiwgXCIkZWxlbWVudFwiLCBcIiRhdHRyc1wiLCBcIiRjb21waWxlXCIsIFwiY2xpcGJvYXJkXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKCRzY29wZSwgJGVsZW1lbnQsICRhdHRycywgJGNvbXBpbGUsIGNsaXBib2FyZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoISEkYXR0cnMubW9kZWwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZWxlbWVudCA9IGV2YWwoJGF0dHJzLm1vZGVsKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVGhlICdtb2RlbCcgYXR0cmlidXRlIG11c3QgZXZhbHVhdGUgdG8gYSBMYXlvdXRFZGl0b3IuRWRpdG9yIG9iamVjdC5cIik7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuY2xpY2sgPSBmdW5jdGlvbiAoY2FudmFzLCBlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWNhbnZhcy5lZGl0b3IuaXNEcmFnZ2luZylcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW52YXMuc2V0SXNGb2N1c2VkKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmdldENsYXNzZXMgPSBmdW5jdGlvbiAoY2FudmFzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcmVzdWx0ID0gW1wibGF5b3V0LWVsZW1lbnRcIiwgXCJsYXlvdXQtY29udGFpbmVyXCIsIFwibGF5b3V0LWNhbnZhc1wiXTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2FudmFzLmdldElzQWN0aXZlKCkpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJsYXlvdXQtZWxlbWVudC1hY3RpdmVcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2FudmFzLmdldElzRm9jdXNlZCgpKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKFwibGF5b3V0LWVsZW1lbnQtZm9jdXNlZFwiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjYW52YXMuZ2V0SXNTZWxlY3RlZCgpKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKFwibGF5b3V0LWVsZW1lbnQtc2VsZWN0ZWRcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2FudmFzLmdldElzRHJvcFRhcmdldCgpKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKFwibGF5b3V0LWVsZW1lbnQtZHJvcHRhcmdldFwiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjYW52YXMuaXNUZW1wbGF0ZWQpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goXCJsYXlvdXQtZWxlbWVudC10ZW1wbGF0ZWRcIik7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIEFuIHVuZm9ydHVuYXRlIHNpZGUtZWZmZWN0IG9mIHRoZSBuZXh0IGhhY2sgb24gbGluZSA1NCBpcyB0aGF0IHRoZSBjcmVhdGVkIGVsZW1lbnRzIGFyZW4ndCBhZGRlZCB0byB0aGUgRE9NIHlldCwgc28gd2UgY2FuJ3QgdXNlIGl0IHRvIGdldCB0byB0aGUgcGFyZW50IFwiLmxheW91dC1kZXNpZ2VyXCIgZWxlbWVudC5cclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gV29yayBhcm91bmQ6IGFjY2VzcyB0aGF0IGVsZW1lbnQgZGlyZWN0bHkgKHdoaWNoIGVmZWN0aXZlbHkgdHVybnMgbXVsdGlwbGUgbGF5b3V0IGVkaXRvcnMgb24gYSBzaW5nbGUgcGFnZSBpbXBvc3NpYmxlKS4gXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIC8vdmFyIGxheW91dERlc2lnbmVySG9zdCA9ICRlbGVtZW50LmNsb3Nlc3QoXCIubGF5b3V0LWRlc2lnbmVyXCIpLmRhdGEoXCJsYXlvdXQtZGVzaWduZXItaG9zdFwiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGxheW91dERlc2lnbmVySG9zdCA9ICQoXCIubGF5b3V0LWRlc2lnbmVyXCIpLmRhdGEoXCJsYXlvdXQtZGVzaWduZXItaG9zdFwiKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS4kcm9vdC5sYXlvdXREZXNpZ25lckhvc3QgPSBsYXlvdXREZXNpZ25lckhvc3Q7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICBsYXlvdXREZXNpZ25lckhvc3QuZWxlbWVudC5vbihcInJlcGxhY2VjYW52YXNcIiwgZnVuY3Rpb24gKGUsIGFyZ3MpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlZGl0b3IgPSAkc2NvcGUuZWxlbWVudDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjYW52YXNEYXRhID0ge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IGFyZ3MuY2FudmFzLmRhdGEsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHRtbElkOiBhcmdzLmNhbnZhcy5odG1sSWQsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHRtbENsYXNzOiBhcmdzLmNhbnZhcy5odG1sQ2xhc3MsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHRtbFN0eWxlOiBhcmdzLmNhbnZhcy5odG1sU3R5bGUsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNUZW1wbGF0ZWQ6IGFyZ3MuY2FudmFzLmlzVGVtcGxhdGVkLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuOiBhcmdzLmNhbnZhcy5jaGlsZHJlblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBIQUNLOiBJbnN0ZWFkIG9mIHNpbXBseSB1cGRhdGluZyB0aGUgJHNjb3BlLmVsZW1lbnQgd2l0aCBhIG5ldyBpbnN0YW5jZSwgd2UgbmVlZCB0byByZXBsYWNlIHRoZSBlbnRpcmUgb3JjLWxheW91dC1lZGl0b3IgbWFya3VwXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBpbiBvcmRlciBmb3IgYW5ndWxhciB0byByZWJpbmQgc3RhcnRpbmcgd2l0aCB0aGUgQ2FudmFzIGVsZW1lbnQuIE90aGVyd2lzZSwgZm9yIHNvbWUgcmVhc29uLCBpdCB3aWxsIHJlYmluZCBzdGFydGluZyB3aXRoIHRoZSBmaXJzdCBjaGlsZCBvZiBDYW52YXMuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBZb3UgY2FuIHNlZSB0aGlzIGhhcHBlbmluZyB3aGVuIHNldHRpbmcgYSBicmVha3BvaW50IGluIFNjb3BlQ29uZmlndXJhdG9yIHdoZXJlIGNvbnRhaW5lcnMgYXJlIGluaXRpYWxpemVkIHdpdGggZHJhZyAmIGRyb3A6IG9uIHBhZ2UgbG9hZCwgdGhlIGZpcnN0IGVsZW1lbnRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGlzIGEgQ2FudmFzIChnb29kKSwgYnV0IGFmdGVyIGhhdmluZyBzZWxlY3RlZCBhbm90aGVyIHRlbXBsYXRlLCB0aGUgZmlyc3QgZWxlbWVudCBpcyAodHlwaWNhbGx5KSBhIEdyaWQgKGJhZCkuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBTaW1wbHkgcmVjb21waWxpbmcgdGhlIG9yYy1sYXlvdXQtZWRpdG9yIGRpcmVjdGl2ZSB3aWxsIGNhdXNlIHRoZSBlbnRpcmUgdGhpbmcgdG8gYmUgZ2VuZXJhdGVkLCB3aGljaCB3b3JrcyBqdXN0IGZpbmUgYXMgd2VsbCAoZXZlbiB0aG91Z2ggbm90IGlzIG5pY2UgYXMgc2ltcGx5IGxldmVyYWdpbmcgbW9kZWwgYmluZGluZykuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXlvdXREZXNpZ25lckhvc3QuZWRpdG9yID0gd2luZG93LmxheW91dEVkaXRvciA9IG5ldyBMYXlvdXRFZGl0b3IuRWRpdG9yKGVkaXRvci5jb25maWcsIGNhbnZhc0RhdGEpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRlbXBsYXRlID0gXCI8b3JjLWxheW91dC1lZGl0b3JcIiArIFwiIG1vZGVsPSd3aW5kb3cubGF5b3V0RWRpdG9yJyAvPlwiO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGh0bWwgPSAkY29tcGlsZSh0ZW1wbGF0ZSkoJHNjb3BlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICQoXCIubGF5b3V0LWVkaXRvci1ob2xkZXJcIikuaHRtbChodG1sKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuJHJvb3QuZWRpdEVsZW1lbnQgPSBmdW5jdGlvbiAoZWxlbWVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGhvc3QgPSAkc2NvcGUuJHJvb3QubGF5b3V0RGVzaWduZXJIb3N0O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGhvc3QuZWRpdEVsZW1lbnQoZWxlbWVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuJHJvb3QuYWRkRWxlbWVudCA9IGZ1bmN0aW9uIChjb250ZW50VHlwZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGhvc3QgPSAkc2NvcGUuJHJvb3QubGF5b3V0RGVzaWduZXJIb3N0O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGhvc3QuYWRkRWxlbWVudChjb250ZW50VHlwZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkKGRvY3VtZW50KS5vbihcImN1dCBjb3B5IHBhc3RlXCIsIGZ1bmN0aW9uIChlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiB0aGUgcHNldWRvIGNsaXBib2FyZCB3YXMgYWxyZWFkeSBpbnZva2VkICh3aGljaCBoYXBwZW5zIG9uIHRoZSBmaXJzdCBjbGlwYm9hcmRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9wZXJhdGlvbiBhZnRlciBwYWdlIGxvYWQgZXZlbiBpZiBuYXRpdmUgY2xpcGJvYXJkIHN1cHBvcnQgZXhpc3RzKSB0aGVuIHNpdCB0aGlzXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBvbmUgb3BlcmF0aW9uIG91dCwgYnV0IG1ha2Ugc3VyZSB3aGF0ZXZlciBpcyBvbiB0aGUgcHNldWRvIGNsaXBib2FyZCBnZXRzIG1pZ3JhdGVkXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB0byB0aGUgbmF0aXZlIGNsaXBib2FyZCBmb3Igc3Vic2VxdWVudCBvcGVyYXRpb25zLlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNsaXBib2FyZC53YXNJbnZva2VkKCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm9yaWdpbmFsRXZlbnQuY2xpcGJvYXJkRGF0YS5zZXREYXRhKFwidGV4dC9wbGFpblwiLCBjbGlwYm9hcmQuZ2V0RGF0YShcInRleHQvcGxhaW5cIikpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUub3JpZ2luYWxFdmVudC5jbGlwYm9hcmREYXRhLnNldERhdGEoXCJ0ZXh0L2pzb25cIiwgY2xpcGJvYXJkLmdldERhdGEoXCJ0ZXh0L2pzb25cIikpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmb2N1c2VkRWxlbWVudCA9ICRzY29wZS5lbGVtZW50LmZvY3VzZWRFbGVtZW50O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghIWZvY3VzZWRFbGVtZW50KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS4kYXBwbHkoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnR5cGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiY29weVwiOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb2N1c2VkRWxlbWVudC5jb3B5KGUub3JpZ2luYWxFdmVudC5jbGlwYm9hcmREYXRhKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcImN1dFwiOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb2N1c2VkRWxlbWVudC5jdXQoZS5vcmlnaW5hbEV2ZW50LmNsaXBib2FyZERhdGEpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwicGFzdGVcIjpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9jdXNlZEVsZW1lbnQucGFzdGUoZS5vcmlnaW5hbEV2ZW50LmNsaXBib2FyZERhdGEpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBIQUNLOiBXb3JrYXJvdW5kIGJlY2F1c2Ugb2YgaG93IEFuZ3VsYXIgdHJlYXRzIHRoZSBET00gd2hlbiBlbGVtZW50cyBhcmUgc2hpZnRlZCBhcm91bmQgLSBpbnB1dCBmb2N1cyBpcyBzb21ldGltZXMgbG9zdC5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LnNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLiRhcHBseShmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEhJHNjb3BlLmVsZW1lbnQuZm9jdXNlZEVsZW1lbnQpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5lbGVtZW50LmZvY3VzZWRFbGVtZW50LnNldElzRm9jdXNlZCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIDEwMCk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIE5hdGl2ZSBjbGlwYm9hcmQgc3VwcG9ydCBvYnZpb3VzbHkgZXhpc3RzLCBzbyBkaXNhYmxlIHRoZSBwZXVkbyBjbGlwYm9hcmQgZnJvbSBub3cgb24uXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGlwYm9hcmQuZGlzYWJsZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICAgICAgdGVtcGxhdGVVcmw6IGVudmlyb25tZW50LnRlbXBsYXRlVXJsKFwiRWRpdG9yXCIpLFxyXG4gICAgICAgICAgICAgICAgcmVwbGFjZTogdHJ1ZSxcclxuICAgICAgICAgICAgICAgIGxpbms6IGZ1bmN0aW9uIChzY29wZSwgZWxlbWVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgIC8vIE5vIGNsaWNrcyBzaG91bGQgcHJvcGFnYXRlIGZyb20gdGhlIFRpbnlNQ0UgdG9vbGJhcnMuXHJcbiAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5maW5kKFwiLmxheW91dC10b29sYmFyLWNvbnRhaW5lclwiKS5jbGljayhmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbigpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIC8vIFVuZm9jdXMgYW5kIHVuc2VsZWN0IGV2ZXJ5dGhpbmcgb24gY2xpY2sgb3V0c2lkZSBvZiBjYW52YXMuXHJcbiAgICAgICAgICAgICAgICAgICAgJCh3aW5kb3cpLmNsaWNrKGZ1bmN0aW9uIChlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlLiRhcHBseShmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZS5lbGVtZW50LmFjdGl2ZUVsZW1lbnQgPSBudWxsO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuZWxlbWVudC5mb2N1c2VkRWxlbWVudCA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgIH1cclxuICAgIF0pOyIsImFuZ3VsYXJcclxuICAgIC5tb2R1bGUoXCJMYXlvdXRFZGl0b3JcIilcclxuICAgIC5kaXJlY3RpdmUoXCJvcmNMYXlvdXRDYW52YXNcIiwgW1wic2NvcGVDb25maWd1cmF0b3JcIiwgXCJlbnZpcm9ubWVudFwiLFxyXG4gICAgICAgIGZ1bmN0aW9uIChzY29wZUNvbmZpZ3VyYXRvciwgZW52aXJvbm1lbnQpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgIHJlc3RyaWN0OiBcIkVcIixcclxuICAgICAgICAgICAgICAgIHNjb3BlOiB7IGVsZW1lbnQ6IFwiPVwiIH0sXHJcbiAgICAgICAgICAgICAgICBjb250cm9sbGVyOiBbXCIkc2NvcGVcIiwgXCIkZWxlbWVudFwiLCBcIiRhdHRyc1wiLFxyXG4gICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICgkc2NvcGUsICRlbGVtZW50LCAkYXR0cnMpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGVDb25maWd1cmF0b3IuY29uZmlndXJlRm9yRWxlbWVudCgkc2NvcGUsICRlbGVtZW50KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGVDb25maWd1cmF0b3IuY29uZmlndXJlRm9yQ29udGFpbmVyKCRzY29wZSwgJGVsZW1lbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuc29ydGFibGVPcHRpb25zW1wiYXhpc1wiXSA9IFwieVwiO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIF0sXHJcbiAgICAgICAgICAgICAgICB0ZW1wbGF0ZVVybDogZW52aXJvbm1lbnQudGVtcGxhdGVVcmwoXCJDYW52YXNcIiksXHJcbiAgICAgICAgICAgICAgICByZXBsYWNlOiB0cnVlXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgfVxyXG4gICAgXSk7IiwiYW5ndWxhclxyXG4gICAgLm1vZHVsZShcIkxheW91dEVkaXRvclwiKVxyXG4gICAgLmRpcmVjdGl2ZShcIm9yY0xheW91dENoaWxkXCIsIFtcIiRjb21waWxlXCIsXHJcbiAgICAgICAgZnVuY3Rpb24gKCRjb21waWxlKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB7XHJcbiAgICAgICAgICAgICAgICByZXN0cmljdDogXCJFXCIsXHJcbiAgICAgICAgICAgICAgICBzY29wZTogeyBlbGVtZW50OiBcIj1cIiB9LFxyXG4gICAgICAgICAgICAgICAgbGluazogZnVuY3Rpb24gKHNjb3BlLCBlbGVtZW50KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIHRlbXBsYXRlID0gXCI8b3JjLWxheW91dC1cIiArIHNjb3BlLmVsZW1lbnQudHlwZS50b0xvd2VyQ2FzZSgpICsgXCIgZWxlbWVudD0nZWxlbWVudCcgLz5cIjtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgaHRtbCA9ICRjb21waWxlKHRlbXBsYXRlKShzY29wZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJChlbGVtZW50KS5yZXBsYWNlV2l0aChodG1sKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuICAgICAgICB9XHJcbiAgICBdKTsiLCJhbmd1bGFyXHJcbiAgICAubW9kdWxlKFwiTGF5b3V0RWRpdG9yXCIpXHJcbiAgICAuZGlyZWN0aXZlKFwib3JjTGF5b3V0Q29sdW1uXCIsIFtcIiRjb21waWxlXCIsIFwic2NvcGVDb25maWd1cmF0b3JcIiwgXCJlbnZpcm9ubWVudFwiLFxyXG4gICAgICAgIGZ1bmN0aW9uICgkY29tcGlsZSwgc2NvcGVDb25maWd1cmF0b3IsIGVudmlyb25tZW50KSB7XHJcbiAgICAgICAgICAgIHJldHVybiB7XHJcbiAgICAgICAgICAgICAgICByZXN0cmljdDogXCJFXCIsXHJcbiAgICAgICAgICAgICAgICBzY29wZTogeyBlbGVtZW50OiBcIj1cIiB9LFxyXG4gICAgICAgICAgICAgICAgY29udHJvbGxlcjogW1wiJHNjb3BlXCIsIFwiJGVsZW1lbnRcIixcclxuICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoJHNjb3BlLCAkZWxlbWVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzY29wZUNvbmZpZ3VyYXRvci5jb25maWd1cmVGb3JFbGVtZW50KCRzY29wZSwgJGVsZW1lbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzY29wZUNvbmZpZ3VyYXRvci5jb25maWd1cmVGb3JDb250YWluZXIoJHNjb3BlLCAkZWxlbWVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5zb3J0YWJsZU9wdGlvbnNbXCJheGlzXCJdID0gXCJ5XCI7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgICAgIHRlbXBsYXRlVXJsOiBlbnZpcm9ubWVudC50ZW1wbGF0ZVVybChcIkNvbHVtblwiKSxcclxuICAgICAgICAgICAgICAgIHJlcGxhY2U6IHRydWUsXHJcbiAgICAgICAgICAgICAgICBsaW5rOiBmdW5jdGlvbiAoc2NvcGUsIGVsZW1lbnQsIGF0dHJzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5maW5kKFwiLmxheW91dC1jb2x1bW4tcmVzaXplLWJhclwiKS5kcmFnZ2FibGUoe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBheGlzOiBcInhcIixcclxuICAgICAgICAgICAgICAgICAgICAgICAgaGVscGVyOiBcImNsb25lXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldmVydDogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IGZ1bmN0aW9uIChlLCB1aSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuJGFwcGx5KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZS5lbGVtZW50LmVkaXRvci5pc1Jlc2l6aW5nID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBkcmFnOiBmdW5jdGlvbiAoZSwgdWkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjb2x1bW5FbGVtZW50ID0gZWxlbWVudC5wYXJlbnQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjb2x1bW5TaXplID0gY29sdW1uRWxlbWVudC53aWR0aCgpIC8gc2NvcGUuZWxlbWVudC53aWR0aDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjb25uZWN0QWRqYWNlbnQgPSAhZS5jdHJsS2V5O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCQoZS50YXJnZXQpLmhhc0NsYXNzKFwibGF5b3V0LWNvbHVtbi1yZXNpemUtYmFyLWxlZnRcIikpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZGVsdGEgPSB1aS5vZmZzZXQubGVmdCAtIGNvbHVtbkVsZW1lbnQub2Zmc2V0KCkubGVmdDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGVsdGEgPCAtY29sdW1uU2l6ZSAmJiBzY29wZS5lbGVtZW50LmNhbkV4cGFuZExlZnQoY29ubmVjdEFkamFjZW50KSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZS4kYXBwbHkoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuZWxlbWVudC5leHBhbmRMZWZ0KGNvbm5lY3RBZGphY2VudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChkZWx0YSA+IGNvbHVtblNpemUgJiYgc2NvcGUuZWxlbWVudC5jYW5Db250cmFjdExlZnQoY29ubmVjdEFkamFjZW50KSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZS4kYXBwbHkoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuZWxlbWVudC5jb250cmFjdExlZnQoY29ubmVjdEFkamFjZW50KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoJChlLnRhcmdldCkuaGFzQ2xhc3MoXCJsYXlvdXQtY29sdW1uLXJlc2l6ZS1iYXItcmlnaHRcIikpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZGVsdGEgPSB1aS5vZmZzZXQubGVmdCAtIGNvbHVtbkVsZW1lbnQud2lkdGgoKSAtIGNvbHVtbkVsZW1lbnQub2Zmc2V0KCkubGVmdDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGVsdGEgPiBjb2x1bW5TaXplICYmIHNjb3BlLmVsZW1lbnQuY2FuRXhwYW5kUmlnaHQoY29ubmVjdEFkamFjZW50KSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZS4kYXBwbHkoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuZWxlbWVudC5leHBhbmRSaWdodChjb25uZWN0QWRqYWNlbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZGVsdGEgPCAtY29sdW1uU2l6ZSAmJiBzY29wZS5lbGVtZW50LmNhbkNvbnRyYWN0UmlnaHQoY29ubmVjdEFkamFjZW50KSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZS4kYXBwbHkoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuZWxlbWVudC5jb250cmFjdFJpZ2h0KGNvbm5lY3RBZGphY2VudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3A6IGZ1bmN0aW9uIChlLCB1aSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuJGFwcGx5KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuZWxlbWVudC5lZGl0b3IuaXNSZXNpemluZyA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuICAgICAgICB9XHJcbiAgICBdKTsiLCJhbmd1bGFyXHJcbiAgICAubW9kdWxlKFwiTGF5b3V0RWRpdG9yXCIpXHJcbiAgICAuZGlyZWN0aXZlKFwib3JjTGF5b3V0Q29udGVudFwiLCBbXCIkc2NlXCIsIFwic2NvcGVDb25maWd1cmF0b3JcIiwgXCJlbnZpcm9ubWVudFwiLFxyXG4gICAgICAgIGZ1bmN0aW9uICgkc2NlLCBzY29wZUNvbmZpZ3VyYXRvciwgZW52aXJvbm1lbnQpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgIHJlc3RyaWN0OiBcIkVcIixcclxuICAgICAgICAgICAgICAgIHNjb3BlOiB7IGVsZW1lbnQ6IFwiPVwiIH0sXHJcbiAgICAgICAgICAgICAgICBjb250cm9sbGVyOiBbXCIkc2NvcGVcIiwgXCIkZWxlbWVudFwiLFxyXG4gICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICgkc2NvcGUsICRlbGVtZW50KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlQ29uZmlndXJhdG9yLmNvbmZpZ3VyZUZvckVsZW1lbnQoJHNjb3BlLCAkZWxlbWVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBPdmVyd3JpdGUgdGhlIHNldEh0bWwgZnVuY3Rpb24gc28gdGhhdCB3ZSBjYW4gdXNlIHRoZSAkc2NlIHNlcnZpY2UgdG8gdHJ1c3QgdGhlIGh0bWwgKGFuZCBub3QgaGF2ZSB0aGUgaHRtbCBiaW5kaW5nIHN0cmlwIGNlcnRhaW4gdGFncykuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5lbGVtZW50LnNldEh0bWwgPSBmdW5jdGlvbiAoaHRtbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmVsZW1lbnQuaHRtbCA9IGh0bWw7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuZWxlbWVudC5odG1sVW5zYWZlID0gJHNjZS50cnVzdEFzSHRtbChodG1sKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5lbGVtZW50LnNldEh0bWwoJHNjb3BlLmVsZW1lbnQuaHRtbCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgICAgIHRlbXBsYXRlVXJsOiBlbnZpcm9ubWVudC50ZW1wbGF0ZVVybChcIkNvbnRlbnRcIiksXHJcbiAgICAgICAgICAgICAgICByZXBsYWNlOiB0cnVlXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgfVxyXG4gICAgXSk7IiwiYW5ndWxhclxyXG4gICAgLm1vZHVsZShcIkxheW91dEVkaXRvclwiKVxyXG4gICAgLmRpcmVjdGl2ZShcIm9yY0xheW91dEdyaWRcIiwgW1wiJGNvbXBpbGVcIiwgXCJzY29wZUNvbmZpZ3VyYXRvclwiLCBcImVudmlyb25tZW50XCIsXHJcbiAgICAgICAgZnVuY3Rpb24gKCRjb21waWxlLCBzY29wZUNvbmZpZ3VyYXRvciwgZW52aXJvbm1lbnQpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgIHJlc3RyaWN0OiBcIkVcIixcclxuICAgICAgICAgICAgICAgIHNjb3BlOiB7IGVsZW1lbnQ6IFwiPVwiIH0sXHJcbiAgICAgICAgICAgICAgICBjb250cm9sbGVyOiBbXCIkc2NvcGVcIiwgXCIkZWxlbWVudFwiLFxyXG4gICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICgkc2NvcGUsICRlbGVtZW50KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlQ29uZmlndXJhdG9yLmNvbmZpZ3VyZUZvckVsZW1lbnQoJHNjb3BlLCAkZWxlbWVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlQ29uZmlndXJhdG9yLmNvbmZpZ3VyZUZvckNvbnRhaW5lcigkc2NvcGUsICRlbGVtZW50KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLnNvcnRhYmxlT3B0aW9uc1tcImF4aXNcIl0gPSBcInlcIjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICAgICAgdGVtcGxhdGVVcmw6IGVudmlyb25tZW50LnRlbXBsYXRlVXJsKFwiR3JpZFwiKSxcclxuICAgICAgICAgICAgICAgIHJlcGxhY2U6IHRydWVcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICB9XHJcbiAgICBdKTsiLCJhbmd1bGFyXHJcbiAgICAubW9kdWxlKFwiTGF5b3V0RWRpdG9yXCIpXHJcbiAgICAuZGlyZWN0aXZlKFwib3JjTGF5b3V0Um93XCIsIFtcIiRjb21waWxlXCIsIFwic2NvcGVDb25maWd1cmF0b3JcIiwgXCJlbnZpcm9ubWVudFwiLFxyXG4gICAgICAgIGZ1bmN0aW9uICgkY29tcGlsZSwgc2NvcGVDb25maWd1cmF0b3IsIGVudmlyb25tZW50KSB7XHJcbiAgICAgICAgICAgIHJldHVybiB7XHJcbiAgICAgICAgICAgICAgICByZXN0cmljdDogXCJFXCIsXHJcbiAgICAgICAgICAgICAgICBzY29wZTogeyBlbGVtZW50OiBcIj1cIiB9LFxyXG4gICAgICAgICAgICAgICAgY29udHJvbGxlcjogW1wiJHNjb3BlXCIsIFwiJGVsZW1lbnRcIixcclxuICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoJHNjb3BlLCAkZWxlbWVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzY29wZUNvbmZpZ3VyYXRvci5jb25maWd1cmVGb3JFbGVtZW50KCRzY29wZSwgJGVsZW1lbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzY29wZUNvbmZpZ3VyYXRvci5jb25maWd1cmVGb3JDb250YWluZXIoJHNjb3BlLCAkZWxlbWVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5zb3J0YWJsZU9wdGlvbnNbXCJheGlzXCJdID0gXCJ4XCI7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5zb3J0YWJsZU9wdGlvbnNbXCJ1aS1mbG9hdGluZ1wiXSA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgICAgIHRlbXBsYXRlVXJsOiBlbnZpcm9ubWVudC50ZW1wbGF0ZVVybChcIlJvd1wiKSxcclxuICAgICAgICAgICAgICAgIHJlcGxhY2U6IHRydWVcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICB9XHJcbiAgICBdKTsiLCJhbmd1bGFyXHJcbiAgICAubW9kdWxlKFwiTGF5b3V0RWRpdG9yXCIpXHJcbiAgICAuZGlyZWN0aXZlKFwib3JjTGF5b3V0UG9wdXBcIiwgW1xyXG4gICAgICAgIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgIHJlc3RyaWN0OiBcIkFcIixcclxuICAgICAgICAgICAgICAgIGxpbms6IGZ1bmN0aW9uIChzY29wZSwgZWxlbWVudCwgYXR0cnMpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgcG9wdXAgPSAkKGVsZW1lbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciB0cmlnZ2VyID0gcG9wdXAuY2xvc2VzdChcIi5sYXlvdXQtcG9wdXAtdHJpZ2dlclwiKTtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgcGFyZW50RWxlbWVudCA9IHBvcHVwLmNsb3Nlc3QoXCIubGF5b3V0LWVsZW1lbnRcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgdHJpZ2dlci5jbGljayhmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHBvcHVwLnRvZ2dsZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocG9wdXAuaXMoXCI6dmlzaWJsZVwiKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9wdXAucG9zaXRpb24oe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG15OiBhdHRycy5vcmNMYXlvdXRQb3B1cE15IHx8IFwibGVmdCB0b3BcIixcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdDogYXR0cnMub3JjTGF5b3V0UG9wdXBBdCB8fCBcImxlZnQgYm90dG9tKzRweFwiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9mOiB0cmlnZ2VyXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvcHVwLmZpbmQoXCJpbnB1dFwiKS5maXJzdCgpLmZvY3VzKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICBwb3B1cC5jbGljayhmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbigpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHBhcmVudEVsZW1lbnQuY2xpY2soZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcG9wdXAuaGlkZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHBvcHVwLmtleWRvd24oZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlLmN0cmxLZXkgJiYgIWUuc2hpZnRLZXkgJiYgIWUuYWx0S2V5ICYmIGUud2hpY2ggPT0gMjcpIC8vIEVzY1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9wdXAuaGlkZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbigpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHBvcHVwLm9uKFwiY3V0IGNvcHkgcGFzdGVcIiwgZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gQWxsb3cgY2xpcGJvYXJkIG9wZXJhdGlvbnMgaW4gcG9wdXAgd2l0aG91dCBpbnZva2luZyBjbGlwYm9hcmQgZXZlbnQgaGFuZGxlcnMgb24gcGFyZW50IGVsZW1lbnQuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGUuc3RvcFByb3BhZ2F0aW9uKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgfVxyXG4gICAgXSk7IiwiYW5ndWxhclxyXG4gICAgLm1vZHVsZShcIkxheW91dEVkaXRvclwiKVxyXG4gICAgLmRpcmVjdGl2ZShcIm9yY0xheW91dFRvb2xib3hcIiwgW1wiJGNvbXBpbGVcIiwgXCJlbnZpcm9ubWVudFwiLFxyXG4gICAgICAgIGZ1bmN0aW9uICgkY29tcGlsZSwgZW52aXJvbm1lbnQpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgIHJlc3RyaWN0OiBcIkVcIixcclxuICAgICAgICAgICAgICAgIGNvbnRyb2xsZXI6IFtcIiRzY29wZVwiLCBcIiRlbGVtZW50XCIsXHJcbiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKCRzY29wZSwgJGVsZW1lbnQpIHtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5yZXNldEVsZW1lbnRzID0gZnVuY3Rpb24gKCkge1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5ncmlkRWxlbWVudHMgPSBbXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0RWRpdG9yLkdyaWQuZnJvbSh7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hJY29uOiBcIlxcdWYwMGFcIixcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveExhYmVsOiBcIkdyaWRcIixcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveERlc2NyaXB0aW9uOiBcIkVtcHR5IGdyaWQuXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuOiBbXVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5yb3dFbGVtZW50cyA9IFtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMYXlvdXRFZGl0b3IuUm93LmZyb20oe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94SWNvbjogXCJcXHVmMGM5XCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hMYWJlbDogXCJSb3cgKDEgY29sdW1uKVwiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94RGVzY3JpcHRpb246IFwiUm93IHdpdGggMSBjb2x1bW4uXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuOiBMYXlvdXRFZGl0b3IuQ29sdW1uLnRpbWVzKDEpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0RWRpdG9yLlJvdy5mcm9tKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveEljb246IFwiXFx1ZjBjOVwiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94TGFiZWw6IFwiUm93ICgyIGNvbHVtbnMpXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hEZXNjcmlwdGlvbjogXCJSb3cgd2l0aCAyIGNvbHVtbnMuXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuOiBMYXlvdXRFZGl0b3IuQ29sdW1uLnRpbWVzKDIpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0RWRpdG9yLlJvdy5mcm9tKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveEljb246IFwiXFx1ZjBjOVwiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94TGFiZWw6IFwiUm93ICgzIGNvbHVtbnMpXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hEZXNjcmlwdGlvbjogXCJSb3cgd2l0aCAzIGNvbHVtbnMuXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuOiBMYXlvdXRFZGl0b3IuQ29sdW1uLnRpbWVzKDMpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0RWRpdG9yLlJvdy5mcm9tKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveEljb246IFwiXFx1ZjBjOVwiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94TGFiZWw6IFwiUm93ICg0IGNvbHVtbnMpXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hEZXNjcmlwdGlvbjogXCJSb3cgd2l0aCA0IGNvbHVtbnMuXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuOiBMYXlvdXRFZGl0b3IuQ29sdW1uLnRpbWVzKDQpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0RWRpdG9yLlJvdy5mcm9tKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveEljb246IFwiXFx1ZjBjOVwiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94TGFiZWw6IFwiUm93ICg2IGNvbHVtbnMpXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hEZXNjcmlwdGlvbjogXCJSb3cgd2l0aCA2IGNvbHVtbnMuXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuOiBMYXlvdXRFZGl0b3IuQ29sdW1uLnRpbWVzKDYpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0RWRpdG9yLlJvdy5mcm9tKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveEljb246IFwiXFx1ZjBjOVwiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94TGFiZWw6IFwiUm93ICgxMiBjb2x1bW5zKVwiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94RGVzY3JpcHRpb246IFwiUm93IHdpdGggMTIgY29sdW1ucy5cIixcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGRyZW46IExheW91dEVkaXRvci5Db2x1bW4udGltZXMoMTIpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIExheW91dEVkaXRvci5Sb3cuZnJvbSh7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hJY29uOiBcIlxcdWYwYzlcIixcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveExhYmVsOiBcIlJvdyAoZW1wdHkpXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hEZXNjcmlwdGlvbjogXCJFbXB0eSByb3cuXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuOiBbXVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5jb2x1bW5FbGVtZW50cyA9IFtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMYXlvdXRFZGl0b3IuQ29sdW1uLmZyb20oe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94SWNvbjogXCJcXHVmMGRiXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hMYWJlbDogXCJDb2x1bW5cIixcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveERlc2NyaXB0aW9uOiBcIkVtcHR5IGNvbHVtbi5cIixcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IDEsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9mZnNldDogMCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGRyZW46IFtdXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmNhbnZhc0VsZW1lbnRzID0gW1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExheW91dEVkaXRvci5DYW52YXMuZnJvbSh7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3hJY29uOiBcIlxcdWYwNDRcIixcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveExhYmVsOiBcIkNhbnZhc1wiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94RGVzY3JpcHRpb246IFwiRW1wdHkgY2FudmFzLlwiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZHJlbjogW11cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuY29udGVudEVsZW1lbnRDYXRlZ29yaWVzID0gXygkc2NvcGUuZWxlbWVudC5jb25maWcuY2F0ZWdvcmllcykubWFwKGZ1bmN0aW9uIChjYXRlZ29yeSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGNhdGVnb3J5Lm5hbWUsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRzOiBfKGNhdGVnb3J5LmNvbnRlbnRUeXBlcykubWFwKGZ1bmN0aW9uIChjb250ZW50VHlwZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHR5cGUgPSBjb250ZW50VHlwZS50eXBlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGZhY3RvcnkgPSBMYXlvdXRFZGl0b3IuZmFjdG9yaWVzW3R5cGVdIHx8IExheW91dEVkaXRvci5mYWN0b3JpZXNbXCJDb250ZW50XCJdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGl0ZW0gPSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNUZW1wbGF0ZWQ6IGZhbHNlLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnRUeXBlOiBjb250ZW50VHlwZS5pZCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50VHlwZUxhYmVsOiBjb250ZW50VHlwZS5sYWJlbCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50VHlwZUNsYXNzOiBjb250ZW50VHlwZS50eXBlQ2xhc3MsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogbnVsbCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNFZGl0b3I6IGNvbnRlbnRUeXBlLmhhc0VkaXRvcixcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBodG1sOiBjb250ZW50VHlwZS5odG1sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSBmYWN0b3J5KGl0ZW0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC50b29sYm94SWNvbiA9IGNvbnRlbnRUeXBlLmljb24gfHwgXCJcXHVmMWM5XCI7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnRvb2xib3hMYWJlbCA9IGNvbnRlbnRUeXBlLmxhYmVsO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC50b29sYm94RGVzY3JpcHRpb24gPSBjb250ZW50VHlwZS5kZXNjcmlwdGlvbjtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlbGVtZW50O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUucmVzZXRFbGVtZW50cygpO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmdldFNvcnRhYmxlT3B0aW9ucyA9IGZ1bmN0aW9uICh0eXBlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZWRpdG9ySWQgPSAkZWxlbWVudC5jbG9zZXN0KFwiLmxheW91dC1lZGl0b3JcIikuYXR0cihcImlkXCIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHBhcmVudENsYXNzZXM7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcGxhY2Vob2xkZXJDbGFzc2VzO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGZsb2F0aW5nID0gZmFsc2U7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0eXBlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcIkdyaWRcIjpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyZW50Q2xhc3NlcyA9IFtcIi5sYXlvdXQtY2FudmFzXCIsIFwiLmxheW91dC1jb2x1bW5cIiwgXCIubGF5b3V0LWNvbW1vbi1ob2xkZXJcIl07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBsYWNlaG9sZGVyQ2xhc3NlcyA9IFwibGF5b3V0LWVsZW1lbnQgbGF5b3V0LWNvbnRhaW5lciBsYXlvdXQtZ3JpZCB1aS1zb3J0YWJsZS1wbGFjZWhvbGRlclwiO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiUm93XCI6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmVudENsYXNzZXMgPSBbXCIubGF5b3V0LWdyaWRcIl07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBsYWNlaG9sZGVyQ2xhc3NlcyA9IFwibGF5b3V0LWVsZW1lbnQgbGF5b3V0LWNvbnRhaW5lciBsYXlvdXQtcm93IHJvdyB1aS1zb3J0YWJsZS1wbGFjZWhvbGRlclwiO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiQ29sdW1uXCI6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmVudENsYXNzZXMgPSBbXCIubGF5b3V0LXJvdzpub3QoLmxheW91dC1yb3ctZnVsbClcIl07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBsYWNlaG9sZGVyQ2xhc3NlcyA9IFwibGF5b3V0LWVsZW1lbnQgbGF5b3V0LWNvbnRhaW5lciBsYXlvdXQtY29sdW1uIHVpLXNvcnRhYmxlLXBsYWNlaG9sZGVyXCI7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0aW5nID0gdHJ1ZTsgLy8gVG8gZW5zdXJlIGEgc21vb3RoIGhvcml6b250YWwtbGlzdCByZW9yZGVyaW5nLiBodHRwczovL2dpdGh1Yi5jb20vYW5ndWxhci11aS91aS1zb3J0YWJsZSNmbG9hdGluZ1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiQ29udGVudFwiOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJlbnRDbGFzc2VzID0gW1wiLmxheW91dC1jYW52YXNcIiwgXCIubGF5b3V0LWNvbHVtblwiLCBcIi5sYXlvdXQtY29tbW9uLWhvbGRlclwiXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGxhY2Vob2xkZXJDbGFzc2VzID0gXCJsYXlvdXQtZWxlbWVudCBsYXlvdXQtY29udGVudCB1aS1zb3J0YWJsZS1wbGFjZWhvbGRlclwiO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiQ2FudmFzXCI6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmVudENsYXNzZXMgPSBbXCIubGF5b3V0LWNhbnZhc1wiLCBcIi5sYXlvdXQtY29sdW1uXCIsIFwiLmxheW91dC1jb21tb24taG9sZGVyXCJdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwbGFjZWhvbGRlckNsYXNzZXMgPSBcImxheW91dC1lbGVtZW50IGxheW91dC1jb250YWluZXIgbGF5b3V0LWdyaWQgdWktc29ydGFibGUtcGxhY2Vob2xkZXJcIjtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJzb3I6IFwibW92ZVwiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbm5lY3RXaXRoOiBfKHBhcmVudENsYXNzZXMpLm1hcChmdW5jdGlvbiAoZSkgeyByZXR1cm4gXCIjXCIgKyBlZGl0b3JJZCArIFwiIFwiICsgZSArIFwiOm5vdCgubGF5b3V0LWNvbnRhaW5lci1zZWFsZWQpID4gLmxheW91dC1lbGVtZW50LXdyYXBwZXIgPiAubGF5b3V0LWNoaWxkcmVuXCI7IH0pLmpvaW4oXCIsIFwiKSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwbGFjZWhvbGRlcjogcGxhY2Vob2xkZXJDbGFzc2VzLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwidWktZmxvYXRpbmdcIjogZmxvYXRpbmcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlYXRlOiBmdW5jdGlvbiAoZSwgdWkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS50YXJnZXQuaXNUb29sYm94ID0gdHJ1ZTsgLy8gV2lsbCBpbmRpY2F0ZSB0byBjb25uZWN0ZWQgc29ydGFibGVzIHRoYXQgZHJvcHBlZCBpdGVtcyB3ZXJlIHNlbnQgZnJvbSB0b29sYm94LlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IGZ1bmN0aW9uIChlLCB1aSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuJGFwcGx5KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5lbGVtZW50LmlzRHJhZ2dpbmcgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3A6IGZ1bmN0aW9uIChlLCB1aSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuJGFwcGx5KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5lbGVtZW50LmlzRHJhZ2dpbmcgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5yZXNldEVsZW1lbnRzKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3ZlcjogZnVuY3Rpb24gKGUsIHVpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS4kYXBwbHkoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmVsZW1lbnQuY2FudmFzLnNldElzRHJvcFRhcmdldChmYWxzZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgbGF5b3V0SXNDb2xsYXBzZWRDb29raWVOYW1lID0gXCJsYXlvdXRUb29sYm94Q2F0ZWdvcnlfTGF5b3V0X0lzQ29sbGFwc2VkXCI7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5sYXlvdXRJc0NvbGxhcHNlZCA9ICQuY29va2llKGxheW91dElzQ29sbGFwc2VkQ29va2llTmFtZSkgPT09IFwidHJ1ZVwiO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLnRvZ2dsZUxheW91dElzQ29sbGFwc2VkID0gZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5sYXlvdXRJc0NvbGxhcHNlZCA9ICEkc2NvcGUubGF5b3V0SXNDb2xsYXBzZWQ7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkLmNvb2tpZShsYXlvdXRJc0NvbGxhcHNlZENvb2tpZU5hbWUsICRzY29wZS5sYXlvdXRJc0NvbGxhcHNlZCwgeyBleHBpcmVzOiAzNjUgfSk7IC8vIFJlbWVtYmVyIGNvbGxhcHNlZCBzdGF0ZSBmb3IgYSB5ZWFyLlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zdG9wUHJvcGFnYXRpb24oKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICAgICAgdGVtcGxhdGVVcmw6IGVudmlyb25tZW50LnRlbXBsYXRlVXJsKFwiVG9vbGJveFwiKSxcclxuICAgICAgICAgICAgICAgIHJlcGxhY2U6IHRydWUsXHJcbiAgICAgICAgICAgICAgICBsaW5rOiBmdW5jdGlvbiAoc2NvcGUsIGVsZW1lbnQpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgdG9vbGJveCA9IGVsZW1lbnQuZmluZChcIi5sYXlvdXQtdG9vbGJveFwiKTtcclxuICAgICAgICAgICAgICAgICAgICAkKHdpbmRvdykub24oXCJyZXNpemUgc2Nyb2xsXCIsIGZ1bmN0aW9uIChlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjYW52YXMgPSBlbGVtZW50LnBhcmVudCgpLmZpbmQoXCIubGF5b3V0LWNhbnZhc1wiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgdGhlIGNhbnZhcyBpcyB0YWxsZXIgdGhhbiB0aGUgdG9vbGJveCwgbWFrZSB0aGUgdG9vbGJveCBzdGlja3ktcG9zaXRpb25lZCB3aXRoaW4gdGhlIGVkaXRvclxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyB0byBoZWxwIHRoZSB1c2VyIGF2b2lkIGV4Y2Vzc2l2ZSB2ZXJ0aWNhbCBzY3JvbGxpbmcuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjYW52YXNJc1RhbGxlciA9ICEhY2FudmFzICYmIGNhbnZhcy5oZWlnaHQoKSA+IHRvb2xib3guaGVpZ2h0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB3aW5kb3dQb3MgPSAkKHdpbmRvdykuc2Nyb2xsVG9wKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjYW52YXNJc1RhbGxlciAmJiB3aW5kb3dQb3MgPiBlbGVtZW50Lm9mZnNldCgpLnRvcCArIGVsZW1lbnQuaGVpZ2h0KCkgLSB0b29sYm94LmhlaWdodCgpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94LmFkZENsYXNzKFwic3RpY2t5LWJvdHRvbVwiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3gucmVtb3ZlQ2xhc3MoXCJzdGlja3ktdG9wXCIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGNhbnZhc0lzVGFsbGVyICYmIHdpbmRvd1BvcyA+IGVsZW1lbnQub2Zmc2V0KCkudG9wKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94LmFkZENsYXNzKFwic3RpY2t5LXRvcFwiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xib3gucmVtb3ZlQ2xhc3MoXCJzdGlja3ktYm90dG9tXCIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9vbGJveC5yZW1vdmVDbGFzcyhcInN0aWNreS10b3BcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b29sYm94LnJlbW92ZUNsYXNzKFwic3RpY2t5LWJvdHRvbVwiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgIH1cclxuICAgIF0pOyIsImFuZ3VsYXJcclxuICAgIC5tb2R1bGUoXCJMYXlvdXRFZGl0b3JcIilcclxuICAgIC5kaXJlY3RpdmUoXCJvcmNMYXlvdXRUb29sYm94R3JvdXBcIiwgW1wiJGNvbXBpbGVcIiwgXCJlbnZpcm9ubWVudFwiLFxyXG4gICAgICAgIGZ1bmN0aW9uICgkY29tcGlsZSwgZW52aXJvbm1lbnQpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgIHJlc3RyaWN0OiBcIkVcIixcclxuICAgICAgICAgICAgICAgIHNjb3BlOiB7IGNhdGVnb3J5OiBcIj1cIiB9LFxyXG4gICAgICAgICAgICAgICAgY29udHJvbGxlcjogW1wiJHNjb3BlXCIsIFwiJGVsZW1lbnRcIixcclxuICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoJHNjb3BlLCAkZWxlbWVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgaXNDb2xsYXBzZWRDb29raWVOYW1lID0gXCJsYXlvdXRUb29sYm94Q2F0ZWdvcnlfXCIgKyAkc2NvcGUuY2F0ZWdvcnkubmFtZSArIFwiX0lzQ29sbGFwc2VkXCI7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRzY29wZS5pc0NvbGxhcHNlZCA9ICQuY29va2llKGlzQ29sbGFwc2VkQ29va2llTmFtZSkgPT09IFwidHJ1ZVwiO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUudG9nZ2xlSXNDb2xsYXBzZWQgPSBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNjb3BlLmlzQ29sbGFwc2VkID0gISRzY29wZS5pc0NvbGxhcHNlZDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICQuY29va2llKGlzQ29sbGFwc2VkQ29va2llTmFtZSwgJHNjb3BlLmlzQ29sbGFwc2VkLCB7IGV4cGlyZXM6IDM2NSB9KTsgLy8gUmVtZW1iZXIgY29sbGFwc2VkIHN0YXRlIGZvciBhIHllYXIuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIF0sXHJcbiAgICAgICAgICAgICAgICB0ZW1wbGF0ZVVybDogZW52aXJvbm1lbnQudGVtcGxhdGVVcmwoXCJUb29sYm94R3JvdXBcIiksXHJcbiAgICAgICAgICAgICAgICByZXBsYWNlOiB0cnVlXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgfVxyXG4gICAgXSk7Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9 diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/LayoutEditor.min.js b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/LayoutEditor.min.js index ab6aa3b3f36..6a3af675c32 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/LayoutEditor.min.js +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/LayoutEditor.min.js @@ -1 +1 @@ -angular.module("LayoutEditor",["ngSanitize","ngResource","ui.sortable"]);var LayoutEditor;!function(e){var t=function(){var e=this;this._clipboardData={},this._isDisabled=!1,this._wasInvoked=!1,this.setData=function(t,o){e._clipboardData[t]=o,e._wasInvoked=!0},this.getData=function(t){return e._clipboardData[t]},this.disable=function(){e._isDisabled=!0,e._wasInvoked=!1,e._clipboardData={}},this.isDisabled=function(){return e._isDisabled},this.wasInvoked=function(){return e._wasInvoked}};e.Clipboard=new t,angular.module("LayoutEditor").factory("clipboard",[function(){return{setData:e.Clipboard.setData,getData:e.Clipboard.getData,disable:e.Clipboard.disable,isDisabled:e.Clipboard.isDisabled,wasInvoked:e.Clipboard.wasInvoked}}])}(LayoutEditor||(LayoutEditor={})),angular.module("LayoutEditor").factory("scopeConfigurator",["$timeout","clipboard",function(e,t){return{configureForElement:function(e,o){o.find(".layout-panel").click(function(e){e.stopPropagation()}),o.parent().keydown(function(n){var l=!1,a=!1,r=e.element;if(!r.editor.isDragging){if(!t.isDisabled()){var i=r.editor.focusedElement;if(i&&n.ctrlKey)switch(n.which){case 67:i.copy(t);break;case 88:i.cut(t);break;case 86:i.paste(t)}}if(n.ctrlKey||n.shiftKey||n.altKey||46!=n.which?n.ctrlKey||n.shiftKey||n.altKey||32!=n.which&&27!=n.which||(o.find(".layout-panel-action-properties").first().click(),l=!0):(e["delete"](r),l=!0),"Content"==r.type&&(n.ctrlKey||n.shiftKey||n.altKey||13!=n.which||(o.find(".layout-panel-action-edit").first().click(),l=!0)),r.children&&(n.ctrlKey||n.shiftKey||!n.altKey||40!=n.which||(r.children.length>0&&r.children[0].setIsFocused(),l=!0),"Column"==r.type)){var c=!n.ctrlKey;37==n.which?(n.altKey&&r.expandLeft(c),n.shiftKey&&r.contractRight(c),l=!0):39==n.which&&(n.altKey&&r.contractLeft(c),n.shiftKey&&r.expandRight(c),l=!0)}r.parent&&(n.altKey&&38==n.which&&(r.parent.setIsFocused(),l=!0),"Row"==r.parent.type?n.ctrlKey||n.shiftKey||n.altKey||37!=n.which?n.ctrlKey||n.shiftKey||n.altKey||39!=n.which?!n.ctrlKey||n.shiftKey||n.altKey||37!=n.which?!n.ctrlKey||n.shiftKey||n.altKey||39!=n.which||(r.moveDown(),l=!0):(r.moveUp(),a=!0,l=!0):(r.parent.moveFocusNextChild(r),l=!0):(r.parent.moveFocusPrevChild(r),l=!0):n.ctrlKey||n.shiftKey||n.altKey||38!=n.which?n.ctrlKey||n.shiftKey||n.altKey||40!=n.which?!n.ctrlKey||n.shiftKey||n.altKey||38!=n.which?!n.ctrlKey||n.shiftKey||n.altKey||40!=n.which||(r.moveDown(),l=!0):(r.moveUp(),a=!0,l=!0):(r.parent.moveFocusNextChild(r),l=!0):(r.parent.moveFocusPrevChild(r),l=!0)),l&&n.preventDefault(),n.stopPropagation(),e.$apply(),a&&window.setTimeout(function(){e.$apply(function(){r.editor.focusedElement.setIsFocused()})},100)}}),e.element.setIsFocusedEventHandlers.push(function(){o.parent().focus()}),e["delete"]=function(e){e["delete"]()},e.element.hasEditor&&(e.edit=function(){e.$root.editElement(e.element).then(function(t){e.$apply(function(){t.cancel||(e.element.data=t.element.data,e.element.applyElementEditorModel(t.elementEditorModel),e.element.setHtml&&e.element.setHtml(t.element.html))})})})},configureForContainer:function(t,o){var n=t.element;t.getShowChildrenPlaceholder=function(){return 0===t.element.children.length&&!t.element.getIsDropTarget()},t.sortableOptions={cursor:"move",delay:150,disabled:n.getIsSealed(),distance:5,start:function(e,o){t.$apply(function(){n.setIsDropTarget(!0),n.editor.isDragging=!0}),o.placeholder.height(o.item.height()-4),o.placeholder.css("min-height",0)},stop:function(e,o){t.$apply(function(){n.editor.isDragging=!1,n.setIsDropTarget(!1)})},over:function(t,l){l.sender&&l.sender[0].isToolbox&&(l.sender[0].dropTargetTimeout&&(e.cancel(l.sender[0].dropTargetTimeout),l.sender[0].dropTargetTimeout=null),e(function(){if("Row"==n.type){var e=n.editor.dropTargetElement;e&&"Row"==e.type&&e.rollbackAddColumn()}n.setIsDropTarget(!1)}),l.sender[0].dropTargetTimeout=e(function(){if("Row"==n.type){var e=l.item.sortable.model,t=Math.floor(12/(n.children.length+1));e.width=t,e.offset=0,n.beginAddColumn(t);var a=_.max(_(o.find("> .layout-children > .layout-column:not(.ui-sortable-placeholder)")).map(function(e){return $(e).height()}));for(i=1;i<=12;i++)l.placeholder.removeClass("col-xs-"+i);l.placeholder.addClass("col-xs-"+e.width),a>0?(l.placeholder.height(a),l.placeholder.css("min-height",0)):(l.placeholder.height(0),l.placeholder.css("min-height",""))}n.setIsDropTarget(!0)},150))},receive:function(o,l){l.sender&&l.sender[0].isToolbox&&t.$apply(function(){var o=l.item.sortable.model;o&&("Row"==n.type&&n.commitAddColumn(),o.setEditor(n.editor),o.setParent(n),o.hasEditor&&t.$root.editElement(o).then(function(t){t.cancel||(o.data=t.element.data,o.applyElementEditorModel(t.elementEditorModel),o.setHtml&&o.setHtml(t.element.html)),e(function(){t.cancel?o["delete"]():o.setIsFocused(),n.setIsDropTarget(!1)})})),e(function(){n.setIsDropTarget(!1),o&&o.setIsFocused()})})}},t.click=function(e,t){e.editor.isDragging||e.setIsFocused(),t.stopPropagation()},t.getClasses=function(e){var t=["layout-element"];return e.children&&(t.push("layout-container"),e.getIsSealed()&&t.push("layout-container-sealed")),t.push("layout-"+e.type.toLowerCase()),e.dropTargetClass&&t.push(e.dropTargetClass),"Row"==e.type&&(t.push("row"),e.canAddColumn()||t.push("layout-row-full")),"Column"==e.type&&(t.push("col-xs-"+e.width),t.push("col-xs-offset-"+e.offset)),"Content"==e.type&&t.push("layout-content-"+e.contentTypeClass),e.getIsActive()&&t.push("layout-element-active"),e.getIsFocused()&&t.push("layout-element-focused"),e.getIsSelected()&&t.push("layout-element-selected"),e.getIsDropTarget()&&t.push("layout-element-droptarget"),e.isTemplated&&t.push("layout-element-templated"),t}}}}]),angular.module("LayoutEditor").directive("orcLayoutEditor",["environment",function(environment){return{restrict:"E",scope:{},controller:["$scope","$element","$attrs","$compile","clipboard",function($scope,$element,$attrs,$compile,clipboard){if(!$attrs.model)throw new Error("The 'model' attribute must evaluate to a LayoutEditor.Editor object.");$scope.element=eval($attrs.model),$scope.click=function(e,t){e.editor.isDragging||e.setIsFocused(),t.stopPropagation()},$scope.getClasses=function(e){var t=["layout-element","layout-container","layout-canvas"];return e.getIsActive()&&t.push("layout-element-active"),e.getIsFocused()&&t.push("layout-element-focused"),e.getIsSelected()&&t.push("layout-element-selected"),e.getIsDropTarget()&&t.push("layout-element-droptarget"),e.isTemplated&&t.push("layout-element-templated"),t};var layoutDesignerHost=$(".layout-designer").data("layout-designer-host");$scope.$root.layoutDesignerHost=layoutDesignerHost,layoutDesignerHost.element.on("replacecanvas",function(e,t){var o=$scope.element,n={data:t.canvas.data,htmlId:t.canvas.htmlId,htmlClass:t.canvas.htmlClass,htmlStyle:t.canvas.htmlStyle,isTemplated:t.canvas.isTemplated,children:t.canvas.children};layoutDesignerHost.editor=window.layoutEditor=new LayoutEditor.Editor(o.config,n);var l="",a=$compile(l)($scope);$(".layout-editor-holder").html(a)}),$scope.$root.editElement=function(e){var t=$scope.$root.layoutDesignerHost;return t.editElement(e)},$scope.$root.addElement=function(e){var t=$scope.$root.layoutDesignerHost;return t.addElement(e)},$(document).on("cut copy paste",function(e){if(clipboard.wasInvoked())e.originalEvent.clipboardData.setData("text/plain",clipboard.getData("text/plain")),e.originalEvent.clipboardData.setData("text/json",clipboard.getData("text/json")),e.preventDefault();else{var t=$scope.element.focusedElement;t&&($scope.$apply(function(){switch(e.type){case"copy":t.copy(e.originalEvent.clipboardData);break;case"cut":t.cut(e.originalEvent.clipboardData);break;case"paste":t.paste(e.originalEvent.clipboardData)}}),window.setTimeout(function(){$scope.$apply(function(){$scope.element.focusedElement&&$scope.element.focusedElement.setIsFocused()})},100),e.preventDefault())}clipboard.disable()})}],templateUrl:environment.templateUrl("Editor"),replace:!0,link:function(e,t){t.find(".layout-toolbar-container").click(function(e){e.stopPropagation()}),$(window).click(function(t){e.$apply(function(){e.element.activeElement=null,e.element.focusedElement=null})})}}}]),angular.module("LayoutEditor").directive("orcLayoutCanvas",["scopeConfigurator","environment",function(e,t){return{restrict:"E",scope:{element:"="},controller:["$scope","$element","$attrs",function(t,o,n){e.configureForElement(t,o),e.configureForContainer(t,o),t.sortableOptions.axis="y"}],templateUrl:t.templateUrl("Canvas"),replace:!0}}]),angular.module("LayoutEditor").directive("orcLayoutChild",["$compile",function(e){return{restrict:"E",scope:{element:"="},link:function(t,o){var n="",l=e(n)(t);$(o).replaceWith(l)}}}]),angular.module("LayoutEditor").directive("orcLayoutColumn",["$compile","scopeConfigurator","environment",function(e,t,o){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(e,o){t.configureForElement(e,o),t.configureForContainer(e,o),e.sortableOptions.axis="y"}],templateUrl:o.templateUrl("Column"),replace:!0,link:function(e,t,o){t.find(".layout-column-resize-bar").draggable({axis:"x",helper:"clone",revert:!0,start:function(t,o){e.$apply(function(){e.element.editor.isResizing=!0})},drag:function(o,n){var l=t.parent(),a=l.width()/e.element.width,r=!o.ctrlKey;if($(o.target).hasClass("layout-column-resize-bar-left")){var i=n.offset.left-l.offset().left;-a>i&&e.element.canExpandLeft(r)?e.$apply(function(){e.element.expandLeft(r)}):i>a&&e.element.canContractLeft(r)&&e.$apply(function(){e.element.contractLeft(r)})}else if($(o.target).hasClass("layout-column-resize-bar-right")){var i=n.offset.left-l.width()-l.offset().left;i>a&&e.element.canExpandRight(r)?e.$apply(function(){e.element.expandRight(r)}):-a>i&&e.element.canContractRight(r)&&e.$apply(function(){e.element.contractRight(r)})}},stop:function(t,o){e.$apply(function(){e.element.editor.isResizing=!1})}})}}}]),angular.module("LayoutEditor").directive("orcLayoutContent",["$sce","scopeConfigurator","environment",function(e,t,o){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(o,n){t.configureForElement(o,n),o.element.setHtml=function(t){o.element.html=t,o.element.htmlUnsafe=e.trustAsHtml(t)},o.element.setHtml(o.element.html)}],templateUrl:o.templateUrl("Content"),replace:!0}}]),angular.module("LayoutEditor").directive("orcLayoutGrid",["$compile","scopeConfigurator","environment",function(e,t,o){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(e,o){t.configureForElement(e,o),t.configureForContainer(e,o),e.sortableOptions.axis="y"}],templateUrl:o.templateUrl("Grid"),replace:!0}}]),angular.module("LayoutEditor").directive("orcLayoutRow",["$compile","scopeConfigurator","environment",function(e,t,o){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(e,o){t.configureForElement(e,o),t.configureForContainer(e,o),e.sortableOptions.axis="x",e.sortableOptions["ui-floating"]=!0}],templateUrl:o.templateUrl("Row"),replace:!0}}]),angular.module("LayoutEditor").directive("orcLayoutPopup",[function(){return{restrict:"A",link:function(e,t,o){var n=$(t),l=n.closest(".layout-popup-trigger"),a=n.closest(".layout-element");l.click(function(){n.toggle(),n.is(":visible")&&(n.position({my:o.orcLayoutPopupMy||"left top",at:o.orcLayoutPopupAt||"left bottom+4px",of:l}),n.find("input").first().focus())}),n.click(function(e){e.stopPropagation()}),a.click(function(e){n.hide()}),n.keydown(function(e){e.ctrlKey||e.shiftKey||e.altKey||27!=e.which||n.hide(),e.stopPropagation()}),n.on("cut copy paste",function(e){e.stopPropagation()})}}}]),angular.module("LayoutEditor").directive("orcLayoutToolbox",["$compile","environment",function(e,t){return{restrict:"E",controller:["$scope","$element",function(e,t){e.resetElements=function(){e.gridElements=[LayoutEditor.Grid.from({toolboxIcon:"",toolboxLabel:"Grid",toolboxDescription:"Empty grid.",children:[]})],e.rowElements=[LayoutEditor.Row.from({toolboxIcon:"",toolboxLabel:"Row (1 column)",toolboxDescription:"Row with 1 column.",children:LayoutEditor.Column.times(1)}),LayoutEditor.Row.from({toolboxIcon:"",toolboxLabel:"Row (2 columns)",toolboxDescription:"Row with 2 columns.",children:LayoutEditor.Column.times(2)}),LayoutEditor.Row.from({toolboxIcon:"",toolboxLabel:"Row (3 columns)",toolboxDescription:"Row with 3 columns.",children:LayoutEditor.Column.times(3)}),LayoutEditor.Row.from({toolboxIcon:"",toolboxLabel:"Row (4 columns)",toolboxDescription:"Row with 4 columns.",children:LayoutEditor.Column.times(4)}),LayoutEditor.Row.from({toolboxIcon:"",toolboxLabel:"Row (6 columns)",toolboxDescription:"Row with 6 columns.",children:LayoutEditor.Column.times(6)}),LayoutEditor.Row.from({toolboxIcon:"",toolboxLabel:"Row (12 columns)",toolboxDescription:"Row with 12 columns.",children:LayoutEditor.Column.times(12)}),LayoutEditor.Row.from({toolboxIcon:"",toolboxLabel:"Row (empty)",toolboxDescription:"Empty row.",children:[]})],e.columnElements=[LayoutEditor.Column.from({toolboxIcon:"",toolboxLabel:"Column",toolboxDescription:"Empty column.",width:1,offset:0,children:[]})],e.canvasElements=[LayoutEditor.Canvas.from({toolboxIcon:"",toolboxLabel:"Canvas",toolboxDescription:"Empty canvas.",children:[]})],e.contentElementCategories=_(e.element.config.categories).map(function(e){return{name:e.name,elements:_(e.contentTypes).map(function(e){var t=e.type,o=LayoutEditor.factories[t]||LayoutEditor.factories.Content,n={isTemplated:!1,contentType:e.id,contentTypeLabel:e.label,contentTypeClass:e.typeClass,data:null,hasEditor:e.hasEditor,html:e.html},l=o(n);return l.toolboxIcon=e.icon||"",l.toolboxLabel=e.label,l.toolboxDescription=e.description,l})}})},e.resetElements(),e.getSortableOptions=function(o){var n,l,a=t.closest(".layout-editor").attr("id"),r=!1;switch(o){case"Grid":n=[".layout-canvas",".layout-column",".layout-common-holder"],l="layout-element layout-container layout-grid ui-sortable-placeholder";break;case"Row":n=[".layout-grid"],l="layout-element layout-container layout-row row ui-sortable-placeholder";break;case"Column":n=[".layout-row:not(.layout-row-full)"],l="layout-element layout-container layout-column ui-sortable-placeholder",r=!0;break;case"Content":n=[".layout-canvas",".layout-column",".layout-common-holder"],l="layout-element layout-content ui-sortable-placeholder";break;case"Canvas":n=[".layout-canvas",".layout-column",".layout-common-holder"],l="layout-element layout-container layout-grid ui-sortable-placeholder"}return{cursor:"move",connectWith:_(n).map(function(e){return"#"+a+" "+e+":not(.layout-container-sealed) > .layout-element-wrapper > .layout-children"}).join(", "),placeholder:l,"ui-floating":r,create:function(e,t){e.target.isToolbox=!0},start:function(t,o){e.$apply(function(){e.element.isDragging=!0})},stop:function(t,o){e.$apply(function(){e.element.isDragging=!1,e.resetElements()})},over:function(t,o){e.$apply(function(){e.element.canvas.setIsDropTarget(!1)})}}};var o="layoutToolboxCategory_Layout_IsCollapsed";e.layoutIsCollapsed="true"===$.cookie(o),e.toggleLayoutIsCollapsed=function(t){e.layoutIsCollapsed=!e.layoutIsCollapsed,$.cookie(o,e.layoutIsCollapsed,{expires:365}),t.preventDefault(),t.stopPropagation()}}],templateUrl:t.templateUrl("Toolbox"),replace:!0,link:function(e,t){var o=t.find(".layout-toolbox");$(window).on("resize scroll",function(e){var n=t.parent().find(".layout-canvas"),l=!!n&&n.height()>o.height(),a=$(window).scrollTop();l&&a>t.offset().top+t.height()-o.height()?(o.addClass("sticky-bottom"),o.removeClass("sticky-top")):l&&a>t.offset().top?(o.addClass("sticky-top"),o.removeClass("sticky-bottom")):(o.removeClass("sticky-top"),o.removeClass("sticky-bottom"))})}}}]),angular.module("LayoutEditor").directive("orcLayoutToolboxGroup",["$compile","environment",function(e,t){return{restrict:"E",scope:{category:"="},controller:["$scope","$element",function(e,t){var o="layoutToolboxCategory_"+e.category.name+"_IsCollapsed";e.isCollapsed="true"===$.cookie(o),e.toggleIsCollapsed=function(t){e.isCollapsed=!e.isCollapsed,$.cookie(o,e.isCollapsed,{expires:365}),t.preventDefault(),t.stopPropagation()}}],templateUrl:t.templateUrl("ToolboxGroup"),replace:!0}}]); \ No newline at end of file +angular.module("LayoutEditor",["ngSanitize","ngResource","ui.sortable"]);var LayoutEditor;!function(e){var t=function(){var e=this;this._clipboardData={},this._isDisabled=!1,this._wasInvoked=!1,this.setData=function(t,o){e._clipboardData[t]=o,e._wasInvoked=!0},this.getData=function(t){return e._wasInvoked=!0,e._clipboardData[t]},this.disable=function(){e._isDisabled=!0,e._wasInvoked=!1,e._clipboardData={}},this.isDisabled=function(){return e._isDisabled},this.wasInvoked=function(){return e._wasInvoked}};e.Clipboard=new t,angular.module("LayoutEditor").factory("clipboard",[function(){return{setData:e.Clipboard.setData,getData:e.Clipboard.getData,disable:e.Clipboard.disable,isDisabled:e.Clipboard.isDisabled,wasInvoked:e.Clipboard.wasInvoked}}])}(LayoutEditor||(LayoutEditor={})),angular.module("LayoutEditor").factory("scopeConfigurator",["$timeout","clipboard",function(e,t){return{configureForElement:function(e,o){o.find(".layout-panel").click(function(e){e.stopPropagation()}),o.parent().keydown(function(n){var l=!1,a=!1,r=e.element;if(!r.editor.isDragging){if(!t.isDisabled()){var i=r.editor.focusedElement;if(i&&n.ctrlKey)switch(n.which){case 67:i.copy(t);break;case 88:i.cut(t);break;case 86:i.paste(t)}}if(n.ctrlKey||n.shiftKey||n.altKey||46!=n.which?n.ctrlKey||n.shiftKey||n.altKey||32!=n.which&&27!=n.which||(o.find(".layout-panel-action-properties").first().click(),l=!0):(e["delete"](r),l=!0),"Content"==r.type&&(n.ctrlKey||n.shiftKey||n.altKey||13!=n.which||(o.find(".layout-panel-action-edit").first().click(),l=!0)),r.children&&(n.ctrlKey||n.shiftKey||!n.altKey||40!=n.which||(r.children.length>0&&r.children[0].setIsFocused(),l=!0),"Column"==r.type)){var c=!n.ctrlKey;37==n.which?(n.altKey&&r.expandLeft(c),n.shiftKey&&r.contractRight(c),l=!0):39==n.which&&(n.altKey&&r.contractLeft(c),n.shiftKey&&r.expandRight(c),l=!0)}r.parent&&(n.altKey&&38==n.which&&(r.parent.setIsFocused(),l=!0),"Row"==r.parent.type?n.ctrlKey||n.shiftKey||n.altKey||37!=n.which?n.ctrlKey||n.shiftKey||n.altKey||39!=n.which?!n.ctrlKey||n.shiftKey||n.altKey||37!=n.which?!n.ctrlKey||n.shiftKey||n.altKey||39!=n.which||(r.moveDown(),l=!0):(r.moveUp(),a=!0,l=!0):(r.parent.moveFocusNextChild(r),l=!0):(r.parent.moveFocusPrevChild(r),l=!0):n.ctrlKey||n.shiftKey||n.altKey||38!=n.which?n.ctrlKey||n.shiftKey||n.altKey||40!=n.which?!n.ctrlKey||n.shiftKey||n.altKey||38!=n.which?!n.ctrlKey||n.shiftKey||n.altKey||40!=n.which||(r.moveDown(),l=!0):(r.moveUp(),a=!0,l=!0):(r.parent.moveFocusNextChild(r),l=!0):(r.parent.moveFocusPrevChild(r),l=!0)),l&&n.preventDefault(),n.stopPropagation(),e.$apply(),a&&window.setTimeout(function(){e.$apply(function(){r.editor.focusedElement.setIsFocused()})},100)}}),e.element.setIsFocusedEventHandlers.push(function(){o.parent().focus()}),e["delete"]=function(e){e["delete"]()},e.element.hasEditor&&(e.edit=function(){e.$root.editElement(e.element).then(function(t){e.$apply(function(){t.cancel||(e.element.data=t.element.data,e.element.applyElementEditorModel(t.elementEditorModel),e.element.setHtml&&e.element.setHtml(t.element.html))})})})},configureForContainer:function(t,o){var n=t.element;t.getShowChildrenPlaceholder=function(){return 0===t.element.children.length&&!t.element.getIsDropTarget()},t.sortableOptions={cursor:"move",delay:150,disabled:n.getIsSealed(),distance:5,start:function(e,o){t.$apply(function(){n.setIsDropTarget(!0),n.editor.isDragging=!0}),o.placeholder.height(o.item.height()-4),o.placeholder.css("min-height",0)},stop:function(e,o){t.$apply(function(){n.editor.isDragging=!1,n.setIsDropTarget(!1)})},over:function(t,l){l.sender&&l.sender[0].isToolbox&&(l.sender[0].dropTargetTimeout&&(e.cancel(l.sender[0].dropTargetTimeout),l.sender[0].dropTargetTimeout=null),e(function(){if("Row"==n.type){var e=n.editor.dropTargetElement;e&&"Row"==e.type&&e.rollbackAddColumn()}n.setIsDropTarget(!1)}),l.sender[0].dropTargetTimeout=e(function(){if("Row"==n.type){var e=l.item.sortable.model,t=Math.floor(12/(n.children.length+1));e.width=t,e.offset=0,n.beginAddColumn(t);var a=_.max(_(o.find("> .layout-children > .layout-column:not(.ui-sortable-placeholder)")).map(function(e){return $(e).height()}));for(i=1;i<=12;i++)l.placeholder.removeClass("col-xs-"+i);l.placeholder.addClass("col-xs-"+e.width),a>0?(l.placeholder.height(a),l.placeholder.css("min-height",0)):(l.placeholder.height(0),l.placeholder.css("min-height",""))}n.setIsDropTarget(!0)},150))},receive:function(o,l){l.sender&&l.sender[0].isToolbox&&t.$apply(function(){var o=l.item.sortable.model;o&&("Row"==n.type&&n.commitAddColumn(),o.setEditor(n.editor),o.setParent(n),o.hasEditor&&t.$root.editElement(o).then(function(t){t.cancel||(o.data=t.element.data,o.applyElementEditorModel(t.elementEditorModel),o.setHtml&&o.setHtml(t.element.html)),e(function(){t.cancel?o["delete"]():o.setIsFocused(),n.setIsDropTarget(!1)})})),e(function(){n.setIsDropTarget(!1),o&&o.setIsFocused()})})}},t.click=function(e,t){e.editor.isDragging||e.setIsFocused(),t.stopPropagation()},t.getClasses=function(e){var t=["layout-element"];return e.children&&(t.push("layout-container"),e.getIsSealed()&&t.push("layout-container-sealed")),t.push("layout-"+e.type.toLowerCase()),e.dropTargetClass&&t.push(e.dropTargetClass),"Row"==e.type&&(t.push("row"),e.canAddColumn()||t.push("layout-row-full")),"Column"==e.type&&(t.push("col-xs-"+e.width),t.push("col-xs-offset-"+e.offset)),"Content"==e.type&&t.push("layout-content-"+e.contentTypeClass),e.getIsActive()&&t.push("layout-element-active"),e.getIsFocused()&&t.push("layout-element-focused"),e.getIsSelected()&&t.push("layout-element-selected"),e.getIsDropTarget()&&t.push("layout-element-droptarget"),e.isTemplated&&t.push("layout-element-templated"),t}}}}]),angular.module("LayoutEditor").directive("orcLayoutEditor",["environment",function(environment){return{restrict:"E",scope:{},controller:["$scope","$element","$attrs","$compile","clipboard",function($scope,$element,$attrs,$compile,clipboard){if(!$attrs.model)throw new Error("The 'model' attribute must evaluate to a LayoutEditor.Editor object.");$scope.element=eval($attrs.model),$scope.click=function(e,t){e.editor.isDragging||e.setIsFocused(),t.stopPropagation()},$scope.getClasses=function(e){var t=["layout-element","layout-container","layout-canvas"];return e.getIsActive()&&t.push("layout-element-active"),e.getIsFocused()&&t.push("layout-element-focused"),e.getIsSelected()&&t.push("layout-element-selected"),e.getIsDropTarget()&&t.push("layout-element-droptarget"),e.isTemplated&&t.push("layout-element-templated"),t};var layoutDesignerHost=$(".layout-designer").data("layout-designer-host");$scope.$root.layoutDesignerHost=layoutDesignerHost,layoutDesignerHost.element.on("replacecanvas",function(e,t){var o=$scope.element,n={data:t.canvas.data,htmlId:t.canvas.htmlId,htmlClass:t.canvas.htmlClass,htmlStyle:t.canvas.htmlStyle,isTemplated:t.canvas.isTemplated,children:t.canvas.children};layoutDesignerHost.editor=window.layoutEditor=new LayoutEditor.Editor(o.config,n);var l="",a=$compile(l)($scope);$(".layout-editor-holder").html(a)}),$scope.$root.editElement=function(e){var t=$scope.$root.layoutDesignerHost;return t.editElement(e)},$scope.$root.addElement=function(e){var t=$scope.$root.layoutDesignerHost;return t.addElement(e)},$(document).on("cut copy paste",function(e){if(clipboard.wasInvoked())e.originalEvent.clipboardData.setData("text/plain",clipboard.getData("text/plain")),e.originalEvent.clipboardData.setData("text/json",clipboard.getData("text/json")),e.preventDefault();else{var t=$scope.element.focusedElement;t&&($scope.$apply(function(){switch(e.type){case"copy":t.copy(e.originalEvent.clipboardData);break;case"cut":t.cut(e.originalEvent.clipboardData);break;case"paste":t.paste(e.originalEvent.clipboardData)}}),window.setTimeout(function(){$scope.$apply(function(){$scope.element.focusedElement&&$scope.element.focusedElement.setIsFocused()})},100),e.preventDefault())}clipboard.disable()})}],templateUrl:environment.templateUrl("Editor"),replace:!0,link:function(e,t){t.find(".layout-toolbar-container").click(function(e){e.stopPropagation()}),$(window).click(function(t){e.$apply(function(){e.element.activeElement=null,e.element.focusedElement=null})})}}}]),angular.module("LayoutEditor").directive("orcLayoutCanvas",["scopeConfigurator","environment",function(e,t){return{restrict:"E",scope:{element:"="},controller:["$scope","$element","$attrs",function(t,o,n){e.configureForElement(t,o),e.configureForContainer(t,o),t.sortableOptions.axis="y"}],templateUrl:t.templateUrl("Canvas"),replace:!0}}]),angular.module("LayoutEditor").directive("orcLayoutChild",["$compile",function(e){return{restrict:"E",scope:{element:"="},link:function(t,o){var n="",l=e(n)(t);$(o).replaceWith(l)}}}]),angular.module("LayoutEditor").directive("orcLayoutColumn",["$compile","scopeConfigurator","environment",function(e,t,o){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(e,o){t.configureForElement(e,o),t.configureForContainer(e,o),e.sortableOptions.axis="y"}],templateUrl:o.templateUrl("Column"),replace:!0,link:function(e,t,o){t.find(".layout-column-resize-bar").draggable({axis:"x",helper:"clone",revert:!0,start:function(t,o){e.$apply(function(){e.element.editor.isResizing=!0})},drag:function(o,n){var l=t.parent(),a=l.width()/e.element.width,r=!o.ctrlKey;if($(o.target).hasClass("layout-column-resize-bar-left")){var i=n.offset.left-l.offset().left;-a>i&&e.element.canExpandLeft(r)?e.$apply(function(){e.element.expandLeft(r)}):i>a&&e.element.canContractLeft(r)&&e.$apply(function(){e.element.contractLeft(r)})}else if($(o.target).hasClass("layout-column-resize-bar-right")){var i=n.offset.left-l.width()-l.offset().left;i>a&&e.element.canExpandRight(r)?e.$apply(function(){e.element.expandRight(r)}):-a>i&&e.element.canContractRight(r)&&e.$apply(function(){e.element.contractRight(r)})}},stop:function(t,o){e.$apply(function(){e.element.editor.isResizing=!1})}})}}}]),angular.module("LayoutEditor").directive("orcLayoutContent",["$sce","scopeConfigurator","environment",function(e,t,o){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(o,n){t.configureForElement(o,n),o.element.setHtml=function(t){o.element.html=t,o.element.htmlUnsafe=e.trustAsHtml(t)},o.element.setHtml(o.element.html)}],templateUrl:o.templateUrl("Content"),replace:!0}}]),angular.module("LayoutEditor").directive("orcLayoutGrid",["$compile","scopeConfigurator","environment",function(e,t,o){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(e,o){t.configureForElement(e,o),t.configureForContainer(e,o),e.sortableOptions.axis="y"}],templateUrl:o.templateUrl("Grid"),replace:!0}}]),angular.module("LayoutEditor").directive("orcLayoutRow",["$compile","scopeConfigurator","environment",function(e,t,o){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(e,o){t.configureForElement(e,o),t.configureForContainer(e,o),e.sortableOptions.axis="x",e.sortableOptions["ui-floating"]=!0}],templateUrl:o.templateUrl("Row"),replace:!0}}]),angular.module("LayoutEditor").directive("orcLayoutPopup",[function(){return{restrict:"A",link:function(e,t,o){var n=$(t),l=n.closest(".layout-popup-trigger"),a=n.closest(".layout-element");l.click(function(){n.toggle(),n.is(":visible")&&(n.position({my:o.orcLayoutPopupMy||"left top",at:o.orcLayoutPopupAt||"left bottom+4px",of:l}),n.find("input").first().focus())}),n.click(function(e){e.stopPropagation()}),a.click(function(e){n.hide()}),n.keydown(function(e){e.ctrlKey||e.shiftKey||e.altKey||27!=e.which||n.hide(),e.stopPropagation()}),n.on("cut copy paste",function(e){e.stopPropagation()})}}}]),angular.module("LayoutEditor").directive("orcLayoutToolbox",["$compile","environment",function(e,t){return{restrict:"E",controller:["$scope","$element",function(e,t){e.resetElements=function(){e.gridElements=[LayoutEditor.Grid.from({toolboxIcon:"",toolboxLabel:"Grid",toolboxDescription:"Empty grid.",children:[]})],e.rowElements=[LayoutEditor.Row.from({toolboxIcon:"",toolboxLabel:"Row (1 column)",toolboxDescription:"Row with 1 column.",children:LayoutEditor.Column.times(1)}),LayoutEditor.Row.from({toolboxIcon:"",toolboxLabel:"Row (2 columns)",toolboxDescription:"Row with 2 columns.",children:LayoutEditor.Column.times(2)}),LayoutEditor.Row.from({toolboxIcon:"",toolboxLabel:"Row (3 columns)",toolboxDescription:"Row with 3 columns.",children:LayoutEditor.Column.times(3)}),LayoutEditor.Row.from({toolboxIcon:"",toolboxLabel:"Row (4 columns)",toolboxDescription:"Row with 4 columns.",children:LayoutEditor.Column.times(4)}),LayoutEditor.Row.from({toolboxIcon:"",toolboxLabel:"Row (6 columns)",toolboxDescription:"Row with 6 columns.",children:LayoutEditor.Column.times(6)}),LayoutEditor.Row.from({toolboxIcon:"",toolboxLabel:"Row (12 columns)",toolboxDescription:"Row with 12 columns.",children:LayoutEditor.Column.times(12)}),LayoutEditor.Row.from({toolboxIcon:"",toolboxLabel:"Row (empty)",toolboxDescription:"Empty row.",children:[]})],e.columnElements=[LayoutEditor.Column.from({toolboxIcon:"",toolboxLabel:"Column",toolboxDescription:"Empty column.",width:1,offset:0,children:[]})],e.canvasElements=[LayoutEditor.Canvas.from({toolboxIcon:"",toolboxLabel:"Canvas",toolboxDescription:"Empty canvas.",children:[]})],e.contentElementCategories=_(e.element.config.categories).map(function(e){return{name:e.name,elements:_(e.contentTypes).map(function(e){var t=e.type,o=LayoutEditor.factories[t]||LayoutEditor.factories.Content,n={isTemplated:!1,contentType:e.id,contentTypeLabel:e.label,contentTypeClass:e.typeClass,data:null,hasEditor:e.hasEditor,html:e.html},l=o(n);return l.toolboxIcon=e.icon||"",l.toolboxLabel=e.label,l.toolboxDescription=e.description,l})}})},e.resetElements(),e.getSortableOptions=function(o){var n,l,a=t.closest(".layout-editor").attr("id"),r=!1;switch(o){case"Grid":n=[".layout-canvas",".layout-column",".layout-common-holder"],l="layout-element layout-container layout-grid ui-sortable-placeholder";break;case"Row":n=[".layout-grid"],l="layout-element layout-container layout-row row ui-sortable-placeholder";break;case"Column":n=[".layout-row:not(.layout-row-full)"],l="layout-element layout-container layout-column ui-sortable-placeholder",r=!0;break;case"Content":n=[".layout-canvas",".layout-column",".layout-common-holder"],l="layout-element layout-content ui-sortable-placeholder";break;case"Canvas":n=[".layout-canvas",".layout-column",".layout-common-holder"],l="layout-element layout-container layout-grid ui-sortable-placeholder"}return{cursor:"move",connectWith:_(n).map(function(e){return"#"+a+" "+e+":not(.layout-container-sealed) > .layout-element-wrapper > .layout-children"}).join(", "),placeholder:l,"ui-floating":r,create:function(e,t){e.target.isToolbox=!0},start:function(t,o){e.$apply(function(){e.element.isDragging=!0})},stop:function(t,o){e.$apply(function(){e.element.isDragging=!1,e.resetElements()})},over:function(t,o){e.$apply(function(){e.element.canvas.setIsDropTarget(!1)})}}};var o="layoutToolboxCategory_Layout_IsCollapsed";e.layoutIsCollapsed="true"===$.cookie(o),e.toggleLayoutIsCollapsed=function(t){e.layoutIsCollapsed=!e.layoutIsCollapsed,$.cookie(o,e.layoutIsCollapsed,{expires:365}),t.preventDefault(),t.stopPropagation()}}],templateUrl:t.templateUrl("Toolbox"),replace:!0,link:function(e,t){var o=t.find(".layout-toolbox");$(window).on("resize scroll",function(e){var n=t.parent().find(".layout-canvas"),l=!!n&&n.height()>o.height(),a=$(window).scrollTop();l&&a>t.offset().top+t.height()-o.height()?(o.addClass("sticky-bottom"),o.removeClass("sticky-top")):l&&a>t.offset().top?(o.addClass("sticky-top"),o.removeClass("sticky-bottom")):(o.removeClass("sticky-top"),o.removeClass("sticky-bottom"))})}}}]),angular.module("LayoutEditor").directive("orcLayoutToolboxGroup",["$compile","environment",function(e,t){return{restrict:"E",scope:{category:"="},controller:["$scope","$element",function(e,t){var o="layoutToolboxCategory_"+e.category.name+"_IsCollapsed";e.isCollapsed="true"===$.cookie(o),e.toggleIsCollapsed=function(t){e.isCollapsed=!e.isCollapsed,$.cookie(o,e.isCollapsed,{expires:365}),t.preventDefault(),t.stopPropagation()}}],templateUrl:t.templateUrl("ToolboxGroup"),replace:!0}}]); \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/dialog.js b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/dialog.js index d7c4bd15e0b..e41adcc92b8 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/dialog.js +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/dialog.js @@ -1,13 +1,4 @@ (function ($) { - var closedDialogs = []; - - var disposeClosedDialogs = function () { - $.each(closedDialogs, function () { - this.dispose(); - }); - - closedDialogs = []; - }; var Dialog = function (templateElementSelector) { var self = this; @@ -20,8 +11,6 @@ this.isVisible = false; this._title = this.template.find(".title").html(); - disposeClosedDialogs(); - this.title = function (value) { var titleElement = this.root.find(".title"); this._title = value; @@ -57,25 +46,7 @@ } this.close = function () { - this.isVisible = false; - - if (this.root) { - $(window).off("resize", resizeIFrame); - - // Hiding is tricky - TinyMCE throws an exception in FF when we hide the root element. - // To avoid this, move the dialog out of view. The next time a Dialog is instantiated, it will be disposed of. - this.overlay.css({ - position: "absolute", - left: "0", - top: "0", - width: "0", - height: "0", - overflow: "hidden" - }); - } - - $(document).off("keyup", onKeyUp); - closedDialogs.push(self); + this.dispose(); }; this.load = function (url, data, method) { @@ -85,19 +56,21 @@ this.frame.element.show(); this.view.hide(); - resizeIFrame(); - centerPosition(); + onWindowResize(); this.frame.getDocument().on("keyup", onKeyUp); - $(window).on("resize", function () { - resizeIFrame(); - centerPosition(); - }); + $(window).on("resize", onWindowResize); }; this.dispose = function () { - if (this.root) + this.isVisible = false; + this.frame.element.off(); + this.frame.getDocument().off("keyup", onKeyUp); + $(window).off("resize", onWindowResize); + + if (this.root) { this.root.remove(); + } }; this.setHtml = function (html) { @@ -129,6 +102,11 @@ buttons.toggle(show); }; + var onWindowResize = function () { + resizeIFrame(); + centerPosition(); + }; + var resizeIFrame = function () { if (self.frame == null) return; @@ -147,7 +125,7 @@ var onKeyUp = function (e) { var esc = 27; - if (e.keyCode == esc) { + if (e.keyCode === esc) { self.trigger("command", { command: "cancel" }); @@ -191,10 +169,9 @@ }; var updateDialog = function (scope) { - //var document = self.frame.getDocument(); var dialogSettings = scope.find(".dialog-settings"); var title = dialogSettings.find(".title"); - var buttons = dialogSettings.find(".buttons"); + var buttons = $(dialogSettings.find(".buttons")[0].outerHTML); if (title.length > 0) self.title(title.html()); if (buttons.length > 0) { diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Views/ElementEditor.cshtml b/src/Orchard.Web/Modules/Orchard.Layouts/Views/ElementEditor.cshtml index d628ed46418..c53b4adfc89 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Views/ElementEditor.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Views/ElementEditor.cshtml @@ -13,21 +13,27 @@ var command = (string)ViewBag.Command; var titleFormat = (string)ViewBag.TitleFormat; } -@Html.ValidationSummary() -@using (Html.BeginFormAntiForgeryPost(Url.Action("Update", "Element", new { session = Model.SessionKey, area = "Orchard.Layouts" }))) { - foreach (var tab in Model.Tabs) { - var id = String.Format("element-{0}", tab.ToLowerInvariant()); -
    - @foreach (var editor in Model.EditorResult.Editors) { - var position = ShapePosition.Parse((String)editor.Metadata.Position); - if (position.Name == tab) { - @Display(editor) - } - } -
    - } +@* Only render the editor shapes if the dialog is not closing. *@ +@if (Model.Submitted != true) { + @Html.ValidationSummary() +using (Html.BeginFormAntiForgeryPost(Url.Action("Update", "Element", new {session = Model.SessionKey, area = "Orchard.Layouts"}))) { + foreach (var tab in Model.Tabs) { + var id = String.Format("element-{0}", tab.ToLowerInvariant()); +
    + @foreach (var editor in Model.EditorResult.Editors) { + var position = ShapePosition.Parse((String) editor.Metadata.Position); + if (position.Name == tab) { + @Display(editor) + } + } +
    + } + } } -@if (Model.Submitted) { +else { + // See Layout-Dialog.cshtml for more information. + Layout.DialogClosing = true; + using (Script.Foot()) {