From 28da906e75f86f7dcf875ab11d76ecede775ee5f Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 30 Dec 2020 17:09:56 +0800 Subject: [PATCH 001/283] Add NormalizeContainerName method --- .../BlobStoring/Aliyun/AliyunBlobProvider.cs | 11 ++++--- .../Abp/BlobStoring/Aws/AwsBlobProvider.cs | 14 +++++---- .../BlobStoring/Azure/AzureBlobProvider.cs | 12 ++++---- ...nioBlobContainerConfigurationExtensions.cs | 1 + .../BlobStoring/Minio/MinioBlobProvider.cs | 10 ++++--- .../Volo/Abp/BlobStoring/BlobProviderBase.cs | 29 +++++++++++++++++-- 6 files changed, 57 insertions(+), 20 deletions(-) diff --git a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs index d6c9303afd..199c343659 100644 --- a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs @@ -10,13 +10,16 @@ namespace Volo.Abp.BlobStoring.Aliyun { protected IOssClientFactory OssClientFactory { get; } protected IAliyunBlobNameCalculator AliyunBlobNameCalculator { get; } + protected IServiceProvider ServiceProvider { get; } public AliyunBlobProvider( IOssClientFactory ossClientFactory, - IAliyunBlobNameCalculator aliyunBlobNameCalculator) + IAliyunBlobNameCalculator aliyunBlobNameCalculator, + IServiceProvider serviceProvider) { OssClientFactory = ossClientFactory; AliyunBlobNameCalculator = aliyunBlobNameCalculator; + ServiceProvider = serviceProvider; } protected virtual IOss GetOssClient(BlobContainerConfiguration blobContainerConfiguration) @@ -88,15 +91,15 @@ namespace Volo.Abp.BlobStoring.Aliyun return memoryStream; } - private static string GetContainerName(BlobProviderArgs args) + protected virtual string GetContainerName(BlobProviderArgs args) { var configuration = args.Configuration.GetAliyunConfiguration(); return configuration.ContainerName.IsNullOrWhiteSpace() ? args.ContainerName - : configuration.ContainerName; + : NormalizeContainerName(args, ServiceProvider, configuration.ContainerName); } - private bool BlobExists(IOss ossClient,string containerName, string blobName) + protected virtual bool BlobExists(IOss ossClient,string containerName, string blobName) { // Make sure Blob Container exists. return ossClient.DoesBucketExist(containerName) && diff --git a/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs index 191f9a0ac7..dbf2ce3848 100644 --- a/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs @@ -12,12 +12,16 @@ namespace Volo.Abp.BlobStoring.Aws { protected IAwsBlobNameCalculator AwsBlobNameCalculator { get; } protected IAmazonS3ClientFactory AmazonS3ClientFactory { get; } + protected IServiceProvider ServiceProvider { get; } - public AwsBlobProvider(IAwsBlobNameCalculator awsBlobNameCalculator, - IAmazonS3ClientFactory amazonS3ClientFactory) + public AwsBlobProvider( + IAwsBlobNameCalculator awsBlobNameCalculator, + IAmazonS3ClientFactory amazonS3ClientFactory, + IServiceProvider serviceProvider) { AwsBlobNameCalculator = awsBlobNameCalculator; AmazonS3ClientFactory = amazonS3ClientFactory; + ServiceProvider = serviceProvider; } public async override Task SaveAsync(BlobProviderSaveArgs args) @@ -111,7 +115,7 @@ namespace Volo.Abp.BlobStoring.Aws return await AmazonS3ClientFactory.GetAmazonS3Client(configuration); } - private async Task BlobExistsAsync(AmazonS3Client amazonS3Client, string containerName, string blobName) + protected virtual async Task BlobExistsAsync(AmazonS3Client amazonS3Client, string containerName, string blobName) { // Make sure Blob Container exists. if (!await AmazonS3Util.DoesS3BucketExistV2Async(amazonS3Client, containerName)) @@ -147,12 +151,12 @@ namespace Volo.Abp.BlobStoring.Aws } } - private static string GetContainerName(BlobProviderArgs args) + protected virtual string GetContainerName(BlobProviderArgs args) { var configuration = args.Configuration.GetAwsConfiguration(); return configuration.ContainerName.IsNullOrWhiteSpace() ? args.ContainerName - : configuration.ContainerName; + : NormalizeContainerName(args, ServiceProvider, configuration.ContainerName); } } } diff --git a/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs index 3a9a062e76..58780c17b6 100644 --- a/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs @@ -9,10 +9,12 @@ namespace Volo.Abp.BlobStoring.Azure public class AzureBlobProvider : BlobProviderBase, ITransientDependency { protected IAzureBlobNameCalculator AzureBlobNameCalculator { get; } + protected IServiceProvider ServiceProvider { get; } - public AzureBlobProvider(IAzureBlobNameCalculator azureBlobNameCalculator) + public AzureBlobProvider(IAzureBlobNameCalculator azureBlobNameCalculator, IServiceProvider serviceProvider) { AzureBlobNameCalculator = azureBlobNameCalculator; + ServiceProvider = serviceProvider; } public async override Task SaveAsync(BlobProviderSaveArgs args) @@ -87,22 +89,22 @@ namespace Volo.Abp.BlobStoring.Azure await blobContainerClient.CreateIfNotExistsAsync(); } - private async Task BlobExistsAsync(BlobProviderArgs args, string blobName) + protected virtual async Task BlobExistsAsync(BlobProviderArgs args, string blobName) { // Make sure Blob Container exists. return await ContainerExistsAsync(GetBlobContainerClient(args)) && (await GetBlobClient(args, blobName).ExistsAsync()).Value; } - private static string GetContainerName(BlobProviderArgs args) + protected virtual string GetContainerName(BlobProviderArgs args) { var configuration = args.Configuration.GetAzureConfiguration(); return configuration.ContainerName.IsNullOrWhiteSpace() ? args.ContainerName - : configuration.ContainerName; + : NormalizeContainerName(args, ServiceProvider, configuration.ContainerName); } - private static async Task ContainerExistsAsync(BlobContainerClient blobContainerClient) + protected virtual async Task ContainerExistsAsync(BlobContainerClient blobContainerClient) { return (await blobContainerClient.ExistsAsync()).Value; } diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobContainerConfigurationExtensions.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobContainerConfigurationExtensions.cs index 3465914156..1449623ef4 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobContainerConfigurationExtensions.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobContainerConfigurationExtensions.cs @@ -15,6 +15,7 @@ namespace Volo.Abp.BlobStoring.Minio Action minioConfigureAction) { containerConfiguration.ProviderType = typeof(MinioBlobProvider); + containerConfiguration.NamingNormalizers.TryAdd(); minioConfigureAction(new MinioBlobProviderConfiguration(containerConfiguration)); diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs index fca23324dc..f8f1a1e880 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs @@ -10,10 +10,12 @@ namespace Volo.Abp.BlobStoring.Minio public class MinioBlobProvider : BlobProviderBase, ITransientDependency { protected IMinioBlobNameCalculator MinioBlobNameCalculator { get; } + protected IServiceProvider ServiceProvider { get; } - public MinioBlobProvider(IMinioBlobNameCalculator minioBlobNameCalculator) + public MinioBlobProvider(IMinioBlobNameCalculator minioBlobNameCalculator, IServiceProvider serviceProvider) { MinioBlobNameCalculator = minioBlobNameCalculator; + ServiceProvider = serviceProvider; } public async override Task SaveAsync(BlobProviderSaveArgs args) @@ -108,7 +110,7 @@ namespace Volo.Abp.BlobStoring.Minio } } - private async Task BlobExistsAsync(MinioClient client, string containerName , string blobName) + protected virtual async Task BlobExistsAsync(MinioClient client, string containerName , string blobName) { // Make sure Blob Container exists. if (await client.BucketExistsAsync(containerName)) @@ -133,13 +135,13 @@ namespace Volo.Abp.BlobStoring.Minio return false; } - private static string GetContainerName(BlobProviderArgs args) + protected virtual string GetContainerName(BlobProviderArgs args) { var configuration = args.Configuration.GetMinioConfiguration(); return configuration.BucketName.IsNullOrWhiteSpace() ? args.ContainerName - : configuration.BucketName; + : NormalizeContainerName(args, ServiceProvider, configuration.BucketName); } } } diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs index b1aafb6903..e0a798a7bb 100644 --- a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs @@ -1,5 +1,8 @@ -using System.IO; +using System; +using System.IO; +using System.Linq; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; namespace Volo.Abp.BlobStoring { @@ -12,5 +15,27 @@ namespace Volo.Abp.BlobStoring public abstract Task ExistsAsync(BlobProviderExistsArgs args); public abstract Task GetOrNullAsync(BlobProviderGetArgs args); + + protected string NormalizeContainerName(BlobProviderArgs args, IServiceProvider serviceProvider, string containerName) + { + if (!args.Configuration.NamingNormalizers.Any()) + { + return containerName; + } + + using (var scope = serviceProvider.CreateScope()) + { + foreach (var normalizerType in args.Configuration.NamingNormalizers) + { + var normalizer = scope.ServiceProvider + .GetRequiredService(normalizerType) + .As(); + + containerName = normalizer.NormalizeContainerName(containerName); + } + + return containerName; + } + } } -} \ No newline at end of file +} From e457a7ede0ac34bdbd94d4fa96adf55b5c4b87b0 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 30 Dec 2020 17:37:34 +0800 Subject: [PATCH 002/283] Improved --- .../Abp/BlobStoring/Aliyun/AliyunBlobProviderConfiguration.cs | 2 +- .../Volo/Abp/BlobStoring/Aws/AwsBlobProviderConfiguration.cs | 2 +- .../Abp/BlobStoring/Azure/AzureBlobProviderConfiguration.cs | 2 +- .../Abp/BlobStoring/Minio/MinioBlobProviderConfiguration.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProviderConfiguration.cs b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProviderConfiguration.cs index 276cbd8fc7..6b83d9f7a9 100644 --- a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProviderConfiguration.cs +++ b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProviderConfiguration.cs @@ -82,7 +82,7 @@ namespace Volo.Abp.BlobStoring.Aliyun public string ContainerName { get => _containerConfiguration.GetConfigurationOrDefault(AliyunBlobProviderConfigurationNames.ContainerName); - set => _containerConfiguration.SetConfiguration(AliyunBlobProviderConfigurationNames.ContainerName, Check.NotNullOrWhiteSpace(value, nameof(value))); + set => _containerConfiguration.SetConfiguration(AliyunBlobProviderConfigurationNames.ContainerName, value); } /// diff --git a/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProviderConfiguration.cs b/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProviderConfiguration.cs index 2be373e428..86d127c0d9 100644 --- a/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProviderConfiguration.cs +++ b/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProviderConfiguration.cs @@ -82,7 +82,7 @@ namespace Volo.Abp.BlobStoring.Aws public string ContainerName { get => _containerConfiguration.GetConfigurationOrDefault(AwsBlobProviderConfigurationNames.ContainerName); - set => _containerConfiguration.SetConfiguration(AwsBlobProviderConfigurationNames.ContainerName, Check.NotNullOrWhiteSpace(value, nameof(value))); + set => _containerConfiguration.SetConfiguration(AwsBlobProviderConfigurationNames.ContainerName, value); } /// diff --git a/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProviderConfiguration.cs b/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProviderConfiguration.cs index 969057d7d6..8b409e008b 100644 --- a/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProviderConfiguration.cs +++ b/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProviderConfiguration.cs @@ -17,7 +17,7 @@ public string ContainerName { get => _containerConfiguration.GetConfigurationOrDefault(AzureBlobProviderConfigurationNames.ContainerName); - set => _containerConfiguration.SetConfiguration(AzureBlobProviderConfigurationNames.ContainerName, Check.NotNullOrWhiteSpace(value, nameof(value))); + set => _containerConfiguration.SetConfiguration(AzureBlobProviderConfigurationNames.ContainerName, value); } /// diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfiguration.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfiguration.cs index 395aa76a72..fb510843e2 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfiguration.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfiguration.cs @@ -5,7 +5,7 @@ public string BucketName { get => _containerConfiguration.GetConfigurationOrDefault(MinioBlobProviderConfigurationNames.BucketName); - set => _containerConfiguration.SetConfiguration(MinioBlobProviderConfigurationNames.BucketName, Check.NotNullOrWhiteSpace(value, nameof(value))); + set => _containerConfiguration.SetConfiguration(MinioBlobProviderConfigurationNames.BucketName, value); } /// From 26fb70beee671bb273fcab961e6ff0bc1b14e5eb Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 30 Dec 2020 18:12:46 +0800 Subject: [PATCH 003/283] Make NormalizeContainerName mehtod virtual --- .../Volo/Abp/BlobStoring/BlobProviderBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs index e0a798a7bb..d96b6fa94b 100644 --- a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.BlobStoring public abstract Task GetOrNullAsync(BlobProviderGetArgs args); - protected string NormalizeContainerName(BlobProviderArgs args, IServiceProvider serviceProvider, string containerName) + protected virtual string NormalizeContainerName(BlobProviderArgs args, IServiceProvider serviceProvider, string containerName) { if (!args.Configuration.NamingNormalizers.Any()) { From 69a613d3f74b6d9ca4c0dfbfc066af55ef6ab0fe Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Thu, 14 Jan 2021 12:11:38 +0800 Subject: [PATCH 004/283] Add IBlobNormalizeNamingFactory --- .../BlobStoring/Aliyun/AliyunBlobProvider.cs | 8 +-- .../Abp/BlobStoring/Aws/AwsBlobProvider.cs | 8 +-- .../BlobStoring/Azure/AzureBlobProvider.cs | 10 +-- .../BlobStoring/Minio/MinioBlobProvider.cs | 10 +-- .../Volo/Abp/BlobStoring/BlobContainer.cs | 37 +++-------- .../Abp/BlobStoring/BlobContainerFactory.cs | 7 +- .../BlobStoring/BlobNormalizeNamingFactory.cs | 64 +++++++++++++++++++ .../Volo/Abp/BlobStoring/BlobProviderBase.cs | 27 +------- .../IBlobNormalizeNamingFactory.cs | 11 ++++ 9 files changed, 110 insertions(+), 72 deletions(-) create mode 100644 framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobNormalizeNamingFactory.cs create mode 100644 framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobNormalizeNamingFactory.cs diff --git a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs index 199c343659..52d8674c67 100644 --- a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs @@ -10,16 +10,16 @@ namespace Volo.Abp.BlobStoring.Aliyun { protected IOssClientFactory OssClientFactory { get; } protected IAliyunBlobNameCalculator AliyunBlobNameCalculator { get; } - protected IServiceProvider ServiceProvider { get; } + protected IBlobNormalizeNamingFactory BlobNormalizeNamingFactory { get; } public AliyunBlobProvider( IOssClientFactory ossClientFactory, IAliyunBlobNameCalculator aliyunBlobNameCalculator, - IServiceProvider serviceProvider) + IBlobNormalizeNamingFactory blobNormalizeNamingFactory) { OssClientFactory = ossClientFactory; AliyunBlobNameCalculator = aliyunBlobNameCalculator; - ServiceProvider = serviceProvider; + BlobNormalizeNamingFactory = blobNormalizeNamingFactory; } protected virtual IOss GetOssClient(BlobContainerConfiguration blobContainerConfiguration) @@ -96,7 +96,7 @@ namespace Volo.Abp.BlobStoring.Aliyun var configuration = args.Configuration.GetAliyunConfiguration(); return configuration.ContainerName.IsNullOrWhiteSpace() ? args.ContainerName - : NormalizeContainerName(args, ServiceProvider, configuration.ContainerName); + : BlobNormalizeNamingFactory.NormalizeContainerName(args.Configuration, configuration.ContainerName); } protected virtual bool BlobExists(IOss ossClient,string containerName, string blobName) diff --git a/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs index dbf2ce3848..991be2b37c 100644 --- a/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs @@ -12,16 +12,16 @@ namespace Volo.Abp.BlobStoring.Aws { protected IAwsBlobNameCalculator AwsBlobNameCalculator { get; } protected IAmazonS3ClientFactory AmazonS3ClientFactory { get; } - protected IServiceProvider ServiceProvider { get; } + protected IBlobNormalizeNamingFactory BlobNormalizeNamingFactory { get; } public AwsBlobProvider( IAwsBlobNameCalculator awsBlobNameCalculator, IAmazonS3ClientFactory amazonS3ClientFactory, - IServiceProvider serviceProvider) + IBlobNormalizeNamingFactory blobNormalizeNamingFactory) { AwsBlobNameCalculator = awsBlobNameCalculator; AmazonS3ClientFactory = amazonS3ClientFactory; - ServiceProvider = serviceProvider; + BlobNormalizeNamingFactory = blobNormalizeNamingFactory; } public async override Task SaveAsync(BlobProviderSaveArgs args) @@ -156,7 +156,7 @@ namespace Volo.Abp.BlobStoring.Aws var configuration = args.Configuration.GetAwsConfiguration(); return configuration.ContainerName.IsNullOrWhiteSpace() ? args.ContainerName - : NormalizeContainerName(args, ServiceProvider, configuration.ContainerName); + : BlobNormalizeNamingFactory.NormalizeContainerName(args.Configuration, configuration.ContainerName); } } } diff --git a/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs index 58780c17b6..8e401b73c7 100644 --- a/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs @@ -9,12 +9,14 @@ namespace Volo.Abp.BlobStoring.Azure public class AzureBlobProvider : BlobProviderBase, ITransientDependency { protected IAzureBlobNameCalculator AzureBlobNameCalculator { get; } - protected IServiceProvider ServiceProvider { get; } + protected IBlobNormalizeNamingFactory BlobNormalizeNamingFactory { get; } - public AzureBlobProvider(IAzureBlobNameCalculator azureBlobNameCalculator, IServiceProvider serviceProvider) + public AzureBlobProvider( + IAzureBlobNameCalculator azureBlobNameCalculator, + IBlobNormalizeNamingFactory blobNormalizeNamingFactory) { AzureBlobNameCalculator = azureBlobNameCalculator; - ServiceProvider = serviceProvider; + BlobNormalizeNamingFactory = blobNormalizeNamingFactory; } public async override Task SaveAsync(BlobProviderSaveArgs args) @@ -101,7 +103,7 @@ namespace Volo.Abp.BlobStoring.Azure var configuration = args.Configuration.GetAzureConfiguration(); return configuration.ContainerName.IsNullOrWhiteSpace() ? args.ContainerName - : NormalizeContainerName(args, ServiceProvider, configuration.ContainerName); + : BlobNormalizeNamingFactory.NormalizeContainerName(args.Configuration, configuration.ContainerName); } protected virtual async Task ContainerExistsAsync(BlobContainerClient blobContainerClient) diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs index f8f1a1e880..a182478017 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs @@ -10,12 +10,14 @@ namespace Volo.Abp.BlobStoring.Minio public class MinioBlobProvider : BlobProviderBase, ITransientDependency { protected IMinioBlobNameCalculator MinioBlobNameCalculator { get; } - protected IServiceProvider ServiceProvider { get; } + protected IBlobNormalizeNamingFactory BlobNormalizeNamingFactory { get; } - public MinioBlobProvider(IMinioBlobNameCalculator minioBlobNameCalculator, IServiceProvider serviceProvider) + public MinioBlobProvider( + IMinioBlobNameCalculator minioBlobNameCalculator, + IBlobNormalizeNamingFactory blobNormalizeNamingFactory) { MinioBlobNameCalculator = minioBlobNameCalculator; - ServiceProvider = serviceProvider; + BlobNormalizeNamingFactory = blobNormalizeNamingFactory; } public async override Task SaveAsync(BlobProviderSaveArgs args) @@ -141,7 +143,7 @@ namespace Volo.Abp.BlobStoring.Minio return configuration.BucketName.IsNullOrWhiteSpace() ? args.ContainerName - : NormalizeContainerName(args, ServiceProvider, configuration.BucketName); + : BlobNormalizeNamingFactory.NormalizeContainerName(args.Configuration, configuration.BucketName); } } } diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainer.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainer.cs index cd2287e964..a95cdcadbe 100644 --- a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainer.cs +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainer.cs @@ -1,9 +1,7 @@ using System; using System.IO; -using System.Linq; using System.Threading; using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; using Volo.Abp.MultiTenancy; using Volo.Abp.Threading; @@ -88,12 +86,15 @@ namespace Volo.Abp.BlobStoring protected IServiceProvider ServiceProvider { get; } + protected IBlobNormalizeNamingFactory BlobNormalizeNamingFactory { get; } + public BlobContainer( string containerName, BlobContainerConfiguration configuration, IBlobProvider provider, ICurrentTenant currentTenant, ICancellationTokenProvider cancellationTokenProvider, + IBlobNormalizeNamingFactory blobNormalizeNamingFactory, IServiceProvider serviceProvider) { ContainerName = containerName; @@ -101,6 +102,7 @@ namespace Volo.Abp.BlobStoring Provider = provider; CurrentTenant = currentTenant; CancellationTokenProvider = cancellationTokenProvider; + BlobNormalizeNamingFactory = blobNormalizeNamingFactory; ServiceProvider = serviceProvider; } @@ -112,7 +114,7 @@ namespace Volo.Abp.BlobStoring { using (CurrentTenant.Change(GetTenantIdOrNull())) { - var (normalizedContainerName, normalizedBlobName) = NormalizeNaming(ContainerName, name); + var (normalizedContainerName, normalizedBlobName) = BlobNormalizeNamingFactory.NormalizeNaming(Configuration, ContainerName, name); await Provider.SaveAsync( new BlobProviderSaveArgs( @@ -134,7 +136,7 @@ namespace Volo.Abp.BlobStoring using (CurrentTenant.Change(GetTenantIdOrNull())) { var (normalizedContainerName, normalizedBlobName) = - NormalizeNaming(ContainerName, name); + BlobNormalizeNamingFactory.NormalizeNaming(Configuration, ContainerName, name); return await Provider.DeleteAsync( new BlobProviderDeleteArgs( @@ -154,7 +156,7 @@ namespace Volo.Abp.BlobStoring using (CurrentTenant.Change(GetTenantIdOrNull())) { var (normalizedContainerName, normalizedBlobName) = - NormalizeNaming(ContainerName, name); + BlobNormalizeNamingFactory.NormalizeNaming(Configuration, ContainerName, name); return await Provider.ExistsAsync( new BlobProviderExistsArgs( @@ -190,7 +192,7 @@ namespace Volo.Abp.BlobStoring using (CurrentTenant.Change(GetTenantIdOrNull())) { var (normalizedContainerName, normalizedBlobName) = - NormalizeNaming(ContainerName, name); + BlobNormalizeNamingFactory.NormalizeNaming(Configuration, ContainerName, name); return await Provider.GetOrNullAsync( new BlobProviderGetArgs( @@ -212,28 +214,5 @@ namespace Volo.Abp.BlobStoring return CurrentTenant.Id; } - - protected virtual (string, string) NormalizeNaming(string containerName, string blobName) - { - if (!Configuration.NamingNormalizers.Any()) - { - return (containerName, blobName); - } - - using (var scope = ServiceProvider.CreateScope()) - { - foreach (var normalizerType in Configuration.NamingNormalizers) - { - var normalizer = scope.ServiceProvider - .GetRequiredService(normalizerType) - .As(); - - containerName = normalizer.NormalizeContainerName(containerName); - blobName = normalizer.NormalizeBlobName(blobName); - } - - return (containerName, blobName); - } - } } } diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainerFactory.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainerFactory.cs index 7a4da39ef9..8013762164 100644 --- a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainerFactory.cs +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainerFactory.cs @@ -17,18 +17,22 @@ namespace Volo.Abp.BlobStoring protected IServiceProvider ServiceProvider { get; } + protected IBlobNormalizeNamingFactory BlobNormalizeNamingFactory { get; } + public BlobContainerFactory( IBlobContainerConfigurationProvider configurationProvider, ICurrentTenant currentTenant, ICancellationTokenProvider cancellationTokenProvider, IBlobProviderSelector providerSelector, - IServiceProvider serviceProvider) + IServiceProvider serviceProvider, + IBlobNormalizeNamingFactory blobNormalizeNamingFactory) { ConfigurationProvider = configurationProvider; CurrentTenant = currentTenant; CancellationTokenProvider = cancellationTokenProvider; ProviderSelector = providerSelector; ServiceProvider = serviceProvider; + BlobNormalizeNamingFactory = blobNormalizeNamingFactory; } public virtual IBlobContainer Create(string name) @@ -41,6 +45,7 @@ namespace Volo.Abp.BlobStoring ProviderSelector.Get(name), CurrentTenant, CancellationTokenProvider, + BlobNormalizeNamingFactory, ServiceProvider ); } diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobNormalizeNamingFactory.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobNormalizeNamingFactory.cs new file mode 100644 index 0000000000..cafba9bec2 --- /dev/null +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobNormalizeNamingFactory.cs @@ -0,0 +1,64 @@ +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.BlobStoring +{ + public class BlobNormalizeNamingFactory : IBlobNormalizeNamingFactory, ITransientDependency + { + protected IServiceProvider ServiceProvider { get; } + + public BlobNormalizeNamingFactory(IServiceProvider serviceProvider) + { + ServiceProvider = serviceProvider; + } + + public (string containerName, string blobName) NormalizeNaming( + BlobContainerConfiguration configuration, + string containerName, + string blobName) + { + + if (!configuration.NamingNormalizers.Any()) + { + return (containerName, blobName); + } + + using (var scope = ServiceProvider.CreateScope()) + { + foreach (var normalizerType in configuration.NamingNormalizers) + { + var normalizer = scope.ServiceProvider + .GetRequiredService(normalizerType) + .As(); + + containerName = containerName.IsNullOrWhiteSpace()? containerName: normalizer.NormalizeContainerName(containerName); + blobName = blobName.IsNullOrWhiteSpace()? blobName: normalizer.NormalizeBlobName(blobName); + } + + return (containerName, blobName); + } + } + + public string NormalizeContainerName(BlobContainerConfiguration configuration, string containerName) + { + if (!configuration.NamingNormalizers.Any()) + { + return containerName; + } + + return NormalizeNaming(configuration, containerName, null).containerName; + } + + public string NormalizeBlobName(BlobContainerConfiguration configuration, string blobName) + { + if (!configuration.NamingNormalizers.Any()) + { + return blobName; + } + + return NormalizeNaming(configuration, null, blobName).blobName; + } + } +} diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs index d96b6fa94b..ea2bd1ed72 100644 --- a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs @@ -1,8 +1,5 @@ -using System; -using System.IO; -using System.Linq; +using System.IO; using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; namespace Volo.Abp.BlobStoring { @@ -15,27 +12,5 @@ namespace Volo.Abp.BlobStoring public abstract Task ExistsAsync(BlobProviderExistsArgs args); public abstract Task GetOrNullAsync(BlobProviderGetArgs args); - - protected virtual string NormalizeContainerName(BlobProviderArgs args, IServiceProvider serviceProvider, string containerName) - { - if (!args.Configuration.NamingNormalizers.Any()) - { - return containerName; - } - - using (var scope = serviceProvider.CreateScope()) - { - foreach (var normalizerType in args.Configuration.NamingNormalizers) - { - var normalizer = scope.ServiceProvider - .GetRequiredService(normalizerType) - .As(); - - containerName = normalizer.NormalizeContainerName(containerName); - } - - return containerName; - } - } } } diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobNormalizeNamingFactory.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobNormalizeNamingFactory.cs new file mode 100644 index 0000000000..281196051d --- /dev/null +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobNormalizeNamingFactory.cs @@ -0,0 +1,11 @@ +namespace Volo.Abp.BlobStoring +{ + public interface IBlobNormalizeNamingFactory + { + (string containerName, string blobName) NormalizeNaming(BlobContainerConfiguration configuration, string containerName, string blobName); + + string NormalizeContainerName(BlobContainerConfiguration configuration, string containerName); + + string NormalizeBlobName(BlobContainerConfiguration configuration, string blobName); + } +} From d980ca961dfe4ea08c5986f123212ba8f986c003 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Thu, 14 Jan 2021 13:46:09 +0800 Subject: [PATCH 005/283] Rename IBlobNormalizeNamingFactory to IBlobNormalizeNamingService --- .../BlobStoring/Aliyun/AliyunBlobProvider.cs | 8 ++--- .../Abp/BlobStoring/Aws/AwsBlobProvider.cs | 8 ++--- .../BlobStoring/Azure/AzureBlobProvider.cs | 8 ++--- .../BlobStoring/Minio/MinioBlobProvider.cs | 8 ++--- .../Volo/Abp/BlobStoring/BlobContainer.cs | 36 +++++++++---------- .../Abp/BlobStoring/BlobContainerFactory.cs | 8 ++--- .../Abp/BlobStoring/BlobNormalizeNaming.cs | 15 ++++++++ ...ctory.cs => BlobNormalizeNamingService.cs} | 14 ++++---- ...tory.cs => IBlobNormalizeNamingService.cs} | 4 +-- 9 files changed, 62 insertions(+), 47 deletions(-) create mode 100644 framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobNormalizeNaming.cs rename framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/{BlobNormalizeNamingFactory.cs => BlobNormalizeNamingService.cs} (81%) rename framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/{IBlobNormalizeNamingFactory.cs => IBlobNormalizeNamingService.cs} (55%) diff --git a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs index 52d8674c67..b06377245c 100644 --- a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs @@ -10,16 +10,16 @@ namespace Volo.Abp.BlobStoring.Aliyun { protected IOssClientFactory OssClientFactory { get; } protected IAliyunBlobNameCalculator AliyunBlobNameCalculator { get; } - protected IBlobNormalizeNamingFactory BlobNormalizeNamingFactory { get; } + protected IBlobNormalizeNamingService BlobNormalizeNamingService { get; } public AliyunBlobProvider( IOssClientFactory ossClientFactory, IAliyunBlobNameCalculator aliyunBlobNameCalculator, - IBlobNormalizeNamingFactory blobNormalizeNamingFactory) + IBlobNormalizeNamingService blobNormalizeNamingService) { OssClientFactory = ossClientFactory; AliyunBlobNameCalculator = aliyunBlobNameCalculator; - BlobNormalizeNamingFactory = blobNormalizeNamingFactory; + BlobNormalizeNamingService = blobNormalizeNamingService; } protected virtual IOss GetOssClient(BlobContainerConfiguration blobContainerConfiguration) @@ -96,7 +96,7 @@ namespace Volo.Abp.BlobStoring.Aliyun var configuration = args.Configuration.GetAliyunConfiguration(); return configuration.ContainerName.IsNullOrWhiteSpace() ? args.ContainerName - : BlobNormalizeNamingFactory.NormalizeContainerName(args.Configuration, configuration.ContainerName); + : BlobNormalizeNamingService.NormalizeContainerName(args.Configuration, configuration.ContainerName); } protected virtual bool BlobExists(IOss ossClient,string containerName, string blobName) diff --git a/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs index 991be2b37c..939e91f4ef 100644 --- a/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs @@ -12,16 +12,16 @@ namespace Volo.Abp.BlobStoring.Aws { protected IAwsBlobNameCalculator AwsBlobNameCalculator { get; } protected IAmazonS3ClientFactory AmazonS3ClientFactory { get; } - protected IBlobNormalizeNamingFactory BlobNormalizeNamingFactory { get; } + protected IBlobNormalizeNamingService BlobNormalizeNamingService { get; } public AwsBlobProvider( IAwsBlobNameCalculator awsBlobNameCalculator, IAmazonS3ClientFactory amazonS3ClientFactory, - IBlobNormalizeNamingFactory blobNormalizeNamingFactory) + IBlobNormalizeNamingService blobNormalizeNamingService) { AwsBlobNameCalculator = awsBlobNameCalculator; AmazonS3ClientFactory = amazonS3ClientFactory; - BlobNormalizeNamingFactory = blobNormalizeNamingFactory; + BlobNormalizeNamingService = blobNormalizeNamingService; } public async override Task SaveAsync(BlobProviderSaveArgs args) @@ -156,7 +156,7 @@ namespace Volo.Abp.BlobStoring.Aws var configuration = args.Configuration.GetAwsConfiguration(); return configuration.ContainerName.IsNullOrWhiteSpace() ? args.ContainerName - : BlobNormalizeNamingFactory.NormalizeContainerName(args.Configuration, configuration.ContainerName); + : BlobNormalizeNamingService.NormalizeContainerName(args.Configuration, configuration.ContainerName); } } } diff --git a/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs index 8e401b73c7..b43e7eb030 100644 --- a/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs @@ -9,14 +9,14 @@ namespace Volo.Abp.BlobStoring.Azure public class AzureBlobProvider : BlobProviderBase, ITransientDependency { protected IAzureBlobNameCalculator AzureBlobNameCalculator { get; } - protected IBlobNormalizeNamingFactory BlobNormalizeNamingFactory { get; } + protected IBlobNormalizeNamingService BlobNormalizeNamingService { get; } public AzureBlobProvider( IAzureBlobNameCalculator azureBlobNameCalculator, - IBlobNormalizeNamingFactory blobNormalizeNamingFactory) + IBlobNormalizeNamingService blobNormalizeNamingService) { AzureBlobNameCalculator = azureBlobNameCalculator; - BlobNormalizeNamingFactory = blobNormalizeNamingFactory; + BlobNormalizeNamingService = blobNormalizeNamingService; } public async override Task SaveAsync(BlobProviderSaveArgs args) @@ -103,7 +103,7 @@ namespace Volo.Abp.BlobStoring.Azure var configuration = args.Configuration.GetAzureConfiguration(); return configuration.ContainerName.IsNullOrWhiteSpace() ? args.ContainerName - : BlobNormalizeNamingFactory.NormalizeContainerName(args.Configuration, configuration.ContainerName); + : BlobNormalizeNamingService.NormalizeContainerName(args.Configuration, configuration.ContainerName); } protected virtual async Task ContainerExistsAsync(BlobContainerClient blobContainerClient) diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs index a182478017..057e4ea0ba 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs @@ -10,14 +10,14 @@ namespace Volo.Abp.BlobStoring.Minio public class MinioBlobProvider : BlobProviderBase, ITransientDependency { protected IMinioBlobNameCalculator MinioBlobNameCalculator { get; } - protected IBlobNormalizeNamingFactory BlobNormalizeNamingFactory { get; } + protected IBlobNormalizeNamingService BlobNormalizeNamingService { get; } public MinioBlobProvider( IMinioBlobNameCalculator minioBlobNameCalculator, - IBlobNormalizeNamingFactory blobNormalizeNamingFactory) + IBlobNormalizeNamingService blobNormalizeNamingService) { MinioBlobNameCalculator = minioBlobNameCalculator; - BlobNormalizeNamingFactory = blobNormalizeNamingFactory; + BlobNormalizeNamingService = blobNormalizeNamingService; } public async override Task SaveAsync(BlobProviderSaveArgs args) @@ -143,7 +143,7 @@ namespace Volo.Abp.BlobStoring.Minio return configuration.BucketName.IsNullOrWhiteSpace() ? args.ContainerName - : BlobNormalizeNamingFactory.NormalizeContainerName(args.Configuration, configuration.BucketName); + : BlobNormalizeNamingService.NormalizeContainerName(args.Configuration, configuration.BucketName); } } } diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainer.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainer.cs index a95cdcadbe..c4d45b840a 100644 --- a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainer.cs +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainer.cs @@ -86,7 +86,7 @@ namespace Volo.Abp.BlobStoring protected IServiceProvider ServiceProvider { get; } - protected IBlobNormalizeNamingFactory BlobNormalizeNamingFactory { get; } + protected IBlobNormalizeNamingService BlobNormalizeNamingService { get; } public BlobContainer( string containerName, @@ -94,7 +94,7 @@ namespace Volo.Abp.BlobStoring IBlobProvider provider, ICurrentTenant currentTenant, ICancellationTokenProvider cancellationTokenProvider, - IBlobNormalizeNamingFactory blobNormalizeNamingFactory, + IBlobNormalizeNamingService blobNormalizeNamingService, IServiceProvider serviceProvider) { ContainerName = containerName; @@ -102,7 +102,7 @@ namespace Volo.Abp.BlobStoring Provider = provider; CurrentTenant = currentTenant; CancellationTokenProvider = cancellationTokenProvider; - BlobNormalizeNamingFactory = blobNormalizeNamingFactory; + BlobNormalizeNamingService = blobNormalizeNamingService; ServiceProvider = serviceProvider; } @@ -114,13 +114,13 @@ namespace Volo.Abp.BlobStoring { using (CurrentTenant.Change(GetTenantIdOrNull())) { - var (normalizedContainerName, normalizedBlobName) = BlobNormalizeNamingFactory.NormalizeNaming(Configuration, ContainerName, name); + var blobNormalizeNaming = BlobNormalizeNamingService.NormalizeNaming(Configuration, ContainerName, name); await Provider.SaveAsync( new BlobProviderSaveArgs( - normalizedContainerName, + blobNormalizeNaming.ContainerName, Configuration, - normalizedBlobName, + blobNormalizeNaming.BlobName, stream, overrideExisting, CancellationTokenProvider.FallbackToProvider(cancellationToken) @@ -135,14 +135,14 @@ namespace Volo.Abp.BlobStoring { using (CurrentTenant.Change(GetTenantIdOrNull())) { - var (normalizedContainerName, normalizedBlobName) = - BlobNormalizeNamingFactory.NormalizeNaming(Configuration, ContainerName, name); + var blobNormalizeNaming = + BlobNormalizeNamingService.NormalizeNaming(Configuration, ContainerName, name); return await Provider.DeleteAsync( new BlobProviderDeleteArgs( - normalizedContainerName, + blobNormalizeNaming.ContainerName, Configuration, - normalizedBlobName, + blobNormalizeNaming.BlobName, CancellationTokenProvider.FallbackToProvider(cancellationToken) ) ); @@ -155,14 +155,14 @@ namespace Volo.Abp.BlobStoring { using (CurrentTenant.Change(GetTenantIdOrNull())) { - var (normalizedContainerName, normalizedBlobName) = - BlobNormalizeNamingFactory.NormalizeNaming(Configuration, ContainerName, name); + var blobNormalizeNaming = + BlobNormalizeNamingService.NormalizeNaming(Configuration, ContainerName, name); return await Provider.ExistsAsync( new BlobProviderExistsArgs( - normalizedContainerName, + blobNormalizeNaming.ContainerName, Configuration, - normalizedBlobName, + blobNormalizeNaming.BlobName, CancellationTokenProvider.FallbackToProvider(cancellationToken) ) ); @@ -191,14 +191,14 @@ namespace Volo.Abp.BlobStoring { using (CurrentTenant.Change(GetTenantIdOrNull())) { - var (normalizedContainerName, normalizedBlobName) = - BlobNormalizeNamingFactory.NormalizeNaming(Configuration, ContainerName, name); + var blobNormalizeNaming = + BlobNormalizeNamingService.NormalizeNaming(Configuration, ContainerName, name); return await Provider.GetOrNullAsync( new BlobProviderGetArgs( - normalizedContainerName, + blobNormalizeNaming.ContainerName, Configuration, - normalizedBlobName, + blobNormalizeNaming.BlobName, CancellationTokenProvider.FallbackToProvider(cancellationToken) ) ); diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainerFactory.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainerFactory.cs index 8013762164..0672554506 100644 --- a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainerFactory.cs +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainerFactory.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.BlobStoring protected IServiceProvider ServiceProvider { get; } - protected IBlobNormalizeNamingFactory BlobNormalizeNamingFactory { get; } + protected IBlobNormalizeNamingService BlobNormalizeNamingService { get; } public BlobContainerFactory( IBlobContainerConfigurationProvider configurationProvider, @@ -25,14 +25,14 @@ namespace Volo.Abp.BlobStoring ICancellationTokenProvider cancellationTokenProvider, IBlobProviderSelector providerSelector, IServiceProvider serviceProvider, - IBlobNormalizeNamingFactory blobNormalizeNamingFactory) + IBlobNormalizeNamingService blobNormalizeNamingService) { ConfigurationProvider = configurationProvider; CurrentTenant = currentTenant; CancellationTokenProvider = cancellationTokenProvider; ProviderSelector = providerSelector; ServiceProvider = serviceProvider; - BlobNormalizeNamingFactory = blobNormalizeNamingFactory; + BlobNormalizeNamingService = blobNormalizeNamingService; } public virtual IBlobContainer Create(string name) @@ -45,7 +45,7 @@ namespace Volo.Abp.BlobStoring ProviderSelector.Get(name), CurrentTenant, CancellationTokenProvider, - BlobNormalizeNamingFactory, + BlobNormalizeNamingService, ServiceProvider ); } diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobNormalizeNaming.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobNormalizeNaming.cs new file mode 100644 index 0000000000..e7ad89425b --- /dev/null +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobNormalizeNaming.cs @@ -0,0 +1,15 @@ +namespace Volo.Abp.BlobStoring +{ + public class BlobNormalizeNaming + { + public string ContainerName { get; } + + public string BlobName { get; } + + public BlobNormalizeNaming(string containerName, string blobName) + { + ContainerName = containerName; + BlobName = blobName; + } + } +} diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobNormalizeNamingFactory.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobNormalizeNamingService.cs similarity index 81% rename from framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobNormalizeNamingFactory.cs rename to framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobNormalizeNamingService.cs index cafba9bec2..b2e057032a 100644 --- a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobNormalizeNamingFactory.cs +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobNormalizeNamingService.cs @@ -5,16 +5,16 @@ using Volo.Abp.DependencyInjection; namespace Volo.Abp.BlobStoring { - public class BlobNormalizeNamingFactory : IBlobNormalizeNamingFactory, ITransientDependency + public class BlobNormalizeNamingService : IBlobNormalizeNamingService, ITransientDependency { protected IServiceProvider ServiceProvider { get; } - public BlobNormalizeNamingFactory(IServiceProvider serviceProvider) + public BlobNormalizeNamingService(IServiceProvider serviceProvider) { ServiceProvider = serviceProvider; } - public (string containerName, string blobName) NormalizeNaming( + public BlobNormalizeNaming NormalizeNaming( BlobContainerConfiguration configuration, string containerName, string blobName) @@ -22,7 +22,7 @@ namespace Volo.Abp.BlobStoring if (!configuration.NamingNormalizers.Any()) { - return (containerName, blobName); + return new BlobNormalizeNaming(containerName, blobName); } using (var scope = ServiceProvider.CreateScope()) @@ -37,7 +37,7 @@ namespace Volo.Abp.BlobStoring blobName = blobName.IsNullOrWhiteSpace()? blobName: normalizer.NormalizeBlobName(blobName); } - return (containerName, blobName); + return new BlobNormalizeNaming(containerName, blobName); } } @@ -48,7 +48,7 @@ namespace Volo.Abp.BlobStoring return containerName; } - return NormalizeNaming(configuration, containerName, null).containerName; + return NormalizeNaming(configuration, containerName, null).ContainerName; } public string NormalizeBlobName(BlobContainerConfiguration configuration, string blobName) @@ -58,7 +58,7 @@ namespace Volo.Abp.BlobStoring return blobName; } - return NormalizeNaming(configuration, null, blobName).blobName; + return NormalizeNaming(configuration, null, blobName).BlobName; } } } diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobNormalizeNamingFactory.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobNormalizeNamingService.cs similarity index 55% rename from framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobNormalizeNamingFactory.cs rename to framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobNormalizeNamingService.cs index 281196051d..fecb75ef6a 100644 --- a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobNormalizeNamingFactory.cs +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobNormalizeNamingService.cs @@ -1,8 +1,8 @@ namespace Volo.Abp.BlobStoring { - public interface IBlobNormalizeNamingFactory + public interface IBlobNormalizeNamingService { - (string containerName, string blobName) NormalizeNaming(BlobContainerConfiguration configuration, string containerName, string blobName); + BlobNormalizeNaming NormalizeNaming(BlobContainerConfiguration configuration, string containerName, string blobName); string NormalizeContainerName(BlobContainerConfiguration configuration, string containerName); From b551e42fc98536d3c8062ed215e6ec648e83b756 Mon Sep 17 00:00:00 2001 From: Necati Meral Date: Fri, 15 Jan 2021 11:32:26 +0100 Subject: [PATCH 006/283] language selector should use whole row without version selector --- .../docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml index 1cdfe7ca2e..dc1ca956ed 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml @@ -126,7 +126,7 @@ @if (Model.LanguageSelectListItems.Count > 1) { -
+
From 7120c35161b94ebde819a6558365b90e34104b00 Mon Sep 17 00:00:00 2001 From: Necati Meral Date: Mon, 18 Jan 2021 07:45:45 +0100 Subject: [PATCH 007/283] consolidated duplicate `if` --- .../docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml index dc1ca956ed..b6a33ec2ad 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml @@ -126,7 +126,7 @@ @if (Model.LanguageSelectListItems.Count > 1) { -
+
From cf627f80aa99916a5722b938ca72a0a65b65af9c Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 8 Feb 2021 12:03:27 +0300 Subject: [PATCH 008/283] Added mediadescriptor and related domain settings --- .../Volo/CmsKit/CmsKitErrorCodes.cs | 5 +++ .../GlobalFeatures/GlobalCmsKitFeatures.cs | 3 ++ .../CmsKit/GlobalFeatures/MediasFeature.cs | 18 ++++++++ .../CmsKit/Localization/Resources/en.json | 3 +- .../Extensions/MediaDescriptorExtensions.cs | 19 +++++++++ .../Medias/IMediaDescriptorRepository.cs | 10 +++++ .../InvalidMediaDescriptorNameException.cs | 23 ++++++++++ .../Volo/CmsKit/Medias/MediaContainer.cs | 10 +++++ .../Volo/CmsKit/Medias/MediaDescriptor.cs | 42 +++++++++++++++++++ 9 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/MediasFeature.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/Extensions/MediaDescriptorExtensions.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/IMediaDescriptorRepository.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/InvalidMediaDescriptorNameException.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/MediaContainer.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/MediaDescriptor.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs index fa31692bfe..434a162abe 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs @@ -19,5 +19,10 @@ { public const string UrlSlugAlreadyExist = "CmsKit:BlogPost:0001"; } + + public static class MediaDescriptors + { + public const string InvalidName = "CmsKit:Medias:0001"; + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs index f6293fc659..08eaf7a919 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs @@ -10,6 +10,8 @@ namespace Volo.CmsKit.GlobalFeatures public ReactionsFeature Reactions => GetFeature(); public CommentsFeature Comments => GetFeature(); + + public MediasFeature Medias => GetFeature(); public RatingsFeature Ratings => GetFeature(); @@ -23,6 +25,7 @@ namespace Volo.CmsKit.GlobalFeatures : base(featureManager) { AddFeature(new ReactionsFeature(this)); + AddFeature(new MediasFeature(this)); AddFeature(new CommentsFeature(this)); AddFeature(new RatingsFeature(this)); AddFeature(new TagsFeature(this)); diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/MediasFeature.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/MediasFeature.cs new file mode 100644 index 0000000000..b39f3a10e3 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/MediasFeature.cs @@ -0,0 +1,18 @@ +using JetBrains.Annotations; +using Volo.Abp.GlobalFeatures; + +namespace Volo.CmsKit.GlobalFeatures +{ + [GlobalFeatureName(Name)] + public class MediasFeature : GlobalFeature + { + public const string Name = "CmsKit.Medias"; + + internal MediasFeature( + [NotNull] GlobalCmsKitFeatures cmsKit + ) : base(cmsKit) + { + + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 8b2588a12f..520664d0aa 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -40,6 +40,7 @@ "Undo": "Undo", "Update": "Update", "YourComment": "Your comment", - "YourReply": "Your reply" + "YourReply": "Your reply", + "CmsKit:Medias:0001": "'{Name}' is not a valid media name." } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/Extensions/MediaDescriptorExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/Extensions/MediaDescriptorExtensions.cs new file mode 100644 index 0000000000..579affbd02 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/Extensions/MediaDescriptorExtensions.cs @@ -0,0 +1,19 @@ +using System.IO; +using System.Linq; + +namespace Volo.CmsKit.Medias.Extensions +{ + public static class MediaDescriptorExtensions + { + public static bool IsValidMediaFileName(this string name) + { + if (string.IsNullOrWhiteSpace(name)) + { + return false; + } + + // "con" is not valid folder/file name for Windows OS + return !(Path.GetInvalidFileNameChars().Any(name.Contains) || name == "con"); + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/IMediaDescriptorRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/IMediaDescriptorRepository.cs new file mode 100644 index 0000000000..552c840897 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/IMediaDescriptorRepository.cs @@ -0,0 +1,10 @@ +using System; +using Volo.Abp.Domain.Repositories; + +namespace Volo.CmsKit.Medias +{ + public interface IMediaDescriptorRepository : IBasicRepository + { + + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/InvalidMediaDescriptorNameException.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/InvalidMediaDescriptorNameException.cs new file mode 100644 index 0000000000..376c221cd1 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/InvalidMediaDescriptorNameException.cs @@ -0,0 +1,23 @@ +using System; +using System.Runtime.Serialization; +using JetBrains.Annotations; +using Volo.Abp; + +namespace Volo.CmsKit.Medias +{ + [Serializable] + public class InvalidMediaDescriptorNameException : BusinessException + { + public InvalidMediaDescriptorNameException([NotNull] string name) + { + Code = CmsKitErrorCodes.MediaDescriptors.InvalidName; + WithData(nameof(MediaDescriptor.Name), name); + } + + public InvalidMediaDescriptorNameException(SerializationInfo serializationInfo, StreamingContext context) + : base(serializationInfo, context) + { + + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/MediaContainer.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/MediaContainer.cs new file mode 100644 index 0000000000..d1bb7a76da --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/MediaContainer.cs @@ -0,0 +1,10 @@ +using Volo.Abp.BlobStoring; + +namespace Volo.CmsKit.Medias +{ + [BlobContainerName("cms-kit-medias")] + public class MediaContainer + { + + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/MediaDescriptor.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/MediaDescriptor.cs new file mode 100644 index 0000000000..78bc42119d --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/MediaDescriptor.cs @@ -0,0 +1,42 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; +using Volo.CmsKit.Medias.Extensions; + +namespace Volo.CmsKit.Medias +{ + public class MediaDescriptor : FullAuditedAggregateRoot, IMultiTenant + { + public Guid? TenantId { get; protected set; } + + public string Name { get; protected set; } + + public string MimeType { get; set; } + + public int Size { get; protected set; } + + protected MediaDescriptor() + { + + } + + public MediaDescriptor(Guid id, Guid? tenantId, string name, string mimeType, int size) : base(id) + { + TenantId = tenantId; + MimeType = mimeType; + Size = size; + + SetName(name); + } + + public void SetName(string name) + { + if (!name.IsValidMediaFileName()) + { + throw new InvalidMediaDescriptorNameException(name); + } + + Name = name; + } + } +} \ No newline at end of file From 8bfdc1ed5f7c8faf1eb3965072ed2d1465c3e9a2 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 8 Feb 2021 12:22:57 +0300 Subject: [PATCH 009/283] Constants added and renaming folder --- .../CmsKit/MediaDescriptors/MediaDescriptorConsts.cs | 11 +++++++++++ .../Extensions/MediaDescriptorExtensions.cs | 2 +- .../IMediaDescriptorRepository.cs | 2 +- .../InvalidMediaDescriptorNameException.cs | 2 +- .../{Medias => MediaDescriptors}/MediaContainer.cs | 2 +- .../{Medias => MediaDescriptors}/MediaDescriptor.cs | 8 +++++--- 6 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/MediaDescriptors/MediaDescriptorConsts.cs rename modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/{Medias => MediaDescriptors}/Extensions/MediaDescriptorExtensions.cs (90%) rename modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/{Medias => MediaDescriptors}/IMediaDescriptorRepository.cs (80%) rename modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/{Medias => MediaDescriptors}/InvalidMediaDescriptorNameException.cs (93%) rename modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/{Medias => MediaDescriptors}/MediaContainer.cs (76%) rename modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/{Medias => MediaDescriptors}/MediaDescriptor.cs (79%) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/MediaDescriptors/MediaDescriptorConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/MediaDescriptors/MediaDescriptorConsts.cs new file mode 100644 index 0000000000..5f4741828e --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/MediaDescriptors/MediaDescriptorConsts.cs @@ -0,0 +1,11 @@ +namespace Volo.CmsKit.MediaDescriptors +{ + public class MediaDescriptorConsts + { + public static int MaxNameLength { get; set; } = 255; + + public static int MaxMimeTypeLength { get; set; } = 128; + + public static int MaxSizeLength = int.MaxValue; + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/Extensions/MediaDescriptorExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/Extensions/MediaDescriptorExtensions.cs similarity index 90% rename from modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/Extensions/MediaDescriptorExtensions.cs rename to modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/Extensions/MediaDescriptorExtensions.cs index 579affbd02..a1fa903d55 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/Extensions/MediaDescriptorExtensions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/Extensions/MediaDescriptorExtensions.cs @@ -1,7 +1,7 @@ using System.IO; using System.Linq; -namespace Volo.CmsKit.Medias.Extensions +namespace Volo.CmsKit.MediaDescriptors.Extensions { public static class MediaDescriptorExtensions { diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/IMediaDescriptorRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/IMediaDescriptorRepository.cs similarity index 80% rename from modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/IMediaDescriptorRepository.cs rename to modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/IMediaDescriptorRepository.cs index 552c840897..f9f003b6c3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/IMediaDescriptorRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/IMediaDescriptorRepository.cs @@ -1,7 +1,7 @@ using System; using Volo.Abp.Domain.Repositories; -namespace Volo.CmsKit.Medias +namespace Volo.CmsKit.MediaDescriptors { public interface IMediaDescriptorRepository : IBasicRepository { diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/InvalidMediaDescriptorNameException.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/InvalidMediaDescriptorNameException.cs similarity index 93% rename from modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/InvalidMediaDescriptorNameException.cs rename to modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/InvalidMediaDescriptorNameException.cs index 376c221cd1..0634448fa2 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/InvalidMediaDescriptorNameException.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/InvalidMediaDescriptorNameException.cs @@ -3,7 +3,7 @@ using System.Runtime.Serialization; using JetBrains.Annotations; using Volo.Abp; -namespace Volo.CmsKit.Medias +namespace Volo.CmsKit.MediaDescriptors { [Serializable] public class InvalidMediaDescriptorNameException : BusinessException diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/MediaContainer.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaContainer.cs similarity index 76% rename from modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/MediaContainer.cs rename to modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaContainer.cs index d1bb7a76da..bbb4a41327 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/MediaContainer.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaContainer.cs @@ -1,6 +1,6 @@ using Volo.Abp.BlobStoring; -namespace Volo.CmsKit.Medias +namespace Volo.CmsKit.MediaDescriptors { [BlobContainerName("cms-kit-medias")] public class MediaContainer diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/MediaDescriptor.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs similarity index 79% rename from modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/MediaDescriptor.cs rename to modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs index 78bc42119d..5041e20c8a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Medias/MediaDescriptor.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs @@ -1,9 +1,10 @@ using System; +using Volo.Abp; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; -using Volo.CmsKit.Medias.Extensions; +using Volo.CmsKit.MediaDescriptors.Extensions; -namespace Volo.CmsKit.Medias +namespace Volo.CmsKit.MediaDescriptors { public class MediaDescriptor : FullAuditedAggregateRoot, IMultiTenant { @@ -23,7 +24,8 @@ namespace Volo.CmsKit.Medias public MediaDescriptor(Guid id, Guid? tenantId, string name, string mimeType, int size) : base(id) { TenantId = tenantId; - MimeType = mimeType; + + MimeType = Check.NotNullOrWhiteSpace(mimeType, nameof(name), MediaDescriptorConsts.MaxMimeTypeLength); Size = size; SetName(name); From 75e13d55bd4a7bc68cb01b61a887cfa1b1cc5213 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 8 Feb 2021 12:30:35 +0300 Subject: [PATCH 010/283] added media descriptor repositores and orm settings --- .../EntityFrameworkCore/CmsKitDbContext.cs | 2 ++ .../CmsKitDbContextModelCreatingExtensions.cs | 19 +++++++++++++++++++ .../CmsKitEntityFrameworkCoreModule.cs | 2 ++ .../EntityFrameworkCore/ICmsKitDbContext.cs | 2 ++ .../EfCoreMediaDescriptorRepository.cs | 14 ++++++++++++++ .../CmsKit/MongoDB/CmsKitMongoDbContext.cs | 3 +++ .../MongoDB/CmsKitMongoDbContextExtensions.cs | 6 ++++++ .../CmsKit/MongoDB/CmsKitMongoDbModule.cs | 3 +++ .../CmsKit/MongoDB/ICmsKitMongoDbContext.cs | 3 +++ .../MongoMediaDescriptorRepository.cs | 14 ++++++++++++++ 10 files changed, 68 insertions(+) create mode 100644 modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/MediaDescriptors/EfCoreMediaDescriptorRepository.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/MediaDescriptors/MongoMediaDescriptorRepository.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContext.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContext.cs index e7694574a9..17a5dc5c34 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContext.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContext.cs @@ -4,6 +4,7 @@ using Volo.Abp.EntityFrameworkCore; using Volo.CmsKit.Blogs; using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; +using Volo.CmsKit.MediaDescriptors; using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; @@ -25,6 +26,7 @@ namespace Volo.CmsKit.EntityFrameworkCore public DbSet Pages { get; set; } public DbSet Blogs { get; set; } public DbSet BlogPosts { get; set; } + public DbSet MediaDescriptors { get; set; } public CmsKitDbContext(DbContextOptions options) : base(options) diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs index 57d1f5511c..2bd81c7755 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs @@ -14,6 +14,7 @@ using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; using Volo.CmsKit.Tags; using Volo.CmsKit.Blogs; +using Volo.CmsKit.MediaDescriptors; namespace Volo.CmsKit.EntityFrameworkCore { @@ -221,6 +222,24 @@ namespace Volo.CmsKit.EntityFrameworkCore builder.Ignore(); builder.Ignore(); } + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "MediaDescriptors", options.Schema); + + b.ConfigureByConvention(); + + b.Property(x => x.Name).IsRequired().HasMaxLength(MediaDescriptorConsts.MaxNameLength); + b.Property(x => x.MimeType).IsRequired().HasMaxLength(MediaDescriptorConsts.MaxMimeTypeLength); + b.Property(x => x.Size).HasMaxLength(MediaDescriptorConsts.MaxSizeLength); + }); + } + else + { + builder.Ignore(); + } } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitEntityFrameworkCoreModule.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitEntityFrameworkCoreModule.cs index 61cd667aed..e67a4f2d1b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitEntityFrameworkCoreModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitEntityFrameworkCoreModule.cs @@ -5,6 +5,7 @@ using Volo.Abp.Users.EntityFrameworkCore; using Volo.CmsKit.Blogs; using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; +using Volo.CmsKit.MediaDescriptors; using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; @@ -34,6 +35,7 @@ namespace Volo.CmsKit.EntityFrameworkCore options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); }); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/ICmsKitDbContext.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/ICmsKitDbContext.cs index feb1a5aacd..42b0a5da89 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/ICmsKitDbContext.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/ICmsKitDbContext.cs @@ -4,6 +4,7 @@ using Volo.Abp.EntityFrameworkCore; using Volo.CmsKit.Blogs; using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; +using Volo.CmsKit.MediaDescriptors; using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; @@ -25,5 +26,6 @@ namespace Volo.CmsKit.EntityFrameworkCore DbSet Pages { get; set; } DbSet Blogs { get; set; } DbSet BlogPosts { get; set; } + DbSet MediaDescriptors { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/MediaDescriptors/EfCoreMediaDescriptorRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/MediaDescriptors/EfCoreMediaDescriptorRepository.cs new file mode 100644 index 0000000000..083664e423 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/MediaDescriptors/EfCoreMediaDescriptorRepository.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.MediaDescriptors +{ + public class EfCoreMediaDescriptorRepository : EfCoreRepository, IMediaDescriptorRepository + { + public EfCoreMediaDescriptorRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContext.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContext.cs index b61ad967cd..a62ed224df 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContext.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContext.cs @@ -4,6 +4,7 @@ using Volo.Abp.MongoDB; using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; using Volo.CmsKit.Blogs; +using Volo.CmsKit.MediaDescriptors; using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; @@ -35,6 +36,8 @@ namespace Volo.CmsKit.MongoDB public IMongoCollection Blogs => Collection(); public IMongoCollection BlogPosts => Collection(); + + public IMongoCollection MediaDescriptors => Collection(); protected override void CreateModel(IMongoModelBuilder modelBuilder) { diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContextExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContextExtensions.cs index 46eecd1077..f4e46a38fa 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContextExtensions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContextExtensions.cs @@ -4,6 +4,7 @@ using Volo.Abp.MongoDB; using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; using Volo.CmsKit.Blogs; +using Volo.CmsKit.MediaDescriptors; using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; @@ -75,6 +76,11 @@ namespace Volo.CmsKit.MongoDB { x.CollectionName = CmsKitDbProperties.DbTablePrefix + "BlogPosts"; }); + + builder.Entity(x => + { + x.CollectionName = CmsKitDbProperties.DbTablePrefix + "MediaDescriptors"; + }); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbModule.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbModule.cs index b5ef74ac34..11e3a0eb86 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbModule.cs @@ -5,9 +5,11 @@ using Volo.Abp.Users.MongoDB; using Volo.CmsKit.Blogs; using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; +using Volo.CmsKit.MediaDescriptors; using Volo.CmsKit.MongoDB.Blogs; using Volo.CmsKit.MongoDB.Comments; using Volo.CmsKit.MongoDB.Contents; +using Volo.CmsKit.MongoDB.MediaDescriptors; using Volo.CmsKit.MongoDB.Pages; using Volo.CmsKit.MongoDB.Ratings; using Volo.CmsKit.MongoDB.Reactions; @@ -42,6 +44,7 @@ namespace Volo.CmsKit.MongoDB options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); }); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/ICmsKitMongoDbContext.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/ICmsKitMongoDbContext.cs index cc0faf912f..f3cf7064f8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/ICmsKitMongoDbContext.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/ICmsKitMongoDbContext.cs @@ -4,6 +4,7 @@ using Volo.Abp.MongoDB; using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; using Volo.CmsKit.Blogs; +using Volo.CmsKit.MediaDescriptors; using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; @@ -35,5 +36,7 @@ namespace Volo.CmsKit.MongoDB IMongoCollection Blogs { get; } IMongoCollection BlogPosts { get; } + + IMongoCollection MediaDescriptors { get; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/MediaDescriptors/MongoMediaDescriptorRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/MediaDescriptors/MongoMediaDescriptorRepository.cs new file mode 100644 index 0000000000..0d656eb0dd --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/MediaDescriptors/MongoMediaDescriptorRepository.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Repositories.MongoDB; +using Volo.Abp.MongoDB; +using Volo.CmsKit.MediaDescriptors; + +namespace Volo.CmsKit.MongoDB.MediaDescriptors +{ + public class MongoMediaDescriptorRepository : MongoDbRepository, IMediaDescriptorRepository + { + public MongoMediaDescriptorRepository(IMongoDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} \ No newline at end of file From 8db77d3567b269439cc36f56f332c2e73ad12a5e Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 8 Feb 2021 13:23:25 +0300 Subject: [PATCH 011/283] update media descriptor size parameter type --- .../Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs index 5041e20c8a..f1b2dafa90 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs @@ -14,14 +14,14 @@ namespace Volo.CmsKit.MediaDescriptors public string MimeType { get; set; } - public int Size { get; protected set; } + public long Size { get; protected set; } protected MediaDescriptor() { } - public MediaDescriptor(Guid id, Guid? tenantId, string name, string mimeType, int size) : base(id) + public MediaDescriptor(Guid id, Guid? tenantId, string name, string mimeType, long size) : base(id) { TenantId = tenantId; From 12211458f82dbc9ddb507a5c9e4af5764850f43e Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 8 Feb 2021 14:13:51 +0300 Subject: [PATCH 012/283] Added admin app service --- .../MediaDescriptors/GetMediaRequestDto.cs | 7 ++ .../IMediaDescriptorAdminAppService.cs | 19 +++++ .../MediaDescriptors/MediaDescriptorDto.cs | 14 ++++ .../MediaDescriptorGetListDto.cs | 14 ++++ .../MediaDescriptorGetListInput.cs | 9 +++ .../UpdateMediaDescriptorDto.cs | 13 +++ .../UploadMediaStreamContent.cs | 23 ++++++ ...CmsKitAdminApplicationAutoMapperProfile.cs | 5 ++ .../MediaDescriptorAdminAppService.cs | 80 +++++++++++++++++++ .../MediaDescriptorAdminController.cs | 64 +++++++++++++++ 10 files changed, 248 insertions(+) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/GetMediaRequestDto.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/IMediaDescriptorAdminAppService.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorDto.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListDto.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListInput.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UpdateMediaDescriptorDto.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UploadMediaStreamContent.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/GetMediaRequestDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/GetMediaRequestDto.cs new file mode 100644 index 0000000000..1311b306bb --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/GetMediaRequestDto.cs @@ -0,0 +1,7 @@ +namespace Volo.CmsKit.Admin.MediaDescriptors +{ + public class GetMediaRequestDto + { + public bool Download { get; set; } = false; + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/IMediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/IMediaDescriptorAdminAppService.cs new file mode 100644 index 0000000000..2fb86ba7f5 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/IMediaDescriptorAdminAppService.cs @@ -0,0 +1,19 @@ +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Volo.Abp.Content; + +namespace Volo.CmsKit.Admin.MediaDescriptors +{ + public interface IMediaDescriptorAdminAppService + : ICrudAppService< + MediaDescriptorDto, + MediaDescriptorGetListDto, + Guid, + MediaDescriptorGetListInput, + UploadMediaStreamContent, + UpdateMediaDescriptorDto> + { + Task DownloadAsync(Guid id, GetMediaRequestDto request); + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorDto.cs new file mode 100644 index 0000000000..d82eb63992 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorDto.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace Volo.CmsKit.Admin.MediaDescriptors +{ + public class MediaDescriptorDto : EntityDto + { + public string Name { get; set; } + + public string MimeType { get; set; } + + public int Size { get; set; } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListDto.cs new file mode 100644 index 0000000000..2be684d894 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListDto.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace Volo.CmsKit.Admin.MediaDescriptors +{ + public class MediaDescriptorGetListDto : EntityDto + { + public string Name { get; set; } + + public string MimeType { get; set; } + + public int Size { get; set; } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListInput.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListInput.cs new file mode 100644 index 0000000000..6d8316a749 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListInput.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Application.Dtos; + +namespace Volo.CmsKit.Admin.MediaDescriptors +{ + public class MediaDescriptorGetListInput : PagedAndSortedResultRequestDto + { + + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UpdateMediaDescriptorDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UpdateMediaDescriptorDto.cs new file mode 100644 index 0000000000..ba3e60ba50 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UpdateMediaDescriptorDto.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; +using Volo.CmsKit.MediaDescriptors; + +namespace Volo.CmsKit.Admin.MediaDescriptors +{ + public class UpdateMediaDescriptorDto + { + [Required] + [DynamicStringLength(typeof(MediaDescriptorConsts), nameof(MediaDescriptorConsts.MaxNameLength))] + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UploadMediaStreamContent.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UploadMediaStreamContent.cs new file mode 100644 index 0000000000..b6dcb1323d --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UploadMediaStreamContent.cs @@ -0,0 +1,23 @@ +using System.ComponentModel.DataAnnotations; +using System.IO; +using Volo.Abp.Content; +using Volo.Abp.Validation; +using Volo.CmsKit.MediaDescriptors; + +namespace Volo.CmsKit.Admin.MediaDescriptors +{ + public class UploadMediaStreamContent : RemoteStreamContent + { + [Required] + [DynamicStringLength(typeof(MediaDescriptorConsts), nameof(MediaDescriptorConsts.MaxNameLength))] + public string Name { get; set; } + + [Required] + [DynamicStringLength(typeof(MediaDescriptorConsts), nameof(MediaDescriptorConsts.MaxMimeTypeLength))] + public string MimeType { get; set; } + + public UploadMediaStreamContent(Stream stream) : base(stream) + { + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs index 8fc2567093..7d23bbbae5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs @@ -1,10 +1,12 @@ using AutoMapper; using Volo.CmsKit.Admin.Blogs; using Volo.CmsKit.Admin.Contents; +using Volo.CmsKit.Admin.MediaDescriptors; using Volo.CmsKit.Admin.Pages; using Volo.CmsKit.Blogs; using Volo.CmsKit.Admin.Tags; using Volo.CmsKit.Contents; +using Volo.CmsKit.MediaDescriptors; using Volo.CmsKit.Pages; using Volo.CmsKit.Tags; @@ -30,6 +32,9 @@ namespace Volo.CmsKit.Admin CreateMap(MemberList.Destination); CreateMap(MemberList.Destination); + + CreateMap(); + CreateMap(); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs new file mode 100644 index 0000000000..84c8a9a993 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Volo.Abp.Application.Dtos; +using Volo.Abp.BlobStoring; +using Volo.Abp.Content; +using Volo.CmsKit.MediaDescriptors; + +namespace Volo.CmsKit.Admin.MediaDescriptors +{ + [Authorize] + public class MediaDescriptorAdminAppService : CmsKitAdminAppServiceBase, IMediaDescriptorAdminAppService + { + protected readonly IBlobContainer MediaContainer; + protected readonly IMediaDescriptorRepository MediaDescriptorRepository; + + public MediaDescriptorAdminAppService(IBlobContainer mediaContainer, IMediaDescriptorRepository mediaDescriptorRepository) + { + MediaContainer = mediaContainer; + MediaDescriptorRepository = mediaDescriptorRepository; + } + + public virtual async Task GetAsync(Guid id) + { + var entity = await MediaDescriptorRepository.GetAsync(id); + + return ObjectMapper.Map(entity); + } + + public virtual async Task> GetListAsync(MediaDescriptorGetListInput input) + { + var totalCount = await MediaDescriptorRepository.GetCountAsync(); + var entites = await MediaDescriptorRepository.GetListAsync(); + + var dtos = ObjectMapper.Map, List>(entites); + + return new PagedResultDto(totalCount, dtos); + } + + public virtual async Task CreateAsync(UploadMediaStreamContent input) + { + var newId = GuidGenerator.Create(); + var newEntity = new MediaDescriptor(newId, CurrentTenant.Id, input.Name, input.MimeType, input.ContentLength ?? 0); + + await MediaDescriptorRepository.InsertAsync(newEntity); + await MediaContainer.SaveAsync(newId.ToString(), input.GetStream()); + + return ObjectMapper.Map(newEntity); + } + + public virtual async Task UpdateAsync(Guid id, UpdateMediaDescriptorDto input) + { + var entity = await MediaDescriptorRepository.GetAsync(id); + + entity.SetName(input.Name); + + await MediaDescriptorRepository.UpdateAsync(entity); + + return ObjectMapper.Map(entity); + } + + public virtual async Task DeleteAsync(Guid id) + { + await MediaContainer.DeleteAsync(id.ToString()); + await MediaDescriptorRepository.DeleteAsync(id); + } + + public virtual async Task DownloadAsync(Guid id, GetMediaRequestDto request) + { + var entity = await MediaDescriptorRepository.GetAsync(id); + var stream = await MediaContainer.GetAsync(id.ToString()); + + return new RemoteStreamContent(stream) + { + ContentType = entity.MimeType + }; + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs new file mode 100644 index 0000000000..ce4325978d --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs @@ -0,0 +1,64 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Content; +using Volo.Abp.GlobalFeatures; +using Volo.CmsKit.GlobalFeatures; + +namespace Volo.CmsKit.Admin.MediaDescriptors +{ + [RequiresGlobalFeature(typeof(MediasFeature))] + [RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] + [Area("cms-kit")] + [Route("api/cms-kit-admin/medias")] + public class MediaDescriptorAdminController : CmsKitAdminController, IMediaDescriptorAdminAppService + { + protected readonly IMediaDescriptorAdminAppService MediaDescriptorAdminAppService; + + public MediaDescriptorAdminController(IMediaDescriptorAdminAppService mediaDescriptorAdminAppService) + { + MediaDescriptorAdminAppService = mediaDescriptorAdminAppService; + } + + [HttpGet] + [Route("{id}")] + public virtual Task GetAsync(Guid id) + { + return MediaDescriptorAdminAppService.GetAsync(id); + } + + [HttpGet] + public virtual Task> GetListAsync(MediaDescriptorGetListInput input) + { + return MediaDescriptorAdminAppService.GetListAsync(input); + } + + [HttpPost] + public virtual Task CreateAsync(UploadMediaStreamContent input) + { + return MediaDescriptorAdminAppService.CreateAsync(input); + } + + [HttpPut] + [Route("{id}")] + public virtual Task UpdateAsync(Guid id, UpdateMediaDescriptorDto input) + { + return MediaDescriptorAdminAppService.UpdateAsync(id, input); + } + + [HttpDelete] + public virtual Task DeleteAsync(Guid id) + { + return MediaDescriptorAdminAppService.DeleteAsync(id); + } + + [HttpGet] + [Route("download/{id}")] + public virtual Task DownloadAsync(Guid id, GetMediaRequestDto request) + { + return MediaDescriptorAdminAppService.DownloadAsync(id, request); + } + } +} \ No newline at end of file From 21bc0bdc1171f9aca8e257693ca8bce9a215b202 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 9 Feb 2021 17:54:03 +0800 Subject: [PATCH 013/283] Add AddDefaultRepository method --- .../AbpCommonDbContextRegistrationOptions.cs | 22 +++++++- ...mmonDbContextRegistrationOptionsBuilder.cs | 14 +++++ .../Repositories/RepositoryRegistrarBase.cs | 16 +++++- .../RepositoryRegistration_Tests.cs | 54 +++++++++++++++++++ 4 files changed, 103 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/AbpCommonDbContextRegistrationOptions.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/AbpCommonDbContextRegistrationOptions.cs index dbd46811f2..babe1da1f9 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/AbpCommonDbContextRegistrationOptions.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/AbpCommonDbContextRegistrationOptions.cs @@ -29,6 +29,8 @@ namespace Volo.Abp.DependencyInjection public Dictionary CustomRepositories { get; } + public List DefaultRepositories { get; } + public bool SpecifiedDefaultRepositoryTypes => DefaultRepositoryImplementationType != null && DefaultRepositoryImplementationTypeWithoutKey != null; protected AbpCommonDbContextRegistrationOptions(Type originalDbContextType, IServiceCollection services) @@ -38,6 +40,7 @@ namespace Volo.Abp.DependencyInjection DefaultRepositoryDbContextType = originalDbContextType; CustomRepositories = new Dictionary(); ReplacedDbContextTypes = new List(); + DefaultRepositories = new List(); } public IAbpCommonDbContextRegistrationOptionsBuilder ReplaceDbContext() @@ -82,6 +85,23 @@ namespace Volo.Abp.DependencyInjection return AddDefaultRepositories(typeof(TDefaultRepositoryDbContext), includeAllEntities); } + public IAbpCommonDbContextRegistrationOptionsBuilder AddDefaultRepository() + { + return AddDefaultRepository(typeof(TEntity)); + } + + public IAbpCommonDbContextRegistrationOptionsBuilder AddDefaultRepository(Type entityType) + { + if (!typeof(IEntity).IsAssignableFrom(entityType)) + { + throw new AbpException($"Given entityType is not an entity: {entityType.AssemblyQualifiedName}. It must implement {typeof(IEntity<>).AssemblyQualifiedName}."); + } + + DefaultRepositories.AddIfNotContains(entityType); + + return this; + } + public IAbpCommonDbContextRegistrationOptionsBuilder AddRepository() { AddCustomRepository(typeof(TEntity), typeof(TRepository)); @@ -118,4 +138,4 @@ namespace Volo.Abp.DependencyInjection CustomRepositories[entityType] = repositoryType; } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/IAbpCommonDbContextRegistrationOptionsBuilder.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/IAbpCommonDbContextRegistrationOptionsBuilder.cs index 53d2f142cd..ebe49718b2 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/IAbpCommonDbContextRegistrationOptionsBuilder.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/IAbpCommonDbContextRegistrationOptionsBuilder.cs @@ -39,6 +39,20 @@ namespace Volo.Abp.DependencyInjection /// IAbpCommonDbContextRegistrationOptionsBuilder AddDefaultRepositories(Type defaultRepositoryDbContextType, bool includeAllEntities = false); + /// + /// Registers custom repository for a specific entity. + /// + /// Entity type + IAbpCommonDbContextRegistrationOptionsBuilder AddDefaultRepository(); + + + /// + /// Registers default repository for a specific entity. + /// + /// + /// + IAbpCommonDbContextRegistrationOptionsBuilder AddDefaultRepository(Type entityType); + /// /// Registers custom repository for a specific entity. /// Custom repositories overrides default repositories. diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryRegistrarBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryRegistrarBase.cs index f3b2fc388f..35129134c3 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryRegistrarBase.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryRegistrarBase.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities; @@ -27,6 +28,12 @@ namespace Volo.Abp.Domain.Repositories { RegisterDefaultRepositories(); } + + foreach (var entityType in Options.DefaultRepositories) + { + ShouldRegisterDefaultRepositoryFor(entityType); + RegisterDefaultRepository(entityType); + } } protected virtual void RegisterDefaultRepositories() @@ -68,7 +75,7 @@ namespace Volo.Abp.Domain.Repositories protected virtual bool ShouldRegisterDefaultRepositoryFor(Type entityType) { - if (!Options.RegisterDefaultRepositories) + if (!Options.RegisterDefaultRepositories && !Options.DefaultRepositories.Any()) { return false; } @@ -78,6 +85,11 @@ namespace Volo.Abp.Domain.Repositories return false; } + if (Options.DefaultRepositories.Contains(entityType)) + { + return true; + } + if (!Options.IncludeAllEntitiesForDefaultRepositories && !typeof(IAggregateRoot).IsAssignableFrom(entityType)) { return false; @@ -92,4 +104,4 @@ namespace Volo.Abp.Domain.Repositories protected abstract Type GetRepositoryType(Type dbContextType, Type entityType, Type primaryKeyType); } -} \ No newline at end of file +} diff --git a/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs b/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs index 85696fae21..32584f293e 100644 --- a/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs +++ b/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs @@ -189,6 +189,60 @@ namespace Volo.Abp.Domain.Repositories services.ShouldContainTransient(typeof(IRepository), typeof(MyTestCustomBaseRepository)); } + [Fact] + public void Should_Register_Default_Repository() + { + //Arrange + + var services = new ServiceCollection(); + + var options = new TestDbContextRegistrationOptions(typeof(MyFakeDbContext), services); + options.AddDefaultRepository(); + + //Act + + new MyTestRepositoryRegistrar(options).AddRepositories(); + + //MyTestAggregateRootWithoutPk + services.ShouldNotContainService(typeof(IReadOnlyRepository)); + services.ShouldNotContainService(typeof(IBasicRepository)); + services.ShouldNotContainService(typeof(IRepository)); + + //MyTestAggregateRootWithGuidPk + services.ShouldContainTransient(typeof(IReadOnlyRepository), typeof(MyTestDefaultRepository)); + services.ShouldContainTransient(typeof(IBasicRepository), typeof(MyTestDefaultRepository)); + services.ShouldContainTransient(typeof(IRepository), typeof(MyTestDefaultRepository)); + services.ShouldContainTransient(typeof(IReadOnlyRepository), typeof(MyTestDefaultRepository)); + services.ShouldContainTransient(typeof(IBasicRepository), typeof(MyTestDefaultRepository)); + services.ShouldContainTransient(typeof(IRepository), typeof(MyTestDefaultRepository)); + } + + [Fact] + public void Should_Not_Register_Default_Repository_If_Registered_Custom_Repository() + { + //Arrange + + var services = new ServiceCollection(); + + var options = new TestDbContextRegistrationOptions(typeof(MyFakeDbContext), services); + options + .AddDefaultRepository() + .AddRepository();; + + //Act + + new MyTestRepositoryRegistrar(options).AddRepositories(); + + //MyTestAggregateRootWithGuidPk + services.ShouldContainTransient(typeof(IReadOnlyRepository), typeof(MyTestAggregateRootWithDefaultPkCustomRepository)); + services.ShouldContainTransient(typeof(IBasicRepository), typeof(MyTestAggregateRootWithDefaultPkCustomRepository)); + services.ShouldContainTransient(typeof(IRepository), typeof(MyTestAggregateRootWithDefaultPkCustomRepository)); + services.ShouldContainTransient(typeof(IReadOnlyRepository), typeof(MyTestAggregateRootWithDefaultPkCustomRepository)); + services.ShouldContainTransient(typeof(IReadOnlyBasicRepository), typeof(MyTestAggregateRootWithDefaultPkCustomRepository)); + services.ShouldContainTransient(typeof(IBasicRepository), typeof(MyTestAggregateRootWithDefaultPkCustomRepository)); + services.ShouldContainTransient(typeof(IRepository), typeof(MyTestAggregateRootWithDefaultPkCustomRepository)); + } + public class MyTestRepositoryRegistrar : RepositoryRegistrarBase { public MyTestRepositoryRegistrar(AbpCommonDbContextRegistrationOptions options) From 3b6a0ee16c05ff728575be2e0979395e03bbc68b Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 9 Feb 2021 18:02:51 +0800 Subject: [PATCH 014/283] Update RepositoryRegistrarBase --- .../Repositories/RepositoryRegistrarBase.cs | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryRegistrarBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryRegistrarBase.cs index 35129134c3..bf0be45bb6 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryRegistrarBase.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryRegistrarBase.cs @@ -18,34 +18,48 @@ namespace Volo.Abp.Domain.Repositories } public virtual void AddRepositories() + { + RegisterCustomRepositories(); + + RegisterDefaultRepositories(); + + RegisterSpecifiedDefaultRepositories(); + } + + protected virtual void RegisterCustomRepositories() { foreach (var customRepository in Options.CustomRepositories) { Options.Services.AddDefaultRepository(customRepository.Key, customRepository.Value); } + } - if (Options.RegisterDefaultRepositories) + protected virtual void RegisterDefaultRepositories() + { + if (!Options.RegisterDefaultRepositories) { - RegisterDefaultRepositories(); + return; } - foreach (var entityType in Options.DefaultRepositories) + foreach (var entityType in GetEntityTypes(Options.OriginalDbContextType)) { - ShouldRegisterDefaultRepositoryFor(entityType); + if (!ShouldRegisterDefaultRepositoryFor(entityType)) + { + continue; + } + RegisterDefaultRepository(entityType); } } - protected virtual void RegisterDefaultRepositories() + protected virtual void RegisterSpecifiedDefaultRepositories() { - foreach (var entityType in GetEntityTypes(Options.OriginalDbContextType)) + foreach (var entityType in Options.DefaultRepositories) { - if (!ShouldRegisterDefaultRepositoryFor(entityType)) + if (!Options.CustomRepositories.ContainsKey(entityType)) { - continue; + RegisterDefaultRepository(entityType); } - - RegisterDefaultRepository(entityType); } } @@ -75,7 +89,7 @@ namespace Volo.Abp.Domain.Repositories protected virtual bool ShouldRegisterDefaultRepositoryFor(Type entityType) { - if (!Options.RegisterDefaultRepositories && !Options.DefaultRepositories.Any()) + if (!Options.RegisterDefaultRepositories) { return false; } @@ -85,11 +99,6 @@ namespace Volo.Abp.Domain.Repositories return false; } - if (Options.DefaultRepositories.Contains(entityType)) - { - return true; - } - if (!Options.IncludeAllEntitiesForDefaultRepositories && !typeof(IAggregateRoot).IsAssignableFrom(entityType)) { return false; From 82d554d0d527755634429b715243f3e03ff85624 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 10 Feb 2021 11:04:32 +0300 Subject: [PATCH 015/283] refactoring --- .../CmsKitWebUnifiedModule.cs | 6 ++- .../Volo.CmsKit.Web.Unified.csproj | 1 + ...treamContent.cs => CreateMediaInputDto.cs} | 8 +-- .../IMediaDescriptorAdminAppService.cs | 13 ++--- .../MediaDescriptorAdminAppService.cs | 37 ++------------ .../MediaDescriptorAdminController.cs | 50 ++++++++++--------- 6 files changed, 42 insertions(+), 73 deletions(-) rename modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/{UploadMediaStreamContent.cs => CreateMediaInputDto.cs} (56%) diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs index b9f562bf98..3f36f7343e 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs @@ -31,6 +31,7 @@ using Volo.Abp.PermissionManagement; using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.PermissionManagement.Identity; using Volo.Abp.SettingManagement.EntityFrameworkCore; +using Volo.Abp.Swashbuckle; using Volo.Abp.TenantManagement; using Volo.Abp.TenantManagement.EntityFrameworkCore; using Volo.Abp.TenantManagement.Web; @@ -65,7 +66,8 @@ namespace Volo.CmsKit typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule), typeof(AbpAspNetCoreSerilogModule), - typeof(BlobStoringDatabaseEntityFrameworkCoreModule) + typeof(BlobStoringDatabaseEntityFrameworkCoreModule), + typeof(AbpSwashbuckleModule) )] public class CmsKitWebUnifiedModule : AbpModule { @@ -158,7 +160,7 @@ namespace Volo.CmsKit app.UseAuthorization(); app.UseSwagger(); - app.UseSwaggerUI(options => + app.UseAbpSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API"); }); diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj index 1dbafb4ad6..f13af43d96 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj @@ -16,6 +16,7 @@ + diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UploadMediaStreamContent.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/CreateMediaInputDto.cs similarity index 56% rename from modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UploadMediaStreamContent.cs rename to modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/CreateMediaInputDto.cs index b6dcb1323d..b61d50e124 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UploadMediaStreamContent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/CreateMediaInputDto.cs @@ -6,17 +6,13 @@ using Volo.CmsKit.MediaDescriptors; namespace Volo.CmsKit.Admin.MediaDescriptors { - public class UploadMediaStreamContent : RemoteStreamContent + public class CreateMediaInputStream : RemoteStreamContent { [Required] [DynamicStringLength(typeof(MediaDescriptorConsts), nameof(MediaDescriptorConsts.MaxNameLength))] public string Name { get; set; } - [Required] - [DynamicStringLength(typeof(MediaDescriptorConsts), nameof(MediaDescriptorConsts.MaxMimeTypeLength))] - public string MimeType { get; set; } - - public UploadMediaStreamContent(Stream stream) : base(stream) + public CreateMediaInputStream(Stream stream) : base(stream) { } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/IMediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/IMediaDescriptorAdminAppService.cs index 2fb86ba7f5..e56cb6d630 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/IMediaDescriptorAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/IMediaDescriptorAdminAppService.cs @@ -5,15 +5,12 @@ using Volo.Abp.Content; namespace Volo.CmsKit.Admin.MediaDescriptors { - public interface IMediaDescriptorAdminAppService - : ICrudAppService< - MediaDescriptorDto, - MediaDescriptorGetListDto, - Guid, - MediaDescriptorGetListInput, - UploadMediaStreamContent, - UpdateMediaDescriptorDto> + public interface IMediaDescriptorAdminAppService : IApplicationService { + Task CreateAsync(CreateMediaInputStream inputStream); + Task DownloadAsync(Guid id, GetMediaRequestDto request); + + Task DeleteAsync(Guid id); } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs index 84c8a9a993..d2f5865926 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs @@ -1,8 +1,6 @@ using System; -using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; -using Volo.Abp.Application.Dtos; using Volo.Abp.BlobStoring; using Volo.Abp.Content; using Volo.CmsKit.MediaDescriptors; @@ -21,45 +19,18 @@ namespace Volo.CmsKit.Admin.MediaDescriptors MediaDescriptorRepository = mediaDescriptorRepository; } - public virtual async Task GetAsync(Guid id) - { - var entity = await MediaDescriptorRepository.GetAsync(id); - - return ObjectMapper.Map(entity); - } - - public virtual async Task> GetListAsync(MediaDescriptorGetListInput input) - { - var totalCount = await MediaDescriptorRepository.GetCountAsync(); - var entites = await MediaDescriptorRepository.GetListAsync(); - - var dtos = ObjectMapper.Map, List>(entites); - - return new PagedResultDto(totalCount, dtos); - } - - public virtual async Task CreateAsync(UploadMediaStreamContent input) + public virtual async Task CreateAsync(CreateMediaInputStream inputStream) { var newId = GuidGenerator.Create(); - var newEntity = new MediaDescriptor(newId, CurrentTenant.Id, input.Name, input.MimeType, input.ContentLength ?? 0); + var stream = inputStream.GetStream(); + var newEntity = new MediaDescriptor(newId, CurrentTenant.Id, inputStream.Name, inputStream.ContentType, stream.Length); await MediaDescriptorRepository.InsertAsync(newEntity); - await MediaContainer.SaveAsync(newId.ToString(), input.GetStream()); + await MediaContainer.SaveAsync(newId.ToString(), stream); return ObjectMapper.Map(newEntity); } - public virtual async Task UpdateAsync(Guid id, UpdateMediaDescriptorDto input) - { - var entity = await MediaDescriptorRepository.GetAsync(id); - - entity.SetName(input.Name); - - await MediaDescriptorRepository.UpdateAsync(entity); - - return ObjectMapper.Map(entity); - } - public virtual async Task DeleteAsync(Guid id) { await MediaContainer.DeleteAsync(id.ToString()); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs index ce4325978d..c310ffbe67 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs @@ -1,5 +1,6 @@ using System; using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Volo.Abp; using Volo.Abp.Application.Dtos; @@ -12,7 +13,7 @@ namespace Volo.CmsKit.Admin.MediaDescriptors [RequiresGlobalFeature(typeof(MediasFeature))] [RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] [Area("cms-kit")] - [Route("api/cms-kit-admin/medias")] + [Route("api/cms-kit-admin/media")] public class MediaDescriptorAdminController : CmsKitAdminController, IMediaDescriptorAdminAppService { protected readonly IMediaDescriptorAdminAppService MediaDescriptorAdminAppService; @@ -22,43 +23,44 @@ namespace Volo.CmsKit.Admin.MediaDescriptors MediaDescriptorAdminAppService = mediaDescriptorAdminAppService; } - [HttpGet] - [Route("{id}")] - public virtual Task GetAsync(Guid id) - { - return MediaDescriptorAdminAppService.GetAsync(id); - } - - [HttpGet] - public virtual Task> GetListAsync(MediaDescriptorGetListInput input) - { - return MediaDescriptorAdminAppService.GetListAsync(input); - } - [HttpPost] - public virtual Task CreateAsync(UploadMediaStreamContent input) - { - return MediaDescriptorAdminAppService.CreateAsync(input); - } - - [HttpPut] - [Route("{id}")] - public virtual Task UpdateAsync(Guid id, UpdateMediaDescriptorDto input) + [NonAction] + public virtual Task CreateAsync(CreateMediaInputStream inputStream) { - return MediaDescriptorAdminAppService.UpdateAsync(id, input); + return MediaDescriptorAdminAppService.CreateAsync(inputStream); } [HttpDelete] + [Route("{id}")] public virtual Task DeleteAsync(Guid id) { return MediaDescriptorAdminAppService.DeleteAsync(id); } [HttpGet] - [Route("download/{id}")] + [Route("{id}")] public virtual Task DownloadAsync(Guid id, GetMediaRequestDto request) { return MediaDescriptorAdminAppService.DownloadAsync(id, request); } + + [HttpPost] + public virtual async Task UploadAsync(IFormFile file) + { + if (file == null) + { + return BadRequest(); + } + + var inputStream = new CreateMediaInputStream(file.OpenReadStream()) + { + ContentType = file.ContentType, + Name = file.FileName + }; + + var mediaDescriptorDto = await MediaDescriptorAdminAppService.CreateAsync(inputStream); + + return StatusCode(201, mediaDescriptorDto); + } } } \ No newline at end of file From 859fda1bff7776319d4f6ff11e8d35c79a5b3950 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 10 Feb 2021 11:19:43 +0300 Subject: [PATCH 016/283] Added media descriptor admin permissions --- .../CmsKitAdminPermissionDefinitionProvider.cs | 7 +++++++ .../Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs | 7 +++++++ .../MediaDescriptors/MediaDescriptorAdminAppService.cs | 9 ++++++++- .../MediaDescriptors/MediaDescriptorAdminController.cs | 9 +++++++-- .../Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs | 4 ++-- .../GlobalFeatures/{MediasFeature.cs => MediaFeature.cs} | 4 ++-- .../CmsKitDbContextModelCreatingExtensions.cs | 2 +- 7 files changed, 34 insertions(+), 8 deletions(-) rename modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/{MediasFeature.cs => MediaFeature.cs} (79%) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs index 0303af762e..a5a30a60ef 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs @@ -48,6 +48,13 @@ namespace Volo.CmsKit.Permissions blogManagement.AddChild(CmsKitAdminPermissions.BlogPosts.Update, L("Permission:BlogPostManagement.Update")); blogManagement.AddChild(CmsKitAdminPermissions.BlogPosts.Delete, L("Permission:BlogPostManagement.Delete")); } + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + var mediaDescriptorManagement = cmsGroup.AddPermission(CmsKitAdminPermissions.MediaDescriptors.Default, L("Permission:MediaDescriptorManagement")); + mediaDescriptorManagement.AddChild(CmsKitAdminPermissions.MediaDescriptors.Create, L("Permission:MediaDescriptorManagement:Create")); + mediaDescriptorManagement.AddChild(CmsKitAdminPermissions.MediaDescriptors.Delete, L("Permission:MediaDescriptorManagement:Delete")); + } } private static LocalizableString L(string name) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs index 38c95ed83d..4c106d4d3c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs @@ -45,5 +45,12 @@ namespace Volo.CmsKit.Permissions public const string Update = Default + ".Update"; public const string Delete = Default + ".Delete"; } + + public static class MediaDescriptors + { + public const string Default = GroupName + ".MediaDescriptors"; + public const string Create = Default + ".Create"; + public const string Delete = Default + ".Delete"; + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs index d2f5865926..4bdcc3b472 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs @@ -3,11 +3,15 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Volo.Abp.BlobStoring; using Volo.Abp.Content; +using Volo.Abp.GlobalFeatures; +using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.MediaDescriptors; +using Volo.CmsKit.Permissions; namespace Volo.CmsKit.Admin.MediaDescriptors { - [Authorize] + [RequiresGlobalFeature(typeof(MediaFeature))] + [Authorize(CmsKitAdminPermissions.MediaDescriptors.Default)] public class MediaDescriptorAdminAppService : CmsKitAdminAppServiceBase, IMediaDescriptorAdminAppService { protected readonly IBlobContainer MediaContainer; @@ -19,6 +23,7 @@ namespace Volo.CmsKit.Admin.MediaDescriptors MediaDescriptorRepository = mediaDescriptorRepository; } + [Authorize(CmsKitAdminPermissions.MediaDescriptors.Create)] public virtual async Task CreateAsync(CreateMediaInputStream inputStream) { var newId = GuidGenerator.Create(); @@ -31,12 +36,14 @@ namespace Volo.CmsKit.Admin.MediaDescriptors return ObjectMapper.Map(newEntity); } + [Authorize(CmsKitAdminPermissions.MediaDescriptors.Delete)] public virtual async Task DeleteAsync(Guid id) { await MediaContainer.DeleteAsync(id.ToString()); await MediaDescriptorRepository.DeleteAsync(id); } + [AllowAnonymous] public virtual async Task DownloadAsync(Guid id, GetMediaRequestDto request) { var entity = await MediaDescriptorRepository.GetAsync(id); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs index c310ffbe67..e62dc66b13 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs @@ -1,17 +1,19 @@ using System; using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Volo.Abp; -using Volo.Abp.Application.Dtos; using Volo.Abp.Content; using Volo.Abp.GlobalFeatures; using Volo.CmsKit.GlobalFeatures; +using Volo.CmsKit.Permissions; namespace Volo.CmsKit.Admin.MediaDescriptors { - [RequiresGlobalFeature(typeof(MediasFeature))] + [RequiresGlobalFeature(typeof(MediaFeature))] [RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] + [Authorize(CmsKitAdminPermissions.MediaDescriptors.Default)] [Area("cms-kit")] [Route("api/cms-kit-admin/media")] public class MediaDescriptorAdminController : CmsKitAdminController, IMediaDescriptorAdminAppService @@ -32,6 +34,7 @@ namespace Volo.CmsKit.Admin.MediaDescriptors [HttpDelete] [Route("{id}")] + [Authorize(CmsKitAdminPermissions.MediaDescriptors.Delete)] public virtual Task DeleteAsync(Guid id) { return MediaDescriptorAdminAppService.DeleteAsync(id); @@ -39,12 +42,14 @@ namespace Volo.CmsKit.Admin.MediaDescriptors [HttpGet] [Route("{id}")] + [AllowAnonymous] public virtual Task DownloadAsync(Guid id, GetMediaRequestDto request) { return MediaDescriptorAdminAppService.DownloadAsync(id, request); } [HttpPost] + [Authorize(CmsKitAdminPermissions.MediaDescriptors.Create)] public virtual async Task UploadAsync(IFormFile file) { if (file == null) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs index 08eaf7a919..91c319f701 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs @@ -11,7 +11,7 @@ namespace Volo.CmsKit.GlobalFeatures public CommentsFeature Comments => GetFeature(); - public MediasFeature Medias => GetFeature(); + public MediaFeature Media => GetFeature(); public RatingsFeature Ratings => GetFeature(); @@ -25,7 +25,7 @@ namespace Volo.CmsKit.GlobalFeatures : base(featureManager) { AddFeature(new ReactionsFeature(this)); - AddFeature(new MediasFeature(this)); + AddFeature(new MediaFeature(this)); AddFeature(new CommentsFeature(this)); AddFeature(new RatingsFeature(this)); AddFeature(new TagsFeature(this)); diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/MediasFeature.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/MediaFeature.cs similarity index 79% rename from modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/MediasFeature.cs rename to modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/MediaFeature.cs index b39f3a10e3..d40cd829b9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/MediasFeature.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/MediaFeature.cs @@ -4,11 +4,11 @@ using Volo.Abp.GlobalFeatures; namespace Volo.CmsKit.GlobalFeatures { [GlobalFeatureName(Name)] - public class MediasFeature : GlobalFeature + public class MediaFeature : GlobalFeature { public const string Name = "CmsKit.Medias"; - internal MediasFeature( + internal MediaFeature( [NotNull] GlobalCmsKitFeatures cmsKit ) : base(cmsKit) { diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs index 1aa441f2f1..9f0ac813fc 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs @@ -223,7 +223,7 @@ namespace Volo.CmsKit.EntityFrameworkCore builder.Ignore(); } - if (GlobalFeatureManager.Instance.IsEnabled()) + if (GlobalFeatureManager.Instance.IsEnabled()) { builder.Entity(b => { From 8306dd74000e300e120c33ea65ac3624cd3a51b7 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 10 Feb 2021 11:44:29 +0300 Subject: [PATCH 017/283] Added common media app service --- .../IMediaDescriptorAdminAppService.cs | 3 -- .../MediaDescriptorAdminAppService.cs | 12 ------- .../MediaDescriptorAdminController.cs | 9 ----- .../IMediaDescriptorAppService.cs | 12 +++++++ .../MediaDescriptorAppService.cs | 33 +++++++++++++++++++ .../{Controllers => }/CmsKitControllerBase.cs | 2 +- .../MediaDescriptorController.cs | 31 +++++++++++++++++ .../Public/CmsKitPublicControllerBase.cs | 4 +-- .../Public/Contents/ContentController.cs | 1 - 9 files changed, 78 insertions(+), 29 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/MediaDescriptors/IMediaDescriptorAppService.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/MediaDescriptors/MediaDescriptorAppService.cs rename modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/{Controllers => }/CmsKitControllerBase.cs (88%) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/MediaDescriptors/MediaDescriptorController.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/IMediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/IMediaDescriptorAdminAppService.cs index e56cb6d630..eb4819dd06 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/IMediaDescriptorAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/IMediaDescriptorAdminAppService.cs @@ -1,7 +1,6 @@ using System; using System.Threading.Tasks; using Volo.Abp.Application.Services; -using Volo.Abp.Content; namespace Volo.CmsKit.Admin.MediaDescriptors { @@ -9,8 +8,6 @@ namespace Volo.CmsKit.Admin.MediaDescriptors { Task CreateAsync(CreateMediaInputStream inputStream); - Task DownloadAsync(Guid id, GetMediaRequestDto request); - Task DeleteAsync(Guid id); } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs index 4bdcc3b472..80029c3168 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs @@ -42,17 +42,5 @@ namespace Volo.CmsKit.Admin.MediaDescriptors await MediaContainer.DeleteAsync(id.ToString()); await MediaDescriptorRepository.DeleteAsync(id); } - - [AllowAnonymous] - public virtual async Task DownloadAsync(Guid id, GetMediaRequestDto request) - { - var entity = await MediaDescriptorRepository.GetAsync(id); - var stream = await MediaContainer.GetAsync(id.ToString()); - - return new RemoteStreamContent(stream) - { - ContentType = entity.MimeType - }; - } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs index e62dc66b13..d4ff6c6ea3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs @@ -4,7 +4,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Volo.Abp; -using Volo.Abp.Content; using Volo.Abp.GlobalFeatures; using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Permissions; @@ -40,14 +39,6 @@ namespace Volo.CmsKit.Admin.MediaDescriptors return MediaDescriptorAdminAppService.DeleteAsync(id); } - [HttpGet] - [Route("{id}")] - [AllowAnonymous] - public virtual Task DownloadAsync(Guid id, GetMediaRequestDto request) - { - return MediaDescriptorAdminAppService.DownloadAsync(id, request); - } - [HttpPost] [Authorize(CmsKitAdminPermissions.MediaDescriptors.Create)] public virtual async Task UploadAsync(IFormFile file) diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/MediaDescriptors/IMediaDescriptorAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/MediaDescriptors/IMediaDescriptorAppService.cs new file mode 100644 index 0000000000..b50103ef0c --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/MediaDescriptors/IMediaDescriptorAppService.cs @@ -0,0 +1,12 @@ +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Volo.Abp.Content; + +namespace Volo.CmsKit.MediaDescriptors +{ + public interface IMediaDescriptorAppService : IApplicationService + { + Task DownloadAsync(Guid id); + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/MediaDescriptors/MediaDescriptorAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/MediaDescriptors/MediaDescriptorAppService.cs new file mode 100644 index 0000000000..81879c5da9 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/MediaDescriptors/MediaDescriptorAppService.cs @@ -0,0 +1,33 @@ +using System; +using System.Threading.Tasks; +using Volo.Abp.BlobStoring; +using Volo.Abp.Content; +using Volo.Abp.GlobalFeatures; +using Volo.CmsKit.GlobalFeatures; + +namespace Volo.CmsKit.MediaDescriptors +{ + [RequiresGlobalFeature(typeof(MediaFeature))] + public class MediaDescriptorAppService : CmsKitAppServiceBase, IMediaDescriptorAppService + { + protected readonly IMediaDescriptorRepository MediaDescriptorRepository; + protected readonly IBlobContainer MediaContainer; + + public MediaDescriptorAppService(IMediaDescriptorRepository mediaDescriptorRepository, IBlobContainer mediaContainer) + { + MediaDescriptorRepository = mediaDescriptorRepository; + MediaContainer = mediaContainer; + } + + public virtual async Task DownloadAsync(Guid id) + { + var entity = await MediaDescriptorRepository.GetAsync(id); + var stream = await MediaContainer.GetAsync(id.ToString()); + + return new RemoteStreamContent(stream) + { + ContentType = entity.MimeType + }; + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/CmsKitControllerBase.cs b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/CmsKitControllerBase.cs similarity index 88% rename from modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/CmsKitControllerBase.cs rename to modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/CmsKitControllerBase.cs index 21a546195a..70a68c7611 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/CmsKitControllerBase.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/CmsKitControllerBase.cs @@ -1,7 +1,7 @@ using Volo.Abp.AspNetCore.Mvc; using Volo.CmsKit.Localization; -namespace Volo.CmsKit.Controllers +namespace Volo.CmsKit { public abstract class CmsKitControllerBase : AbpController { diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/MediaDescriptors/MediaDescriptorController.cs b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/MediaDescriptors/MediaDescriptorController.cs new file mode 100644 index 0000000000..ce091a2adb --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/MediaDescriptors/MediaDescriptorController.cs @@ -0,0 +1,31 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Content; +using Volo.Abp.GlobalFeatures; +using Volo.CmsKit.GlobalFeatures; + +namespace Volo.CmsKit.MediaDescriptors +{ + [RequiresGlobalFeature(typeof(MediaFeature))] + [RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] + [Area("cms-kit")] + [Route("api/cms-kit/media")] + public class MediaDescriptorController : CmsKitControllerBase, IMediaDescriptorAppService + { + protected readonly IMediaDescriptorAppService MediaDescriptorAppService; + + public MediaDescriptorController(IMediaDescriptorAppService mediaDescriptorAppService) + { + MediaDescriptorAppService = mediaDescriptorAppService; + } + + [HttpGet] + [Route("{id}")] + public virtual Task DownloadAsync(Guid id) + { + return MediaDescriptorAppService.DownloadAsync(id); + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/CmsKitPublicControllerBase.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/CmsKitPublicControllerBase.cs index 49aa98c134..af20a697bc 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/CmsKitPublicControllerBase.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/CmsKitPublicControllerBase.cs @@ -1,6 +1,4 @@ -using Volo.CmsKit.Controllers; - -namespace Volo.CmsKit.Public +namespace Volo.CmsKit.Public { public abstract class CmsKitPublicControllerBase : CmsKitControllerBase { diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Contents/ContentController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Contents/ContentController.cs index f18326a3d0..4a348fc7bf 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Contents/ContentController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Contents/ContentController.cs @@ -2,7 +2,6 @@ using Microsoft.AspNetCore.Mvc; using Volo.Abp; using Volo.CmsKit.Contents; -using Volo.CmsKit.Controllers; namespace Volo.CmsKit.Public.Contents { From d026abc4406c5400f6a2e2beb1a157d4905eaecc Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 10 Feb 2021 11:46:37 +0300 Subject: [PATCH 018/283] added missin authorization attribute --- .../Admin/MediaDescriptors/MediaDescriptorAdminController.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs index d4ff6c6ea3..a3b438e341 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs @@ -25,6 +25,7 @@ namespace Volo.CmsKit.Admin.MediaDescriptors } [HttpPost] + [Authorize(CmsKitAdminPermissions.MediaDescriptors.Create)] [NonAction] public virtual Task CreateAsync(CreateMediaInputStream inputStream) { From f5b181e973a0ac97348ade9dbbc8077140bed226 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 10 Feb 2021 11:47:15 +0300 Subject: [PATCH 019/283] remove unused namespace --- .../Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs index 80029c3168..597c038719 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs @@ -2,7 +2,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Volo.Abp.BlobStoring; -using Volo.Abp.Content; using Volo.Abp.GlobalFeatures; using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.MediaDescriptors; From 876b2b542d1ca4ece1b5e9423ab12b2c12f0c04a Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 10 Feb 2021 11:57:12 +0300 Subject: [PATCH 020/283] Update mediadescriptor constructor --- .../Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs | 2 +- .../Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs index 597c038719..c053a0b2e3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs @@ -27,7 +27,7 @@ namespace Volo.CmsKit.Admin.MediaDescriptors { var newId = GuidGenerator.Create(); var stream = inputStream.GetStream(); - var newEntity = new MediaDescriptor(newId, CurrentTenant.Id, inputStream.Name, inputStream.ContentType, stream.Length); + var newEntity = new MediaDescriptor(newId, inputStream.Name, inputStream.ContentType, stream.Length, CurrentTenant.Id); await MediaDescriptorRepository.InsertAsync(newEntity); await MediaContainer.SaveAsync(newId.ToString(), stream); diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs index f1b2dafa90..a16a48b0a0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs @@ -21,7 +21,7 @@ namespace Volo.CmsKit.MediaDescriptors } - public MediaDescriptor(Guid id, Guid? tenantId, string name, string mimeType, long size) : base(id) + public MediaDescriptor(Guid id, string name, string mimeType, long size, Guid? tenantId = null) : base(id) { TenantId = tenantId; From 7bf8a90af68fa9c2294b45624796cfaaf8009583 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 10 Feb 2021 13:52:46 +0300 Subject: [PATCH 021/283] added admin tests --- .../MediaDescriptorAdminAppService_Tests.cs | 53 +++++++++++++++++++ .../CmsKitDataSeedContributor.cs | 26 ++++++++- .../Volo.CmsKit.TestBase/CmsKitTestData.cs | 8 +++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 modules/cms-kit/test/Volo.CmsKit.Application.Tests/MediaDescriptors/MediaDescriptorAdminAppService_Tests.cs diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/MediaDescriptors/MediaDescriptorAdminAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/MediaDescriptors/MediaDescriptorAdminAppService_Tests.cs new file mode 100644 index 0000000000..20bfaf2c12 --- /dev/null +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/MediaDescriptors/MediaDescriptorAdminAppService_Tests.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; +using System.Text; +using System.Threading.Tasks; +using Shouldly; +using Volo.CmsKit.Admin.MediaDescriptors; +using Xunit; + +namespace Volo.CmsKit.MediaDescriptors +{ + public class MediaDescriptorAdminAppService_Tests : CmsKitApplicationTestBase + { + private readonly CmsKitTestData _cmsKitTestData; + private readonly IMediaDescriptorAdminAppService _mediaDescriptorAdminAppService; + private readonly IMediaDescriptorRepository _mediaDescriptorRepository; + + public MediaDescriptorAdminAppService_Tests() + { + _cmsKitTestData = GetRequiredService(); + _mediaDescriptorAdminAppService = GetRequiredService(); + _mediaDescriptorRepository = GetRequiredService(); + } + + [Fact] + public async Task Should_Create_Media() + { + var mediaName = "README.md"; + var mediaType = "text/markdown"; + var mediaContent = + "# ABP Framework\nABP Framework is a complete **infrastructure** based on the **ASP.NET Core** to create **modern web applications** and **APIs** by following the software development **best practices** and the **latest technologies**."; + + using var stream = new MemoryStream(Encoding.UTF8.GetBytes(mediaContent)); + + var inputStream = new CreateMediaInputStream(stream) + { + ContentType = mediaType, + Name = mediaName + }; + + var media = await _mediaDescriptorAdminAppService.CreateAsync(inputStream); + + media.ShouldNotBeNull(); + } + + [Fact] + public async Task Should_Delete_Media() + { + await _mediaDescriptorAdminAppService.DeleteAsync(_cmsKitTestData.Media_1_Id); + + (await _mediaDescriptorRepository.FindAsync(_cmsKitTestData.Media_1_Id)).ShouldBeNull(); + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs index 2ac4a23171..68a65de89e 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs @@ -1,8 +1,11 @@ using Microsoft.Extensions.Options; using System; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Text; using System.Threading.Tasks; +using Volo.Abp.BlobStoring; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories; @@ -12,6 +15,7 @@ using Volo.Abp.Users; using Volo.CmsKit.Blogs; using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; +using Volo.CmsKit.MediaDescriptors; using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; @@ -38,6 +42,8 @@ namespace Volo.CmsKit private readonly IBlogPostRepository _blogPostRepository; private readonly IOptions _options; private readonly IOptions _tagOptions; + private readonly IMediaDescriptorRepository _mediaDescriptorRepository; + private readonly IBlobContainer _mediaBlobContainer; public CmsKitDataSeedContributor( IGuidGenerator guidGenerator, @@ -55,7 +61,9 @@ namespace Volo.CmsKit IBlogPostRepository blogPostRepository, IEntityTagManager entityTagManager, IOptions options, - IOptions tagOptions) + IOptions tagOptions, + IMediaDescriptorRepository mediaDescriptorRepository, + IBlobContainer mediaBlobContainer) { _guidGenerator = guidGenerator; _cmsUserRepository = cmsUserRepository; @@ -73,6 +81,8 @@ namespace Volo.CmsKit _blogPostRepository = blogPostRepository; _options = options; _tagOptions = tagOptions; + _mediaDescriptorRepository = mediaDescriptorRepository; + _mediaBlobContainer = mediaBlobContainer; } public async Task SeedAsync(DataSeedContext context) @@ -96,6 +106,8 @@ namespace Volo.CmsKit await SeedPagesAsync(); await SeedBlogsAsync(); + + await SeedMediaAsync(); } } @@ -314,5 +326,17 @@ namespace Volo.CmsKit await _blogPostRepository.InsertAsync(new BlogPost(_cmsKitTestData.BlogPost_2_Id, blog.Id, _cmsKitTestData.BlogPost_2_Title, _cmsKitTestData.BlogPost_2_Slug, "Short desc 2")); } + + private async Task SeedMediaAsync() + { + using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(_cmsKitTestData.Media_1_Content))) + { + var media = new MediaDescriptor(_cmsKitTestData.Media_1_Id, _cmsKitTestData.Media_1_Name, _cmsKitTestData.Media_1_ContentType, stream.Length); + + await _mediaDescriptorRepository.InsertAsync(media); + + await _mediaBlobContainer.SaveAsync(media.Id.ToString(), stream); + } + } } } diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs index 2d6bf30da6..b0b4a5b1ba 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs @@ -90,5 +90,13 @@ namespace Volo.CmsKit public string BlogPost_2_Title => "How to use CmsKit"; public string BlogPost_2_Slug => "how-to-use-cms-kit"; + + public Guid Media_1_Id { get; } = Guid.NewGuid(); + + public string Media_1_Content = "Hi, this is text file"; + + public string Media_1_Name = "hello.txt"; + + public string Media_1_ContentType = "text/plain"; } } From 8125732b62241212bfab1d5352bf4dfbeccb4db3 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 10 Feb 2021 14:01:42 +0300 Subject: [PATCH 022/283] delete not necessary files and added host migration --- .../20210210105857_Added_Media.Designer.cs | 1889 +++++++++++++++++ .../Migrations/20210210105857_Added_Media.cs | 73 + .../UnifiedDbContextModelSnapshot.cs | 38 +- .../MediaDescriptors/GetMediaRequestDto.cs | 7 - .../MediaDescriptorGetListDto.cs | 14 - .../MediaDescriptorGetListInput.cs | 9 - .../UpdateMediaDescriptorDto.cs | 13 - ...CmsKitAdminApplicationAutoMapperProfile.cs | 1 - 8 files changed, 1980 insertions(+), 64 deletions(-) create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210210105857_Added_Media.Designer.cs create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210210105857_Added_Media.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/GetMediaRequestDto.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListDto.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListInput.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UpdateMediaDescriptorDto.cs diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210210105857_Added_Media.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210210105857_Added_Media.Designer.cs new file mode 100644 index 0000000000..14b807eb67 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210210105857_Added_Media.Designer.cs @@ -0,0 +1,1889 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.Migrations +{ + [DbContext(typeof(UnifiedDbContext))] + [Migration("20210210105857_Added_Media")] + partial class Added_Media + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)") + .HasColumnName("Exceptions"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("varbinary(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("SourceTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique() + .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + b.ToTable("AbpLinkUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("bit") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("bit") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("bit") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("SecurityStamp"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("nvarchar(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("CmsBlogs"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogPost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ShortDescription") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("CreatorId"); + + b.HasIndex("DeleterId"); + + b.HasIndex("LastModifierId"); + + b.HasIndex("Slug", "BlogId"); + + b.ToTable("CmsBlogPosts"); + }); + + modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "RepliedCommentId"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsComments"); + }); + + modelBuilder.Entity("Volo.CmsKit.Contents.Content", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsContents"); + }); + + modelBuilder.Entity("Volo.CmsKit.MediaDescriptors.MediaDescriptor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MimeType") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Size") + .HasMaxLength(2147483647) + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("CmsMediaDescriptors"); + }); + + modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StarCount") + .HasColumnType("smallint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId"); + + b.ToTable("CmsRatings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ReactionName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName"); + + b.ToTable("CmsUserReactions"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => + { + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); + + b.HasIndex("TenantId", "EntityId", "TagId"); + + b.ToTable("CmsEntityTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("CmsTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Email"); + + b.HasIndex("TenantId", "UserName"); + + b.ToTable("CmsUsers"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("OrganizationUnits") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("ParentId"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany("Roles") + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogPost", b => + { + b.HasOne("Volo.CmsKit.Users.CmsUser", "Creator") + .WithMany() + .HasForeignKey("CreatorId"); + + b.HasOne("Volo.CmsKit.Users.CmsUser", "Deleter") + .WithMany() + .HasForeignKey("DeleterId"); + + b.HasOne("Volo.CmsKit.Users.CmsUser", "LastModifier") + .WithMany() + .HasForeignKey("LastModifierId"); + + b.Navigation("Creator"); + + b.Navigation("Deleter"); + + b.Navigation("LastModifier"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210210105857_Added_Media.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210210105857_Added_Media.cs new file mode 100644 index 0000000000..46abf1b3b0 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210210105857_Added_Media.cs @@ -0,0 +1,73 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Volo.CmsKit.Migrations +{ + public partial class Added_Media : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CmsPages"); + + migrationBuilder.CreateTable( + name: "CmsMediaDescriptors", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false), + MimeType = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Size = table.Column(type: "bigint", maxLength: 2147483647, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsMediaDescriptors", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CmsMediaDescriptors"); + + migrationBuilder.CreateTable( + name: "CmsPages", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true), + Description = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Title = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Url = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsPages", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_CmsPages_TenantId_Url", + table: "CmsPages", + columns: new[] { "TenantId", "Url" }); + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs index bdfc4be963..80080860e9 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs @@ -16,10 +16,10 @@ namespace Volo.CmsKit.Migrations { #pragma warning disable 612, 618 modelBuilder - .UseIdentityColumns() .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.2"); + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -1386,7 +1386,7 @@ namespace Volo.CmsKit.Migrations b.ToTable("CmsContents"); }); - modelBuilder.Entity("Volo.CmsKit.Pages.Page", b => + modelBuilder.Entity("Volo.CmsKit.MediaDescriptors.MediaDescriptor", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1414,10 +1414,6 @@ namespace Volo.CmsKit.Migrations .HasColumnType("datetime2") .HasColumnName("DeletionTime"); - b.Property("Description") - .HasMaxLength(512) - .HasColumnType("nvarchar(512)"); - b.Property("ExtraProperties") .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -1436,25 +1432,27 @@ namespace Volo.CmsKit.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("LastModifierId"); - b.Property("TenantId") - .HasColumnType("uniqueidentifier") - .HasColumnName("TenantId"); - - b.Property("Title") + b.Property("MimeType") .IsRequired() - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); - b.Property("Url") + b.Property("Name") .IsRequired() - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); - b.HasKey("Id"); + b.Property("Size") + .HasMaxLength(2147483647) + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); - b.HasIndex("TenantId", "Url"); + b.HasKey("Id"); - b.ToTable("CmsPages"); + b.ToTable("CmsMediaDescriptors"); }); modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/GetMediaRequestDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/GetMediaRequestDto.cs deleted file mode 100644 index 1311b306bb..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/GetMediaRequestDto.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Volo.CmsKit.Admin.MediaDescriptors -{ - public class GetMediaRequestDto - { - public bool Download { get; set; } = false; - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListDto.cs deleted file mode 100644 index 2be684d894..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListDto.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; - -namespace Volo.CmsKit.Admin.MediaDescriptors -{ - public class MediaDescriptorGetListDto : EntityDto - { - public string Name { get; set; } - - public string MimeType { get; set; } - - public int Size { get; set; } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListInput.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListInput.cs deleted file mode 100644 index 6d8316a749..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorGetListInput.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Volo.CmsKit.Admin.MediaDescriptors -{ - public class MediaDescriptorGetListInput : PagedAndSortedResultRequestDto - { - - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UpdateMediaDescriptorDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UpdateMediaDescriptorDto.cs deleted file mode 100644 index ba3e60ba50..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/UpdateMediaDescriptorDto.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using Volo.Abp.Validation; -using Volo.CmsKit.MediaDescriptors; - -namespace Volo.CmsKit.Admin.MediaDescriptors -{ - public class UpdateMediaDescriptorDto - { - [Required] - [DynamicStringLength(typeof(MediaDescriptorConsts), nameof(MediaDescriptorConsts.MaxNameLength))] - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs index 7d23bbbae5..33a9d9de84 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs @@ -34,7 +34,6 @@ namespace Volo.CmsKit.Admin CreateMap(MemberList.Destination); CreateMap(); - CreateMap(); } } } From f5737f8a2f7c9d7534ff6aabde28249f1c278626 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 10 Feb 2021 14:28:13 +0300 Subject: [PATCH 023/283] rename media container name --- .../Volo/CmsKit/MediaDescriptors/MediaContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaContainer.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaContainer.cs index bbb4a41327..b1ea0fe1d4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaContainer.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaContainer.cs @@ -2,7 +2,7 @@ namespace Volo.CmsKit.MediaDescriptors { - [BlobContainerName("cms-kit-medias")] + [BlobContainerName("cms-kit-media")] public class MediaContainer { From be20146860c232b8e7e5e9d2cdf9c56035da049f Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 10 Feb 2021 14:30:47 +0300 Subject: [PATCH 024/283] added missing localizations --- .../Volo/CmsKit/CmsKitErrorCodes.cs | 2 +- .../Volo/CmsKit/Localization/Resources/en.json | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs index bbb3c59e2a..60ed82a671 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs @@ -22,7 +22,7 @@ public static class MediaDescriptors { - public const string InvalidName = "CmsKit:Medias:0001"; + public const string InvalidName = "CmsKit:Media:0001"; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 520664d0aa..7b7dd69308 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -41,6 +41,9 @@ "Update": "Update", "YourComment": "Your comment", "YourReply": "Your reply", - "CmsKit:Medias:0001": "'{Name}' is not a valid media name." + "CmsKit:Media:0001": "'{Name}' is not a valid media name.", + "Permission:MediaDescriptorManagement": "Media Management", + "Permission:MediaDescriptorManagement:Create": "Create", + "Permission:MediaDescriptorManagement:Delete": "Delete" } } From 53a920a761a28ea4077604449af9d98f1f6564dd Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 11 Feb 2021 11:45:23 +0300 Subject: [PATCH 025/283] update set accesibilty --- .../Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs index a16a48b0a0..1119219e1b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs @@ -12,7 +12,7 @@ namespace Volo.CmsKit.MediaDescriptors public string Name { get; protected set; } - public string MimeType { get; set; } + public string MimeType { get; protected set; } public long Size { get; protected set; } From b20d42af75249aa1ff1fe4746014c0c7592ba210 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 11 Feb 2021 11:46:12 +0300 Subject: [PATCH 026/283] switch order of saving blob & entity --- .../Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs index c053a0b2e3..17af6a9993 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs @@ -29,8 +29,8 @@ namespace Volo.CmsKit.Admin.MediaDescriptors var stream = inputStream.GetStream(); var newEntity = new MediaDescriptor(newId, inputStream.Name, inputStream.ContentType, stream.Length, CurrentTenant.Id); - await MediaDescriptorRepository.InsertAsync(newEntity); await MediaContainer.SaveAsync(newId.ToString(), stream); + await MediaDescriptorRepository.InsertAsync(newEntity); return ObjectMapper.Map(newEntity); } From 9725c17481d1a4f22dd8d3f06f6841db463a7695 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 11 Feb 2021 12:07:49 +0300 Subject: [PATCH 027/283] remove os depended filename validation --- .../MediaDescriptors/Extensions/MediaDescriptorExtensions.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/Extensions/MediaDescriptorExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/Extensions/MediaDescriptorExtensions.cs index a1fa903d55..fc60d90438 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/Extensions/MediaDescriptorExtensions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/Extensions/MediaDescriptorExtensions.cs @@ -12,8 +12,7 @@ namespace Volo.CmsKit.MediaDescriptors.Extensions return false; } - // "con" is not valid folder/file name for Windows OS - return !(Path.GetInvalidFileNameChars().Any(name.Contains) || name == "con"); + return !(Path.GetInvalidFileNameChars().Any(name.Contains)); } } } \ No newline at end of file From 5781dca2707130451a94a269854dad43e6e3956a Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 11 Feb 2021 12:08:19 +0300 Subject: [PATCH 028/283] remove notnecessary chars --- .../MediaDescriptors/Extensions/MediaDescriptorExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/Extensions/MediaDescriptorExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/Extensions/MediaDescriptorExtensions.cs index fc60d90438..a8a8e6545d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/Extensions/MediaDescriptorExtensions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/Extensions/MediaDescriptorExtensions.cs @@ -12,7 +12,7 @@ namespace Volo.CmsKit.MediaDescriptors.Extensions return false; } - return !(Path.GetInvalidFileNameChars().Any(name.Contains)); + return !Path.GetInvalidFileNameChars().Any(name.Contains); } } } \ No newline at end of file From 324e90b82f55dc9daf40031dc4ab2d4cc2ec11d9 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 11 Feb 2021 12:30:12 +0300 Subject: [PATCH 029/283] added tui-editor npm package and cast yarn gulp --- .../host/Volo.CmsKit.Web.Unified/package.json | 3 +- .../wwwroot/libs/codemirror/codemirror.css | 350 + .../wwwroot/libs/codemirror/codemirror.js | 9800 + .../libs/highlight.js/highlight.pack.js | 2 + .../libs/highlight.js/styles/agate.css | 108 + .../highlight.js/styles/androidstudio.css | 66 + .../highlight.js/styles/arduino-light.css | 88 + .../wwwroot/libs/highlight.js/styles/arta.css | 73 + .../libs/highlight.js/styles/ascetic.css | 45 + .../highlight.js/styles/atelier-cave-dark.css | 83 + .../styles/atelier-cave-light.css | 85 + .../highlight.js/styles/atelier-dune-dark.css | 69 + .../styles/atelier-dune-light.css | 69 + .../styles/atelier-estuary-dark.css | 84 + .../styles/atelier-estuary-light.css | 84 + .../styles/atelier-forest-dark.css | 69 + .../styles/atelier-forest-light.css | 69 + .../styles/atelier-heath-dark.css | 69 + .../styles/atelier-heath-light.css | 69 + .../styles/atelier-lakeside-dark.css | 69 + .../styles/atelier-lakeside-light.css | 69 + .../styles/atelier-plateau-dark.css | 84 + .../styles/atelier-plateau-light.css | 84 + .../styles/atelier-savanna-dark.css | 84 + .../styles/atelier-savanna-light.css | 84 + .../styles/atelier-seaside-dark.css | 69 + .../styles/atelier-seaside-light.css | 69 + .../styles/atelier-sulphurpool-dark.css | 69 + .../styles/atelier-sulphurpool-light.css | 69 + .../highlight.js/styles/atom-one-dark.css | 96 + .../highlight.js/styles/atom-one-light.css | 96 + .../libs/highlight.js/styles/brown-paper.css | 64 + .../highlight.js/styles/brown-papersq.png | Bin 0 -> 18198 bytes .../highlight.js/styles/codepen-embed.css | 60 + .../libs/highlight.js/styles/color-brewer.css | 71 + .../libs/highlight.js/styles/darcula.css | 77 + .../wwwroot/libs/highlight.js/styles/dark.css | 63 + .../libs/highlight.js/styles/darkula.css | 6 + .../libs/highlight.js/styles/default.css | 99 + .../libs/highlight.js/styles/docco.css | 97 + .../libs/highlight.js/styles/dracula.css | 76 + .../wwwroot/libs/highlight.js/styles/far.css | 71 + .../libs/highlight.js/styles/foundation.css | 88 + .../libs/highlight.js/styles/github-gist.css | 71 + .../libs/highlight.js/styles/github.css | 99 + .../libs/highlight.js/styles/googlecode.css | 89 + .../libs/highlight.js/styles/grayscale.css | 101 + .../libs/highlight.js/styles/gruvbox-dark.css | 108 + .../highlight.js/styles/gruvbox-light.css | 108 + .../libs/highlight.js/styles/hopscotch.css | 83 + .../libs/highlight.js/styles/hybrid.css | 102 + .../wwwroot/libs/highlight.js/styles/idea.css | 97 + .../libs/highlight.js/styles/ir-black.css | 73 + .../libs/highlight.js/styles/kimbie.dark.css | 74 + .../libs/highlight.js/styles/kimbie.light.css | 74 + .../libs/highlight.js/styles/magula.css | 70 + .../libs/highlight.js/styles/mono-blue.css | 59 + .../highlight.js/styles/monokai-sublime.css | 83 + .../libs/highlight.js/styles/monokai.css | 70 + .../libs/highlight.js/styles/obsidian.css | 88 + .../libs/highlight.js/styles/ocean.css | 74 + .../libs/highlight.js/styles/paraiso-dark.css | 72 + .../highlight.js/styles/paraiso-light.css | 72 + .../libs/highlight.js/styles/pojoaque.css | 83 + .../libs/highlight.js/styles/pojoaque.jpg | Bin 0 -> 1186 bytes .../libs/highlight.js/styles/purebasic.css | 96 + .../highlight.js/styles/qtcreator_dark.css | 83 + .../highlight.js/styles/qtcreator_light.css | 83 + .../libs/highlight.js/styles/railscasts.css | 106 + .../libs/highlight.js/styles/rainbow.css | 85 + .../libs/highlight.js/styles/routeros.css | 108 + .../libs/highlight.js/styles/school-book.css | 72 + .../libs/highlight.js/styles/school-book.png | Bin 0 -> 486 bytes .../highlight.js/styles/solarized-dark.css | 84 + .../highlight.js/styles/solarized-light.css | 84 + .../libs/highlight.js/styles/sunburst.css | 102 + .../styles/tomorrow-night-blue.css | 75 + .../styles/tomorrow-night-bright.css | 74 + .../styles/tomorrow-night-eighties.css | 74 + .../highlight.js/styles/tomorrow-night.css | 75 + .../libs/highlight.js/styles/tomorrow.css | 72 + .../wwwroot/libs/highlight.js/styles/vs.css | 68 + .../libs/highlight.js/styles/vs2015.css | 115 + .../libs/highlight.js/styles/xcode.css | 93 + .../libs/highlight.js/styles/xt256.css | 92 + .../libs/highlight.js/styles/zenburn.css | 80 + .../libs/markdown-it/markdown-it.min.js | 1 + .../wwwroot/libs/squire-rte/squire.js | 2 + .../wwwroot/libs/to-mark/to-mark.min.js | 1 + .../libs/tui-code-snippet/tui-code-snippet.js | 5201 + .../wwwroot/libs/tui-editor/tui-editor-2x.png | Bin 0 -> 24489 bytes .../libs/tui-editor/tui-editor-Editor-all.js | 42211 ++++ .../tui-editor/tui-editor-Editor-all.min.js | 14 + .../libs/tui-editor/tui-editor-Editor-full.js | 167497 +++++++++++++++ .../tui-editor/tui-editor-Editor-full.min.js | 134 + .../libs/tui-editor/tui-editor-Editor.js | 29529 +++ .../libs/tui-editor/tui-editor-Editor.min.js | 7 + .../libs/tui-editor/tui-editor-Viewer-all.js | 15853 ++ .../tui-editor/tui-editor-Viewer-all.min.js | 14 + .../libs/tui-editor/tui-editor-Viewer-full.js | 166357 ++++++++++++++ .../tui-editor/tui-editor-Viewer-full.min.js | 134 + .../libs/tui-editor/tui-editor-Viewer.js | 4318 + .../libs/tui-editor/tui-editor-Viewer.min.js | 7 + .../libs/tui-editor/tui-editor-contents.css | 259 + .../tui-editor/tui-editor-contents.min.css | 1 + .../libs/tui-editor/tui-editor-extChart.js | 7371 + .../tui-editor/tui-editor-extChart.min.js | 14 + .../tui-editor/tui-editor-extColorSyntax.js | 551 + .../tui-editor-extColorSyntax.min.js | 7 + .../tui-editor/tui-editor-extScrollSync.js | 1311 + .../tui-editor-extScrollSync.min.js | 7 + .../libs/tui-editor/tui-editor-extTable.js | 4036 + .../tui-editor/tui-editor-extTable.min.js | 7 + .../libs/tui-editor/tui-editor-extUML.js | 236 + .../libs/tui-editor/tui-editor-extUML.min.js | 7 + .../wwwroot/libs/tui-editor/tui-editor.css | 1291 + .../libs/tui-editor/tui-editor.min.css | 1 + .../wwwroot/libs/tui-editor/tui-editor.png | Bin 0 -> 10885 bytes .../host/Volo.CmsKit.Web.Unified/yarn.lock | 237 +- 119 files changed, 463084 insertions(+), 2 deletions(-) create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/codemirror/codemirror.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/codemirror/codemirror.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/highlight.pack.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/agate.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/androidstudio.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/arduino-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/arta.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/ascetic.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-cave-dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-cave-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-dune-dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-dune-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-estuary-dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-estuary-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-forest-dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-forest-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-heath-dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-heath-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-lakeside-dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-lakeside-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-plateau-dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-plateau-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-savanna-dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-savanna-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-seaside-dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-seaside-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-sulphurpool-dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-sulphurpool-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atom-one-dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atom-one-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/brown-paper.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/brown-papersq.png create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/codepen-embed.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/color-brewer.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/darcula.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/darkula.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/default.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/docco.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/dracula.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/far.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/foundation.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/github-gist.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/github.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/googlecode.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/grayscale.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/gruvbox-dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/gruvbox-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/hopscotch.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/hybrid.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/idea.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/ir-black.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/kimbie.dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/kimbie.light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/magula.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/mono-blue.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/monokai-sublime.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/monokai.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/obsidian.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/ocean.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/paraiso-dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/paraiso-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/pojoaque.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/pojoaque.jpg create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/purebasic.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/qtcreator_dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/qtcreator_light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/railscasts.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/rainbow.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/routeros.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/school-book.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/school-book.png create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/solarized-dark.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/solarized-light.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/sunburst.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night-blue.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night-bright.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night-eighties.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/vs.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/vs2015.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/xcode.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/xt256.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/zenburn.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/markdown-it/markdown-it.min.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/squire-rte/squire.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/to-mark/to-mark.min.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-code-snippet/tui-code-snippet.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-2x.png create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-Editor-all.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-Editor-all.min.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-Editor-full.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-Editor-full.min.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-Editor.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-Editor.min.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-Viewer-all.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-Viewer-all.min.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-Viewer-full.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-Viewer-full.min.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-Viewer.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-Viewer.min.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-contents.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-contents.min.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-extChart.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-extChart.min.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-extColorSyntax.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-extColorSyntax.min.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-extScrollSync.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-extScrollSync.min.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-extTable.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-extTable.min.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-extUML.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-extUML.min.js create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor.min.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor.png diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json index 7c27b656b4..d5b390026d 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json @@ -4,6 +4,7 @@ "private": true, "dependencies": { "@abp/aspnetcore.mvc.ui.theme.basic": "^4.2.1", - "@abp/cms-kit": "4.2.1" + "@abp/cms-kit": "4.2.1", + "@abp/tui-editor": "^4.2.1" } } \ No newline at end of file diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/codemirror/codemirror.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/codemirror/codemirror.css new file mode 100644 index 0000000000..5ea2d2be2a --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/codemirror/codemirror.css @@ -0,0 +1,350 @@ +/* BASICS */ + +.CodeMirror { + /* Set height, width, borders, and global font properties here */ + font-family: monospace; + height: 300px; + color: black; + direction: ltr; +} + +/* PADDING */ + +.CodeMirror-lines { + padding: 4px 0; /* Vertical padding around content */ +} +.CodeMirror pre.CodeMirror-line, +.CodeMirror pre.CodeMirror-line-like { + padding: 0 4px; /* Horizontal padding of content */ +} + +.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { + background-color: transparent; /* The little square between H and V scrollbars */ +} + +/* GUTTER */ + +.CodeMirror-gutters { + border-right: 1px solid #ddd; + background-color: #f7f7f7; + white-space: nowrap; +} +.CodeMirror-linenumbers {} +.CodeMirror-linenumber { + padding: 0 3px 0 5px; + min-width: 20px; + text-align: right; + color: #999; + white-space: nowrap; +} + +.CodeMirror-guttermarker { color: black; } +.CodeMirror-guttermarker-subtle { color: #999; } + +/* CURSOR */ + +.CodeMirror-cursor { + border-left: 1px solid black; + border-right: none; + width: 0; +} +/* Shown when moving in bi-directional text */ +.CodeMirror div.CodeMirror-secondarycursor { + border-left: 1px solid silver; +} +.cm-fat-cursor .CodeMirror-cursor { + width: auto; + border: 0 !important; + background: #7e7; +} +.cm-fat-cursor div.CodeMirror-cursors { + z-index: 1; +} +.cm-fat-cursor-mark { + background-color: rgba(20, 255, 20, 0.5); + -webkit-animation: blink 1.06s steps(1) infinite; + -moz-animation: blink 1.06s steps(1) infinite; + animation: blink 1.06s steps(1) infinite; +} +.cm-animate-fat-cursor { + width: auto; + border: 0; + -webkit-animation: blink 1.06s steps(1) infinite; + -moz-animation: blink 1.06s steps(1) infinite; + animation: blink 1.06s steps(1) infinite; + background-color: #7e7; +} +@-moz-keyframes blink { + 0% {} + 50% { background-color: transparent; } + 100% {} +} +@-webkit-keyframes blink { + 0% {} + 50% { background-color: transparent; } + 100% {} +} +@keyframes blink { + 0% {} + 50% { background-color: transparent; } + 100% {} +} + +/* Can style cursor different in overwrite (non-insert) mode */ +.CodeMirror-overwrite .CodeMirror-cursor {} + +.cm-tab { display: inline-block; text-decoration: inherit; } + +.CodeMirror-rulers { + position: absolute; + left: 0; right: 0; top: -50px; bottom: 0; + overflow: hidden; +} +.CodeMirror-ruler { + border-left: 1px solid #ccc; + top: 0; bottom: 0; + position: absolute; +} + +/* DEFAULT THEME */ + +.cm-s-default .cm-header {color: blue;} +.cm-s-default .cm-quote {color: #090;} +.cm-negative {color: #d44;} +.cm-positive {color: #292;} +.cm-header, .cm-strong {font-weight: bold;} +.cm-em {font-style: italic;} +.cm-link {text-decoration: underline;} +.cm-strikethrough {text-decoration: line-through;} + +.cm-s-default .cm-keyword {color: #708;} +.cm-s-default .cm-atom {color: #219;} +.cm-s-default .cm-number {color: #164;} +.cm-s-default .cm-def {color: #00f;} +.cm-s-default .cm-variable, +.cm-s-default .cm-punctuation, +.cm-s-default .cm-property, +.cm-s-default .cm-operator {} +.cm-s-default .cm-variable-2 {color: #05a;} +.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;} +.cm-s-default .cm-comment {color: #a50;} +.cm-s-default .cm-string {color: #a11;} +.cm-s-default .cm-string-2 {color: #f50;} +.cm-s-default .cm-meta {color: #555;} +.cm-s-default .cm-qualifier {color: #555;} +.cm-s-default .cm-builtin {color: #30a;} +.cm-s-default .cm-bracket {color: #997;} +.cm-s-default .cm-tag {color: #170;} +.cm-s-default .cm-attribute {color: #00c;} +.cm-s-default .cm-hr {color: #999;} +.cm-s-default .cm-link {color: #00c;} + +.cm-s-default .cm-error {color: #f00;} +.cm-invalidchar {color: #f00;} + +.CodeMirror-composing { border-bottom: 2px solid; } + +/* Default styles for common addons */ + +div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;} +div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;} +.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); } +.CodeMirror-activeline-background {background: #e8f2ff;} + +/* STOP */ + +/* The rest of this file contains styles related to the mechanics of + the editor. You probably shouldn't touch them. */ + +.CodeMirror { + position: relative; + overflow: hidden; + background: white; +} + +.CodeMirror-scroll { + overflow: scroll !important; /* Things will break if this is overridden */ + /* 50px is the magic margin used to hide the element's real scrollbars */ + /* See overflow: hidden in .CodeMirror */ + margin-bottom: -50px; margin-right: -50px; + padding-bottom: 50px; + height: 100%; + outline: none; /* Prevent dragging from highlighting the element */ + position: relative; +} +.CodeMirror-sizer { + position: relative; + border-right: 50px solid transparent; +} + +/* The fake, visible scrollbars. Used to force redraw during scrolling + before actual scrolling happens, thus preventing shaking and + flickering artifacts. */ +.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { + position: absolute; + z-index: 6; + display: none; + outline: none; +} +.CodeMirror-vscrollbar { + right: 0; top: 0; + overflow-x: hidden; + overflow-y: scroll; +} +.CodeMirror-hscrollbar { + bottom: 0; left: 0; + overflow-y: hidden; + overflow-x: scroll; +} +.CodeMirror-scrollbar-filler { + right: 0; bottom: 0; +} +.CodeMirror-gutter-filler { + left: 0; bottom: 0; +} + +.CodeMirror-gutters { + position: absolute; left: 0; top: 0; + min-height: 100%; + z-index: 3; +} +.CodeMirror-gutter { + white-space: normal; + height: 100%; + display: inline-block; + vertical-align: top; + margin-bottom: -50px; +} +.CodeMirror-gutter-wrapper { + position: absolute; + z-index: 4; + background: none !important; + border: none !important; +} +.CodeMirror-gutter-background { + position: absolute; + top: 0; bottom: 0; + z-index: 4; +} +.CodeMirror-gutter-elt { + position: absolute; + cursor: default; + z-index: 4; +} +.CodeMirror-gutter-wrapper ::selection { background-color: transparent } +.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent } + +.CodeMirror-lines { + cursor: text; + min-height: 1px; /* prevents collapsing before first draw */ +} +.CodeMirror pre.CodeMirror-line, +.CodeMirror pre.CodeMirror-line-like { + /* Reset some styles that the rest of the page might have set */ + -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; + border-width: 0; + background: transparent; + font-family: inherit; + font-size: inherit; + margin: 0; + white-space: pre; + word-wrap: normal; + line-height: inherit; + color: inherit; + z-index: 2; + position: relative; + overflow: visible; + -webkit-tap-highlight-color: transparent; + -webkit-font-variant-ligatures: contextual; + font-variant-ligatures: contextual; +} +.CodeMirror-wrap pre.CodeMirror-line, +.CodeMirror-wrap pre.CodeMirror-line-like { + word-wrap: break-word; + white-space: pre-wrap; + word-break: normal; +} + +.CodeMirror-linebackground { + position: absolute; + left: 0; right: 0; top: 0; bottom: 0; + z-index: 0; +} + +.CodeMirror-linewidget { + position: relative; + z-index: 2; + padding: 0.1px; /* Force widget margins to stay inside of the container */ +} + +.CodeMirror-widget {} + +.CodeMirror-rtl pre { direction: rtl; } + +.CodeMirror-code { + outline: none; +} + +/* Force content-box sizing for the elements where we expect it */ +.CodeMirror-scroll, +.CodeMirror-sizer, +.CodeMirror-gutter, +.CodeMirror-gutters, +.CodeMirror-linenumber { + -moz-box-sizing: content-box; + box-sizing: content-box; +} + +.CodeMirror-measure { + position: absolute; + width: 100%; + height: 0; + overflow: hidden; + visibility: hidden; +} + +.CodeMirror-cursor { + position: absolute; + pointer-events: none; +} +.CodeMirror-measure pre { position: static; } + +div.CodeMirror-cursors { + visibility: hidden; + position: relative; + z-index: 3; +} +div.CodeMirror-dragcursors { + visibility: visible; +} + +.CodeMirror-focused div.CodeMirror-cursors { + visibility: visible; +} + +.CodeMirror-selected { background: #d9d9d9; } +.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } +.CodeMirror-crosshair { cursor: crosshair; } +.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; } +.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; } + +.cm-searching { + background-color: #ffa; + background-color: rgba(255, 255, 0, .4); +} + +/* Used to force a border model for a node */ +.cm-force-border { padding-right: .1px; } + +@media print { + /* Hide the cursor when printing */ + .CodeMirror div.CodeMirror-cursors { + visibility: hidden; + } +} + +/* See issue #2901 */ +.cm-tab-wrap-hack:after { content: ''; } + +/* Help users use markselection to safely style text background */ +span.CodeMirror-selectedtext { background: none; } diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/codemirror/codemirror.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/codemirror/codemirror.js new file mode 100644 index 0000000000..9aa6da5df5 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/codemirror/codemirror.js @@ -0,0 +1,9800 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: https://codemirror.net/LICENSE + +// This is CodeMirror (https://codemirror.net), a code editor +// implemented in JavaScript on top of the browser's DOM. +// +// You can find some technical background for some of the code below +// at http://marijnhaverbeke.nl/blog/#cm-internals . + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.CodeMirror = factory()); +}(this, (function () { 'use strict'; + + // Kludges for bugs and behavior differences that can't be feature + // detected are enabled based on userAgent etc sniffing. + var userAgent = navigator.userAgent; + var platform = navigator.platform; + + var gecko = /gecko\/\d/i.test(userAgent); + var ie_upto10 = /MSIE \d/.test(userAgent); + var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent); + var edge = /Edge\/(\d+)/.exec(userAgent); + var ie = ie_upto10 || ie_11up || edge; + var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]); + var webkit = !edge && /WebKit\//.test(userAgent); + var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent); + var chrome = !edge && /Chrome\//.test(userAgent); + var presto = /Opera\//.test(userAgent); + var safari = /Apple Computer/.test(navigator.vendor); + var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent); + var phantom = /PhantomJS/.test(userAgent); + + var ios = safari && (/Mobile\/\w+/.test(userAgent) || navigator.maxTouchPoints > 2); + var android = /Android/.test(userAgent); + // This is woefully incomplete. Suggestions for alternative methods welcome. + var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent); + var mac = ios || /Mac/.test(platform); + var chromeOS = /\bCrOS\b/.test(userAgent); + var windows = /win/i.test(platform); + + var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/); + if (presto_version) { presto_version = Number(presto_version[1]); } + if (presto_version && presto_version >= 15) { presto = false; webkit = true; } + // Some browsers use the wrong event properties to signal cmd/ctrl on OS X + var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11)); + var captureRightClick = gecko || (ie && ie_version >= 9); + + function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") } + + var rmClass = function(node, cls) { + var current = node.className; + var match = classTest(cls).exec(current); + if (match) { + var after = current.slice(match.index + match[0].length); + node.className = current.slice(0, match.index) + (after ? match[1] + after : ""); + } + }; + + function removeChildren(e) { + for (var count = e.childNodes.length; count > 0; --count) + { e.removeChild(e.firstChild); } + return e + } + + function removeChildrenAndAdd(parent, e) { + return removeChildren(parent).appendChild(e) + } + + function elt(tag, content, className, style) { + var e = document.createElement(tag); + if (className) { e.className = className; } + if (style) { e.style.cssText = style; } + if (typeof content == "string") { e.appendChild(document.createTextNode(content)); } + else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } } + return e + } + // wrapper for elt, which removes the elt from the accessibility tree + function eltP(tag, content, className, style) { + var e = elt(tag, content, className, style); + e.setAttribute("role", "presentation"); + return e + } + + var range; + if (document.createRange) { range = function(node, start, end, endNode) { + var r = document.createRange(); + r.setEnd(endNode || node, end); + r.setStart(node, start); + return r + }; } + else { range = function(node, start, end) { + var r = document.body.createTextRange(); + try { r.moveToElementText(node.parentNode); } + catch(e) { return r } + r.collapse(true); + r.moveEnd("character", end); + r.moveStart("character", start); + return r + }; } + + function contains(parent, child) { + if (child.nodeType == 3) // Android browser always returns false when child is a textnode + { child = child.parentNode; } + if (parent.contains) + { return parent.contains(child) } + do { + if (child.nodeType == 11) { child = child.host; } + if (child == parent) { return true } + } while (child = child.parentNode) + } + + function activeElt() { + // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement. + // IE < 10 will throw when accessed while the page is loading or in an iframe. + // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable. + var activeElement; + try { + activeElement = document.activeElement; + } catch(e) { + activeElement = document.body || null; + } + while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement) + { activeElement = activeElement.shadowRoot.activeElement; } + return activeElement + } + + function addClass(node, cls) { + var current = node.className; + if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; } + } + function joinClasses(a, b) { + var as = a.split(" "); + for (var i = 0; i < as.length; i++) + { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } } + return b + } + + var selectInput = function(node) { node.select(); }; + if (ios) // Mobile Safari apparently has a bug where select() is broken. + { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; } + else if (ie) // Suppress mysterious IE10 errors + { selectInput = function(node) { try { node.select(); } catch(_e) {} }; } + + function bind(f) { + var args = Array.prototype.slice.call(arguments, 1); + return function(){return f.apply(null, args)} + } + + function copyObj(obj, target, overwrite) { + if (!target) { target = {}; } + for (var prop in obj) + { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop))) + { target[prop] = obj[prop]; } } + return target + } + + // Counts the column offset in a string, taking tabs into account. + // Used mostly to find indentation. + function countColumn(string, end, tabSize, startIndex, startValue) { + if (end == null) { + end = string.search(/[^\s\u00a0]/); + if (end == -1) { end = string.length; } + } + for (var i = startIndex || 0, n = startValue || 0;;) { + var nextTab = string.indexOf("\t", i); + if (nextTab < 0 || nextTab >= end) + { return n + (end - i) } + n += nextTab - i; + n += tabSize - (n % tabSize); + i = nextTab + 1; + } + } + + var Delayed = function() { + this.id = null; + this.f = null; + this.time = 0; + this.handler = bind(this.onTimeout, this); + }; + Delayed.prototype.onTimeout = function (self) { + self.id = 0; + if (self.time <= +new Date) { + self.f(); + } else { + setTimeout(self.handler, self.time - +new Date); + } + }; + Delayed.prototype.set = function (ms, f) { + this.f = f; + var time = +new Date + ms; + if (!this.id || time < this.time) { + clearTimeout(this.id); + this.id = setTimeout(this.handler, ms); + this.time = time; + } + }; + + function indexOf(array, elt) { + for (var i = 0; i < array.length; ++i) + { if (array[i] == elt) { return i } } + return -1 + } + + // Number of pixels added to scroller and sizer to hide scrollbar + var scrollerGap = 50; + + // Returned or thrown by various protocols to signal 'I'm not + // handling this'. + var Pass = {toString: function(){return "CodeMirror.Pass"}}; + + // Reused option objects for setSelection & friends + var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"}; + + // The inverse of countColumn -- find the offset that corresponds to + // a particular column. + function findColumn(string, goal, tabSize) { + for (var pos = 0, col = 0;;) { + var nextTab = string.indexOf("\t", pos); + if (nextTab == -1) { nextTab = string.length; } + var skipped = nextTab - pos; + if (nextTab == string.length || col + skipped >= goal) + { return pos + Math.min(skipped, goal - col) } + col += nextTab - pos; + col += tabSize - (col % tabSize); + pos = nextTab + 1; + if (col >= goal) { return pos } + } + } + + var spaceStrs = [""]; + function spaceStr(n) { + while (spaceStrs.length <= n) + { spaceStrs.push(lst(spaceStrs) + " "); } + return spaceStrs[n] + } + + function lst(arr) { return arr[arr.length-1] } + + function map(array, f) { + var out = []; + for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); } + return out + } + + function insertSorted(array, value, score) { + var pos = 0, priority = score(value); + while (pos < array.length && score(array[pos]) <= priority) { pos++; } + array.splice(pos, 0, value); + } + + function nothing() {} + + function createObj(base, props) { + var inst; + if (Object.create) { + inst = Object.create(base); + } else { + nothing.prototype = base; + inst = new nothing(); + } + if (props) { copyObj(props, inst); } + return inst + } + + var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; + function isWordCharBasic(ch) { + return /\w/.test(ch) || ch > "\x80" && + (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch)) + } + function isWordChar(ch, helper) { + if (!helper) { return isWordCharBasic(ch) } + if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true } + return helper.test(ch) + } + + function isEmpty(obj) { + for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } } + return true + } + + // Extending unicode characters. A series of a non-extending char + + // any number of extending chars is treated as a single unit as far + // as editing and measuring is concerned. This is not fully correct, + // since some scripts/fonts/browsers also treat other configurations + // of code points as a group. + var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/; + function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) } + + // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range. + function skipExtendingChars(str, pos, dir) { + while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; } + return pos + } + + // Returns the value from the range [`from`; `to`] that satisfies + // `pred` and is closest to `from`. Assumes that at least `to` + // satisfies `pred`. Supports `from` being greater than `to`. + function findFirst(pred, from, to) { + // At any point we are certain `to` satisfies `pred`, don't know + // whether `from` does. + var dir = from > to ? -1 : 1; + for (;;) { + if (from == to) { return from } + var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF); + if (mid == from) { return pred(mid) ? from : to } + if (pred(mid)) { to = mid; } + else { from = mid + dir; } + } + } + + // BIDI HELPERS + + function iterateBidiSections(order, from, to, f) { + if (!order) { return f(from, to, "ltr", 0) } + var found = false; + for (var i = 0; i < order.length; ++i) { + var part = order[i]; + if (part.from < to && part.to > from || from == to && part.to == from) { + f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr", i); + found = true; + } + } + if (!found) { f(from, to, "ltr"); } + } + + var bidiOther = null; + function getBidiPartAt(order, ch, sticky) { + var found; + bidiOther = null; + for (var i = 0; i < order.length; ++i) { + var cur = order[i]; + if (cur.from < ch && cur.to > ch) { return i } + if (cur.to == ch) { + if (cur.from != cur.to && sticky == "before") { found = i; } + else { bidiOther = i; } + } + if (cur.from == ch) { + if (cur.from != cur.to && sticky != "before") { found = i; } + else { bidiOther = i; } + } + } + return found != null ? found : bidiOther + } + + // Bidirectional ordering algorithm + // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm + // that this (partially) implements. + + // One-char codes used for character types: + // L (L): Left-to-Right + // R (R): Right-to-Left + // r (AL): Right-to-Left Arabic + // 1 (EN): European Number + // + (ES): European Number Separator + // % (ET): European Number Terminator + // n (AN): Arabic Number + // , (CS): Common Number Separator + // m (NSM): Non-Spacing Mark + // b (BN): Boundary Neutral + // s (B): Paragraph Separator + // t (S): Segment Separator + // w (WS): Whitespace + // N (ON): Other Neutrals + + // Returns null if characters are ordered as they appear + // (left-to-right), or an array of sections ({from, to, level} + // objects) in the order in which they occur visually. + var bidiOrdering = (function() { + // Character types for codepoints 0 to 0xff + var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN"; + // Character types for codepoints 0x600 to 0x6f9 + var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111"; + function charType(code) { + if (code <= 0xf7) { return lowTypes.charAt(code) } + else if (0x590 <= code && code <= 0x5f4) { return "R" } + else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) } + else if (0x6ee <= code && code <= 0x8ac) { return "r" } + else if (0x2000 <= code && code <= 0x200b) { return "w" } + else if (code == 0x200c) { return "b" } + else { return "L" } + } + + var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/; + var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/; + + function BidiSpan(level, from, to) { + this.level = level; + this.from = from; this.to = to; + } + + return function(str, direction) { + var outerType = direction == "ltr" ? "L" : "R"; + + if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false } + var len = str.length, types = []; + for (var i = 0; i < len; ++i) + { types.push(charType(str.charCodeAt(i))); } + + // W1. Examine each non-spacing mark (NSM) in the level run, and + // change the type of the NSM to the type of the previous + // character. If the NSM is at the start of the level run, it will + // get the type of sor. + for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) { + var type = types[i$1]; + if (type == "m") { types[i$1] = prev; } + else { prev = type; } + } + + // W2. Search backwards from each instance of a European number + // until the first strong type (R, L, AL, or sor) is found. If an + // AL is found, change the type of the European number to Arabic + // number. + // W3. Change all ALs to R. + for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) { + var type$1 = types[i$2]; + if (type$1 == "1" && cur == "r") { types[i$2] = "n"; } + else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } } + } + + // W4. A single European separator between two European numbers + // changes to a European number. A single common separator between + // two numbers of the same type changes to that type. + for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) { + var type$2 = types[i$3]; + if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; } + else if (type$2 == "," && prev$1 == types[i$3+1] && + (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; } + prev$1 = type$2; + } + + // W5. A sequence of European terminators adjacent to European + // numbers changes to all European numbers. + // W6. Otherwise, separators and terminators change to Other + // Neutral. + for (var i$4 = 0; i$4 < len; ++i$4) { + var type$3 = types[i$4]; + if (type$3 == ",") { types[i$4] = "N"; } + else if (type$3 == "%") { + var end = (void 0); + for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {} + var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N"; + for (var j = i$4; j < end; ++j) { types[j] = replace; } + i$4 = end - 1; + } + } + + // W7. Search backwards from each instance of a European number + // until the first strong type (R, L, or sor) is found. If an L is + // found, then change the type of the European number to L. + for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) { + var type$4 = types[i$5]; + if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; } + else if (isStrong.test(type$4)) { cur$1 = type$4; } + } + + // N1. A sequence of neutrals takes the direction of the + // surrounding strong text if the text on both sides has the same + // direction. European and Arabic numbers act as if they were R in + // terms of their influence on neutrals. Start-of-level-run (sor) + // and end-of-level-run (eor) are used at level run boundaries. + // N2. Any remaining neutrals take the embedding direction. + for (var i$6 = 0; i$6 < len; ++i$6) { + if (isNeutral.test(types[i$6])) { + var end$1 = (void 0); + for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {} + var before = (i$6 ? types[i$6-1] : outerType) == "L"; + var after = (end$1 < len ? types[end$1] : outerType) == "L"; + var replace$1 = before == after ? (before ? "L" : "R") : outerType; + for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; } + i$6 = end$1 - 1; + } + } + + // Here we depart from the documented algorithm, in order to avoid + // building up an actual levels array. Since there are only three + // levels (0, 1, 2) in an implementation that doesn't take + // explicit embedding into account, we can build up the order on + // the fly, without following the level-based algorithm. + var order = [], m; + for (var i$7 = 0; i$7 < len;) { + if (countsAsLeft.test(types[i$7])) { + var start = i$7; + for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {} + order.push(new BidiSpan(0, start, i$7)); + } else { + var pos = i$7, at = order.length, isRTL = direction == "rtl" ? 1 : 0; + for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {} + for (var j$2 = pos; j$2 < i$7;) { + if (countsAsNum.test(types[j$2])) { + if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); at += isRTL; } + var nstart = j$2; + for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {} + order.splice(at, 0, new BidiSpan(2, nstart, j$2)); + at += isRTL; + pos = j$2; + } else { ++j$2; } + } + if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); } + } + } + if (direction == "ltr") { + if (order[0].level == 1 && (m = str.match(/^\s+/))) { + order[0].from = m[0].length; + order.unshift(new BidiSpan(0, 0, m[0].length)); + } + if (lst(order).level == 1 && (m = str.match(/\s+$/))) { + lst(order).to -= m[0].length; + order.push(new BidiSpan(0, len - m[0].length, len)); + } + } + + return direction == "rtl" ? order.reverse() : order + } + })(); + + // Get the bidi ordering for the given line (and cache it). Returns + // false for lines that are fully left-to-right, and an array of + // BidiSpan objects otherwise. + function getOrder(line, direction) { + var order = line.order; + if (order == null) { order = line.order = bidiOrdering(line.text, direction); } + return order + } + + // EVENT HANDLING + + // Lightweight event framework. on/off also work on DOM nodes, + // registering native DOM handlers. + + var noHandlers = []; + + var on = function(emitter, type, f) { + if (emitter.addEventListener) { + emitter.addEventListener(type, f, false); + } else if (emitter.attachEvent) { + emitter.attachEvent("on" + type, f); + } else { + var map = emitter._handlers || (emitter._handlers = {}); + map[type] = (map[type] || noHandlers).concat(f); + } + }; + + function getHandlers(emitter, type) { + return emitter._handlers && emitter._handlers[type] || noHandlers + } + + function off(emitter, type, f) { + if (emitter.removeEventListener) { + emitter.removeEventListener(type, f, false); + } else if (emitter.detachEvent) { + emitter.detachEvent("on" + type, f); + } else { + var map = emitter._handlers, arr = map && map[type]; + if (arr) { + var index = indexOf(arr, f); + if (index > -1) + { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)); } + } + } + } + + function signal(emitter, type /*, values...*/) { + var handlers = getHandlers(emitter, type); + if (!handlers.length) { return } + var args = Array.prototype.slice.call(arguments, 2); + for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); } + } + + // The DOM events that CodeMirror handles can be overridden by + // registering a (non-DOM) handler on the editor for the event name, + // and preventDefault-ing the event in that handler. + function signalDOMEvent(cm, e, override) { + if (typeof e == "string") + { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; } + signal(cm, override || e.type, cm, e); + return e_defaultPrevented(e) || e.codemirrorIgnore + } + + function signalCursorActivity(cm) { + var arr = cm._handlers && cm._handlers.cursorActivity; + if (!arr) { return } + var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []); + for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1) + { set.push(arr[i]); } } + } + + function hasHandler(emitter, type) { + return getHandlers(emitter, type).length > 0 + } + + // Add on and off methods to a constructor's prototype, to make + // registering events on such objects more convenient. + function eventMixin(ctor) { + ctor.prototype.on = function(type, f) {on(this, type, f);}; + ctor.prototype.off = function(type, f) {off(this, type, f);}; + } + + // Due to the fact that we still support jurassic IE versions, some + // compatibility wrappers are needed. + + function e_preventDefault(e) { + if (e.preventDefault) { e.preventDefault(); } + else { e.returnValue = false; } + } + function e_stopPropagation(e) { + if (e.stopPropagation) { e.stopPropagation(); } + else { e.cancelBubble = true; } + } + function e_defaultPrevented(e) { + return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false + } + function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);} + + function e_target(e) {return e.target || e.srcElement} + function e_button(e) { + var b = e.which; + if (b == null) { + if (e.button & 1) { b = 1; } + else if (e.button & 2) { b = 3; } + else if (e.button & 4) { b = 2; } + } + if (mac && e.ctrlKey && b == 1) { b = 3; } + return b + } + + // Detect drag-and-drop + var dragAndDrop = function() { + // There is *some* kind of drag-and-drop support in IE6-8, but I + // couldn't get it to work yet. + if (ie && ie_version < 9) { return false } + var div = elt('div'); + return "draggable" in div || "dragDrop" in div + }(); + + var zwspSupported; + function zeroWidthElement(measure) { + if (zwspSupported == null) { + var test = elt("span", "\u200b"); + removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")])); + if (measure.firstChild.offsetHeight != 0) + { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); } + } + var node = zwspSupported ? elt("span", "\u200b") : + elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px"); + node.setAttribute("cm-text", ""); + return node + } + + // Feature-detect IE's crummy client rect reporting for bidi text + var badBidiRects; + function hasBadBidiRects(measure) { + if (badBidiRects != null) { return badBidiRects } + var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA")); + var r0 = range(txt, 0, 1).getBoundingClientRect(); + var r1 = range(txt, 1, 2).getBoundingClientRect(); + removeChildren(measure); + if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780) + return badBidiRects = (r1.right - r0.right < 3) + } + + // See if "".split is the broken IE version, if so, provide an + // alternative way to split lines. + var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) { + var pos = 0, result = [], l = string.length; + while (pos <= l) { + var nl = string.indexOf("\n", pos); + if (nl == -1) { nl = string.length; } + var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl); + var rt = line.indexOf("\r"); + if (rt != -1) { + result.push(line.slice(0, rt)); + pos += rt + 1; + } else { + result.push(line); + pos = nl + 1; + } + } + return result + } : function (string) { return string.split(/\r\n?|\n/); }; + + var hasSelection = window.getSelection ? function (te) { + try { return te.selectionStart != te.selectionEnd } + catch(e) { return false } + } : function (te) { + var range; + try {range = te.ownerDocument.selection.createRange();} + catch(e) {} + if (!range || range.parentElement() != te) { return false } + return range.compareEndPoints("StartToEnd", range) != 0 + }; + + var hasCopyEvent = (function () { + var e = elt("div"); + if ("oncopy" in e) { return true } + e.setAttribute("oncopy", "return;"); + return typeof e.oncopy == "function" + })(); + + var badZoomedRects = null; + function hasBadZoomedRects(measure) { + if (badZoomedRects != null) { return badZoomedRects } + var node = removeChildrenAndAdd(measure, elt("span", "x")); + var normal = node.getBoundingClientRect(); + var fromRange = range(node, 0, 1).getBoundingClientRect(); + return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1 + } + + // Known modes, by name and by MIME + var modes = {}, mimeModes = {}; + + // Extra arguments are stored as the mode's dependencies, which is + // used by (legacy) mechanisms like loadmode.js to automatically + // load a mode. (Preferred mechanism is the require/define calls.) + function defineMode(name, mode) { + if (arguments.length > 2) + { mode.dependencies = Array.prototype.slice.call(arguments, 2); } + modes[name] = mode; + } + + function defineMIME(mime, spec) { + mimeModes[mime] = spec; + } + + // Given a MIME type, a {name, ...options} config object, or a name + // string, return a mode config object. + function resolveMode(spec) { + if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) { + spec = mimeModes[spec]; + } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) { + var found = mimeModes[spec.name]; + if (typeof found == "string") { found = {name: found}; } + spec = createObj(found, spec); + spec.name = found.name; + } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) { + return resolveMode("application/xml") + } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) { + return resolveMode("application/json") + } + if (typeof spec == "string") { return {name: spec} } + else { return spec || {name: "null"} } + } + + // Given a mode spec (anything that resolveMode accepts), find and + // initialize an actual mode object. + function getMode(options, spec) { + spec = resolveMode(spec); + var mfactory = modes[spec.name]; + if (!mfactory) { return getMode(options, "text/plain") } + var modeObj = mfactory(options, spec); + if (modeExtensions.hasOwnProperty(spec.name)) { + var exts = modeExtensions[spec.name]; + for (var prop in exts) { + if (!exts.hasOwnProperty(prop)) { continue } + if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; } + modeObj[prop] = exts[prop]; + } + } + modeObj.name = spec.name; + if (spec.helperType) { modeObj.helperType = spec.helperType; } + if (spec.modeProps) { for (var prop$1 in spec.modeProps) + { modeObj[prop$1] = spec.modeProps[prop$1]; } } + + return modeObj + } + + // This can be used to attach properties to mode objects from + // outside the actual mode definition. + var modeExtensions = {}; + function extendMode(mode, properties) { + var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {}); + copyObj(properties, exts); + } + + function copyState(mode, state) { + if (state === true) { return state } + if (mode.copyState) { return mode.copyState(state) } + var nstate = {}; + for (var n in state) { + var val = state[n]; + if (val instanceof Array) { val = val.concat([]); } + nstate[n] = val; + } + return nstate + } + + // Given a mode and a state (for that mode), find the inner mode and + // state at the position that the state refers to. + function innerMode(mode, state) { + var info; + while (mode.innerMode) { + info = mode.innerMode(state); + if (!info || info.mode == mode) { break } + state = info.state; + mode = info.mode; + } + return info || {mode: mode, state: state} + } + + function startState(mode, a1, a2) { + return mode.startState ? mode.startState(a1, a2) : true + } + + // STRING STREAM + + // Fed to the mode parsers, provides helper functions to make + // parsers more succinct. + + var StringStream = function(string, tabSize, lineOracle) { + this.pos = this.start = 0; + this.string = string; + this.tabSize = tabSize || 8; + this.lastColumnPos = this.lastColumnValue = 0; + this.lineStart = 0; + this.lineOracle = lineOracle; + }; + + StringStream.prototype.eol = function () {return this.pos >= this.string.length}; + StringStream.prototype.sol = function () {return this.pos == this.lineStart}; + StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined}; + StringStream.prototype.next = function () { + if (this.pos < this.string.length) + { return this.string.charAt(this.pos++) } + }; + StringStream.prototype.eat = function (match) { + var ch = this.string.charAt(this.pos); + var ok; + if (typeof match == "string") { ok = ch == match; } + else { ok = ch && (match.test ? match.test(ch) : match(ch)); } + if (ok) {++this.pos; return ch} + }; + StringStream.prototype.eatWhile = function (match) { + var start = this.pos; + while (this.eat(match)){} + return this.pos > start + }; + StringStream.prototype.eatSpace = function () { + var start = this.pos; + while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this.pos; } + return this.pos > start + }; + StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;}; + StringStream.prototype.skipTo = function (ch) { + var found = this.string.indexOf(ch, this.pos); + if (found > -1) {this.pos = found; return true} + }; + StringStream.prototype.backUp = function (n) {this.pos -= n;}; + StringStream.prototype.column = function () { + if (this.lastColumnPos < this.start) { + this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue); + this.lastColumnPos = this.start; + } + return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0) + }; + StringStream.prototype.indentation = function () { + return countColumn(this.string, null, this.tabSize) - + (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0) + }; + StringStream.prototype.match = function (pattern, consume, caseInsensitive) { + if (typeof pattern == "string") { + var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; }; + var substr = this.string.substr(this.pos, pattern.length); + if (cased(substr) == cased(pattern)) { + if (consume !== false) { this.pos += pattern.length; } + return true + } + } else { + var match = this.string.slice(this.pos).match(pattern); + if (match && match.index > 0) { return null } + if (match && consume !== false) { this.pos += match[0].length; } + return match + } + }; + StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)}; + StringStream.prototype.hideFirstChars = function (n, inner) { + this.lineStart += n; + try { return inner() } + finally { this.lineStart -= n; } + }; + StringStream.prototype.lookAhead = function (n) { + var oracle = this.lineOracle; + return oracle && oracle.lookAhead(n) + }; + StringStream.prototype.baseToken = function () { + var oracle = this.lineOracle; + return oracle && oracle.baseToken(this.pos) + }; + + // Find the line object corresponding to the given line number. + function getLine(doc, n) { + n -= doc.first; + if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") } + var chunk = doc; + while (!chunk.lines) { + for (var i = 0;; ++i) { + var child = chunk.children[i], sz = child.chunkSize(); + if (n < sz) { chunk = child; break } + n -= sz; + } + } + return chunk.lines[n] + } + + // Get the part of a document between two positions, as an array of + // strings. + function getBetween(doc, start, end) { + var out = [], n = start.line; + doc.iter(start.line, end.line + 1, function (line) { + var text = line.text; + if (n == end.line) { text = text.slice(0, end.ch); } + if (n == start.line) { text = text.slice(start.ch); } + out.push(text); + ++n; + }); + return out + } + // Get the lines between from and to, as array of strings. + function getLines(doc, from, to) { + var out = []; + doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value + return out + } + + // Update the height of a line, propagating the height change + // upwards to parent nodes. + function updateLineHeight(line, height) { + var diff = height - line.height; + if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } } + } + + // Given a line object, find its line number by walking up through + // its parent links. + function lineNo(line) { + if (line.parent == null) { return null } + var cur = line.parent, no = indexOf(cur.lines, line); + for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { + for (var i = 0;; ++i) { + if (chunk.children[i] == cur) { break } + no += chunk.children[i].chunkSize(); + } + } + return no + cur.first + } + + // Find the line at the given vertical position, using the height + // information in the document tree. + function lineAtHeight(chunk, h) { + var n = chunk.first; + outer: do { + for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) { + var child = chunk.children[i$1], ch = child.height; + if (h < ch) { chunk = child; continue outer } + h -= ch; + n += child.chunkSize(); + } + return n + } while (!chunk.lines) + var i = 0; + for (; i < chunk.lines.length; ++i) { + var line = chunk.lines[i], lh = line.height; + if (h < lh) { break } + h -= lh; + } + return n + i + } + + function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size} + + function lineNumberFor(options, i) { + return String(options.lineNumberFormatter(i + options.firstLineNumber)) + } + + // A Pos instance represents a position within the text. + function Pos(line, ch, sticky) { + if ( sticky === void 0 ) sticky = null; + + if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) } + this.line = line; + this.ch = ch; + this.sticky = sticky; + } + + // Compare two positions, return 0 if they are the same, a negative + // number when a is less, and a positive number otherwise. + function cmp(a, b) { return a.line - b.line || a.ch - b.ch } + + function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 } + + function copyPos(x) {return Pos(x.line, x.ch)} + function maxPos(a, b) { return cmp(a, b) < 0 ? b : a } + function minPos(a, b) { return cmp(a, b) < 0 ? a : b } + + // Most of the external API clips given positions to make sure they + // actually exist within the document. + function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))} + function clipPos(doc, pos) { + if (pos.line < doc.first) { return Pos(doc.first, 0) } + var last = doc.first + doc.size - 1; + if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) } + return clipToLen(pos, getLine(doc, pos.line).text.length) + } + function clipToLen(pos, linelen) { + var ch = pos.ch; + if (ch == null || ch > linelen) { return Pos(pos.line, linelen) } + else if (ch < 0) { return Pos(pos.line, 0) } + else { return pos } + } + function clipPosArray(doc, array) { + var out = []; + for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); } + return out + } + + var SavedContext = function(state, lookAhead) { + this.state = state; + this.lookAhead = lookAhead; + }; + + var Context = function(doc, state, line, lookAhead) { + this.state = state; + this.doc = doc; + this.line = line; + this.maxLookAhead = lookAhead || 0; + this.baseTokens = null; + this.baseTokenPos = 1; + }; + + Context.prototype.lookAhead = function (n) { + var line = this.doc.getLine(this.line + n); + if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n; } + return line + }; + + Context.prototype.baseToken = function (n) { + if (!this.baseTokens) { return null } + while (this.baseTokens[this.baseTokenPos] <= n) + { this.baseTokenPos += 2; } + var type = this.baseTokens[this.baseTokenPos + 1]; + return {type: type && type.replace(/( |^)overlay .*/, ""), + size: this.baseTokens[this.baseTokenPos] - n} + }; + + Context.prototype.nextLine = function () { + this.line++; + if (this.maxLookAhead > 0) { this.maxLookAhead--; } + }; + + Context.fromSaved = function (doc, saved, line) { + if (saved instanceof SavedContext) + { return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) } + else + { return new Context(doc, copyState(doc.mode, saved), line) } + }; + + Context.prototype.save = function (copy) { + var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state; + return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state + }; + + + // Compute a style array (an array starting with a mode generation + // -- for invalidation -- followed by pairs of end positions and + // style strings), which is used to highlight the tokens on the + // line. + function highlightLine(cm, line, context, forceToEnd) { + // A styles array always starts with a number identifying the + // mode/overlays that it is based on (for easy invalidation). + var st = [cm.state.modeGen], lineClasses = {}; + // Compute the base array of styles + runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); }, + lineClasses, forceToEnd); + var state = context.state; + + // Run overlays, adjust style array. + var loop = function ( o ) { + context.baseTokens = st; + var overlay = cm.state.overlays[o], i = 1, at = 0; + context.state = true; + runMode(cm, line.text, overlay.mode, context, function (end, style) { + var start = i; + // Ensure there's a token end at the current position, and that i points at it + while (at < end) { + var i_end = st[i]; + if (i_end > end) + { st.splice(i, 1, end, st[i+1], i_end); } + i += 2; + at = Math.min(end, i_end); + } + if (!style) { return } + if (overlay.opaque) { + st.splice(start, i - start, end, "overlay " + style); + i = start + 2; + } else { + for (; start < i; start += 2) { + var cur = st[start+1]; + st[start+1] = (cur ? cur + " " : "") + "overlay " + style; + } + } + }, lineClasses); + context.state = state; + context.baseTokens = null; + context.baseTokenPos = 1; + }; + + for (var o = 0; o < cm.state.overlays.length; ++o) loop( o ); + + return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null} + } + + function getLineStyles(cm, line, updateFrontier) { + if (!line.styles || line.styles[0] != cm.state.modeGen) { + var context = getContextBefore(cm, lineNo(line)); + var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state); + var result = highlightLine(cm, line, context); + if (resetState) { context.state = resetState; } + line.stateAfter = context.save(!resetState); + line.styles = result.styles; + if (result.classes) { line.styleClasses = result.classes; } + else if (line.styleClasses) { line.styleClasses = null; } + if (updateFrontier === cm.doc.highlightFrontier) + { cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier); } + } + return line.styles + } + + function getContextBefore(cm, n, precise) { + var doc = cm.doc, display = cm.display; + if (!doc.mode.startState) { return new Context(doc, true, n) } + var start = findStartLine(cm, n, precise); + var saved = start > doc.first && getLine(doc, start - 1).stateAfter; + var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start); + + doc.iter(start, n, function (line) { + processLine(cm, line.text, context); + var pos = context.line; + line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null; + context.nextLine(); + }); + if (precise) { doc.modeFrontier = context.line; } + return context + } + + // Lightweight form of highlight -- proceed over this line and + // update state, but don't save a style array. Used for lines that + // aren't currently visible. + function processLine(cm, text, context, startAt) { + var mode = cm.doc.mode; + var stream = new StringStream(text, cm.options.tabSize, context); + stream.start = stream.pos = startAt || 0; + if (text == "") { callBlankLine(mode, context.state); } + while (!stream.eol()) { + readToken(mode, stream, context.state); + stream.start = stream.pos; + } + } + + function callBlankLine(mode, state) { + if (mode.blankLine) { return mode.blankLine(state) } + if (!mode.innerMode) { return } + var inner = innerMode(mode, state); + if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) } + } + + function readToken(mode, stream, state, inner) { + for (var i = 0; i < 10; i++) { + if (inner) { inner[0] = innerMode(mode, state).mode; } + var style = mode.token(stream, state); + if (stream.pos > stream.start) { return style } + } + throw new Error("Mode " + mode.name + " failed to advance stream.") + } + + var Token = function(stream, type, state) { + this.start = stream.start; this.end = stream.pos; + this.string = stream.current(); + this.type = type || null; + this.state = state; + }; + + // Utility for getTokenAt and getLineTokens + function takeToken(cm, pos, precise, asArray) { + var doc = cm.doc, mode = doc.mode, style; + pos = clipPos(doc, pos); + var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise); + var stream = new StringStream(line.text, cm.options.tabSize, context), tokens; + if (asArray) { tokens = []; } + while ((asArray || stream.pos < pos.ch) && !stream.eol()) { + stream.start = stream.pos; + style = readToken(mode, stream, context.state); + if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); } + } + return asArray ? tokens : new Token(stream, style, context.state) + } + + function extractLineClasses(type, output) { + if (type) { for (;;) { + var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/); + if (!lineClass) { break } + type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length); + var prop = lineClass[1] ? "bgClass" : "textClass"; + if (output[prop] == null) + { output[prop] = lineClass[2]; } + else if (!(new RegExp("(?:^|\\s)" + lineClass[2] + "(?:$|\\s)")).test(output[prop])) + { output[prop] += " " + lineClass[2]; } + } } + return type + } + + // Run the given mode's parser over a line, calling f for each token. + function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) { + var flattenSpans = mode.flattenSpans; + if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; } + var curStart = 0, curStyle = null; + var stream = new StringStream(text, cm.options.tabSize, context), style; + var inner = cm.options.addModeClass && [null]; + if (text == "") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); } + while (!stream.eol()) { + if (stream.pos > cm.options.maxHighlightLength) { + flattenSpans = false; + if (forceToEnd) { processLine(cm, text, context, stream.pos); } + stream.pos = text.length; + style = null; + } else { + style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses); + } + if (inner) { + var mName = inner[0].name; + if (mName) { style = "m-" + (style ? mName + " " + style : mName); } + } + if (!flattenSpans || curStyle != style) { + while (curStart < stream.start) { + curStart = Math.min(stream.start, curStart + 5000); + f(curStart, curStyle); + } + curStyle = style; + } + stream.start = stream.pos; + } + while (curStart < stream.pos) { + // Webkit seems to refuse to render text nodes longer than 57444 + // characters, and returns inaccurate measurements in nodes + // starting around 5000 chars. + var pos = Math.min(stream.pos, curStart + 5000); + f(pos, curStyle); + curStart = pos; + } + } + + // Finds the line to start with when starting a parse. Tries to + // find a line with a stateAfter, so that it can start with a + // valid state. If that fails, it returns the line with the + // smallest indentation, which tends to need the least context to + // parse correctly. + function findStartLine(cm, n, precise) { + var minindent, minline, doc = cm.doc; + var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100); + for (var search = n; search > lim; --search) { + if (search <= doc.first) { return doc.first } + var line = getLine(doc, search - 1), after = line.stateAfter; + if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier)) + { return search } + var indented = countColumn(line.text, null, cm.options.tabSize); + if (minline == null || minindent > indented) { + minline = search - 1; + minindent = indented; + } + } + return minline + } + + function retreatFrontier(doc, n) { + doc.modeFrontier = Math.min(doc.modeFrontier, n); + if (doc.highlightFrontier < n - 10) { return } + var start = doc.first; + for (var line = n - 1; line > start; line--) { + var saved = getLine(doc, line).stateAfter; + // change is on 3 + // state on line 1 looked ahead 2 -- so saw 3 + // test 1 + 2 < 3 should cover this + if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) { + start = line + 1; + break + } + } + doc.highlightFrontier = Math.min(doc.highlightFrontier, start); + } + + // Optimize some code when these features are not used. + var sawReadOnlySpans = false, sawCollapsedSpans = false; + + function seeReadOnlySpans() { + sawReadOnlySpans = true; + } + + function seeCollapsedSpans() { + sawCollapsedSpans = true; + } + + // TEXTMARKER SPANS + + function MarkedSpan(marker, from, to) { + this.marker = marker; + this.from = from; this.to = to; + } + + // Search an array of spans for a span matching the given marker. + function getMarkedSpanFor(spans, marker) { + if (spans) { for (var i = 0; i < spans.length; ++i) { + var span = spans[i]; + if (span.marker == marker) { return span } + } } + } + // Remove a span from an array, returning undefined if no spans are + // left (we don't store arrays for lines without spans). + function removeMarkedSpan(spans, span) { + var r; + for (var i = 0; i < spans.length; ++i) + { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } } + return r + } + // Add a span to a line. + function addMarkedSpan(line, span) { + line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]; + span.marker.attachLine(line); + } + + // Used for the algorithm that adjusts markers for a change in the + // document. These functions cut an array of spans at a given + // character position, returning an array of remaining chunks (or + // undefined if nothing remains). + function markedSpansBefore(old, startCh, isInsert) { + var nw; + if (old) { for (var i = 0; i < old.length; ++i) { + var span = old[i], marker = span.marker; + var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh); + if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) { + var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh) + ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to)); + } + } } + return nw + } + function markedSpansAfter(old, endCh, isInsert) { + var nw; + if (old) { for (var i = 0; i < old.length; ++i) { + var span = old[i], marker = span.marker; + var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh); + if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) { + var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh) + ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh, + span.to == null ? null : span.to - endCh)); + } + } } + return nw + } + + // Given a change object, compute the new set of marker spans that + // cover the line in which the change took place. Removes spans + // entirely within the change, reconnects spans belonging to the + // same marker that appear on both sides of the change, and cuts off + // spans partially within the change. Returns an array of span + // arrays with one element for each line in (after) the change. + function stretchSpansOverChange(doc, change) { + if (change.full) { return null } + var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans; + var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans; + if (!oldFirst && !oldLast) { return null } + + var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0; + // Get the spans that 'stick out' on both sides + var first = markedSpansBefore(oldFirst, startCh, isInsert); + var last = markedSpansAfter(oldLast, endCh, isInsert); + + // Next, merge those two ends + var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0); + if (first) { + // Fix up .to properties of first + for (var i = 0; i < first.length; ++i) { + var span = first[i]; + if (span.to == null) { + var found = getMarkedSpanFor(last, span.marker); + if (!found) { span.to = startCh; } + else if (sameLine) { span.to = found.to == null ? null : found.to + offset; } + } + } + } + if (last) { + // Fix up .from in last (or move them into first in case of sameLine) + for (var i$1 = 0; i$1 < last.length; ++i$1) { + var span$1 = last[i$1]; + if (span$1.to != null) { span$1.to += offset; } + if (span$1.from == null) { + var found$1 = getMarkedSpanFor(first, span$1.marker); + if (!found$1) { + span$1.from = offset; + if (sameLine) { (first || (first = [])).push(span$1); } + } + } else { + span$1.from += offset; + if (sameLine) { (first || (first = [])).push(span$1); } + } + } + } + // Make sure we didn't create any zero-length spans + if (first) { first = clearEmptySpans(first); } + if (last && last != first) { last = clearEmptySpans(last); } + + var newMarkers = [first]; + if (!sameLine) { + // Fill gap with whole-line-spans + var gap = change.text.length - 2, gapMarkers; + if (gap > 0 && first) + { for (var i$2 = 0; i$2 < first.length; ++i$2) + { if (first[i$2].to == null) + { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } } + for (var i$3 = 0; i$3 < gap; ++i$3) + { newMarkers.push(gapMarkers); } + newMarkers.push(last); + } + return newMarkers + } + + // Remove spans that are empty and don't have a clearWhenEmpty + // option of false. + function clearEmptySpans(spans) { + for (var i = 0; i < spans.length; ++i) { + var span = spans[i]; + if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false) + { spans.splice(i--, 1); } + } + if (!spans.length) { return null } + return spans + } + + // Used to 'clip' out readOnly ranges when making a change. + function removeReadOnlyRanges(doc, from, to) { + var markers = null; + doc.iter(from.line, to.line + 1, function (line) { + if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) { + var mark = line.markedSpans[i].marker; + if (mark.readOnly && (!markers || indexOf(markers, mark) == -1)) + { (markers || (markers = [])).push(mark); } + } } + }); + if (!markers) { return null } + var parts = [{from: from, to: to}]; + for (var i = 0; i < markers.length; ++i) { + var mk = markers[i], m = mk.find(0); + for (var j = 0; j < parts.length; ++j) { + var p = parts[j]; + if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue } + var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to); + if (dfrom < 0 || !mk.inclusiveLeft && !dfrom) + { newParts.push({from: p.from, to: m.from}); } + if (dto > 0 || !mk.inclusiveRight && !dto) + { newParts.push({from: m.to, to: p.to}); } + parts.splice.apply(parts, newParts); + j += newParts.length - 3; + } + } + return parts + } + + // Connect or disconnect spans from a line. + function detachMarkedSpans(line) { + var spans = line.markedSpans; + if (!spans) { return } + for (var i = 0; i < spans.length; ++i) + { spans[i].marker.detachLine(line); } + line.markedSpans = null; + } + function attachMarkedSpans(line, spans) { + if (!spans) { return } + for (var i = 0; i < spans.length; ++i) + { spans[i].marker.attachLine(line); } + line.markedSpans = spans; + } + + // Helpers used when computing which overlapping collapsed span + // counts as the larger one. + function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 } + function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 } + + // Returns a number indicating which of two overlapping collapsed + // spans is larger (and thus includes the other). Falls back to + // comparing ids when the spans cover exactly the same range. + function compareCollapsedMarkers(a, b) { + var lenDiff = a.lines.length - b.lines.length; + if (lenDiff != 0) { return lenDiff } + var aPos = a.find(), bPos = b.find(); + var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b); + if (fromCmp) { return -fromCmp } + var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b); + if (toCmp) { return toCmp } + return b.id - a.id + } + + // Find out whether a line ends or starts in a collapsed span. If + // so, return the marker for that span. + function collapsedSpanAtSide(line, start) { + var sps = sawCollapsedSpans && line.markedSpans, found; + if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) { + sp = sps[i]; + if (sp.marker.collapsed && (start ? sp.from : sp.to) == null && + (!found || compareCollapsedMarkers(found, sp.marker) < 0)) + { found = sp.marker; } + } } + return found + } + function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) } + function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) } + + function collapsedSpanAround(line, ch) { + var sps = sawCollapsedSpans && line.markedSpans, found; + if (sps) { for (var i = 0; i < sps.length; ++i) { + var sp = sps[i]; + if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) && + (!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker; } + } } + return found + } + + // Test whether there exists a collapsed span that partially + // overlaps (covers the start or end, but not both) of a new span. + // Such overlap is not allowed. + function conflictingCollapsedRange(doc, lineNo, from, to, marker) { + var line = getLine(doc, lineNo); + var sps = sawCollapsedSpans && line.markedSpans; + if (sps) { for (var i = 0; i < sps.length; ++i) { + var sp = sps[i]; + if (!sp.marker.collapsed) { continue } + var found = sp.marker.find(0); + var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker); + var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker); + if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue } + if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) || + fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0)) + { return true } + } } + } + + // A visual line is a line as drawn on the screen. Folding, for + // example, can cause multiple logical lines to appear on the same + // visual line. This finds the start of the visual line that the + // given line is part of (usually that is the line itself). + function visualLine(line) { + var merged; + while (merged = collapsedSpanAtStart(line)) + { line = merged.find(-1, true).line; } + return line + } + + function visualLineEnd(line) { + var merged; + while (merged = collapsedSpanAtEnd(line)) + { line = merged.find(1, true).line; } + return line + } + + // Returns an array of logical lines that continue the visual line + // started by the argument, or undefined if there are no such lines. + function visualLineContinued(line) { + var merged, lines; + while (merged = collapsedSpanAtEnd(line)) { + line = merged.find(1, true).line + ;(lines || (lines = [])).push(line); + } + return lines + } + + // Get the line number of the start of the visual line that the + // given line number is part of. + function visualLineNo(doc, lineN) { + var line = getLine(doc, lineN), vis = visualLine(line); + if (line == vis) { return lineN } + return lineNo(vis) + } + + // Get the line number of the start of the next visual line after + // the given line. + function visualLineEndNo(doc, lineN) { + if (lineN > doc.lastLine()) { return lineN } + var line = getLine(doc, lineN), merged; + if (!lineIsHidden(doc, line)) { return lineN } + while (merged = collapsedSpanAtEnd(line)) + { line = merged.find(1, true).line; } + return lineNo(line) + 1 + } + + // Compute whether a line is hidden. Lines count as hidden when they + // are part of a visual line that starts with another line, or when + // they are entirely covered by collapsed, non-widget span. + function lineIsHidden(doc, line) { + var sps = sawCollapsedSpans && line.markedSpans; + if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) { + sp = sps[i]; + if (!sp.marker.collapsed) { continue } + if (sp.from == null) { return true } + if (sp.marker.widgetNode) { continue } + if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp)) + { return true } + } } + } + function lineIsHiddenInner(doc, line, span) { + if (span.to == null) { + var end = span.marker.find(1, true); + return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker)) + } + if (span.marker.inclusiveRight && span.to == line.text.length) + { return true } + for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) { + sp = line.markedSpans[i]; + if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to && + (sp.to == null || sp.to != span.from) && + (sp.marker.inclusiveLeft || span.marker.inclusiveRight) && + lineIsHiddenInner(doc, line, sp)) { return true } + } + } + + // Find the height above the given line. + function heightAtLine(lineObj) { + lineObj = visualLine(lineObj); + + var h = 0, chunk = lineObj.parent; + for (var i = 0; i < chunk.lines.length; ++i) { + var line = chunk.lines[i]; + if (line == lineObj) { break } + else { h += line.height; } + } + for (var p = chunk.parent; p; chunk = p, p = chunk.parent) { + for (var i$1 = 0; i$1 < p.children.length; ++i$1) { + var cur = p.children[i$1]; + if (cur == chunk) { break } + else { h += cur.height; } + } + } + return h + } + + // Compute the character length of a line, taking into account + // collapsed ranges (see markText) that might hide parts, and join + // other lines onto it. + function lineLength(line) { + if (line.height == 0) { return 0 } + var len = line.text.length, merged, cur = line; + while (merged = collapsedSpanAtStart(cur)) { + var found = merged.find(0, true); + cur = found.from.line; + len += found.from.ch - found.to.ch; + } + cur = line; + while (merged = collapsedSpanAtEnd(cur)) { + var found$1 = merged.find(0, true); + len -= cur.text.length - found$1.from.ch; + cur = found$1.to.line; + len += cur.text.length - found$1.to.ch; + } + return len + } + + // Find the longest line in the document. + function findMaxLine(cm) { + var d = cm.display, doc = cm.doc; + d.maxLine = getLine(doc, doc.first); + d.maxLineLength = lineLength(d.maxLine); + d.maxLineChanged = true; + doc.iter(function (line) { + var len = lineLength(line); + if (len > d.maxLineLength) { + d.maxLineLength = len; + d.maxLine = line; + } + }); + } + + // LINE DATA STRUCTURE + + // Line objects. These hold state related to a line, including + // highlighting info (the styles array). + var Line = function(text, markedSpans, estimateHeight) { + this.text = text; + attachMarkedSpans(this, markedSpans); + this.height = estimateHeight ? estimateHeight(this) : 1; + }; + + Line.prototype.lineNo = function () { return lineNo(this) }; + eventMixin(Line); + + // Change the content (text, markers) of a line. Automatically + // invalidates cached information and tries to re-estimate the + // line's height. + function updateLine(line, text, markedSpans, estimateHeight) { + line.text = text; + if (line.stateAfter) { line.stateAfter = null; } + if (line.styles) { line.styles = null; } + if (line.order != null) { line.order = null; } + detachMarkedSpans(line); + attachMarkedSpans(line, markedSpans); + var estHeight = estimateHeight ? estimateHeight(line) : 1; + if (estHeight != line.height) { updateLineHeight(line, estHeight); } + } + + // Detach a line from the document tree and its markers. + function cleanUpLine(line) { + line.parent = null; + detachMarkedSpans(line); + } + + // Convert a style as returned by a mode (either null, or a string + // containing one or more styles) to a CSS style. This is cached, + // and also looks for line-wide styles. + var styleToClassCache = {}, styleToClassCacheWithMode = {}; + function interpretTokenStyle(style, options) { + if (!style || /^\s*$/.test(style)) { return null } + var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache; + return cache[style] || + (cache[style] = style.replace(/\S+/g, "cm-$&")) + } + + // Render the DOM representation of the text of a line. Also builds + // up a 'line map', which points at the DOM nodes that represent + // specific stretches of text, and is used by the measuring code. + // The returned object contains the DOM node, this map, and + // information about line-wide styles that were set by the mode. + function buildLineContent(cm, lineView) { + // The padding-right forces the element to have a 'border', which + // is needed on Webkit to be able to get line-level bounding + // rectangles for it (in measureChar). + var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null); + var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content, + col: 0, pos: 0, cm: cm, + trailingSpace: false, + splitSpaces: cm.getOption("lineWrapping")}; + lineView.measure = {}; + + // Iterate over the logical lines that make up this visual line. + for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) { + var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0); + builder.pos = 0; + builder.addToken = buildToken; + // Optionally wire in some hacks into the token-rendering + // algorithm, to deal with browser quirks. + if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction))) + { builder.addToken = buildTokenBadBidi(builder.addToken, order); } + builder.map = []; + var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line); + insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate)); + if (line.styleClasses) { + if (line.styleClasses.bgClass) + { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); } + if (line.styleClasses.textClass) + { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); } + } + + // Ensure at least a single node is present, for measuring. + if (builder.map.length == 0) + { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); } + + // Store the map and a cache object for the current logical line + if (i == 0) { + lineView.measure.map = builder.map; + lineView.measure.cache = {}; + } else { + (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map) + ;(lineView.measure.caches || (lineView.measure.caches = [])).push({}); + } + } + + // See issue #2901 + if (webkit) { + var last = builder.content.lastChild; + if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab"))) + { builder.content.className = "cm-tab-wrap-hack"; } + } + + signal(cm, "renderLine", cm, lineView.line, builder.pre); + if (builder.pre.className) + { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); } + + return builder + } + + function defaultSpecialCharPlaceholder(ch) { + var token = elt("span", "\u2022", "cm-invalidchar"); + token.title = "\\u" + ch.charCodeAt(0).toString(16); + token.setAttribute("aria-label", token.title); + return token + } + + // Build up the DOM representation for a single token, and add it to + // the line map. Takes care to render special characters separately. + function buildToken(builder, text, style, startStyle, endStyle, css, attributes) { + if (!text) { return } + var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text; + var special = builder.cm.state.specialChars, mustWrap = false; + var content; + if (!special.test(text)) { + builder.col += text.length; + content = document.createTextNode(displayText); + builder.map.push(builder.pos, builder.pos + text.length, content); + if (ie && ie_version < 9) { mustWrap = true; } + builder.pos += text.length; + } else { + content = document.createDocumentFragment(); + var pos = 0; + while (true) { + special.lastIndex = pos; + var m = special.exec(text); + var skipped = m ? m.index - pos : text.length - pos; + if (skipped) { + var txt = document.createTextNode(displayText.slice(pos, pos + skipped)); + if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); } + else { content.appendChild(txt); } + builder.map.push(builder.pos, builder.pos + skipped, txt); + builder.col += skipped; + builder.pos += skipped; + } + if (!m) { break } + pos += skipped + 1; + var txt$1 = (void 0); + if (m[0] == "\t") { + var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize; + txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab")); + txt$1.setAttribute("role", "presentation"); + txt$1.setAttribute("cm-text", "\t"); + builder.col += tabWidth; + } else if (m[0] == "\r" || m[0] == "\n") { + txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar")); + txt$1.setAttribute("cm-text", m[0]); + builder.col += 1; + } else { + txt$1 = builder.cm.options.specialCharPlaceholder(m[0]); + txt$1.setAttribute("cm-text", m[0]); + if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); } + else { content.appendChild(txt$1); } + builder.col += 1; + } + builder.map.push(builder.pos, builder.pos + 1, txt$1); + builder.pos++; + } + } + builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32; + if (style || startStyle || endStyle || mustWrap || css || attributes) { + var fullStyle = style || ""; + if (startStyle) { fullStyle += startStyle; } + if (endStyle) { fullStyle += endStyle; } + var token = elt("span", [content], fullStyle, css); + if (attributes) { + for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != "style" && attr != "class") + { token.setAttribute(attr, attributes[attr]); } } + } + return builder.content.appendChild(token) + } + builder.content.appendChild(content); + } + + // Change some spaces to NBSP to prevent the browser from collapsing + // trailing spaces at the end of a line when rendering text (issue #1362). + function splitSpaces(text, trailingBefore) { + if (text.length > 1 && !/ /.test(text)) { return text } + var spaceBefore = trailingBefore, result = ""; + for (var i = 0; i < text.length; i++) { + var ch = text.charAt(i); + if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32)) + { ch = "\u00a0"; } + result += ch; + spaceBefore = ch == " "; + } + return result + } + + // Work around nonsense dimensions being reported for stretches of + // right-to-left text. + function buildTokenBadBidi(inner, order) { + return function (builder, text, style, startStyle, endStyle, css, attributes) { + style = style ? style + " cm-force-border" : "cm-force-border"; + var start = builder.pos, end = start + text.length; + for (;;) { + // Find the part that overlaps with the start of this text + var part = (void 0); + for (var i = 0; i < order.length; i++) { + part = order[i]; + if (part.to > start && part.from <= start) { break } + } + if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, css, attributes) } + inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes); + startStyle = null; + text = text.slice(part.to - start); + start = part.to; + } + } + } + + function buildCollapsedSpan(builder, size, marker, ignoreWidget) { + var widget = !ignoreWidget && marker.widgetNode; + if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); } + if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) { + if (!widget) + { widget = builder.content.appendChild(document.createElement("span")); } + widget.setAttribute("cm-marker", marker.id); + } + if (widget) { + builder.cm.display.input.setUneditable(widget); + builder.content.appendChild(widget); + } + builder.pos += size; + builder.trailingSpace = false; + } + + // Outputs a number of spans to make up a line, taking highlighting + // and marked text into account. + function insertLineContent(line, builder, styles) { + var spans = line.markedSpans, allText = line.text, at = 0; + if (!spans) { + for (var i$1 = 1; i$1 < styles.length; i$1+=2) + { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); } + return + } + + var len = allText.length, pos = 0, i = 1, text = "", style, css; + var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes; + for (;;) { + if (nextChange == pos) { // Update current marker set + spanStyle = spanEndStyle = spanStartStyle = css = ""; + attributes = null; + collapsed = null; nextChange = Infinity; + var foundBookmarks = [], endStyles = (void 0); + for (var j = 0; j < spans.length; ++j) { + var sp = spans[j], m = sp.marker; + if (m.type == "bookmark" && sp.from == pos && m.widgetNode) { + foundBookmarks.push(m); + } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) { + if (sp.to != null && sp.to != pos && nextChange > sp.to) { + nextChange = sp.to; + spanEndStyle = ""; + } + if (m.className) { spanStyle += " " + m.className; } + if (m.css) { css = (css ? css + ";" : "") + m.css; } + if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; } + if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); } + // support for the old title property + // https://github.com/codemirror/CodeMirror/pull/5673 + if (m.title) { (attributes || (attributes = {})).title = m.title; } + if (m.attributes) { + for (var attr in m.attributes) + { (attributes || (attributes = {}))[attr] = m.attributes[attr]; } + } + if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)) + { collapsed = sp; } + } else if (sp.from > pos && nextChange > sp.from) { + nextChange = sp.from; + } + } + if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2) + { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } } + + if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2) + { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } } + if (collapsed && (collapsed.from || 0) == pos) { + buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos, + collapsed.marker, collapsed.from == null); + if (collapsed.to == null) { return } + if (collapsed.to == pos) { collapsed = false; } + } + } + if (pos >= len) { break } + + var upto = Math.min(len, nextChange); + while (true) { + if (text) { + var end = pos + text.length; + if (!collapsed) { + var tokenText = end > upto ? text.slice(0, upto - pos) : text; + builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle, + spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", css, attributes); + } + if (end >= upto) {text = text.slice(upto - pos); pos = upto; break} + pos = end; + spanStartStyle = ""; + } + text = allText.slice(at, at = styles[i++]); + style = interpretTokenStyle(styles[i++], builder.cm.options); + } + } + } + + + // These objects are used to represent the visible (currently drawn) + // part of the document. A LineView may correspond to multiple + // logical lines, if those are connected by collapsed ranges. + function LineView(doc, line, lineN) { + // The starting line + this.line = line; + // Continuing lines, if any + this.rest = visualLineContinued(line); + // Number of logical lines in this visual line + this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1; + this.node = this.text = null; + this.hidden = lineIsHidden(doc, line); + } + + // Create a range of LineView objects for the given lines. + function buildViewArray(cm, from, to) { + var array = [], nextPos; + for (var pos = from; pos < to; pos = nextPos) { + var view = new LineView(cm.doc, getLine(cm.doc, pos), pos); + nextPos = pos + view.size; + array.push(view); + } + return array + } + + var operationGroup = null; + + function pushOperation(op) { + if (operationGroup) { + operationGroup.ops.push(op); + } else { + op.ownsGroup = operationGroup = { + ops: [op], + delayedCallbacks: [] + }; + } + } + + function fireCallbacksForOps(group) { + // Calls delayed callbacks and cursorActivity handlers until no + // new ones appear + var callbacks = group.delayedCallbacks, i = 0; + do { + for (; i < callbacks.length; i++) + { callbacks[i].call(null); } + for (var j = 0; j < group.ops.length; j++) { + var op = group.ops[j]; + if (op.cursorActivityHandlers) + { while (op.cursorActivityCalled < op.cursorActivityHandlers.length) + { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } } + } + } while (i < callbacks.length) + } + + function finishOperation(op, endCb) { + var group = op.ownsGroup; + if (!group) { return } + + try { fireCallbacksForOps(group); } + finally { + operationGroup = null; + endCb(group); + } + } + + var orphanDelayedCallbacks = null; + + // Often, we want to signal events at a point where we are in the + // middle of some work, but don't want the handler to start calling + // other methods on the editor, which might be in an inconsistent + // state or simply not expect any other events to happen. + // signalLater looks whether there are any handlers, and schedules + // them to be executed when the last operation ends, or, if no + // operation is active, when a timeout fires. + function signalLater(emitter, type /*, values...*/) { + var arr = getHandlers(emitter, type); + if (!arr.length) { return } + var args = Array.prototype.slice.call(arguments, 2), list; + if (operationGroup) { + list = operationGroup.delayedCallbacks; + } else if (orphanDelayedCallbacks) { + list = orphanDelayedCallbacks; + } else { + list = orphanDelayedCallbacks = []; + setTimeout(fireOrphanDelayed, 0); + } + var loop = function ( i ) { + list.push(function () { return arr[i].apply(null, args); }); + }; + + for (var i = 0; i < arr.length; ++i) + loop( i ); + } + + function fireOrphanDelayed() { + var delayed = orphanDelayedCallbacks; + orphanDelayedCallbacks = null; + for (var i = 0; i < delayed.length; ++i) { delayed[i](); } + } + + // When an aspect of a line changes, a string is added to + // lineView.changes. This updates the relevant part of the line's + // DOM structure. + function updateLineForChanges(cm, lineView, lineN, dims) { + for (var j = 0; j < lineView.changes.length; j++) { + var type = lineView.changes[j]; + if (type == "text") { updateLineText(cm, lineView); } + else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); } + else if (type == "class") { updateLineClasses(cm, lineView); } + else if (type == "widget") { updateLineWidgets(cm, lineView, dims); } + } + lineView.changes = null; + } + + // Lines with gutter elements, widgets or a background class need to + // be wrapped, and have the extra elements added to the wrapper div + function ensureLineWrapped(lineView) { + if (lineView.node == lineView.text) { + lineView.node = elt("div", null, null, "position: relative"); + if (lineView.text.parentNode) + { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); } + lineView.node.appendChild(lineView.text); + if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; } + } + return lineView.node + } + + function updateLineBackground(cm, lineView) { + var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass; + if (cls) { cls += " CodeMirror-linebackground"; } + if (lineView.background) { + if (cls) { lineView.background.className = cls; } + else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; } + } else if (cls) { + var wrap = ensureLineWrapped(lineView); + lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild); + cm.display.input.setUneditable(lineView.background); + } + } + + // Wrapper around buildLineContent which will reuse the structure + // in display.externalMeasured when possible. + function getLineContent(cm, lineView) { + var ext = cm.display.externalMeasured; + if (ext && ext.line == lineView.line) { + cm.display.externalMeasured = null; + lineView.measure = ext.measure; + return ext.built + } + return buildLineContent(cm, lineView) + } + + // Redraw the line's text. Interacts with the background and text + // classes because the mode may output tokens that influence these + // classes. + function updateLineText(cm, lineView) { + var cls = lineView.text.className; + var built = getLineContent(cm, lineView); + if (lineView.text == lineView.node) { lineView.node = built.pre; } + lineView.text.parentNode.replaceChild(built.pre, lineView.text); + lineView.text = built.pre; + if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) { + lineView.bgClass = built.bgClass; + lineView.textClass = built.textClass; + updateLineClasses(cm, lineView); + } else if (cls) { + lineView.text.className = cls; + } + } + + function updateLineClasses(cm, lineView) { + updateLineBackground(cm, lineView); + if (lineView.line.wrapClass) + { ensureLineWrapped(lineView).className = lineView.line.wrapClass; } + else if (lineView.node != lineView.text) + { lineView.node.className = ""; } + var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass; + lineView.text.className = textClass || ""; + } + + function updateLineGutter(cm, lineView, lineN, dims) { + if (lineView.gutter) { + lineView.node.removeChild(lineView.gutter); + lineView.gutter = null; + } + if (lineView.gutterBackground) { + lineView.node.removeChild(lineView.gutterBackground); + lineView.gutterBackground = null; + } + if (lineView.line.gutterClass) { + var wrap = ensureLineWrapped(lineView); + lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass, + ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px")); + cm.display.input.setUneditable(lineView.gutterBackground); + wrap.insertBefore(lineView.gutterBackground, lineView.text); + } + var markers = lineView.line.gutterMarkers; + if (cm.options.lineNumbers || markers) { + var wrap$1 = ensureLineWrapped(lineView); + var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px")); + cm.display.input.setUneditable(gutterWrap); + wrap$1.insertBefore(gutterWrap, lineView.text); + if (lineView.line.gutterClass) + { gutterWrap.className += " " + lineView.line.gutterClass; } + if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"])) + { lineView.lineNumber = gutterWrap.appendChild( + elt("div", lineNumberFor(cm.options, lineN), + "CodeMirror-linenumber CodeMirror-gutter-elt", + ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); } + if (markers) { for (var k = 0; k < cm.display.gutterSpecs.length; ++k) { + var id = cm.display.gutterSpecs[k].className, found = markers.hasOwnProperty(id) && markers[id]; + if (found) + { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", + ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); } + } } + } + } + + function updateLineWidgets(cm, lineView, dims) { + if (lineView.alignable) { lineView.alignable = null; } + var isWidget = classTest("CodeMirror-linewidget"); + for (var node = lineView.node.firstChild, next = (void 0); node; node = next) { + next = node.nextSibling; + if (isWidget.test(node.className)) { lineView.node.removeChild(node); } + } + insertLineWidgets(cm, lineView, dims); + } + + // Build a line's DOM representation from scratch + function buildLineElement(cm, lineView, lineN, dims) { + var built = getLineContent(cm, lineView); + lineView.text = lineView.node = built.pre; + if (built.bgClass) { lineView.bgClass = built.bgClass; } + if (built.textClass) { lineView.textClass = built.textClass; } + + updateLineClasses(cm, lineView); + updateLineGutter(cm, lineView, lineN, dims); + insertLineWidgets(cm, lineView, dims); + return lineView.node + } + + // A lineView may contain multiple logical lines (when merged by + // collapsed spans). The widgets for all of them need to be drawn. + function insertLineWidgets(cm, lineView, dims) { + insertLineWidgetsFor(cm, lineView.line, lineView, dims, true); + if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++) + { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } } + } + + function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) { + if (!line.widgets) { return } + var wrap = ensureLineWrapped(lineView); + for (var i = 0, ws = line.widgets; i < ws.length; ++i) { + var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget" + (widget.className ? " " + widget.className : "")); + if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); } + positionLineWidget(widget, node, lineView, dims); + cm.display.input.setUneditable(node); + if (allowAbove && widget.above) + { wrap.insertBefore(node, lineView.gutter || lineView.text); } + else + { wrap.appendChild(node); } + signalLater(widget, "redraw"); + } + } + + function positionLineWidget(widget, node, lineView, dims) { + if (widget.noHScroll) { + (lineView.alignable || (lineView.alignable = [])).push(node); + var width = dims.wrapperWidth; + node.style.left = dims.fixedPos + "px"; + if (!widget.coverGutter) { + width -= dims.gutterTotalWidth; + node.style.paddingLeft = dims.gutterTotalWidth + "px"; + } + node.style.width = width + "px"; + } + if (widget.coverGutter) { + node.style.zIndex = 5; + node.style.position = "relative"; + if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; } + } + } + + function widgetHeight(widget) { + if (widget.height != null) { return widget.height } + var cm = widget.doc.cm; + if (!cm) { return 0 } + if (!contains(document.body, widget.node)) { + var parentStyle = "position: relative;"; + if (widget.coverGutter) + { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; } + if (widget.noHScroll) + { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; } + removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle)); + } + return widget.height = widget.node.parentNode.offsetHeight + } + + // Return true when the given mouse event happened in a widget + function eventInWidget(display, e) { + for (var n = e_target(e); n != display.wrapper; n = n.parentNode) { + if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") || + (n.parentNode == display.sizer && n != display.mover)) + { return true } + } + } + + // POSITION MEASUREMENT + + function paddingTop(display) {return display.lineSpace.offsetTop} + function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight} + function paddingH(display) { + if (display.cachedPaddingH) { return display.cachedPaddingH } + var e = removeChildrenAndAdd(display.measure, elt("pre", "x", "CodeMirror-line-like")); + var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle; + var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)}; + if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; } + return data + } + + function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth } + function displayWidth(cm) { + return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth + } + function displayHeight(cm) { + return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight + } + + // Ensure the lineView.wrapping.heights array is populated. This is + // an array of bottom offsets for the lines that make up a drawn + // line. When lineWrapping is on, there might be more than one + // height. + function ensureLineHeights(cm, lineView, rect) { + var wrapping = cm.options.lineWrapping; + var curWidth = wrapping && displayWidth(cm); + if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { + var heights = lineView.measure.heights = []; + if (wrapping) { + lineView.measure.width = curWidth; + var rects = lineView.text.firstChild.getClientRects(); + for (var i = 0; i < rects.length - 1; i++) { + var cur = rects[i], next = rects[i + 1]; + if (Math.abs(cur.bottom - next.bottom) > 2) + { heights.push((cur.bottom + next.top) / 2 - rect.top); } + } + } + heights.push(rect.bottom - rect.top); + } + } + + // Find a line map (mapping character offsets to text nodes) and a + // measurement cache for the given line number. (A line view might + // contain multiple lines when collapsed ranges are present.) + function mapFromLineView(lineView, line, lineN) { + if (lineView.line == line) + { return {map: lineView.measure.map, cache: lineView.measure.cache} } + for (var i = 0; i < lineView.rest.length; i++) + { if (lineView.rest[i] == line) + { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } } + for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) + { if (lineNo(lineView.rest[i$1]) > lineN) + { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } } + } + + // Render a line into the hidden node display.externalMeasured. Used + // when measurement is needed for a line that's not in the viewport. + function updateExternalMeasurement(cm, line) { + line = visualLine(line); + var lineN = lineNo(line); + var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN); + view.lineN = lineN; + var built = view.built = buildLineContent(cm, view); + view.text = built.pre; + removeChildrenAndAdd(cm.display.lineMeasure, built.pre); + return view + } + + // Get a {top, bottom, left, right} box (in line-local coordinates) + // for a given character. + function measureChar(cm, line, ch, bias) { + return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias) + } + + // Find a line view that corresponds to the given line number. + function findViewForLine(cm, lineN) { + if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo) + { return cm.display.view[findViewIndex(cm, lineN)] } + var ext = cm.display.externalMeasured; + if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size) + { return ext } + } + + // Measurement can be split in two steps, the set-up work that + // applies to the whole line, and the measurement of the actual + // character. Functions like coordsChar, that need to do a lot of + // measurements in a row, can thus ensure that the set-up work is + // only done once. + function prepareMeasureForLine(cm, line) { + var lineN = lineNo(line); + var view = findViewForLine(cm, lineN); + if (view && !view.text) { + view = null; + } else if (view && view.changes) { + updateLineForChanges(cm, view, lineN, getDimensions(cm)); + cm.curOp.forceUpdate = true; + } + if (!view) + { view = updateExternalMeasurement(cm, line); } + + var info = mapFromLineView(view, line, lineN); + return { + line: line, view: view, rect: null, + map: info.map, cache: info.cache, before: info.before, + hasHeights: false + } + } + + // Given a prepared measurement object, measures the position of an + // actual character (or fetches it from the cache). + function measureCharPrepared(cm, prepared, ch, bias, varHeight) { + if (prepared.before) { ch = -1; } + var key = ch + (bias || ""), found; + if (prepared.cache.hasOwnProperty(key)) { + found = prepared.cache[key]; + } else { + if (!prepared.rect) + { prepared.rect = prepared.view.text.getBoundingClientRect(); } + if (!prepared.hasHeights) { + ensureLineHeights(cm, prepared.view, prepared.rect); + prepared.hasHeights = true; + } + found = measureCharInner(cm, prepared, ch, bias); + if (!found.bogus) { prepared.cache[key] = found; } + } + return {left: found.left, right: found.right, + top: varHeight ? found.rtop : found.top, + bottom: varHeight ? found.rbottom : found.bottom} + } + + var nullRect = {left: 0, right: 0, top: 0, bottom: 0}; + + function nodeAndOffsetInLineMap(map, ch, bias) { + var node, start, end, collapse, mStart, mEnd; + // First, search the line map for the text node corresponding to, + // or closest to, the target character. + for (var i = 0; i < map.length; i += 3) { + mStart = map[i]; + mEnd = map[i + 1]; + if (ch < mStart) { + start = 0; end = 1; + collapse = "left"; + } else if (ch < mEnd) { + start = ch - mStart; + end = start + 1; + } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) { + end = mEnd - mStart; + start = end - 1; + if (ch >= mEnd) { collapse = "right"; } + } + if (start != null) { + node = map[i + 2]; + if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right")) + { collapse = bias; } + if (bias == "left" && start == 0) + { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) { + node = map[(i -= 3) + 2]; + collapse = "left"; + } } + if (bias == "right" && start == mEnd - mStart) + { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) { + node = map[(i += 3) + 2]; + collapse = "right"; + } } + break + } + } + return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd} + } + + function getUsefulRect(rects, bias) { + var rect = nullRect; + if (bias == "left") { for (var i = 0; i < rects.length; i++) { + if ((rect = rects[i]).left != rect.right) { break } + } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) { + if ((rect = rects[i$1]).left != rect.right) { break } + } } + return rect + } + + function measureCharInner(cm, prepared, ch, bias) { + var place = nodeAndOffsetInLineMap(prepared.map, ch, bias); + var node = place.node, start = place.start, end = place.end, collapse = place.collapse; + + var rect; + if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates. + for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned + while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; } + while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; } + if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart) + { rect = node.parentNode.getBoundingClientRect(); } + else + { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); } + if (rect.left || rect.right || start == 0) { break } + end = start; + start = start - 1; + collapse = "right"; + } + if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); } + } else { // If it is a widget, simply get the box for the whole widget. + if (start > 0) { collapse = bias = "right"; } + var rects; + if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1) + { rect = rects[bias == "right" ? rects.length - 1 : 0]; } + else + { rect = node.getBoundingClientRect(); } + } + if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) { + var rSpan = node.parentNode.getClientRects()[0]; + if (rSpan) + { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; } + else + { rect = nullRect; } + } + + var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top; + var mid = (rtop + rbot) / 2; + var heights = prepared.view.measure.heights; + var i = 0; + for (; i < heights.length - 1; i++) + { if (mid < heights[i]) { break } } + var top = i ? heights[i - 1] : 0, bot = heights[i]; + var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left, + right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left, + top: top, bottom: bot}; + if (!rect.left && !rect.right) { result.bogus = true; } + if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; } + + return result + } + + // Work around problem with bounding client rects on ranges being + // returned incorrectly when zoomed on IE10 and below. + function maybeUpdateRectForZooming(measure, rect) { + if (!window.screen || screen.logicalXDPI == null || + screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure)) + { return rect } + var scaleX = screen.logicalXDPI / screen.deviceXDPI; + var scaleY = screen.logicalYDPI / screen.deviceYDPI; + return {left: rect.left * scaleX, right: rect.right * scaleX, + top: rect.top * scaleY, bottom: rect.bottom * scaleY} + } + + function clearLineMeasurementCacheFor(lineView) { + if (lineView.measure) { + lineView.measure.cache = {}; + lineView.measure.heights = null; + if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++) + { lineView.measure.caches[i] = {}; } } + } + } + + function clearLineMeasurementCache(cm) { + cm.display.externalMeasure = null; + removeChildren(cm.display.lineMeasure); + for (var i = 0; i < cm.display.view.length; i++) + { clearLineMeasurementCacheFor(cm.display.view[i]); } + } + + function clearCaches(cm) { + clearLineMeasurementCache(cm); + cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null; + if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; } + cm.display.lineNumChars = null; + } + + function pageScrollX() { + // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206 + // which causes page_Offset and bounding client rects to use + // different reference viewports and invalidate our calculations. + if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) } + return window.pageXOffset || (document.documentElement || document.body).scrollLeft + } + function pageScrollY() { + if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) } + return window.pageYOffset || (document.documentElement || document.body).scrollTop + } + + function widgetTopHeight(lineObj) { + var height = 0; + if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) + { height += widgetHeight(lineObj.widgets[i]); } } } + return height + } + + // Converts a {top, bottom, left, right} box from line-local + // coordinates into another coordinate system. Context may be one of + // "line", "div" (display.lineDiv), "local"./null (editor), "window", + // or "page". + function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) { + if (!includeWidgets) { + var height = widgetTopHeight(lineObj); + rect.top += height; rect.bottom += height; + } + if (context == "line") { return rect } + if (!context) { context = "local"; } + var yOff = heightAtLine(lineObj); + if (context == "local") { yOff += paddingTop(cm.display); } + else { yOff -= cm.display.viewOffset; } + if (context == "page" || context == "window") { + var lOff = cm.display.lineSpace.getBoundingClientRect(); + yOff += lOff.top + (context == "window" ? 0 : pageScrollY()); + var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()); + rect.left += xOff; rect.right += xOff; + } + rect.top += yOff; rect.bottom += yOff; + return rect + } + + // Coverts a box from "div" coords to another coordinate system. + // Context may be "window", "page", "div", or "local"./null. + function fromCoordSystem(cm, coords, context) { + if (context == "div") { return coords } + var left = coords.left, top = coords.top; + // First move into "page" coordinate system + if (context == "page") { + left -= pageScrollX(); + top -= pageScrollY(); + } else if (context == "local" || !context) { + var localBox = cm.display.sizer.getBoundingClientRect(); + left += localBox.left; + top += localBox.top; + } + + var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect(); + return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top} + } + + function charCoords(cm, pos, context, lineObj, bias) { + if (!lineObj) { lineObj = getLine(cm.doc, pos.line); } + return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context) + } + + // Returns a box for a given cursor position, which may have an + // 'other' property containing the position of the secondary cursor + // on a bidi boundary. + // A cursor Pos(line, char, "before") is on the same visual line as `char - 1` + // and after `char - 1` in writing order of `char - 1` + // A cursor Pos(line, char, "after") is on the same visual line as `char` + // and before `char` in writing order of `char` + // Examples (upper-case letters are RTL, lower-case are LTR): + // Pos(0, 1, ...) + // before after + // ab a|b a|b + // aB a|B aB| + // Ab |Ab A|b + // AB B|A B|A + // Every position after the last character on a line is considered to stick + // to the last character on the line. + function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) { + lineObj = lineObj || getLine(cm.doc, pos.line); + if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); } + function get(ch, right) { + var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight); + if (right) { m.left = m.right; } else { m.right = m.left; } + return intoCoordSystem(cm, lineObj, m, context) + } + var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky; + if (ch >= lineObj.text.length) { + ch = lineObj.text.length; + sticky = "before"; + } else if (ch <= 0) { + ch = 0; + sticky = "after"; + } + if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") } + + function getBidi(ch, partPos, invert) { + var part = order[partPos], right = part.level == 1; + return get(invert ? ch - 1 : ch, right != invert) + } + var partPos = getBidiPartAt(order, ch, sticky); + var other = bidiOther; + var val = getBidi(ch, partPos, sticky == "before"); + if (other != null) { val.other = getBidi(ch, other, sticky != "before"); } + return val + } + + // Used to cheaply estimate the coordinates for a position. Used for + // intermediate scroll updates. + function estimateCoords(cm, pos) { + var left = 0; + pos = clipPos(cm.doc, pos); + if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; } + var lineObj = getLine(cm.doc, pos.line); + var top = heightAtLine(lineObj) + paddingTop(cm.display); + return {left: left, right: left, top: top, bottom: top + lineObj.height} + } + + // Positions returned by coordsChar contain some extra information. + // xRel is the relative x position of the input coordinates compared + // to the found position (so xRel > 0 means the coordinates are to + // the right of the character position, for example). When outside + // is true, that means the coordinates lie outside the line's + // vertical range. + function PosWithInfo(line, ch, sticky, outside, xRel) { + var pos = Pos(line, ch, sticky); + pos.xRel = xRel; + if (outside) { pos.outside = outside; } + return pos + } + + // Compute the character position closest to the given coordinates. + // Input must be lineSpace-local ("div" coordinate system). + function coordsChar(cm, x, y) { + var doc = cm.doc; + y += cm.display.viewOffset; + if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) } + var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1; + if (lineN > last) + { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) } + if (x < 0) { x = 0; } + + var lineObj = getLine(doc, lineN); + for (;;) { + var found = coordsCharInner(cm, lineObj, lineN, x, y); + var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0)); + if (!collapsed) { return found } + var rangeEnd = collapsed.find(1); + if (rangeEnd.line == lineN) { return rangeEnd } + lineObj = getLine(doc, lineN = rangeEnd.line); + } + } + + function wrappedLineExtent(cm, lineObj, preparedMeasure, y) { + y -= widgetTopHeight(lineObj); + var end = lineObj.text.length; + var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0); + end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end); + return {begin: begin, end: end} + } + + function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) { + if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); } + var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top; + return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop) + } + + // Returns true if the given side of a box is after the given + // coordinates, in top-to-bottom, left-to-right order. + function boxIsAfter(box, x, y, left) { + return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x + } + + function coordsCharInner(cm, lineObj, lineNo, x, y) { + // Move y into line-local coordinate space + y -= heightAtLine(lineObj); + var preparedMeasure = prepareMeasureForLine(cm, lineObj); + // When directly calling `measureCharPrepared`, we have to adjust + // for the widgets at this line. + var widgetHeight = widgetTopHeight(lineObj); + var begin = 0, end = lineObj.text.length, ltr = true; + + var order = getOrder(lineObj, cm.doc.direction); + // If the line isn't plain left-to-right text, first figure out + // which bidi section the coordinates fall into. + if (order) { + var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart) + (cm, lineObj, lineNo, preparedMeasure, order, x, y); + ltr = part.level != 1; + // The awkward -1 offsets are needed because findFirst (called + // on these below) will treat its first bound as inclusive, + // second as exclusive, but we want to actually address the + // characters in the part's range + begin = ltr ? part.from : part.to - 1; + end = ltr ? part.to : part.from - 1; + } + + // A binary search to find the first character whose bounding box + // starts after the coordinates. If we run across any whose box wrap + // the coordinates, store that. + var chAround = null, boxAround = null; + var ch = findFirst(function (ch) { + var box = measureCharPrepared(cm, preparedMeasure, ch); + box.top += widgetHeight; box.bottom += widgetHeight; + if (!boxIsAfter(box, x, y, false)) { return false } + if (box.top <= y && box.left <= x) { + chAround = ch; + boxAround = box; + } + return true + }, begin, end); + + var baseX, sticky, outside = false; + // If a box around the coordinates was found, use that + if (boxAround) { + // Distinguish coordinates nearer to the left or right side of the box + var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr; + ch = chAround + (atStart ? 0 : 1); + sticky = atStart ? "after" : "before"; + baseX = atLeft ? boxAround.left : boxAround.right; + } else { + // (Adjust for extended bound, if necessary.) + if (!ltr && (ch == end || ch == begin)) { ch++; } + // To determine which side to associate with, get the box to the + // left of the character and compare it's vertical position to the + // coordinates + sticky = ch == 0 ? "after" : ch == lineObj.text.length ? "before" : + (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight <= y) == ltr ? + "after" : "before"; + // Now get accurate coordinates for this place, in order to get a + // base X position + var coords = cursorCoords(cm, Pos(lineNo, ch, sticky), "line", lineObj, preparedMeasure); + baseX = coords.left; + outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0; + } + + ch = skipExtendingChars(lineObj.text, ch, 1); + return PosWithInfo(lineNo, ch, sticky, outside, x - baseX) + } + + function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) { + // Bidi parts are sorted left-to-right, and in a non-line-wrapping + // situation, we can take this ordering to correspond to the visual + // ordering. This finds the first part whose end is after the given + // coordinates. + var index = findFirst(function (i) { + var part = order[i], ltr = part.level != 1; + return boxIsAfter(cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? "before" : "after"), + "line", lineObj, preparedMeasure), x, y, true) + }, 0, order.length - 1); + var part = order[index]; + // If this isn't the first part, the part's start is also after + // the coordinates, and the coordinates aren't on the same line as + // that start, move one part back. + if (index > 0) { + var ltr = part.level != 1; + var start = cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? "after" : "before"), + "line", lineObj, preparedMeasure); + if (boxIsAfter(start, x, y, true) && start.top > y) + { part = order[index - 1]; } + } + return part + } + + function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) { + // In a wrapped line, rtl text on wrapping boundaries can do things + // that don't correspond to the ordering in our `order` array at + // all, so a binary search doesn't work, and we want to return a + // part that only spans one line so that the binary search in + // coordsCharInner is safe. As such, we first find the extent of the + // wrapped line, and then do a flat search in which we discard any + // spans that aren't on the line. + var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y); + var begin = ref.begin; + var end = ref.end; + if (/\s/.test(lineObj.text.charAt(end - 1))) { end--; } + var part = null, closestDist = null; + for (var i = 0; i < order.length; i++) { + var p = order[i]; + if (p.from >= end || p.to <= begin) { continue } + var ltr = p.level != 1; + var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right; + // Weigh against spans ending before this, so that they are only + // picked if nothing ends after + var dist = endX < x ? x - endX + 1e9 : endX - x; + if (!part || closestDist > dist) { + part = p; + closestDist = dist; + } + } + if (!part) { part = order[order.length - 1]; } + // Clip the part to the wrapped line. + if (part.from < begin) { part = {from: begin, to: part.to, level: part.level}; } + if (part.to > end) { part = {from: part.from, to: end, level: part.level}; } + return part + } + + var measureText; + // Compute the default text height. + function textHeight(display) { + if (display.cachedTextHeight != null) { return display.cachedTextHeight } + if (measureText == null) { + measureText = elt("pre", null, "CodeMirror-line-like"); + // Measure a bunch of lines, for browsers that compute + // fractional heights. + for (var i = 0; i < 49; ++i) { + measureText.appendChild(document.createTextNode("x")); + measureText.appendChild(elt("br")); + } + measureText.appendChild(document.createTextNode("x")); + } + removeChildrenAndAdd(display.measure, measureText); + var height = measureText.offsetHeight / 50; + if (height > 3) { display.cachedTextHeight = height; } + removeChildren(display.measure); + return height || 1 + } + + // Compute the default character width. + function charWidth(display) { + if (display.cachedCharWidth != null) { return display.cachedCharWidth } + var anchor = elt("span", "xxxxxxxxxx"); + var pre = elt("pre", [anchor], "CodeMirror-line-like"); + removeChildrenAndAdd(display.measure, pre); + var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10; + if (width > 2) { display.cachedCharWidth = width; } + return width || 10 + } + + // Do a bulk-read of the DOM positions and sizes needed to draw the + // view, so that we don't interleave reading and writing to the DOM. + function getDimensions(cm) { + var d = cm.display, left = {}, width = {}; + var gutterLeft = d.gutters.clientLeft; + for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) { + var id = cm.display.gutterSpecs[i].className; + left[id] = n.offsetLeft + n.clientLeft + gutterLeft; + width[id] = n.clientWidth; + } + return {fixedPos: compensateForHScroll(d), + gutterTotalWidth: d.gutters.offsetWidth, + gutterLeft: left, + gutterWidth: width, + wrapperWidth: d.wrapper.clientWidth} + } + + // Computes display.scroller.scrollLeft + display.gutters.offsetWidth, + // but using getBoundingClientRect to get a sub-pixel-accurate + // result. + function compensateForHScroll(display) { + return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left + } + + // Returns a function that estimates the height of a line, to use as + // first approximation until the line becomes visible (and is thus + // properly measurable). + function estimateHeight(cm) { + var th = textHeight(cm.display), wrapping = cm.options.lineWrapping; + var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3); + return function (line) { + if (lineIsHidden(cm.doc, line)) { return 0 } + + var widgetsHeight = 0; + if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) { + if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; } + } } + + if (wrapping) + { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th } + else + { return widgetsHeight + th } + } + } + + function estimateLineHeights(cm) { + var doc = cm.doc, est = estimateHeight(cm); + doc.iter(function (line) { + var estHeight = est(line); + if (estHeight != line.height) { updateLineHeight(line, estHeight); } + }); + } + + // Given a mouse event, find the corresponding position. If liberal + // is false, it checks whether a gutter or scrollbar was clicked, + // and returns null if it was. forRect is used by rectangular + // selections, and tries to estimate a character position even for + // coordinates beyond the right of the text. + function posFromMouse(cm, e, liberal, forRect) { + var display = cm.display; + if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null } + + var x, y, space = display.lineSpace.getBoundingClientRect(); + // Fails unpredictably on IE[67] when mouse is dragged around quickly. + try { x = e.clientX - space.left; y = e.clientY - space.top; } + catch (e$1) { return null } + var coords = coordsChar(cm, x, y), line; + if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) { + var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length; + coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff)); + } + return coords + } + + // Find the view element corresponding to a given line. Return null + // when the line isn't visible. + function findViewIndex(cm, n) { + if (n >= cm.display.viewTo) { return null } + n -= cm.display.viewFrom; + if (n < 0) { return null } + var view = cm.display.view; + for (var i = 0; i < view.length; i++) { + n -= view[i].size; + if (n < 0) { return i } + } + } + + // Updates the display.view data structure for a given change to the + // document. From and to are in pre-change coordinates. Lendiff is + // the amount of lines added or subtracted by the change. This is + // used for changes that span multiple lines, or change the way + // lines are divided into visual lines. regLineChange (below) + // registers single-line changes. + function regChange(cm, from, to, lendiff) { + if (from == null) { from = cm.doc.first; } + if (to == null) { to = cm.doc.first + cm.doc.size; } + if (!lendiff) { lendiff = 0; } + + var display = cm.display; + if (lendiff && to < display.viewTo && + (display.updateLineNumbers == null || display.updateLineNumbers > from)) + { display.updateLineNumbers = from; } + + cm.curOp.viewChanged = true; + + if (from >= display.viewTo) { // Change after + if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo) + { resetView(cm); } + } else if (to <= display.viewFrom) { // Change before + if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) { + resetView(cm); + } else { + display.viewFrom += lendiff; + display.viewTo += lendiff; + } + } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap + resetView(cm); + } else if (from <= display.viewFrom) { // Top overlap + var cut = viewCuttingPoint(cm, to, to + lendiff, 1); + if (cut) { + display.view = display.view.slice(cut.index); + display.viewFrom = cut.lineN; + display.viewTo += lendiff; + } else { + resetView(cm); + } + } else if (to >= display.viewTo) { // Bottom overlap + var cut$1 = viewCuttingPoint(cm, from, from, -1); + if (cut$1) { + display.view = display.view.slice(0, cut$1.index); + display.viewTo = cut$1.lineN; + } else { + resetView(cm); + } + } else { // Gap in the middle + var cutTop = viewCuttingPoint(cm, from, from, -1); + var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1); + if (cutTop && cutBot) { + display.view = display.view.slice(0, cutTop.index) + .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN)) + .concat(display.view.slice(cutBot.index)); + display.viewTo += lendiff; + } else { + resetView(cm); + } + } + + var ext = display.externalMeasured; + if (ext) { + if (to < ext.lineN) + { ext.lineN += lendiff; } + else if (from < ext.lineN + ext.size) + { display.externalMeasured = null; } + } + } + + // Register a change to a single line. Type must be one of "text", + // "gutter", "class", "widget" + function regLineChange(cm, line, type) { + cm.curOp.viewChanged = true; + var display = cm.display, ext = cm.display.externalMeasured; + if (ext && line >= ext.lineN && line < ext.lineN + ext.size) + { display.externalMeasured = null; } + + if (line < display.viewFrom || line >= display.viewTo) { return } + var lineView = display.view[findViewIndex(cm, line)]; + if (lineView.node == null) { return } + var arr = lineView.changes || (lineView.changes = []); + if (indexOf(arr, type) == -1) { arr.push(type); } + } + + // Clear the view. + function resetView(cm) { + cm.display.viewFrom = cm.display.viewTo = cm.doc.first; + cm.display.view = []; + cm.display.viewOffset = 0; + } + + function viewCuttingPoint(cm, oldN, newN, dir) { + var index = findViewIndex(cm, oldN), diff, view = cm.display.view; + if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size) + { return {index: index, lineN: newN} } + var n = cm.display.viewFrom; + for (var i = 0; i < index; i++) + { n += view[i].size; } + if (n != oldN) { + if (dir > 0) { + if (index == view.length - 1) { return null } + diff = (n + view[index].size) - oldN; + index++; + } else { + diff = n - oldN; + } + oldN += diff; newN += diff; + } + while (visualLineNo(cm.doc, newN) != newN) { + if (index == (dir < 0 ? 0 : view.length - 1)) { return null } + newN += dir * view[index - (dir < 0 ? 1 : 0)].size; + index += dir; + } + return {index: index, lineN: newN} + } + + // Force the view to cover a given range, adding empty view element + // or clipping off existing ones as needed. + function adjustView(cm, from, to) { + var display = cm.display, view = display.view; + if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) { + display.view = buildViewArray(cm, from, to); + display.viewFrom = from; + } else { + if (display.viewFrom > from) + { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); } + else if (display.viewFrom < from) + { display.view = display.view.slice(findViewIndex(cm, from)); } + display.viewFrom = from; + if (display.viewTo < to) + { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); } + else if (display.viewTo > to) + { display.view = display.view.slice(0, findViewIndex(cm, to)); } + } + display.viewTo = to; + } + + // Count the number of lines in the view whose DOM representation is + // out of date (or nonexistent). + function countDirtyView(cm) { + var view = cm.display.view, dirty = 0; + for (var i = 0; i < view.length; i++) { + var lineView = view[i]; + if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; } + } + return dirty + } + + function updateSelection(cm) { + cm.display.input.showSelection(cm.display.input.prepareSelection()); + } + + function prepareSelection(cm, primary) { + if ( primary === void 0 ) primary = true; + + var doc = cm.doc, result = {}; + var curFragment = result.cursors = document.createDocumentFragment(); + var selFragment = result.selection = document.createDocumentFragment(); + + for (var i = 0; i < doc.sel.ranges.length; i++) { + if (!primary && i == doc.sel.primIndex) { continue } + var range = doc.sel.ranges[i]; + if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue } + var collapsed = range.empty(); + if (collapsed || cm.options.showCursorWhenSelecting) + { drawSelectionCursor(cm, range.head, curFragment); } + if (!collapsed) + { drawSelectionRange(cm, range, selFragment); } + } + return result + } + + // Draws a cursor for the given range + function drawSelectionCursor(cm, head, output) { + var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine); + + var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor")); + cursor.style.left = pos.left + "px"; + cursor.style.top = pos.top + "px"; + cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"; + + if (pos.other) { + // Secondary cursor, shown when on a 'jump' in bi-directional text + var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor")); + otherCursor.style.display = ""; + otherCursor.style.left = pos.other.left + "px"; + otherCursor.style.top = pos.other.top + "px"; + otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px"; + } + } + + function cmpCoords(a, b) { return a.top - b.top || a.left - b.left } + + // Draws the given range as a highlighted selection + function drawSelectionRange(cm, range, output) { + var display = cm.display, doc = cm.doc; + var fragment = document.createDocumentFragment(); + var padding = paddingH(cm.display), leftSide = padding.left; + var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right; + var docLTR = doc.direction == "ltr"; + + function add(left, top, width, bottom) { + if (top < 0) { top = 0; } + top = Math.round(top); + bottom = Math.round(bottom); + fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px"))); + } + + function drawForLine(line, fromArg, toArg) { + var lineObj = getLine(doc, line); + var lineLen = lineObj.text.length; + var start, end; + function coords(ch, bias) { + return charCoords(cm, Pos(line, ch), "div", lineObj, bias) + } + + function wrapX(pos, dir, side) { + var extent = wrappedLineExtentChar(cm, lineObj, null, pos); + var prop = (dir == "ltr") == (side == "after") ? "left" : "right"; + var ch = side == "after" ? extent.begin : extent.end - (/\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1); + return coords(ch, prop)[prop] + } + + var order = getOrder(lineObj, doc.direction); + iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) { + var ltr = dir == "ltr"; + var fromPos = coords(from, ltr ? "left" : "right"); + var toPos = coords(to - 1, ltr ? "right" : "left"); + + var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen; + var first = i == 0, last = !order || i == order.length - 1; + if (toPos.top - fromPos.top <= 3) { // Single line + var openLeft = (docLTR ? openStart : openEnd) && first; + var openRight = (docLTR ? openEnd : openStart) && last; + var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left; + var right = openRight ? rightSide : (ltr ? toPos : fromPos).right; + add(left, fromPos.top, right - left, fromPos.bottom); + } else { // Multiple lines + var topLeft, topRight, botLeft, botRight; + if (ltr) { + topLeft = docLTR && openStart && first ? leftSide : fromPos.left; + topRight = docLTR ? rightSide : wrapX(from, dir, "before"); + botLeft = docLTR ? leftSide : wrapX(to, dir, "after"); + botRight = docLTR && openEnd && last ? rightSide : toPos.right; + } else { + topLeft = !docLTR ? leftSide : wrapX(from, dir, "before"); + topRight = !docLTR && openStart && first ? rightSide : fromPos.right; + botLeft = !docLTR && openEnd && last ? leftSide : toPos.left; + botRight = !docLTR ? rightSide : wrapX(to, dir, "after"); + } + add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom); + if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); } + add(botLeft, toPos.top, botRight - botLeft, toPos.bottom); + } + + if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; } + if (cmpCoords(toPos, start) < 0) { start = toPos; } + if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; } + if (cmpCoords(toPos, end) < 0) { end = toPos; } + }); + return {start: start, end: end} + } + + var sFrom = range.from(), sTo = range.to(); + if (sFrom.line == sTo.line) { + drawForLine(sFrom.line, sFrom.ch, sTo.ch); + } else { + var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line); + var singleVLine = visualLine(fromLine) == visualLine(toLine); + var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end; + var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start; + if (singleVLine) { + if (leftEnd.top < rightStart.top - 2) { + add(leftEnd.right, leftEnd.top, null, leftEnd.bottom); + add(leftSide, rightStart.top, rightStart.left, rightStart.bottom); + } else { + add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom); + } + } + if (leftEnd.bottom < rightStart.top) + { add(leftSide, leftEnd.bottom, null, rightStart.top); } + } + + output.appendChild(fragment); + } + + // Cursor-blinking + function restartBlink(cm) { + if (!cm.state.focused) { return } + var display = cm.display; + clearInterval(display.blinker); + var on = true; + display.cursorDiv.style.visibility = ""; + if (cm.options.cursorBlinkRate > 0) + { display.blinker = setInterval(function () { + if (!cm.hasFocus()) { onBlur(cm); } + display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; + }, cm.options.cursorBlinkRate); } + else if (cm.options.cursorBlinkRate < 0) + { display.cursorDiv.style.visibility = "hidden"; } + } + + function ensureFocus(cm) { + if (!cm.hasFocus()) { + cm.display.input.focus(); + if (!cm.state.focused) { onFocus(cm); } + } + } + + function delayBlurEvent(cm) { + cm.state.delayingBlurEvent = true; + setTimeout(function () { if (cm.state.delayingBlurEvent) { + cm.state.delayingBlurEvent = false; + if (cm.state.focused) { onBlur(cm); } + } }, 100); + } + + function onFocus(cm, e) { + if (cm.state.delayingBlurEvent && !cm.state.draggingText) { cm.state.delayingBlurEvent = false; } + + if (cm.options.readOnly == "nocursor") { return } + if (!cm.state.focused) { + signal(cm, "focus", cm, e); + cm.state.focused = true; + addClass(cm.display.wrapper, "CodeMirror-focused"); + // This test prevents this from firing when a context + // menu is closed (since the input reset would kill the + // select-all detection hack) + if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) { + cm.display.input.reset(); + if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730 + } + cm.display.input.receivedFocus(); + } + restartBlink(cm); + } + function onBlur(cm, e) { + if (cm.state.delayingBlurEvent) { return } + + if (cm.state.focused) { + signal(cm, "blur", cm, e); + cm.state.focused = false; + rmClass(cm.display.wrapper, "CodeMirror-focused"); + } + clearInterval(cm.display.blinker); + setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150); + } + + // Read the actual heights of the rendered lines, and update their + // stored heights to match. + function updateHeightsInViewport(cm) { + var display = cm.display; + var prevBottom = display.lineDiv.offsetTop; + for (var i = 0; i < display.view.length; i++) { + var cur = display.view[i], wrapping = cm.options.lineWrapping; + var height = (void 0), width = 0; + if (cur.hidden) { continue } + if (ie && ie_version < 8) { + var bot = cur.node.offsetTop + cur.node.offsetHeight; + height = bot - prevBottom; + prevBottom = bot; + } else { + var box = cur.node.getBoundingClientRect(); + height = box.bottom - box.top; + // Check that lines don't extend past the right of the current + // editor width + if (!wrapping && cur.text.firstChild) + { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; } + } + var diff = cur.line.height - height; + if (diff > .005 || diff < -.005) { + updateLineHeight(cur.line, height); + updateWidgetHeight(cur.line); + if (cur.rest) { for (var j = 0; j < cur.rest.length; j++) + { updateWidgetHeight(cur.rest[j]); } } + } + if (width > cm.display.sizerWidth) { + var chWidth = Math.ceil(width / charWidth(cm.display)); + if (chWidth > cm.display.maxLineLength) { + cm.display.maxLineLength = chWidth; + cm.display.maxLine = cur.line; + cm.display.maxLineChanged = true; + } + } + } + } + + // Read and store the height of line widgets associated with the + // given line. + function updateWidgetHeight(line) { + if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) { + var w = line.widgets[i], parent = w.node.parentNode; + if (parent) { w.height = parent.offsetHeight; } + } } + } + + // Compute the lines that are visible in a given viewport (defaults + // the the current scroll position). viewport may contain top, + // height, and ensure (see op.scrollToPos) properties. + function visibleLines(display, doc, viewport) { + var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop; + top = Math.floor(top - paddingTop(display)); + var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight; + + var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom); + // Ensure is a {from: {line, ch}, to: {line, ch}} object, and + // forces those lines into the viewport (if possible). + if (viewport && viewport.ensure) { + var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line; + if (ensureFrom < from) { + from = ensureFrom; + to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight); + } else if (Math.min(ensureTo, doc.lastLine()) >= to) { + from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight); + to = ensureTo; + } + } + return {from: from, to: Math.max(to, from + 1)} + } + + // SCROLLING THINGS INTO VIEW + + // If an editor sits on the top or bottom of the window, partially + // scrolled out of view, this ensures that the cursor is visible. + function maybeScrollWindow(cm, rect) { + if (signalDOMEvent(cm, "scrollCursorIntoView")) { return } + + var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null; + if (rect.top + box.top < 0) { doScroll = true; } + else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; } + if (doScroll != null && !phantom) { + var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;")); + cm.display.lineSpace.appendChild(scrollNode); + scrollNode.scrollIntoView(doScroll); + cm.display.lineSpace.removeChild(scrollNode); + } + } + + // Scroll a given position into view (immediately), verifying that + // it actually became visible (as line heights are accurately + // measured, the position of something may 'drift' during drawing). + function scrollPosIntoView(cm, pos, end, margin) { + if (margin == null) { margin = 0; } + var rect; + if (!cm.options.lineWrapping && pos == end) { + // Set pos and end to the cursor positions around the character pos sticks to + // If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch + // If pos == Pos(_, 0, "before"), pos and end are unchanged + pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos; + end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos; + } + for (var limit = 0; limit < 5; limit++) { + var changed = false; + var coords = cursorCoords(cm, pos); + var endCoords = !end || end == pos ? coords : cursorCoords(cm, end); + rect = {left: Math.min(coords.left, endCoords.left), + top: Math.min(coords.top, endCoords.top) - margin, + right: Math.max(coords.left, endCoords.left), + bottom: Math.max(coords.bottom, endCoords.bottom) + margin}; + var scrollPos = calculateScrollPos(cm, rect); + var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft; + if (scrollPos.scrollTop != null) { + updateScrollTop(cm, scrollPos.scrollTop); + if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; } + } + if (scrollPos.scrollLeft != null) { + setScrollLeft(cm, scrollPos.scrollLeft); + if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; } + } + if (!changed) { break } + } + return rect + } + + // Scroll a given set of coordinates into view (immediately). + function scrollIntoView(cm, rect) { + var scrollPos = calculateScrollPos(cm, rect); + if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); } + if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); } + } + + // Calculate a new scroll position needed to scroll the given + // rectangle into view. Returns an object with scrollTop and + // scrollLeft properties. When these are undefined, the + // vertical/horizontal position does not need to be adjusted. + function calculateScrollPos(cm, rect) { + var display = cm.display, snapMargin = textHeight(cm.display); + if (rect.top < 0) { rect.top = 0; } + var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop; + var screen = displayHeight(cm), result = {}; + if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; } + var docBottom = cm.doc.height + paddingVert(display); + var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin; + if (rect.top < screentop) { + result.scrollTop = atTop ? 0 : rect.top; + } else if (rect.bottom > screentop + screen) { + var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen); + if (newTop != screentop) { result.scrollTop = newTop; } + } + + var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth; + var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace; + var screenw = displayWidth(cm) - display.gutters.offsetWidth; + var tooWide = rect.right - rect.left > screenw; + if (tooWide) { rect.right = rect.left + screenw; } + if (rect.left < 10) + { result.scrollLeft = 0; } + else if (rect.left < screenleft) + { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); } + else if (rect.right > screenw + screenleft - 3) + { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; } + return result + } + + // Store a relative adjustment to the scroll position in the current + // operation (to be applied when the operation finishes). + function addToScrollTop(cm, top) { + if (top == null) { return } + resolveScrollToPos(cm); + cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top; + } + + // Make sure that at the end of the operation the current cursor is + // shown. + function ensureCursorVisible(cm) { + resolveScrollToPos(cm); + var cur = cm.getCursor(); + cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin}; + } + + function scrollToCoords(cm, x, y) { + if (x != null || y != null) { resolveScrollToPos(cm); } + if (x != null) { cm.curOp.scrollLeft = x; } + if (y != null) { cm.curOp.scrollTop = y; } + } + + function scrollToRange(cm, range) { + resolveScrollToPos(cm); + cm.curOp.scrollToPos = range; + } + + // When an operation has its scrollToPos property set, and another + // scroll action is applied before the end of the operation, this + // 'simulates' scrolling that position into view in a cheap way, so + // that the effect of intermediate scroll commands is not ignored. + function resolveScrollToPos(cm) { + var range = cm.curOp.scrollToPos; + if (range) { + cm.curOp.scrollToPos = null; + var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to); + scrollToCoordsRange(cm, from, to, range.margin); + } + } + + function scrollToCoordsRange(cm, from, to, margin) { + var sPos = calculateScrollPos(cm, { + left: Math.min(from.left, to.left), + top: Math.min(from.top, to.top) - margin, + right: Math.max(from.right, to.right), + bottom: Math.max(from.bottom, to.bottom) + margin + }); + scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop); + } + + // Sync the scrollable area and scrollbars, ensure the viewport + // covers the visible area. + function updateScrollTop(cm, val) { + if (Math.abs(cm.doc.scrollTop - val) < 2) { return } + if (!gecko) { updateDisplaySimple(cm, {top: val}); } + setScrollTop(cm, val, true); + if (gecko) { updateDisplaySimple(cm); } + startWorker(cm, 100); + } + + function setScrollTop(cm, val, forceScroll) { + val = Math.max(0, Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val)); + if (cm.display.scroller.scrollTop == val && !forceScroll) { return } + cm.doc.scrollTop = val; + cm.display.scrollbars.setScrollTop(val); + if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; } + } + + // Sync scroller and scrollbar, ensure the gutter elements are + // aligned. + function setScrollLeft(cm, val, isScroller, forceScroll) { + val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth)); + if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return } + cm.doc.scrollLeft = val; + alignHorizontally(cm); + if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; } + cm.display.scrollbars.setScrollLeft(val); + } + + // SCROLLBARS + + // Prepare DOM reads needed to update the scrollbars. Done in one + // shot to minimize update/measure roundtrips. + function measureForScrollbars(cm) { + var d = cm.display, gutterW = d.gutters.offsetWidth; + var docH = Math.round(cm.doc.height + paddingVert(cm.display)); + return { + clientHeight: d.scroller.clientHeight, + viewHeight: d.wrapper.clientHeight, + scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth, + viewWidth: d.wrapper.clientWidth, + barLeft: cm.options.fixedGutter ? gutterW : 0, + docHeight: docH, + scrollHeight: docH + scrollGap(cm) + d.barHeight, + nativeBarWidth: d.nativeBarWidth, + gutterWidth: gutterW + } + } + + var NativeScrollbars = function(place, scroll, cm) { + this.cm = cm; + var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar"); + var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar"); + vert.tabIndex = horiz.tabIndex = -1; + place(vert); place(horiz); + + on(vert, "scroll", function () { + if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); } + }); + on(horiz, "scroll", function () { + if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); } + }); + + this.checkedZeroWidth = false; + // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8). + if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; } + }; + + NativeScrollbars.prototype.update = function (measure) { + var needsH = measure.scrollWidth > measure.clientWidth + 1; + var needsV = measure.scrollHeight > measure.clientHeight + 1; + var sWidth = measure.nativeBarWidth; + + if (needsV) { + this.vert.style.display = "block"; + this.vert.style.bottom = needsH ? sWidth + "px" : "0"; + var totalHeight = measure.viewHeight - (needsH ? sWidth : 0); + // A bug in IE8 can cause this value to be negative, so guard it. + this.vert.firstChild.style.height = + Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"; + } else { + this.vert.style.display = ""; + this.vert.firstChild.style.height = "0"; + } + + if (needsH) { + this.horiz.style.display = "block"; + this.horiz.style.right = needsV ? sWidth + "px" : "0"; + this.horiz.style.left = measure.barLeft + "px"; + var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0); + this.horiz.firstChild.style.width = + Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px"; + } else { + this.horiz.style.display = ""; + this.horiz.firstChild.style.width = "0"; + } + + if (!this.checkedZeroWidth && measure.clientHeight > 0) { + if (sWidth == 0) { this.zeroWidthHack(); } + this.checkedZeroWidth = true; + } + + return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0} + }; + + NativeScrollbars.prototype.setScrollLeft = function (pos) { + if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; } + if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz"); } + }; + + NativeScrollbars.prototype.setScrollTop = function (pos) { + if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; } + if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, "vert"); } + }; + + NativeScrollbars.prototype.zeroWidthHack = function () { + var w = mac && !mac_geMountainLion ? "12px" : "18px"; + this.horiz.style.height = this.vert.style.width = w; + this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none"; + this.disableHoriz = new Delayed; + this.disableVert = new Delayed; + }; + + NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) { + bar.style.pointerEvents = "auto"; + function maybeDisable() { + // To find out whether the scrollbar is still visible, we + // check whether the element under the pixel in the bottom + // right corner of the scrollbar box is the scrollbar box + // itself (when the bar is still visible) or its filler child + // (when the bar is hidden). If it is still visible, we keep + // it enabled, if it's hidden, we disable pointer events. + var box = bar.getBoundingClientRect(); + var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2) + : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1); + if (elt != bar) { bar.style.pointerEvents = "none"; } + else { delay.set(1000, maybeDisable); } + } + delay.set(1000, maybeDisable); + }; + + NativeScrollbars.prototype.clear = function () { + var parent = this.horiz.parentNode; + parent.removeChild(this.horiz); + parent.removeChild(this.vert); + }; + + var NullScrollbars = function () {}; + + NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} }; + NullScrollbars.prototype.setScrollLeft = function () {}; + NullScrollbars.prototype.setScrollTop = function () {}; + NullScrollbars.prototype.clear = function () {}; + + function updateScrollbars(cm, measure) { + if (!measure) { measure = measureForScrollbars(cm); } + var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight; + updateScrollbarsInner(cm, measure); + for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) { + if (startWidth != cm.display.barWidth && cm.options.lineWrapping) + { updateHeightsInViewport(cm); } + updateScrollbarsInner(cm, measureForScrollbars(cm)); + startWidth = cm.display.barWidth; startHeight = cm.display.barHeight; + } + } + + // Re-synchronize the fake scrollbars with the actual size of the + // content. + function updateScrollbarsInner(cm, measure) { + var d = cm.display; + var sizes = d.scrollbars.update(measure); + + d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px"; + d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px"; + d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent"; + + if (sizes.right && sizes.bottom) { + d.scrollbarFiller.style.display = "block"; + d.scrollbarFiller.style.height = sizes.bottom + "px"; + d.scrollbarFiller.style.width = sizes.right + "px"; + } else { d.scrollbarFiller.style.display = ""; } + if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) { + d.gutterFiller.style.display = "block"; + d.gutterFiller.style.height = sizes.bottom + "px"; + d.gutterFiller.style.width = measure.gutterWidth + "px"; + } else { d.gutterFiller.style.display = ""; } + } + + var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars}; + + function initScrollbars(cm) { + if (cm.display.scrollbars) { + cm.display.scrollbars.clear(); + if (cm.display.scrollbars.addClass) + { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); } + } + + cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) { + cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller); + // Prevent clicks in the scrollbars from killing focus + on(node, "mousedown", function () { + if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); } + }); + node.setAttribute("cm-not-content", "true"); + }, function (pos, axis) { + if (axis == "horizontal") { setScrollLeft(cm, pos); } + else { updateScrollTop(cm, pos); } + }, cm); + if (cm.display.scrollbars.addClass) + { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); } + } + + // Operations are used to wrap a series of changes to the editor + // state in such a way that each change won't have to update the + // cursor and display (which would be awkward, slow, and + // error-prone). Instead, display updates are batched and then all + // combined and executed at once. + + var nextOpId = 0; + // Start a new operation. + function startOperation(cm) { + cm.curOp = { + cm: cm, + viewChanged: false, // Flag that indicates that lines might need to be redrawn + startHeight: cm.doc.height, // Used to detect need to update scrollbar + forceUpdate: false, // Used to force a redraw + updateInput: 0, // Whether to reset the input textarea + typing: false, // Whether this reset should be careful to leave existing text (for compositing) + changeObjs: null, // Accumulated changes, for firing change events + cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on + cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already + selectionChanged: false, // Whether the selection needs to be redrawn + updateMaxLine: false, // Set when the widest line needs to be determined anew + scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet + scrollToPos: null, // Used to scroll to a specific position + focus: false, + id: ++nextOpId // Unique ID + }; + pushOperation(cm.curOp); + } + + // Finish an operation, updating the display and signalling delayed events + function endOperation(cm) { + var op = cm.curOp; + if (op) { finishOperation(op, function (group) { + for (var i = 0; i < group.ops.length; i++) + { group.ops[i].cm.curOp = null; } + endOperations(group); + }); } + } + + // The DOM updates done when an operation finishes are batched so + // that the minimum number of relayouts are required. + function endOperations(group) { + var ops = group.ops; + for (var i = 0; i < ops.length; i++) // Read DOM + { endOperation_R1(ops[i]); } + for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe) + { endOperation_W1(ops[i$1]); } + for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM + { endOperation_R2(ops[i$2]); } + for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe) + { endOperation_W2(ops[i$3]); } + for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM + { endOperation_finish(ops[i$4]); } + } + + function endOperation_R1(op) { + var cm = op.cm, display = cm.display; + maybeClipScrollbars(cm); + if (op.updateMaxLine) { findMaxLine(cm); } + + op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null || + op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom || + op.scrollToPos.to.line >= display.viewTo) || + display.maxLineChanged && cm.options.lineWrapping; + op.update = op.mustUpdate && + new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate); + } + + function endOperation_W1(op) { + op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update); + } + + function endOperation_R2(op) { + var cm = op.cm, display = cm.display; + if (op.updatedDisplay) { updateHeightsInViewport(cm); } + + op.barMeasure = measureForScrollbars(cm); + + // If the max line changed since it was last measured, measure it, + // and ensure the document's width matches it. + // updateDisplay_W2 will use these properties to do the actual resizing + if (display.maxLineChanged && !cm.options.lineWrapping) { + op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3; + cm.display.sizerWidth = op.adjustWidthTo; + op.barMeasure.scrollWidth = + Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth); + op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm)); + } + + if (op.updatedDisplay || op.selectionChanged) + { op.preparedSelection = display.input.prepareSelection(); } + } + + function endOperation_W2(op) { + var cm = op.cm; + + if (op.adjustWidthTo != null) { + cm.display.sizer.style.minWidth = op.adjustWidthTo + "px"; + if (op.maxScrollLeft < cm.doc.scrollLeft) + { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); } + cm.display.maxLineChanged = false; + } + + var takeFocus = op.focus && op.focus == activeElt(); + if (op.preparedSelection) + { cm.display.input.showSelection(op.preparedSelection, takeFocus); } + if (op.updatedDisplay || op.startHeight != cm.doc.height) + { updateScrollbars(cm, op.barMeasure); } + if (op.updatedDisplay) + { setDocumentHeight(cm, op.barMeasure); } + + if (op.selectionChanged) { restartBlink(cm); } + + if (cm.state.focused && op.updateInput) + { cm.display.input.reset(op.typing); } + if (takeFocus) { ensureFocus(op.cm); } + } + + function endOperation_finish(op) { + var cm = op.cm, display = cm.display, doc = cm.doc; + + if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); } + + // Abort mouse wheel delta measurement, when scrolling explicitly + if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos)) + { display.wheelStartX = display.wheelStartY = null; } + + // Propagate the scroll position to the actual DOM scroller + if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll); } + + if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true); } + // If we need to scroll a specific position into view, do so. + if (op.scrollToPos) { + var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from), + clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin); + maybeScrollWindow(cm, rect); + } + + // Fire events for markers that are hidden/unidden by editing or + // undoing + var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers; + if (hidden) { for (var i = 0; i < hidden.length; ++i) + { if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } } + if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1) + { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } } + + if (display.wrapper.offsetHeight) + { doc.scrollTop = cm.display.scroller.scrollTop; } + + // Fire change events, and delayed event handlers + if (op.changeObjs) + { signal(cm, "changes", cm, op.changeObjs); } + if (op.update) + { op.update.finish(); } + } + + // Run the given function in an operation + function runInOp(cm, f) { + if (cm.curOp) { return f() } + startOperation(cm); + try { return f() } + finally { endOperation(cm); } + } + // Wraps a function in an operation. Returns the wrapped function. + function operation(cm, f) { + return function() { + if (cm.curOp) { return f.apply(cm, arguments) } + startOperation(cm); + try { return f.apply(cm, arguments) } + finally { endOperation(cm); } + } + } + // Used to add methods to editor and doc instances, wrapping them in + // operations. + function methodOp(f) { + return function() { + if (this.curOp) { return f.apply(this, arguments) } + startOperation(this); + try { return f.apply(this, arguments) } + finally { endOperation(this); } + } + } + function docMethodOp(f) { + return function() { + var cm = this.cm; + if (!cm || cm.curOp) { return f.apply(this, arguments) } + startOperation(cm); + try { return f.apply(this, arguments) } + finally { endOperation(cm); } + } + } + + // HIGHLIGHT WORKER + + function startWorker(cm, time) { + if (cm.doc.highlightFrontier < cm.display.viewTo) + { cm.state.highlight.set(time, bind(highlightWorker, cm)); } + } + + function highlightWorker(cm) { + var doc = cm.doc; + if (doc.highlightFrontier >= cm.display.viewTo) { return } + var end = +new Date + cm.options.workTime; + var context = getContextBefore(cm, doc.highlightFrontier); + var changedLines = []; + + doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) { + if (context.line >= cm.display.viewFrom) { // Visible + var oldStyles = line.styles; + var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null; + var highlighted = highlightLine(cm, line, context, true); + if (resetState) { context.state = resetState; } + line.styles = highlighted.styles; + var oldCls = line.styleClasses, newCls = highlighted.classes; + if (newCls) { line.styleClasses = newCls; } + else if (oldCls) { line.styleClasses = null; } + var ischange = !oldStyles || oldStyles.length != line.styles.length || + oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass); + for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; } + if (ischange) { changedLines.push(context.line); } + line.stateAfter = context.save(); + context.nextLine(); + } else { + if (line.text.length <= cm.options.maxHighlightLength) + { processLine(cm, line.text, context); } + line.stateAfter = context.line % 5 == 0 ? context.save() : null; + context.nextLine(); + } + if (+new Date > end) { + startWorker(cm, cm.options.workDelay); + return true + } + }); + doc.highlightFrontier = context.line; + doc.modeFrontier = Math.max(doc.modeFrontier, context.line); + if (changedLines.length) { runInOp(cm, function () { + for (var i = 0; i < changedLines.length; i++) + { regLineChange(cm, changedLines[i], "text"); } + }); } + } + + // DISPLAY DRAWING + + var DisplayUpdate = function(cm, viewport, force) { + var display = cm.display; + + this.viewport = viewport; + // Store some values that we'll need later (but don't want to force a relayout for) + this.visible = visibleLines(display, cm.doc, viewport); + this.editorIsHidden = !display.wrapper.offsetWidth; + this.wrapperHeight = display.wrapper.clientHeight; + this.wrapperWidth = display.wrapper.clientWidth; + this.oldDisplayWidth = displayWidth(cm); + this.force = force; + this.dims = getDimensions(cm); + this.events = []; + }; + + DisplayUpdate.prototype.signal = function (emitter, type) { + if (hasHandler(emitter, type)) + { this.events.push(arguments); } + }; + DisplayUpdate.prototype.finish = function () { + for (var i = 0; i < this.events.length; i++) + { signal.apply(null, this.events[i]); } + }; + + function maybeClipScrollbars(cm) { + var display = cm.display; + if (!display.scrollbarsClipped && display.scroller.offsetWidth) { + display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth; + display.heightForcer.style.height = scrollGap(cm) + "px"; + display.sizer.style.marginBottom = -display.nativeBarWidth + "px"; + display.sizer.style.borderRightWidth = scrollGap(cm) + "px"; + display.scrollbarsClipped = true; + } + } + + function selectionSnapshot(cm) { + if (cm.hasFocus()) { return null } + var active = activeElt(); + if (!active || !contains(cm.display.lineDiv, active)) { return null } + var result = {activeElt: active}; + if (window.getSelection) { + var sel = window.getSelection(); + if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) { + result.anchorNode = sel.anchorNode; + result.anchorOffset = sel.anchorOffset; + result.focusNode = sel.focusNode; + result.focusOffset = sel.focusOffset; + } + } + return result + } + + function restoreSelection(snapshot) { + if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return } + snapshot.activeElt.focus(); + if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) && + snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) { + var sel = window.getSelection(), range = document.createRange(); + range.setEnd(snapshot.anchorNode, snapshot.anchorOffset); + range.collapse(false); + sel.removeAllRanges(); + sel.addRange(range); + sel.extend(snapshot.focusNode, snapshot.focusOffset); + } + } + + // Does the actual updating of the line display. Bails out + // (returning false) when there is nothing to be done and forced is + // false. + function updateDisplayIfNeeded(cm, update) { + var display = cm.display, doc = cm.doc; + + if (update.editorIsHidden) { + resetView(cm); + return false + } + + // Bail out if the visible area is already rendered and nothing changed. + if (!update.force && + update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo && + (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) && + display.renderedView == display.view && countDirtyView(cm) == 0) + { return false } + + if (maybeUpdateLineNumberWidth(cm)) { + resetView(cm); + update.dims = getDimensions(cm); + } + + // Compute a suitable new viewport (from & to) + var end = doc.first + doc.size; + var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first); + var to = Math.min(end, update.visible.to + cm.options.viewportMargin); + if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); } + if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); } + if (sawCollapsedSpans) { + from = visualLineNo(cm.doc, from); + to = visualLineEndNo(cm.doc, to); + } + + var different = from != display.viewFrom || to != display.viewTo || + display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth; + adjustView(cm, from, to); + + display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom)); + // Position the mover div to align with the current scroll position + cm.display.mover.style.top = display.viewOffset + "px"; + + var toUpdate = countDirtyView(cm); + if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view && + (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo)) + { return false } + + // For big changes, we hide the enclosing element during the + // update, since that speeds up the operations on most browsers. + var selSnapshot = selectionSnapshot(cm); + if (toUpdate > 4) { display.lineDiv.style.display = "none"; } + patchDisplay(cm, display.updateLineNumbers, update.dims); + if (toUpdate > 4) { display.lineDiv.style.display = ""; } + display.renderedView = display.view; + // There might have been a widget with a focused element that got + // hidden or updated, if so re-focus it. + restoreSelection(selSnapshot); + + // Prevent selection and cursors from interfering with the scroll + // width and height. + removeChildren(display.cursorDiv); + removeChildren(display.selectionDiv); + display.gutters.style.height = display.sizer.style.minHeight = 0; + + if (different) { + display.lastWrapHeight = update.wrapperHeight; + display.lastWrapWidth = update.wrapperWidth; + startWorker(cm, 400); + } + + display.updateLineNumbers = null; + + return true + } + + function postUpdateDisplay(cm, update) { + var viewport = update.viewport; + + for (var first = true;; first = false) { + if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) { + // Clip forced viewport to actual scrollable area. + if (viewport && viewport.top != null) + { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; } + // Updated line heights might result in the drawn area not + // actually covering the viewport. Keep looping until it does. + update.visible = visibleLines(cm.display, cm.doc, viewport); + if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo) + { break } + } else if (first) { + update.visible = visibleLines(cm.display, cm.doc, viewport); + } + if (!updateDisplayIfNeeded(cm, update)) { break } + updateHeightsInViewport(cm); + var barMeasure = measureForScrollbars(cm); + updateSelection(cm); + updateScrollbars(cm, barMeasure); + setDocumentHeight(cm, barMeasure); + update.force = false; + } + + update.signal(cm, "update", cm); + if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) { + update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo); + cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo; + } + } + + function updateDisplaySimple(cm, viewport) { + var update = new DisplayUpdate(cm, viewport); + if (updateDisplayIfNeeded(cm, update)) { + updateHeightsInViewport(cm); + postUpdateDisplay(cm, update); + var barMeasure = measureForScrollbars(cm); + updateSelection(cm); + updateScrollbars(cm, barMeasure); + setDocumentHeight(cm, barMeasure); + update.finish(); + } + } + + // Sync the actual display DOM structure with display.view, removing + // nodes for lines that are no longer in view, and creating the ones + // that are not there yet, and updating the ones that are out of + // date. + function patchDisplay(cm, updateNumbersFrom, dims) { + var display = cm.display, lineNumbers = cm.options.lineNumbers; + var container = display.lineDiv, cur = container.firstChild; + + function rm(node) { + var next = node.nextSibling; + // Works around a throw-scroll bug in OS X Webkit + if (webkit && mac && cm.display.currentWheelTarget == node) + { node.style.display = "none"; } + else + { node.parentNode.removeChild(node); } + return next + } + + var view = display.view, lineN = display.viewFrom; + // Loop over the elements in the view, syncing cur (the DOM nodes + // in display.lineDiv) with the view as we go. + for (var i = 0; i < view.length; i++) { + var lineView = view[i]; + if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet + var node = buildLineElement(cm, lineView, lineN, dims); + container.insertBefore(node, cur); + } else { // Already drawn + while (cur != lineView.node) { cur = rm(cur); } + var updateNumber = lineNumbers && updateNumbersFrom != null && + updateNumbersFrom <= lineN && lineView.lineNumber; + if (lineView.changes) { + if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; } + updateLineForChanges(cm, lineView, lineN, dims); + } + if (updateNumber) { + removeChildren(lineView.lineNumber); + lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN))); + } + cur = lineView.node.nextSibling; + } + lineN += lineView.size; + } + while (cur) { cur = rm(cur); } + } + + function updateGutterSpace(display) { + var width = display.gutters.offsetWidth; + display.sizer.style.marginLeft = width + "px"; + } + + function setDocumentHeight(cm, measure) { + cm.display.sizer.style.minHeight = measure.docHeight + "px"; + cm.display.heightForcer.style.top = measure.docHeight + "px"; + cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px"; + } + + // Re-align line numbers and gutter marks to compensate for + // horizontal scrolling. + function alignHorizontally(cm) { + var display = cm.display, view = display.view; + if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return } + var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft; + var gutterW = display.gutters.offsetWidth, left = comp + "px"; + for (var i = 0; i < view.length; i++) { if (!view[i].hidden) { + if (cm.options.fixedGutter) { + if (view[i].gutter) + { view[i].gutter.style.left = left; } + if (view[i].gutterBackground) + { view[i].gutterBackground.style.left = left; } + } + var align = view[i].alignable; + if (align) { for (var j = 0; j < align.length; j++) + { align[j].style.left = left; } } + } } + if (cm.options.fixedGutter) + { display.gutters.style.left = (comp + gutterW) + "px"; } + } + + // Used to ensure that the line number gutter is still the right + // size for the current document size. Returns true when an update + // is needed. + function maybeUpdateLineNumberWidth(cm) { + if (!cm.options.lineNumbers) { return false } + var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display; + if (last.length != display.lineNumChars) { + var test = display.measure.appendChild(elt("div", [elt("div", last)], + "CodeMirror-linenumber CodeMirror-gutter-elt")); + var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW; + display.lineGutter.style.width = ""; + display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1; + display.lineNumWidth = display.lineNumInnerWidth + padding; + display.lineNumChars = display.lineNumInnerWidth ? last.length : -1; + display.lineGutter.style.width = display.lineNumWidth + "px"; + updateGutterSpace(cm.display); + return true + } + return false + } + + function getGutters(gutters, lineNumbers) { + var result = [], sawLineNumbers = false; + for (var i = 0; i < gutters.length; i++) { + var name = gutters[i], style = null; + if (typeof name != "string") { style = name.style; name = name.className; } + if (name == "CodeMirror-linenumbers") { + if (!lineNumbers) { continue } + else { sawLineNumbers = true; } + } + result.push({className: name, style: style}); + } + if (lineNumbers && !sawLineNumbers) { result.push({className: "CodeMirror-linenumbers", style: null}); } + return result + } + + // Rebuild the gutter elements, ensure the margin to the left of the + // code matches their width. + function renderGutters(display) { + var gutters = display.gutters, specs = display.gutterSpecs; + removeChildren(gutters); + display.lineGutter = null; + for (var i = 0; i < specs.length; ++i) { + var ref = specs[i]; + var className = ref.className; + var style = ref.style; + var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + className)); + if (style) { gElt.style.cssText = style; } + if (className == "CodeMirror-linenumbers") { + display.lineGutter = gElt; + gElt.style.width = (display.lineNumWidth || 1) + "px"; + } + } + gutters.style.display = specs.length ? "" : "none"; + updateGutterSpace(display); + } + + function updateGutters(cm) { + renderGutters(cm.display); + regChange(cm); + alignHorizontally(cm); + } + + // The display handles the DOM integration, both for input reading + // and content drawing. It holds references to DOM nodes and + // display-related state. + + function Display(place, doc, input, options) { + var d = this; + this.input = input; + + // Covers bottom-right square when both scrollbars are present. + d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler"); + d.scrollbarFiller.setAttribute("cm-not-content", "true"); + // Covers bottom of gutter when coverGutterNextToScrollbar is on + // and h scrollbar is present. + d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler"); + d.gutterFiller.setAttribute("cm-not-content", "true"); + // Will contain the actual code, positioned to cover the viewport. + d.lineDiv = eltP("div", null, "CodeMirror-code"); + // Elements are added to these to represent selection and cursors. + d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1"); + d.cursorDiv = elt("div", null, "CodeMirror-cursors"); + // A visibility: hidden element used to find the size of things. + d.measure = elt("div", null, "CodeMirror-measure"); + // When lines outside of the viewport are measured, they are drawn in this. + d.lineMeasure = elt("div", null, "CodeMirror-measure"); + // Wraps everything that needs to exist inside the vertically-padded coordinate system + d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv], + null, "position: relative; outline: none"); + var lines = eltP("div", [d.lineSpace], "CodeMirror-lines"); + // Moved around its parent to cover visible view. + d.mover = elt("div", [lines], null, "position: relative"); + // Set to the height of the document, allowing scrolling. + d.sizer = elt("div", [d.mover], "CodeMirror-sizer"); + d.sizerWidth = null; + // Behavior of elts with overflow: auto and padding is + // inconsistent across browsers. This is used to ensure the + // scrollable area is big enough. + d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;"); + // Will contain the gutters, if any. + d.gutters = elt("div", null, "CodeMirror-gutters"); + d.lineGutter = null; + // Actual scrollable element. + d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll"); + d.scroller.setAttribute("tabIndex", "-1"); + // The element in which the editor lives. + d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror"); + + // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) + if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; } + if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; } + + if (place) { + if (place.appendChild) { place.appendChild(d.wrapper); } + else { place(d.wrapper); } + } + + // Current rendered range (may be bigger than the view window). + d.viewFrom = d.viewTo = doc.first; + d.reportedViewFrom = d.reportedViewTo = doc.first; + // Information about the rendered lines. + d.view = []; + d.renderedView = null; + // Holds info about a single rendered line when it was rendered + // for measurement, while not in view. + d.externalMeasured = null; + // Empty space (in pixels) above the view + d.viewOffset = 0; + d.lastWrapHeight = d.lastWrapWidth = 0; + d.updateLineNumbers = null; + + d.nativeBarWidth = d.barHeight = d.barWidth = 0; + d.scrollbarsClipped = false; + + // Used to only resize the line number gutter when necessary (when + // the amount of lines crosses a boundary that makes its width change) + d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null; + // Set to true when a non-horizontal-scrolling line widget is + // added. As an optimization, line widget aligning is skipped when + // this is false. + d.alignWidgets = false; + + d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; + + // Tracks the maximum line length so that the horizontal scrollbar + // can be kept static when scrolling. + d.maxLine = null; + d.maxLineLength = 0; + d.maxLineChanged = false; + + // Used for measuring wheel scrolling granularity + d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null; + + // True when shift is held down. + d.shift = false; + + // Used to track whether anything happened since the context menu + // was opened. + d.selForContextMenu = null; + + d.activeTouch = null; + + d.gutterSpecs = getGutters(options.gutters, options.lineNumbers); + renderGutters(d); + + input.init(d); + } + + // Since the delta values reported on mouse wheel events are + // unstandardized between browsers and even browser versions, and + // generally horribly unpredictable, this code starts by measuring + // the scroll effect that the first few mouse wheel events have, + // and, from that, detects the way it can convert deltas to pixel + // offsets afterwards. + // + // The reason we want to know the amount a wheel event will scroll + // is that it gives us a chance to update the display before the + // actual scrolling happens, reducing flickering. + + var wheelSamples = 0, wheelPixelsPerUnit = null; + // Fill in a browser-detected starting value on browsers where we + // know one. These don't have to be accurate -- the result of them + // being wrong would just be a slight flicker on the first wheel + // scroll (if it is large enough). + if (ie) { wheelPixelsPerUnit = -.53; } + else if (gecko) { wheelPixelsPerUnit = 15; } + else if (chrome) { wheelPixelsPerUnit = -.7; } + else if (safari) { wheelPixelsPerUnit = -1/3; } + + function wheelEventDelta(e) { + var dx = e.wheelDeltaX, dy = e.wheelDeltaY; + if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; } + if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; } + else if (dy == null) { dy = e.wheelDelta; } + return {x: dx, y: dy} + } + function wheelEventPixels(e) { + var delta = wheelEventDelta(e); + delta.x *= wheelPixelsPerUnit; + delta.y *= wheelPixelsPerUnit; + return delta + } + + function onScrollWheel(cm, e) { + var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y; + + var display = cm.display, scroll = display.scroller; + // Quit if there's nothing to scroll here + var canScrollX = scroll.scrollWidth > scroll.clientWidth; + var canScrollY = scroll.scrollHeight > scroll.clientHeight; + if (!(dx && canScrollX || dy && canScrollY)) { return } + + // Webkit browsers on OS X abort momentum scrolls when the target + // of the scroll event is removed from the scrollable element. + // This hack (see related code in patchDisplay) makes sure the + // element is kept around. + if (dy && mac && webkit) { + outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) { + for (var i = 0; i < view.length; i++) { + if (view[i].node == cur) { + cm.display.currentWheelTarget = cur; + break outer + } + } + } + } + + // On some browsers, horizontal scrolling will cause redraws to + // happen before the gutter has been realigned, causing it to + // wriggle around in a most unseemly way. When we have an + // estimated pixels/delta value, we just handle horizontal + // scrolling entirely here. It'll be slightly off from native, but + // better than glitching out. + if (dx && !gecko && !presto && wheelPixelsPerUnit != null) { + if (dy && canScrollY) + { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); } + setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit)); + // Only prevent default scrolling if vertical scrolling is + // actually possible. Otherwise, it causes vertical scroll + // jitter on OSX trackpads when deltaX is small and deltaY + // is large (issue #3579) + if (!dy || (dy && canScrollY)) + { e_preventDefault(e); } + display.wheelStartX = null; // Abort measurement, if in progress + return + } + + // 'Project' the visible viewport to cover the area that is being + // scrolled into view (if we know enough to estimate it). + if (dy && wheelPixelsPerUnit != null) { + var pixels = dy * wheelPixelsPerUnit; + var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight; + if (pixels < 0) { top = Math.max(0, top + pixels - 50); } + else { bot = Math.min(cm.doc.height, bot + pixels + 50); } + updateDisplaySimple(cm, {top: top, bottom: bot}); + } + + if (wheelSamples < 20) { + if (display.wheelStartX == null) { + display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop; + display.wheelDX = dx; display.wheelDY = dy; + setTimeout(function () { + if (display.wheelStartX == null) { return } + var movedX = scroll.scrollLeft - display.wheelStartX; + var movedY = scroll.scrollTop - display.wheelStartY; + var sample = (movedY && display.wheelDY && movedY / display.wheelDY) || + (movedX && display.wheelDX && movedX / display.wheelDX); + display.wheelStartX = display.wheelStartY = null; + if (!sample) { return } + wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1); + ++wheelSamples; + }, 200); + } else { + display.wheelDX += dx; display.wheelDY += dy; + } + } + } + + // Selection objects are immutable. A new one is created every time + // the selection changes. A selection is one or more non-overlapping + // (and non-touching) ranges, sorted, and an integer that indicates + // which one is the primary selection (the one that's scrolled into + // view, that getCursor returns, etc). + var Selection = function(ranges, primIndex) { + this.ranges = ranges; + this.primIndex = primIndex; + }; + + Selection.prototype.primary = function () { return this.ranges[this.primIndex] }; + + Selection.prototype.equals = function (other) { + if (other == this) { return true } + if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false } + for (var i = 0; i < this.ranges.length; i++) { + var here = this.ranges[i], there = other.ranges[i]; + if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false } + } + return true + }; + + Selection.prototype.deepCopy = function () { + var out = []; + for (var i = 0; i < this.ranges.length; i++) + { out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head)); } + return new Selection(out, this.primIndex) + }; + + Selection.prototype.somethingSelected = function () { + for (var i = 0; i < this.ranges.length; i++) + { if (!this.ranges[i].empty()) { return true } } + return false + }; + + Selection.prototype.contains = function (pos, end) { + if (!end) { end = pos; } + for (var i = 0; i < this.ranges.length; i++) { + var range = this.ranges[i]; + if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0) + { return i } + } + return -1 + }; + + var Range = function(anchor, head) { + this.anchor = anchor; this.head = head; + }; + + Range.prototype.from = function () { return minPos(this.anchor, this.head) }; + Range.prototype.to = function () { return maxPos(this.anchor, this.head) }; + Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch }; + + // Take an unsorted, potentially overlapping set of ranges, and + // build a selection out of it. 'Consumes' ranges array (modifying + // it). + function normalizeSelection(cm, ranges, primIndex) { + var mayTouch = cm && cm.options.selectionsMayTouch; + var prim = ranges[primIndex]; + ranges.sort(function (a, b) { return cmp(a.from(), b.from()); }); + primIndex = indexOf(ranges, prim); + for (var i = 1; i < ranges.length; i++) { + var cur = ranges[i], prev = ranges[i - 1]; + var diff = cmp(prev.to(), cur.from()); + if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) { + var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to()); + var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head; + if (i <= primIndex) { --primIndex; } + ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to)); + } + } + return new Selection(ranges, primIndex) + } + + function simpleSelection(anchor, head) { + return new Selection([new Range(anchor, head || anchor)], 0) + } + + // Compute the position of the end of a change (its 'to' property + // refers to the pre-change end). + function changeEnd(change) { + if (!change.text) { return change.to } + return Pos(change.from.line + change.text.length - 1, + lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0)) + } + + // Adjust a position to refer to the post-change position of the + // same text, or the end of the change if the change covers it. + function adjustForChange(pos, change) { + if (cmp(pos, change.from) < 0) { return pos } + if (cmp(pos, change.to) <= 0) { return changeEnd(change) } + + var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch; + if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; } + return Pos(line, ch) + } + + function computeSelAfterChange(doc, change) { + var out = []; + for (var i = 0; i < doc.sel.ranges.length; i++) { + var range = doc.sel.ranges[i]; + out.push(new Range(adjustForChange(range.anchor, change), + adjustForChange(range.head, change))); + } + return normalizeSelection(doc.cm, out, doc.sel.primIndex) + } + + function offsetPos(pos, old, nw) { + if (pos.line == old.line) + { return Pos(nw.line, pos.ch - old.ch + nw.ch) } + else + { return Pos(nw.line + (pos.line - old.line), pos.ch) } + } + + // Used by replaceSelections to allow moving the selection to the + // start or around the replaced test. Hint may be "start" or "around". + function computeReplacedSel(doc, changes, hint) { + var out = []; + var oldPrev = Pos(doc.first, 0), newPrev = oldPrev; + for (var i = 0; i < changes.length; i++) { + var change = changes[i]; + var from = offsetPos(change.from, oldPrev, newPrev); + var to = offsetPos(changeEnd(change), oldPrev, newPrev); + oldPrev = change.to; + newPrev = to; + if (hint == "around") { + var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0; + out[i] = new Range(inv ? to : from, inv ? from : to); + } else { + out[i] = new Range(from, from); + } + } + return new Selection(out, doc.sel.primIndex) + } + + // Used to get the editor into a consistent state again when options change. + + function loadMode(cm) { + cm.doc.mode = getMode(cm.options, cm.doc.modeOption); + resetModeState(cm); + } + + function resetModeState(cm) { + cm.doc.iter(function (line) { + if (line.stateAfter) { line.stateAfter = null; } + if (line.styles) { line.styles = null; } + }); + cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first; + startWorker(cm, 100); + cm.state.modeGen++; + if (cm.curOp) { regChange(cm); } + } + + // DOCUMENT DATA STRUCTURE + + // By default, updates that start and end at the beginning of a line + // are treated specially, in order to make the association of line + // widgets and marker elements with the text behave more intuitive. + function isWholeLineUpdate(doc, change) { + return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" && + (!doc.cm || doc.cm.options.wholeLineUpdateBefore) + } + + // Perform a change on the document data structure. + function updateDoc(doc, change, markedSpans, estimateHeight) { + function spansFor(n) {return markedSpans ? markedSpans[n] : null} + function update(line, text, spans) { + updateLine(line, text, spans, estimateHeight); + signalLater(line, "change", line, change); + } + function linesFor(start, end) { + var result = []; + for (var i = start; i < end; ++i) + { result.push(new Line(text[i], spansFor(i), estimateHeight)); } + return result + } + + var from = change.from, to = change.to, text = change.text; + var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line); + var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line; + + // Adjust the line structure + if (change.full) { + doc.insert(0, linesFor(0, text.length)); + doc.remove(text.length, doc.size - text.length); + } else if (isWholeLineUpdate(doc, change)) { + // This is a whole-line replace. Treated specially to make + // sure line objects move the way they are supposed to. + var added = linesFor(0, text.length - 1); + update(lastLine, lastLine.text, lastSpans); + if (nlines) { doc.remove(from.line, nlines); } + if (added.length) { doc.insert(from.line, added); } + } else if (firstLine == lastLine) { + if (text.length == 1) { + update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans); + } else { + var added$1 = linesFor(1, text.length - 1); + added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight)); + update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)); + doc.insert(from.line + 1, added$1); + } + } else if (text.length == 1) { + update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0)); + doc.remove(from.line + 1, nlines); + } else { + update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)); + update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans); + var added$2 = linesFor(1, text.length - 1); + if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); } + doc.insert(from.line + 1, added$2); + } + + signalLater(doc, "change", doc, change); + } + + // Call f for all linked documents. + function linkedDocs(doc, f, sharedHistOnly) { + function propagate(doc, skip, sharedHist) { + if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) { + var rel = doc.linked[i]; + if (rel.doc == skip) { continue } + var shared = sharedHist && rel.sharedHist; + if (sharedHistOnly && !shared) { continue } + f(rel.doc, shared); + propagate(rel.doc, doc, shared); + } } + } + propagate(doc, null, true); + } + + // Attach a document to an editor. + function attachDoc(cm, doc) { + if (doc.cm) { throw new Error("This document is already in use.") } + cm.doc = doc; + doc.cm = cm; + estimateLineHeights(cm); + loadMode(cm); + setDirectionClass(cm); + if (!cm.options.lineWrapping) { findMaxLine(cm); } + cm.options.mode = doc.modeOption; + regChange(cm); + } + + function setDirectionClass(cm) { + (cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl"); + } + + function directionChanged(cm) { + runInOp(cm, function () { + setDirectionClass(cm); + regChange(cm); + }); + } + + function History(startGen) { + // Arrays of change events and selections. Doing something adds an + // event to done and clears undo. Undoing moves events from done + // to undone, redoing moves them in the other direction. + this.done = []; this.undone = []; + this.undoDepth = Infinity; + // Used to track when changes can be merged into a single undo + // event + this.lastModTime = this.lastSelTime = 0; + this.lastOp = this.lastSelOp = null; + this.lastOrigin = this.lastSelOrigin = null; + // Used by the isClean() method + this.generation = this.maxGeneration = startGen || 1; + } + + // Create a history change event from an updateDoc-style change + // object. + function historyChangeFromChange(doc, change) { + var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}; + attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); + linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true); + return histChange + } + + // Pop all selection events off the end of a history array. Stop at + // a change event. + function clearSelectionEvents(array) { + while (array.length) { + var last = lst(array); + if (last.ranges) { array.pop(); } + else { break } + } + } + + // Find the top change event in the history. Pop off selection + // events that are in the way. + function lastChangeEvent(hist, force) { + if (force) { + clearSelectionEvents(hist.done); + return lst(hist.done) + } else if (hist.done.length && !lst(hist.done).ranges) { + return lst(hist.done) + } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) { + hist.done.pop(); + return lst(hist.done) + } + } + + // Register a change in the history. Merges changes that are within + // a single operation, or are close together with an origin that + // allows merging (starting with "+") into a single event. + function addChangeToHistory(doc, change, selAfter, opId) { + var hist = doc.history; + hist.undone.length = 0; + var time = +new Date, cur; + var last; + + if ((hist.lastOp == opId || + hist.lastOrigin == change.origin && change.origin && + ((change.origin.charAt(0) == "+" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) || + change.origin.charAt(0) == "*")) && + (cur = lastChangeEvent(hist, hist.lastOp == opId))) { + // Merge this change into the last event + last = lst(cur.changes); + if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) { + // Optimized case for simple insertion -- don't want to add + // new changesets for every character typed + last.to = changeEnd(change); + } else { + // Add new sub-event + cur.changes.push(historyChangeFromChange(doc, change)); + } + } else { + // Can not be merged, start a new event. + var before = lst(hist.done); + if (!before || !before.ranges) + { pushSelectionToHistory(doc.sel, hist.done); } + cur = {changes: [historyChangeFromChange(doc, change)], + generation: hist.generation}; + hist.done.push(cur); + while (hist.done.length > hist.undoDepth) { + hist.done.shift(); + if (!hist.done[0].ranges) { hist.done.shift(); } + } + } + hist.done.push(selAfter); + hist.generation = ++hist.maxGeneration; + hist.lastModTime = hist.lastSelTime = time; + hist.lastOp = hist.lastSelOp = opId; + hist.lastOrigin = hist.lastSelOrigin = change.origin; + + if (!last) { signal(doc, "historyAdded"); } + } + + function selectionEventCanBeMerged(doc, origin, prev, sel) { + var ch = origin.charAt(0); + return ch == "*" || + ch == "+" && + prev.ranges.length == sel.ranges.length && + prev.somethingSelected() == sel.somethingSelected() && + new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500) + } + + // Called whenever the selection changes, sets the new selection as + // the pending selection in the history, and pushes the old pending + // selection into the 'done' array when it was significantly + // different (in number of selected ranges, emptiness, or time). + function addSelectionToHistory(doc, sel, opId, options) { + var hist = doc.history, origin = options && options.origin; + + // A new event is started when the previous origin does not match + // the current, or the origins don't allow matching. Origins + // starting with * are always merged, those starting with + are + // merged when similar and close together in time. + if (opId == hist.lastSelOp || + (origin && hist.lastSelOrigin == origin && + (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin || + selectionEventCanBeMerged(doc, origin, lst(hist.done), sel)))) + { hist.done[hist.done.length - 1] = sel; } + else + { pushSelectionToHistory(sel, hist.done); } + + hist.lastSelTime = +new Date; + hist.lastSelOrigin = origin; + hist.lastSelOp = opId; + if (options && options.clearRedo !== false) + { clearSelectionEvents(hist.undone); } + } + + function pushSelectionToHistory(sel, dest) { + var top = lst(dest); + if (!(top && top.ranges && top.equals(sel))) + { dest.push(sel); } + } + + // Used to store marked span information in the history. + function attachLocalSpans(doc, change, from, to) { + var existing = change["spans_" + doc.id], n = 0; + doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) { + if (line.markedSpans) + { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; } + ++n; + }); + } + + // When un/re-doing restores text containing marked spans, those + // that have been explicitly cleared should not be restored. + function removeClearedSpans(spans) { + if (!spans) { return null } + var out; + for (var i = 0; i < spans.length; ++i) { + if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } } + else if (out) { out.push(spans[i]); } + } + return !out ? spans : out.length ? out : null + } + + // Retrieve and filter the old marked spans stored in a change event. + function getOldSpans(doc, change) { + var found = change["spans_" + doc.id]; + if (!found) { return null } + var nw = []; + for (var i = 0; i < change.text.length; ++i) + { nw.push(removeClearedSpans(found[i])); } + return nw + } + + // Used for un/re-doing changes from the history. Combines the + // result of computing the existing spans with the set of spans that + // existed in the history (so that deleting around a span and then + // undoing brings back the span). + function mergeOldSpans(doc, change) { + var old = getOldSpans(doc, change); + var stretched = stretchSpansOverChange(doc, change); + if (!old) { return stretched } + if (!stretched) { return old } + + for (var i = 0; i < old.length; ++i) { + var oldCur = old[i], stretchCur = stretched[i]; + if (oldCur && stretchCur) { + spans: for (var j = 0; j < stretchCur.length; ++j) { + var span = stretchCur[j]; + for (var k = 0; k < oldCur.length; ++k) + { if (oldCur[k].marker == span.marker) { continue spans } } + oldCur.push(span); + } + } else if (stretchCur) { + old[i] = stretchCur; + } + } + return old + } + + // Used both to provide a JSON-safe object in .getHistory, and, when + // detaching a document, to split the history in two + function copyHistoryArray(events, newGroup, instantiateSel) { + var copy = []; + for (var i = 0; i < events.length; ++i) { + var event = events[i]; + if (event.ranges) { + copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event); + continue + } + var changes = event.changes, newChanges = []; + copy.push({changes: newChanges}); + for (var j = 0; j < changes.length; ++j) { + var change = changes[j], m = (void 0); + newChanges.push({from: change.from, to: change.to, text: change.text}); + if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) { + if (indexOf(newGroup, Number(m[1])) > -1) { + lst(newChanges)[prop] = change[prop]; + delete change[prop]; + } + } } } + } + } + return copy + } + + // The 'scroll' parameter given to many of these indicated whether + // the new cursor position should be scrolled into view after + // modifying the selection. + + // If shift is held or the extend flag is set, extends a range to + // include a given position (and optionally a second position). + // Otherwise, simply returns the range between the given positions. + // Used for cursor motion and such. + function extendRange(range, head, other, extend) { + if (extend) { + var anchor = range.anchor; + if (other) { + var posBefore = cmp(head, anchor) < 0; + if (posBefore != (cmp(other, anchor) < 0)) { + anchor = head; + head = other; + } else if (posBefore != (cmp(head, other) < 0)) { + head = other; + } + } + return new Range(anchor, head) + } else { + return new Range(other || head, head) + } + } + + // Extend the primary selection range, discard the rest. + function extendSelection(doc, head, other, options, extend) { + if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); } + setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options); + } + + // Extend all selections (pos is an array of selections with length + // equal the number of selections) + function extendSelections(doc, heads, options) { + var out = []; + var extend = doc.cm && (doc.cm.display.shift || doc.extend); + for (var i = 0; i < doc.sel.ranges.length; i++) + { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); } + var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex); + setSelection(doc, newSel, options); + } + + // Updates a single range in the selection. + function replaceOneSelection(doc, i, range, options) { + var ranges = doc.sel.ranges.slice(0); + ranges[i] = range; + setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options); + } + + // Reset the selection to a single range. + function setSimpleSelection(doc, anchor, head, options) { + setSelection(doc, simpleSelection(anchor, head), options); + } + + // Give beforeSelectionChange handlers a change to influence a + // selection update. + function filterSelectionChange(doc, sel, options) { + var obj = { + ranges: sel.ranges, + update: function(ranges) { + this.ranges = []; + for (var i = 0; i < ranges.length; i++) + { this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor), + clipPos(doc, ranges[i].head)); } + }, + origin: options && options.origin + }; + signal(doc, "beforeSelectionChange", doc, obj); + if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); } + if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) } + else { return sel } + } + + function setSelectionReplaceHistory(doc, sel, options) { + var done = doc.history.done, last = lst(done); + if (last && last.ranges) { + done[done.length - 1] = sel; + setSelectionNoUndo(doc, sel, options); + } else { + setSelection(doc, sel, options); + } + } + + // Set a new selection. + function setSelection(doc, sel, options) { + setSelectionNoUndo(doc, sel, options); + addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options); + } + + function setSelectionNoUndo(doc, sel, options) { + if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange")) + { sel = filterSelectionChange(doc, sel, options); } + + var bias = options && options.bias || + (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1); + setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true)); + + if (!(options && options.scroll === false) && doc.cm && doc.cm.getOption("readOnly") != "nocursor") + { ensureCursorVisible(doc.cm); } + } + + function setSelectionInner(doc, sel) { + if (sel.equals(doc.sel)) { return } + + doc.sel = sel; + + if (doc.cm) { + doc.cm.curOp.updateInput = 1; + doc.cm.curOp.selectionChanged = true; + signalCursorActivity(doc.cm); + } + signalLater(doc, "cursorActivity", doc); + } + + // Verify that the selection does not partially select any atomic + // marked ranges. + function reCheckSelection(doc) { + setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false)); + } + + // Return a selection that does not partially select any atomic + // ranges. + function skipAtomicInSelection(doc, sel, bias, mayClear) { + var out; + for (var i = 0; i < sel.ranges.length; i++) { + var range = sel.ranges[i]; + var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]; + var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear); + var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear); + if (out || newAnchor != range.anchor || newHead != range.head) { + if (!out) { out = sel.ranges.slice(0, i); } + out[i] = new Range(newAnchor, newHead); + } + } + return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel + } + + function skipAtomicInner(doc, pos, oldPos, dir, mayClear) { + var line = getLine(doc, pos.line); + if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) { + var sp = line.markedSpans[i], m = sp.marker; + + // Determine if we should prevent the cursor being placed to the left/right of an atomic marker + // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it + // is with selectLeft/Right + var preventCursorLeft = ("selectLeft" in m) ? !m.selectLeft : m.inclusiveLeft; + var preventCursorRight = ("selectRight" in m) ? !m.selectRight : m.inclusiveRight; + + if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) && + (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) { + if (mayClear) { + signal(m, "beforeCursorEnter"); + if (m.explicitlyCleared) { + if (!line.markedSpans) { break } + else {--i; continue} + } + } + if (!m.atomic) { continue } + + if (oldPos) { + var near = m.find(dir < 0 ? 1 : -1), diff = (void 0); + if (dir < 0 ? preventCursorRight : preventCursorLeft) + { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); } + if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0)) + { return skipAtomicInner(doc, near, pos, dir, mayClear) } + } + + var far = m.find(dir < 0 ? -1 : 1); + if (dir < 0 ? preventCursorLeft : preventCursorRight) + { far = movePos(doc, far, dir, far.line == pos.line ? line : null); } + return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null + } + } } + return pos + } + + // Ensure a given position is not inside an atomic range. + function skipAtomic(doc, pos, oldPos, bias, mayClear) { + var dir = bias || 1; + var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) || + (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) || + skipAtomicInner(doc, pos, oldPos, -dir, mayClear) || + (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true)); + if (!found) { + doc.cantEdit = true; + return Pos(doc.first, 0) + } + return found + } + + function movePos(doc, pos, dir, line) { + if (dir < 0 && pos.ch == 0) { + if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) } + else { return null } + } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) { + if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) } + else { return null } + } else { + return new Pos(pos.line, pos.ch + dir) + } + } + + function selectAll(cm) { + cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll); + } + + // UPDATING + + // Allow "beforeChange" event handlers to influence a change + function filterChange(doc, change, update) { + var obj = { + canceled: false, + from: change.from, + to: change.to, + text: change.text, + origin: change.origin, + cancel: function () { return obj.canceled = true; } + }; + if (update) { obj.update = function (from, to, text, origin) { + if (from) { obj.from = clipPos(doc, from); } + if (to) { obj.to = clipPos(doc, to); } + if (text) { obj.text = text; } + if (origin !== undefined) { obj.origin = origin; } + }; } + signal(doc, "beforeChange", doc, obj); + if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); } + + if (obj.canceled) { + if (doc.cm) { doc.cm.curOp.updateInput = 2; } + return null + } + return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin} + } + + // Apply a change to a document, and add it to the document's + // history, and propagating it to all linked documents. + function makeChange(doc, change, ignoreReadOnly) { + if (doc.cm) { + if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) } + if (doc.cm.state.suppressEdits) { return } + } + + if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { + change = filterChange(doc, change, true); + if (!change) { return } + } + + // Possibly split or suppress the update based on the presence + // of read-only spans in its range. + var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to); + if (split) { + for (var i = split.length - 1; i >= 0; --i) + { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text, origin: change.origin}); } + } else { + makeChangeInner(doc, change); + } + } + + function makeChangeInner(doc, change) { + if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return } + var selAfter = computeSelAfterChange(doc, change); + addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN); + + makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change)); + var rebased = []; + + linkedDocs(doc, function (doc, sharedHist) { + if (!sharedHist && indexOf(rebased, doc.history) == -1) { + rebaseHist(doc.history, change); + rebased.push(doc.history); + } + makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change)); + }); + } + + // Revert a change stored in a document's history. + function makeChangeFromHistory(doc, type, allowSelectionOnly) { + var suppress = doc.cm && doc.cm.state.suppressEdits; + if (suppress && !allowSelectionOnly) { return } + + var hist = doc.history, event, selAfter = doc.sel; + var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done; + + // Verify that there is a useable event (so that ctrl-z won't + // needlessly clear selection events) + var i = 0; + for (; i < source.length; i++) { + event = source[i]; + if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges) + { break } + } + if (i == source.length) { return } + hist.lastOrigin = hist.lastSelOrigin = null; + + for (;;) { + event = source.pop(); + if (event.ranges) { + pushSelectionToHistory(event, dest); + if (allowSelectionOnly && !event.equals(doc.sel)) { + setSelection(doc, event, {clearRedo: false}); + return + } + selAfter = event; + } else if (suppress) { + source.push(event); + return + } else { break } + } + + // Build up a reverse change object to add to the opposite history + // stack (redo when undoing, and vice versa). + var antiChanges = []; + pushSelectionToHistory(selAfter, dest); + dest.push({changes: antiChanges, generation: hist.generation}); + hist.generation = event.generation || ++hist.maxGeneration; + + var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange"); + + var loop = function ( i ) { + var change = event.changes[i]; + change.origin = type; + if (filter && !filterChange(doc, change, false)) { + source.length = 0; + return {} + } + + antiChanges.push(historyChangeFromChange(doc, change)); + + var after = i ? computeSelAfterChange(doc, change) : lst(source); + makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change)); + if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); } + var rebased = []; + + // Propagate to the linked documents + linkedDocs(doc, function (doc, sharedHist) { + if (!sharedHist && indexOf(rebased, doc.history) == -1) { + rebaseHist(doc.history, change); + rebased.push(doc.history); + } + makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change)); + }); + }; + + for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) { + var returned = loop( i$1 ); + + if ( returned ) return returned.v; + } + } + + // Sub-views need their line numbers shifted when text is added + // above or below them in the parent document. + function shiftDoc(doc, distance) { + if (distance == 0) { return } + doc.first += distance; + doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range( + Pos(range.anchor.line + distance, range.anchor.ch), + Pos(range.head.line + distance, range.head.ch) + ); }), doc.sel.primIndex); + if (doc.cm) { + regChange(doc.cm, doc.first, doc.first - distance, distance); + for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++) + { regLineChange(doc.cm, l, "gutter"); } + } + } + + // More lower-level change function, handling only a single document + // (not linked ones). + function makeChangeSingleDoc(doc, change, selAfter, spans) { + if (doc.cm && !doc.cm.curOp) + { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) } + + if (change.to.line < doc.first) { + shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line)); + return + } + if (change.from.line > doc.lastLine()) { return } + + // Clip the change to the size of this doc + if (change.from.line < doc.first) { + var shift = change.text.length - 1 - (doc.first - change.from.line); + shiftDoc(doc, shift); + change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch), + text: [lst(change.text)], origin: change.origin}; + } + var last = doc.lastLine(); + if (change.to.line > last) { + change = {from: change.from, to: Pos(last, getLine(doc, last).text.length), + text: [change.text[0]], origin: change.origin}; + } + + change.removed = getBetween(doc, change.from, change.to); + + if (!selAfter) { selAfter = computeSelAfterChange(doc, change); } + if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); } + else { updateDoc(doc, change, spans); } + setSelectionNoUndo(doc, selAfter, sel_dontScroll); + + if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0))) + { doc.cantEdit = false; } + } + + // Handle the interaction of a change to a document with the editor + // that this document is part of. + function makeChangeSingleDocInEditor(cm, change, spans) { + var doc = cm.doc, display = cm.display, from = change.from, to = change.to; + + var recomputeMaxLength = false, checkWidthStart = from.line; + if (!cm.options.lineWrapping) { + checkWidthStart = lineNo(visualLine(getLine(doc, from.line))); + doc.iter(checkWidthStart, to.line + 1, function (line) { + if (line == display.maxLine) { + recomputeMaxLength = true; + return true + } + }); + } + + if (doc.sel.contains(change.from, change.to) > -1) + { signalCursorActivity(cm); } + + updateDoc(doc, change, spans, estimateHeight(cm)); + + if (!cm.options.lineWrapping) { + doc.iter(checkWidthStart, from.line + change.text.length, function (line) { + var len = lineLength(line); + if (len > display.maxLineLength) { + display.maxLine = line; + display.maxLineLength = len; + display.maxLineChanged = true; + recomputeMaxLength = false; + } + }); + if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; } + } + + retreatFrontier(doc, from.line); + startWorker(cm, 400); + + var lendiff = change.text.length - (to.line - from.line) - 1; + // Remember that these lines changed, for updating the display + if (change.full) + { regChange(cm); } + else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) + { regLineChange(cm, from.line, "text"); } + else + { regChange(cm, from.line, to.line + 1, lendiff); } + + var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change"); + if (changeHandler || changesHandler) { + var obj = { + from: from, to: to, + text: change.text, + removed: change.removed, + origin: change.origin + }; + if (changeHandler) { signalLater(cm, "change", cm, obj); } + if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); } + } + cm.display.selForContextMenu = null; + } + + function replaceRange(doc, code, from, to, origin) { + var assign; + + if (!to) { to = from; } + if (cmp(to, from) < 0) { (assign = [to, from], from = assign[0], to = assign[1]); } + if (typeof code == "string") { code = doc.splitLines(code); } + makeChange(doc, {from: from, to: to, text: code, origin: origin}); + } + + // Rebasing/resetting history to deal with externally-sourced changes + + function rebaseHistSelSingle(pos, from, to, diff) { + if (to < pos.line) { + pos.line += diff; + } else if (from < pos.line) { + pos.line = from; + pos.ch = 0; + } + } + + // Tries to rebase an array of history events given a change in the + // document. If the change touches the same lines as the event, the + // event, and everything 'behind' it, is discarded. If the change is + // before the event, the event's positions are updated. Uses a + // copy-on-write scheme for the positions, to avoid having to + // reallocate them all on every rebase, but also avoid problems with + // shared position objects being unsafely updated. + function rebaseHistArray(array, from, to, diff) { + for (var i = 0; i < array.length; ++i) { + var sub = array[i], ok = true; + if (sub.ranges) { + if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; } + for (var j = 0; j < sub.ranges.length; j++) { + rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff); + rebaseHistSelSingle(sub.ranges[j].head, from, to, diff); + } + continue + } + for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) { + var cur = sub.changes[j$1]; + if (to < cur.from.line) { + cur.from = Pos(cur.from.line + diff, cur.from.ch); + cur.to = Pos(cur.to.line + diff, cur.to.ch); + } else if (from <= cur.to.line) { + ok = false; + break + } + } + if (!ok) { + array.splice(0, i + 1); + i = 0; + } + } + } + + function rebaseHist(hist, change) { + var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1; + rebaseHistArray(hist.done, from, to, diff); + rebaseHistArray(hist.undone, from, to, diff); + } + + // Utility for applying a change to a line by handle or number, + // returning the number and optionally registering the line as + // changed. + function changeLine(doc, handle, changeType, op) { + var no = handle, line = handle; + if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); } + else { no = lineNo(handle); } + if (no == null) { return null } + if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); } + return line + } + + // The document is represented as a BTree consisting of leaves, with + // chunk of lines in them, and branches, with up to ten leaves or + // other branch nodes below them. The top node is always a branch + // node, and is the document object itself (meaning it has + // additional methods and properties). + // + // All nodes have parent links. The tree is used both to go from + // line numbers to line objects, and to go from objects to numbers. + // It also indexes by height, and is used to convert between height + // and line object, and to find the total height of the document. + // + // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html + + function LeafChunk(lines) { + this.lines = lines; + this.parent = null; + var height = 0; + for (var i = 0; i < lines.length; ++i) { + lines[i].parent = this; + height += lines[i].height; + } + this.height = height; + } + + LeafChunk.prototype = { + chunkSize: function() { return this.lines.length }, + + // Remove the n lines at offset 'at'. + removeInner: function(at, n) { + for (var i = at, e = at + n; i < e; ++i) { + var line = this.lines[i]; + this.height -= line.height; + cleanUpLine(line); + signalLater(line, "delete"); + } + this.lines.splice(at, n); + }, + + // Helper used to collapse a small branch into a single leaf. + collapse: function(lines) { + lines.push.apply(lines, this.lines); + }, + + // Insert the given array of lines at offset 'at', count them as + // having the given height. + insertInner: function(at, lines, height) { + this.height += height; + this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at)); + for (var i = 0; i < lines.length; ++i) { lines[i].parent = this; } + }, + + // Used to iterate over a part of the tree. + iterN: function(at, n, op) { + for (var e = at + n; at < e; ++at) + { if (op(this.lines[at])) { return true } } + } + }; + + function BranchChunk(children) { + this.children = children; + var size = 0, height = 0; + for (var i = 0; i < children.length; ++i) { + var ch = children[i]; + size += ch.chunkSize(); height += ch.height; + ch.parent = this; + } + this.size = size; + this.height = height; + this.parent = null; + } + + BranchChunk.prototype = { + chunkSize: function() { return this.size }, + + removeInner: function(at, n) { + this.size -= n; + for (var i = 0; i < this.children.length; ++i) { + var child = this.children[i], sz = child.chunkSize(); + if (at < sz) { + var rm = Math.min(n, sz - at), oldHeight = child.height; + child.removeInner(at, rm); + this.height -= oldHeight - child.height; + if (sz == rm) { this.children.splice(i--, 1); child.parent = null; } + if ((n -= rm) == 0) { break } + at = 0; + } else { at -= sz; } + } + // If the result is smaller than 25 lines, ensure that it is a + // single leaf node. + if (this.size - n < 25 && + (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) { + var lines = []; + this.collapse(lines); + this.children = [new LeafChunk(lines)]; + this.children[0].parent = this; + } + }, + + collapse: function(lines) { + for (var i = 0; i < this.children.length; ++i) { this.children[i].collapse(lines); } + }, + + insertInner: function(at, lines, height) { + this.size += lines.length; + this.height += height; + for (var i = 0; i < this.children.length; ++i) { + var child = this.children[i], sz = child.chunkSize(); + if (at <= sz) { + child.insertInner(at, lines, height); + if (child.lines && child.lines.length > 50) { + // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced. + // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest. + var remaining = child.lines.length % 25 + 25; + for (var pos = remaining; pos < child.lines.length;) { + var leaf = new LeafChunk(child.lines.slice(pos, pos += 25)); + child.height -= leaf.height; + this.children.splice(++i, 0, leaf); + leaf.parent = this; + } + child.lines = child.lines.slice(0, remaining); + this.maybeSpill(); + } + break + } + at -= sz; + } + }, + + // When a node has grown, check whether it should be split. + maybeSpill: function() { + if (this.children.length <= 10) { return } + var me = this; + do { + var spilled = me.children.splice(me.children.length - 5, 5); + var sibling = new BranchChunk(spilled); + if (!me.parent) { // Become the parent node + var copy = new BranchChunk(me.children); + copy.parent = me; + me.children = [copy, sibling]; + me = copy; + } else { + me.size -= sibling.size; + me.height -= sibling.height; + var myIndex = indexOf(me.parent.children, me); + me.parent.children.splice(myIndex + 1, 0, sibling); + } + sibling.parent = me.parent; + } while (me.children.length > 10) + me.parent.maybeSpill(); + }, + + iterN: function(at, n, op) { + for (var i = 0; i < this.children.length; ++i) { + var child = this.children[i], sz = child.chunkSize(); + if (at < sz) { + var used = Math.min(n, sz - at); + if (child.iterN(at, used, op)) { return true } + if ((n -= used) == 0) { break } + at = 0; + } else { at -= sz; } + } + } + }; + + // Line widgets are block elements displayed above or below a line. + + var LineWidget = function(doc, node, options) { + if (options) { for (var opt in options) { if (options.hasOwnProperty(opt)) + { this[opt] = options[opt]; } } } + this.doc = doc; + this.node = node; + }; + + LineWidget.prototype.clear = function () { + var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line); + if (no == null || !ws) { return } + for (var i = 0; i < ws.length; ++i) { if (ws[i] == this) { ws.splice(i--, 1); } } + if (!ws.length) { line.widgets = null; } + var height = widgetHeight(this); + updateLineHeight(line, Math.max(0, line.height - height)); + if (cm) { + runInOp(cm, function () { + adjustScrollWhenAboveVisible(cm, line, -height); + regLineChange(cm, no, "widget"); + }); + signalLater(cm, "lineWidgetCleared", cm, this, no); + } + }; + + LineWidget.prototype.changed = function () { + var this$1 = this; + + var oldH = this.height, cm = this.doc.cm, line = this.line; + this.height = null; + var diff = widgetHeight(this) - oldH; + if (!diff) { return } + if (!lineIsHidden(this.doc, line)) { updateLineHeight(line, line.height + diff); } + if (cm) { + runInOp(cm, function () { + cm.curOp.forceUpdate = true; + adjustScrollWhenAboveVisible(cm, line, diff); + signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line)); + }); + } + }; + eventMixin(LineWidget); + + function adjustScrollWhenAboveVisible(cm, line, diff) { + if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop)) + { addToScrollTop(cm, diff); } + } + + function addLineWidget(doc, handle, node, options) { + var widget = new LineWidget(doc, node, options); + var cm = doc.cm; + if (cm && widget.noHScroll) { cm.display.alignWidgets = true; } + changeLine(doc, handle, "widget", function (line) { + var widgets = line.widgets || (line.widgets = []); + if (widget.insertAt == null) { widgets.push(widget); } + else { widgets.splice(Math.min(widgets.length, Math.max(0, widget.insertAt)), 0, widget); } + widget.line = line; + if (cm && !lineIsHidden(doc, line)) { + var aboveVisible = heightAtLine(line) < doc.scrollTop; + updateLineHeight(line, line.height + widgetHeight(widget)); + if (aboveVisible) { addToScrollTop(cm, widget.height); } + cm.curOp.forceUpdate = true; + } + return true + }); + if (cm) { signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)); } + return widget + } + + // TEXTMARKERS + + // Created with markText and setBookmark methods. A TextMarker is a + // handle that can be used to clear or find a marked position in the + // document. Line objects hold arrays (markedSpans) containing + // {from, to, marker} object pointing to such marker objects, and + // indicating that such a marker is present on that line. Multiple + // lines may point to the same marker when it spans across lines. + // The spans will have null for their from/to properties when the + // marker continues beyond the start/end of the line. Markers have + // links back to the lines they currently touch. + + // Collapsed markers have unique ids, in order to be able to order + // them, which is needed for uniquely determining an outer marker + // when they overlap (they may nest, but not partially overlap). + var nextMarkerId = 0; + + var TextMarker = function(doc, type) { + this.lines = []; + this.type = type; + this.doc = doc; + this.id = ++nextMarkerId; + }; + + // Clear the marker. + TextMarker.prototype.clear = function () { + if (this.explicitlyCleared) { return } + var cm = this.doc.cm, withOp = cm && !cm.curOp; + if (withOp) { startOperation(cm); } + if (hasHandler(this, "clear")) { + var found = this.find(); + if (found) { signalLater(this, "clear", found.from, found.to); } + } + var min = null, max = null; + for (var i = 0; i < this.lines.length; ++i) { + var line = this.lines[i]; + var span = getMarkedSpanFor(line.markedSpans, this); + if (cm && !this.collapsed) { regLineChange(cm, lineNo(line), "text"); } + else if (cm) { + if (span.to != null) { max = lineNo(line); } + if (span.from != null) { min = lineNo(line); } + } + line.markedSpans = removeMarkedSpan(line.markedSpans, span); + if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm) + { updateLineHeight(line, textHeight(cm.display)); } + } + if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) { + var visual = visualLine(this.lines[i$1]), len = lineLength(visual); + if (len > cm.display.maxLineLength) { + cm.display.maxLine = visual; + cm.display.maxLineLength = len; + cm.display.maxLineChanged = true; + } + } } + + if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); } + this.lines.length = 0; + this.explicitlyCleared = true; + if (this.atomic && this.doc.cantEdit) { + this.doc.cantEdit = false; + if (cm) { reCheckSelection(cm.doc); } + } + if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); } + if (withOp) { endOperation(cm); } + if (this.parent) { this.parent.clear(); } + }; + + // Find the position of the marker in the document. Returns a {from, + // to} object by default. Side can be passed to get a specific side + // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the + // Pos objects returned contain a line object, rather than a line + // number (used to prevent looking up the same line twice). + TextMarker.prototype.find = function (side, lineObj) { + if (side == null && this.type == "bookmark") { side = 1; } + var from, to; + for (var i = 0; i < this.lines.length; ++i) { + var line = this.lines[i]; + var span = getMarkedSpanFor(line.markedSpans, this); + if (span.from != null) { + from = Pos(lineObj ? line : lineNo(line), span.from); + if (side == -1) { return from } + } + if (span.to != null) { + to = Pos(lineObj ? line : lineNo(line), span.to); + if (side == 1) { return to } + } + } + return from && {from: from, to: to} + }; + + // Signals that the marker's widget changed, and surrounding layout + // should be recomputed. + TextMarker.prototype.changed = function () { + var this$1 = this; + + var pos = this.find(-1, true), widget = this, cm = this.doc.cm; + if (!pos || !cm) { return } + runInOp(cm, function () { + var line = pos.line, lineN = lineNo(pos.line); + var view = findViewForLine(cm, lineN); + if (view) { + clearLineMeasurementCacheFor(view); + cm.curOp.selectionChanged = cm.curOp.forceUpdate = true; + } + cm.curOp.updateMaxLine = true; + if (!lineIsHidden(widget.doc, line) && widget.height != null) { + var oldHeight = widget.height; + widget.height = null; + var dHeight = widgetHeight(widget) - oldHeight; + if (dHeight) + { updateLineHeight(line, line.height + dHeight); } + } + signalLater(cm, "markerChanged", cm, this$1); + }); + }; + + TextMarker.prototype.attachLine = function (line) { + if (!this.lines.length && this.doc.cm) { + var op = this.doc.cm.curOp; + if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1) + { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); } + } + this.lines.push(line); + }; + + TextMarker.prototype.detachLine = function (line) { + this.lines.splice(indexOf(this.lines, line), 1); + if (!this.lines.length && this.doc.cm) { + var op = this.doc.cm.curOp + ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this); + } + }; + eventMixin(TextMarker); + + // Create a marker, wire it up to the right lines, and + function markText(doc, from, to, options, type) { + // Shared markers (across linked documents) are handled separately + // (markTextShared will call out to this again, once per + // document). + if (options && options.shared) { return markTextShared(doc, from, to, options, type) } + // Ensure we are in an operation. + if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) } + + var marker = new TextMarker(doc, type), diff = cmp(from, to); + if (options) { copyObj(options, marker, false); } + // Don't connect empty markers unless clearWhenEmpty is false + if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false) + { return marker } + if (marker.replacedWith) { + // Showing up as a widget implies collapsed (widget replaces text) + marker.collapsed = true; + marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget"); + if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); } + if (options.insertLeft) { marker.widgetNode.insertLeft = true; } + } + if (marker.collapsed) { + if (conflictingCollapsedRange(doc, from.line, from, to, marker) || + from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker)) + { throw new Error("Inserting collapsed marker partially overlapping an existing one") } + seeCollapsedSpans(); + } + + if (marker.addToHistory) + { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); } + + var curLine = from.line, cm = doc.cm, updateMaxLine; + doc.iter(curLine, to.line + 1, function (line) { + if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine) + { updateMaxLine = true; } + if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); } + addMarkedSpan(line, new MarkedSpan(marker, + curLine == from.line ? from.ch : null, + curLine == to.line ? to.ch : null)); + ++curLine; + }); + // lineIsHidden depends on the presence of the spans, so needs a second pass + if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) { + if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); } + }); } + + if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); } + + if (marker.readOnly) { + seeReadOnlySpans(); + if (doc.history.done.length || doc.history.undone.length) + { doc.clearHistory(); } + } + if (marker.collapsed) { + marker.id = ++nextMarkerId; + marker.atomic = true; + } + if (cm) { + // Sync editor state + if (updateMaxLine) { cm.curOp.updateMaxLine = true; } + if (marker.collapsed) + { regChange(cm, from.line, to.line + 1); } + else if (marker.className || marker.startStyle || marker.endStyle || marker.css || + marker.attributes || marker.title) + { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } } + if (marker.atomic) { reCheckSelection(cm.doc); } + signalLater(cm, "markerAdded", cm, marker); + } + return marker + } + + // SHARED TEXTMARKERS + + // A shared marker spans multiple linked documents. It is + // implemented as a meta-marker-object controlling multiple normal + // markers. + var SharedTextMarker = function(markers, primary) { + this.markers = markers; + this.primary = primary; + for (var i = 0; i < markers.length; ++i) + { markers[i].parent = this; } + }; + + SharedTextMarker.prototype.clear = function () { + if (this.explicitlyCleared) { return } + this.explicitlyCleared = true; + for (var i = 0; i < this.markers.length; ++i) + { this.markers[i].clear(); } + signalLater(this, "clear"); + }; + + SharedTextMarker.prototype.find = function (side, lineObj) { + return this.primary.find(side, lineObj) + }; + eventMixin(SharedTextMarker); + + function markTextShared(doc, from, to, options, type) { + options = copyObj(options); + options.shared = false; + var markers = [markText(doc, from, to, options, type)], primary = markers[0]; + var widget = options.widgetNode; + linkedDocs(doc, function (doc) { + if (widget) { options.widgetNode = widget.cloneNode(true); } + markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type)); + for (var i = 0; i < doc.linked.length; ++i) + { if (doc.linked[i].isParent) { return } } + primary = lst(markers); + }); + return new SharedTextMarker(markers, primary) + } + + function findSharedMarkers(doc) { + return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; }) + } + + function copySharedMarkers(doc, markers) { + for (var i = 0; i < markers.length; i++) { + var marker = markers[i], pos = marker.find(); + var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to); + if (cmp(mFrom, mTo)) { + var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type); + marker.markers.push(subMark); + subMark.parent = marker; + } + } + } + + function detachSharedMarkers(markers) { + var loop = function ( i ) { + var marker = markers[i], linked = [marker.primary.doc]; + linkedDocs(marker.primary.doc, function (d) { return linked.push(d); }); + for (var j = 0; j < marker.markers.length; j++) { + var subMarker = marker.markers[j]; + if (indexOf(linked, subMarker.doc) == -1) { + subMarker.parent = null; + marker.markers.splice(j--, 1); + } + } + }; + + for (var i = 0; i < markers.length; i++) loop( i ); + } + + var nextDocId = 0; + var Doc = function(text, mode, firstLine, lineSep, direction) { + if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) } + if (firstLine == null) { firstLine = 0; } + + BranchChunk.call(this, [new LeafChunk([new Line("", null)])]); + this.first = firstLine; + this.scrollTop = this.scrollLeft = 0; + this.cantEdit = false; + this.cleanGeneration = 1; + this.modeFrontier = this.highlightFrontier = firstLine; + var start = Pos(firstLine, 0); + this.sel = simpleSelection(start); + this.history = new History(null); + this.id = ++nextDocId; + this.modeOption = mode; + this.lineSep = lineSep; + this.direction = (direction == "rtl") ? "rtl" : "ltr"; + this.extend = false; + + if (typeof text == "string") { text = this.splitLines(text); } + updateDoc(this, {from: start, to: start, text: text}); + setSelection(this, simpleSelection(start), sel_dontScroll); + }; + + Doc.prototype = createObj(BranchChunk.prototype, { + constructor: Doc, + // Iterate over the document. Supports two forms -- with only one + // argument, it calls that for each line in the document. With + // three, it iterates over the range given by the first two (with + // the second being non-inclusive). + iter: function(from, to, op) { + if (op) { this.iterN(from - this.first, to - from, op); } + else { this.iterN(this.first, this.first + this.size, from); } + }, + + // Non-public interface for adding and removing lines. + insert: function(at, lines) { + var height = 0; + for (var i = 0; i < lines.length; ++i) { height += lines[i].height; } + this.insertInner(at - this.first, lines, height); + }, + remove: function(at, n) { this.removeInner(at - this.first, n); }, + + // From here, the methods are part of the public interface. Most + // are also available from CodeMirror (editor) instances. + + getValue: function(lineSep) { + var lines = getLines(this, this.first, this.first + this.size); + if (lineSep === false) { return lines } + return lines.join(lineSep || this.lineSeparator()) + }, + setValue: docMethodOp(function(code) { + var top = Pos(this.first, 0), last = this.first + this.size - 1; + makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length), + text: this.splitLines(code), origin: "setValue", full: true}, true); + if (this.cm) { scrollToCoords(this.cm, 0, 0); } + setSelection(this, simpleSelection(top), sel_dontScroll); + }), + replaceRange: function(code, from, to, origin) { + from = clipPos(this, from); + to = to ? clipPos(this, to) : from; + replaceRange(this, code, from, to, origin); + }, + getRange: function(from, to, lineSep) { + var lines = getBetween(this, clipPos(this, from), clipPos(this, to)); + if (lineSep === false) { return lines } + return lines.join(lineSep || this.lineSeparator()) + }, + + getLine: function(line) {var l = this.getLineHandle(line); return l && l.text}, + + getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }}, + getLineNumber: function(line) {return lineNo(line)}, + + getLineHandleVisualStart: function(line) { + if (typeof line == "number") { line = getLine(this, line); } + return visualLine(line) + }, + + lineCount: function() {return this.size}, + firstLine: function() {return this.first}, + lastLine: function() {return this.first + this.size - 1}, + + clipPos: function(pos) {return clipPos(this, pos)}, + + getCursor: function(start) { + var range = this.sel.primary(), pos; + if (start == null || start == "head") { pos = range.head; } + else if (start == "anchor") { pos = range.anchor; } + else if (start == "end" || start == "to" || start === false) { pos = range.to(); } + else { pos = range.from(); } + return pos + }, + listSelections: function() { return this.sel.ranges }, + somethingSelected: function() {return this.sel.somethingSelected()}, + + setCursor: docMethodOp(function(line, ch, options) { + setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options); + }), + setSelection: docMethodOp(function(anchor, head, options) { + setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options); + }), + extendSelection: docMethodOp(function(head, other, options) { + extendSelection(this, clipPos(this, head), other && clipPos(this, other), options); + }), + extendSelections: docMethodOp(function(heads, options) { + extendSelections(this, clipPosArray(this, heads), options); + }), + extendSelectionsBy: docMethodOp(function(f, options) { + var heads = map(this.sel.ranges, f); + extendSelections(this, clipPosArray(this, heads), options); + }), + setSelections: docMethodOp(function(ranges, primary, options) { + if (!ranges.length) { return } + var out = []; + for (var i = 0; i < ranges.length; i++) + { out[i] = new Range(clipPos(this, ranges[i].anchor), + clipPos(this, ranges[i].head)); } + if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); } + setSelection(this, normalizeSelection(this.cm, out, primary), options); + }), + addSelection: docMethodOp(function(anchor, head, options) { + var ranges = this.sel.ranges.slice(0); + ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor))); + setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options); + }), + + getSelection: function(lineSep) { + var ranges = this.sel.ranges, lines; + for (var i = 0; i < ranges.length; i++) { + var sel = getBetween(this, ranges[i].from(), ranges[i].to()); + lines = lines ? lines.concat(sel) : sel; + } + if (lineSep === false) { return lines } + else { return lines.join(lineSep || this.lineSeparator()) } + }, + getSelections: function(lineSep) { + var parts = [], ranges = this.sel.ranges; + for (var i = 0; i < ranges.length; i++) { + var sel = getBetween(this, ranges[i].from(), ranges[i].to()); + if (lineSep !== false) { sel = sel.join(lineSep || this.lineSeparator()); } + parts[i] = sel; + } + return parts + }, + replaceSelection: function(code, collapse, origin) { + var dup = []; + for (var i = 0; i < this.sel.ranges.length; i++) + { dup[i] = code; } + this.replaceSelections(dup, collapse, origin || "+input"); + }, + replaceSelections: docMethodOp(function(code, collapse, origin) { + var changes = [], sel = this.sel; + for (var i = 0; i < sel.ranges.length; i++) { + var range = sel.ranges[i]; + changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin}; + } + var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse); + for (var i$1 = changes.length - 1; i$1 >= 0; i$1--) + { makeChange(this, changes[i$1]); } + if (newSel) { setSelectionReplaceHistory(this, newSel); } + else if (this.cm) { ensureCursorVisible(this.cm); } + }), + undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}), + redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}), + undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}), + redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}), + + setExtending: function(val) {this.extend = val;}, + getExtending: function() {return this.extend}, + + historySize: function() { + var hist = this.history, done = 0, undone = 0; + for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } } + for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } } + return {undo: done, redo: undone} + }, + clearHistory: function() { + var this$1 = this; + + this.history = new History(this.history.maxGeneration); + linkedDocs(this, function (doc) { return doc.history = this$1.history; }, true); + }, + + markClean: function() { + this.cleanGeneration = this.changeGeneration(true); + }, + changeGeneration: function(forceSplit) { + if (forceSplit) + { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; } + return this.history.generation + }, + isClean: function (gen) { + return this.history.generation == (gen || this.cleanGeneration) + }, + + getHistory: function() { + return {done: copyHistoryArray(this.history.done), + undone: copyHistoryArray(this.history.undone)} + }, + setHistory: function(histData) { + var hist = this.history = new History(this.history.maxGeneration); + hist.done = copyHistoryArray(histData.done.slice(0), null, true); + hist.undone = copyHistoryArray(histData.undone.slice(0), null, true); + }, + + setGutterMarker: docMethodOp(function(line, gutterID, value) { + return changeLine(this, line, "gutter", function (line) { + var markers = line.gutterMarkers || (line.gutterMarkers = {}); + markers[gutterID] = value; + if (!value && isEmpty(markers)) { line.gutterMarkers = null; } + return true + }) + }), + + clearGutter: docMethodOp(function(gutterID) { + var this$1 = this; + + this.iter(function (line) { + if (line.gutterMarkers && line.gutterMarkers[gutterID]) { + changeLine(this$1, line, "gutter", function () { + line.gutterMarkers[gutterID] = null; + if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; } + return true + }); + } + }); + }), + + lineInfo: function(line) { + var n; + if (typeof line == "number") { + if (!isLine(this, line)) { return null } + n = line; + line = getLine(this, line); + if (!line) { return null } + } else { + n = lineNo(line); + if (n == null) { return null } + } + return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers, + textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass, + widgets: line.widgets} + }, + + addLineClass: docMethodOp(function(handle, where, cls) { + return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) { + var prop = where == "text" ? "textClass" + : where == "background" ? "bgClass" + : where == "gutter" ? "gutterClass" : "wrapClass"; + if (!line[prop]) { line[prop] = cls; } + else if (classTest(cls).test(line[prop])) { return false } + else { line[prop] += " " + cls; } + return true + }) + }), + removeLineClass: docMethodOp(function(handle, where, cls) { + return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) { + var prop = where == "text" ? "textClass" + : where == "background" ? "bgClass" + : where == "gutter" ? "gutterClass" : "wrapClass"; + var cur = line[prop]; + if (!cur) { return false } + else if (cls == null) { line[prop] = null; } + else { + var found = cur.match(classTest(cls)); + if (!found) { return false } + var end = found.index + found[0].length; + line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null; + } + return true + }) + }), + + addLineWidget: docMethodOp(function(handle, node, options) { + return addLineWidget(this, handle, node, options) + }), + removeLineWidget: function(widget) { widget.clear(); }, + + markText: function(from, to, options) { + return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range") + }, + setBookmark: function(pos, options) { + var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options), + insertLeft: options && options.insertLeft, + clearWhenEmpty: false, shared: options && options.shared, + handleMouseEvents: options && options.handleMouseEvents}; + pos = clipPos(this, pos); + return markText(this, pos, pos, realOpts, "bookmark") + }, + findMarksAt: function(pos) { + pos = clipPos(this, pos); + var markers = [], spans = getLine(this, pos.line).markedSpans; + if (spans) { for (var i = 0; i < spans.length; ++i) { + var span = spans[i]; + if ((span.from == null || span.from <= pos.ch) && + (span.to == null || span.to >= pos.ch)) + { markers.push(span.marker.parent || span.marker); } + } } + return markers + }, + findMarks: function(from, to, filter) { + from = clipPos(this, from); to = clipPos(this, to); + var found = [], lineNo = from.line; + this.iter(from.line, to.line + 1, function (line) { + var spans = line.markedSpans; + if (spans) { for (var i = 0; i < spans.length; i++) { + var span = spans[i]; + if (!(span.to != null && lineNo == from.line && from.ch >= span.to || + span.from == null && lineNo != from.line || + span.from != null && lineNo == to.line && span.from >= to.ch) && + (!filter || filter(span.marker))) + { found.push(span.marker.parent || span.marker); } + } } + ++lineNo; + }); + return found + }, + getAllMarks: function() { + var markers = []; + this.iter(function (line) { + var sps = line.markedSpans; + if (sps) { for (var i = 0; i < sps.length; ++i) + { if (sps[i].from != null) { markers.push(sps[i].marker); } } } + }); + return markers + }, + + posFromIndex: function(off) { + var ch, lineNo = this.first, sepSize = this.lineSeparator().length; + this.iter(function (line) { + var sz = line.text.length + sepSize; + if (sz > off) { ch = off; return true } + off -= sz; + ++lineNo; + }); + return clipPos(this, Pos(lineNo, ch)) + }, + indexFromPos: function (coords) { + coords = clipPos(this, coords); + var index = coords.ch; + if (coords.line < this.first || coords.ch < 0) { return 0 } + var sepSize = this.lineSeparator().length; + this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value + index += line.text.length + sepSize; + }); + return index + }, + + copy: function(copyHistory) { + var doc = new Doc(getLines(this, this.first, this.first + this.size), + this.modeOption, this.first, this.lineSep, this.direction); + doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft; + doc.sel = this.sel; + doc.extend = false; + if (copyHistory) { + doc.history.undoDepth = this.history.undoDepth; + doc.setHistory(this.getHistory()); + } + return doc + }, + + linkedDoc: function(options) { + if (!options) { options = {}; } + var from = this.first, to = this.first + this.size; + if (options.from != null && options.from > from) { from = options.from; } + if (options.to != null && options.to < to) { to = options.to; } + var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction); + if (options.sharedHist) { copy.history = this.history + ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist}); + copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}]; + copySharedMarkers(copy, findSharedMarkers(this)); + return copy + }, + unlinkDoc: function(other) { + if (other instanceof CodeMirror) { other = other.doc; } + if (this.linked) { for (var i = 0; i < this.linked.length; ++i) { + var link = this.linked[i]; + if (link.doc != other) { continue } + this.linked.splice(i, 1); + other.unlinkDoc(this); + detachSharedMarkers(findSharedMarkers(this)); + break + } } + // If the histories were shared, split them again + if (other.history == this.history) { + var splitIds = [other.id]; + linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true); + other.history = new History(null); + other.history.done = copyHistoryArray(this.history.done, splitIds); + other.history.undone = copyHistoryArray(this.history.undone, splitIds); + } + }, + iterLinkedDocs: function(f) {linkedDocs(this, f);}, + + getMode: function() {return this.mode}, + getEditor: function() {return this.cm}, + + splitLines: function(str) { + if (this.lineSep) { return str.split(this.lineSep) } + return splitLinesAuto(str) + }, + lineSeparator: function() { return this.lineSep || "\n" }, + + setDirection: docMethodOp(function (dir) { + if (dir != "rtl") { dir = "ltr"; } + if (dir == this.direction) { return } + this.direction = dir; + this.iter(function (line) { return line.order = null; }); + if (this.cm) { directionChanged(this.cm); } + }) + }); + + // Public alias. + Doc.prototype.eachLine = Doc.prototype.iter; + + // Kludge to work around strange IE behavior where it'll sometimes + // re-fire a series of drag-related events right after the drop (#1551) + var lastDrop = 0; + + function onDrop(e) { + var cm = this; + clearDragCursor(cm); + if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) + { return } + e_preventDefault(e); + if (ie) { lastDrop = +new Date; } + var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files; + if (!pos || cm.isReadOnly()) { return } + // Might be a file drop, in which case we simply extract the text + // and insert it. + if (files && files.length && window.FileReader && window.File) { + var n = files.length, text = Array(n), read = 0; + var markAsReadAndPasteIfAllFilesAreRead = function () { + if (++read == n) { + operation(cm, function () { + pos = clipPos(cm.doc, pos); + var change = {from: pos, to: pos, + text: cm.doc.splitLines( + text.filter(function (t) { return t != null; }).join(cm.doc.lineSeparator())), + origin: "paste"}; + makeChange(cm.doc, change); + setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change)))); + })(); + } + }; + var readTextFromFile = function (file, i) { + if (cm.options.allowDropFileTypes && + indexOf(cm.options.allowDropFileTypes, file.type) == -1) { + markAsReadAndPasteIfAllFilesAreRead(); + return + } + var reader = new FileReader; + reader.onerror = function () { return markAsReadAndPasteIfAllFilesAreRead(); }; + reader.onload = function () { + var content = reader.result; + if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { + markAsReadAndPasteIfAllFilesAreRead(); + return + } + text[i] = content; + markAsReadAndPasteIfAllFilesAreRead(); + }; + reader.readAsText(file); + }; + for (var i = 0; i < files.length; i++) { readTextFromFile(files[i], i); } + } else { // Normal drop + // Don't do a replace if the drop happened inside of the selected text. + if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) { + cm.state.draggingText(e); + // Ensure the editor is re-focused + setTimeout(function () { return cm.display.input.focus(); }, 20); + return + } + try { + var text$1 = e.dataTransfer.getData("Text"); + if (text$1) { + var selected; + if (cm.state.draggingText && !cm.state.draggingText.copy) + { selected = cm.listSelections(); } + setSelectionNoUndo(cm.doc, simpleSelection(pos, pos)); + if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1) + { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } } + cm.replaceSelection(text$1, "around", "paste"); + cm.display.input.focus(); + } + } + catch(e$1){} + } + } + + function onDragStart(cm, e) { + if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return } + if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return } + + e.dataTransfer.setData("Text", cm.getSelection()); + e.dataTransfer.effectAllowed = "copyMove"; + + // Use dummy image instead of default browsers image. + // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there. + if (e.dataTransfer.setDragImage && !safari) { + var img = elt("img", null, null, "position: fixed; left: 0; top: 0;"); + img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; + if (presto) { + img.width = img.height = 1; + cm.display.wrapper.appendChild(img); + // Force a relayout, or Opera won't use our image for some obscure reason + img._top = img.offsetTop; + } + e.dataTransfer.setDragImage(img, 0, 0); + if (presto) { img.parentNode.removeChild(img); } + } + } + + function onDragOver(cm, e) { + var pos = posFromMouse(cm, e); + if (!pos) { return } + var frag = document.createDocumentFragment(); + drawSelectionCursor(cm, pos, frag); + if (!cm.display.dragCursor) { + cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors"); + cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv); + } + removeChildrenAndAdd(cm.display.dragCursor, frag); + } + + function clearDragCursor(cm) { + if (cm.display.dragCursor) { + cm.display.lineSpace.removeChild(cm.display.dragCursor); + cm.display.dragCursor = null; + } + } + + // These must be handled carefully, because naively registering a + // handler for each editor will cause the editors to never be + // garbage collected. + + function forEachCodeMirror(f) { + if (!document.getElementsByClassName) { return } + var byClass = document.getElementsByClassName("CodeMirror"), editors = []; + for (var i = 0; i < byClass.length; i++) { + var cm = byClass[i].CodeMirror; + if (cm) { editors.push(cm); } + } + if (editors.length) { editors[0].operation(function () { + for (var i = 0; i < editors.length; i++) { f(editors[i]); } + }); } + } + + var globalsRegistered = false; + function ensureGlobalHandlers() { + if (globalsRegistered) { return } + registerGlobalHandlers(); + globalsRegistered = true; + } + function registerGlobalHandlers() { + // When the window resizes, we need to refresh active editors. + var resizeTimer; + on(window, "resize", function () { + if (resizeTimer == null) { resizeTimer = setTimeout(function () { + resizeTimer = null; + forEachCodeMirror(onResize); + }, 100); } + }); + // When the window loses focus, we want to show the editor as blurred + on(window, "blur", function () { return forEachCodeMirror(onBlur); }); + } + // Called when the window resizes + function onResize(cm) { + var d = cm.display; + // Might be a text scaling operation, clear size caches. + d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; + d.scrollbarsClipped = false; + cm.setSize(); + } + + var keyNames = { + 3: "Pause", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt", + 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", + 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert", + 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod", + 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 145: "ScrollLock", + 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", + 221: "]", 222: "'", 224: "Mod", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete", + 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert" + }; + + // Number keys + for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); } + // Alphabetic keys + for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); } + // Function keys + for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; } + + var keyMap = {}; + + keyMap.basic = { + "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown", + "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown", + "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore", + "Tab": "defaultTab", "Shift-Tab": "indentAuto", + "Enter": "newlineAndIndent", "Insert": "toggleOverwrite", + "Esc": "singleSelection" + }; + // Note that the save and find-related commands aren't defined by + // default. User code or addons can define them. Unknown commands + // are simply ignored. + keyMap.pcDefault = { + "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo", + "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown", + "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd", + "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find", + "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll", + "Ctrl-[": "indentLess", "Ctrl-]": "indentMore", + "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection", + "fallthrough": "basic" + }; + // Very basic readline/emacs-style bindings, which are standard on Mac. + keyMap.emacsy = { + "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown", + "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", + "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore", + "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars", + "Ctrl-O": "openLine" + }; + keyMap.macDefault = { + "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo", + "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft", + "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore", + "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find", + "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll", + "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight", + "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd", + "fallthrough": ["basic", "emacsy"] + }; + keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault; + + // KEYMAP DISPATCH + + function normalizeKeyName(name) { + var parts = name.split(/-(?!$)/); + name = parts[parts.length - 1]; + var alt, ctrl, shift, cmd; + for (var i = 0; i < parts.length - 1; i++) { + var mod = parts[i]; + if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; } + else if (/^a(lt)?$/i.test(mod)) { alt = true; } + else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; } + else if (/^s(hift)?$/i.test(mod)) { shift = true; } + else { throw new Error("Unrecognized modifier name: " + mod) } + } + if (alt) { name = "Alt-" + name; } + if (ctrl) { name = "Ctrl-" + name; } + if (cmd) { name = "Cmd-" + name; } + if (shift) { name = "Shift-" + name; } + return name + } + + // This is a kludge to keep keymaps mostly working as raw objects + // (backwards compatibility) while at the same time support features + // like normalization and multi-stroke key bindings. It compiles a + // new normalized keymap, and then updates the old object to reflect + // this. + function normalizeKeyMap(keymap) { + var copy = {}; + for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) { + var value = keymap[keyname]; + if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue } + if (value == "...") { delete keymap[keyname]; continue } + + var keys = map(keyname.split(" "), normalizeKeyName); + for (var i = 0; i < keys.length; i++) { + var val = (void 0), name = (void 0); + if (i == keys.length - 1) { + name = keys.join(" "); + val = value; + } else { + name = keys.slice(0, i + 1).join(" "); + val = "..."; + } + var prev = copy[name]; + if (!prev) { copy[name] = val; } + else if (prev != val) { throw new Error("Inconsistent bindings for " + name) } + } + delete keymap[keyname]; + } } + for (var prop in copy) { keymap[prop] = copy[prop]; } + return keymap + } + + function lookupKey(key, map, handle, context) { + map = getKeyMap(map); + var found = map.call ? map.call(key, context) : map[key]; + if (found === false) { return "nothing" } + if (found === "...") { return "multi" } + if (found != null && handle(found)) { return "handled" } + + if (map.fallthrough) { + if (Object.prototype.toString.call(map.fallthrough) != "[object Array]") + { return lookupKey(key, map.fallthrough, handle, context) } + for (var i = 0; i < map.fallthrough.length; i++) { + var result = lookupKey(key, map.fallthrough[i], handle, context); + if (result) { return result } + } + } + } + + // Modifier key presses don't count as 'real' key presses for the + // purpose of keymap fallthrough. + function isModifierKey(value) { + var name = typeof value == "string" ? value : keyNames[value.keyCode]; + return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod" + } + + function addModifierNames(name, event, noShift) { + var base = name; + if (event.altKey && base != "Alt") { name = "Alt-" + name; } + if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; } + if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Mod") { name = "Cmd-" + name; } + if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; } + return name + } + + // Look up the name of a key as indicated by an event object. + function keyName(event, noShift) { + if (presto && event.keyCode == 34 && event["char"]) { return false } + var name = keyNames[event.keyCode]; + if (name == null || event.altGraphKey) { return false } + // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause, + // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+) + if (event.keyCode == 3 && event.code) { name = event.code; } + return addModifierNames(name, event, noShift) + } + + function getKeyMap(val) { + return typeof val == "string" ? keyMap[val] : val + } + + // Helper for deleting text near the selection(s), used to implement + // backspace, delete, and similar functionality. + function deleteNearSelection(cm, compute) { + var ranges = cm.doc.sel.ranges, kill = []; + // Build up a set of ranges to kill first, merging overlapping + // ranges. + for (var i = 0; i < ranges.length; i++) { + var toKill = compute(ranges[i]); + while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) { + var replaced = kill.pop(); + if (cmp(replaced.from, toKill.from) < 0) { + toKill.from = replaced.from; + break + } + } + kill.push(toKill); + } + // Next, remove those actual ranges. + runInOp(cm, function () { + for (var i = kill.length - 1; i >= 0; i--) + { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); } + ensureCursorVisible(cm); + }); + } + + function moveCharLogically(line, ch, dir) { + var target = skipExtendingChars(line.text, ch + dir, dir); + return target < 0 || target > line.text.length ? null : target + } + + function moveLogically(line, start, dir) { + var ch = moveCharLogically(line, start.ch, dir); + return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before") + } + + function endOfLine(visually, cm, lineObj, lineNo, dir) { + if (visually) { + if (cm.doc.direction == "rtl") { dir = -dir; } + var order = getOrder(lineObj, cm.doc.direction); + if (order) { + var part = dir < 0 ? lst(order) : order[0]; + var moveInStorageOrder = (dir < 0) == (part.level == 1); + var sticky = moveInStorageOrder ? "after" : "before"; + var ch; + // With a wrapped rtl chunk (possibly spanning multiple bidi parts), + // it could be that the last bidi part is not on the last visual line, + // since visual lines contain content order-consecutive chunks. + // Thus, in rtl, we are looking for the first (content-order) character + // in the rtl chunk that is on the last line (that is, the same line + // as the last (content-order) character). + if (part.level > 0 || cm.doc.direction == "rtl") { + var prep = prepareMeasureForLine(cm, lineObj); + ch = dir < 0 ? lineObj.text.length - 1 : 0; + var targetTop = measureCharPrepared(cm, prep, ch).top; + ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch); + if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1); } + } else { ch = dir < 0 ? part.to : part.from; } + return new Pos(lineNo, ch, sticky) + } + } + return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after") + } + + function moveVisually(cm, line, start, dir) { + var bidi = getOrder(line, cm.doc.direction); + if (!bidi) { return moveLogically(line, start, dir) } + if (start.ch >= line.text.length) { + start.ch = line.text.length; + start.sticky = "before"; + } else if (start.ch <= 0) { + start.ch = 0; + start.sticky = "after"; + } + var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos]; + if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) { + // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines, + // nothing interesting happens. + return moveLogically(line, start, dir) + } + + var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); }; + var prep; + var getWrappedLineExtent = function (ch) { + if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} } + prep = prep || prepareMeasureForLine(cm, line); + return wrappedLineExtentChar(cm, line, prep, ch) + }; + var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch); + + if (cm.doc.direction == "rtl" || part.level == 1) { + var moveInStorageOrder = (part.level == 1) == (dir < 0); + var ch = mv(start, moveInStorageOrder ? 1 : -1); + if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) { + // Case 2: We move within an rtl part or in an rtl editor on the same visual line + var sticky = moveInStorageOrder ? "before" : "after"; + return new Pos(start.line, ch, sticky) + } + } + + // Case 3: Could not move within this bidi part in this visual line, so leave + // the current bidi part + + var searchInVisualLine = function (partPos, dir, wrappedLineExtent) { + var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder + ? new Pos(start.line, mv(ch, 1), "before") + : new Pos(start.line, ch, "after"); }; + + for (; partPos >= 0 && partPos < bidi.length; partPos += dir) { + var part = bidi[partPos]; + var moveInStorageOrder = (dir > 0) == (part.level != 1); + var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1); + if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) } + ch = moveInStorageOrder ? part.from : mv(part.to, -1); + if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) } + } + }; + + // Case 3a: Look for other bidi parts on the same visual line + var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent); + if (res) { return res } + + // Case 3b: Look for other bidi parts on the next visual line + var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1); + if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) { + res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh)); + if (res) { return res } + } + + // Case 4: Nowhere to move + return null + } + + // Commands are parameter-less actions that can be performed on an + // editor, mostly used for keybindings. + var commands = { + selectAll: selectAll, + singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); }, + killLine: function (cm) { return deleteNearSelection(cm, function (range) { + if (range.empty()) { + var len = getLine(cm.doc, range.head.line).text.length; + if (range.head.ch == len && range.head.line < cm.lastLine()) + { return {from: range.head, to: Pos(range.head.line + 1, 0)} } + else + { return {from: range.head, to: Pos(range.head.line, len)} } + } else { + return {from: range.from(), to: range.to()} + } + }); }, + deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({ + from: Pos(range.from().line, 0), + to: clipPos(cm.doc, Pos(range.to().line + 1, 0)) + }); }); }, + delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({ + from: Pos(range.from().line, 0), to: range.from() + }); }); }, + delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { + var top = cm.charCoords(range.head, "div").top + 5; + var leftPos = cm.coordsChar({left: 0, top: top}, "div"); + return {from: leftPos, to: range.from()} + }); }, + delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) { + var top = cm.charCoords(range.head, "div").top + 5; + var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div"); + return {from: range.from(), to: rightPos } + }); }, + undo: function (cm) { return cm.undo(); }, + redo: function (cm) { return cm.redo(); }, + undoSelection: function (cm) { return cm.undoSelection(); }, + redoSelection: function (cm) { return cm.redoSelection(); }, + goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); }, + goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); }, + goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); }, + {origin: "+move", bias: 1} + ); }, + goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); }, + {origin: "+move", bias: 1} + ); }, + goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); }, + {origin: "+move", bias: -1} + ); }, + goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) { + var top = cm.cursorCoords(range.head, "div").top + 5; + return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div") + }, sel_move); }, + goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) { + var top = cm.cursorCoords(range.head, "div").top + 5; + return cm.coordsChar({left: 0, top: top}, "div") + }, sel_move); }, + goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) { + var top = cm.cursorCoords(range.head, "div").top + 5; + var pos = cm.coordsChar({left: 0, top: top}, "div"); + if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) } + return pos + }, sel_move); }, + goLineUp: function (cm) { return cm.moveV(-1, "line"); }, + goLineDown: function (cm) { return cm.moveV(1, "line"); }, + goPageUp: function (cm) { return cm.moveV(-1, "page"); }, + goPageDown: function (cm) { return cm.moveV(1, "page"); }, + goCharLeft: function (cm) { return cm.moveH(-1, "char"); }, + goCharRight: function (cm) { return cm.moveH(1, "char"); }, + goColumnLeft: function (cm) { return cm.moveH(-1, "column"); }, + goColumnRight: function (cm) { return cm.moveH(1, "column"); }, + goWordLeft: function (cm) { return cm.moveH(-1, "word"); }, + goGroupRight: function (cm) { return cm.moveH(1, "group"); }, + goGroupLeft: function (cm) { return cm.moveH(-1, "group"); }, + goWordRight: function (cm) { return cm.moveH(1, "word"); }, + delCharBefore: function (cm) { return cm.deleteH(-1, "codepoint"); }, + delCharAfter: function (cm) { return cm.deleteH(1, "char"); }, + delWordBefore: function (cm) { return cm.deleteH(-1, "word"); }, + delWordAfter: function (cm) { return cm.deleteH(1, "word"); }, + delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); }, + delGroupAfter: function (cm) { return cm.deleteH(1, "group"); }, + indentAuto: function (cm) { return cm.indentSelection("smart"); }, + indentMore: function (cm) { return cm.indentSelection("add"); }, + indentLess: function (cm) { return cm.indentSelection("subtract"); }, + insertTab: function (cm) { return cm.replaceSelection("\t"); }, + insertSoftTab: function (cm) { + var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize; + for (var i = 0; i < ranges.length; i++) { + var pos = ranges[i].from(); + var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize); + spaces.push(spaceStr(tabSize - col % tabSize)); + } + cm.replaceSelections(spaces); + }, + defaultTab: function (cm) { + if (cm.somethingSelected()) { cm.indentSelection("add"); } + else { cm.execCommand("insertTab"); } + }, + // Swap the two chars left and right of each selection's head. + // Move cursor behind the two swapped characters afterwards. + // + // Doesn't consider line feeds a character. + // Doesn't scan more than one line above to find a character. + // Doesn't do anything on an empty line. + // Doesn't do anything with non-empty selections. + transposeChars: function (cm) { return runInOp(cm, function () { + var ranges = cm.listSelections(), newSel = []; + for (var i = 0; i < ranges.length; i++) { + if (!ranges[i].empty()) { continue } + var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text; + if (line) { + if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); } + if (cur.ch > 0) { + cur = new Pos(cur.line, cur.ch + 1); + cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2), + Pos(cur.line, cur.ch - 2), cur, "+transpose"); + } else if (cur.line > cm.doc.first) { + var prev = getLine(cm.doc, cur.line - 1).text; + if (prev) { + cur = new Pos(cur.line, 1); + cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() + + prev.charAt(prev.length - 1), + Pos(cur.line - 1, prev.length - 1), cur, "+transpose"); + } + } + } + newSel.push(new Range(cur, cur)); + } + cm.setSelections(newSel); + }); }, + newlineAndIndent: function (cm) { return runInOp(cm, function () { + var sels = cm.listSelections(); + for (var i = sels.length - 1; i >= 0; i--) + { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); } + sels = cm.listSelections(); + for (var i$1 = 0; i$1 < sels.length; i$1++) + { cm.indentLine(sels[i$1].from().line, null, true); } + ensureCursorVisible(cm); + }); }, + openLine: function (cm) { return cm.replaceSelection("\n", "start"); }, + toggleOverwrite: function (cm) { return cm.toggleOverwrite(); } + }; + + + function lineStart(cm, lineN) { + var line = getLine(cm.doc, lineN); + var visual = visualLine(line); + if (visual != line) { lineN = lineNo(visual); } + return endOfLine(true, cm, visual, lineN, 1) + } + function lineEnd(cm, lineN) { + var line = getLine(cm.doc, lineN); + var visual = visualLineEnd(line); + if (visual != line) { lineN = lineNo(visual); } + return endOfLine(true, cm, line, lineN, -1) + } + function lineStartSmart(cm, pos) { + var start = lineStart(cm, pos.line); + var line = getLine(cm.doc, start.line); + var order = getOrder(line, cm.doc.direction); + if (!order || order[0].level == 0) { + var firstNonWS = Math.max(start.ch, line.text.search(/\S/)); + var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch; + return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky) + } + return start + } + + // Run a handler that was bound to a key. + function doHandleBinding(cm, bound, dropShift) { + if (typeof bound == "string") { + bound = commands[bound]; + if (!bound) { return false } + } + // Ensure previous input has been read, so that the handler sees a + // consistent view of the document + cm.display.input.ensurePolled(); + var prevShift = cm.display.shift, done = false; + try { + if (cm.isReadOnly()) { cm.state.suppressEdits = true; } + if (dropShift) { cm.display.shift = false; } + done = bound(cm) != Pass; + } finally { + cm.display.shift = prevShift; + cm.state.suppressEdits = false; + } + return done + } + + function lookupKeyForEditor(cm, name, handle) { + for (var i = 0; i < cm.state.keyMaps.length; i++) { + var result = lookupKey(name, cm.state.keyMaps[i], handle, cm); + if (result) { return result } + } + return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm)) + || lookupKey(name, cm.options.keyMap, handle, cm) + } + + // Note that, despite the name, this function is also used to check + // for bound mouse clicks. + + var stopSeq = new Delayed; + + function dispatchKey(cm, name, e, handle) { + var seq = cm.state.keySeq; + if (seq) { + if (isModifierKey(name)) { return "handled" } + if (/\'$/.test(name)) + { cm.state.keySeq = null; } + else + { stopSeq.set(50, function () { + if (cm.state.keySeq == seq) { + cm.state.keySeq = null; + cm.display.input.reset(); + } + }); } + if (dispatchKeyInner(cm, seq + " " + name, e, handle)) { return true } + } + return dispatchKeyInner(cm, name, e, handle) + } + + function dispatchKeyInner(cm, name, e, handle) { + var result = lookupKeyForEditor(cm, name, handle); + + if (result == "multi") + { cm.state.keySeq = name; } + if (result == "handled") + { signalLater(cm, "keyHandled", cm, name, e); } + + if (result == "handled" || result == "multi") { + e_preventDefault(e); + restartBlink(cm); + } + + return !!result + } + + // Handle a key from the keydown event. + function handleKeyBinding(cm, e) { + var name = keyName(e, true); + if (!name) { return false } + + if (e.shiftKey && !cm.state.keySeq) { + // First try to resolve full name (including 'Shift-'). Failing + // that, see if there is a cursor-motion command (starting with + // 'go') bound to the keyname without 'Shift-'. + return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); }) + || dispatchKey(cm, name, e, function (b) { + if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion) + { return doHandleBinding(cm, b) } + }) + } else { + return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); }) + } + } + + // Handle a key from the keypress event + function handleCharBinding(cm, e, ch) { + return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); }) + } + + var lastStoppedKey = null; + function onKeyDown(e) { + var cm = this; + if (e.target && e.target != cm.display.input.getField()) { return } + cm.curOp.focus = activeElt(); + if (signalDOMEvent(cm, e)) { return } + // IE does strange things with escape. + if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; } + var code = e.keyCode; + cm.display.shift = code == 16 || e.shiftKey; + var handled = handleKeyBinding(cm, e); + if (presto) { + lastStoppedKey = handled ? code : null; + // Opera has no cut event... we try to at least catch the key combo + if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey)) + { cm.replaceSelection("", null, "cut"); } + } + if (gecko && !mac && !handled && code == 46 && e.shiftKey && !e.ctrlKey && document.execCommand) + { document.execCommand("cut"); } + + // Turn mouse into crosshair when Alt is held on Mac. + if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className)) + { showCrossHair(cm); } + } + + function showCrossHair(cm) { + var lineDiv = cm.display.lineDiv; + addClass(lineDiv, "CodeMirror-crosshair"); + + function up(e) { + if (e.keyCode == 18 || !e.altKey) { + rmClass(lineDiv, "CodeMirror-crosshair"); + off(document, "keyup", up); + off(document, "mouseover", up); + } + } + on(document, "keyup", up); + on(document, "mouseover", up); + } + + function onKeyUp(e) { + if (e.keyCode == 16) { this.doc.sel.shift = false; } + signalDOMEvent(this, e); + } + + function onKeyPress(e) { + var cm = this; + if (e.target && e.target != cm.display.input.getField()) { return } + if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return } + var keyCode = e.keyCode, charCode = e.charCode; + if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return} + if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return } + var ch = String.fromCharCode(charCode == null ? keyCode : charCode); + // Some browsers fire keypress events for backspace + if (ch == "\x08") { return } + if (handleCharBinding(cm, e, ch)) { return } + cm.display.input.onKeyPress(e); + } + + var DOUBLECLICK_DELAY = 400; + + var PastClick = function(time, pos, button) { + this.time = time; + this.pos = pos; + this.button = button; + }; + + PastClick.prototype.compare = function (time, pos, button) { + return this.time + DOUBLECLICK_DELAY > time && + cmp(pos, this.pos) == 0 && button == this.button + }; + + var lastClick, lastDoubleClick; + function clickRepeat(pos, button) { + var now = +new Date; + if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) { + lastClick = lastDoubleClick = null; + return "triple" + } else if (lastClick && lastClick.compare(now, pos, button)) { + lastDoubleClick = new PastClick(now, pos, button); + lastClick = null; + return "double" + } else { + lastClick = new PastClick(now, pos, button); + lastDoubleClick = null; + return "single" + } + } + + // A mouse down can be a single click, double click, triple click, + // start of selection drag, start of text drag, new cursor + // (ctrl-click), rectangle drag (alt-drag), or xwin + // middle-click-paste. Or it might be a click on something we should + // not interfere with, such as a scrollbar or widget. + function onMouseDown(e) { + var cm = this, display = cm.display; + if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return } + display.input.ensurePolled(); + display.shift = e.shiftKey; + + if (eventInWidget(display, e)) { + if (!webkit) { + // Briefly turn off draggability, to allow widgets to do + // normal dragging things. + display.scroller.draggable = false; + setTimeout(function () { return display.scroller.draggable = true; }, 100); + } + return + } + if (clickInGutter(cm, e)) { return } + var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single"; + window.focus(); + + // #3261: make sure, that we're not starting a second selection + if (button == 1 && cm.state.selectingText) + { cm.state.selectingText(e); } + + if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return } + + if (button == 1) { + if (pos) { leftButtonDown(cm, pos, repeat, e); } + else if (e_target(e) == display.scroller) { e_preventDefault(e); } + } else if (button == 2) { + if (pos) { extendSelection(cm.doc, pos); } + setTimeout(function () { return display.input.focus(); }, 20); + } else if (button == 3) { + if (captureRightClick) { cm.display.input.onContextMenu(e); } + else { delayBlurEvent(cm); } + } + } + + function handleMappedButton(cm, button, pos, repeat, event) { + var name = "Click"; + if (repeat == "double") { name = "Double" + name; } + else if (repeat == "triple") { name = "Triple" + name; } + name = (button == 1 ? "Left" : button == 2 ? "Middle" : "Right") + name; + + return dispatchKey(cm, addModifierNames(name, event), event, function (bound) { + if (typeof bound == "string") { bound = commands[bound]; } + if (!bound) { return false } + var done = false; + try { + if (cm.isReadOnly()) { cm.state.suppressEdits = true; } + done = bound(cm, pos) != Pass; + } finally { + cm.state.suppressEdits = false; + } + return done + }) + } + + function configureMouse(cm, repeat, event) { + var option = cm.getOption("configureMouse"); + var value = option ? option(cm, repeat, event) : {}; + if (value.unit == null) { + var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey; + value.unit = rect ? "rectangle" : repeat == "single" ? "char" : repeat == "double" ? "word" : "line"; + } + if (value.extend == null || cm.doc.extend) { value.extend = cm.doc.extend || event.shiftKey; } + if (value.addNew == null) { value.addNew = mac ? event.metaKey : event.ctrlKey; } + if (value.moveOnDrag == null) { value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey); } + return value + } + + function leftButtonDown(cm, pos, repeat, event) { + if (ie) { setTimeout(bind(ensureFocus, cm), 0); } + else { cm.curOp.focus = activeElt(); } + + var behavior = configureMouse(cm, repeat, event); + + var sel = cm.doc.sel, contained; + if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() && + repeat == "single" && (contained = sel.contains(pos)) > -1 && + (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) && + (cmp(contained.to(), pos) > 0 || pos.xRel < 0)) + { leftButtonStartDrag(cm, event, pos, behavior); } + else + { leftButtonSelect(cm, event, pos, behavior); } + } + + // Start a text drag. When it ends, see if any dragging actually + // happen, and treat as a click if it didn't. + function leftButtonStartDrag(cm, event, pos, behavior) { + var display = cm.display, moved = false; + var dragEnd = operation(cm, function (e) { + if (webkit) { display.scroller.draggable = false; } + cm.state.draggingText = false; + if (cm.state.delayingBlurEvent) { + if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; } + else { delayBlurEvent(cm); } + } + off(display.wrapper.ownerDocument, "mouseup", dragEnd); + off(display.wrapper.ownerDocument, "mousemove", mouseMove); + off(display.scroller, "dragstart", dragStart); + off(display.scroller, "drop", dragEnd); + if (!moved) { + e_preventDefault(e); + if (!behavior.addNew) + { extendSelection(cm.doc, pos, null, null, behavior.extend); } + // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081) + if ((webkit && !safari) || ie && ie_version == 9) + { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); } + else + { display.input.focus(); } + } + }); + var mouseMove = function(e2) { + moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10; + }; + var dragStart = function () { return moved = true; }; + // Let the drag handler handle this. + if (webkit) { display.scroller.draggable = true; } + cm.state.draggingText = dragEnd; + dragEnd.copy = !behavior.moveOnDrag; + on(display.wrapper.ownerDocument, "mouseup", dragEnd); + on(display.wrapper.ownerDocument, "mousemove", mouseMove); + on(display.scroller, "dragstart", dragStart); + on(display.scroller, "drop", dragEnd); + + cm.state.delayingBlurEvent = true; + setTimeout(function () { return display.input.focus(); }, 20); + // IE's approach to draggable + if (display.scroller.dragDrop) { display.scroller.dragDrop(); } + } + + function rangeForUnit(cm, pos, unit) { + if (unit == "char") { return new Range(pos, pos) } + if (unit == "word") { return cm.findWordAt(pos) } + if (unit == "line") { return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) } + var result = unit(cm, pos); + return new Range(result.from, result.to) + } + + // Normal selection, as opposed to text dragging. + function leftButtonSelect(cm, event, start, behavior) { + if (ie) { delayBlurEvent(cm); } + var display = cm.display, doc = cm.doc; + e_preventDefault(event); + + var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges; + if (behavior.addNew && !behavior.extend) { + ourIndex = doc.sel.contains(start); + if (ourIndex > -1) + { ourRange = ranges[ourIndex]; } + else + { ourRange = new Range(start, start); } + } else { + ourRange = doc.sel.primary(); + ourIndex = doc.sel.primIndex; + } + + if (behavior.unit == "rectangle") { + if (!behavior.addNew) { ourRange = new Range(start, start); } + start = posFromMouse(cm, event, true, true); + ourIndex = -1; + } else { + var range = rangeForUnit(cm, start, behavior.unit); + if (behavior.extend) + { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); } + else + { ourRange = range; } + } + + if (!behavior.addNew) { + ourIndex = 0; + setSelection(doc, new Selection([ourRange], 0), sel_mouse); + startSel = doc.sel; + } else if (ourIndex == -1) { + ourIndex = ranges.length; + setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex), + {scroll: false, origin: "*mouse"}); + } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) { + setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0), + {scroll: false, origin: "*mouse"}); + startSel = doc.sel; + } else { + replaceOneSelection(doc, ourIndex, ourRange, sel_mouse); + } + + var lastPos = start; + function extendTo(pos) { + if (cmp(lastPos, pos) == 0) { return } + lastPos = pos; + + if (behavior.unit == "rectangle") { + var ranges = [], tabSize = cm.options.tabSize; + var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize); + var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize); + var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol); + for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); + line <= end; line++) { + var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize); + if (left == right) + { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); } + else if (text.length > leftPos) + { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); } + } + if (!ranges.length) { ranges.push(new Range(start, start)); } + setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), + {origin: "*mouse", scroll: false}); + cm.scrollIntoView(pos); + } else { + var oldRange = ourRange; + var range = rangeForUnit(cm, pos, behavior.unit); + var anchor = oldRange.anchor, head; + if (cmp(range.anchor, anchor) > 0) { + head = range.head; + anchor = minPos(oldRange.from(), range.anchor); + } else { + head = range.anchor; + anchor = maxPos(oldRange.to(), range.head); + } + var ranges$1 = startSel.ranges.slice(0); + ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head)); + setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse); + } + } + + var editorSize = display.wrapper.getBoundingClientRect(); + // Used to ensure timeout re-tries don't fire when another extend + // happened in the meantime (clearTimeout isn't reliable -- at + // least on Chrome, the timeouts still happen even when cleared, + // if the clear happens after their scheduled firing time). + var counter = 0; + + function extend(e) { + var curCount = ++counter; + var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle"); + if (!cur) { return } + if (cmp(cur, lastPos) != 0) { + cm.curOp.focus = activeElt(); + extendTo(cur); + var visible = visibleLines(display, doc); + if (cur.line >= visible.to || cur.line < visible.from) + { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); } + } else { + var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0; + if (outside) { setTimeout(operation(cm, function () { + if (counter != curCount) { return } + display.scroller.scrollTop += outside; + extend(e); + }), 50); } + } + } + + function done(e) { + cm.state.selectingText = false; + counter = Infinity; + // If e is null or undefined we interpret this as someone trying + // to explicitly cancel the selection rather than the user + // letting go of the mouse button. + if (e) { + e_preventDefault(e); + display.input.focus(); + } + off(display.wrapper.ownerDocument, "mousemove", move); + off(display.wrapper.ownerDocument, "mouseup", up); + doc.history.lastSelOrigin = null; + } + + var move = operation(cm, function (e) { + if (e.buttons === 0 || !e_button(e)) { done(e); } + else { extend(e); } + }); + var up = operation(cm, done); + cm.state.selectingText = up; + on(display.wrapper.ownerDocument, "mousemove", move); + on(display.wrapper.ownerDocument, "mouseup", up); + } + + // Used when mouse-selecting to adjust the anchor to the proper side + // of a bidi jump depending on the visual position of the head. + function bidiSimplify(cm, range) { + var anchor = range.anchor; + var head = range.head; + var anchorLine = getLine(cm.doc, anchor.line); + if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range } + var order = getOrder(anchorLine); + if (!order) { return range } + var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index]; + if (part.from != anchor.ch && part.to != anchor.ch) { return range } + var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1); + if (boundary == 0 || boundary == order.length) { return range } + + // Compute the relative visual position of the head compared to the + // anchor (<0 is to the left, >0 to the right) + var leftSide; + if (head.line != anchor.line) { + leftSide = (head.line - anchor.line) * (cm.doc.direction == "ltr" ? 1 : -1) > 0; + } else { + var headIndex = getBidiPartAt(order, head.ch, head.sticky); + var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1); + if (headIndex == boundary - 1 || headIndex == boundary) + { leftSide = dir < 0; } + else + { leftSide = dir > 0; } + } + + var usePart = order[boundary + (leftSide ? -1 : 0)]; + var from = leftSide == (usePart.level == 1); + var ch = from ? usePart.from : usePart.to, sticky = from ? "after" : "before"; + return anchor.ch == ch && anchor.sticky == sticky ? range : new Range(new Pos(anchor.line, ch, sticky), head) + } + + + // Determines whether an event happened in the gutter, and fires the + // handlers for the corresponding event. + function gutterEvent(cm, e, type, prevent) { + var mX, mY; + if (e.touches) { + mX = e.touches[0].clientX; + mY = e.touches[0].clientY; + } else { + try { mX = e.clientX; mY = e.clientY; } + catch(e$1) { return false } + } + if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false } + if (prevent) { e_preventDefault(e); } + + var display = cm.display; + var lineBox = display.lineDiv.getBoundingClientRect(); + + if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) } + mY -= lineBox.top - display.viewOffset; + + for (var i = 0; i < cm.display.gutterSpecs.length; ++i) { + var g = display.gutters.childNodes[i]; + if (g && g.getBoundingClientRect().right >= mX) { + var line = lineAtHeight(cm.doc, mY); + var gutter = cm.display.gutterSpecs[i]; + signal(cm, type, cm, line, gutter.className, e); + return e_defaultPrevented(e) + } + } + } + + function clickInGutter(cm, e) { + return gutterEvent(cm, e, "gutterClick", true) + } + + // CONTEXT MENU HANDLING + + // To make the context menu work, we need to briefly unhide the + // textarea (making it as unobtrusive as possible) to let the + // right-click take effect on it. + function onContextMenu(cm, e) { + if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return } + if (signalDOMEvent(cm, e, "contextmenu")) { return } + if (!captureRightClick) { cm.display.input.onContextMenu(e); } + } + + function contextMenuInGutter(cm, e) { + if (!hasHandler(cm, "gutterContextMenu")) { return false } + return gutterEvent(cm, e, "gutterContextMenu", false) + } + + function themeChanged(cm) { + cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") + + cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-"); + clearCaches(cm); + } + + var Init = {toString: function(){return "CodeMirror.Init"}}; + + var defaults = {}; + var optionHandlers = {}; + + function defineOptions(CodeMirror) { + var optionHandlers = CodeMirror.optionHandlers; + + function option(name, deflt, handle, notOnInit) { + CodeMirror.defaults[name] = deflt; + if (handle) { optionHandlers[name] = + notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; } + } + + CodeMirror.defineOption = option; + + // Passed to option handlers when there is no old value. + CodeMirror.Init = Init; + + // These two are, on init, called from the constructor because they + // have to be initialized before the editor can start at all. + option("value", "", function (cm, val) { return cm.setValue(val); }, true); + option("mode", null, function (cm, val) { + cm.doc.modeOption = val; + loadMode(cm); + }, true); + + option("indentUnit", 2, loadMode, true); + option("indentWithTabs", false); + option("smartIndent", true); + option("tabSize", 4, function (cm) { + resetModeState(cm); + clearCaches(cm); + regChange(cm); + }, true); + + option("lineSeparator", null, function (cm, val) { + cm.doc.lineSep = val; + if (!val) { return } + var newBreaks = [], lineNo = cm.doc.first; + cm.doc.iter(function (line) { + for (var pos = 0;;) { + var found = line.text.indexOf(val, pos); + if (found == -1) { break } + pos = found + val.length; + newBreaks.push(Pos(lineNo, found)); + } + lineNo++; + }); + for (var i = newBreaks.length - 1; i >= 0; i--) + { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); } + }); + option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) { + cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g"); + if (old != Init) { cm.refresh(); } + }); + option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true); + option("electricChars", true); + option("inputStyle", mobile ? "contenteditable" : "textarea", function () { + throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME + }, true); + option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true); + option("autocorrect", false, function (cm, val) { return cm.getInputField().autocorrect = val; }, true); + option("autocapitalize", false, function (cm, val) { return cm.getInputField().autocapitalize = val; }, true); + option("rtlMoveVisually", !windows); + option("wholeLineUpdateBefore", true); + + option("theme", "default", function (cm) { + themeChanged(cm); + updateGutters(cm); + }, true); + option("keyMap", "default", function (cm, val, old) { + var next = getKeyMap(val); + var prev = old != Init && getKeyMap(old); + if (prev && prev.detach) { prev.detach(cm, next); } + if (next.attach) { next.attach(cm, prev || null); } + }); + option("extraKeys", null); + option("configureMouse", null); + + option("lineWrapping", false, wrappingChanged, true); + option("gutters", [], function (cm, val) { + cm.display.gutterSpecs = getGutters(val, cm.options.lineNumbers); + updateGutters(cm); + }, true); + option("fixedGutter", true, function (cm, val) { + cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0"; + cm.refresh(); + }, true); + option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true); + option("scrollbarStyle", "native", function (cm) { + initScrollbars(cm); + updateScrollbars(cm); + cm.display.scrollbars.setScrollTop(cm.doc.scrollTop); + cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft); + }, true); + option("lineNumbers", false, function (cm, val) { + cm.display.gutterSpecs = getGutters(cm.options.gutters, val); + updateGutters(cm); + }, true); + option("firstLineNumber", 1, updateGutters, true); + option("lineNumberFormatter", function (integer) { return integer; }, updateGutters, true); + option("showCursorWhenSelecting", false, updateSelection, true); + + option("resetSelectionOnContextMenu", true); + option("lineWiseCopyCut", true); + option("pasteLinesPerSelection", true); + option("selectionsMayTouch", false); + + option("readOnly", false, function (cm, val) { + if (val == "nocursor") { + onBlur(cm); + cm.display.input.blur(); + } + cm.display.input.readOnlyChanged(val); + }); + + option("screenReaderLabel", null, function (cm, val) { + val = (val === '') ? null : val; + cm.display.input.screenReaderLabelChanged(val); + }); + + option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true); + option("dragDrop", true, dragDropChanged); + option("allowDropFileTypes", null); + + option("cursorBlinkRate", 530); + option("cursorScrollMargin", 0); + option("cursorHeight", 1, updateSelection, true); + option("singleCursorHeightPerLine", true, updateSelection, true); + option("workTime", 100); + option("workDelay", 100); + option("flattenSpans", true, resetModeState, true); + option("addModeClass", false, resetModeState, true); + option("pollInterval", 100); + option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; }); + option("historyEventDelay", 1250); + option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true); + option("maxHighlightLength", 10000, resetModeState, true); + option("moveInputWithCursor", true, function (cm, val) { + if (!val) { cm.display.input.resetPosition(); } + }); + + option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; }); + option("autofocus", null); + option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true); + option("phrases", null); + } + + function dragDropChanged(cm, value, old) { + var wasOn = old && old != Init; + if (!value != !wasOn) { + var funcs = cm.display.dragFunctions; + var toggle = value ? on : off; + toggle(cm.display.scroller, "dragstart", funcs.start); + toggle(cm.display.scroller, "dragenter", funcs.enter); + toggle(cm.display.scroller, "dragover", funcs.over); + toggle(cm.display.scroller, "dragleave", funcs.leave); + toggle(cm.display.scroller, "drop", funcs.drop); + } + } + + function wrappingChanged(cm) { + if (cm.options.lineWrapping) { + addClass(cm.display.wrapper, "CodeMirror-wrap"); + cm.display.sizer.style.minWidth = ""; + cm.display.sizerWidth = null; + } else { + rmClass(cm.display.wrapper, "CodeMirror-wrap"); + findMaxLine(cm); + } + estimateLineHeights(cm); + regChange(cm); + clearCaches(cm); + setTimeout(function () { return updateScrollbars(cm); }, 100); + } + + // A CodeMirror instance represents an editor. This is the object + // that user code is usually dealing with. + + function CodeMirror(place, options) { + var this$1 = this; + + if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) } + + this.options = options = options ? copyObj(options) : {}; + // Determine effective options based on given values and defaults. + copyObj(defaults, options, false); + + var doc = options.value; + if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); } + else if (options.mode) { doc.modeOption = options.mode; } + this.doc = doc; + + var input = new CodeMirror.inputStyles[options.inputStyle](this); + var display = this.display = new Display(place, doc, input, options); + display.wrapper.CodeMirror = this; + themeChanged(this); + if (options.lineWrapping) + { this.display.wrapper.className += " CodeMirror-wrap"; } + initScrollbars(this); + + this.state = { + keyMaps: [], // stores maps added by addKeyMap + overlays: [], // highlighting overlays, as added by addOverlay + modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info + overwrite: false, + delayingBlurEvent: false, + focused: false, + suppressEdits: false, // used to disable editing during key handlers when in readOnly mode + pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll + selectingText: false, + draggingText: false, + highlight: new Delayed(), // stores highlight worker timeout + keySeq: null, // Unfinished key sequence + specialChars: null + }; + + if (options.autofocus && !mobile) { display.input.focus(); } + + // Override magic textarea content restore that IE sometimes does + // on our hidden textarea on reload + if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); } + + registerEventHandlers(this); + ensureGlobalHandlers(); + + startOperation(this); + this.curOp.forceUpdate = true; + attachDoc(this, doc); + + if ((options.autofocus && !mobile) || this.hasFocus()) + { setTimeout(function () { + if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); } + }, 20); } + else + { onBlur(this); } + + for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt)) + { optionHandlers[opt](this, options[opt], Init); } } + maybeUpdateLineNumberWidth(this); + if (options.finishInit) { options.finishInit(this); } + for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); } + endOperation(this); + // Suppress optimizelegibility in Webkit, since it breaks text + // measuring on line wrapping boundaries. + if (webkit && options.lineWrapping && + getComputedStyle(display.lineDiv).textRendering == "optimizelegibility") + { display.lineDiv.style.textRendering = "auto"; } + } + + // The default configuration options. + CodeMirror.defaults = defaults; + // Functions to run when options are changed. + CodeMirror.optionHandlers = optionHandlers; + + // Attach the necessary event handlers when initializing the editor + function registerEventHandlers(cm) { + var d = cm.display; + on(d.scroller, "mousedown", operation(cm, onMouseDown)); + // Older IE's will not fire a second mousedown for a double click + if (ie && ie_version < 11) + { on(d.scroller, "dblclick", operation(cm, function (e) { + if (signalDOMEvent(cm, e)) { return } + var pos = posFromMouse(cm, e); + if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return } + e_preventDefault(e); + var word = cm.findWordAt(pos); + extendSelection(cm.doc, word.anchor, word.head); + })); } + else + { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); } + // Some browsers fire contextmenu *after* opening the menu, at + // which point we can't mess with it anymore. Context menu is + // handled in onMouseDown for these browsers. + on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); }); + on(d.input.getField(), "contextmenu", function (e) { + if (!d.scroller.contains(e.target)) { onContextMenu(cm, e); } + }); + + // Used to suppress mouse event handling when a touch happens + var touchFinished, prevTouch = {end: 0}; + function finishTouch() { + if (d.activeTouch) { + touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000); + prevTouch = d.activeTouch; + prevTouch.end = +new Date; + } + } + function isMouseLikeTouchEvent(e) { + if (e.touches.length != 1) { return false } + var touch = e.touches[0]; + return touch.radiusX <= 1 && touch.radiusY <= 1 + } + function farAway(touch, other) { + if (other.left == null) { return true } + var dx = other.left - touch.left, dy = other.top - touch.top; + return dx * dx + dy * dy > 20 * 20 + } + on(d.scroller, "touchstart", function (e) { + if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) { + d.input.ensurePolled(); + clearTimeout(touchFinished); + var now = +new Date; + d.activeTouch = {start: now, moved: false, + prev: now - prevTouch.end <= 300 ? prevTouch : null}; + if (e.touches.length == 1) { + d.activeTouch.left = e.touches[0].pageX; + d.activeTouch.top = e.touches[0].pageY; + } + } + }); + on(d.scroller, "touchmove", function () { + if (d.activeTouch) { d.activeTouch.moved = true; } + }); + on(d.scroller, "touchend", function (e) { + var touch = d.activeTouch; + if (touch && !eventInWidget(d, e) && touch.left != null && + !touch.moved && new Date - touch.start < 300) { + var pos = cm.coordsChar(d.activeTouch, "page"), range; + if (!touch.prev || farAway(touch, touch.prev)) // Single tap + { range = new Range(pos, pos); } + else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap + { range = cm.findWordAt(pos); } + else // Triple tap + { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); } + cm.setSelection(range.anchor, range.head); + cm.focus(); + e_preventDefault(e); + } + finishTouch(); + }); + on(d.scroller, "touchcancel", finishTouch); + + // Sync scrolling between fake scrollbars and real scrollable + // area, ensure viewport is updated when scrolling. + on(d.scroller, "scroll", function () { + if (d.scroller.clientHeight) { + updateScrollTop(cm, d.scroller.scrollTop); + setScrollLeft(cm, d.scroller.scrollLeft, true); + signal(cm, "scroll", cm); + } + }); + + // Listen to wheel events in order to try and update the viewport on time. + on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); }); + on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); }); + + // Prevent wrapper from ever scrolling + on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; }); + + d.dragFunctions = { + enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }}, + over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }}, + start: function (e) { return onDragStart(cm, e); }, + drop: operation(cm, onDrop), + leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }} + }; + + var inp = d.input.getField(); + on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); }); + on(inp, "keydown", operation(cm, onKeyDown)); + on(inp, "keypress", operation(cm, onKeyPress)); + on(inp, "focus", function (e) { return onFocus(cm, e); }); + on(inp, "blur", function (e) { return onBlur(cm, e); }); + } + + var initHooks = []; + CodeMirror.defineInitHook = function (f) { return initHooks.push(f); }; + + // Indent the given line. The how parameter can be "smart", + // "add"/null, "subtract", or "prev". When aggressive is false + // (typically set to true for forced single-line indents), empty + // lines are not indented, and places where the mode returns Pass + // are left alone. + function indentLine(cm, n, how, aggressive) { + var doc = cm.doc, state; + if (how == null) { how = "add"; } + if (how == "smart") { + // Fall back to "prev" when the mode doesn't have an indentation + // method. + if (!doc.mode.indent) { how = "prev"; } + else { state = getContextBefore(cm, n).state; } + } + + var tabSize = cm.options.tabSize; + var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize); + if (line.stateAfter) { line.stateAfter = null; } + var curSpaceString = line.text.match(/^\s*/)[0], indentation; + if (!aggressive && !/\S/.test(line.text)) { + indentation = 0; + how = "not"; + } else if (how == "smart") { + indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text); + if (indentation == Pass || indentation > 150) { + if (!aggressive) { return } + how = "prev"; + } + } + if (how == "prev") { + if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); } + else { indentation = 0; } + } else if (how == "add") { + indentation = curSpace + cm.options.indentUnit; + } else if (how == "subtract") { + indentation = curSpace - cm.options.indentUnit; + } else if (typeof how == "number") { + indentation = curSpace + how; + } + indentation = Math.max(0, indentation); + + var indentString = "", pos = 0; + if (cm.options.indentWithTabs) + { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} } + if (pos < indentation) { indentString += spaceStr(indentation - pos); } + + if (indentString != curSpaceString) { + replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input"); + line.stateAfter = null; + return true + } else { + // Ensure that, if the cursor was in the whitespace at the start + // of the line, it is moved to the end of that space. + for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) { + var range = doc.sel.ranges[i$1]; + if (range.head.line == n && range.head.ch < curSpaceString.length) { + var pos$1 = Pos(n, curSpaceString.length); + replaceOneSelection(doc, i$1, new Range(pos$1, pos$1)); + break + } + } + } + } + + // This will be set to a {lineWise: bool, text: [string]} object, so + // that, when pasting, we know what kind of selections the copied + // text was made out of. + var lastCopied = null; + + function setLastCopied(newLastCopied) { + lastCopied = newLastCopied; + } + + function applyTextInput(cm, inserted, deleted, sel, origin) { + var doc = cm.doc; + cm.display.shift = false; + if (!sel) { sel = doc.sel; } + + var recent = +new Date - 200; + var paste = origin == "paste" || cm.state.pasteIncoming > recent; + var textLines = splitLinesAuto(inserted), multiPaste = null; + // When pasting N lines into N selections, insert one line per selection + if (paste && sel.ranges.length > 1) { + if (lastCopied && lastCopied.text.join("\n") == inserted) { + if (sel.ranges.length % lastCopied.text.length == 0) { + multiPaste = []; + for (var i = 0; i < lastCopied.text.length; i++) + { multiPaste.push(doc.splitLines(lastCopied.text[i])); } + } + } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) { + multiPaste = map(textLines, function (l) { return [l]; }); + } + } + + var updateInput = cm.curOp.updateInput; + // Normal behavior is to insert the new text into every selection + for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) { + var range = sel.ranges[i$1]; + var from = range.from(), to = range.to(); + if (range.empty()) { + if (deleted && deleted > 0) // Handle deletion + { from = Pos(from.line, from.ch - deleted); } + else if (cm.state.overwrite && !paste) // Handle overwrite + { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); } + else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == textLines.join("\n")) + { from = to = Pos(from.line, 0); } + } + var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines, + origin: origin || (paste ? "paste" : cm.state.cutIncoming > recent ? "cut" : "+input")}; + makeChange(cm.doc, changeEvent); + signalLater(cm, "inputRead", cm, changeEvent); + } + if (inserted && !paste) + { triggerElectric(cm, inserted); } + + ensureCursorVisible(cm); + if (cm.curOp.updateInput < 2) { cm.curOp.updateInput = updateInput; } + cm.curOp.typing = true; + cm.state.pasteIncoming = cm.state.cutIncoming = -1; + } + + function handlePaste(e, cm) { + var pasted = e.clipboardData && e.clipboardData.getData("Text"); + if (pasted) { + e.preventDefault(); + if (!cm.isReadOnly() && !cm.options.disableInput) + { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); } + return true + } + } + + function triggerElectric(cm, inserted) { + // When an 'electric' character is inserted, immediately trigger a reindent + if (!cm.options.electricChars || !cm.options.smartIndent) { return } + var sel = cm.doc.sel; + + for (var i = sel.ranges.length - 1; i >= 0; i--) { + var range = sel.ranges[i]; + if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue } + var mode = cm.getModeAt(range.head); + var indented = false; + if (mode.electricChars) { + for (var j = 0; j < mode.electricChars.length; j++) + { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) { + indented = indentLine(cm, range.head.line, "smart"); + break + } } + } else if (mode.electricInput) { + if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch))) + { indented = indentLine(cm, range.head.line, "smart"); } + } + if (indented) { signalLater(cm, "electricInput", cm, range.head.line); } + } + } + + function copyableRanges(cm) { + var text = [], ranges = []; + for (var i = 0; i < cm.doc.sel.ranges.length; i++) { + var line = cm.doc.sel.ranges[i].head.line; + var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)}; + ranges.push(lineRange); + text.push(cm.getRange(lineRange.anchor, lineRange.head)); + } + return {text: text, ranges: ranges} + } + + function disableBrowserMagic(field, spellcheck, autocorrect, autocapitalize) { + field.setAttribute("autocorrect", autocorrect ? "" : "off"); + field.setAttribute("autocapitalize", autocapitalize ? "" : "off"); + field.setAttribute("spellcheck", !!spellcheck); + } + + function hiddenTextarea() { + var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"); + var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"); + // The textarea is kept positioned near the cursor to prevent the + // fact that it'll be scrolled into view on input from scrolling + // our fake cursor out of view. On webkit, when wrap=off, paste is + // very slow. So make the area wide instead. + if (webkit) { te.style.width = "1000px"; } + else { te.setAttribute("wrap", "off"); } + // If border: 0; -- iOS fails to open keyboard (issue #1287) + if (ios) { te.style.border = "1px solid black"; } + disableBrowserMagic(te); + return div + } + + // The publicly visible API. Note that methodOp(f) means + // 'wrap f in an operation, performed on its `this` parameter'. + + // This is not the complete set of editor methods. Most of the + // methods defined on the Doc type are also injected into + // CodeMirror.prototype, for backwards compatibility and + // convenience. + + function addEditorMethods(CodeMirror) { + var optionHandlers = CodeMirror.optionHandlers; + + var helpers = CodeMirror.helpers = {}; + + CodeMirror.prototype = { + constructor: CodeMirror, + focus: function(){window.focus(); this.display.input.focus();}, + + setOption: function(option, value) { + var options = this.options, old = options[option]; + if (options[option] == value && option != "mode") { return } + options[option] = value; + if (optionHandlers.hasOwnProperty(option)) + { operation(this, optionHandlers[option])(this, value, old); } + signal(this, "optionChange", this, option); + }, + + getOption: function(option) {return this.options[option]}, + getDoc: function() {return this.doc}, + + addKeyMap: function(map, bottom) { + this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map)); + }, + removeKeyMap: function(map) { + var maps = this.state.keyMaps; + for (var i = 0; i < maps.length; ++i) + { if (maps[i] == map || maps[i].name == map) { + maps.splice(i, 1); + return true + } } + }, + + addOverlay: methodOp(function(spec, options) { + var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec); + if (mode.startState) { throw new Error("Overlays may not be stateful.") } + insertSorted(this.state.overlays, + {mode: mode, modeSpec: spec, opaque: options && options.opaque, + priority: (options && options.priority) || 0}, + function (overlay) { return overlay.priority; }); + this.state.modeGen++; + regChange(this); + }), + removeOverlay: methodOp(function(spec) { + var overlays = this.state.overlays; + for (var i = 0; i < overlays.length; ++i) { + var cur = overlays[i].modeSpec; + if (cur == spec || typeof spec == "string" && cur.name == spec) { + overlays.splice(i, 1); + this.state.modeGen++; + regChange(this); + return + } + } + }), + + indentLine: methodOp(function(n, dir, aggressive) { + if (typeof dir != "string" && typeof dir != "number") { + if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; } + else { dir = dir ? "add" : "subtract"; } + } + if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); } + }), + indentSelection: methodOp(function(how) { + var ranges = this.doc.sel.ranges, end = -1; + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + if (!range.empty()) { + var from = range.from(), to = range.to(); + var start = Math.max(end, from.line); + end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1; + for (var j = start; j < end; ++j) + { indentLine(this, j, how); } + var newRanges = this.doc.sel.ranges; + if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0) + { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); } + } else if (range.head.line > end) { + indentLine(this, range.head.line, how, true); + end = range.head.line; + if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); } + } + } + }), + + // Fetch the parser token for a given character. Useful for hacks + // that want to inspect the mode state (say, for completion). + getTokenAt: function(pos, precise) { + return takeToken(this, pos, precise) + }, + + getLineTokens: function(line, precise) { + return takeToken(this, Pos(line), precise, true) + }, + + getTokenTypeAt: function(pos) { + pos = clipPos(this.doc, pos); + var styles = getLineStyles(this, getLine(this.doc, pos.line)); + var before = 0, after = (styles.length - 1) / 2, ch = pos.ch; + var type; + if (ch == 0) { type = styles[2]; } + else { for (;;) { + var mid = (before + after) >> 1; + if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; } + else if (styles[mid * 2 + 1] < ch) { before = mid + 1; } + else { type = styles[mid * 2 + 2]; break } + } } + var cut = type ? type.indexOf("overlay ") : -1; + return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1) + }, + + getModeAt: function(pos) { + var mode = this.doc.mode; + if (!mode.innerMode) { return mode } + return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode + }, + + getHelper: function(pos, type) { + return this.getHelpers(pos, type)[0] + }, + + getHelpers: function(pos, type) { + var found = []; + if (!helpers.hasOwnProperty(type)) { return found } + var help = helpers[type], mode = this.getModeAt(pos); + if (typeof mode[type] == "string") { + if (help[mode[type]]) { found.push(help[mode[type]]); } + } else if (mode[type]) { + for (var i = 0; i < mode[type].length; i++) { + var val = help[mode[type][i]]; + if (val) { found.push(val); } + } + } else if (mode.helperType && help[mode.helperType]) { + found.push(help[mode.helperType]); + } else if (help[mode.name]) { + found.push(help[mode.name]); + } + for (var i$1 = 0; i$1 < help._global.length; i$1++) { + var cur = help._global[i$1]; + if (cur.pred(mode, this) && indexOf(found, cur.val) == -1) + { found.push(cur.val); } + } + return found + }, + + getStateAfter: function(line, precise) { + var doc = this.doc; + line = clipLine(doc, line == null ? doc.first + doc.size - 1: line); + return getContextBefore(this, line + 1, precise).state + }, + + cursorCoords: function(start, mode) { + var pos, range = this.doc.sel.primary(); + if (start == null) { pos = range.head; } + else if (typeof start == "object") { pos = clipPos(this.doc, start); } + else { pos = start ? range.from() : range.to(); } + return cursorCoords(this, pos, mode || "page") + }, + + charCoords: function(pos, mode) { + return charCoords(this, clipPos(this.doc, pos), mode || "page") + }, + + coordsChar: function(coords, mode) { + coords = fromCoordSystem(this, coords, mode || "page"); + return coordsChar(this, coords.left, coords.top) + }, + + lineAtHeight: function(height, mode) { + height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top; + return lineAtHeight(this.doc, height + this.display.viewOffset) + }, + heightAtLine: function(line, mode, includeWidgets) { + var end = false, lineObj; + if (typeof line == "number") { + var last = this.doc.first + this.doc.size - 1; + if (line < this.doc.first) { line = this.doc.first; } + else if (line > last) { line = last; end = true; } + lineObj = getLine(this.doc, line); + } else { + lineObj = line; + } + return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top + + (end ? this.doc.height - heightAtLine(lineObj) : 0) + }, + + defaultTextHeight: function() { return textHeight(this.display) }, + defaultCharWidth: function() { return charWidth(this.display) }, + + getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}}, + + addWidget: function(pos, node, scroll, vert, horiz) { + var display = this.display; + pos = cursorCoords(this, clipPos(this.doc, pos)); + var top = pos.bottom, left = pos.left; + node.style.position = "absolute"; + node.setAttribute("cm-ignore-events", "true"); + this.display.input.setUneditable(node); + display.sizer.appendChild(node); + if (vert == "over") { + top = pos.top; + } else if (vert == "above" || vert == "near") { + var vspace = Math.max(display.wrapper.clientHeight, this.doc.height), + hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth); + // Default to positioning above (if specified and possible); otherwise default to positioning below + if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight) + { top = pos.top - node.offsetHeight; } + else if (pos.bottom + node.offsetHeight <= vspace) + { top = pos.bottom; } + if (left + node.offsetWidth > hspace) + { left = hspace - node.offsetWidth; } + } + node.style.top = top + "px"; + node.style.left = node.style.right = ""; + if (horiz == "right") { + left = display.sizer.clientWidth - node.offsetWidth; + node.style.right = "0px"; + } else { + if (horiz == "left") { left = 0; } + else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; } + node.style.left = left + "px"; + } + if (scroll) + { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); } + }, + + triggerOnKeyDown: methodOp(onKeyDown), + triggerOnKeyPress: methodOp(onKeyPress), + triggerOnKeyUp: onKeyUp, + triggerOnMouseDown: methodOp(onMouseDown), + + execCommand: function(cmd) { + if (commands.hasOwnProperty(cmd)) + { return commands[cmd].call(null, this) } + }, + + triggerElectric: methodOp(function(text) { triggerElectric(this, text); }), + + findPosH: function(from, amount, unit, visually) { + var dir = 1; + if (amount < 0) { dir = -1; amount = -amount; } + var cur = clipPos(this.doc, from); + for (var i = 0; i < amount; ++i) { + cur = findPosH(this.doc, cur, dir, unit, visually); + if (cur.hitSide) { break } + } + return cur + }, + + moveH: methodOp(function(dir, unit) { + var this$1 = this; + + this.extendSelectionsBy(function (range) { + if (this$1.display.shift || this$1.doc.extend || range.empty()) + { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) } + else + { return dir < 0 ? range.from() : range.to() } + }, sel_move); + }), + + deleteH: methodOp(function(dir, unit) { + var sel = this.doc.sel, doc = this.doc; + if (sel.somethingSelected()) + { doc.replaceSelection("", null, "+delete"); } + else + { deleteNearSelection(this, function (range) { + var other = findPosH(doc, range.head, dir, unit, false); + return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other} + }); } + }), + + findPosV: function(from, amount, unit, goalColumn) { + var dir = 1, x = goalColumn; + if (amount < 0) { dir = -1; amount = -amount; } + var cur = clipPos(this.doc, from); + for (var i = 0; i < amount; ++i) { + var coords = cursorCoords(this, cur, "div"); + if (x == null) { x = coords.left; } + else { coords.left = x; } + cur = findPosV(this, coords, dir, unit); + if (cur.hitSide) { break } + } + return cur + }, + + moveV: methodOp(function(dir, unit) { + var this$1 = this; + + var doc = this.doc, goals = []; + var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected(); + doc.extendSelectionsBy(function (range) { + if (collapse) + { return dir < 0 ? range.from() : range.to() } + var headPos = cursorCoords(this$1, range.head, "div"); + if (range.goalColumn != null) { headPos.left = range.goalColumn; } + goals.push(headPos.left); + var pos = findPosV(this$1, headPos, dir, unit); + if (unit == "page" && range == doc.sel.primary()) + { addToScrollTop(this$1, charCoords(this$1, pos, "div").top - headPos.top); } + return pos + }, sel_move); + if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++) + { doc.sel.ranges[i].goalColumn = goals[i]; } } + }), + + // Find the word at the given position (as returned by coordsChar). + findWordAt: function(pos) { + var doc = this.doc, line = getLine(doc, pos.line).text; + var start = pos.ch, end = pos.ch; + if (line) { + var helper = this.getHelper(pos, "wordChars"); + if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; } + var startChar = line.charAt(start); + var check = isWordChar(startChar, helper) + ? function (ch) { return isWordChar(ch, helper); } + : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); } + : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); }; + while (start > 0 && check(line.charAt(start - 1))) { --start; } + while (end < line.length && check(line.charAt(end))) { ++end; } + } + return new Range(Pos(pos.line, start), Pos(pos.line, end)) + }, + + toggleOverwrite: function(value) { + if (value != null && value == this.state.overwrite) { return } + if (this.state.overwrite = !this.state.overwrite) + { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); } + else + { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); } + + signal(this, "overwriteToggle", this, this.state.overwrite); + }, + hasFocus: function() { return this.display.input.getField() == activeElt() }, + isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) }, + + scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }), + getScrollInfo: function() { + var scroller = this.display.scroller; + return {left: scroller.scrollLeft, top: scroller.scrollTop, + height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight, + width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth, + clientHeight: displayHeight(this), clientWidth: displayWidth(this)} + }, + + scrollIntoView: methodOp(function(range, margin) { + if (range == null) { + range = {from: this.doc.sel.primary().head, to: null}; + if (margin == null) { margin = this.options.cursorScrollMargin; } + } else if (typeof range == "number") { + range = {from: Pos(range, 0), to: null}; + } else if (range.from == null) { + range = {from: range, to: null}; + } + if (!range.to) { range.to = range.from; } + range.margin = margin || 0; + + if (range.from.line != null) { + scrollToRange(this, range); + } else { + scrollToCoordsRange(this, range.from, range.to, range.margin); + } + }), + + setSize: methodOp(function(width, height) { + var this$1 = this; + + var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; }; + if (width != null) { this.display.wrapper.style.width = interpret(width); } + if (height != null) { this.display.wrapper.style.height = interpret(height); } + if (this.options.lineWrapping) { clearLineMeasurementCache(this); } + var lineNo = this.display.viewFrom; + this.doc.iter(lineNo, this.display.viewTo, function (line) { + if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) + { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, "widget"); break } } } + ++lineNo; + }); + this.curOp.forceUpdate = true; + signal(this, "refresh", this); + }), + + operation: function(f){return runInOp(this, f)}, + startOperation: function(){return startOperation(this)}, + endOperation: function(){return endOperation(this)}, + + refresh: methodOp(function() { + var oldHeight = this.display.cachedTextHeight; + regChange(this); + this.curOp.forceUpdate = true; + clearCaches(this); + scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop); + updateGutterSpace(this.display); + if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping) + { estimateLineHeights(this); } + signal(this, "refresh", this); + }), + + swapDoc: methodOp(function(doc) { + var old = this.doc; + old.cm = null; + // Cancel the current text selection if any (#5821) + if (this.state.selectingText) { this.state.selectingText(); } + attachDoc(this, doc); + clearCaches(this); + this.display.input.reset(); + scrollToCoords(this, doc.scrollLeft, doc.scrollTop); + this.curOp.forceScroll = true; + signalLater(this, "swapDoc", this, old); + return old + }), + + phrase: function(phraseText) { + var phrases = this.options.phrases; + return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText + }, + + getInputField: function(){return this.display.input.getField()}, + getWrapperElement: function(){return this.display.wrapper}, + getScrollerElement: function(){return this.display.scroller}, + getGutterElement: function(){return this.display.gutters} + }; + eventMixin(CodeMirror); + + CodeMirror.registerHelper = function(type, name, value) { + if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; } + helpers[type][name] = value; + }; + CodeMirror.registerGlobalHelper = function(type, name, predicate, value) { + CodeMirror.registerHelper(type, name, value); + helpers[type]._global.push({pred: predicate, val: value}); + }; + } + + // Used for horizontal relative motion. Dir is -1 or 1 (left or + // right), unit can be "codepoint", "char", "column" (like char, but + // doesn't cross line boundaries), "word" (across next word), or + // "group" (to the start of next group of word or + // non-word-non-whitespace chars). The visually param controls + // whether, in right-to-left text, direction 1 means to move towards + // the next index in the string, or towards the character to the right + // of the current position. The resulting position will have a + // hitSide=true property if it reached the end of the document. + function findPosH(doc, pos, dir, unit, visually) { + var oldPos = pos; + var origDir = dir; + var lineObj = getLine(doc, pos.line); + var lineDir = visually && doc.direction == "rtl" ? -dir : dir; + function findNextLine() { + var l = pos.line + lineDir; + if (l < doc.first || l >= doc.first + doc.size) { return false } + pos = new Pos(l, pos.ch, pos.sticky); + return lineObj = getLine(doc, l) + } + function moveOnce(boundToLine) { + var next; + if (unit == "codepoint") { + var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1)); + if (isNaN(ch)) { + next = null; + } else { + var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF; + next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir); + } + } else if (visually) { + next = moveVisually(doc.cm, lineObj, pos, dir); + } else { + next = moveLogically(lineObj, pos, dir); + } + if (next == null) { + if (!boundToLine && findNextLine()) + { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); } + else + { return false } + } else { + pos = next; + } + return true + } + + if (unit == "char" || unit == "codepoint") { + moveOnce(); + } else if (unit == "column") { + moveOnce(true); + } else if (unit == "word" || unit == "group") { + var sawType = null, group = unit == "group"; + var helper = doc.cm && doc.cm.getHelper(pos, "wordChars"); + for (var first = true;; first = false) { + if (dir < 0 && !moveOnce(!first)) { break } + var cur = lineObj.text.charAt(pos.ch) || "\n"; + var type = isWordChar(cur, helper) ? "w" + : group && cur == "\n" ? "n" + : !group || /\s/.test(cur) ? null + : "p"; + if (group && !first && !type) { type = "s"; } + if (sawType && sawType != type) { + if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";} + break + } + + if (type) { sawType = type; } + if (dir > 0 && !moveOnce(!first)) { break } + } + } + var result = skipAtomic(doc, pos, oldPos, origDir, true); + if (equalCursorPos(oldPos, result)) { result.hitSide = true; } + return result + } + + // For relative vertical movement. Dir may be -1 or 1. Unit can be + // "page" or "line". The resulting position will have a hitSide=true + // property if it reached the end of the document. + function findPosV(cm, pos, dir, unit) { + var doc = cm.doc, x = pos.left, y; + if (unit == "page") { + var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); + var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3); + y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount; + + } else if (unit == "line") { + y = dir > 0 ? pos.bottom + 3 : pos.top - 3; + } + var target; + for (;;) { + target = coordsChar(cm, x, y); + if (!target.outside) { break } + if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break } + y += dir * 5; + } + return target + } + + // CONTENTEDITABLE INPUT STYLE + + var ContentEditableInput = function(cm) { + this.cm = cm; + this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null; + this.polling = new Delayed(); + this.composing = null; + this.gracePeriod = false; + this.readDOMTimeout = null; + }; + + ContentEditableInput.prototype.init = function (display) { + var this$1 = this; + + var input = this, cm = input.cm; + var div = input.div = display.lineDiv; + disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize); + + function belongsToInput(e) { + for (var t = e.target; t; t = t.parentNode) { + if (t == div) { return true } + if (/\bCodeMirror-(?:line)?widget\b/.test(t.className)) { break } + } + return false + } + + on(div, "paste", function (e) { + if (!belongsToInput(e) || signalDOMEvent(cm, e) || handlePaste(e, cm)) { return } + // IE doesn't fire input events, so we schedule a read for the pasted content in this way + if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); } + }); + + on(div, "compositionstart", function (e) { + this$1.composing = {data: e.data, done: false}; + }); + on(div, "compositionupdate", function (e) { + if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; } + }); + on(div, "compositionend", function (e) { + if (this$1.composing) { + if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); } + this$1.composing.done = true; + } + }); + + on(div, "touchstart", function () { return input.forceCompositionEnd(); }); + + on(div, "input", function () { + if (!this$1.composing) { this$1.readFromDOMSoon(); } + }); + + function onCopyCut(e) { + if (!belongsToInput(e) || signalDOMEvent(cm, e)) { return } + if (cm.somethingSelected()) { + setLastCopied({lineWise: false, text: cm.getSelections()}); + if (e.type == "cut") { cm.replaceSelection("", null, "cut"); } + } else if (!cm.options.lineWiseCopyCut) { + return + } else { + var ranges = copyableRanges(cm); + setLastCopied({lineWise: true, text: ranges.text}); + if (e.type == "cut") { + cm.operation(function () { + cm.setSelections(ranges.ranges, 0, sel_dontScroll); + cm.replaceSelection("", null, "cut"); + }); + } + } + if (e.clipboardData) { + e.clipboardData.clearData(); + var content = lastCopied.text.join("\n"); + // iOS exposes the clipboard API, but seems to discard content inserted into it + e.clipboardData.setData("Text", content); + if (e.clipboardData.getData("Text") == content) { + e.preventDefault(); + return + } + } + // Old-fashioned briefly-focus-a-textarea hack + var kludge = hiddenTextarea(), te = kludge.firstChild; + cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild); + te.value = lastCopied.text.join("\n"); + var hadFocus = document.activeElement; + selectInput(te); + setTimeout(function () { + cm.display.lineSpace.removeChild(kludge); + hadFocus.focus(); + if (hadFocus == div) { input.showPrimarySelection(); } + }, 50); + } + on(div, "copy", onCopyCut); + on(div, "cut", onCopyCut); + }; + + ContentEditableInput.prototype.screenReaderLabelChanged = function (label) { + // Label for screenreaders, accessibility + if(label) { + this.div.setAttribute('aria-label', label); + } else { + this.div.removeAttribute('aria-label'); + } + }; + + ContentEditableInput.prototype.prepareSelection = function () { + var result = prepareSelection(this.cm, false); + result.focus = document.activeElement == this.div; + return result + }; + + ContentEditableInput.prototype.showSelection = function (info, takeFocus) { + if (!info || !this.cm.display.view.length) { return } + if (info.focus || takeFocus) { this.showPrimarySelection(); } + this.showMultipleSelections(info); + }; + + ContentEditableInput.prototype.getSelection = function () { + return this.cm.display.wrapper.ownerDocument.getSelection() + }; + + ContentEditableInput.prototype.showPrimarySelection = function () { + var sel = this.getSelection(), cm = this.cm, prim = cm.doc.sel.primary(); + var from = prim.from(), to = prim.to(); + + if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) { + sel.removeAllRanges(); + return + } + + var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset); + var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset); + if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad && + cmp(minPos(curAnchor, curFocus), from) == 0 && + cmp(maxPos(curAnchor, curFocus), to) == 0) + { return } + + var view = cm.display.view; + var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) || + {node: view[0].measure.map[2], offset: 0}; + var end = to.line < cm.display.viewTo && posToDOM(cm, to); + if (!end) { + var measure = view[view.length - 1].measure; + var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map; + end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]}; + } + + if (!start || !end) { + sel.removeAllRanges(); + return + } + + var old = sel.rangeCount && sel.getRangeAt(0), rng; + try { rng = range(start.node, start.offset, end.offset, end.node); } + catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible + if (rng) { + if (!gecko && cm.state.focused) { + sel.collapse(start.node, start.offset); + if (!rng.collapsed) { + sel.removeAllRanges(); + sel.addRange(rng); + } + } else { + sel.removeAllRanges(); + sel.addRange(rng); + } + if (old && sel.anchorNode == null) { sel.addRange(old); } + else if (gecko) { this.startGracePeriod(); } + } + this.rememberSelection(); + }; + + ContentEditableInput.prototype.startGracePeriod = function () { + var this$1 = this; + + clearTimeout(this.gracePeriod); + this.gracePeriod = setTimeout(function () { + this$1.gracePeriod = false; + if (this$1.selectionChanged()) + { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); } + }, 20); + }; + + ContentEditableInput.prototype.showMultipleSelections = function (info) { + removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors); + removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection); + }; + + ContentEditableInput.prototype.rememberSelection = function () { + var sel = this.getSelection(); + this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset; + this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset; + }; + + ContentEditableInput.prototype.selectionInEditor = function () { + var sel = this.getSelection(); + if (!sel.rangeCount) { return false } + var node = sel.getRangeAt(0).commonAncestorContainer; + return contains(this.div, node) + }; + + ContentEditableInput.prototype.focus = function () { + if (this.cm.options.readOnly != "nocursor") { + if (!this.selectionInEditor() || document.activeElement != this.div) + { this.showSelection(this.prepareSelection(), true); } + this.div.focus(); + } + }; + ContentEditableInput.prototype.blur = function () { this.div.blur(); }; + ContentEditableInput.prototype.getField = function () { return this.div }; + + ContentEditableInput.prototype.supportsTouch = function () { return true }; + + ContentEditableInput.prototype.receivedFocus = function () { + var input = this; + if (this.selectionInEditor()) + { this.pollSelection(); } + else + { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); } + + function poll() { + if (input.cm.state.focused) { + input.pollSelection(); + input.polling.set(input.cm.options.pollInterval, poll); + } + } + this.polling.set(this.cm.options.pollInterval, poll); + }; + + ContentEditableInput.prototype.selectionChanged = function () { + var sel = this.getSelection(); + return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset || + sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset + }; + + ContentEditableInput.prototype.pollSelection = function () { + if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return } + var sel = this.getSelection(), cm = this.cm; + // On Android Chrome (version 56, at least), backspacing into an + // uneditable block element will put the cursor in that element, + // and then, because it's not editable, hide the virtual keyboard. + // Because Android doesn't allow us to actually detect backspace + // presses in a sane way, this code checks for when that happens + // and simulates a backspace press in this case. + if (android && chrome && this.cm.display.gutterSpecs.length && isInGutter(sel.anchorNode)) { + this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs}); + this.blur(); + this.focus(); + return + } + if (this.composing) { return } + this.rememberSelection(); + var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset); + var head = domToPos(cm, sel.focusNode, sel.focusOffset); + if (anchor && head) { runInOp(cm, function () { + setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll); + if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; } + }); } + }; + + ContentEditableInput.prototype.pollContent = function () { + if (this.readDOMTimeout != null) { + clearTimeout(this.readDOMTimeout); + this.readDOMTimeout = null; + } + + var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary(); + var from = sel.from(), to = sel.to(); + if (from.ch == 0 && from.line > cm.firstLine()) + { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); } + if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine()) + { to = Pos(to.line + 1, 0); } + if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false } + + var fromIndex, fromLine, fromNode; + if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) { + fromLine = lineNo(display.view[0].line); + fromNode = display.view[0].node; + } else { + fromLine = lineNo(display.view[fromIndex].line); + fromNode = display.view[fromIndex - 1].node.nextSibling; + } + var toIndex = findViewIndex(cm, to.line); + var toLine, toNode; + if (toIndex == display.view.length - 1) { + toLine = display.viewTo - 1; + toNode = display.lineDiv.lastChild; + } else { + toLine = lineNo(display.view[toIndex + 1].line) - 1; + toNode = display.view[toIndex + 1].node.previousSibling; + } + + if (!fromNode) { return false } + var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine)); + var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length)); + while (newText.length > 1 && oldText.length > 1) { + if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; } + else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; } + else { break } + } + + var cutFront = 0, cutEnd = 0; + var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length); + while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront)) + { ++cutFront; } + var newBot = lst(newText), oldBot = lst(oldText); + var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0), + oldBot.length - (oldText.length == 1 ? cutFront : 0)); + while (cutEnd < maxCutEnd && + newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) + { ++cutEnd; } + // Try to move start of change to start of selection if ambiguous + if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) { + while (cutFront && cutFront > from.ch && + newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) { + cutFront--; + cutEnd++; + } + } + + newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, ""); + newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, ""); + + var chFrom = Pos(fromLine, cutFront); + var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0); + if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) { + replaceRange(cm.doc, newText, chFrom, chTo, "+input"); + return true + } + }; + + ContentEditableInput.prototype.ensurePolled = function () { + this.forceCompositionEnd(); + }; + ContentEditableInput.prototype.reset = function () { + this.forceCompositionEnd(); + }; + ContentEditableInput.prototype.forceCompositionEnd = function () { + if (!this.composing) { return } + clearTimeout(this.readDOMTimeout); + this.composing = null; + this.updateFromDOM(); + this.div.blur(); + this.div.focus(); + }; + ContentEditableInput.prototype.readFromDOMSoon = function () { + var this$1 = this; + + if (this.readDOMTimeout != null) { return } + this.readDOMTimeout = setTimeout(function () { + this$1.readDOMTimeout = null; + if (this$1.composing) { + if (this$1.composing.done) { this$1.composing = null; } + else { return } + } + this$1.updateFromDOM(); + }, 80); + }; + + ContentEditableInput.prototype.updateFromDOM = function () { + var this$1 = this; + + if (this.cm.isReadOnly() || !this.pollContent()) + { runInOp(this.cm, function () { return regChange(this$1.cm); }); } + }; + + ContentEditableInput.prototype.setUneditable = function (node) { + node.contentEditable = "false"; + }; + + ContentEditableInput.prototype.onKeyPress = function (e) { + if (e.charCode == 0 || this.composing) { return } + e.preventDefault(); + if (!this.cm.isReadOnly()) + { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); } + }; + + ContentEditableInput.prototype.readOnlyChanged = function (val) { + this.div.contentEditable = String(val != "nocursor"); + }; + + ContentEditableInput.prototype.onContextMenu = function () {}; + ContentEditableInput.prototype.resetPosition = function () {}; + + ContentEditableInput.prototype.needsContentAttribute = true; + + function posToDOM(cm, pos) { + var view = findViewForLine(cm, pos.line); + if (!view || view.hidden) { return null } + var line = getLine(cm.doc, pos.line); + var info = mapFromLineView(view, line, pos.line); + + var order = getOrder(line, cm.doc.direction), side = "left"; + if (order) { + var partPos = getBidiPartAt(order, pos.ch); + side = partPos % 2 ? "right" : "left"; + } + var result = nodeAndOffsetInLineMap(info.map, pos.ch, side); + result.offset = result.collapse == "right" ? result.end : result.start; + return result + } + + function isInGutter(node) { + for (var scan = node; scan; scan = scan.parentNode) + { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } } + return false + } + + function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos } + + function domTextBetween(cm, from, to, fromLine, toLine) { + var text = "", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false; + function recognizeMarker(id) { return function (marker) { return marker.id == id; } } + function close() { + if (closing) { + text += lineSep; + if (extraLinebreak) { text += lineSep; } + closing = extraLinebreak = false; + } + } + function addText(str) { + if (str) { + close(); + text += str; + } + } + function walk(node) { + if (node.nodeType == 1) { + var cmText = node.getAttribute("cm-text"); + if (cmText) { + addText(cmText); + return + } + var markerID = node.getAttribute("cm-marker"), range; + if (markerID) { + var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID)); + if (found.length && (range = found[0].find(0))) + { addText(getBetween(cm.doc, range.from, range.to).join(lineSep)); } + return + } + if (node.getAttribute("contenteditable") == "false") { return } + var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName); + if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) { return } + + if (isBlock) { close(); } + for (var i = 0; i < node.childNodes.length; i++) + { walk(node.childNodes[i]); } + + if (/^(pre|p)$/i.test(node.nodeName)) { extraLinebreak = true; } + if (isBlock) { closing = true; } + } else if (node.nodeType == 3) { + addText(node.nodeValue.replace(/\u200b/g, "").replace(/\u00a0/g, " ")); + } + } + for (;;) { + walk(from); + if (from == to) { break } + from = from.nextSibling; + extraLinebreak = false; + } + return text + } + + function domToPos(cm, node, offset) { + var lineNode; + if (node == cm.display.lineDiv) { + lineNode = cm.display.lineDiv.childNodes[offset]; + if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) } + node = null; offset = 0; + } else { + for (lineNode = node;; lineNode = lineNode.parentNode) { + if (!lineNode || lineNode == cm.display.lineDiv) { return null } + if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break } + } + } + for (var i = 0; i < cm.display.view.length; i++) { + var lineView = cm.display.view[i]; + if (lineView.node == lineNode) + { return locateNodeInLineView(lineView, node, offset) } + } + } + + function locateNodeInLineView(lineView, node, offset) { + var wrapper = lineView.text.firstChild, bad = false; + if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) } + if (node == wrapper) { + bad = true; + node = wrapper.childNodes[offset]; + offset = 0; + if (!node) { + var line = lineView.rest ? lst(lineView.rest) : lineView.line; + return badPos(Pos(lineNo(line), line.text.length), bad) + } + } + + var textNode = node.nodeType == 3 ? node : null, topNode = node; + if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) { + textNode = node.firstChild; + if (offset) { offset = textNode.nodeValue.length; } + } + while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; } + var measure = lineView.measure, maps = measure.maps; + + function find(textNode, topNode, offset) { + for (var i = -1; i < (maps ? maps.length : 0); i++) { + var map = i < 0 ? measure.map : maps[i]; + for (var j = 0; j < map.length; j += 3) { + var curNode = map[j + 2]; + if (curNode == textNode || curNode == topNode) { + var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]); + var ch = map[j] + offset; + if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)]; } + return Pos(line, ch) + } + } + } + } + var found = find(textNode, topNode, offset); + if (found) { return badPos(found, bad) } + + // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems + for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) { + found = find(after, after.firstChild, 0); + if (found) + { return badPos(Pos(found.line, found.ch - dist), bad) } + else + { dist += after.textContent.length; } + } + for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) { + found = find(before, before.firstChild, -1); + if (found) + { return badPos(Pos(found.line, found.ch + dist$1), bad) } + else + { dist$1 += before.textContent.length; } + } + } + + // TEXTAREA INPUT STYLE + + var TextareaInput = function(cm) { + this.cm = cm; + // See input.poll and input.reset + this.prevInput = ""; + + // Flag that indicates whether we expect input to appear real soon + // now (after some event like 'keypress' or 'input') and are + // polling intensively. + this.pollingFast = false; + // Self-resetting timeout for the poller + this.polling = new Delayed(); + // Used to work around IE issue with selection being forgotten when focus moves away from textarea + this.hasSelection = false; + this.composing = null; + }; + + TextareaInput.prototype.init = function (display) { + var this$1 = this; + + var input = this, cm = this.cm; + this.createField(display); + var te = this.textarea; + + display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild); + + // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore) + if (ios) { te.style.width = "0px"; } + + on(te, "input", function () { + if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; } + input.poll(); + }); + + on(te, "paste", function (e) { + if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return } + + cm.state.pasteIncoming = +new Date; + input.fastPoll(); + }); + + function prepareCopyCut(e) { + if (signalDOMEvent(cm, e)) { return } + if (cm.somethingSelected()) { + setLastCopied({lineWise: false, text: cm.getSelections()}); + } else if (!cm.options.lineWiseCopyCut) { + return + } else { + var ranges = copyableRanges(cm); + setLastCopied({lineWise: true, text: ranges.text}); + if (e.type == "cut") { + cm.setSelections(ranges.ranges, null, sel_dontScroll); + } else { + input.prevInput = ""; + te.value = ranges.text.join("\n"); + selectInput(te); + } + } + if (e.type == "cut") { cm.state.cutIncoming = +new Date; } + } + on(te, "cut", prepareCopyCut); + on(te, "copy", prepareCopyCut); + + on(display.scroller, "paste", function (e) { + if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return } + if (!te.dispatchEvent) { + cm.state.pasteIncoming = +new Date; + input.focus(); + return + } + + // Pass the `paste` event to the textarea so it's handled by its event listener. + var event = new Event("paste"); + event.clipboardData = e.clipboardData; + te.dispatchEvent(event); + }); + + // Prevent normal selection in the editor (we handle our own) + on(display.lineSpace, "selectstart", function (e) { + if (!eventInWidget(display, e)) { e_preventDefault(e); } + }); + + on(te, "compositionstart", function () { + var start = cm.getCursor("from"); + if (input.composing) { input.composing.range.clear(); } + input.composing = { + start: start, + range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"}) + }; + }); + on(te, "compositionend", function () { + if (input.composing) { + input.poll(); + input.composing.range.clear(); + input.composing = null; + } + }); + }; + + TextareaInput.prototype.createField = function (_display) { + // Wraps and hides input textarea + this.wrapper = hiddenTextarea(); + // The semihidden textarea that is focused when the editor is + // focused, and receives input. + this.textarea = this.wrapper.firstChild; + }; + + TextareaInput.prototype.screenReaderLabelChanged = function (label) { + // Label for screenreaders, accessibility + if(label) { + this.textarea.setAttribute('aria-label', label); + } else { + this.textarea.removeAttribute('aria-label'); + } + }; + + TextareaInput.prototype.prepareSelection = function () { + // Redraw the selection and/or cursor + var cm = this.cm, display = cm.display, doc = cm.doc; + var result = prepareSelection(cm); + + // Move the hidden textarea near the cursor to prevent scrolling artifacts + if (cm.options.moveInputWithCursor) { + var headPos = cursorCoords(cm, doc.sel.primary().head, "div"); + var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect(); + result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10, + headPos.top + lineOff.top - wrapOff.top)); + result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10, + headPos.left + lineOff.left - wrapOff.left)); + } + + return result + }; + + TextareaInput.prototype.showSelection = function (drawn) { + var cm = this.cm, display = cm.display; + removeChildrenAndAdd(display.cursorDiv, drawn.cursors); + removeChildrenAndAdd(display.selectionDiv, drawn.selection); + if (drawn.teTop != null) { + this.wrapper.style.top = drawn.teTop + "px"; + this.wrapper.style.left = drawn.teLeft + "px"; + } + }; + + // Reset the input to correspond to the selection (or to be empty, + // when not typing and nothing is selected) + TextareaInput.prototype.reset = function (typing) { + if (this.contextMenuPending || this.composing) { return } + var cm = this.cm; + if (cm.somethingSelected()) { + this.prevInput = ""; + var content = cm.getSelection(); + this.textarea.value = content; + if (cm.state.focused) { selectInput(this.textarea); } + if (ie && ie_version >= 9) { this.hasSelection = content; } + } else if (!typing) { + this.prevInput = this.textarea.value = ""; + if (ie && ie_version >= 9) { this.hasSelection = null; } + } + }; + + TextareaInput.prototype.getField = function () { return this.textarea }; + + TextareaInput.prototype.supportsTouch = function () { return false }; + + TextareaInput.prototype.focus = function () { + if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) { + try { this.textarea.focus(); } + catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM + } + }; + + TextareaInput.prototype.blur = function () { this.textarea.blur(); }; + + TextareaInput.prototype.resetPosition = function () { + this.wrapper.style.top = this.wrapper.style.left = 0; + }; + + TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); }; + + // Poll for input changes, using the normal rate of polling. This + // runs as long as the editor is focused. + TextareaInput.prototype.slowPoll = function () { + var this$1 = this; + + if (this.pollingFast) { return } + this.polling.set(this.cm.options.pollInterval, function () { + this$1.poll(); + if (this$1.cm.state.focused) { this$1.slowPoll(); } + }); + }; + + // When an event has just come in that is likely to add or change + // something in the input textarea, we poll faster, to ensure that + // the change appears on the screen quickly. + TextareaInput.prototype.fastPoll = function () { + var missed = false, input = this; + input.pollingFast = true; + function p() { + var changed = input.poll(); + if (!changed && !missed) {missed = true; input.polling.set(60, p);} + else {input.pollingFast = false; input.slowPoll();} + } + input.polling.set(20, p); + }; + + // Read input from the textarea, and update the document to match. + // When something is selected, it is present in the textarea, and + // selected (unless it is huge, in which case a placeholder is + // used). When nothing is selected, the cursor sits after previously + // seen text (can be empty), which is stored in prevInput (we must + // not reset the textarea when typing, because that breaks IME). + TextareaInput.prototype.poll = function () { + var this$1 = this; + + var cm = this.cm, input = this.textarea, prevInput = this.prevInput; + // Since this is called a *lot*, try to bail out as cheaply as + // possible when it is clear that nothing happened. hasSelection + // will be the case when there is a lot of text in the textarea, + // in which case reading its value would be expensive. + if (this.contextMenuPending || !cm.state.focused || + (hasSelection(input) && !prevInput && !this.composing) || + cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq) + { return false } + + var text = input.value; + // If nothing changed, bail. + if (text == prevInput && !cm.somethingSelected()) { return false } + // Work around nonsensical selection resetting in IE9/10, and + // inexplicable appearance of private area unicode characters on + // some key combos in Mac (#2689). + if (ie && ie_version >= 9 && this.hasSelection === text || + mac && /[\uf700-\uf7ff]/.test(text)) { + cm.display.input.reset(); + return false + } + + if (cm.doc.sel == cm.display.selForContextMenu) { + var first = text.charCodeAt(0); + if (first == 0x200b && !prevInput) { prevInput = "\u200b"; } + if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") } + } + // Find the part of the input that is actually new + var same = 0, l = Math.min(prevInput.length, text.length); + while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; } + + runInOp(cm, function () { + applyTextInput(cm, text.slice(same), prevInput.length - same, + null, this$1.composing ? "*compose" : null); + + // Don't leave long text in the textarea, since it makes further polling slow + if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = ""; } + else { this$1.prevInput = text; } + + if (this$1.composing) { + this$1.composing.range.clear(); + this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"), + {className: "CodeMirror-composing"}); + } + }); + return true + }; + + TextareaInput.prototype.ensurePolled = function () { + if (this.pollingFast && this.poll()) { this.pollingFast = false; } + }; + + TextareaInput.prototype.onKeyPress = function () { + if (ie && ie_version >= 9) { this.hasSelection = null; } + this.fastPoll(); + }; + + TextareaInput.prototype.onContextMenu = function (e) { + var input = this, cm = input.cm, display = cm.display, te = input.textarea; + if (input.contextMenuPending) { input.contextMenuPending(); } + var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop; + if (!pos || presto) { return } // Opera is difficult. + + // Reset the current text selection only if the click is done outside of the selection + // and 'resetSelectionOnContextMenu' option is true. + var reset = cm.options.resetSelectionOnContextMenu; + if (reset && cm.doc.sel.contains(pos) == -1) + { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); } + + var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText; + var wrapperBox = input.wrapper.offsetParent.getBoundingClientRect(); + input.wrapper.style.cssText = "position: static"; + te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; + var oldScrollY; + if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712) + display.input.focus(); + if (webkit) { window.scrollTo(null, oldScrollY); } + display.input.reset(); + // Adds "Select all" to context menu in FF + if (!cm.somethingSelected()) { te.value = input.prevInput = " "; } + input.contextMenuPending = rehide; + display.selForContextMenu = cm.doc.sel; + clearTimeout(display.detectingSelectAll); + + // Select-all will be greyed out if there's nothing to select, so + // this adds a zero-width space so that we can later check whether + // it got selected. + function prepareSelectAllHack() { + if (te.selectionStart != null) { + var selected = cm.somethingSelected(); + var extval = "\u200b" + (selected ? te.value : ""); + te.value = "\u21da"; // Used to catch context-menu undo + te.value = extval; + input.prevInput = selected ? "" : "\u200b"; + te.selectionStart = 1; te.selectionEnd = extval.length; + // Re-set this, in case some other handler touched the + // selection in the meantime. + display.selForContextMenu = cm.doc.sel; + } + } + function rehide() { + if (input.contextMenuPending != rehide) { return } + input.contextMenuPending = false; + input.wrapper.style.cssText = oldWrapperCSS; + te.style.cssText = oldCSS; + if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); } + + // Try to detect the user choosing select-all + if (te.selectionStart != null) { + if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); } + var i = 0, poll = function () { + if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 && + te.selectionEnd > 0 && input.prevInput == "\u200b") { + operation(cm, selectAll)(cm); + } else if (i++ < 10) { + display.detectingSelectAll = setTimeout(poll, 500); + } else { + display.selForContextMenu = null; + display.input.reset(); + } + }; + display.detectingSelectAll = setTimeout(poll, 200); + } + } + + if (ie && ie_version >= 9) { prepareSelectAllHack(); } + if (captureRightClick) { + e_stop(e); + var mouseup = function () { + off(window, "mouseup", mouseup); + setTimeout(rehide, 20); + }; + on(window, "mouseup", mouseup); + } else { + setTimeout(rehide, 50); + } + }; + + TextareaInput.prototype.readOnlyChanged = function (val) { + if (!val) { this.reset(); } + this.textarea.disabled = val == "nocursor"; + this.textarea.readOnly = !!val; + }; + + TextareaInput.prototype.setUneditable = function () {}; + + TextareaInput.prototype.needsContentAttribute = false; + + function fromTextArea(textarea, options) { + options = options ? copyObj(options) : {}; + options.value = textarea.value; + if (!options.tabindex && textarea.tabIndex) + { options.tabindex = textarea.tabIndex; } + if (!options.placeholder && textarea.placeholder) + { options.placeholder = textarea.placeholder; } + // Set autofocus to true if this textarea is focused, or if it has + // autofocus and no other element is focused. + if (options.autofocus == null) { + var hasFocus = activeElt(); + options.autofocus = hasFocus == textarea || + textarea.getAttribute("autofocus") != null && hasFocus == document.body; + } + + function save() {textarea.value = cm.getValue();} + + var realSubmit; + if (textarea.form) { + on(textarea.form, "submit", save); + // Deplorable hack to make the submit method do the right thing. + if (!options.leaveSubmitMethodAlone) { + var form = textarea.form; + realSubmit = form.submit; + try { + var wrappedSubmit = form.submit = function () { + save(); + form.submit = realSubmit; + form.submit(); + form.submit = wrappedSubmit; + }; + } catch(e) {} + } + } + + options.finishInit = function (cm) { + cm.save = save; + cm.getTextArea = function () { return textarea; }; + cm.toTextArea = function () { + cm.toTextArea = isNaN; // Prevent this from being ran twice + save(); + textarea.parentNode.removeChild(cm.getWrapperElement()); + textarea.style.display = ""; + if (textarea.form) { + off(textarea.form, "submit", save); + if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == "function") + { textarea.form.submit = realSubmit; } + } + }; + }; + + textarea.style.display = "none"; + var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); }, + options); + return cm + } + + function addLegacyProps(CodeMirror) { + CodeMirror.off = off; + CodeMirror.on = on; + CodeMirror.wheelEventPixels = wheelEventPixels; + CodeMirror.Doc = Doc; + CodeMirror.splitLines = splitLinesAuto; + CodeMirror.countColumn = countColumn; + CodeMirror.findColumn = findColumn; + CodeMirror.isWordChar = isWordCharBasic; + CodeMirror.Pass = Pass; + CodeMirror.signal = signal; + CodeMirror.Line = Line; + CodeMirror.changeEnd = changeEnd; + CodeMirror.scrollbarModel = scrollbarModel; + CodeMirror.Pos = Pos; + CodeMirror.cmpPos = cmp; + CodeMirror.modes = modes; + CodeMirror.mimeModes = mimeModes; + CodeMirror.resolveMode = resolveMode; + CodeMirror.getMode = getMode; + CodeMirror.modeExtensions = modeExtensions; + CodeMirror.extendMode = extendMode; + CodeMirror.copyState = copyState; + CodeMirror.startState = startState; + CodeMirror.innerMode = innerMode; + CodeMirror.commands = commands; + CodeMirror.keyMap = keyMap; + CodeMirror.keyName = keyName; + CodeMirror.isModifierKey = isModifierKey; + CodeMirror.lookupKey = lookupKey; + CodeMirror.normalizeKeyMap = normalizeKeyMap; + CodeMirror.StringStream = StringStream; + CodeMirror.SharedTextMarker = SharedTextMarker; + CodeMirror.TextMarker = TextMarker; + CodeMirror.LineWidget = LineWidget; + CodeMirror.e_preventDefault = e_preventDefault; + CodeMirror.e_stopPropagation = e_stopPropagation; + CodeMirror.e_stop = e_stop; + CodeMirror.addClass = addClass; + CodeMirror.contains = contains; + CodeMirror.rmClass = rmClass; + CodeMirror.keyNames = keyNames; + } + + // EDITOR CONSTRUCTOR + + defineOptions(CodeMirror); + + addEditorMethods(CodeMirror); + + // Set up methods on CodeMirror's prototype to redirect to the editor's document. + var dontDelegate = "iter insert remove copy getEditor constructor".split(" "); + for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0) + { CodeMirror.prototype[prop] = (function(method) { + return function() {return method.apply(this.doc, arguments)} + })(Doc.prototype[prop]); } } + + eventMixin(Doc); + CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput}; + + // Extra arguments are stored as the mode's dependencies, which is + // used by (legacy) mechanisms like loadmode.js to automatically + // load a mode. (Preferred mechanism is the require/define calls.) + CodeMirror.defineMode = function(name/*, mode, …*/) { + if (!CodeMirror.defaults.mode && name != "null") { CodeMirror.defaults.mode = name; } + defineMode.apply(this, arguments); + }; + + CodeMirror.defineMIME = defineMIME; + + // Minimal default mode. + CodeMirror.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); }); + CodeMirror.defineMIME("text/plain", "null"); + + // EXTENSIONS + + CodeMirror.defineExtension = function (name, func) { + CodeMirror.prototype[name] = func; + }; + CodeMirror.defineDocExtension = function (name, func) { + Doc.prototype[name] = func; + }; + + CodeMirror.fromTextArea = fromTextArea; + + addLegacyProps(CodeMirror); + + CodeMirror.version = "5.59.2"; + + return CodeMirror; + +}))); diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/highlight.pack.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/highlight.pack.js new file mode 100644 index 0000000000..52404e5d6a --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/highlight.pack.js @@ -0,0 +1,2 @@ +/*! highlight.js v9.12.0 | BSD3 License | git.io/hljslicense */ +!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/&/g,"&").replace(//g,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function a(e){return k.test(e)}function i(e){var n,t,r,i,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=B.exec(o))return w(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(i=o[n],a(i)||w(i))return i}function o(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach(function(e){for(n in e)t[n]=e[n]}),t}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3===i.nodeType?a+=i.nodeValue.length:1===i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset"}function u(e){s+=""}function c(e){("start"===e.event?o:u)(e.node)}for(var l=0,s="",f=[];e.length||r.length;){var g=i();if(s+=n(a.substring(l,g[0].offset)),l=g[0].offset,g===e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g===e&&g.length&&g[0].offset===l);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return s+n(a.substr(l))}function l(e){return e.v&&!e.cached_variants&&(e.cached_variants=e.v.map(function(n){return o(e,{v:null},n)})),e.cached_variants||e.eW&&[o(e)]||[e]}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var o={},u=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");o[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?u("keyword",a.k):x(a.k).forEach(function(e){u(e,a.k[e])}),a.k=o}a.lR=t(a.l||/\w+/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),null==a.r&&(a.r=1),a.c||(a.c=[]),a.c=Array.prototype.concat.apply([],a.c.map(function(e){return l("self"===e?a:e)})),a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var c=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=c.length?t(c.join("|"),!0):{exec:function(){return null}}}}r(e)}function f(e,t,a,i){function o(e,n){var t,a;for(t=0,a=n.c.length;a>t;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!a&&r(n.iR,e)}function l(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function p(e,n,t,r){var a=r?"":I.classPrefix,i='',i+n+o}function h(){var e,t,r,a;if(!E.k)return n(k);for(a="",t=0,E.lR.lastIndex=0,r=E.lR.exec(k);r;)a+=n(k.substring(t,r.index)),e=l(E,r),e?(B+=e[1],a+=p(e[0],n(r[0]))):a+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(k);return a+n(k.substr(t))}function d(){var e="string"==typeof E.sL;if(e&&!y[E.sL])return n(k);var t=e?f(E.sL,k,!0,x[E.sL]):g(k,E.sL.length?E.sL:void 0);return E.r>0&&(B+=t.r),e&&(x[E.sL]=t.top),p(t.language,t.value,!1,!0)}function b(){L+=null!=E.sL?d():h(),k=""}function v(e){L+=e.cN?p(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function m(e,n){if(k+=e,null==n)return b(),0;var t=o(n,E);if(t)return t.skip?k+=n:(t.eB&&(k+=n),b(),t.rB||t.eB||(k=n)),v(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var a=E;a.skip?k+=n:(a.rE||a.eE||(k+=n),b(),a.eE&&(k=n));do E.cN&&(L+=C),E.skip||(B+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&v(r.starts,""),a.rE?0:n.length}if(c(n,E))throw new Error('Illegal lexeme "'+n+'" for mode "'+(E.cN||"")+'"');return k+=n,n.length||1}var N=w(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var R,E=i||N,x={},L="";for(R=E;R!==N;R=R.parent)R.cN&&(L=p(R.cN,"",!0)+L);var k="",B=0;try{for(var M,j,O=0;;){if(E.t.lastIndex=O,M=E.t.exec(t),!M)break;j=m(t.substring(O,M.index),M[0]),O=M.index+j}for(m(t.substr(O)),R=E;R.parent;R=R.parent)R.cN&&(L+=C);return{r:B,value:L,language:e,top:E}}catch(T){if(T.message&&-1!==T.message.indexOf("Illegal"))return{r:0,value:n(t)};throw T}}function g(e,t){t=t||I.languages||x(y);var r={r:0,value:n(e)},a=r;return t.filter(w).forEach(function(n){var t=f(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}),a.language&&(r.second_best=a),r}function p(e){return I.tabReplace||I.useBR?e.replace(M,function(e,n){return I.useBR&&"\n"===e?"
":I.tabReplace?n.replace(/\t/g,I.tabReplace):""}):e}function h(e,n,t){var r=n?L[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function d(e){var n,t,r,o,l,s=i(e);a(s)||(I.useBR?(n=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):n=e,l=n.textContent,r=s?f(s,l,!0):g(l),t=u(n),t.length&&(o=document.createElementNS("http://www.w3.org/1999/xhtml","div"),o.innerHTML=r.value,r.value=c(t,u(o),l)),r.value=p(r.value),e.innerHTML=r.value,e.className=h(e.className,s,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function b(e){I=o(I,e)}function v(){if(!v.called){v.called=!0;var e=document.querySelectorAll("pre code");E.forEach.call(e,d)}}function m(){addEventListener("DOMContentLoaded",v,!1),addEventListener("load",v,!1)}function N(n,t){var r=y[n]=t(e);r.aliases&&r.aliases.forEach(function(e){L[e]=n})}function R(){return x(y)}function w(e){return e=(e||"").toLowerCase(),y[e]||y[L[e]]}var E=[],x=Object.keys,y={},L={},k=/^(no-?highlight|plain|text)$/i,B=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,C="
",I={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0};return e.highlight=f,e.highlightAuto=g,e.fixMarkup=p,e.highlightBlock=d,e.configure=b,e.initHighlighting=v,e.initHighlightingOnLoad=m,e.registerLanguage=N,e.listLanguages=R,e.getLanguage=w,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("xml",function(s){var e="[A-Za-z0-9\\._:-]+",t={eW:!0,i:/`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[t],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[t],starts:{e:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}});hljs.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"^```w*s*$",e:"^```s*$"},{b:"`.+?`"},{b:"^( {4}| )",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:/^\[[^\n]+\]:/,rB:!0,c:[{cN:"symbol",b:/\[/,e:/\]/,eB:!0,eE:!0},{cN:"link",b:/:\s*/,e:/$/,eB:!0}]}]}});hljs.registerLanguage("javascript",function(e){var r="[A-Za-z$_][0-9A-Za-z$_]*",t={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},a={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},n={cN:"subst",b:"\\$\\{",e:"\\}",k:t,c:[]},c={cN:"string",b:"`",e:"`",c:[e.BE,n]};n.c=[e.ASM,e.QSM,c,a,e.RM];var s=n.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:t,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,c,e.CLCM,e.CBCM,a,{b:/[{,]\s*/,r:0,c:[{b:r+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:r,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+r+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:r},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,c:s}]}]},{b://,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:r}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}});hljs.registerLanguage("powershell",function(e){var t={b:"`[\\s\\S]",r:0},o={cN:"variable",v:[{b:/\$[\w\d][\w\d_:]*/}]},r={cN:"literal",b:/\$(null|true|false)\b/},n={cN:"string",v:[{b:/"/,e:/"/},{b:/@"/,e:/^"@/}],c:[t,o,{cN:"variable",b:/\$[A-z]/,e:/[^A-z]/}]},a={cN:"string",v:[{b:/'/,e:/'/},{b:/@'/,e:/^'@/}]},i={cN:"doctag",v:[{b:/\.(synopsis|description|example|inputs|outputs|notes|link|component|role|functionality)/},{b:/\.(parameter|forwardhelptargetname|forwardhelpcategory|remotehelprunspace|externalhelp)\s+\S+/}]},s=e.inherit(e.C(null,null),{v:[{b:/#/,e:/$/},{b:/<#/,e:/#>/}],c:[i]});return{aliases:["ps"],l:/-?[A-z\.\-]+/,cI:!0,k:{keyword:"if else foreach return function do while until elseif begin for trap data dynamicparam end break throw param continue finally in switch exit filter try process catch",built_in:"Add-Computer Add-Content Add-History Add-JobTrigger Add-Member Add-PSSnapin Add-Type Checkpoint-Computer Clear-Content Clear-EventLog Clear-History Clear-Host Clear-Item Clear-ItemProperty Clear-Variable Compare-Object Complete-Transaction Connect-PSSession Connect-WSMan Convert-Path ConvertFrom-Csv ConvertFrom-Json ConvertFrom-SecureString ConvertFrom-StringData ConvertTo-Csv ConvertTo-Html ConvertTo-Json ConvertTo-SecureString ConvertTo-Xml Copy-Item Copy-ItemProperty Debug-Process Disable-ComputerRestore Disable-JobTrigger Disable-PSBreakpoint Disable-PSRemoting Disable-PSSessionConfiguration Disable-WSManCredSSP Disconnect-PSSession Disconnect-WSMan Disable-ScheduledJob Enable-ComputerRestore Enable-JobTrigger Enable-PSBreakpoint Enable-PSRemoting Enable-PSSessionConfiguration Enable-ScheduledJob Enable-WSManCredSSP Enter-PSSession Exit-PSSession Export-Alias Export-Clixml Export-Console Export-Counter Export-Csv Export-FormatData Export-ModuleMember Export-PSSession ForEach-Object Format-Custom Format-List Format-Table Format-Wide Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command Get-ComputerRestorePoint Get-Content Get-ControlPanelItem Get-Counter Get-Credential Get-Culture Get-Date Get-Event Get-EventLog Get-EventSubscriber Get-ExecutionPolicy Get-FormatData Get-Host Get-HotFix Get-Help Get-History Get-IseSnippet Get-Item Get-ItemProperty Get-Job Get-JobTrigger Get-Location Get-Member Get-Module Get-PfxCertificate Get-Process Get-PSBreakpoint Get-PSCallStack Get-PSDrive Get-PSProvider Get-PSSession Get-PSSessionConfiguration Get-PSSnapin Get-Random Get-ScheduledJob Get-ScheduledJobOption Get-Service Get-TraceSource Get-Transaction Get-TypeData Get-UICulture Get-Unique Get-Variable Get-Verb Get-WinEvent Get-WmiObject Get-WSManCredSSP Get-WSManInstance Group-Object Import-Alias Import-Clixml Import-Counter Import-Csv Import-IseSnippet Import-LocalizedData Import-PSSession Import-Module Invoke-AsWorkflow Invoke-Command Invoke-Expression Invoke-History Invoke-Item Invoke-RestMethod Invoke-WebRequest Invoke-WmiMethod Invoke-WSManAction Join-Path Limit-EventLog Measure-Command Measure-Object Move-Item Move-ItemProperty New-Alias New-Event New-EventLog New-IseSnippet New-Item New-ItemProperty New-JobTrigger New-Object New-Module New-ModuleManifest New-PSDrive New-PSSession New-PSSessionConfigurationFile New-PSSessionOption New-PSTransportOption New-PSWorkflowExecutionOption New-PSWorkflowSession New-ScheduledJobOption New-Service New-TimeSpan New-Variable New-WebServiceProxy New-WinEvent New-WSManInstance New-WSManSessionOption Out-Default Out-File Out-GridView Out-Host Out-Null Out-Printer Out-String Pop-Location Push-Location Read-Host Receive-Job Register-EngineEvent Register-ObjectEvent Register-PSSessionConfiguration Register-ScheduledJob Register-WmiEvent Remove-Computer Remove-Event Remove-EventLog Remove-Item Remove-ItemProperty Remove-Job Remove-JobTrigger Remove-Module Remove-PSBreakpoint Remove-PSDrive Remove-PSSession Remove-PSSnapin Remove-TypeData Remove-Variable Remove-WmiObject Remove-WSManInstance Rename-Computer Rename-Item Rename-ItemProperty Reset-ComputerMachinePassword Resolve-Path Restart-Computer Restart-Service Restore-Computer Resume-Job Resume-Service Save-Help Select-Object Select-String Select-Xml Send-MailMessage Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content Set-Date Set-ExecutionPolicy Set-Item Set-ItemProperty Set-JobTrigger Set-Location Set-PSBreakpoint Set-PSDebug Set-PSSessionConfiguration Set-ScheduledJob Set-ScheduledJobOption Set-Service Set-StrictMode Set-TraceSource Set-Variable Set-WmiInstance Set-WSManInstance Set-WSManQuickConfig Show-Command Show-ControlPanelItem Show-EventLog Sort-Object Split-Path Start-Job Start-Process Start-Service Start-Sleep Start-Transaction Start-Transcript Stop-Computer Stop-Job Stop-Process Stop-Service Stop-Transcript Suspend-Job Suspend-Service Tee-Object Test-ComputerSecureChannel Test-Connection Test-ModuleManifest Test-Path Test-PSSessionConfigurationFile Trace-Command Unblock-File Undo-Transaction Unregister-Event Unregister-PSSessionConfiguration Unregister-ScheduledJob Update-FormatData Update-Help Update-List Update-TypeData Use-Transaction Wait-Event Wait-Job Wait-Process Where-Object Write-Debug Write-Error Write-EventLog Write-Host Write-Output Write-Progress Write-Verbose Write-Warning Add-MDTPersistentDrive Disable-MDTMonitorService Enable-MDTMonitorService Get-MDTDeploymentShareStatistics Get-MDTMonitorData Get-MDTOperatingSystemCatalog Get-MDTPersistentDrive Import-MDTApplication Import-MDTDriver Import-MDTOperatingSystem Import-MDTPackage Import-MDTTaskSequence New-MDTDatabase Remove-MDTMonitorData Remove-MDTPersistentDrive Restore-MDTPersistentDrive Set-MDTMonitorData Test-MDTDeploymentShare Test-MDTMonitorData Update-MDTDatabaseSchema Update-MDTDeploymentShare Update-MDTLinkedDS Update-MDTMedia Update-MDTMedia Add-VamtProductKey Export-VamtData Find-VamtManagedMachine Get-VamtConfirmationId Get-VamtProduct Get-VamtProductKey Import-VamtData Initialize-VamtData Install-VamtConfirmationId Install-VamtProductActivation Install-VamtProductKey Update-VamtProduct",nomarkup:"-ne -eq -lt -gt -ge -le -not -like -notlike -match -notmatch -contains -notcontains -in -notin -replace"},c:[t,e.NM,n,a,r,o,s]}});hljs.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"meta",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"comment",v:[{b:/Index: /,e:/$/},{b:/={3,}/,e:/$/},{b:/^\-{3}/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+{3}/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"addition",b:"^\\!",e:"$"}]}});hljs.registerLanguage("java",function(e){var a="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",t=a+"(<"+a+"(\\s*,\\s*"+a+")*>)?",r="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",s="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",c={cN:"number",b:s,r:0};return{aliases:["jsp"],k:r,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"("+t+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:r,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:r,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},c,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("vbnet",function(e){return{aliases:["vb"],cI:!0,k:{keyword:"addhandler addressof alias and andalso aggregate ansi as assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into is isfalse isnot istrue join key let lib like loop me mid mod module mustinherit mustoverride mybase myclass namespace narrowing new next not notinheritable notoverridable of off on operator option optional or order orelse overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim rem removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly xor",built_in:"boolean byte cbool cbyte cchar cdate cdec cdbl char cint clng cobj csbyte cshort csng cstr ctype date decimal directcast double gettype getxmlnamespace iif integer long object sbyte short single string trycast typeof uinteger ulong ushort",literal:"true false nothing"},i:"//|{|}|endif|gosub|variant|wend",c:[e.inherit(e.QSM,{c:[{b:'""'}]}),e.C("'","$",{rB:!0,c:[{cN:"doctag",b:"'''|",c:[e.PWM]},{cN:"doctag",b:"",c:[e.PWM]}]}),e.CNM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elseif end region externalsource"}}]}});hljs.registerLanguage("cs",function(e){var i={keyword:"abstract as base bool break byte case catch char checked const continue decimal default delegate do double enum event explicit extern finally fixed float for foreach goto if implicit in int interface internal is lock long nameof object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this try typeof uint ulong unchecked unsafe ushort using virtual void volatile while add alias ascending async await by descending dynamic equals from get global group into join let on orderby partial remove select set value var where yield",literal:"null false true"},t={cN:"string",b:'@"',e:'"',c:[{b:'""'}]},r=e.inherit(t,{i:/\n/}),a={cN:"subst",b:"{",e:"}",k:i},c=e.inherit(a,{i:/\n/}),n={cN:"string",b:/\$"/,e:'"',i:/\n/,c:[{b:"{{"},{b:"}}"},e.BE,c]},s={cN:"string",b:/\$@"/,e:'"',c:[{b:"{{"},{b:"}}"},{b:'""'},a]},o=e.inherit(s,{i:/\n/,c:[{b:"{{"},{b:"}}"},{b:'""'},c]});a.c=[s,n,t,e.ASM,e.QSM,e.CNM,e.CBCM],c.c=[o,n,r,e.ASM,e.QSM,e.CNM,e.inherit(e.CBCM,{i:/\n/})];var l={v:[s,n,t,e.ASM,e.QSM]},b=e.IR+"(<"+e.IR+"(\\s*,\\s*"+e.IR+")*>)?(\\[\\])?";return{aliases:["csharp"],k:i,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"doctag",v:[{b:"///",r:0},{b:""},{b:""}]}]}),e.CLCM,e.CBCM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum"}},l,e.CNM,{bK:"class interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"namespace",e:/[{;=]/,i:/[^\s:]/,c:[e.inherit(e.TM,{b:"[a-zA-Z](\\.?\\w)*"}),e.CLCM,e.CBCM]},{cN:"meta",b:"^\\s*\\[",eB:!0,e:"\\]",eE:!0,c:[{cN:"meta-string",b:/"/,e:/"/}]},{bK:"new return throw await else",r:0},{cN:"function",b:"("+b+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:i,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:i,r:0,c:[l,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}});hljs.registerLanguage("go",function(e){var t={keyword:"break default func interface select case map struct chan else goto package switch const fallthrough if range type continue for import return var go defer bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 uint16 uint32 uint64 int uint uintptr rune",literal:"true false iota nil",built_in:"append cap close complex copy imag len make new panic print println real recover delete"};return{aliases:["golang"],k:t,i:"{}*#]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke comment",e:/;/,eW:!0,l:/[\w\.]+/,k:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}});hljs.registerLanguage("vbscript",function(e){return{aliases:["vbs"],cI:!0,k:{keyword:"call class const dim do loop erase execute executeglobal exit for each next function if then else on error option explicit new private property let get public randomize redim rem select case set stop sub while wend with end to elseif is or xor and not class_initialize class_terminate default preserve in me byval byref step resume goto",built_in:"lcase month vartype instrrev ubound setlocale getobject rgb getref string weekdayname rnd dateadd monthname now day minute isarray cbool round formatcurrency conversions csng timevalue second year space abs clng timeserial fixs len asc isempty maths dateserial atn timer isobject filter weekday datevalue ccur isdate instr datediff formatdatetime replace isnull right sgn array snumeric log cdbl hex chr lbound msgbox ucase getlocale cos cdate cbyte rtrim join hour oct typename trim strcomp int createobject loadpicture tan formatnumber mid scriptenginebuildversion scriptengine split scriptengineminorversion cint sin datepart ltrim sqr scriptenginemajorversion time derived eval date formatpercent exp inputbox left ascw chrw regexp server response request cstr err",literal:"true false null nothing empty"},i:"//",c:[e.inherit(e.QSM,{c:[{b:'""'}]}),e.C(/'/,/$/,{r:0}),e.CNM]}});hljs.registerLanguage("vbscript-html",function(r){return{sL:"xml",c:[{b:"<%",e:"%>",sL:"vbscript"}]}});hljs.registerLanguage("fsharp",function(e){var t={b:"<",e:">",c:[e.inherit(e.TM,{b:/'[a-zA-Z0-9_]+/})]};return{aliases:["fs"],k:"abstract and as assert base begin class default delegate do done downcast downto elif else end exception extern false finally for fun function global if in inherit inline interface internal lazy let match member module mutable namespace new null of open or override private public rec return sig static struct then to true try type upcast use val void when while with yield",i:/\/\*/,c:[{cN:"keyword",b:/\b(yield|return|let|do)!/},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},{cN:"string",b:'"""',e:'"""'},e.C("\\(\\*","\\*\\)"),{cN:"class",bK:"type",e:"\\(|=|$",eE:!0,c:[e.UTM,t]},{cN:"meta",b:"\\[<",e:">\\]",r:10},{cN:"symbol",b:"\\B('[A-Za-z])\\b",c:[e.BE]},e.CLCM,e.inherit(e.QSM,{i:null}),e.CNM]}});hljs.registerLanguage("less",function(e){var r="[\\w-]+",t="("+r+"|@{"+r+"})",a=[],c=[],s=function(e){return{cN:"string",b:"~?"+e+".*?"+e}},b=function(e,r,t){return{cN:e,b:r,r:t}},n={b:"\\(",e:"\\)",c:c,r:0};c.push(e.CLCM,e.CBCM,s("'"),s('"'),e.CSSNM,{b:"(url|data-uri)\\(",starts:{cN:"string",e:"[\\)\\n]",eE:!0}},b("number","#[0-9A-Fa-f]+\\b"),n,b("variable","@@?"+r,10),b("variable","@{"+r+"}"),b("built_in","~?`[^`]*?`"),{cN:"attribute",b:r+"\\s*:",e:":",rB:!0,eE:!0},{cN:"meta",b:"!important"});var i=c.concat({b:"{",e:"}",c:a}),o={bK:"when",eW:!0,c:[{bK:"and not"}].concat(c)},u={b:t+"\\s*:",rB:!0,e:"[;}]",r:0,c:[{cN:"attribute",b:t,e:":",eE:!0,starts:{eW:!0,i:"[<=$]",r:0,c:c}}]},l={cN:"keyword",b:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{e:"[;{}]",rE:!0,c:c,r:0}},C={cN:"variable",v:[{b:"@"+r+"\\s*:",r:15},{b:"@"+r}],starts:{e:"[;}]",rE:!0,c:i}},p={v:[{b:"[\\.#:&\\[>]",e:"[;{}]"},{b:t,e:"{"}],rB:!0,rE:!0,i:"[<='$\"]",r:0,c:[e.CLCM,e.CBCM,o,b("keyword","all\\b"),b("variable","@{"+r+"}"),b("selector-tag",t+"%?",0),b("selector-id","#"+t),b("selector-class","\\."+t,0),b("selector-tag","&",0),{cN:"selector-attr",b:"\\[",e:"\\]"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"\\(",e:"\\)",c:i},{b:"!important"}]};return a.push(e.CLCM,e.CBCM,l,C,u,p),{cI:!0,i:"[=>'/<($\"]",c:a}});hljs.registerLanguage("dos",function(e){var r=e.C(/^\s*@?rem\b/,/$/,{r:10}),t={cN:"symbol",b:"^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)",r:0};return{aliases:["bat","cmd"],cI:!0,i:/\/\*/,k:{keyword:"if else goto for in do call exit not exist errorlevel defined equ neq lss leq gtr geq",built_in:"prn nul lpt3 lpt2 lpt1 con com4 com3 com2 com1 aux shift cd dir echo setlocal endlocal set pause copy append assoc at attrib break cacls cd chcp chdir chkdsk chkntfs cls cmd color comp compact convert date dir diskcomp diskcopy doskey erase fs find findstr format ftype graftabl help keyb label md mkdir mode more move path pause print popd pushd promt rd recover rem rename replace restore rmdir shiftsort start subst time title tree type ver verify vol ping net ipconfig taskkill xcopy ren del"},c:[{cN:"variable",b:/%%[^ ]|%[^ ]+?%|![^ ]+?!/},{cN:"function",b:t.b,e:"goto:eof",c:[e.inherit(e.TM,{b:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),r]},{cN:"number",b:"\\b\\d+",r:0},r]}});hljs.registerLanguage("python",function(e){var r={keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},b={cN:"meta",b:/^(>>>|\.\.\.) /},c={cN:"subst",b:/\{/,e:/\}/,k:r,i:/#/},a={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[b],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[b],r:10},{b:/(fr|rf|f)'''/,e:/'''/,c:[b,c]},{b:/(fr|rf|f)"""/,e:/"""/,c:[b,c]},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},{b:/(fr|rf|f)'/,e:/'/,c:[c]},{b:/(fr|rf|f)"/,e:/"/,c:[c]},e.ASM,e.QSM]},s={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},i={cN:"params",b:/\(/,e:/\)/,c:["self",b,s,a]};return c.c=[a,s,b],{aliases:["py","gyp"],k:r,i:/(<\/|->|\?)|=>/,c:[b,s,a,e.HCM,{v:[{cN:"function",bK:"def"},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,i,{b:/->/,eW:!0,k:"None"}]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}});hljs.registerLanguage("css",function(e){var c="[a-zA-Z-][a-zA-Z0-9_-]*",t={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:c,r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,t]}]}});hljs.registerLanguage("cpp",function(t){var e={cN:"keyword",b:"\\b[a-z\\d_]*_t\\b"},r={cN:"string",v:[{b:'(u8?|U)?L?"',e:'"',i:"\\n",c:[t.BE]},{b:'(u8?|U)?R"',e:'"',c:[t.BE]},{b:"'\\\\?.",e:"'",i:"."}]},s={cN:"number",v:[{b:"\\b(0b[01']+)"},{b:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{b:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],r:0},i={cN:"meta",b:/#\s*[a-z]+\b/,e:/$/,k:{"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef include"},c:[{b:/\\\n/,r:0},t.inherit(r,{cN:"meta-string"}),{cN:"meta-string",b:/<[^\n>]*>/,e:/$/,i:"\\n"},t.CLCM,t.CBCM]},a=t.IR+"\\s*\\(",c={keyword:"int float while private char catch import module export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong new throw return and or not",built_in:"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr",literal:"true false nullptr NULL"},n=[e,t.CLCM,t.CBCM,s,r];return{aliases:["c","cc","h","c++","h++","hpp"],k:c,i:"",k:c,c:["self",e]},{b:t.IR+"::",k:c},{v:[{b:/=/,e:/;/},{b:/\(/,e:/\)/},{bK:"new throw return else",e:/;/}],k:c,c:n.concat([{b:/\(/,e:/\)/,k:c,c:n.concat(["self"]),r:0}]),r:0},{cN:"function",b:"("+t.IR+"[\\*&\\s]+)+"+a,rB:!0,e:/[{;=]/,eE:!0,k:c,i:/[^\w\s\*&]/,c:[{b:a,rB:!0,c:[t.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:c,r:0,c:[t.CLCM,t.CBCM,r,s,e]},t.CLCM,t.CBCM,i]},{cN:"class",bK:"class struct",e:/[{;:]/,c:[{b://,c:["self"]},t.TM]}]),exports:{preprocessor:i,strings:r,k:c}}});hljs.registerLanguage("http",function(e){var t="HTTP/[0-9\\.]+";return{aliases:["https"],i:"\\S",c:[{b:"^"+t,e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{b:"^[A-Z]+ (.*?) "+t+"$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0},{b:t},{cN:"keyword",b:"[A-Z]+"}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{e:"$",r:0}},{b:"\\n\\n",starts:{sL:[],eW:!0}}]}});hljs.registerLanguage("json",function(e){var i={literal:"true false null"},n=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:n,k:i},t={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(r,{b:/:/})],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return n.splice(n.length,0,t,c),{c:n,k:i,i:"\\S"}}); \ No newline at end of file diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/agate.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/agate.css new file mode 100644 index 0000000000..8d64547c58 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/agate.css @@ -0,0 +1,108 @@ +/*! + * Agate by Taufik Nurrohman + * ---------------------------------------------------- + * + * #ade5fc + * #a2fca2 + * #c6b4f0 + * #d36363 + * #fcc28c + * #fc9b9b + * #ffa + * #fff + * #333 + * #62c8f3 + * #888 + * + */ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #333; + color: white; +} + +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-code, +.hljs-emphasis { + font-style: italic; +} + +.hljs-tag { + color: #62c8f3; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-selector-id, +.hljs-selector-class { + color: #ade5fc; +} + +.hljs-string, +.hljs-bullet { + color: #a2fca2; +} + +.hljs-type, +.hljs-title, +.hljs-section, +.hljs-attribute, +.hljs-quote, +.hljs-built_in, +.hljs-builtin-name { + color: #ffa; +} + +.hljs-number, +.hljs-symbol, +.hljs-bullet { + color: #d36363; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal { + color: #fcc28c; +} + +.hljs-comment, +.hljs-deletion, +.hljs-code { + color: #888; +} + +.hljs-regexp, +.hljs-link { + color: #c6b4f0; +} + +.hljs-meta { + color: #fc9b9b; +} + +.hljs-deletion { + background-color: #fc9b9b; + color: #333; +} + +.hljs-addition { + background-color: #a2fca2; + color: #333; +} + +.hljs a { + color: inherit; +} + +.hljs a:focus, +.hljs a:hover { + color: inherit; + text-decoration: underline; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/androidstudio.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/androidstudio.css new file mode 100644 index 0000000000..bc8e473b59 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/androidstudio.css @@ -0,0 +1,66 @@ +/* +Date: 24 Fev 2015 +Author: Pedro Oliveira +*/ + +.hljs { + color: #a9b7c6; + background: #282b2e; + display: block; + overflow-x: auto; + padding: 0.5em; +} + +.hljs-number, +.hljs-literal, +.hljs-symbol, +.hljs-bullet { + color: #6897BB; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-deletion { + color: #cc7832; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-link { + color: #629755; +} + +.hljs-comment, +.hljs-quote { + color: #808080; +} + +.hljs-meta { + color: #bbb529; +} + +.hljs-string, +.hljs-attribute, +.hljs-addition { + color: #6A8759; +} + +.hljs-section, +.hljs-title, +.hljs-type { + color: #ffc66d; +} + +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #e8bf6a; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/arduino-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/arduino-light.css new file mode 100644 index 0000000000..4b8b7fd3c9 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/arduino-light.css @@ -0,0 +1,88 @@ +/* + +Arduino® Light Theme - Stefania Mellai + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #FFFFFF; +} + +.hljs, +.hljs-subst { + color: #434f54; +} + +.hljs-keyword, +.hljs-attribute, +.hljs-selector-tag, +.hljs-doctag, +.hljs-name { + color: #00979D; +} + +.hljs-built_in, +.hljs-literal, +.hljs-bullet, +.hljs-code, +.hljs-addition { + color: #D35400; +} + +.hljs-regexp, +.hljs-symbol, +.hljs-variable, +.hljs-template-variable, +.hljs-link, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #00979D; +} + +.hljs-type, +.hljs-string, +.hljs-selector-id, +.hljs-selector-class, +.hljs-quote, +.hljs-template-tag, +.hljs-deletion { + color: #005C5F; +} + +.hljs-title, +.hljs-section { + color: #880000; + font-weight: bold; +} + +.hljs-comment { + color: rgba(149,165,166,.8); +} + +.hljs-meta-keyword { + color: #728E00; +} + +.hljs-meta { + color: #728E00; + color: #434f54; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-function { + color: #728E00; +} + +.hljs-number { + color: #8A7B52; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/arta.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/arta.css new file mode 100644 index 0000000000..75ef3a9e59 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/arta.css @@ -0,0 +1,73 @@ +/* +Date: 17.V.2011 +Author: pumbur +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #222; +} + +.hljs, +.hljs-subst { + color: #aaa; +} + +.hljs-section { + color: #fff; +} + +.hljs-comment, +.hljs-quote, +.hljs-meta { + color: #444; +} + +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-regexp { + color: #ffcc33; +} + +.hljs-number, +.hljs-addition { + color: #00cc66; +} + +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-template-variable, +.hljs-attribute, +.hljs-link { + color: #32aaee; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #6644aa; +} + +.hljs-title, +.hljs-variable, +.hljs-deletion, +.hljs-template-tag { + color: #bb1166; +} + +.hljs-section, +.hljs-doctag, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/ascetic.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/ascetic.css new file mode 100644 index 0000000000..48397e889d --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/ascetic.css @@ -0,0 +1,45 @@ +/* + +Original style from softwaremaniacs.org (c) Ivan Sagalaev + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: white; + color: black; +} + +.hljs-string, +.hljs-variable, +.hljs-template-variable, +.hljs-symbol, +.hljs-bullet, +.hljs-section, +.hljs-addition, +.hljs-attribute, +.hljs-link { + color: #888; +} + +.hljs-comment, +.hljs-quote, +.hljs-meta, +.hljs-deletion { + color: #ccc; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-section, +.hljs-name, +.hljs-type, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-cave-dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-cave-dark.css new file mode 100644 index 0000000000..65428f3b12 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-cave-dark.css @@ -0,0 +1,83 @@ +/* Base16 Atelier Cave Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/cave) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Cave Comment */ +.hljs-comment, +.hljs-quote { + color: #7e7887; +} + +/* Atelier-Cave Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-regexp, +.hljs-link, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #be4678; +} + +/* Atelier-Cave Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #aa573c; +} + +/* Atelier-Cave Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #2a9292; +} + +/* Atelier-Cave Blue */ +.hljs-title, +.hljs-section { + color: #576ddb; +} + +/* Atelier-Cave Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #955ae7; +} + +.hljs-deletion, +.hljs-addition { + color: #19171c; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #be4678; +} + +.hljs-addition { + background-color: #2a9292; +} + +.hljs { + display: block; + overflow-x: auto; + background: #19171c; + color: #8b8792; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-cave-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-cave-light.css new file mode 100644 index 0000000000..b419f9fd8f --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-cave-light.css @@ -0,0 +1,85 @@ +/* Base16 Atelier Cave Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/cave) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Cave Comment */ +.hljs-comment, +.hljs-quote { + color: #655f6d; +} + +/* Atelier-Cave Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #be4678; +} + +/* Atelier-Cave Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #aa573c; +} + +/* Atelier-Cave Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #2a9292; +} + +/* Atelier-Cave Blue */ +.hljs-title, +.hljs-section { + color: #576ddb; +} + +/* Atelier-Cave Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #955ae7; +} + +.hljs-deletion, +.hljs-addition { + color: #19171c; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #be4678; +} + +.hljs-addition { + background-color: #2a9292; +} + +.hljs { + display: block; + overflow-x: auto; + background: #efecf4; + color: #585260; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-dune-dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-dune-dark.css new file mode 100644 index 0000000000..1684f5225a --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-dune-dark.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Dune Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Dune Comment */ +.hljs-comment, +.hljs-quote { + color: #999580; +} + +/* Atelier-Dune Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #d73737; +} + +/* Atelier-Dune Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #b65611; +} + +/* Atelier-Dune Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #60ac39; +} + +/* Atelier-Dune Blue */ +.hljs-title, +.hljs-section { + color: #6684e1; +} + +/* Atelier-Dune Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #b854d4; +} + +.hljs { + display: block; + overflow-x: auto; + background: #20201d; + color: #a6a28c; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-dune-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-dune-light.css new file mode 100644 index 0000000000..547719de82 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-dune-light.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Dune Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Dune Comment */ +.hljs-comment, +.hljs-quote { + color: #7d7a68; +} + +/* Atelier-Dune Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #d73737; +} + +/* Atelier-Dune Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #b65611; +} + +/* Atelier-Dune Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #60ac39; +} + +/* Atelier-Dune Blue */ +.hljs-title, +.hljs-section { + color: #6684e1; +} + +/* Atelier-Dune Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #b854d4; +} + +.hljs { + display: block; + overflow-x: auto; + background: #fefbec; + color: #6e6b5e; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-estuary-dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-estuary-dark.css new file mode 100644 index 0000000000..a5e507187e --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-estuary-dark.css @@ -0,0 +1,84 @@ +/* Base16 Atelier Estuary Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/estuary) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Estuary Comment */ +.hljs-comment, +.hljs-quote { + color: #878573; +} + +/* Atelier-Estuary Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #ba6236; +} + +/* Atelier-Estuary Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #ae7313; +} + +/* Atelier-Estuary Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #7d9726; +} + +/* Atelier-Estuary Blue */ +.hljs-title, +.hljs-section { + color: #36a166; +} + +/* Atelier-Estuary Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #5f9182; +} + +.hljs-deletion, +.hljs-addition { + color: #22221b; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #ba6236; +} + +.hljs-addition { + background-color: #7d9726; +} + +.hljs { + display: block; + overflow-x: auto; + background: #22221b; + color: #929181; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-estuary-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-estuary-light.css new file mode 100644 index 0000000000..1daee5d985 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-estuary-light.css @@ -0,0 +1,84 @@ +/* Base16 Atelier Estuary Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/estuary) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Estuary Comment */ +.hljs-comment, +.hljs-quote { + color: #6c6b5a; +} + +/* Atelier-Estuary Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #ba6236; +} + +/* Atelier-Estuary Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #ae7313; +} + +/* Atelier-Estuary Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #7d9726; +} + +/* Atelier-Estuary Blue */ +.hljs-title, +.hljs-section { + color: #36a166; +} + +/* Atelier-Estuary Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #5f9182; +} + +.hljs-deletion, +.hljs-addition { + color: #22221b; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #ba6236; +} + +.hljs-addition { + background-color: #7d9726; +} + +.hljs { + display: block; + overflow-x: auto; + background: #f4f3ec; + color: #5f5e4e; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-forest-dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-forest-dark.css new file mode 100644 index 0000000000..0ef4fae317 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-forest-dark.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Forest Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Forest Comment */ +.hljs-comment, +.hljs-quote { + color: #9c9491; +} + +/* Atelier-Forest Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #f22c40; +} + +/* Atelier-Forest Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #df5320; +} + +/* Atelier-Forest Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #7b9726; +} + +/* Atelier-Forest Blue */ +.hljs-title, +.hljs-section { + color: #407ee7; +} + +/* Atelier-Forest Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #6666ea; +} + +.hljs { + display: block; + overflow-x: auto; + background: #1b1918; + color: #a8a19f; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-forest-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-forest-light.css new file mode 100644 index 0000000000..bbedde18a0 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-forest-light.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Forest Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Forest Comment */ +.hljs-comment, +.hljs-quote { + color: #766e6b; +} + +/* Atelier-Forest Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #f22c40; +} + +/* Atelier-Forest Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #df5320; +} + +/* Atelier-Forest Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #7b9726; +} + +/* Atelier-Forest Blue */ +.hljs-title, +.hljs-section { + color: #407ee7; +} + +/* Atelier-Forest Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #6666ea; +} + +.hljs { + display: block; + overflow-x: auto; + background: #f1efee; + color: #68615e; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-heath-dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-heath-dark.css new file mode 100644 index 0000000000..fe01ff721b --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-heath-dark.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Heath Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Heath Comment */ +.hljs-comment, +.hljs-quote { + color: #9e8f9e; +} + +/* Atelier-Heath Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #ca402b; +} + +/* Atelier-Heath Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #a65926; +} + +/* Atelier-Heath Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #918b3b; +} + +/* Atelier-Heath Blue */ +.hljs-title, +.hljs-section { + color: #516aec; +} + +/* Atelier-Heath Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #7b59c0; +} + +.hljs { + display: block; + overflow-x: auto; + background: #1b181b; + color: #ab9bab; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-heath-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-heath-light.css new file mode 100644 index 0000000000..ee43786d12 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-heath-light.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Heath Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Heath Comment */ +.hljs-comment, +.hljs-quote { + color: #776977; +} + +/* Atelier-Heath Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #ca402b; +} + +/* Atelier-Heath Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #a65926; +} + +/* Atelier-Heath Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #918b3b; +} + +/* Atelier-Heath Blue */ +.hljs-title, +.hljs-section { + color: #516aec; +} + +/* Atelier-Heath Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #7b59c0; +} + +.hljs { + display: block; + overflow-x: auto; + background: #f7f3f7; + color: #695d69; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-lakeside-dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-lakeside-dark.css new file mode 100644 index 0000000000..a937d3bf5f --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-lakeside-dark.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Lakeside Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Lakeside Comment */ +.hljs-comment, +.hljs-quote { + color: #7195a8; +} + +/* Atelier-Lakeside Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #d22d72; +} + +/* Atelier-Lakeside Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #935c25; +} + +/* Atelier-Lakeside Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #568c3b; +} + +/* Atelier-Lakeside Blue */ +.hljs-title, +.hljs-section { + color: #257fad; +} + +/* Atelier-Lakeside Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #6b6bb8; +} + +.hljs { + display: block; + overflow-x: auto; + background: #161b1d; + color: #7ea2b4; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-lakeside-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-lakeside-light.css new file mode 100644 index 0000000000..6c7e8f9ef2 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-lakeside-light.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Lakeside Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Lakeside Comment */ +.hljs-comment, +.hljs-quote { + color: #5a7b8c; +} + +/* Atelier-Lakeside Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #d22d72; +} + +/* Atelier-Lakeside Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #935c25; +} + +/* Atelier-Lakeside Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #568c3b; +} + +/* Atelier-Lakeside Blue */ +.hljs-title, +.hljs-section { + color: #257fad; +} + +/* Atelier-Lakeside Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #6b6bb8; +} + +.hljs { + display: block; + overflow-x: auto; + background: #ebf8ff; + color: #516d7b; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-plateau-dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-plateau-dark.css new file mode 100644 index 0000000000..3bb052693c --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-plateau-dark.css @@ -0,0 +1,84 @@ +/* Base16 Atelier Plateau Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/plateau) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Plateau Comment */ +.hljs-comment, +.hljs-quote { + color: #7e7777; +} + +/* Atelier-Plateau Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #ca4949; +} + +/* Atelier-Plateau Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #b45a3c; +} + +/* Atelier-Plateau Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #4b8b8b; +} + +/* Atelier-Plateau Blue */ +.hljs-title, +.hljs-section { + color: #7272ca; +} + +/* Atelier-Plateau Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #8464c4; +} + +.hljs-deletion, +.hljs-addition { + color: #1b1818; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #ca4949; +} + +.hljs-addition { + background-color: #4b8b8b; +} + +.hljs { + display: block; + overflow-x: auto; + background: #1b1818; + color: #8a8585; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-plateau-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-plateau-light.css new file mode 100644 index 0000000000..5f0222bec1 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-plateau-light.css @@ -0,0 +1,84 @@ +/* Base16 Atelier Plateau Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/plateau) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Plateau Comment */ +.hljs-comment, +.hljs-quote { + color: #655d5d; +} + +/* Atelier-Plateau Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #ca4949; +} + +/* Atelier-Plateau Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #b45a3c; +} + +/* Atelier-Plateau Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #4b8b8b; +} + +/* Atelier-Plateau Blue */ +.hljs-title, +.hljs-section { + color: #7272ca; +} + +/* Atelier-Plateau Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #8464c4; +} + +.hljs-deletion, +.hljs-addition { + color: #1b1818; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #ca4949; +} + +.hljs-addition { + background-color: #4b8b8b; +} + +.hljs { + display: block; + overflow-x: auto; + background: #f4ecec; + color: #585050; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-savanna-dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-savanna-dark.css new file mode 100644 index 0000000000..38f831431c --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-savanna-dark.css @@ -0,0 +1,84 @@ +/* Base16 Atelier Savanna Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/savanna) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Savanna Comment */ +.hljs-comment, +.hljs-quote { + color: #78877d; +} + +/* Atelier-Savanna Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #b16139; +} + +/* Atelier-Savanna Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #9f713c; +} + +/* Atelier-Savanna Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #489963; +} + +/* Atelier-Savanna Blue */ +.hljs-title, +.hljs-section { + color: #478c90; +} + +/* Atelier-Savanna Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #55859b; +} + +.hljs-deletion, +.hljs-addition { + color: #171c19; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #b16139; +} + +.hljs-addition { + background-color: #489963; +} + +.hljs { + display: block; + overflow-x: auto; + background: #171c19; + color: #87928a; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-savanna-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-savanna-light.css new file mode 100644 index 0000000000..1ccd7c6858 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-savanna-light.css @@ -0,0 +1,84 @@ +/* Base16 Atelier Savanna Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/savanna) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Savanna Comment */ +.hljs-comment, +.hljs-quote { + color: #5f6d64; +} + +/* Atelier-Savanna Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #b16139; +} + +/* Atelier-Savanna Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #9f713c; +} + +/* Atelier-Savanna Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #489963; +} + +/* Atelier-Savanna Blue */ +.hljs-title, +.hljs-section { + color: #478c90; +} + +/* Atelier-Savanna Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #55859b; +} + +.hljs-deletion, +.hljs-addition { + color: #171c19; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #b16139; +} + +.hljs-addition { + background-color: #489963; +} + +.hljs { + display: block; + overflow-x: auto; + background: #ecf4ee; + color: #526057; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-seaside-dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-seaside-dark.css new file mode 100644 index 0000000000..df29949c69 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-seaside-dark.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Seaside Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Seaside Comment */ +.hljs-comment, +.hljs-quote { + color: #809980; +} + +/* Atelier-Seaside Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #e6193c; +} + +/* Atelier-Seaside Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #87711d; +} + +/* Atelier-Seaside Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #29a329; +} + +/* Atelier-Seaside Blue */ +.hljs-title, +.hljs-section { + color: #3d62f5; +} + +/* Atelier-Seaside Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #ad2bee; +} + +.hljs { + display: block; + overflow-x: auto; + background: #131513; + color: #8ca68c; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-seaside-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-seaside-light.css new file mode 100644 index 0000000000..9d960f29f3 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-seaside-light.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Seaside Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Seaside Comment */ +.hljs-comment, +.hljs-quote { + color: #687d68; +} + +/* Atelier-Seaside Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #e6193c; +} + +/* Atelier-Seaside Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #87711d; +} + +/* Atelier-Seaside Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #29a329; +} + +/* Atelier-Seaside Blue */ +.hljs-title, +.hljs-section { + color: #3d62f5; +} + +/* Atelier-Seaside Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #ad2bee; +} + +.hljs { + display: block; + overflow-x: auto; + background: #f4fbf4; + color: #5e6e5e; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-sulphurpool-dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-sulphurpool-dark.css new file mode 100644 index 0000000000..c2ab7938d8 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-sulphurpool-dark.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Sulphurpool Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/sulphurpool) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Sulphurpool Comment */ +.hljs-comment, +.hljs-quote { + color: #898ea4; +} + +/* Atelier-Sulphurpool Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #c94922; +} + +/* Atelier-Sulphurpool Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #c76b29; +} + +/* Atelier-Sulphurpool Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #ac9739; +} + +/* Atelier-Sulphurpool Blue */ +.hljs-title, +.hljs-section { + color: #3d8fd1; +} + +/* Atelier-Sulphurpool Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #6679cc; +} + +.hljs { + display: block; + overflow-x: auto; + background: #202746; + color: #979db4; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-sulphurpool-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-sulphurpool-light.css new file mode 100644 index 0000000000..96c47d0860 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atelier-sulphurpool-light.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Sulphurpool Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/sulphurpool) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Sulphurpool Comment */ +.hljs-comment, +.hljs-quote { + color: #6b7394; +} + +/* Atelier-Sulphurpool Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #c94922; +} + +/* Atelier-Sulphurpool Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #c76b29; +} + +/* Atelier-Sulphurpool Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #ac9739; +} + +/* Atelier-Sulphurpool Blue */ +.hljs-title, +.hljs-section { + color: #3d8fd1; +} + +/* Atelier-Sulphurpool Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #6679cc; +} + +.hljs { + display: block; + overflow-x: auto; + background: #f5f7ff; + color: #5e6687; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atom-one-dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atom-one-dark.css new file mode 100644 index 0000000000..1616aafe31 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atom-one-dark.css @@ -0,0 +1,96 @@ +/* + +Atom One Dark by Daniel Gamage +Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax + +base: #282c34 +mono-1: #abb2bf +mono-2: #818896 +mono-3: #5c6370 +hue-1: #56b6c2 +hue-2: #61aeee +hue-3: #c678dd +hue-4: #98c379 +hue-5: #e06c75 +hue-5-2: #be5046 +hue-6: #d19a66 +hue-6-2: #e6c07b + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #abb2bf; + background: #282c34; +} + +.hljs-comment, +.hljs-quote { + color: #5c6370; + font-style: italic; +} + +.hljs-doctag, +.hljs-keyword, +.hljs-formula { + color: #c678dd; +} + +.hljs-section, +.hljs-name, +.hljs-selector-tag, +.hljs-deletion, +.hljs-subst { + color: #e06c75; +} + +.hljs-literal { + color: #56b6c2; +} + +.hljs-string, +.hljs-regexp, +.hljs-addition, +.hljs-attribute, +.hljs-meta-string { + color: #98c379; +} + +.hljs-built_in, +.hljs-class .hljs-title { + color: #e6c07b; +} + +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-type, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-number { + color: #d19a66; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link, +.hljs-meta, +.hljs-selector-id, +.hljs-title { + color: #61aeee; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-link { + text-decoration: underline; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atom-one-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atom-one-light.css new file mode 100644 index 0000000000..d5bd1d2a9a --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/atom-one-light.css @@ -0,0 +1,96 @@ +/* + +Atom One Light by Daniel Gamage +Original One Light Syntax theme from https://github.com/atom/one-light-syntax + +base: #fafafa +mono-1: #383a42 +mono-2: #686b77 +mono-3: #a0a1a7 +hue-1: #0184bb +hue-2: #4078f2 +hue-3: #a626a4 +hue-4: #50a14f +hue-5: #e45649 +hue-5-2: #c91243 +hue-6: #986801 +hue-6-2: #c18401 + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #383a42; + background: #fafafa; +} + +.hljs-comment, +.hljs-quote { + color: #a0a1a7; + font-style: italic; +} + +.hljs-doctag, +.hljs-keyword, +.hljs-formula { + color: #a626a4; +} + +.hljs-section, +.hljs-name, +.hljs-selector-tag, +.hljs-deletion, +.hljs-subst { + color: #e45649; +} + +.hljs-literal { + color: #0184bb; +} + +.hljs-string, +.hljs-regexp, +.hljs-addition, +.hljs-attribute, +.hljs-meta-string { + color: #50a14f; +} + +.hljs-built_in, +.hljs-class .hljs-title { + color: #c18401; +} + +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-type, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-number { + color: #986801; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link, +.hljs-meta, +.hljs-selector-id, +.hljs-title { + color: #4078f2; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-link { + text-decoration: underline; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/brown-paper.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/brown-paper.css new file mode 100644 index 0000000000..f0197b924c --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/brown-paper.css @@ -0,0 +1,64 @@ +/* + +Brown Paper style from goldblog.com.ua (c) Zaripov Yura + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background:#b7a68e url(./brown-papersq.png); +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal { + color:#005599; + font-weight:bold; +} + +.hljs, +.hljs-subst { + color: #363c69; +} + +.hljs-string, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-attribute, +.hljs-symbol, +.hljs-bullet, +.hljs-built_in, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable, +.hljs-link, +.hljs-name { + color: #2c009f; +} + +.hljs-comment, +.hljs-quote, +.hljs-meta, +.hljs-deletion { + color: #802022; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-doctag, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/brown-papersq.png b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/brown-papersq.png new file mode 100644 index 0000000000000000000000000000000000000000..3813903dbf9fa7b1fb5bd11d9534c06667d9056f GIT binary patch literal 18198 zcmZsCRajhYlWil7yGw9LaCaw2kl^kP!M%at?m>cka0u>ctf6s&e8CzTLSrGMaSIUS zWM7q;>fa~s$OpT> zFLY-GO$7j;Wl{{7eE9cF?XPU&ukYpLA870A2vBhFvU6lq^RRVx)N{0T2=eQ4J41(5=2G+8;)w1ZEPMkbF2bGnazV|OLZz2Hb@=WyXBX0)f+0o;fWze0N{t<*y ztIiNnZC{LRA&k!$ZY8RSSkRr34SfzyO1FQ1#+`5DKBGKIaW*#IpS|)H)0b)RO)vVT zdmZs``V5~Rd=7^niGNRi-KohFdl7;cLNt=6H%jET$<@@a?HPC}DI+UeV-R$j(|Cgb zovyEp&h`&JS~h*u+dsTgScW2zDVr4f~DH;Zx@cQhlKiyzUik!{j?26_bcGl3n zz;xi(8ENgs!;6LMT9?9^)|SgIm+Xu<9pAn@Jwvr@j|kU$Ps<;yJK|Ptilz{)cF~50 z>3}X}-GE2L$gd5vToUcA;ufTe+vCmq6y;EHLIF1Y)!*mMIk7Ufz`-6@{%j+0t}5by-kjAimHgt*AfoWQ3<}2%HH1G)X=gxwsGTnqo!jS zPp^mHU)Wdo9i$J93f_cGL~o081HVh2MIfFb&r#24&zMhy4-B`@-M4wqKeV5e3rOCk zzfxnXb=ed%7QxZsGFZ!Bk=ojIqXM0lz`=t&N`(ieb`uT$vaWG--x!ps=kokELG7^v z+{LRR;H>H{+#Sy9)~}T-X{s*WDIF9ko?!YOUrBL6c1UTt%|c-C%-R`h{*D&-?xTv6%U;Fy)q@zD7n;Mm&VTYo!f>`4|^@IrUrWqi<2` zIK=%8Y>k7_cJFc62Fm1dsu5V%^D!kOF(oA;3duw z%pO09{DvbtIv+U1{6MQ8Wq|e~4(8RFaZSiu$ z|CJ~BTvRLdM64V`xYr`XpzSoka%-H{0)Ro-jT6+} zT18|CY&T<`K}73~WMQMkzj<-{e`EjOV2Ch(n321C+#16;>MjIhblly|M?Br0UERMA z8yIvk9sVuv0~h)1=S{wY{&V6fDi@0c8|@S!>h`gR_^u~(f!y=uu=3o8U2>$VV-mwV zeJKl8K*mz%0O$3!XmmqEd#rW!>oY?U<|?CBsX=UMCSrinA}B9GA5MTUzn%ILQD=}Q z^-qc}to5D!{UYEBFfSF{7{}5#I2`7!9Xcs|{e!rTVYvNetFc@43N$#e!DM_Y#5_4V z3P*)qJyw97IJGZYj53iEQKK~Zk6QE|wnDAQ6e%ci7WM9yX{3Voy>2v7-{dW*|+Zvy7%^(o^DMc&%_Tp}4@Jo%0Bs7ObY$K2QS=1v19slY*WwV!8B05I;*7gc| zC}iWT!ocL=zoXCa-*EVkQZPGoFVou4>|(ng{&T`5ns(d;`0IWRE4$3aCE zX={pif)xfKL2J&CwL-rbsVhFX~Ast|24AzGCb$6bP zzjP96&p17?0`zA}Cr(1{- zBWmAc^Tih%c@PSpJD39Rtvbpc27|&`W}18q&trP3z4xp%4^t5T!T})zWON*!hQ+0C zGnKXI-(t5+$xcN_*!vy^Ebcn(`}3GQ=EjrR)jEu#)a!Qo+uU^L6Sf!vtQo@-)YCH_ zIkq!}#RQ?#H9Na)c>fA?i%F=AwN>+%6IHG_6~07@;tNMw)pj-py?fm5OAkUXC)Brp z)eG?cTAV-ODy=aRrlcS^!0S!95GOO@_zy6Yr~oZODHiWB(rYDHVW+oP+iSHanvW_2 zD+33#kuvw;P&BQf8OM-`63t1%h)cdnm8}>fIrS=425~>gpk!*nOPF^FRJ!}0{NO(e z1ANE&sU_mPMS;Pw9^8F*v5!k1Dr?=^%?eWij0f~to7y`V{K(<#9fgxsh1qZ}irc;t zApc;fE}TBG^?-(ZYfC3hk)rzA9||a50&`5$fOMODInB^CQQz-%|FVW(Me6cd&RQ!Em*`8(cOiTV*}I0^ zkh9#bz+b`^Achh+t!T{E%m*7Spr8X*#NFvrNeQKR9N#NYImXo$orFW}S#|kp!g) zC|mslRtj z{<(wk5heSmNTLQPjVu+tu`Ax0<Jp<3;sv=x5%C^te-lbQRUIA>ktvMAj}|$FYU$Qp}=T~;pv%9btR=dxklUy zkR9E*9e)3CPHhghYGI4o&yB<6Ek^@&s6_$^hHm%y;$mG#6s2Gj@yUh|7NNvbZ*-CiW>(`$PB*?kxl)}lSZKB^Wx?u%oy%PiU;Ucb|V z|JbtHI`e>wDu43V9mbmTz-O*hsj=x3p@_52uHWdv$KHWXIJ?hAN_O+SE^)}7#rG|6 z_BKM`Ghwpm2fNaI-XM&&0MIfLw+nk~2$Q9!(m1H({sIm*PjV$tD(vHzF8J^I z$5d)V3#P=#{X0~lkvdz*hO?2|P39$67m%BB>cJ;P&i?e>f6oD0A_x(fXnlhN8_iy~ z=8_i6_?scR{Q@F{<_+s`6F0?)4q>Y!TZURG@z1Xg(XF|Uq<7M}+x3!5CKzKPU%EBw zWsc%dMB{e=rbNFynyQz;$Wk>xdNDkRB!r}hPlheoBDRi4NdE0U68C8T=FwmB)E|du zu(3Ry^ER}qt8o=s^t;)ka7?Rw9BkK-AbMm!5YyN{n8j%4(FS=#^NXNFzOKvDh-fh_ ztrMuN#+;}%O*fdC_O-zikI?cL4FkQFbMJ&%;LsLdp2pU1z81byeDrcnfVfSPjd&Tx z0uTNCRa&zYgwCK{AP>=r8Sx{G=0I#zQ4SAF*CLY5@Ge_3>$_ebR&z8QuoP^G_nMbA zR!J5=NfW+bA;6g4yh|56J$}zRiUEt*T!NqU4MM$Ik(YO5ElC z3I>TTR5(&RS-e$~mJ610i3Tb|O!%oihx2Dou=SDi zY8QGbi&iMst0x9N)(Qw|m<=v9=H$h=d9q7_RC$8&xiTCpO(nAT)09jNd*kDz)xA=d zA>mDJMEO}wm=z8%##p8Epux^Z?6*hT+bBf^Yw~9wh1mOBI2*B_&;n6YqN$_sLi+`r zN+}oUEH%!)UEZO0kGwoV{fV0125Liy{XQRjOG;ll15xL$5w(ynu*BE#Y!uUbJlqhC z*)p9Akd=!p3VXT;Mo_Zvej_{xJkq)x&0<&B)@Utjud|co5aPb~dM)3OKXKmRzZ}RD zt~hR#D>70m`e$6d9RY-q2@W6QANld%IvZ*VmwpbdVCzWDJ`&UO%hC*(c9AJ; z8qe|b;=knC|ZRghL9-j+JpIpBjS zLIz{G#rkZ%K&UOs1pgA;bi1JjfXryT;9AV*AdF1(P;A$V^MMS0X10gTzoNjJBTB;U z#kJ5|QkG?|zHY}$^ddtj_$wAkIcd;Wk|&B6^`fnOL3uIPj@Z+b!gftAC_YE@sh~EY z@awBver>U-j(pBMf%*W;OI?#3J3yRO&^PqFHW`#yr|%#0rDM+^ZV zw!IXpiDk0Qo5iL_mNZlA`+m>mgyn-Z9( z1VK4OJry2Iq?o90-NhDNVAP3Niev{MJh~PQ7M5U9?Ob1#H}q=Dgn%~Ng=3b;7jX>n zADv=?=pgaOIN2G2JCr_(7k0YF#OlE0c}by4_|pb-iJ-CYzLbWwHs2A)ZY;uuYwbQMUa1ed5)1G+DXr$;MC*sQ-N@4$xD327+bTrT^ z?kmr?X}=Lu2xf7X5|gkw#k>FEC139#QtL*Y>C)kvvqB=d;fVQ8{+;RhP-)is9rX&jj-Ik zT00%|O4wv`6`(M(&W*hs2A z?qIa9QPvO>*ssTM+$((GcA1>?(C1jm10t6@Dy(k%HtIN+5d!Bk;~J%32ZhcKu$-i2gOM1Ek)Av0js<&PBErK4 zp0BqauJ^Yy7bnHdyGOO!FbWP*qG)O@I>y%wAIOX9eD)7R>ow6xlYRy-h|ZmQaLshv zm7r7H)>I5~>_i>NDSv6k)mCwZu$9K6)JGn#ni#>O5}3aMrYt7e67}_&zNlt_@b&$n z)VO|sK6qnt57(FA0!{d&$}h!DdNgOgYMn=8${CJ>S2YIAe zYh9atd77_K6soYC+WALnJL7SxqnE#(+1G`m^0I56gta@e+L0z>IRG+?>DS@Oe-NlQ z-mQ)F{=7b($L)X@jB5Ot*D*>ceMR8793ItK-tTO`iAnNm-xzYn0#;&=gXJYz8KmnUBrL#cb@ELwnkp?O zZZ{8tSRklRk}8Ts29G>v-&z?qob#qYSe!ek zt^r`X2W(J?(qxhOf%h#^?8D`^&MPbuUE9s z$80u<1iU&&+mQB<4bZeyBaOB}$!d@`^f4+iXS3;h>rXP~*FRrr)Wki^(q)&EwAMt?71xOWwtXa8UsY(_;C*7d*d9Z z-#(@Mu>`+6lrEC|=E^q^u&A=e+P9|#`hdP0Rg9`gUbNqm@!-Gg-V6vL;!*U<4ZtIa zv@cWy_^m4cV=F@sv3lCwx|?r%lb?NGQobaW&#Mi<9dngpq({-uy?xwAR&#MBUtybddE z1Ka>|_TRpK@#mBE#M;ka;RDR*2pXmP#YHG|5qh#YgXDUPD*cs3)>>Co@wnbArjo;_^QGnuQGdUSqu6AMPxBHbW99c9gHFZ*u&-M5cS}n@d z@wWUbV?X7y#NTCaqV_t*)w+Vzpte?L^08$=xiju5lCZ4~#~@34qa{rJM!{y~Tqe5H z-`N}U;ZKj9jnYas%EXCD=*$|XC$h{m@?;&T(uT--QOR_H^PcjyAP~pc&dS&v#J%KN zK|)APC-pnC;EKdibKx8O+Pqef? zY3J^)uf~;VDge4m$gh`Aj{?OYnES!Tftm1kjZwLB-5soBf8q9RaPk~e{SqHq+Gh(R z<}KbtcWaoIC!do+k`h}5s~QzJ&#Ro?TzU_eO^xAgvNoX&oKS7|-8Lm;%2@BRKwb9H4rRICqXPIQLdOMGtG>0(Kh}5xDzW z<`R5ub7|^ov6hX(i^R_d6ZdLQ5t}vu@?2|ueBl^W!CoR=LZ1Urel(cC{`jK##xJ5Z zW6m&PFV^e{7~mrz4!xy@n!O%C(vIRG0g>FrE1t+=n3;z9D!vWHCUjqMi*QAc4!hId zk9MAo2%jf}g*lzYPM7_RYQxo3rJR%jUCd5FoBmmSn@QTM@?QERM*E-uEb}GD!7+W4 z;ucS;Fa1*ZgF9U&8>R&|tjy3FH;93-Kpof^^nCm9kp4U+SFqwi@6}>$jo4)7x?L*p z5eHsG=We;aDoq*x+H6v7x39;dP<1mgK0fQuG+#L+=2<$z#m5Z5 zCEto{j1wIIxQ(7>!yi2iRgQS~c_6N5JHqo=$`q=PD?Y@90#727stD}1n!C~qy z1q^LAqT}jq4r2TFIf&-|vYu|DXI}0>^}2ev5jUXZCM+ZOWL>l4t}d2Pur%y+XM$j(Cc126Ww7ST~4S;g=2q8j3!|OoWynEtKkuUjZ>k za%azP+sS^P^KJ=|`TAdnlNkRHqn@0nFWdFeMoI4-_sH22UA`hq_xA?B;_u;ixDrx%9ajWMqLgzfYCofw8KF`gO zWh92d@!_T((;rc7)Y0;~o3^0R^ALS8opgP}hX%hpsuO^eo@L^`#d1RJD{m2kN6wGw z5T;|y=;jNZl}W2j;Bc$yGn_%Ti(Jtk4%` zDK5cCl`%fdh(p%F! zN4;@Huf@ukLx1k|0(qt;@&Xiw=4#8cVPcfFDX~atn}9jl7(Tz#p-Q|4F%ywo(jlv# z%qISsaHlw>1|(CS*2KqRSCP8NF(6NfJ>HP|lV`v4llSyqeD!0%X_1> zg{vvN5D0m~n!O3#;}}s;n>z%iE0e^EX_%IQaWRp4yx4LOzqV3T+W(;k{udVh!#EJ} zgnXu%H1P~HO=bwcbt57%T)u4QT05g9BA!O6PoHP#DPg-80&W|M33F=n@!{4j6>-=9 zl9KJP6S3H+U>;T?}#WA z_O%upq*IdOTe9b~q#{Y}07vk515LC)Il|+Aa$f}Tcr-&vQOIH)UZ$6& z36g&<+>7?MFwXUe`uwpa`gVyIwLJn~p1QK-H&X5vGa};Wdy^Q_m|$Lgl*a(g9EO{h z##w%7(g(SjboyvXP~vP72(|N1)ZI{XNa-&bPjF54D`q-}^mUm=DGk7I_a#t~zNU)> zJD=vyGTVi2y}*&qMByXD3Tn-Wj|5S#f( z1uWJ`3RnO6rh+Yy?c=B~PUJ?nV_{w6l7FulT#(2M_~r)HsCX+L?$5L39mEvBSU`8$ zYq&EhHXoxg(J-om_c-fe@=~3q#OG#^kYLhMnV)y;ZF6Gqz_mr2P zugbL0xc8{kyxRcLC?m)K&Yj$%)>_B@og|1@e~QPf=dh!p2dBQAtX$a~q4}AI9ArA; za(4@-P0mv5dlML~u;DO#U*_mx8yZv31rn3O5F4pLW;#xXKA<~u3@cMIw&h)_VR
G3S-EN>9CM!{YB*|;6wg-K3V?)eR((z#1 zHyX+Us~H@9)~!8`K-#ZDU>v8HpiaQ|@=VU5MgT@ehzQ(1nZ!M0ZDk{Fb`>pCb0vQE z`gX@ZK}6S!(-($v3w8-+L6Xs~;@WTrR}q42gH9p2ncZYDab8*`#p8jbS&H9$DTx{1 z|8L)r+}X3oIp6b9dN^fZsl0TpRK4NW^TVGZOit8~r*qM+QL3pd7G0|~C`PHxw2PM3 z->n8iEh)LU)Je%r7nEt|D%&F&(={XI*19z_HKI38aE6Cfm-buU7W|=mo3gMA57~g` z7aBx4OS&(O5w@W;2pO@ZVyG;2^F+2cYshx%M2*M@%;(4quYc}>z1WX(9ccb&>8#{j zE=VlFg+&2-xsr%AY_}ciz4+<$^}2TO2e)byPmJl?+aOU7{UVx$=ZNQDTQLxsh}+(_ zak-NBw`v4=+Ydp_L=w^J1&NT$-AbEUuj%8LN7nJzt^APyl$(ght>;(o{)xCqf8IX6 zq`a-CyPq$UOPJN(oo>$gX?v65Y$GnIq7Fq?=??};kY4#Na69k#iG|Wd|{Tt z&uFLgaDQ4)`{9^3rX|Bg zNY8N2w1??HVsq#}Xk&RcmoQBacog;CZ%I-HU?7dT+nZRo?h7BQd5Yrv%sI0rPF^Sk^9@l-_4``bwK!A z5Ud{#8B%fMPHat04G9kj%j5>0maQK}jQTzGC!2<9FicZ-#V^ZaC)A?QK9EelA!nP) z+Z2DqYAqTsfZ9k1CW9+h;Uao59}OnJ9>r}xs&nHlM5^Y58T*TkM80zn8=UE2e8u{j zpH(Cv<_IWBdh<6_f1={d7#R|wGLcIoegMU>82VZLrcn;{FuCmF59Tpu7qQ5TEj5`AFXQxx{XS6|0N# z3g?J^0RDM8_l@3M4G0f^O03>$S#_it3cdG%7HWo_Xb-<{a&XHHzW`(2t54<~-m{AO)J~7AhPI zbkz9A9Eq!7aijhY%^=rG`j6?w^hb13^_LKf!X*}jaV$GaXvsies~+H0T#v%OcveHN zw6t*A@XdVfqJIPsPwPO4;>%M4C+{dTVU{cOk`3puW6b36K2&z%>btSk&&H>Z;<`p> z`FMTMiHw&wOXcQ$-Y{pG@3aN}s_>;# zeQ6GDsqIMA?iz{B1XzIIegeu-#qL_ZBH|eh`L{~J(A{bH*vND8W}io(WZ9s;;m3qZ zElXp!ru)Ht+yJJ|dfvRtcX?~Pn_nW{zZbM5z3mB?Hbf_|+7ZC-9yVjR&7mnNul4vE z%KEK*b1~tReV{kNh2E=&iwgU8w0kYs3c1o6m;*fZfrF-g?1!~+<-`f!Dj8+i7NJUI zcZj}vt?|8iHQ3TdM;gn(X(Vidn!cd{^x{>dX&Vt^`^_3pu?t)#>x|K0cW=egSMl9#+mqq-8|RdMP1Dw zx^5}L#|i6)ERW8LBjm}wD6@3$`!cXl0aV*W>(xz)J2m+v|RNGEXIA%XWv z$Hx$v!@W5LfaU7iEY}no2e;*F&dh{F;<$?``JyH&l3RVjA{xC=Rq{ z6}dLQKK(BW4N!Y)Mzd3h)PX8L3OR6JX82vsk%|<`y{3G<99ycR8(ZD;4@=k|d zx1nPOrARPmMi86c#Qn^1g5RVk00)%LY3fdvDm`_|D|ZP>a4hmnJmTiqc40*eItZ0G z(Cfxe`6oWB{4L&V2-lf)Dz{MkXQ(A{E}?e1cWU;s-J?xBbGBUgebeTI{+k+LT|P=A z;GHDn*981}=hBJAGXPX?iXEu)RoZN2kKn)}Yp)=+)%`(=Hk2z^Csu^a+hNSE9<}O4 zW9BhF843QW<{+N^4NZ(+Ohu0L$qp9AhpJ?UbX8~fibx(>f3CRh|ZH~FPW;%L4 z2Jfb`#^2zr=0rNvM5{6`q6x-M;QJ8B$W1lwJwBT6OTa+L|E?*68NnD-d zqirI@#!DTk6=nvBq1t|F2a57+*JomCoPO&bkNHd&fq@7CoA#=ogI@ER;^g6MTjnNJpU8$17lkcby!fn#Y^cf59qs4;WjW9@I`pu+^=!$XvlzSp zHl-BP6qCLifc*pwQ8vDfUY0lgjC>>zTLL$6VLQBKH2U4M(&?%A718nspPj%tmUBw+ z#X>LH_#p;`9!I5vv6@cVh1b)~bHTXz;!@s>4omWjec#A;((g=Fq_p{u1|<#I-D{h1 zr%{sZ%zv+3T?)s{c78c|r6Ez1kf5OuRJ<^!_`!;|HxG;mZiSf=CdVqy^)Fpf= zR6<3YrraF!c1|tIJ#;9sg<)`+=a+cw8*6)$-yV3w_=*W`MB#~zjz6^LYX4eVoTxdI zc3h_Bc-v+z^z5>e3vEp)brfA?bQ>r1^-8x`-ATBNL)99$& z;rXG-!IBn08OxyuZoj`hcQ)a@7O5;d=o7$6_hSTJ z;(^Dr%6p+QhE473G62?L^T{&S2^UB8^~fFHE0@wP^b_T#h%rn7^=(?yQf+N!)<~#c zB&mh#W%khdZrGJgs@ixb%h?ad2HG&$G8+QXR6zbUk;$(r4F#>F^1>Br!mAfDkRR@D z!K|#|oQjAh)DlY~3|CG`+4@opGIM z^i^Z4rXu>d*NVXngpKKI2U_*K}S3_}=T|7q^w`XB` z2D5mfvT(`vMwh8DGJql?=LI15;DsNI&n^nhYwgI&-{a#V-{;<=cJWiZ5HEkDY(4jD zc2?xCALMIz@)_iwDG(vRJQ8kP7xC8|N5n z-mb8AOpEdA->ZPnh_c<&o3Jg+X;AwynF(`1Ihpp9xt|hy zu7!?dLSahdVg=JpZk#xq{L7i0Y3(N`w+}g zn}vYJKK$VH`HhCBK)g%Cw8flu&$)8+Ef5m{+5}|bRYsP&t~Jk0TLEENO=yT3nrvyfYKk*n#uYjkyI9wC{A(mO8ae&B%;9#dTh)|_V0}&D>^xO(UZ2e z2{_|CZ)7#U(3yWf5i9##7`c79OX{6Y8(moRVE~tW6|XopYg$JLlxm|Q3X{o#=h{Lt zyCavxXR*2;2qGJ^XJ;nKfb^TpVwPUUM{br*(tWeRu{4Id4v!3gY2#K~T^)u_Zer}E zn_7xjY>yK@ouN|9;O0P^ZRT#CcRfGYf%F#Vs;VRb^a|0p^Z(QZ;v z_h#9VcRfJ+!d^?N=4N?P&mP&Il_OwCQMpD;0zHfk@ay$}8TVzgO~mUpV_LitM@Q8z z?9S+w#)-R7Wlo;vsZz9D@#pj>8Cxn}a*?q4(u0!Y^j5C?U$fc+Q?CL`w3ANg?&_1 z?FycB-DhP^mg2^y?@lqA_P>^f{|QRaU~igN=blSkS9CZwMjy&9MHhfv%{2!{eynf` z$pvnj!j!PJ^$UUrQOmKo@@YFMK}y`iI9Na(F-H2m)K^;G@|^OUI0RWuw$|>Zi>>4v zq8|c(foEJT-K`qR-DS&5P&JlKeXe6o?f)$qE9Lfsl2!ik}0GeaVk8W1YV42f9! zrDpRi_q@-CcyuXkqt%*k_=Sc09&?96Tu==56A9)J#}xMwb)PC2fO#x-Caabw>Rn0y z{HI2_IqLYwp=X|p=?Np~=954+Ml?kfMhR7O0xujiI*!b{uTA~|{_q>bBp z=-{T8<|tDq3CTI;lW2D@h@1>&cH*BDa_y{)8j?pQ@ST4-bycb_leaSjIqXOg!I-dI zwNUCuLgX|9CoCb|R&9g{#A6D$#nUq#?A;pr8AdUx?+Mg??0rWBc7w@CmP8$GxdE}e zzHzq~`$CYEEw*mQui5d*E?e~uhB&}WX3EcR8?CKn>HfFzpYY*7uYx^#J!@o8sI_T# z<9>7j4!UEiu=RQ98@44ed!uGToSby}kzEY$x!v2ihKXiyj2);!CRiFr>vI6V7wV&~ zpF$-W<*Q*jZKoda1CDyKwXd4AY%8NW?9?a@Yy}T{I z8l%pzl#*N&hVTtVAK9|*u$h3nx1=6hC?%PgdUH$1 zgU4B#9LvX`-GA_Cqken?Okqp8ZYE~ymacnbL{jExU#!eyp{f&~&7KrUZ(@I$| z*^;qz>W?cO%fU+}`r^A}yw+(=Jny@=CHlQvYr*sZn~Mq?a}U+deU_vMDx=p%_S zeq4>UTvg|Ns%zPo!tKDK1jo!MHXs5k!B@$&Iw30U0NMQkIcpzN?DYb2*ymZtS+0tL z|7ZN81f&h|3Gcxa1-K}FIu}UC&Q5;*yA>^uZA?ny{4)}sFcUL|IrhZMoeaaeLpX1W z;w-j*w2UV02#G(CdabMIPx^&kQ$y&xwe3xF%dn^Zx=-2>R>1)!wONiAju(G&X}wa&e3M9e@y*jUOnq=Da;aeY3U?)V#0wlC4b>zD zYg41RpwFSrtQS5)@i*U(!g@ZK3qpF#ekkwhzv36}MIRhhvDIX_{kvF-w-i!URUy&1 zZ(GVLd13Rxa`n}=54^&rT5t6b{-~*ny>~1i9TpVYZ!wNEQFHytZc3QlVJihZ*&r<0 z+pVZ@C%9pIE7QsXE_Wp;lEw)G|JA?Qr?Kw4JQlq%?zBMH%3 zQ6JVx`e*&{{{B6UR&7EDCoSR>Ia4d+4zz1c4JkkrJzYuTQJ&qreUvcDtG1l9xOB(^ zrc~7sn*MO0arcJ>5^dNJY0Dd`dhvNp0zvzsHa0TO=<$99GqoAfRNXiNXf(!*IEnmP zr8tbeCb^b*$m_VvC6g&*bjtGqCpo-Ox`{)A5lw;yGH&b+sGu3`p#9`TQsPue)fUR< z&`V+$NVA8gzWIS^yrU#20h!!^9m?LW?#vpgS2M(T!&ts|UtGu)ibm12hjYQH3>Qh9 z&4Gq1i{aI05C~XPmovUh_g2b!EvwQ{JyK_xNk>x&ulaux-hYGOKQD&wmOXCwH|wi# z>ZA;Hh-sqvZJyfmPTTsim;OTNb>l5w$r>9)Wr+8Y$ptx_kA@kv@KugIc@7s51}<>$GYQ56)Ki`;R>$*#5fm%=a3oHXA{2r ze(gE^q7@6M#NOKDk?lQ!5v+|OS})<3Q$-XinH=iC%oZ$K*8mR&EYajonfKIB3qJw` zEh)zGw95_xD1yBg7v#8+sMaF^CW02x=1c30XZN3`1|S3xsHPU&%AtideyTVxW^pmN zC+CEKwcWLdiPK%WA><$Zk_5~1-n5;YlQ3aqhz90Q0Xyfxt(2@|0?VzodBvU=`;yT2 z97iv%rVlOZAzEh~-1FWqO$aNkyaLq>*<|?mOs(GR3FT392W{moZ;HD&I)GzNjoj|$ z6#h>D!~{G0fG#7m_{NwN;WBo+FBYH&u^ak!z=N*W+uPe4om4A>NYVy$G_k2Ag|NAO z1wvW{1B!~LGZRF@(ZG@sG?88UFOlrO7R5%3$!Z0a^39~K+xO1U`7jU^5z(@hy;s>te8_ua9x0Q zn(l}+Nj+K~g&_``wy#um;Qzq?f&T;l2mTNIANW7;|84Ov|JCpRS8NUz9_W9coCNv_ z?xl52VVa7r#b5F5PRa<1$EH=S_IdUhr^0@&t!&FBRvJ)_Pg&>TFXt z;Him`;9z20Fs(B_&VW(!)c3M{jzBor(F1Dq}caD#skevw=^xy`W{jSaVH-|RF^ zSxJ<1s$c_lG4y9pCj12Kt805nHipE(fmI(remtK}i2v8umpU5=fE&6Kz!tKfD5{zY zco!fp1V_e}JZR%cv(4G}(kNtwr>75|O)au*I`|}b#FsjqhIe!NJ-zeaOcKF`RqzgX zM*JenjN>g8sc(CV9npdUo7l-3T~TbOt`ob-!+y>EHiCg>^;n^+rmplETdVk@A`cVT zA1`NM{`03FQ?x4Ad8O#s9fGCv7?9O}iuG`+X$PzYMAI#+5>jAk1=DDL4Zw~OY#s>1 zQelFQX}adIQepTSq~Q#Jb(w>Y{qR)gW)Aw04L6*=W|uYVCY8oiUWoVZpBMokVRv`n z|G@u&{{#OA{tx^g_&@OfZSgOE^Xp%o&t1c5t;L4bTyJavWpxv!`N2~II|QWnuI)Ob zYv3~hzdJ|?XBxHj0LyR7#yX)CPY)MQMfjp;JB;mJUhwT5L@?^+5I~?-#K5{H_o>s$tlw9%!2JAO% zwPewi-QXC{!xhKIj#2sjTTl)0}n}@N`7N{W=1DLw7kpe!!Zsa-=pa8*m(NH%XbHdb1Xf#@^W+ z0!Yl(Z&WF*q+t}rJ+X~J$AAkhsNVDQV?(l=i7Q)eikH_fxBDBC;`#gl3*YY74ymO- zu^WR8?-b)qS)xc+#&MP};#uWZXjqxtS8$~83O9k&BTMF?%87MjbR|K3ytK zDO-8yV;5vhR^p`+p+(ZmL}s%bYB1U6cA4RPB%6{$xxo07C&85m{tx^g_&@M};Qzq? jf&T;l-xmM>p8x{@D(Mktb)u`N00000NkvXXu0mjf(?NUb literal 0 HcmV?d00001 diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/codepen-embed.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/codepen-embed.css new file mode 100644 index 0000000000..195c4a0784 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/codepen-embed.css @@ -0,0 +1,60 @@ +/* + codepen.io Embed Theme + Author: Justin Perry + Original theme - https://github.com/chriskempson/tomorrow-theme +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #222; + color: #fff; +} + +.hljs-comment, +.hljs-quote { + color: #777; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-regexp, +.hljs-meta, +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-params, +.hljs-symbol, +.hljs-bullet, +.hljs-link, +.hljs-deletion { + color: #ab875d; +} + +.hljs-section, +.hljs-title, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-type, +.hljs-attribute { + color: #9b869b; +} + +.hljs-string, +.hljs-keyword, +.hljs-selector-tag, +.hljs-addition { + color: #8f9c6c; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/color-brewer.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/color-brewer.css new file mode 100644 index 0000000000..7934d986a7 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/color-brewer.css @@ -0,0 +1,71 @@ +/* + +Colorbrewer theme +Original: https://github.com/mbostock/colorbrewer-theme (c) Mike Bostock +Ported by Fabrício Tavares de Oliveira + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #fff; +} + +.hljs, +.hljs-subst { + color: #000; +} + +.hljs-string, +.hljs-meta, +.hljs-symbol, +.hljs-template-tag, +.hljs-template-variable, +.hljs-addition { + color: #756bb1; +} + +.hljs-comment, +.hljs-quote { + color: #636363; +} + +.hljs-number, +.hljs-regexp, +.hljs-literal, +.hljs-bullet, +.hljs-link { + color: #31a354; +} + +.hljs-deletion, +.hljs-variable { + color: #88f; +} + + + +.hljs-keyword, +.hljs-selector-tag, +.hljs-title, +.hljs-section, +.hljs-built_in, +.hljs-doctag, +.hljs-type, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-strong { + color: #3182bd; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-attribute { + color: #e6550d; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/darcula.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/darcula.css new file mode 100644 index 0000000000..be182d0b50 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/darcula.css @@ -0,0 +1,77 @@ +/* + +Darcula color scheme from the JetBrains family of IDEs + +*/ + + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #2b2b2b; +} + +.hljs { + color: #bababa; +} + +.hljs-strong, +.hljs-emphasis { + color: #a8a8a2; +} + +.hljs-bullet, +.hljs-quote, +.hljs-link, +.hljs-number, +.hljs-regexp, +.hljs-literal { + color: #6896ba; +} + +.hljs-code, +.hljs-selector-class { + color: #a6e22e; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-section, +.hljs-attribute, +.hljs-name, +.hljs-variable { + color: #cb7832; +} + +.hljs-params { + color: #b9b9b9; +} + +.hljs-string { + color: #6a8759; +} + +.hljs-subst, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-symbol, +.hljs-selector-id, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-template-tag, +.hljs-template-variable, +.hljs-addition { + color: #e0c46c; +} + +.hljs-comment, +.hljs-deletion, +.hljs-meta { + color: #7f7f7f; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/dark.css new file mode 100644 index 0000000000..b4724f5f50 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/dark.css @@ -0,0 +1,63 @@ +/* + +Dark style from softwaremaniacs.org (c) Ivan Sagalaev + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #444; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-section, +.hljs-link { + color: white; +} + +.hljs, +.hljs-subst { + color: #ddd; +} + +.hljs-string, +.hljs-title, +.hljs-name, +.hljs-type, +.hljs-attribute, +.hljs-symbol, +.hljs-bullet, +.hljs-built_in, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #d88; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion, +.hljs-meta { + color: #777; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-title, +.hljs-section, +.hljs-doctag, +.hljs-type, +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/darkula.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/darkula.css new file mode 100644 index 0000000000..f4646c3c5d --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/darkula.css @@ -0,0 +1,6 @@ +/* + Deprecated due to a typo in the name and left here for compatibility purpose only. + Please use darcula.css instead. +*/ + +@import url('darcula.css'); diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/default.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/default.css new file mode 100644 index 0000000000..f1bfade31e --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/default.css @@ -0,0 +1,99 @@ +/* + +Original highlight.js style (c) Ivan Sagalaev + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #F0F0F0; +} + + +/* Base color: saturation 0; */ + +.hljs, +.hljs-subst { + color: #444; +} + +.hljs-comment { + color: #888888; +} + +.hljs-keyword, +.hljs-attribute, +.hljs-selector-tag, +.hljs-meta-keyword, +.hljs-doctag, +.hljs-name { + font-weight: bold; +} + + +/* User color: hue: 0 */ + +.hljs-type, +.hljs-string, +.hljs-number, +.hljs-selector-id, +.hljs-selector-class, +.hljs-quote, +.hljs-template-tag, +.hljs-deletion { + color: #880000; +} + +.hljs-title, +.hljs-section { + color: #880000; + font-weight: bold; +} + +.hljs-regexp, +.hljs-symbol, +.hljs-variable, +.hljs-template-variable, +.hljs-link, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #BC6060; +} + + +/* Language color: hue: 90; */ + +.hljs-literal { + color: #78A960; +} + +.hljs-built_in, +.hljs-bullet, +.hljs-code, +.hljs-addition { + color: #397300; +} + + +/* Meta color: hue: 200 */ + +.hljs-meta { + color: #1f7199; +} + +.hljs-meta-string { + color: #4d99bf; +} + + +/* Misc effects */ + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/docco.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/docco.css new file mode 100644 index 0000000000..db366be372 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/docco.css @@ -0,0 +1,97 @@ +/* +Docco style used in http://jashkenas.github.com/docco/ converted by Simon Madine (@thingsinjars) +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #000; + background: #f8f8ff; +} + +.hljs-comment, +.hljs-quote { + color: #408080; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-subst { + color: #954121; +} + +.hljs-number { + color: #40a070; +} + +.hljs-string, +.hljs-doctag { + color: #219161; +} + +.hljs-selector-id, +.hljs-selector-class, +.hljs-section, +.hljs-type { + color: #19469d; +} + +.hljs-params { + color: #00f; +} + +.hljs-title { + color: #458; + font-weight: bold; +} + +.hljs-tag, +.hljs-name, +.hljs-attribute { + color: #000080; + font-weight: normal; +} + +.hljs-variable, +.hljs-template-variable { + color: #008080; +} + +.hljs-regexp, +.hljs-link { + color: #b68; +} + +.hljs-symbol, +.hljs-bullet { + color: #990073; +} + +.hljs-built_in, +.hljs-builtin-name { + color: #0086b3; +} + +.hljs-meta { + color: #999; + font-weight: bold; +} + +.hljs-deletion { + background: #fdd; +} + +.hljs-addition { + background: #dfd; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/dracula.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/dracula.css new file mode 100644 index 0000000000..d591db6801 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/dracula.css @@ -0,0 +1,76 @@ +/* + +Dracula Theme v1.2.0 + +https://github.com/zenorocha/dracula-theme + +Copyright 2015, All rights reserved + +Code licensed under the MIT license +http://zenorocha.mit-license.org + +@author Éverton Ribeiro +@author Zeno Rocha + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #282a36; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-section, +.hljs-link { + color: #8be9fd; +} + +.hljs-function .hljs-keyword { + color: #ff79c6; +} + +.hljs, +.hljs-subst { + color: #f8f8f2; +} + +.hljs-string, +.hljs-title, +.hljs-name, +.hljs-type, +.hljs-attribute, +.hljs-symbol, +.hljs-bullet, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #f1fa8c; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion, +.hljs-meta { + color: #6272a4; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-title, +.hljs-section, +.hljs-doctag, +.hljs-type, +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/far.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/far.css new file mode 100644 index 0000000000..2b3f87b562 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/far.css @@ -0,0 +1,71 @@ +/* + +FAR Style (c) MajestiC + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #000080; +} + +.hljs, +.hljs-subst { + color: #0ff; +} + +.hljs-string, +.hljs-attribute, +.hljs-symbol, +.hljs-bullet, +.hljs-built_in, +.hljs-builtin-name, +.hljs-template-tag, +.hljs-template-variable, +.hljs-addition { + color: #ff0; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-section, +.hljs-type, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-variable { + color: #fff; +} + +.hljs-comment, +.hljs-quote, +.hljs-doctag, +.hljs-deletion { + color: #888; +} + +.hljs-number, +.hljs-regexp, +.hljs-literal, +.hljs-link { + color: #0f0; +} + +.hljs-meta { + color: #008080; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-title, +.hljs-section, +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/foundation.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/foundation.css new file mode 100644 index 0000000000..f1fe64b377 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/foundation.css @@ -0,0 +1,88 @@ +/* +Description: Foundation 4 docs style for highlight.js +Author: Dan Allen +Website: http://foundation.zurb.com/docs/ +Version: 1.0 +Date: 2013-04-02 +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #eee; color: black; +} + +.hljs-link, +.hljs-emphasis, +.hljs-attribute, +.hljs-addition { + color: #070; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong, +.hljs-string, +.hljs-deletion { + color: #d14; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-quote, +.hljs-comment { + color: #998; + font-style: italic; +} + +.hljs-section, +.hljs-title { + color: #900; +} + +.hljs-class .hljs-title, +.hljs-type { + color: #458; +} + +.hljs-variable, +.hljs-template-variable { + color: #336699; +} + +.hljs-bullet { + color: #997700; +} + +.hljs-meta { + color: #3344bb; +} + +.hljs-code, +.hljs-number, +.hljs-literal, +.hljs-keyword, +.hljs-selector-tag { + color: #099; +} + +.hljs-regexp { + background-color: #fff0ff; + color: #880088; +} + +.hljs-symbol { + color: #990073; +} + +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #007700; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/github-gist.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/github-gist.css new file mode 100644 index 0000000000..155f0b9160 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/github-gist.css @@ -0,0 +1,71 @@ +/** + * GitHub Gist Theme + * Author : Louis Barranqueiro - https://github.com/LouisBarranqueiro + */ + +.hljs { + display: block; + background: white; + padding: 0.5em; + color: #333333; + overflow-x: auto; +} + +.hljs-comment, +.hljs-meta { + color: #969896; +} + +.hljs-string, +.hljs-variable, +.hljs-template-variable, +.hljs-strong, +.hljs-emphasis, +.hljs-quote { + color: #df5000; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-type { + color: #a71d5d; +} + +.hljs-literal, +.hljs-symbol, +.hljs-bullet, +.hljs-attribute { + color: #0086b3; +} + +.hljs-section, +.hljs-name { + color: #63a35c; +} + +.hljs-tag { + color: #333333; +} + +.hljs-title, +.hljs-attr, +.hljs-selector-id, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #795da3; +} + +.hljs-addition { + color: #55a532; + background-color: #eaffea; +} + +.hljs-deletion { + color: #bd2c00; + background-color: #ffecec; +} + +.hljs-link { + text-decoration: underline; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/github.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/github.css new file mode 100644 index 0000000000..791932b87e --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/github.css @@ -0,0 +1,99 @@ +/* + +github.com style (c) Vasily Polovnyov + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #333; + background: #f8f8f8; +} + +.hljs-comment, +.hljs-quote { + color: #998; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-subst { + color: #333; + font-weight: bold; +} + +.hljs-number, +.hljs-literal, +.hljs-variable, +.hljs-template-variable, +.hljs-tag .hljs-attr { + color: #008080; +} + +.hljs-string, +.hljs-doctag { + color: #d14; +} + +.hljs-title, +.hljs-section, +.hljs-selector-id { + color: #900; + font-weight: bold; +} + +.hljs-subst { + font-weight: normal; +} + +.hljs-type, +.hljs-class .hljs-title { + color: #458; + font-weight: bold; +} + +.hljs-tag, +.hljs-name, +.hljs-attribute { + color: #000080; + font-weight: normal; +} + +.hljs-regexp, +.hljs-link { + color: #009926; +} + +.hljs-symbol, +.hljs-bullet { + color: #990073; +} + +.hljs-built_in, +.hljs-builtin-name { + color: #0086b3; +} + +.hljs-meta { + color: #999; + font-weight: bold; +} + +.hljs-deletion { + background: #fdd; +} + +.hljs-addition { + background: #dfd; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/googlecode.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/googlecode.css new file mode 100644 index 0000000000..884ad63538 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/googlecode.css @@ -0,0 +1,89 @@ +/* + +Google Code style (c) Aahan Krish + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: white; + color: black; +} + +.hljs-comment, +.hljs-quote { + color: #800; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-section, +.hljs-title, +.hljs-name { + color: #008; +} + +.hljs-variable, +.hljs-template-variable { + color: #660; +} + +.hljs-string, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-regexp { + color: #080; +} + +.hljs-literal, +.hljs-symbol, +.hljs-bullet, +.hljs-meta, +.hljs-number, +.hljs-link { + color: #066; +} + +.hljs-title, +.hljs-doctag, +.hljs-type, +.hljs-attr, +.hljs-built_in, +.hljs-builtin-name, +.hljs-params { + color: #606; +} + +.hljs-attribute, +.hljs-subst { + color: #000; +} + +.hljs-formula { + background-color: #eee; + font-style: italic; +} + +.hljs-selector-id, +.hljs-selector-class { + color: #9B703F +} + +.hljs-addition { + background-color: #baeeba; +} + +.hljs-deletion { + background-color: #ffc8bd; +} + +.hljs-doctag, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/grayscale.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/grayscale.css new file mode 100644 index 0000000000..5376f34064 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/grayscale.css @@ -0,0 +1,101 @@ +/* + +grayscale style (c) MY Sun + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #333; + background: #fff; +} + +.hljs-comment, +.hljs-quote { + color: #777; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-subst { + color: #333; + font-weight: bold; +} + +.hljs-number, +.hljs-literal { + color: #777; +} + +.hljs-string, +.hljs-doctag, +.hljs-formula { + color: #333; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAJ0lEQVQIW2O8e/fufwYGBgZBQUEQxcCIIfDu3Tuwivfv30NUoAsAALHpFMMLqZlPAAAAAElFTkSuQmCC) repeat; +} + +.hljs-title, +.hljs-section, +.hljs-selector-id { + color: #000; + font-weight: bold; +} + +.hljs-subst { + font-weight: normal; +} + +.hljs-class .hljs-title, +.hljs-type, +.hljs-name { + color: #333; + font-weight: bold; +} + +.hljs-tag { + color: #333; +} + +.hljs-regexp { + color: #333; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAICAYAAADA+m62AAAAPUlEQVQYV2NkQAN37979r6yszIgujiIAU4RNMVwhuiQ6H6wQl3XI4oy4FMHcCJPHcDS6J2A2EqUQpJhohQDexSef15DBCwAAAABJRU5ErkJggg==) repeat; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link { + color: #000; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAKElEQVQIW2NkQAO7d+/+z4gsBhJwdXVlhAvCBECKwIIwAbhKZBUwBQA6hBpm5efZsgAAAABJRU5ErkJggg==) repeat; +} + +.hljs-built_in, +.hljs-builtin-name { + color: #000; + text-decoration: underline; +} + +.hljs-meta { + color: #999; + font-weight: bold; +} + +.hljs-deletion { + color: #fff; + background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAADCAYAAABS3WWCAAAAE0lEQVQIW2MMDQ39zzhz5kwIAQAyxweWgUHd1AAAAABJRU5ErkJggg==) repeat; +} + +.hljs-addition { + color: #000; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAALUlEQVQYV2N89+7dfwYk8P79ewZBQUFkIQZGOiu6e/cuiptQHAPl0NtNxAQBAM97Oejj3Dg7AAAAAElFTkSuQmCC) repeat; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/gruvbox-dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/gruvbox-dark.css new file mode 100644 index 0000000000..f563811a86 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/gruvbox-dark.css @@ -0,0 +1,108 @@ +/* + +Gruvbox style (dark) (c) Pavel Pertsev (original style at https://github.com/morhetz/gruvbox) + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #282828; +} + +.hljs, +.hljs-subst { + color: #ebdbb2; +} + +/* Gruvbox Red */ +.hljs-deletion, +.hljs-formula, +.hljs-keyword, +.hljs-link, +.hljs-selector-tag { + color: #fb4934; +} + +/* Gruvbox Blue */ +.hljs-built_in, +.hljs-emphasis, +.hljs-name, +.hljs-quote, +.hljs-strong, +.hljs-title, +.hljs-variable { + color: #83a598; +} + +/* Gruvbox Yellow */ +.hljs-attr, +.hljs-params, +.hljs-template-tag, +.hljs-type { + color: #fabd2f; +} + +/* Gruvbox Purple */ +.hljs-builtin-name, +.hljs-doctag, +.hljs-literal, +.hljs-number { + color: #8f3f71; +} + +/* Gruvbox Orange */ +.hljs-code, +.hljs-meta, +.hljs-regexp, +.hljs-selector-id, +.hljs-template-variable { + color: #fe8019; +} + +/* Gruvbox Green */ +.hljs-addition, +.hljs-meta-string, +.hljs-section, +.hljs-selector-attr, +.hljs-selector-class, +.hljs-string, +.hljs-symbol { + color: #b8bb26; +} + +/* Gruvbox Aqua */ +.hljs-attribute, +.hljs-bullet, +.hljs-class, +.hljs-function, +.hljs-function .hljs-keyword, +.hljs-meta-keyword, +.hljs-selector-pseudo, +.hljs-tag { + color: #8ec07c; +} + +/* Gruvbox Gray */ +.hljs-comment { + color: #928374; +} + +/* Gruvbox Purple */ +.hljs-link_label, +.hljs-literal, +.hljs-number { + color: #d3869b; +} + +.hljs-comment, +.hljs-emphasis { + font-style: italic; +} + +.hljs-section, +.hljs-strong, +.hljs-tag { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/gruvbox-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/gruvbox-light.css new file mode 100644 index 0000000000..ff45468eb2 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/gruvbox-light.css @@ -0,0 +1,108 @@ +/* + +Gruvbox style (light) (c) Pavel Pertsev (original style at https://github.com/morhetz/gruvbox) + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #fbf1c7; +} + +.hljs, +.hljs-subst { + color: #3c3836; +} + +/* Gruvbox Red */ +.hljs-deletion, +.hljs-formula, +.hljs-keyword, +.hljs-link, +.hljs-selector-tag { + color: #9d0006; +} + +/* Gruvbox Blue */ +.hljs-built_in, +.hljs-emphasis, +.hljs-name, +.hljs-quote, +.hljs-strong, +.hljs-title, +.hljs-variable { + color: #076678; +} + +/* Gruvbox Yellow */ +.hljs-attr, +.hljs-params, +.hljs-template-tag, +.hljs-type { + color: #b57614; +} + +/* Gruvbox Purple */ +.hljs-builtin-name, +.hljs-doctag, +.hljs-literal, +.hljs-number { + color: #8f3f71; +} + +/* Gruvbox Orange */ +.hljs-code, +.hljs-meta, +.hljs-regexp, +.hljs-selector-id, +.hljs-template-variable { + color: #af3a03; +} + +/* Gruvbox Green */ +.hljs-addition, +.hljs-meta-string, +.hljs-section, +.hljs-selector-attr, +.hljs-selector-class, +.hljs-string, +.hljs-symbol { + color: #79740e; +} + +/* Gruvbox Aqua */ +.hljs-attribute, +.hljs-bullet, +.hljs-class, +.hljs-function, +.hljs-function .hljs-keyword, +.hljs-meta-keyword, +.hljs-selector-pseudo, +.hljs-tag { + color: #427b58; +} + +/* Gruvbox Gray */ +.hljs-comment { + color: #928374; +} + +/* Gruvbox Purple */ +.hljs-link_label, +.hljs-literal, +.hljs-number { + color: #8f3f71; +} + +.hljs-comment, +.hljs-emphasis { + font-style: italic; +} + +.hljs-section, +.hljs-strong, +.hljs-tag { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/hopscotch.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/hopscotch.css new file mode 100644 index 0000000000..32e60d230a --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/hopscotch.css @@ -0,0 +1,83 @@ +/* + * Hopscotch + * by Jan T. Sott + * https://github.com/idleberg/Hopscotch + * + * This work is licensed under the Creative Commons CC0 1.0 Universal License + */ + +/* Comment */ +.hljs-comment, +.hljs-quote { + color: #989498; +} + +/* Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-link, +.hljs-deletion { + color: #dd464c; +} + +/* Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #fd8b19; +} + +/* Yellow */ +.hljs-class .hljs-title { + color: #fdcc59; +} + +/* Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #8fc13e; +} + +/* Aqua */ +.hljs-meta { + color: #149b93; +} + +/* Blue */ +.hljs-function, +.hljs-section, +.hljs-title { + color: #1290bf; +} + +/* Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #c85e7c; +} + +.hljs { + display: block; + background: #322931; + color: #b9b5b8; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/hybrid.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/hybrid.css new file mode 100644 index 0000000000..29735a1890 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/hybrid.css @@ -0,0 +1,102 @@ +/* + +vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid) + +*/ + +/*background color*/ +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #1d1f21; +} + +/*selection color*/ +.hljs::selection, +.hljs span::selection { + background: #373b41; +} + +.hljs::-moz-selection, +.hljs span::-moz-selection { + background: #373b41; +} + +/*foreground color*/ +.hljs { + color: #c5c8c6; +} + +/*color: fg_yellow*/ +.hljs-title, +.hljs-name { + color: #f0c674; +} + +/*color: fg_comment*/ +.hljs-comment, +.hljs-meta, +.hljs-meta .hljs-keyword { + color: #707880; +} + +/*color: fg_red*/ +.hljs-number, +.hljs-symbol, +.hljs-literal, +.hljs-deletion, +.hljs-link { + color: #cc6666 +} + +/*color: fg_green*/ +.hljs-string, +.hljs-doctag, +.hljs-addition, +.hljs-regexp, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #b5bd68; +} + +/*color: fg_purple*/ +.hljs-attribute, +.hljs-code, +.hljs-selector-id { + color: #b294bb; +} + +/*color: fg_blue*/ +.hljs-keyword, +.hljs-selector-tag, +.hljs-bullet, +.hljs-tag { + color: #81a2be; +} + +/*color: fg_aqua*/ +.hljs-subst, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #8abeb7; +} + +/*color: fg_orange*/ +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-quote, +.hljs-section, +.hljs-selector-class { + color: #de935f; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/idea.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/idea.css new file mode 100644 index 0000000000..3bf1892bd4 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/idea.css @@ -0,0 +1,97 @@ +/* + +Intellij Idea-like styling (c) Vasily Polovnyov + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #000; + background: #fff; +} + +.hljs-subst, +.hljs-title { + font-weight: normal; + color: #000; +} + +.hljs-comment, +.hljs-quote { + color: #808080; + font-style: italic; +} + +.hljs-meta { + color: #808000; +} + +.hljs-tag { + background: #efefef; +} + +.hljs-section, +.hljs-name, +.hljs-literal, +.hljs-keyword, +.hljs-selector-tag, +.hljs-type, +.hljs-selector-id, +.hljs-selector-class { + font-weight: bold; + color: #000080; +} + +.hljs-attribute, +.hljs-number, +.hljs-regexp, +.hljs-link { + font-weight: bold; + color: #0000ff; +} + +.hljs-number, +.hljs-regexp, +.hljs-link { + font-weight: normal; +} + +.hljs-string { + color: #008000; + font-weight: bold; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-formula { + color: #000; + background: #d0eded; + font-style: italic; +} + +.hljs-doctag { + text-decoration: underline; +} + +.hljs-variable, +.hljs-template-variable { + color: #660e7a; +} + +.hljs-addition { + background: #baeeba; +} + +.hljs-deletion { + background: #ffc8bd; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/ir-black.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/ir-black.css new file mode 100644 index 0000000000..bd4c755ed8 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/ir-black.css @@ -0,0 +1,73 @@ +/* + IR_Black style (c) Vasily Mikhailitchenko +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #000; + color: #f8f8f8; +} + +.hljs-comment, +.hljs-quote, +.hljs-meta { + color: #7c7c7c; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-tag, +.hljs-name { + color: #96cbfe; +} + +.hljs-attribute, +.hljs-selector-id { + color: #ffffb6; +} + +.hljs-string, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-addition { + color: #a8ff60; +} + +.hljs-subst { + color: #daefa3; +} + +.hljs-regexp, +.hljs-link { + color: #e9c062; +} + +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-doctag { + color: #ffffb6; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-variable, +.hljs-template-variable, +.hljs-literal { + color: #c6c5fe; +} + +.hljs-number, +.hljs-deletion { + color:#ff73fd; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/kimbie.dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/kimbie.dark.css new file mode 100644 index 0000000000..d139cb5d0c --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/kimbie.dark.css @@ -0,0 +1,74 @@ +/* + Name: Kimbie (dark) + Author: Jan T. Sott + License: Creative Commons Attribution-ShareAlike 4.0 Unported License + URL: https://github.com/idleberg/Kimbie-highlight.js +*/ + +/* Kimbie Comment */ +.hljs-comment, +.hljs-quote { + color: #d6baad; +} + +/* Kimbie Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-meta { + color: #dc3958; +} + +/* Kimbie Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-deletion, +.hljs-link { + color: #f79a32; +} + +/* Kimbie Yellow */ +.hljs-title, +.hljs-section, +.hljs-attribute { + color: #f06431; +} + +/* Kimbie Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #889b4a; +} + +/* Kimbie Purple */ +.hljs-keyword, +.hljs-selector-tag, +.hljs-function { + color: #98676a; +} + +.hljs { + display: block; + overflow-x: auto; + background: #221a0f; + color: #d3af86; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/kimbie.light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/kimbie.light.css new file mode 100644 index 0000000000..04ff6ed3a2 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/kimbie.light.css @@ -0,0 +1,74 @@ +/* + Name: Kimbie (light) + Author: Jan T. Sott + License: Creative Commons Attribution-ShareAlike 4.0 Unported License + URL: https://github.com/idleberg/Kimbie-highlight.js +*/ + +/* Kimbie Comment */ +.hljs-comment, +.hljs-quote { + color: #a57a4c; +} + +/* Kimbie Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-meta { + color: #dc3958; +} + +/* Kimbie Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-deletion, +.hljs-link { + color: #f79a32; +} + +/* Kimbie Yellow */ +.hljs-title, +.hljs-section, +.hljs-attribute { + color: #f06431; +} + +/* Kimbie Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #889b4a; +} + +/* Kimbie Purple */ +.hljs-keyword, +.hljs-selector-tag, +.hljs-function { + color: #98676a; +} + +.hljs { + display: block; + overflow-x: auto; + background: #fbebd4; + color: #84613d; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/magula.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/magula.css new file mode 100644 index 0000000000..44dee5e8e1 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/magula.css @@ -0,0 +1,70 @@ +/* +Description: Magula style for highligh.js +Author: Ruslan Keba +Website: http://rukeba.com/ +Version: 1.0 +Date: 2009-01-03 +Music: Aphex Twin / Xtal +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background-color: #f4f4f4; +} + +.hljs, +.hljs-subst { + color: black; +} + +.hljs-string, +.hljs-title, +.hljs-symbol, +.hljs-bullet, +.hljs-attribute, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #050; +} + +.hljs-comment, +.hljs-quote { + color: #777; +} + +.hljs-number, +.hljs-regexp, +.hljs-literal, +.hljs-type, +.hljs-link { + color: #800; +} + +.hljs-deletion, +.hljs-meta { + color: #00e; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-doctag, +.hljs-title, +.hljs-section, +.hljs-built_in, +.hljs-tag, +.hljs-name { + font-weight: bold; + color: navy; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/mono-blue.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/mono-blue.css new file mode 100644 index 0000000000..884c97c767 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/mono-blue.css @@ -0,0 +1,59 @@ +/* + Five-color theme from a single blue hue. +*/ +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #eaeef3; +} + +.hljs { + color: #00193a; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-title, +.hljs-section, +.hljs-doctag, +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-comment { + color: #738191; +} + +.hljs-string, +.hljs-title, +.hljs-section, +.hljs-built_in, +.hljs-literal, +.hljs-type, +.hljs-addition, +.hljs-tag, +.hljs-quote, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #0048ab; +} + +.hljs-meta, +.hljs-subst, +.hljs-symbol, +.hljs-regexp, +.hljs-attribute, +.hljs-deletion, +.hljs-variable, +.hljs-template-variable, +.hljs-link, +.hljs-bullet { + color: #4c81c9; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/monokai-sublime.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/monokai-sublime.css new file mode 100644 index 0000000000..2864170daf --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/monokai-sublime.css @@ -0,0 +1,83 @@ +/* + +Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-license.org/ + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #23241f; +} + +.hljs, +.hljs-tag, +.hljs-subst { + color: #f8f8f2; +} + +.hljs-strong, +.hljs-emphasis { + color: #a8a8a2; +} + +.hljs-bullet, +.hljs-quote, +.hljs-number, +.hljs-regexp, +.hljs-literal, +.hljs-link { + color: #ae81ff; +} + +.hljs-code, +.hljs-title, +.hljs-section, +.hljs-selector-class { + color: #a6e22e; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-name, +.hljs-attr { + color: #f92672; +} + +.hljs-symbol, +.hljs-attribute { + color: #66d9ef; +} + +.hljs-params, +.hljs-class .hljs-title { + color: #f8f8f2; +} + +.hljs-string, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-selector-id, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-addition, +.hljs-variable, +.hljs-template-variable { + color: #e6db74; +} + +.hljs-comment, +.hljs-deletion, +.hljs-meta { + color: #75715e; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/monokai.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/monokai.css new file mode 100644 index 0000000000..775d53f91a --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/monokai.css @@ -0,0 +1,70 @@ +/* +Monokai style - ported by Luigi Maselli - http://grigio.org +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #272822; color: #ddd; +} + +.hljs-tag, +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-strong, +.hljs-name { + color: #f92672; +} + +.hljs-code { + color: #66d9ef; +} + +.hljs-class .hljs-title { + color: white; +} + +.hljs-attribute, +.hljs-symbol, +.hljs-regexp, +.hljs-link { + color: #bf79db; +} + +.hljs-string, +.hljs-bullet, +.hljs-subst, +.hljs-title, +.hljs-section, +.hljs-emphasis, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #a6e22e; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion, +.hljs-meta { + color: #75715e; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-doctag, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-selector-id { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/obsidian.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/obsidian.css new file mode 100644 index 0000000000..356630fa23 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/obsidian.css @@ -0,0 +1,88 @@ +/** + * Obsidian style + * ported by Alexander Marenin (http://github.com/ioncreature) + */ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #282b2e; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-selector-id { + color: #93c763; +} + +.hljs-number { + color: #ffcd22; +} + +.hljs { + color: #e0e2e4; +} + +.hljs-attribute { + color: #668bb0; +} + +.hljs-code, +.hljs-class .hljs-title, +.hljs-section { + color: white; +} + +.hljs-regexp, +.hljs-link { + color: #d39745; +} + +.hljs-meta { + color: #557182; +} + +.hljs-tag, +.hljs-name, +.hljs-bullet, +.hljs-subst, +.hljs-emphasis, +.hljs-type, +.hljs-built_in, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #8cbbad; +} + +.hljs-string, +.hljs-symbol { + color: #ec7600; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion { + color: #818e96; +} + +.hljs-selector-class { + color: #A082BD +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-doctag, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-name, +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/ocean.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/ocean.css new file mode 100644 index 0000000000..5901581b40 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/ocean.css @@ -0,0 +1,74 @@ +/* Ocean Dark Theme */ +/* https://github.com/gavsiu */ +/* Original theme - https://github.com/chriskempson/base16 */ + +/* Ocean Comment */ +.hljs-comment, +.hljs-quote { + color: #65737e; +} + +/* Ocean Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion { + color: #bf616a; +} + +/* Ocean Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link { + color: #d08770; +} + +/* Ocean Yellow */ +.hljs-attribute { + color: #ebcb8b; +} + +/* Ocean Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #a3be8c; +} + +/* Ocean Blue */ +.hljs-title, +.hljs-section { + color: #8fa1b3; +} + +/* Ocean Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #b48ead; +} + +.hljs { + display: block; + overflow-x: auto; + background: #2b303b; + color: #c0c5ce; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/paraiso-dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/paraiso-dark.css new file mode 100644 index 0000000000..e7292401c6 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/paraiso-dark.css @@ -0,0 +1,72 @@ +/* + Paraíso (dark) + Created by Jan T. Sott (http://github.com/idleberg) + Inspired by the art of Rubens LP (http://www.rubenslp.com.br) +*/ + +/* Paraíso Comment */ +.hljs-comment, +.hljs-quote { + color: #8d8687; +} + +/* Paraíso Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-link, +.hljs-meta { + color: #ef6155; +} + +/* Paraíso Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-deletion { + color: #f99b15; +} + +/* Paraíso Yellow */ +.hljs-title, +.hljs-section, +.hljs-attribute { + color: #fec418; +} + +/* Paraíso Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #48b685; +} + +/* Paraíso Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #815ba4; +} + +.hljs { + display: block; + overflow-x: auto; + background: #2f1e2e; + color: #a39e9b; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/paraiso-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/paraiso-light.css new file mode 100644 index 0000000000..944857cd8d --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/paraiso-light.css @@ -0,0 +1,72 @@ +/* + Paraíso (light) + Created by Jan T. Sott (http://github.com/idleberg) + Inspired by the art of Rubens LP (http://www.rubenslp.com.br) +*/ + +/* Paraíso Comment */ +.hljs-comment, +.hljs-quote { + color: #776e71; +} + +/* Paraíso Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-link, +.hljs-meta { + color: #ef6155; +} + +/* Paraíso Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-deletion { + color: #f99b15; +} + +/* Paraíso Yellow */ +.hljs-title, +.hljs-section, +.hljs-attribute { + color: #fec418; +} + +/* Paraíso Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #48b685; +} + +/* Paraíso Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #815ba4; +} + +.hljs { + display: block; + overflow-x: auto; + background: #e7e9db; + color: #4f424c; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/pojoaque.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/pojoaque.css new file mode 100644 index 0000000000..2e07847b2b --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/pojoaque.css @@ -0,0 +1,83 @@ +/* + +Pojoaque Style by Jason Tate +http://web-cms-designs.com/ftopict-10-pojoaque-style-for-highlight-js-code-highlighter.html +Based on Solarized Style from http://ethanschoonover.com/solarized + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #dccf8f; + background: url(./pojoaque.jpg) repeat scroll left top #181914; +} + +.hljs-comment, +.hljs-quote { + color: #586e75; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-addition { + color: #b64926; +} + +.hljs-number, +.hljs-string, +.hljs-doctag, +.hljs-regexp { + color: #468966; +} + +.hljs-title, +.hljs-section, +.hljs-built_in, +.hljs-name { + color: #ffb03b; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-class .hljs-title, +.hljs-type, +.hljs-tag { + color: #b58900; +} + +.hljs-attribute { + color: #b89859; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link, +.hljs-subst, +.hljs-meta { + color: #cb4b16; +} + +.hljs-deletion { + color: #dc322f; +} + +.hljs-selector-id, +.hljs-selector-class { + color: #d3a60c; +} + +.hljs-formula { + background: #073642; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/pojoaque.jpg b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/pojoaque.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9c07d4ab40b6d77e90ff69f0012bcd33b21d31c3 GIT binary patch literal 1186 zcmZXSe^8Tk9LK-kXFs3)f@f?)Cddzw3v4wdZyXQ;4x3=;Ja*N#%n9ik!UGmt9H3k0 zJST|5jOc(ID$FQt3C?jQZBws#kXolO1lg9Pba9BB=Q+UEBX!nY@6Uhl&+ofe$Q$y5 z@ci`~)&qzDP(lOiQ5p?p z(`j^e7!yUAVHk%K#^GQXn?s0=VLYCI$HRoe=xCuZ>A6A3@sxEP#XqNFpIb=0)KQ#Nss_tD17;m4@$JKL;LR|K|QF3f%!L5+s(9Ft8SQ zG|~pGpEGFW5Z|OA)-O@mNHy-g@7m8JTf?kl@vUKBGmw)Y*9sDRNr3PN!IKefWaydTe1D zjzpyzPnD3}hBNaS4aFX7=0&~I*Hu7#4au@qVBglH#-m;QFOx_`=j z{EqRY#Eh*yoWP^pa4H>8GH{rO?!_+xwL0(k4yL^D%^nBkJ*UI;Lx;ped8d|f*S_s@ z3~ilcRC(&NT#9Gn#UD;o^EYSMXDMf%XcUi3>;WXXD-QX3P9wMyP7eA&RS{)h5{??W3^Rq=goFJ>?lA~J- zdYe>!xvYLW*fPT0RK7wsJRg^?x#W1*GP9_f`6t>QD_X>0d!owyN>nO2?U5}|3?hX_UZYT@^>S!9eB~bZ9U`q;`U)@L670o1g z`Hd}h<_WRvUc|n*%v4Hbb-4tJD40iyF^q%g*&!6>hkYDvi-{Uc4yTM zzcthN4Z{ka!+F_KzYV#yWi;c^X^q6g`pD8cp?$Kl?hCz0s^a|mH%P!CF%*<6k^~i` zT5Mi-t5-frUcHkk^Qh}+N)Kz1&Bi95`oNc|quI>tUi~BY>xcF9(%tv2i{G6kE9*q~ qCoAGl20`)w0rdgp9H%Q=M5|p`hOhFz6$I%Y&ncY8>c?7PXyh+SL&XXJ literal 0 HcmV?d00001 diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/purebasic.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/purebasic.css new file mode 100644 index 0000000000..5ce9b9e071 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/purebasic.css @@ -0,0 +1,96 @@ +/* + +PureBASIC native IDE style ( version 1.0 - April 2016 ) + +by Tristano Ajmone + +Public Domain + +NOTE_1: PureBASIC code syntax highlighting only applies the following classes: + .hljs-comment + .hljs-function + .hljs-keywords + .hljs-string + .hljs-symbol + + Other classes are added here for the benefit of styling other languages with the look and feel of PureBASIC native IDE style. + If you need to customize a stylesheet for PureBASIC only, remove all non-relevant classes -- PureBASIC-related classes are followed by + a "--- used for PureBASIC ... ---" comment on same line. + +NOTE_2: Color names provided in comments were derived using "Name that Color" online tool: + http://chir.ag/projects/name-that-color +*/ + +.hljs { /* Common set of rules required by highlight.js (don'r remove!) */ + display: block; + overflow-x: auto; + padding: 0.5em; + background: #FFFFDF; /* Half and Half (approx.) */ +/* --- Uncomment to add PureBASIC native IDE styled font! + font-family: Consolas; +*/ +} + +.hljs, /* --- used for PureBASIC base color --- */ +.hljs-type, /* --- used for PureBASIC Procedures return type --- */ +.hljs-function, /* --- used for wrapping PureBASIC Procedures definitions --- */ +.hljs-name, +.hljs-number, +.hljs-attr, +.hljs-params, +.hljs-subst { + color: #000000; /* Black */ +} + +.hljs-comment, /* --- used for PureBASIC Comments --- */ +.hljs-regexp, +.hljs-section, +.hljs-selector-pseudo, +.hljs-addition { + color: #00AAAA; /* Persian Green (approx.) */ +} + +.hljs-title, /* --- used for PureBASIC Procedures Names --- */ +.hljs-tag, +.hljs-variable, +.hljs-code { + color: #006666; /* Blue Stone (approx.) */ +} + +.hljs-keyword, /* --- used for PureBASIC Keywords --- */ +.hljs-class, +.hljs-meta-keyword, +.hljs-selector-class, +.hljs-built_in, +.hljs-builtin-name { + color: #006666; /* Blue Stone (approx.) */ + font-weight: bold; +} + +.hljs-string, /* --- used for PureBASIC Strings --- */ +.hljs-selector-attr { + color: #0080FF; /* Azure Radiance (approx.) */ +} + +.hljs-symbol, /* --- used for PureBASIC Constants --- */ +.hljs-link, +.hljs-deletion, +.hljs-attribute { + color: #924B72; /* Cannon Pink (approx.) */ +} + +.hljs-meta, +.hljs-literal, +.hljs-selector-id { + color: #924B72; /* Cannon Pink (approx.) */ + font-weight: bold; +} + +.hljs-strong, +.hljs-name { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/qtcreator_dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/qtcreator_dark.css new file mode 100644 index 0000000000..7aa56a3655 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/qtcreator_dark.css @@ -0,0 +1,83 @@ +/* + +Qt Creator dark color scheme + +*/ + + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #000000; +} + +.hljs, +.hljs-subst, +.hljs-tag, +.hljs-title { + color: #aaaaaa; +} + +.hljs-strong, +.hljs-emphasis { + color: #a8a8a2; +} + +.hljs-bullet, +.hljs-quote, +.hljs-number, +.hljs-regexp, +.hljs-literal { + color: #ff55ff; +} + +.hljs-code +.hljs-selector-class { + color: #aaaaff; +} + +.hljs-emphasis, +.hljs-stronge, +.hljs-type { + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-function, +.hljs-section, +.hljs-symbol, +.hljs-name { + color: #ffff55; +} + +.hljs-attribute { + color: #ff5555; +} + +.hljs-variable, +.hljs-params, +.hljs-class .hljs-title { + color: #8888ff; +} + +.hljs-string, +.hljs-selector-id, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-template-tag, +.hljs-template-variable, +.hljs-addition, +.hljs-link { + color: #ff55ff; +} + +.hljs-comment, +.hljs-meta, +.hljs-deletion { + color: #55ffff; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/qtcreator_light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/qtcreator_light.css new file mode 100644 index 0000000000..1efa2c660f --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/qtcreator_light.css @@ -0,0 +1,83 @@ +/* + +Qt Creator light color scheme + +*/ + + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #ffffff; +} + +.hljs, +.hljs-subst, +.hljs-tag, +.hljs-title { + color: #000000; +} + +.hljs-strong, +.hljs-emphasis { + color: #000000; +} + +.hljs-bullet, +.hljs-quote, +.hljs-number, +.hljs-regexp, +.hljs-literal { + color: #000080; +} + +.hljs-code +.hljs-selector-class { + color: #800080; +} + +.hljs-emphasis, +.hljs-stronge, +.hljs-type { + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-function, +.hljs-section, +.hljs-symbol, +.hljs-name { + color: #808000; +} + +.hljs-attribute { + color: #800000; +} + +.hljs-variable, +.hljs-params, +.hljs-class .hljs-title { + color: #0055AF; +} + +.hljs-string, +.hljs-selector-id, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-template-tag, +.hljs-template-variable, +.hljs-addition, +.hljs-link { + color: #008000; +} + +.hljs-comment, +.hljs-meta, +.hljs-deletion { + color: #008000; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/railscasts.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/railscasts.css new file mode 100644 index 0000000000..008cdc5bf1 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/railscasts.css @@ -0,0 +1,106 @@ +/* + +Railscasts-like style (c) Visoft, Inc. (Damien White) + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #232323; + color: #e6e1dc; +} + +.hljs-comment, +.hljs-quote { + color: #bc9458; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag { + color: #c26230; +} + +.hljs-string, +.hljs-number, +.hljs-regexp, +.hljs-variable, +.hljs-template-variable { + color: #a5c261; +} + +.hljs-subst { + color: #519f50; +} + +.hljs-tag, +.hljs-name { + color: #e8bf6a; +} + +.hljs-type { + color: #da4939; +} + + +.hljs-symbol, +.hljs-bullet, +.hljs-built_in, +.hljs-builtin-name, +.hljs-attr, +.hljs-link { + color: #6d9cbe; +} + +.hljs-params { + color: #d0d0ff; +} + +.hljs-attribute { + color: #cda869; +} + +.hljs-meta { + color: #9b859d; +} + +.hljs-title, +.hljs-section { + color: #ffc66d; +} + +.hljs-addition { + background-color: #144212; + color: #e6e1dc; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #600; + color: #e6e1dc; + display: inline-block; + width: 100%; +} + +.hljs-selector-class { + color: #9b703f; +} + +.hljs-selector-id { + color: #8b98ab; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-link { + text-decoration: underline; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/rainbow.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/rainbow.css new file mode 100644 index 0000000000..905eb8ef18 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/rainbow.css @@ -0,0 +1,85 @@ +/* + +Style with support for rainbow parens + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #474949; + color: #d1d9e1; +} + + +.hljs-comment, +.hljs-quote { + color: #969896; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-type, +.hljs-addition { + color: #cc99cc; +} + +.hljs-number, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #f99157; +} + +.hljs-string, +.hljs-doctag, +.hljs-regexp { + color: #8abeb7; +} + +.hljs-title, +.hljs-name, +.hljs-section, +.hljs-built_in { + color: #b5bd68; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-selector-id, +.hljs-class .hljs-title { + color: #ffcc66; +} + +.hljs-section, +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-subst, +.hljs-meta, +.hljs-link { + color: #f99157; +} + +.hljs-deletion { + color: #dc322f; +} + +.hljs-formula { + background: #eee8d5; +} + +.hljs-attr, +.hljs-attribute { + color: #81a2be; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/routeros.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/routeros.css new file mode 100644 index 0000000000..ebe23990da --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/routeros.css @@ -0,0 +1,108 @@ +/* + + highlight.js style for Microtik RouterOS script + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #F0F0F0; +} + +/* Base color: saturation 0; */ + +.hljs, +.hljs-subst { + color: #444; +} + +.hljs-comment { + color: #888888; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-meta-keyword, +.hljs-doctag, +.hljs-name { + font-weight: bold; +} + +.hljs-attribute { + color: #0E9A00; +} + +.hljs-function { + color: #99069A; +} + +.hljs-builtin-name { + color: #99069A; +} + +/* User color: hue: 0 */ + +.hljs-type, +.hljs-string, +.hljs-number, +.hljs-selector-id, +.hljs-selector-class, +.hljs-quote, +.hljs-template-tag, +.hljs-deletion { + color: #880000; +} + +.hljs-title, +.hljs-section { + color: #880000; + font-weight: bold; +} + +.hljs-regexp, +.hljs-symbol, +.hljs-variable, +.hljs-template-variable, +.hljs-link, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #BC6060; +} + + +/* Language color: hue: 90; */ + +.hljs-literal { + color: #78A960; +} + +.hljs-built_in, +.hljs-bullet, +.hljs-code, +.hljs-addition { + color: #0C9A9A; +} + + +/* Meta color: hue: 200 */ + +.hljs-meta { + color: #1f7199; +} + +.hljs-meta-string { + color: #4d99bf; +} + + +/* Misc effects */ + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/school-book.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/school-book.css new file mode 100644 index 0000000000..964b51d841 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/school-book.css @@ -0,0 +1,72 @@ +/* + +School Book style from goldblog.com.ua (c) Zaripov Yura + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 15px 0.5em 0.5em 30px; + font-size: 11px; + line-height:16px; +} + +pre{ + background:#f6f6ae url(./school-book.png); + border-top: solid 2px #d2e8b9; + border-bottom: solid 1px #d2e8b9; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal { + color:#005599; + font-weight:bold; +} + +.hljs, +.hljs-subst { + color: #3e5915; +} + +.hljs-string, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-symbol, +.hljs-bullet, +.hljs-attribute, +.hljs-built_in, +.hljs-builtin-name, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable, +.hljs-link { + color: #2c009f; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion, +.hljs-meta { + color: #e60415; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-doctag, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-name, +.hljs-selector-id, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/school-book.png b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/school-book.png new file mode 100644 index 0000000000000000000000000000000000000000..956e9790a0e2c079b3d568348ff3accd1d9cac30 GIT binary patch literal 486 zcmeAS@N?(olHy`uVBq!ia0y~yV7?7x3vjRjNjAS6Ga$v1?&#~tz_9*=IcwKTAYZb? zHKHUqKdq!Zu_%?nF(p4KRlzeiF+DXXH8G{K@MNkD0|R4)r;B4q#jQ7Ycl#YS5MfK$ z?b^fh#qmaEhFDxvyThwfhdfkOPApt1lr{NA;Vr%uzxJuVIyzm(ed_8_-0$LLU})H&o5Re&aDemE>EG#(|F^t9_pa-H z_Mf?rMVrs}-M?S|?ZdY@c6s41zy8~}@a{v&#Ea7V)wJ$+#K|u$5UvWCdFLwGac}6w{_s*=8A6L7Rfc|9gboFyt I=akR{0OLZ+qyPW_ literal 0 HcmV?d00001 diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/solarized-dark.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/solarized-dark.css new file mode 100644 index 0000000000..b4c0da1f78 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/solarized-dark.css @@ -0,0 +1,84 @@ +/* + +Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #002b36; + color: #839496; +} + +.hljs-comment, +.hljs-quote { + color: #586e75; +} + +/* Solarized Green */ +.hljs-keyword, +.hljs-selector-tag, +.hljs-addition { + color: #859900; +} + +/* Solarized Cyan */ +.hljs-number, +.hljs-string, +.hljs-meta .hljs-meta-string, +.hljs-literal, +.hljs-doctag, +.hljs-regexp { + color: #2aa198; +} + +/* Solarized Blue */ +.hljs-title, +.hljs-section, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #268bd2; +} + +/* Solarized Yellow */ +.hljs-attribute, +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-class .hljs-title, +.hljs-type { + color: #b58900; +} + +/* Solarized Orange */ +.hljs-symbol, +.hljs-bullet, +.hljs-subst, +.hljs-meta, +.hljs-meta .hljs-keyword, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-link { + color: #cb4b16; +} + +/* Solarized Red */ +.hljs-built_in, +.hljs-deletion { + color: #dc322f; +} + +.hljs-formula { + background: #073642; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/solarized-light.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/solarized-light.css new file mode 100644 index 0000000000..fdcfcc72c4 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/solarized-light.css @@ -0,0 +1,84 @@ +/* + +Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #fdf6e3; + color: #657b83; +} + +.hljs-comment, +.hljs-quote { + color: #93a1a1; +} + +/* Solarized Green */ +.hljs-keyword, +.hljs-selector-tag, +.hljs-addition { + color: #859900; +} + +/* Solarized Cyan */ +.hljs-number, +.hljs-string, +.hljs-meta .hljs-meta-string, +.hljs-literal, +.hljs-doctag, +.hljs-regexp { + color: #2aa198; +} + +/* Solarized Blue */ +.hljs-title, +.hljs-section, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #268bd2; +} + +/* Solarized Yellow */ +.hljs-attribute, +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-class .hljs-title, +.hljs-type { + color: #b58900; +} + +/* Solarized Orange */ +.hljs-symbol, +.hljs-bullet, +.hljs-subst, +.hljs-meta, +.hljs-meta .hljs-keyword, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-link { + color: #cb4b16; +} + +/* Solarized Red */ +.hljs-built_in, +.hljs-deletion { + color: #dc322f; +} + +.hljs-formula { + background: #eee8d5; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/sunburst.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/sunburst.css new file mode 100644 index 0000000000..f56dd5e9b6 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/sunburst.css @@ -0,0 +1,102 @@ +/* + +Sunburst-like style (c) Vasily Polovnyov + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #000; + color: #f8f8f8; +} + +.hljs-comment, +.hljs-quote { + color: #aeaeae; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-type { + color: #e28964; +} + +.hljs-string { + color: #65b042; +} + +.hljs-subst { + color: #daefa3; +} + +.hljs-regexp, +.hljs-link { + color: #e9c062; +} + +.hljs-title, +.hljs-section, +.hljs-tag, +.hljs-name { + color: #89bdff; +} + +.hljs-class .hljs-title, +.hljs-doctag { + text-decoration: underline; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-number { + color: #3387cc; +} + +.hljs-params, +.hljs-variable, +.hljs-template-variable { + color: #3e87e3; +} + +.hljs-attribute { + color: #cda869; +} + +.hljs-meta { + color: #8996a8; +} + +.hljs-formula { + background-color: #0e2231; + color: #f8f8f8; + font-style: italic; +} + +.hljs-addition { + background-color: #253b22; + color: #f8f8f8; +} + +.hljs-deletion { + background-color: #420e09; + color: #f8f8f8; +} + +.hljs-selector-class { + color: #9b703f; +} + +.hljs-selector-id { + color: #8b98ab; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night-blue.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night-blue.css new file mode 100644 index 0000000000..78e59cc8cb --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night-blue.css @@ -0,0 +1,75 @@ +/* Tomorrow Night Blue Theme */ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + +/* Tomorrow Comment */ +.hljs-comment, +.hljs-quote { + color: #7285b7; +} + +/* Tomorrow Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion { + color: #ff9da4; +} + +/* Tomorrow Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link { + color: #ffc58f; +} + +/* Tomorrow Yellow */ +.hljs-attribute { + color: #ffeead; +} + +/* Tomorrow Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #d1f1a9; +} + +/* Tomorrow Blue */ +.hljs-title, +.hljs-section { + color: #bbdaff; +} + +/* Tomorrow Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #ebbbff; +} + +.hljs { + display: block; + overflow-x: auto; + background: #002451; + color: white; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night-bright.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night-bright.css new file mode 100644 index 0000000000..e05af8ae24 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night-bright.css @@ -0,0 +1,74 @@ +/* Tomorrow Night Bright Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + +/* Tomorrow Comment */ +.hljs-comment, +.hljs-quote { + color: #969896; +} + +/* Tomorrow Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion { + color: #d54e53; +} + +/* Tomorrow Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link { + color: #e78c45; +} + +/* Tomorrow Yellow */ +.hljs-attribute { + color: #e7c547; +} + +/* Tomorrow Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #b9ca4a; +} + +/* Tomorrow Blue */ +.hljs-title, +.hljs-section { + color: #7aa6da; +} + +/* Tomorrow Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #c397d8; +} + +.hljs { + display: block; + overflow-x: auto; + background: black; + color: #eaeaea; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night-eighties.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night-eighties.css new file mode 100644 index 0000000000..08fd51c742 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night-eighties.css @@ -0,0 +1,74 @@ +/* Tomorrow Night Eighties Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + +/* Tomorrow Comment */ +.hljs-comment, +.hljs-quote { + color: #999999; +} + +/* Tomorrow Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion { + color: #f2777a; +} + +/* Tomorrow Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link { + color: #f99157; +} + +/* Tomorrow Yellow */ +.hljs-attribute { + color: #ffcc66; +} + +/* Tomorrow Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #99cc99; +} + +/* Tomorrow Blue */ +.hljs-title, +.hljs-section { + color: #6699cc; +} + +/* Tomorrow Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #cc99cc; +} + +.hljs { + display: block; + overflow-x: auto; + background: #2d2d2d; + color: #cccccc; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night.css new file mode 100644 index 0000000000..ddd270a4e7 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow-night.css @@ -0,0 +1,75 @@ +/* Tomorrow Night Theme */ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + +/* Tomorrow Comment */ +.hljs-comment, +.hljs-quote { + color: #969896; +} + +/* Tomorrow Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion { + color: #cc6666; +} + +/* Tomorrow Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link { + color: #de935f; +} + +/* Tomorrow Yellow */ +.hljs-attribute { + color: #f0c674; +} + +/* Tomorrow Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #b5bd68; +} + +/* Tomorrow Blue */ +.hljs-title, +.hljs-section { + color: #81a2be; +} + +/* Tomorrow Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #b294bb; +} + +.hljs { + display: block; + overflow-x: auto; + background: #1d1f21; + color: #c5c8c6; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow.css new file mode 100644 index 0000000000..026a62fe3b --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/tomorrow.css @@ -0,0 +1,72 @@ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + +/* Tomorrow Comment */ +.hljs-comment, +.hljs-quote { + color: #8e908c; +} + +/* Tomorrow Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion { + color: #c82829; +} + +/* Tomorrow Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link { + color: #f5871f; +} + +/* Tomorrow Yellow */ +.hljs-attribute { + color: #eab700; +} + +/* Tomorrow Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #718c00; +} + +/* Tomorrow Blue */ +.hljs-title, +.hljs-section { + color: #4271ae; +} + +/* Tomorrow Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #8959a8; +} + +.hljs { + display: block; + overflow-x: auto; + background: white; + color: #4d4d4c; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/vs.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/vs.css new file mode 100644 index 0000000000..c5d07d3115 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/vs.css @@ -0,0 +1,68 @@ +/* + +Visual Studio-like style based on original C# coloring by Jason Diamond + +*/ +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: white; + color: black; +} + +.hljs-comment, +.hljs-quote, +.hljs-variable { + color: #008000; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-built_in, +.hljs-name, +.hljs-tag { + color: #00f; +} + +.hljs-string, +.hljs-title, +.hljs-section, +.hljs-attribute, +.hljs-literal, +.hljs-template-tag, +.hljs-template-variable, +.hljs-type, +.hljs-addition { + color: #a31515; +} + +.hljs-deletion, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-meta { + color: #2b91af; +} + +.hljs-doctag { + color: #808080; +} + +.hljs-attr { + color: #f00; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link { + color: #00b0e8; +} + + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/vs2015.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/vs2015.css new file mode 100644 index 0000000000..d1d9be3caa --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/vs2015.css @@ -0,0 +1,115 @@ +/* + * Visual Studio 2015 dark style + * Author: Nicolas LLOBERA + */ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #1E1E1E; + color: #DCDCDC; +} + +.hljs-keyword, +.hljs-literal, +.hljs-symbol, +.hljs-name { + color: #569CD6; +} +.hljs-link { + color: #569CD6; + text-decoration: underline; +} + +.hljs-built_in, +.hljs-type { + color: #4EC9B0; +} + +.hljs-number, +.hljs-class { + color: #B8D7A3; +} + +.hljs-string, +.hljs-meta-string { + color: #D69D85; +} + +.hljs-regexp, +.hljs-template-tag { + color: #9A5334; +} + +.hljs-subst, +.hljs-function, +.hljs-title, +.hljs-params, +.hljs-formula { + color: #DCDCDC; +} + +.hljs-comment, +.hljs-quote { + color: #57A64A; + font-style: italic; +} + +.hljs-doctag { + color: #608B4E; +} + +.hljs-meta, +.hljs-meta-keyword, +.hljs-tag { + color: #9B9B9B; +} + +.hljs-variable, +.hljs-template-variable { + color: #BD63C5; +} + +.hljs-attr, +.hljs-attribute, +.hljs-builtin-name { + color: #9CDCFE; +} + +.hljs-section { + color: gold; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +/*.hljs-code { + font-family:'Monospace'; +}*/ + +.hljs-bullet, +.hljs-selector-tag, +.hljs-selector-id, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #D7BA7D; +} + +.hljs-addition { + background-color: #144212; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #600; + display: inline-block; + width: 100%; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/xcode.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/xcode.css new file mode 100644 index 0000000000..43dddad84d --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/xcode.css @@ -0,0 +1,93 @@ +/* + +XCode style (c) Angel Garcia + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #fff; + color: black; +} + +.hljs-comment, +.hljs-quote { + color: #006a00; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal { + color: #aa0d91; +} + +.hljs-name { + color: #008; +} + +.hljs-variable, +.hljs-template-variable { + color: #660; +} + +.hljs-string { + color: #c41a16; +} + +.hljs-regexp, +.hljs-link { + color: #080; +} + +.hljs-title, +.hljs-tag, +.hljs-symbol, +.hljs-bullet, +.hljs-number, +.hljs-meta { + color: #1c00cf; +} + +.hljs-section, +.hljs-class .hljs-title, +.hljs-type, +.hljs-attr, +.hljs-built_in, +.hljs-builtin-name, +.hljs-params { + color: #5c2699; +} + +.hljs-attribute, +.hljs-subst { + color: #000; +} + +.hljs-formula { + background-color: #eee; + font-style: italic; +} + +.hljs-addition { + background-color: #baeeba; +} + +.hljs-deletion { + background-color: #ffc8bd; +} + +.hljs-selector-id, +.hljs-selector-class { + color: #9b703f; +} + +.hljs-doctag, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/xt256.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/xt256.css new file mode 100644 index 0000000000..58df82cb75 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/xt256.css @@ -0,0 +1,92 @@ + +/* + xt256.css + + Contact: initbar [at] protonmail [dot] ch + : github.com/initbar +*/ + +.hljs { + display: block; + overflow-x: auto; + color: #eaeaea; + background: #000; + padding: 0.5; +} + +.hljs-subst { + color: #eaeaea; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-builtin-name, +.hljs-type { + color: #eaeaea; +} + +.hljs-params { + color: #da0000; +} + +.hljs-literal, +.hljs-number, +.hljs-name { + color: #ff0000; + font-weight: bolder; +} + +.hljs-comment { + color: #969896; +} + +.hljs-selector-id, +.hljs-quote { + color: #00ffff; +} + +.hljs-template-variable, +.hljs-variable, +.hljs-title { + color: #00ffff; + font-weight: bold; +} + +.hljs-selector-class, +.hljs-keyword, +.hljs-symbol { + color: #fff000; +} + +.hljs-string, +.hljs-bullet { + color: #00ff00; +} + +.hljs-tag, +.hljs-section { + color: #000fff; +} + +.hljs-selector-tag { + color: #000fff; + font-weight: bold; +} + +.hljs-attribute, +.hljs-built_in, +.hljs-regexp, +.hljs-link { + color: #ff00ff; +} + +.hljs-meta { + color: #fff; + font-weight: bolder; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/zenburn.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/zenburn.css new file mode 100644 index 0000000000..07be502016 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/highlight.js/styles/zenburn.css @@ -0,0 +1,80 @@ +/* + +Zenburn style from voldmar.ru (c) Vladimir Epifanov +based on dark.css by Ivan Sagalaev + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #3f3f3f; + color: #dcdcdc; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-tag { + color: #e3ceab; +} + +.hljs-template-tag { + color: #dcdcdc; +} + +.hljs-number { + color: #8cd0d3; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-attribute { + color: #efdcbc; +} + +.hljs-literal { + color: #efefaf; +} + +.hljs-subst { + color: #8f8f8f; +} + +.hljs-title, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-section, +.hljs-type { + color: #efef8f; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link { + color: #dca3a3; +} + +.hljs-deletion, +.hljs-string, +.hljs-built_in, +.hljs-builtin-name { + color: #cc9393; +} + +.hljs-addition, +.hljs-comment, +.hljs-quote, +.hljs-meta { + color: #7f9f7f; +} + + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/markdown-it/markdown-it.min.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/markdown-it/markdown-it.min.js new file mode 100644 index 0000000000..9607298473 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/markdown-it/markdown-it.min.js @@ -0,0 +1 @@ +/*! markdown-it 11.0.1 https://github.com//markdown-it/markdown-it @license MIT */!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).markdownit=e()}}((function(){return function e(r,t,n){function s(i,a){if(!t[i]){if(!r[i]){var c="function"==typeof require&&require;if(!a&&c)return c(i,!0);if(o)return o(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var u=t[i]={exports:{}};r[i][0].call(u.exports,(function(e){return s(r[i][1][e]||e)}),u,u.exports,e,r,t,n)}return t[i].exports}for(var o="function"==typeof require&&require,i=0;i`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>",s="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",o=new RegExp("^(?:"+n+"|"+s+"|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|<[?].*?[?]>|]*>|)"),i=new RegExp("^(?:"+n+"|"+s+")");r.exports.HTML_TAG_RE=o,r.exports.HTML_OPEN_CLOSE_TAG_RE=i},{}],4:[function(e,r,t){"use strict";var n=Object.prototype.hasOwnProperty;function s(e,r){return n.call(e,r)}function o(e){return!(e>=55296&&e<=57343)&&(!(e>=64976&&e<=65007)&&(65535!=(65535&e)&&65534!=(65535&e)&&(!(e>=0&&e<=8)&&(11!==e&&(!(e>=14&&e<=31)&&(!(e>=127&&e<=159)&&!(e>1114111)))))))}function i(e){if(e>65535){var r=55296+((e-=65536)>>10),t=56320+(1023&e);return String.fromCharCode(r,t)}return String.fromCharCode(e)}var a=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,c=new RegExp(a.source+"|"+/&([a-z#][a-z0-9]{1,31});/gi.source,"gi"),l=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,u=e("./entities");var p=/[&<>"]/,h=/[&<>"]/g,f={"&":"&","<":"<",">":">",'"':"""};function d(e){return f[e]}var m=/[.?*+^$[\]\\(){}|-]/g;var _=e("uc.micro/categories/P/regex");t.lib={},t.lib.mdurl=e("mdurl"),t.lib.ucmicro=e("uc.micro"),t.assign=function(e){var r=Array.prototype.slice.call(arguments,1);return r.forEach((function(r){if(r){if("object"!=typeof r)throw new TypeError(r+"must be object");Object.keys(r).forEach((function(t){e[t]=r[t]}))}})),e},t.isString=function(e){return"[object String]"===function(e){return Object.prototype.toString.call(e)}(e)},t.has=s,t.unescapeMd=function(e){return e.indexOf("\\")<0?e:e.replace(a,"$1")},t.unescapeAll=function(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(c,(function(e,r,t){return r||function(e,r){var t=0;return s(u,r)?u[r]:35===r.charCodeAt(0)&&l.test(r)&&o(t="x"===r[1].toLowerCase()?parseInt(r.slice(2),16):parseInt(r.slice(1),10))?i(t):e}(e,t)}))},t.isValidEntityCode=o,t.fromCodePoint=i,t.escapeHtml=function(e){return p.test(e)?e.replace(h,d):e},t.arrayReplaceAt=function(e,r,t){return[].concat(e.slice(0,r),t,e.slice(r+1))},t.isSpace=function(e){switch(e){case 9:case 32:return!0}return!1},t.isWhiteSpace=function(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1},t.isMdAsciiPunct=function(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}},t.isPunctChar=function(e){return _.test(e)},t.escapeRE=function(e){return e.replace(m,"\\$&")},t.normalizeReference=function(e){return e=e.trim().replace(/\s+/g," "),"\u1e7e"==="\u1e9e".toLowerCase()&&(e=e.replace(/\u1e9e/g,"\xdf")),e.toLowerCase().toUpperCase()}},{"./entities":1,mdurl:58,"uc.micro":65,"uc.micro/categories/P/regex":63}],5:[function(e,r,t){"use strict";t.parseLinkLabel=e("./parse_link_label"),t.parseLinkDestination=e("./parse_link_destination"),t.parseLinkTitle=e("./parse_link_title")},{"./parse_link_destination":6,"./parse_link_label":7,"./parse_link_title":8}],6:[function(e,r,t){"use strict";var n=e("../common/utils").unescapeAll;r.exports=function(e,r,t){var s,o,i=r,a={ok:!1,pos:0,lines:0,str:""};if(60===e.charCodeAt(r)){for(r++;r=t)return c;if(34!==(o=e.charCodeAt(r))&&39!==o&&40!==o)return c;for(r++,40===o&&(o=41);r=0))try{r.hostname=p.toASCII(r.hostname)}catch(e){}return u.encode(u.format(r))}function k(e){var r=u.parse(e,!0);if(r.hostname&&(!r.protocol||_.indexOf(r.protocol)>=0))try{r.hostname=p.toUnicode(r.hostname)}catch(e){}return u.decode(u.format(r))}function b(e,r){if(!(this instanceof b))return new b(e,r);r||n.isString(e)||(r=e||{},e="default"),this.inline=new c,this.block=new a,this.core=new i,this.renderer=new o,this.linkify=new l,this.validateLink=m,this.normalizeLink=g,this.normalizeLinkText=k,this.utils=n,this.helpers=n.assign({},s),this.options={},this.configure(e),r&&this.set(r)}b.prototype.set=function(e){return n.assign(this.options,e),this},b.prototype.configure=function(e){var r,t=this;if(n.isString(e)&&!(e=h[r=e]))throw new Error('Wrong `markdown-it` preset "'+r+'", check name');if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach((function(r){e.components[r].rules&&t[r].ruler.enableOnly(e.components[r].rules),e.components[r].rules2&&t[r].ruler2.enableOnly(e.components[r].rules2)})),this},b.prototype.enable=function(e,r){var t=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach((function(r){t=t.concat(this[r].ruler.enable(e,!0))}),this),t=t.concat(this.inline.ruler2.enable(e,!0));var n=e.filter((function(e){return t.indexOf(e)<0}));if(n.length&&!r)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+n);return this},b.prototype.disable=function(e,r){var t=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach((function(r){t=t.concat(this[r].ruler.disable(e,!0))}),this),t=t.concat(this.inline.ruler2.disable(e,!0));var n=e.filter((function(e){return t.indexOf(e)<0}));if(n.length&&!r)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+n);return this},b.prototype.use=function(e){var r=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,r),this},b.prototype.parse=function(e,r){if("string"!=typeof e)throw new Error("Input data should be a String");var t=new this.core.State(e,this,r);return this.core.process(t),t.tokens},b.prototype.render=function(e,r){return r=r||{},this.renderer.render(this.parse(e,r),this.options,r)},b.prototype.parseInline=function(e,r){var t=new this.core.State(e,this,r);return t.inlineMode=!0,this.core.process(t),t.tokens},b.prototype.renderInline=function(e,r){return r=r||{},this.renderer.render(this.parseInline(e,r),this.options,r)},r.exports=b},{"./common/utils":4,"./helpers":5,"./parser_block":10,"./parser_core":11,"./parser_inline":12,"./presets/commonmark":13,"./presets/default":14,"./presets/zero":15,"./renderer":16,"linkify-it":53,mdurl:58,punycode:60}],10:[function(e,r,t){"use strict";var n=e("./ruler"),s=[["table",e("./rules_block/table"),["paragraph","reference"]],["code",e("./rules_block/code")],["fence",e("./rules_block/fence"),["paragraph","reference","blockquote","list"]],["blockquote",e("./rules_block/blockquote"),["paragraph","reference","blockquote","list"]],["hr",e("./rules_block/hr"),["paragraph","reference","blockquote","list"]],["list",e("./rules_block/list"),["paragraph","reference","blockquote"]],["reference",e("./rules_block/reference")],["heading",e("./rules_block/heading"),["paragraph","reference","blockquote"]],["lheading",e("./rules_block/lheading")],["html_block",e("./rules_block/html_block"),["paragraph","reference","blockquote"]],["paragraph",e("./rules_block/paragraph")]];function o(){this.ruler=new n;for(var e=0;e=t))&&!(e.sCount[i]=c){e.line=t;break}for(n=0;n=o)break}else e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},i.prototype.parse=function(e,r,t,n){var s,o,i,a=new this.State(e,r,t,n);for(this.tokenize(a),i=(o=this.ruler2.getRules("")).length,s=0;s"+o(e[r].content)+""},i.code_block=function(e,r,t,n,s){var i=e[r];return""+o(e[r].content)+"\n"},i.fence=function(e,r,t,n,i){var a,c,l,u,p=e[r],h=p.info?s(p.info).trim():"",f="";return h&&(f=h.split(/\s+/g)[0]),0===(a=t.highlight&&t.highlight(p.content,f)||o(p.content)).indexOf(""+a+"\n"):"
"+a+"
\n"},i.image=function(e,r,t,n,s){var o=e[r];return o.attrs[o.attrIndex("alt")][1]=s.renderInlineAsText(o.children,t,n),s.renderToken(e,r,t)},i.hardbreak=function(e,r,t){return t.xhtmlOut?"
\n":"
\n"},i.softbreak=function(e,r,t){return t.breaks?t.xhtmlOut?"
\n":"
\n":"\n"},i.text=function(e,r){return o(e[r].content)},i.html_block=function(e,r){return e[r].content},i.html_inline=function(e,r){return e[r].content},a.prototype.renderAttrs=function(e){var r,t,n;if(!e.attrs)return"";for(n="",r=0,t=e.attrs.length;r\n":">")},a.prototype.renderInline=function(e,r,t){for(var n,s="",o=this.rules,i=0,a=e.length;i=4)return!1;if(62!==e.src.charCodeAt(D++))return!1;if(s)return!0;for(c=f=e.sCount[r]+1,32===e.src.charCodeAt(D)?(D++,c++,f++,o=!1,v=!0):9===e.src.charCodeAt(D)?(v=!0,(e.bsCount[r]+f)%4==3?(D++,c++,f++,o=!1):o=!0):v=!1,d=[e.bMarks[r]],e.bMarks[r]=D;D=E,k=[e.sCount[r]],e.sCount[r]=f-c,b=[e.tShift[r]],e.tShift[r]=D-e.bMarks[r],y=e.md.block.ruler.getRules("blockquote"),g=e.parentType,e.parentType="blockquote",h=r+1;h=(E=e.eMarks[h])));h++)if(62!==e.src.charCodeAt(D++)||A){if(u)break;for(C=!1,a=0,l=y.length;a=E,m.push(e.bsCount[h]),e.bsCount[h]=e.sCount[h]+1+(v?1:0),k.push(e.sCount[h]),e.sCount[h]=f-c,b.push(e.tShift[h]),e.tShift[h]=D-e.bMarks[h]}for(_=e.blkIndent,e.blkIndent=0,(x=e.push("blockquote_open","blockquote",1)).markup=">",x.map=p=[r,0],e.md.block.tokenize(e,r,h),(x=e.push("blockquote_close","blockquote",-1)).markup=">",e.lineMax=w,e.parentType=g,p[1]=e.line,a=0;a=4))break;s=++n}return e.line=s,(o=e.push("code_block","code",0)).content=e.getLines(r,s,4+e.blkIndent,!0),o.map=[r,e.line],!0}},{}],20:[function(e,r,t){"use strict";r.exports=function(e,r,t,n){var s,o,i,a,c,l,u,p=!1,h=e.bMarks[r]+e.tShift[r],f=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4)return!1;if(h+3>f)return!1;if(126!==(s=e.src.charCodeAt(h))&&96!==s)return!1;if(c=h,(o=(h=e.skipChars(h,s))-c)<3)return!1;if(u=e.src.slice(c,h),i=e.src.slice(h,f),96===s&&i.indexOf(String.fromCharCode(s))>=0)return!1;if(n)return!0;for(a=r;!(++a>=t)&&!((h=c=e.bMarks[a]+e.tShift[a])<(f=e.eMarks[a])&&e.sCount[a]=4||(h=e.skipChars(h,s))-c=4)return!1;if(35!==(o=e.src.charCodeAt(l))||l>=u)return!1;for(i=1,o=e.src.charCodeAt(++l);35===o&&l6||ll&&n(e.src.charCodeAt(a-1))&&(u=a),e.line=r+1,(c=e.push("heading_open","h"+String(i),1)).markup="########".slice(0,i),c.map=[r,e.line],(c=e.push("inline","",0)).content=e.src.slice(l,u).trim(),c.map=[r,e.line],c.children=[],(c=e.push("heading_close","h"+String(i),-1)).markup="########".slice(0,i)),!0)}},{"../common/utils":4}],22:[function(e,r,t){"use strict";var n=e("../common/utils").isSpace;r.exports=function(e,r,t,s){var o,i,a,c,l=e.bMarks[r]+e.tShift[r],u=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4)return!1;if(42!==(o=e.src.charCodeAt(l++))&&45!==o&&95!==o)return!1;for(i=1;l|$))/i,/<\/(script|pre|style)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(s.source+"\\s*$"),/^$/,!1]];r.exports=function(e,r,t,n){var s,i,a,c,l=e.bMarks[r]+e.tShift[r],u=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4)return!1;if(!e.md.options.html)return!1;if(60!==e.src.charCodeAt(l))return!1;for(c=e.src.slice(l,u),s=0;s=4)return!1;for(h=e.parentType,e.parentType="paragraph";f3)){if(e.sCount[f]>=e.blkIndent&&(c=e.bMarks[f]+e.tShift[f])<(l=e.eMarks[f])&&(45===(p=e.src.charCodeAt(c))||61===p)&&(c=e.skipChars(c,p),(c=e.skipSpaces(c))>=l)){u=61===p?1:2;break}if(!(e.sCount[f]<0)){for(s=!1,o=0,i=d.length;o=i)return-1;if((t=e.src.charCodeAt(o++))<48||t>57)return-1;for(;;){if(o>=i)return-1;if(!((t=e.src.charCodeAt(o++))>=48&&t<=57)){if(41===t||46===t)break;return-1}if(o-s>=10)return-1}return o=4)return!1;if(e.listIndent>=0&&e.sCount[r]-e.listIndent>=4&&e.sCount[r]=e.blkIndent&&(I=!0),(q=o(e,r))>=0){if(h=!0,S=e.bMarks[r]+e.tShift[r],k=Number(e.src.substr(S,q-S-1)),I&&1!==k)return!1}else{if(!((q=s(e,r))>=0))return!1;h=!1}if(I&&e.skipSpaces(q)>=e.eMarks[r])return!1;if(g=e.src.charCodeAt(q-1),n)return!0;for(_=e.tokens.length,h?(T=e.push("ordered_list_open","ol",1),1!==k&&(T.attrs=[["start",k]])):T=e.push("bullet_list_open","ul",1),T.map=m=[r,0],T.markup=String.fromCharCode(g),v=r,F=!1,z=e.md.block.ruler.getRules("list"),x=e.parentType,e.parentType="list";v=b?1:C-p)>4&&(u=1),l=p+u,(T=e.push("list_item_open","li",1)).markup=String.fromCharCode(g),T.map=f=[r,0],D=e.tight,w=e.tShift[r],A=e.sCount[r],y=e.listIndent,e.listIndent=e.blkIndent,e.blkIndent=l,e.tight=!0,e.tShift[r]=a-e.bMarks[r],e.sCount[r]=C,a>=b&&e.isEmpty(r+1)?e.line=Math.min(e.line+2,t):e.md.block.tokenize(e,r,t,!0),e.tight&&!F||(R=!1),F=e.line-r>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=y,e.tShift[r]=w,e.sCount[r]=A,e.tight=D,(T=e.push("list_item_close","li",-1)).markup=String.fromCharCode(g),v=r=e.line,f[1]=v,a=e.bMarks[r],v>=t)break;if(e.sCount[v]=4)break;for(L=!1,c=0,d=z.length;c3||e.sCount[c]<0)){for(n=!1,s=0,o=l.length;s=4)return!1;if(91!==e.src.charCodeAt(x))return!1;for(;++x3||e.sCount[w]<0)){for(b=!1,p=0,h=v.length;p0&&this.level++,this.tokens.push(s),s},o.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},o.prototype.skipEmptyLines=function(e){for(var r=this.lineMax;er;)if(!s(this.src.charCodeAt(--e)))return e+1;return e},o.prototype.skipChars=function(e,r){for(var t=this.src.length;et;)if(r!==this.src.charCodeAt(--e))return e+1;return e},o.prototype.getLines=function(e,r,t,n){var o,i,a,c,l,u,p,h=e;if(e>=r)return"";for(u=new Array(r-e),o=0;ht?new Array(i-t+1).join(" ")+this.src.slice(c,l):this.src.slice(c,l)}return u.join("")},o.prototype.Token=n,r.exports=o},{"../common/utils":4,"../token":51}],29:[function(e,r,t){"use strict";var n=e("../common/utils").isSpace;function s(e,r){var t=e.bMarks[r]+e.blkIndent,n=e.eMarks[r];return e.src.substr(t,n-t)}function o(e){var r,t=[],n=0,s=e.length,o=0,i=0,a=!1,c=0;for(r=e.charCodeAt(n);nt)return!1;if(p=r+1,e.sCount[p]=4)return!1;if((l=e.bMarks[p]+e.tShift[p])>=e.eMarks[p])return!1;if(124!==(a=e.src.charCodeAt(l++))&&45!==a&&58!==a)return!1;for(;l=4)return!1;if((f=(h=o(c.replace(/^\||\|$/g,""))).length)>m.length)return!1;if(i)return!0;for((d=e.push("table_open","table",1)).map=g=[r,0],(d=e.push("thead_open","thead",1)).map=[r,r+1],(d=e.push("tr_open","tr",1)).map=[r,r+1],u=0;u=4);p++){for(h=o(c.replace(/^\||\|$/g,"")),d=e.push("tr_open","tr",1),u=0;u/i.test(e)}r.exports=function(e){var r,t,o,i,a,c,l,u,p,h,f,d,m,_,g,k,b,v,C=e.tokens;if(e.md.options.linkify)for(t=0,o=C.length;t=0;r--)if("link_close"!==(c=i[r]).type){if("html_inline"===c.type&&(v=c.content,/^\s]/i.test(v)&&m>0&&m--,s(c.content)&&m++),!(m>0)&&"text"===c.type&&e.md.linkify.test(c.content)){for(p=c.content,b=e.md.linkify.match(p),l=[],d=c.level,f=0,u=0;uf&&((a=new e.Token("text","",0)).content=p.slice(f,h),a.level=d,l.push(a)),(a=new e.Token("link_open","a",1)).attrs=[["href",g]],a.level=d++,a.markup="linkify",a.info="auto",l.push(a),(a=new e.Token("text","",0)).content=k,a.level=d,l.push(a),(a=new e.Token("link_close","a",-1)).level=--d,a.markup="linkify",a.info="auto",l.push(a),f=b[u].lastIndex);f=0;r--)"text"!==(t=e[r]).type||n||(t.content=t.content.replace(o,a)),"link_open"===t.type&&"auto"===t.info&&n--,"link_close"===t.type&&"auto"===t.info&&n++}function l(e){var r,t,s=0;for(r=e.length-1;r>=0;r--)"text"!==(t=e[r]).type||s||n.test(t.content)&&(t.content=t.content.replace(/\+-/g,"\xb1").replace(/\.{2,}/g,"\u2026").replace(/([?!])\u2026/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/gm,"$1\u2014").replace(/(^|\s)--(?=\s|$)/gm,"$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,"$1\u2013")),"link_open"===t.type&&"auto"===t.info&&s--,"link_close"===t.type&&"auto"===t.info&&s++}r.exports=function(e){var r;if(e.md.options.typographer)for(r=e.tokens.length-1;r>=0;r--)"inline"===e.tokens[r].type&&(s.test(e.tokens[r].content)&&c(e.tokens[r].children),n.test(e.tokens[r].content)&&l(e.tokens[r].children))}},{}],35:[function(e,r,t){"use strict";var n=e("../common/utils").isWhiteSpace,s=e("../common/utils").isPunctChar,o=e("../common/utils").isMdAsciiPunct,i=/['"]/,a=/['"]/g;function c(e,r,t){return e.substr(0,r)+t+e.substr(r+1)}function l(e,r){var t,i,l,u,p,h,f,d,m,_,g,k,b,v,C,y,x,A,w,D,E;for(w=[],t=0;t=0&&!(w[x].level<=f);x--);if(w.length=x+1,"text"===i.type){p=0,h=(l=i.content).length;e:for(;p=0)m=l.charCodeAt(u.index-1);else for(x=t-1;x>=0&&("softbreak"!==e[x].type&&"hardbreak"!==e[x].type);x--)if(e[x].content){m=e[x].content.charCodeAt(e[x].content.length-1);break}if(_=32,p=48&&m<=57&&(y=C=!1),C&&y&&(C=g,y=k),C||y){if(y)for(x=w.length-1;x>=0&&(d=w[x],!(w[x].level=0;r--)"inline"===e.tokens[r].type&&i.test(e.tokens[r].content)&&l(e.tokens[r].children,e)}},{"../common/utils":4}],36:[function(e,r,t){"use strict";var n=e("../token");function s(e,r,t){this.src=e,this.env=t,this.tokens=[],this.inlineMode=!1,this.md=r}s.prototype.Token=n,r.exports=s},{"../token":51}],37:[function(e,r,t){"use strict";var n=/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/,s=/^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/;r.exports=function(e,r){var t,o,i,a,c,l,u=e.pos;return 60===e.src.charCodeAt(u)&&(!((t=e.src.slice(u)).indexOf(">")<0)&&(s.test(t)?(a=(o=t.match(s))[0].slice(1,-1),c=e.md.normalizeLink(a),!!e.md.validateLink(c)&&(r||((l=e.push("link_open","a",1)).attrs=[["href",c]],l.markup="autolink",l.info="auto",(l=e.push("text","",0)).content=e.md.normalizeLinkText(a),(l=e.push("link_close","a",-1)).markup="autolink",l.info="auto"),e.pos+=o[0].length,!0)):!!n.test(t)&&(a=(i=t.match(n))[0].slice(1,-1),c=e.md.normalizeLink("mailto:"+a),!!e.md.validateLink(c)&&(r||((l=e.push("link_open","a",1)).attrs=[["href",c]],l.markup="autolink",l.info="auto",(l=e.push("text","",0)).content=e.md.normalizeLinkText(a),(l=e.push("link_close","a",-1)).markup="autolink",l.info="auto"),e.pos+=i[0].length,!0))))}},{}],38:[function(e,r,t){"use strict";r.exports=function(e,r){var t,n,s,o,i,a,c=e.pos;if(96!==e.src.charCodeAt(c))return!1;for(t=c,c++,n=e.posMax;ci;n-=o.jump+1)if((o=r[n]).marker===s.marker&&(-1===a&&(a=n),o.open&&o.end<0&&(c=!1,(o.close||s.open)&&(o.length+s.length)%3==0&&(o.length%3==0&&s.length%3==0||(c=!0)),!c))){l=n>0&&!r[n-1].open?r[n-1].jump+1:0,s.jump=t-n+l,s.open=!1,o.end=t,o.jump=l,o.close=!1,a=-1;break}-1!==a&&(u[s.marker][(s.length||0)%3]=a)}}r.exports=function(e){var r,t=e.tokens_meta,s=e.tokens_meta.length;for(n(0,e.delimiters),r=0;r=0;t--)95!==(n=r[t]).marker&&42!==n.marker||-1!==n.end&&(s=r[n.end],a=t>0&&r[t-1].end===n.end+1&&r[t-1].token===n.token-1&&r[n.end+1].token===s.token+1&&r[t-1].marker===n.marker,i=String.fromCharCode(n.marker),(o=e.tokens[n.token]).type=a?"strong_open":"em_open",o.tag=a?"strong":"em",o.nesting=1,o.markup=a?i+i:i,o.content="",(o=e.tokens[s.token]).type=a?"strong_close":"em_close",o.tag=a?"strong":"em",o.nesting=-1,o.markup=a?i+i:i,o.content="",a&&(e.tokens[r[t-1].token].content="",e.tokens[r[n.end+1].token].content="",t--))}r.exports.tokenize=function(e,r){var t,n,s=e.pos,o=e.src.charCodeAt(s);if(r)return!1;if(95!==o&&42!==o)return!1;for(n=e.scanDelims(e.pos,42===o),t=0;t?@[]^_`{|}~-".split("").forEach((function(e){s[e.charCodeAt(0)]=1})),r.exports=function(e,r){var t,o=e.pos,i=e.posMax;if(92!==e.src.charCodeAt(o))return!1;if(++o=o)&&(!(33!==(t=e.src.charCodeAt(i+1))&&63!==t&&47!==t&&!function(e){var r=32|e;return r>=97&&r<=122}(t))&&(!!(s=e.src.slice(i).match(n))&&(r||(e.push("html_inline","",0).content=e.src.slice(i,i+s[0].length)),e.pos+=s[0].length,!0))))}},{"../common/html_re":3}],44:[function(e,r,t){"use strict";var n=e("../common/utils").normalizeReference,s=e("../common/utils").isSpace;r.exports=function(e,r){var t,o,i,a,c,l,u,p,h,f,d,m,_,g="",k=e.pos,b=e.posMax;if(33!==e.src.charCodeAt(e.pos))return!1;if(91!==e.src.charCodeAt(e.pos+1))return!1;if(l=e.pos+2,(c=e.md.helpers.parseLinkLabel(e,e.pos+1,!1))<0)return!1;if((u=c+1)=b)return!1;for(_=u,(h=e.md.helpers.parseLinkDestination(e.src,u,e.posMax)).ok&&(g=e.md.normalizeLink(h.str),e.md.validateLink(g)?u=h.pos:g=""),_=u;u=b||41!==e.src.charCodeAt(u))return e.pos=k,!1;u++}else{if(void 0===e.env.references)return!1;if(u=0?a=e.src.slice(_,u++):u=c+1):u=c+1,a||(a=e.src.slice(l,c)),!(p=e.env.references[n(a)]))return e.pos=k,!1;g=p.href,f=p.title}return r||(i=e.src.slice(l,c),e.md.inline.parse(i,e.md,e.env,m=[]),(d=e.push("image","img",0)).attrs=t=[["src",g],["alt",""]],d.children=m,d.content=i,f&&t.push(["title",f])),e.pos=u,e.posMax=b,!0}},{"../common/utils":4}],45:[function(e,r,t){"use strict";var n=e("../common/utils").normalizeReference,s=e("../common/utils").isSpace;r.exports=function(e,r){var t,o,i,a,c,l,u,p,h,f="",d=e.pos,m=e.posMax,_=e.pos,g=!0;if(91!==e.src.charCodeAt(e.pos))return!1;if(c=e.pos+1,(a=e.md.helpers.parseLinkLabel(e,e.pos,!0))<0)return!1;if((l=a+1)=m)return!1;for(_=l,(u=e.md.helpers.parseLinkDestination(e.src,l,e.posMax)).ok&&(f=e.md.normalizeLink(u.str),e.md.validateLink(f)?l=u.pos:f=""),_=l;l=m||41!==e.src.charCodeAt(l))&&(g=!0),l++}if(g){if(void 0===e.env.references)return!1;if(l=0?i=e.src.slice(_,l++):l=a+1):l=a+1,i||(i=e.src.slice(c,a)),!(p=e.env.references[n(i)]))return e.pos=d,!1;f=p.href,h=p.title}return r||(e.pos=c,e.posMax=a,e.push("link_open","a",1).attrs=t=[["href",f]],h&&t.push(["title",h]),e.md.inline.tokenize(e),e.push("link_close","a",-1)),e.pos=l,e.posMax=m,!0}},{"../common/utils":4}],46:[function(e,r,t){"use strict";var n=e("../common/utils").isSpace;r.exports=function(e,r){var t,s,o=e.pos;if(10!==e.src.charCodeAt(o))return!1;for(t=e.pending.length-1,s=e.posMax,r||(t>=0&&32===e.pending.charCodeAt(t)?t>=1&&32===e.pending.charCodeAt(t-1)?(e.pending=e.pending.replace(/ +$/,""),e.push("hardbreak","br",0)):(e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0)):e.push("softbreak","br",0)),o++;o0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],o={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(s),this.tokens_meta.push(o),s},a.prototype.scanDelims=function(e,r){var t,n,a,c,l,u,p,h,f,d=e,m=!0,_=!0,g=this.posMax,k=this.src.charCodeAt(e);for(t=e>0?this.src.charCodeAt(e-1):32;d0&&n++,"text"===s[r].type&&r+1=0&&(t=this.attrs[r][1]),t},n.prototype.attrJoin=function(e,r){var t=this.attrIndex(e);t<0?this.attrPush([e,r]):this.attrs[t][1]=this.attrs[t][1]+" "+r},r.exports=n},{}],52:[function(e,r,t){r.exports={Aacute:"\xc1",aacute:"\xe1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223e",acd:"\u223f",acE:"\u223e\u0333",Acirc:"\xc2",acirc:"\xe2",acute:"\xb4",Acy:"\u0410",acy:"\u0430",AElig:"\xc6",aelig:"\xe6",af:"\u2061",Afr:"\ud835\udd04",afr:"\ud835\udd1e",Agrave:"\xc0",agrave:"\xe0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03b1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2a3f",amp:"&",AMP:"&",andand:"\u2a55",And:"\u2a53",and:"\u2227",andd:"\u2a5c",andslope:"\u2a58",andv:"\u2a5a",ang:"\u2220",ange:"\u29a4",angle:"\u2220",angmsdaa:"\u29a8",angmsdab:"\u29a9",angmsdac:"\u29aa",angmsdad:"\u29ab",angmsdae:"\u29ac",angmsdaf:"\u29ad",angmsdag:"\u29ae",angmsdah:"\u29af",angmsd:"\u2221",angrt:"\u221f",angrtvb:"\u22be",angrtvbd:"\u299d",angsph:"\u2222",angst:"\xc5",angzarr:"\u237c",Aogon:"\u0104",aogon:"\u0105",Aopf:"\ud835\udd38",aopf:"\ud835\udd52",apacir:"\u2a6f",ap:"\u2248",apE:"\u2a70",ape:"\u224a",apid:"\u224b",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224a",Aring:"\xc5",aring:"\xe5",Ascr:"\ud835\udc9c",ascr:"\ud835\udcb6",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224d",Atilde:"\xc3",atilde:"\xe3",Auml:"\xc4",auml:"\xe4",awconint:"\u2233",awint:"\u2a11",backcong:"\u224c",backepsilon:"\u03f6",backprime:"\u2035",backsim:"\u223d",backsimeq:"\u22cd",Backslash:"\u2216",Barv:"\u2ae7",barvee:"\u22bd",barwed:"\u2305",Barwed:"\u2306",barwedge:"\u2305",bbrk:"\u23b5",bbrktbrk:"\u23b6",bcong:"\u224c",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201e",becaus:"\u2235",because:"\u2235",Because:"\u2235",bemptyv:"\u29b0",bepsi:"\u03f6",bernou:"\u212c",Bernoullis:"\u212c",Beta:"\u0392",beta:"\u03b2",beth:"\u2136",between:"\u226c",Bfr:"\ud835\udd05",bfr:"\ud835\udd1f",bigcap:"\u22c2",bigcirc:"\u25ef",bigcup:"\u22c3",bigodot:"\u2a00",bigoplus:"\u2a01",bigotimes:"\u2a02",bigsqcup:"\u2a06",bigstar:"\u2605",bigtriangledown:"\u25bd",bigtriangleup:"\u25b3",biguplus:"\u2a04",bigvee:"\u22c1",bigwedge:"\u22c0",bkarow:"\u290d",blacklozenge:"\u29eb",blacksquare:"\u25aa",blacktriangle:"\u25b4",blacktriangledown:"\u25be",blacktriangleleft:"\u25c2",blacktriangleright:"\u25b8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20e5",bnequiv:"\u2261\u20e5",bNot:"\u2aed",bnot:"\u2310",Bopf:"\ud835\udd39",bopf:"\ud835\udd53",bot:"\u22a5",bottom:"\u22a5",bowtie:"\u22c8",boxbox:"\u29c9",boxdl:"\u2510",boxdL:"\u2555",boxDl:"\u2556",boxDL:"\u2557",boxdr:"\u250c",boxdR:"\u2552",boxDr:"\u2553",boxDR:"\u2554",boxh:"\u2500",boxH:"\u2550",boxhd:"\u252c",boxHd:"\u2564",boxhD:"\u2565",boxHD:"\u2566",boxhu:"\u2534",boxHu:"\u2567",boxhU:"\u2568",boxHU:"\u2569",boxminus:"\u229f",boxplus:"\u229e",boxtimes:"\u22a0",boxul:"\u2518",boxuL:"\u255b",boxUl:"\u255c",boxUL:"\u255d",boxur:"\u2514",boxuR:"\u2558",boxUr:"\u2559",boxUR:"\u255a",boxv:"\u2502",boxV:"\u2551",boxvh:"\u253c",boxvH:"\u256a",boxVh:"\u256b",boxVH:"\u256c",boxvl:"\u2524",boxvL:"\u2561",boxVl:"\u2562",boxVL:"\u2563",boxvr:"\u251c",boxvR:"\u255e",boxVr:"\u255f",boxVR:"\u2560",bprime:"\u2035",breve:"\u02d8",Breve:"\u02d8",brvbar:"\xa6",bscr:"\ud835\udcb7",Bscr:"\u212c",bsemi:"\u204f",bsim:"\u223d",bsime:"\u22cd",bsolb:"\u29c5",bsol:"\\",bsolhsub:"\u27c8",bull:"\u2022",bullet:"\u2022",bump:"\u224e",bumpE:"\u2aae",bumpe:"\u224f",Bumpeq:"\u224e",bumpeq:"\u224f",Cacute:"\u0106",cacute:"\u0107",capand:"\u2a44",capbrcup:"\u2a49",capcap:"\u2a4b",cap:"\u2229",Cap:"\u22d2",capcup:"\u2a47",capdot:"\u2a40",CapitalDifferentialD:"\u2145",caps:"\u2229\ufe00",caret:"\u2041",caron:"\u02c7",Cayleys:"\u212d",ccaps:"\u2a4d",Ccaron:"\u010c",ccaron:"\u010d",Ccedil:"\xc7",ccedil:"\xe7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2a4c",ccupssm:"\u2a50",Cdot:"\u010a",cdot:"\u010b",cedil:"\xb8",Cedilla:"\xb8",cemptyv:"\u29b2",cent:"\xa2",centerdot:"\xb7",CenterDot:"\xb7",cfr:"\ud835\udd20",Cfr:"\u212d",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03a7",chi:"\u03c7",circ:"\u02c6",circeq:"\u2257",circlearrowleft:"\u21ba",circlearrowright:"\u21bb",circledast:"\u229b",circledcirc:"\u229a",circleddash:"\u229d",CircleDot:"\u2299",circledR:"\xae",circledS:"\u24c8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cir:"\u25cb",cirE:"\u29c3",cire:"\u2257",cirfnint:"\u2a10",cirmid:"\u2aef",cirscir:"\u29c2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201d",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",colon:":",Colon:"\u2237",Colone:"\u2a74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2a6d",Congruent:"\u2261",conint:"\u222e",Conint:"\u222f",ContourIntegral:"\u222e",copf:"\ud835\udd54",Copf:"\u2102",coprod:"\u2210",Coproduct:"\u2210",copy:"\xa9",COPY:"\xa9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21b5",cross:"\u2717",Cross:"\u2a2f",Cscr:"\ud835\udc9e",cscr:"\ud835\udcb8",csub:"\u2acf",csube:"\u2ad1",csup:"\u2ad0",csupe:"\u2ad2",ctdot:"\u22ef",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22de",cuesc:"\u22df",cularr:"\u21b6",cularrp:"\u293d",cupbrcap:"\u2a48",cupcap:"\u2a46",CupCap:"\u224d",cup:"\u222a",Cup:"\u22d3",cupcup:"\u2a4a",cupdot:"\u228d",cupor:"\u2a45",cups:"\u222a\ufe00",curarr:"\u21b7",curarrm:"\u293c",curlyeqprec:"\u22de",curlyeqsucc:"\u22df",curlyvee:"\u22ce",curlywedge:"\u22cf",curren:"\xa4",curvearrowleft:"\u21b6",curvearrowright:"\u21b7",cuvee:"\u22ce",cuwed:"\u22cf",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232d",dagger:"\u2020",Dagger:"\u2021",daleth:"\u2138",darr:"\u2193",Darr:"\u21a1",dArr:"\u21d3",dash:"\u2010",Dashv:"\u2ae4",dashv:"\u22a3",dbkarow:"\u290f",dblac:"\u02dd",Dcaron:"\u010e",dcaron:"\u010f",Dcy:"\u0414",dcy:"\u0434",ddagger:"\u2021",ddarr:"\u21ca",DD:"\u2145",dd:"\u2146",DDotrahd:"\u2911",ddotseq:"\u2a77",deg:"\xb0",Del:"\u2207",Delta:"\u0394",delta:"\u03b4",demptyv:"\u29b1",dfisht:"\u297f",Dfr:"\ud835\udd07",dfr:"\ud835\udd21",dHar:"\u2965",dharl:"\u21c3",dharr:"\u21c2",DiacriticalAcute:"\xb4",DiacriticalDot:"\u02d9",DiacriticalDoubleAcute:"\u02dd",DiacriticalGrave:"`",DiacriticalTilde:"\u02dc",diam:"\u22c4",diamond:"\u22c4",Diamond:"\u22c4",diamondsuit:"\u2666",diams:"\u2666",die:"\xa8",DifferentialD:"\u2146",digamma:"\u03dd",disin:"\u22f2",div:"\xf7",divide:"\xf7",divideontimes:"\u22c7",divonx:"\u22c7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231e",dlcrop:"\u230d",dollar:"$",Dopf:"\ud835\udd3b",dopf:"\ud835\udd55",Dot:"\xa8",dot:"\u02d9",DotDot:"\u20dc",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22a1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222f",DoubleDot:"\xa8",DoubleDownArrow:"\u21d3",DoubleLeftArrow:"\u21d0",DoubleLeftRightArrow:"\u21d4",DoubleLeftTee:"\u2ae4",DoubleLongLeftArrow:"\u27f8",DoubleLongLeftRightArrow:"\u27fa",DoubleLongRightArrow:"\u27f9",DoubleRightArrow:"\u21d2",DoubleRightTee:"\u22a8",DoubleUpArrow:"\u21d1",DoubleUpDownArrow:"\u21d5",DoubleVerticalBar:"\u2225",DownArrowBar:"\u2913",downarrow:"\u2193",DownArrow:"\u2193",Downarrow:"\u21d3",DownArrowUpArrow:"\u21f5",DownBreve:"\u0311",downdownarrows:"\u21ca",downharpoonleft:"\u21c3",downharpoonright:"\u21c2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295e",DownLeftVectorBar:"\u2956",DownLeftVector:"\u21bd",DownRightTeeVector:"\u295f",DownRightVectorBar:"\u2957",DownRightVector:"\u21c1",DownTeeArrow:"\u21a7",DownTee:"\u22a4",drbkarow:"\u2910",drcorn:"\u231f",drcrop:"\u230c",Dscr:"\ud835\udc9f",dscr:"\ud835\udcb9",DScy:"\u0405",dscy:"\u0455",dsol:"\u29f6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22f1",dtri:"\u25bf",dtrif:"\u25be",duarr:"\u21f5",duhar:"\u296f",dwangle:"\u29a6",DZcy:"\u040f",dzcy:"\u045f",dzigrarr:"\u27ff",Eacute:"\xc9",eacute:"\xe9",easter:"\u2a6e",Ecaron:"\u011a",ecaron:"\u011b",Ecirc:"\xca",ecirc:"\xea",ecir:"\u2256",ecolon:"\u2255",Ecy:"\u042d",ecy:"\u044d",eDDot:"\u2a77",Edot:"\u0116",edot:"\u0117",eDot:"\u2251",ee:"\u2147",efDot:"\u2252",Efr:"\ud835\udd08",efr:"\ud835\udd22",eg:"\u2a9a",Egrave:"\xc8",egrave:"\xe8",egs:"\u2a96",egsdot:"\u2a98",el:"\u2a99",Element:"\u2208",elinters:"\u23e7",ell:"\u2113",els:"\u2a95",elsdot:"\u2a97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25fb",emptyv:"\u2205",EmptyVerySmallSquare:"\u25ab",emsp13:"\u2004",emsp14:"\u2005",emsp:"\u2003",ENG:"\u014a",eng:"\u014b",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\ud835\udd3c",eopf:"\ud835\udd56",epar:"\u22d5",eparsl:"\u29e3",eplus:"\u2a71",epsi:"\u03b5",Epsilon:"\u0395",epsilon:"\u03b5",epsiv:"\u03f5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2a96",eqslantless:"\u2a95",Equal:"\u2a75",equals:"=",EqualTilde:"\u2242",equest:"\u225f",Equilibrium:"\u21cc",equiv:"\u2261",equivDD:"\u2a78",eqvparsl:"\u29e5",erarr:"\u2971",erDot:"\u2253",escr:"\u212f",Escr:"\u2130",esdot:"\u2250",Esim:"\u2a73",esim:"\u2242",Eta:"\u0397",eta:"\u03b7",ETH:"\xd0",eth:"\xf0",Euml:"\xcb",euml:"\xeb",euro:"\u20ac",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",exponentiale:"\u2147",ExponentialE:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\ufb03",fflig:"\ufb00",ffllig:"\ufb04",Ffr:"\ud835\udd09",ffr:"\ud835\udd23",filig:"\ufb01",FilledSmallSquare:"\u25fc",FilledVerySmallSquare:"\u25aa",fjlig:"fj",flat:"\u266d",fllig:"\ufb02",fltns:"\u25b1",fnof:"\u0192",Fopf:"\ud835\udd3d",fopf:"\ud835\udd57",forall:"\u2200",ForAll:"\u2200",fork:"\u22d4",forkv:"\u2ad9",Fouriertrf:"\u2131",fpartint:"\u2a0d",frac12:"\xbd",frac13:"\u2153",frac14:"\xbc",frac15:"\u2155",frac16:"\u2159",frac18:"\u215b",frac23:"\u2154",frac25:"\u2156",frac34:"\xbe",frac35:"\u2157",frac38:"\u215c",frac45:"\u2158",frac56:"\u215a",frac58:"\u215d",frac78:"\u215e",frasl:"\u2044",frown:"\u2322",fscr:"\ud835\udcbb",Fscr:"\u2131",gacute:"\u01f5",Gamma:"\u0393",gamma:"\u03b3",Gammad:"\u03dc",gammad:"\u03dd",gap:"\u2a86",Gbreve:"\u011e",gbreve:"\u011f",Gcedil:"\u0122",Gcirc:"\u011c",gcirc:"\u011d",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",ge:"\u2265",gE:"\u2267",gEl:"\u2a8c",gel:"\u22db",geq:"\u2265",geqq:"\u2267",geqslant:"\u2a7e",gescc:"\u2aa9",ges:"\u2a7e",gesdot:"\u2a80",gesdoto:"\u2a82",gesdotol:"\u2a84",gesl:"\u22db\ufe00",gesles:"\u2a94",Gfr:"\ud835\udd0a",gfr:"\ud835\udd24",gg:"\u226b",Gg:"\u22d9",ggg:"\u22d9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gla:"\u2aa5",gl:"\u2277",glE:"\u2a92",glj:"\u2aa4",gnap:"\u2a8a",gnapprox:"\u2a8a",gne:"\u2a88",gnE:"\u2269",gneq:"\u2a88",gneqq:"\u2269",gnsim:"\u22e7",Gopf:"\ud835\udd3e",gopf:"\ud835\udd58",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22db",GreaterFullEqual:"\u2267",GreaterGreater:"\u2aa2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2a7e",GreaterTilde:"\u2273",Gscr:"\ud835\udca2",gscr:"\u210a",gsim:"\u2273",gsime:"\u2a8e",gsiml:"\u2a90",gtcc:"\u2aa7",gtcir:"\u2a7a",gt:">",GT:">",Gt:"\u226b",gtdot:"\u22d7",gtlPar:"\u2995",gtquest:"\u2a7c",gtrapprox:"\u2a86",gtrarr:"\u2978",gtrdot:"\u22d7",gtreqless:"\u22db",gtreqqless:"\u2a8c",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\ufe00",gvnE:"\u2269\ufe00",Hacek:"\u02c7",hairsp:"\u200a",half:"\xbd",hamilt:"\u210b",HARDcy:"\u042a",hardcy:"\u044a",harrcir:"\u2948",harr:"\u2194",hArr:"\u21d4",harrw:"\u21ad",Hat:"^",hbar:"\u210f",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22b9",hfr:"\ud835\udd25",Hfr:"\u210c",HilbertSpace:"\u210b",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21ff",homtht:"\u223b",hookleftarrow:"\u21a9",hookrightarrow:"\u21aa",hopf:"\ud835\udd59",Hopf:"\u210d",horbar:"\u2015",HorizontalLine:"\u2500",hscr:"\ud835\udcbd",Hscr:"\u210b",hslash:"\u210f",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224e",HumpEqual:"\u224f",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xcd",iacute:"\xed",ic:"\u2063",Icirc:"\xce",icirc:"\xee",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xa1",iff:"\u21d4",ifr:"\ud835\udd26",Ifr:"\u2111",Igrave:"\xcc",igrave:"\xec",ii:"\u2148",iiiint:"\u2a0c",iiint:"\u222d",iinfin:"\u29dc",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Imacr:"\u012a",imacr:"\u012b",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",Im:"\u2111",imof:"\u22b7",imped:"\u01b5",Implies:"\u21d2",incare:"\u2105",in:"\u2208",infin:"\u221e",infintie:"\u29dd",inodot:"\u0131",intcal:"\u22ba",int:"\u222b",Int:"\u222c",integers:"\u2124",Integral:"\u222b",intercal:"\u22ba",Intersection:"\u22c2",intlarhk:"\u2a17",intprod:"\u2a3c",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012e",iogon:"\u012f",Iopf:"\ud835\udd40",iopf:"\ud835\udd5a",Iota:"\u0399",iota:"\u03b9",iprod:"\u2a3c",iquest:"\xbf",iscr:"\ud835\udcbe",Iscr:"\u2110",isin:"\u2208",isindot:"\u22f5",isinE:"\u22f9",isins:"\u22f4",isinsv:"\u22f3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xcf",iuml:"\xef",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\ud835\udd0d",jfr:"\ud835\udd27",jmath:"\u0237",Jopf:"\ud835\udd41",jopf:"\ud835\udd5b",Jscr:"\ud835\udca5",jscr:"\ud835\udcbf",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039a",kappa:"\u03ba",kappav:"\u03f0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041a",kcy:"\u043a",Kfr:"\ud835\udd0e",kfr:"\ud835\udd28",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040c",kjcy:"\u045c",Kopf:"\ud835\udd42",kopf:"\ud835\udd5c",Kscr:"\ud835\udca6",kscr:"\ud835\udcc0",lAarr:"\u21da",Lacute:"\u0139",lacute:"\u013a",laemptyv:"\u29b4",lagran:"\u2112",Lambda:"\u039b",lambda:"\u03bb",lang:"\u27e8",Lang:"\u27ea",langd:"\u2991",langle:"\u27e8",lap:"\u2a85",Laplacetrf:"\u2112",laquo:"\xab",larrb:"\u21e4",larrbfs:"\u291f",larr:"\u2190",Larr:"\u219e",lArr:"\u21d0",larrfs:"\u291d",larrhk:"\u21a9",larrlp:"\u21ab",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21a2",latail:"\u2919",lAtail:"\u291b",lat:"\u2aab",late:"\u2aad",lates:"\u2aad\ufe00",lbarr:"\u290c",lBarr:"\u290e",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298b",lbrksld:"\u298f",lbrkslu:"\u298d",Lcaron:"\u013d",lcaron:"\u013e",Lcedil:"\u013b",lcedil:"\u013c",lceil:"\u2308",lcub:"{",Lcy:"\u041b",lcy:"\u043b",ldca:"\u2936",ldquo:"\u201c",ldquor:"\u201e",ldrdhar:"\u2967",ldrushar:"\u294b",ldsh:"\u21b2",le:"\u2264",lE:"\u2266",LeftAngleBracket:"\u27e8",LeftArrowBar:"\u21e4",leftarrow:"\u2190",LeftArrow:"\u2190",Leftarrow:"\u21d0",LeftArrowRightArrow:"\u21c6",leftarrowtail:"\u21a2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27e6",LeftDownTeeVector:"\u2961",LeftDownVectorBar:"\u2959",LeftDownVector:"\u21c3",LeftFloor:"\u230a",leftharpoondown:"\u21bd",leftharpoonup:"\u21bc",leftleftarrows:"\u21c7",leftrightarrow:"\u2194",LeftRightArrow:"\u2194",Leftrightarrow:"\u21d4",leftrightarrows:"\u21c6",leftrightharpoons:"\u21cb",leftrightsquigarrow:"\u21ad",LeftRightVector:"\u294e",LeftTeeArrow:"\u21a4",LeftTee:"\u22a3",LeftTeeVector:"\u295a",leftthreetimes:"\u22cb",LeftTriangleBar:"\u29cf",LeftTriangle:"\u22b2",LeftTriangleEqual:"\u22b4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVectorBar:"\u2958",LeftUpVector:"\u21bf",LeftVectorBar:"\u2952",LeftVector:"\u21bc",lEg:"\u2a8b",leg:"\u22da",leq:"\u2264",leqq:"\u2266",leqslant:"\u2a7d",lescc:"\u2aa8",les:"\u2a7d",lesdot:"\u2a7f",lesdoto:"\u2a81",lesdotor:"\u2a83",lesg:"\u22da\ufe00",lesges:"\u2a93",lessapprox:"\u2a85",lessdot:"\u22d6",lesseqgtr:"\u22da",lesseqqgtr:"\u2a8b",LessEqualGreater:"\u22da",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2aa1",lesssim:"\u2272",LessSlantEqual:"\u2a7d",LessTilde:"\u2272",lfisht:"\u297c",lfloor:"\u230a",Lfr:"\ud835\udd0f",lfr:"\ud835\udd29",lg:"\u2276",lgE:"\u2a91",lHar:"\u2962",lhard:"\u21bd",lharu:"\u21bc",lharul:"\u296a",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",llarr:"\u21c7",ll:"\u226a",Ll:"\u22d8",llcorner:"\u231e",Lleftarrow:"\u21da",llhard:"\u296b",lltri:"\u25fa",Lmidot:"\u013f",lmidot:"\u0140",lmoustache:"\u23b0",lmoust:"\u23b0",lnap:"\u2a89",lnapprox:"\u2a89",lne:"\u2a87",lnE:"\u2268",lneq:"\u2a87",lneqq:"\u2268",lnsim:"\u22e6",loang:"\u27ec",loarr:"\u21fd",lobrk:"\u27e6",longleftarrow:"\u27f5",LongLeftArrow:"\u27f5",Longleftarrow:"\u27f8",longleftrightarrow:"\u27f7",LongLeftRightArrow:"\u27f7",Longleftrightarrow:"\u27fa",longmapsto:"\u27fc",longrightarrow:"\u27f6",LongRightArrow:"\u27f6",Longrightarrow:"\u27f9",looparrowleft:"\u21ab",looparrowright:"\u21ac",lopar:"\u2985",Lopf:"\ud835\udd43",lopf:"\ud835\udd5d",loplus:"\u2a2d",lotimes:"\u2a34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25ca",lozenge:"\u25ca",lozf:"\u29eb",lpar:"(",lparlt:"\u2993",lrarr:"\u21c6",lrcorner:"\u231f",lrhar:"\u21cb",lrhard:"\u296d",lrm:"\u200e",lrtri:"\u22bf",lsaquo:"\u2039",lscr:"\ud835\udcc1",Lscr:"\u2112",lsh:"\u21b0",Lsh:"\u21b0",lsim:"\u2272",lsime:"\u2a8d",lsimg:"\u2a8f",lsqb:"[",lsquo:"\u2018",lsquor:"\u201a",Lstrok:"\u0141",lstrok:"\u0142",ltcc:"\u2aa6",ltcir:"\u2a79",lt:"<",LT:"<",Lt:"\u226a",ltdot:"\u22d6",lthree:"\u22cb",ltimes:"\u22c9",ltlarr:"\u2976",ltquest:"\u2a7b",ltri:"\u25c3",ltrie:"\u22b4",ltrif:"\u25c2",ltrPar:"\u2996",lurdshar:"\u294a",luruhar:"\u2966",lvertneqq:"\u2268\ufe00",lvnE:"\u2268\ufe00",macr:"\xaf",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21a6",mapsto:"\u21a6",mapstodown:"\u21a7",mapstoleft:"\u21a4",mapstoup:"\u21a5",marker:"\u25ae",mcomma:"\u2a29",Mcy:"\u041c",mcy:"\u043c",mdash:"\u2014",mDDot:"\u223a",measuredangle:"\u2221",MediumSpace:"\u205f",Mellintrf:"\u2133",Mfr:"\ud835\udd10",mfr:"\ud835\udd2a",mho:"\u2127",micro:"\xb5",midast:"*",midcir:"\u2af0",mid:"\u2223",middot:"\xb7",minusb:"\u229f",minus:"\u2212",minusd:"\u2238",minusdu:"\u2a2a",MinusPlus:"\u2213",mlcp:"\u2adb",mldr:"\u2026",mnplus:"\u2213",models:"\u22a7",Mopf:"\ud835\udd44",mopf:"\ud835\udd5e",mp:"\u2213",mscr:"\ud835\udcc2",Mscr:"\u2133",mstpos:"\u223e",Mu:"\u039c",mu:"\u03bc",multimap:"\u22b8",mumap:"\u22b8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20d2",nap:"\u2249",napE:"\u2a70\u0338",napid:"\u224b\u0338",napos:"\u0149",napprox:"\u2249",natural:"\u266e",naturals:"\u2115",natur:"\u266e",nbsp:"\xa0",nbump:"\u224e\u0338",nbumpe:"\u224f\u0338",ncap:"\u2a43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2a6d\u0338",ncup:"\u2a42",Ncy:"\u041d",ncy:"\u043d",ndash:"\u2013",nearhk:"\u2924",nearr:"\u2197",neArr:"\u21d7",nearrow:"\u2197",ne:"\u2260",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200b",NegativeThickSpace:"\u200b",NegativeThinSpace:"\u200b",NegativeVeryThinSpace:"\u200b",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226b",NestedLessLess:"\u226a",NewLine:"\n",nexist:"\u2204",nexists:"\u2204",Nfr:"\ud835\udd11",nfr:"\ud835\udd2b",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2a7e\u0338",nges:"\u2a7e\u0338",nGg:"\u22d9\u0338",ngsim:"\u2275",nGt:"\u226b\u20d2",ngt:"\u226f",ngtr:"\u226f",nGtv:"\u226b\u0338",nharr:"\u21ae",nhArr:"\u21ce",nhpar:"\u2af2",ni:"\u220b",nis:"\u22fc",nisd:"\u22fa",niv:"\u220b",NJcy:"\u040a",njcy:"\u045a",nlarr:"\u219a",nlArr:"\u21cd",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nleftarrow:"\u219a",nLeftarrow:"\u21cd",nleftrightarrow:"\u21ae",nLeftrightarrow:"\u21ce",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2a7d\u0338",nles:"\u2a7d\u0338",nless:"\u226e",nLl:"\u22d8\u0338",nlsim:"\u2274",nLt:"\u226a\u20d2",nlt:"\u226e",nltri:"\u22ea",nltrie:"\u22ec",nLtv:"\u226a\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xa0",nopf:"\ud835\udd5f",Nopf:"\u2115",Not:"\u2aec",not:"\xac",NotCongruent:"\u2262",NotCupCap:"\u226d",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226f",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226b\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2a7e\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224e\u0338",NotHumpEqual:"\u224f\u0338",notin:"\u2209",notindot:"\u22f5\u0338",notinE:"\u22f9\u0338",notinva:"\u2209",notinvb:"\u22f7",notinvc:"\u22f6",NotLeftTriangleBar:"\u29cf\u0338",NotLeftTriangle:"\u22ea",NotLeftTriangleEqual:"\u22ec",NotLess:"\u226e",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226a\u0338",NotLessSlantEqual:"\u2a7d\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2aa2\u0338",NotNestedLessLess:"\u2aa1\u0338",notni:"\u220c",notniva:"\u220c",notnivb:"\u22fe",notnivc:"\u22fd",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2aaf\u0338",NotPrecedesSlantEqual:"\u22e0",NotReverseElement:"\u220c",NotRightTriangleBar:"\u29d0\u0338",NotRightTriangle:"\u22eb",NotRightTriangleEqual:"\u22ed",NotSquareSubset:"\u228f\u0338",NotSquareSubsetEqual:"\u22e2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22e3",NotSubset:"\u2282\u20d2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2ab0\u0338",NotSucceedsSlantEqual:"\u22e1",NotSucceedsTilde:"\u227f\u0338",NotSuperset:"\u2283\u20d2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",nparallel:"\u2226",npar:"\u2226",nparsl:"\u2afd\u20e5",npart:"\u2202\u0338",npolint:"\u2a14",npr:"\u2280",nprcue:"\u22e0",nprec:"\u2280",npreceq:"\u2aaf\u0338",npre:"\u2aaf\u0338",nrarrc:"\u2933\u0338",nrarr:"\u219b",nrArr:"\u21cf",nrarrw:"\u219d\u0338",nrightarrow:"\u219b",nRightarrow:"\u21cf",nrtri:"\u22eb",nrtrie:"\u22ed",nsc:"\u2281",nsccue:"\u22e1",nsce:"\u2ab0\u0338",Nscr:"\ud835\udca9",nscr:"\ud835\udcc3",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22e2",nsqsupe:"\u22e3",nsub:"\u2284",nsubE:"\u2ac5\u0338",nsube:"\u2288",nsubset:"\u2282\u20d2",nsubseteq:"\u2288",nsubseteqq:"\u2ac5\u0338",nsucc:"\u2281",nsucceq:"\u2ab0\u0338",nsup:"\u2285",nsupE:"\u2ac6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20d2",nsupseteq:"\u2289",nsupseteqq:"\u2ac6\u0338",ntgl:"\u2279",Ntilde:"\xd1",ntilde:"\xf1",ntlg:"\u2278",ntriangleleft:"\u22ea",ntrianglelefteq:"\u22ec",ntriangleright:"\u22eb",ntrianglerighteq:"\u22ed",Nu:"\u039d",nu:"\u03bd",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224d\u20d2",nvdash:"\u22ac",nvDash:"\u22ad",nVdash:"\u22ae",nVDash:"\u22af",nvge:"\u2265\u20d2",nvgt:">\u20d2",nvHarr:"\u2904",nvinfin:"\u29de",nvlArr:"\u2902",nvle:"\u2264\u20d2",nvlt:"<\u20d2",nvltrie:"\u22b4\u20d2",nvrArr:"\u2903",nvrtrie:"\u22b5\u20d2",nvsim:"\u223c\u20d2",nwarhk:"\u2923",nwarr:"\u2196",nwArr:"\u21d6",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xd3",oacute:"\xf3",oast:"\u229b",Ocirc:"\xd4",ocirc:"\xf4",ocir:"\u229a",Ocy:"\u041e",ocy:"\u043e",odash:"\u229d",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2a38",odot:"\u2299",odsold:"\u29bc",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29bf",Ofr:"\ud835\udd12",ofr:"\ud835\udd2c",ogon:"\u02db",Ograve:"\xd2",ograve:"\xf2",ogt:"\u29c1",ohbar:"\u29b5",ohm:"\u03a9",oint:"\u222e",olarr:"\u21ba",olcir:"\u29be",olcross:"\u29bb",oline:"\u203e",olt:"\u29c0",Omacr:"\u014c",omacr:"\u014d",Omega:"\u03a9",omega:"\u03c9",Omicron:"\u039f",omicron:"\u03bf",omid:"\u29b6",ominus:"\u2296",Oopf:"\ud835\udd46",oopf:"\ud835\udd60",opar:"\u29b7",OpenCurlyDoubleQuote:"\u201c",OpenCurlyQuote:"\u2018",operp:"\u29b9",oplus:"\u2295",orarr:"\u21bb",Or:"\u2a54",or:"\u2228",ord:"\u2a5d",order:"\u2134",orderof:"\u2134",ordf:"\xaa",ordm:"\xba",origof:"\u22b6",oror:"\u2a56",orslope:"\u2a57",orv:"\u2a5b",oS:"\u24c8",Oscr:"\ud835\udcaa",oscr:"\u2134",Oslash:"\xd8",oslash:"\xf8",osol:"\u2298",Otilde:"\xd5",otilde:"\xf5",otimesas:"\u2a36",Otimes:"\u2a37",otimes:"\u2297",Ouml:"\xd6",ouml:"\xf6",ovbar:"\u233d",OverBar:"\u203e",OverBrace:"\u23de",OverBracket:"\u23b4",OverParenthesis:"\u23dc",para:"\xb6",parallel:"\u2225",par:"\u2225",parsim:"\u2af3",parsl:"\u2afd",part:"\u2202",PartialD:"\u2202",Pcy:"\u041f",pcy:"\u043f",percnt:"%",period:".",permil:"\u2030",perp:"\u22a5",pertenk:"\u2031",Pfr:"\ud835\udd13",pfr:"\ud835\udd2d",Phi:"\u03a6",phi:"\u03c6",phiv:"\u03d5",phmmat:"\u2133",phone:"\u260e",Pi:"\u03a0",pi:"\u03c0",pitchfork:"\u22d4",piv:"\u03d6",planck:"\u210f",planckh:"\u210e",plankv:"\u210f",plusacir:"\u2a23",plusb:"\u229e",pluscir:"\u2a22",plus:"+",plusdo:"\u2214",plusdu:"\u2a25",pluse:"\u2a72",PlusMinus:"\xb1",plusmn:"\xb1",plussim:"\u2a26",plustwo:"\u2a27",pm:"\xb1",Poincareplane:"\u210c",pointint:"\u2a15",popf:"\ud835\udd61",Popf:"\u2119",pound:"\xa3",prap:"\u2ab7",Pr:"\u2abb",pr:"\u227a",prcue:"\u227c",precapprox:"\u2ab7",prec:"\u227a",preccurlyeq:"\u227c",Precedes:"\u227a",PrecedesEqual:"\u2aaf",PrecedesSlantEqual:"\u227c",PrecedesTilde:"\u227e",preceq:"\u2aaf",precnapprox:"\u2ab9",precneqq:"\u2ab5",precnsim:"\u22e8",pre:"\u2aaf",prE:"\u2ab3",precsim:"\u227e",prime:"\u2032",Prime:"\u2033",primes:"\u2119",prnap:"\u2ab9",prnE:"\u2ab5",prnsim:"\u22e8",prod:"\u220f",Product:"\u220f",profalar:"\u232e",profline:"\u2312",profsurf:"\u2313",prop:"\u221d",Proportional:"\u221d",Proportion:"\u2237",propto:"\u221d",prsim:"\u227e",prurel:"\u22b0",Pscr:"\ud835\udcab",pscr:"\ud835\udcc5",Psi:"\u03a8",psi:"\u03c8",puncsp:"\u2008",Qfr:"\ud835\udd14",qfr:"\ud835\udd2e",qint:"\u2a0c",qopf:"\ud835\udd62",Qopf:"\u211a",qprime:"\u2057",Qscr:"\ud835\udcac",qscr:"\ud835\udcc6",quaternions:"\u210d",quatint:"\u2a16",quest:"?",questeq:"\u225f",quot:'"',QUOT:'"',rAarr:"\u21db",race:"\u223d\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221a",raemptyv:"\u29b3",rang:"\u27e9",Rang:"\u27eb",rangd:"\u2992",range:"\u29a5",rangle:"\u27e9",raquo:"\xbb",rarrap:"\u2975",rarrb:"\u21e5",rarrbfs:"\u2920",rarrc:"\u2933",rarr:"\u2192",Rarr:"\u21a0",rArr:"\u21d2",rarrfs:"\u291e",rarrhk:"\u21aa",rarrlp:"\u21ac",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21a3",rarrw:"\u219d",ratail:"\u291a",rAtail:"\u291c",ratio:"\u2236",rationals:"\u211a",rbarr:"\u290d",rBarr:"\u290f",RBarr:"\u2910",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298c",rbrksld:"\u298e",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201d",rdquor:"\u201d",rdsh:"\u21b3",real:"\u211c",realine:"\u211b",realpart:"\u211c",reals:"\u211d",Re:"\u211c",rect:"\u25ad",reg:"\xae",REG:"\xae",ReverseElement:"\u220b",ReverseEquilibrium:"\u21cb",ReverseUpEquilibrium:"\u296f",rfisht:"\u297d",rfloor:"\u230b",rfr:"\ud835\udd2f",Rfr:"\u211c",rHar:"\u2964",rhard:"\u21c1",rharu:"\u21c0",rharul:"\u296c",Rho:"\u03a1",rho:"\u03c1",rhov:"\u03f1",RightAngleBracket:"\u27e9",RightArrowBar:"\u21e5",rightarrow:"\u2192",RightArrow:"\u2192",Rightarrow:"\u21d2",RightArrowLeftArrow:"\u21c4",rightarrowtail:"\u21a3",RightCeiling:"\u2309",RightDoubleBracket:"\u27e7",RightDownTeeVector:"\u295d",RightDownVectorBar:"\u2955",RightDownVector:"\u21c2",RightFloor:"\u230b",rightharpoondown:"\u21c1",rightharpoonup:"\u21c0",rightleftarrows:"\u21c4",rightleftharpoons:"\u21cc",rightrightarrows:"\u21c9",rightsquigarrow:"\u219d",RightTeeArrow:"\u21a6",RightTee:"\u22a2",RightTeeVector:"\u295b",rightthreetimes:"\u22cc",RightTriangleBar:"\u29d0",RightTriangle:"\u22b3",RightTriangleEqual:"\u22b5",RightUpDownVector:"\u294f",RightUpTeeVector:"\u295c",RightUpVectorBar:"\u2954",RightUpVector:"\u21be",RightVectorBar:"\u2953",RightVector:"\u21c0",ring:"\u02da",risingdotseq:"\u2253",rlarr:"\u21c4",rlhar:"\u21cc",rlm:"\u200f",rmoustache:"\u23b1",rmoust:"\u23b1",rnmid:"\u2aee",roang:"\u27ed",roarr:"\u21fe",robrk:"\u27e7",ropar:"\u2986",ropf:"\ud835\udd63",Ropf:"\u211d",roplus:"\u2a2e",rotimes:"\u2a35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2a12",rrarr:"\u21c9",Rrightarrow:"\u21db",rsaquo:"\u203a",rscr:"\ud835\udcc7",Rscr:"\u211b",rsh:"\u21b1",Rsh:"\u21b1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22cc",rtimes:"\u22ca",rtri:"\u25b9",rtrie:"\u22b5",rtrif:"\u25b8",rtriltri:"\u29ce",RuleDelayed:"\u29f4",ruluhar:"\u2968",rx:"\u211e",Sacute:"\u015a",sacute:"\u015b",sbquo:"\u201a",scap:"\u2ab8",Scaron:"\u0160",scaron:"\u0161",Sc:"\u2abc",sc:"\u227b",sccue:"\u227d",sce:"\u2ab0",scE:"\u2ab4",Scedil:"\u015e",scedil:"\u015f",Scirc:"\u015c",scirc:"\u015d",scnap:"\u2aba",scnE:"\u2ab6",scnsim:"\u22e9",scpolint:"\u2a13",scsim:"\u227f",Scy:"\u0421",scy:"\u0441",sdotb:"\u22a1",sdot:"\u22c5",sdote:"\u2a66",searhk:"\u2925",searr:"\u2198",seArr:"\u21d8",searrow:"\u2198",sect:"\xa7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\ud835\udd16",sfr:"\ud835\udd30",sfrown:"\u2322",sharp:"\u266f",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xad",Sigma:"\u03a3",sigma:"\u03c3",sigmaf:"\u03c2",sigmav:"\u03c2",sim:"\u223c",simdot:"\u2a6a",sime:"\u2243",simeq:"\u2243",simg:"\u2a9e",simgE:"\u2aa0",siml:"\u2a9d",simlE:"\u2a9f",simne:"\u2246",simplus:"\u2a24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2a33",smeparsl:"\u29e4",smid:"\u2223",smile:"\u2323",smt:"\u2aaa",smte:"\u2aac",smtes:"\u2aac\ufe00",SOFTcy:"\u042c",softcy:"\u044c",solbar:"\u233f",solb:"\u29c4",sol:"/",Sopf:"\ud835\udd4a",sopf:"\ud835\udd64",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\ufe00",sqcup:"\u2294",sqcups:"\u2294\ufe00",Sqrt:"\u221a",sqsub:"\u228f",sqsube:"\u2291",sqsubset:"\u228f",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",square:"\u25a1",Square:"\u25a1",SquareIntersection:"\u2293",SquareSubset:"\u228f",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25aa",squ:"\u25a1",squf:"\u25aa",srarr:"\u2192",Sscr:"\ud835\udcae",sscr:"\ud835\udcc8",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22c6",Star:"\u22c6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03f5",straightphi:"\u03d5",strns:"\xaf",sub:"\u2282",Sub:"\u22d0",subdot:"\u2abd",subE:"\u2ac5",sube:"\u2286",subedot:"\u2ac3",submult:"\u2ac1",subnE:"\u2acb",subne:"\u228a",subplus:"\u2abf",subrarr:"\u2979",subset:"\u2282",Subset:"\u22d0",subseteq:"\u2286",subseteqq:"\u2ac5",SubsetEqual:"\u2286",subsetneq:"\u228a",subsetneqq:"\u2acb",subsim:"\u2ac7",subsub:"\u2ad5",subsup:"\u2ad3",succapprox:"\u2ab8",succ:"\u227b",succcurlyeq:"\u227d",Succeeds:"\u227b",SucceedsEqual:"\u2ab0",SucceedsSlantEqual:"\u227d",SucceedsTilde:"\u227f",succeq:"\u2ab0",succnapprox:"\u2aba",succneqq:"\u2ab6",succnsim:"\u22e9",succsim:"\u227f",SuchThat:"\u220b",sum:"\u2211",Sum:"\u2211",sung:"\u266a",sup1:"\xb9",sup2:"\xb2",sup3:"\xb3",sup:"\u2283",Sup:"\u22d1",supdot:"\u2abe",supdsub:"\u2ad8",supE:"\u2ac6",supe:"\u2287",supedot:"\u2ac4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27c9",suphsub:"\u2ad7",suplarr:"\u297b",supmult:"\u2ac2",supnE:"\u2acc",supne:"\u228b",supplus:"\u2ac0",supset:"\u2283",Supset:"\u22d1",supseteq:"\u2287",supseteqq:"\u2ac6",supsetneq:"\u228b",supsetneqq:"\u2acc",supsim:"\u2ac8",supsub:"\u2ad4",supsup:"\u2ad6",swarhk:"\u2926",swarr:"\u2199",swArr:"\u21d9",swarrow:"\u2199",swnwar:"\u292a",szlig:"\xdf",Tab:"\t",target:"\u2316",Tau:"\u03a4",tau:"\u03c4",tbrk:"\u23b4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20db",telrec:"\u2315",Tfr:"\ud835\udd17",tfr:"\ud835\udd31",there4:"\u2234",therefore:"\u2234",Therefore:"\u2234",Theta:"\u0398",theta:"\u03b8",thetasym:"\u03d1",thetav:"\u03d1",thickapprox:"\u2248",thicksim:"\u223c",ThickSpace:"\u205f\u200a",ThinSpace:"\u2009",thinsp:"\u2009",thkap:"\u2248",thksim:"\u223c",THORN:"\xde",thorn:"\xfe",tilde:"\u02dc",Tilde:"\u223c",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",timesbar:"\u2a31",timesb:"\u22a0",times:"\xd7",timesd:"\u2a30",tint:"\u222d",toea:"\u2928",topbot:"\u2336",topcir:"\u2af1",top:"\u22a4",Topf:"\ud835\udd4b",topf:"\ud835\udd65",topfork:"\u2ada",tosa:"\u2929",tprime:"\u2034",trade:"\u2122",TRADE:"\u2122",triangle:"\u25b5",triangledown:"\u25bf",triangleleft:"\u25c3",trianglelefteq:"\u22b4",triangleq:"\u225c",triangleright:"\u25b9",trianglerighteq:"\u22b5",tridot:"\u25ec",trie:"\u225c",triminus:"\u2a3a",TripleDot:"\u20db",triplus:"\u2a39",trisb:"\u29cd",tritime:"\u2a3b",trpezium:"\u23e2",Tscr:"\ud835\udcaf",tscr:"\ud835\udcc9",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040b",tshcy:"\u045b",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226c",twoheadleftarrow:"\u219e",twoheadrightarrow:"\u21a0",Uacute:"\xda",uacute:"\xfa",uarr:"\u2191",Uarr:"\u219f",uArr:"\u21d1",Uarrocir:"\u2949",Ubrcy:"\u040e",ubrcy:"\u045e",Ubreve:"\u016c",ubreve:"\u016d",Ucirc:"\xdb",ucirc:"\xfb",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21c5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296e",ufisht:"\u297e",Ufr:"\ud835\udd18",ufr:"\ud835\udd32",Ugrave:"\xd9",ugrave:"\xf9",uHar:"\u2963",uharl:"\u21bf",uharr:"\u21be",uhblk:"\u2580",ulcorn:"\u231c",ulcorner:"\u231c",ulcrop:"\u230f",ultri:"\u25f8",Umacr:"\u016a",umacr:"\u016b",uml:"\xa8",UnderBar:"_",UnderBrace:"\u23df",UnderBracket:"\u23b5",UnderParenthesis:"\u23dd",Union:"\u22c3",UnionPlus:"\u228e",Uogon:"\u0172",uogon:"\u0173",Uopf:"\ud835\udd4c",uopf:"\ud835\udd66",UpArrowBar:"\u2912",uparrow:"\u2191",UpArrow:"\u2191",Uparrow:"\u21d1",UpArrowDownArrow:"\u21c5",updownarrow:"\u2195",UpDownArrow:"\u2195",Updownarrow:"\u21d5",UpEquilibrium:"\u296e",upharpoonleft:"\u21bf",upharpoonright:"\u21be",uplus:"\u228e",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",upsi:"\u03c5",Upsi:"\u03d2",upsih:"\u03d2",Upsilon:"\u03a5",upsilon:"\u03c5",UpTeeArrow:"\u21a5",UpTee:"\u22a5",upuparrows:"\u21c8",urcorn:"\u231d",urcorner:"\u231d",urcrop:"\u230e",Uring:"\u016e",uring:"\u016f",urtri:"\u25f9",Uscr:"\ud835\udcb0",uscr:"\ud835\udcca",utdot:"\u22f0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25b5",utrif:"\u25b4",uuarr:"\u21c8",Uuml:"\xdc",uuml:"\xfc",uwangle:"\u29a7",vangrt:"\u299c",varepsilon:"\u03f5",varkappa:"\u03f0",varnothing:"\u2205",varphi:"\u03d5",varpi:"\u03d6",varpropto:"\u221d",varr:"\u2195",vArr:"\u21d5",varrho:"\u03f1",varsigma:"\u03c2",varsubsetneq:"\u228a\ufe00",varsubsetneqq:"\u2acb\ufe00",varsupsetneq:"\u228b\ufe00",varsupsetneqq:"\u2acc\ufe00",vartheta:"\u03d1",vartriangleleft:"\u22b2",vartriangleright:"\u22b3",vBar:"\u2ae8",Vbar:"\u2aeb",vBarv:"\u2ae9",Vcy:"\u0412",vcy:"\u0432",vdash:"\u22a2",vDash:"\u22a8",Vdash:"\u22a9",VDash:"\u22ab",Vdashl:"\u2ae6",veebar:"\u22bb",vee:"\u2228",Vee:"\u22c1",veeeq:"\u225a",vellip:"\u22ee",verbar:"|",Verbar:"\u2016",vert:"|",Vert:"\u2016",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200a",Vfr:"\ud835\udd19",vfr:"\ud835\udd33",vltri:"\u22b2",vnsub:"\u2282\u20d2",vnsup:"\u2283\u20d2",Vopf:"\ud835\udd4d",vopf:"\ud835\udd67",vprop:"\u221d",vrtri:"\u22b3",Vscr:"\ud835\udcb1",vscr:"\ud835\udccb",vsubnE:"\u2acb\ufe00",vsubne:"\u228a\ufe00",vsupnE:"\u2acc\ufe00",vsupne:"\u228b\ufe00",Vvdash:"\u22aa",vzigzag:"\u299a",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2a5f",wedge:"\u2227",Wedge:"\u22c0",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\ud835\udd1a",wfr:"\ud835\udd34",Wopf:"\ud835\udd4e",wopf:"\ud835\udd68",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\ud835\udcb2",wscr:"\ud835\udccc",xcap:"\u22c2",xcirc:"\u25ef",xcup:"\u22c3",xdtri:"\u25bd",Xfr:"\ud835\udd1b",xfr:"\ud835\udd35",xharr:"\u27f7",xhArr:"\u27fa",Xi:"\u039e",xi:"\u03be",xlarr:"\u27f5",xlArr:"\u27f8",xmap:"\u27fc",xnis:"\u22fb",xodot:"\u2a00",Xopf:"\ud835\udd4f",xopf:"\ud835\udd69",xoplus:"\u2a01",xotime:"\u2a02",xrarr:"\u27f6",xrArr:"\u27f9",Xscr:"\ud835\udcb3",xscr:"\ud835\udccd",xsqcup:"\u2a06",xuplus:"\u2a04",xutri:"\u25b3",xvee:"\u22c1",xwedge:"\u22c0",Yacute:"\xdd",yacute:"\xfd",YAcy:"\u042f",yacy:"\u044f",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042b",ycy:"\u044b",yen:"\xa5",Yfr:"\ud835\udd1c",yfr:"\ud835\udd36",YIcy:"\u0407",yicy:"\u0457",Yopf:"\ud835\udd50",yopf:"\ud835\udd6a",Yscr:"\ud835\udcb4",yscr:"\ud835\udcce",YUcy:"\u042e",yucy:"\u044e",yuml:"\xff",Yuml:"\u0178",Zacute:"\u0179",zacute:"\u017a",Zcaron:"\u017d",zcaron:"\u017e",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017b",zdot:"\u017c",zeetrf:"\u2128",ZeroWidthSpace:"\u200b",Zeta:"\u0396",zeta:"\u03b6",zfr:"\ud835\udd37",Zfr:"\u2128",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21dd",zopf:"\ud835\udd6b",Zopf:"\u2124",Zscr:"\ud835\udcb5",zscr:"\ud835\udccf",zwj:"\u200d",zwnj:"\u200c"}},{}],53:[function(e,r,t){"use strict";function n(e){var r=Array.prototype.slice.call(arguments,1);return r.forEach((function(r){r&&Object.keys(r).forEach((function(t){e[t]=r[t]}))})),e}function s(e){return Object.prototype.toString.call(e)}function o(e){return"[object Function]"===s(e)}function i(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var a={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};var c={"http:":{validate:function(e,r,t){var n=e.slice(r);return t.re.http||(t.re.http=new RegExp("^\\/\\/"+t.re.src_auth+t.re.src_host_port_strict+t.re.src_path,"i")),t.re.http.test(n)?n.match(t.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,r,t){var n=e.slice(r);return t.re.no_http||(t.re.no_http=new RegExp("^"+t.re.src_auth+"(?:localhost|(?:(?:"+t.re.src_domain+")\\.)+"+t.re.src_domain_root+")"+t.re.src_port+t.re.src_host_terminator+t.re.src_path,"i")),t.re.no_http.test(n)?r>=3&&":"===e[r-3]||r>=3&&"/"===e[r-3]?0:n.match(t.re.no_http)[0].length:0}},"mailto:":{validate:function(e,r,t){var n=e.slice(r);return t.re.mailto||(t.re.mailto=new RegExp("^"+t.re.src_email_name+"@"+t.re.src_host_strict,"i")),t.re.mailto.test(n)?n.match(t.re.mailto)[0].length:0}}},l="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444".split("|");function u(r){var t=r.re=e("./lib/re")(r.__opts__),n=r.__tlds__.slice();function a(e){return e.replace("%TLDS%",t.src_tlds)}r.onCompile(),r.__tlds_replaced__||n.push("a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]"),n.push(t.src_xn),t.src_tlds=n.join("|"),t.email_fuzzy=RegExp(a(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(a(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(a(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(a(t.tpl_host_fuzzy_test),"i");var c=[];function l(e,r){throw new Error('(LinkifyIt) Invalid schema "'+e+'": '+r)}r.__compiled__={},Object.keys(r.__schemas__).forEach((function(e){var t=r.__schemas__[e];if(null!==t){var n={validate:null,link:null};if(r.__compiled__[e]=n,"[object Object]"===s(t))return!function(e){return"[object RegExp]"===s(e)}(t.validate)?o(t.validate)?n.validate=t.validate:l(e,t):n.validate=function(e){return function(r,t){var n=r.slice(t);return e.test(n)?n.match(e)[0].length:0}}(t.validate),void(o(t.normalize)?n.normalize=t.normalize:t.normalize?l(e,t):n.normalize=function(e,r){r.normalize(e)});!function(e){return"[object String]"===s(e)}(t)?l(e,t):c.push(e)}})),c.forEach((function(e){r.__compiled__[r.__schemas__[e]]&&(r.__compiled__[e].validate=r.__compiled__[r.__schemas__[e]].validate,r.__compiled__[e].normalize=r.__compiled__[r.__schemas__[e]].normalize)})),r.__compiled__[""]={validate:null,normalize:function(e,r){r.normalize(e)}};var u=Object.keys(r.__compiled__).filter((function(e){return e.length>0&&r.__compiled__[e]})).map(i).join("|");r.re.schema_test=RegExp("(^|(?!_)(?:[><\uff5c]|"+t.src_ZPCc+"))("+u+")","i"),r.re.schema_search=RegExp("(^|(?!_)(?:[><\uff5c]|"+t.src_ZPCc+"))("+u+")","ig"),r.re.pretest=RegExp("("+r.re.schema_test.source+")|("+r.re.host_fuzzy_test.source+")|@","i"),function(e){e.__index__=-1,e.__text_cache__=""}(r)}function p(e,r){var t=e.__index__,n=e.__last_index__,s=e.__text_cache__.slice(t,n);this.schema=e.__schema__.toLowerCase(),this.index=t+r,this.lastIndex=n+r,this.raw=s,this.text=s,this.url=s}function h(e,r){var t=new p(e,r);return e.__compiled__[t.schema].normalize(t,e),t}function f(e,r){if(!(this instanceof f))return new f(e,r);var t;r||(t=e,Object.keys(t||{}).reduce((function(e,r){return e||a.hasOwnProperty(r)}),!1)&&(r=e,e={})),this.__opts__=n({},a,r),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=n({},c,e),this.__compiled__={},this.__tlds__=l,this.__tlds_replaced__=!1,this.re={},u(this)}f.prototype.add=function(e,r){return this.__schemas__[e]=r,u(this),this},f.prototype.set=function(e){return this.__opts__=n(this.__opts__,e),this},f.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var r,t,n,s,o,i,a,c;if(this.re.schema_test.test(e))for((a=this.re.schema_search).lastIndex=0;null!==(r=a.exec(e));)if(s=this.testSchemaAt(e,r[2],a.lastIndex)){this.__schema__=r[2],this.__index__=r.index+r[1].length,this.__last_index__=r.index+r[0].length+s;break}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(c=e.search(this.re.host_fuzzy_test))>=0&&(this.__index__<0||c=0&&null!==(n=e.match(this.re.email_fuzzy))&&(o=n.index+n[1].length,i=n.index+n[0].length,(this.__index__<0||othis.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=i)),this.__index__>=0},f.prototype.pretest=function(e){return this.re.pretest.test(e)},f.prototype.testSchemaAt=function(e,r,t){return this.__compiled__[r.toLowerCase()]?this.__compiled__[r.toLowerCase()].validate(e,t,this):0},f.prototype.match=function(e){var r=0,t=[];this.__index__>=0&&this.__text_cache__===e&&(t.push(h(this,r)),r=this.__last_index__);for(var n=r?e.slice(r):e;this.test(n);)t.push(h(this,r)),n=n.slice(this.__last_index__),r+=this.__last_index__;return t.length?t:null},f.prototype.tlds=function(e,r){return e=Array.isArray(e)?e:[e],r?(this.__tlds__=this.__tlds__.concat(e).sort().filter((function(e,r,t){return e!==t[r-1]})).reverse(),u(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,u(this),this)},f.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),"mailto:"!==e.schema||/^mailto:/i.test(e.url)||(e.url="mailto:"+e.url)},f.prototype.onCompile=function(){},r.exports=f},{"./lib/re":54}],54:[function(e,r,t){"use strict";r.exports=function(r){var t={};t.src_Any=e("uc.micro/properties/Any/regex").source,t.src_Cc=e("uc.micro/categories/Cc/regex").source,t.src_Z=e("uc.micro/categories/Z/regex").source,t.src_P=e("uc.micro/categories/P/regex").source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");return t.src_pseudo_letter="(?:(?![><\uff5c]|"+t.src_ZPCc+")"+t.src_Any+")",t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|[><\uff5c]|"+t.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|[><\uff5c]|[()[\\]{}.,\"'?!\\-]).|\\[(?:(?!"+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-]).|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+t.src_ZCc+"|[.]).|"+(r&&r["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+t.src_ZCc+").|\\!+(?!"+t.src_ZCc+"|[!]).|\\?(?!"+t.src_ZCc+"|[?]).)+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy='(^|[><\uff5c]|"|\\(|'+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+t.src_ZPCc+"))((?![$+<=>^`|\uff5c])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+t.src_ZPCc+"))((?![$+<=>^`|\uff5c])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}},{"uc.micro/categories/Cc/regex":61,"uc.micro/categories/P/regex":63,"uc.micro/categories/Z/regex":64,"uc.micro/properties/Any/regex":66}],55:[function(e,r,t){"use strict";var n={};function s(e,r){var t;return"string"!=typeof r&&(r=s.defaultChars),t=function(e){var r,t,s=n[e];if(s)return s;for(s=n[e]=[],r=0;r<128;r++)t=String.fromCharCode(r),s.push(t);for(r=0;r=55296&&c<=57343?"\ufffd\ufffd\ufffd":String.fromCharCode(c),r+=6):240==(248&s)&&r+91114111?l+="\ufffd\ufffd\ufffd\ufffd":(c-=65536,l+=String.fromCharCode(55296+(c>>10),56320+(1023&c))),r+=9):l+="\ufffd";return l}))}s.defaultChars=";/?:@&=+$,#",s.componentChars="",r.exports=s},{}],56:[function(e,r,t){"use strict";var n={};function s(e,r,t){var o,i,a,c,l,u="";for("string"!=typeof r&&(t=r,r=s.defaultChars),void 0===t&&(t=!0),l=function(e){var r,t,s=n[e];if(s)return s;for(s=n[e]=[],r=0;r<128;r++)t=String.fromCharCode(r),/^[0-9a-z]$/i.test(t)?s.push(t):s.push("%"+("0"+r.toString(16).toUpperCase()).slice(-2));for(r=0;r=55296&&a<=57343){if(a>=55296&&a<=56319&&o+1=56320&&c<=57343){u+=encodeURIComponent(e[o]+e[o+1]),o++;continue}u+="%EF%BF%BD"}else u+=encodeURIComponent(e[o]);return u}s.defaultChars=";/?:@&=+$,-_.!~*'()#",s.componentChars="-_.!~*'()",r.exports=s},{}],57:[function(e,r,t){"use strict";r.exports=function(e){var r="";return r+=e.protocol||"",r+=e.slashes?"//":"",r+=e.auth?e.auth+"@":"",e.hostname&&-1!==e.hostname.indexOf(":")?r+="["+e.hostname+"]":r+=e.hostname||"",r+=e.port?":"+e.port:"",r+=e.pathname||"",r+=e.search||"",r+=e.hash||""}},{}],58:[function(e,r,t){"use strict";r.exports.encode=e("./encode"),r.exports.decode=e("./decode"),r.exports.format=e("./format"),r.exports.parse=e("./parse")},{"./decode":55,"./encode":56,"./format":57,"./parse":59}],59:[function(e,r,t){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var s=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,i=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,a=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(a),l=["%","/","?",";","#"].concat(c),u=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},d={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};n.prototype.parse=function(e,r){var t,n,o,a,c,m=e;if(m=m.trim(),!r&&1===e.split("#").length){var _=i.exec(m);if(_)return this.pathname=_[1],_[2]&&(this.search=_[2]),this}var g=s.exec(m);if(g&&(o=(g=g[0]).toLowerCase(),this.protocol=g,m=m.substr(g.length)),(r||g||m.match(/^\/\/[^@\/]+@[^@\/]+/))&&(!(c="//"===m.substr(0,2))||g&&f[g]||(m=m.substr(2),this.slashes=!0)),!f[g]&&(c||g&&!d[g])){var k,b,v=-1;for(t=0;t127?w+="x":w+=A[D];if(!w.match(p)){var q=x.slice(0,t),F=x.slice(t+1),S=A.match(h);S&&(q.push(S[1]),F.unshift(S[2])),F.length&&(m=F.join(".")+m),this.hostname=q.join(".");break}}}}this.hostname.length>255&&(this.hostname=""),y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var L=m.indexOf("#");-1!==L&&(this.hash=m.substr(L),m=m.slice(0,L));var z=m.indexOf("?");return-1!==z&&(this.search=m.substr(z),m=m.slice(0,z)),m&&(this.pathname=m),d[o]&&this.hostname&&!this.pathname&&(this.pathname=""),this},n.prototype.parseHost=function(e){var r=o.exec(e);r&&(":"!==(r=r[0])&&(this.port=r.substr(1)),e=e.substr(0,e.length-r.length)),e&&(this.hostname=e)},r.exports=function(e,r){if(e&&e instanceof n)return e;var t=new n;return t.parse(e,r),t}},{}],60:[function(e,r,t){(function(e){!function(n){var s="object"==typeof t&&t&&!t.nodeType&&t,o="object"==typeof r&&r&&!r.nodeType&&r,i="object"==typeof e&&e;i.global!==i&&i.window!==i&&i.self!==i||(n=i);var a,c,l=2147483647,u=/^xn--/,p=/[^\x20-\x7E]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=Math.floor,m=String.fromCharCode;function _(e){throw new RangeError(f[e])}function g(e,r){for(var t=e.length,n=[];t--;)n[t]=r(e[t]);return n}function k(e,r){var t=e.split("@"),n="";return t.length>1&&(n=t[0]+"@",e=t[1]),n+g((e=e.replace(h,".")).split("."),r).join(".")}function b(e){for(var r,t,n=[],s=0,o=e.length;s=55296&&r<=56319&&s65535&&(r+=m((e-=65536)>>>10&1023|55296),e=56320|1023&e),r+=m(e)})).join("")}function C(e,r){return e+22+75*(e<26)-((0!=r)<<5)}function y(e,r,t){var n=0;for(e=t?d(e/700):e>>1,e+=d(e/r);e>455;n+=36)e=d(e/35);return d(n+36*e/(e+38))}function x(e){var r,t,n,s,o,i,a,c,u,p,h,f=[],m=e.length,g=0,k=128,b=72;for((t=e.lastIndexOf("-"))<0&&(t=0),n=0;n=128&&_("not-basic"),f.push(e.charCodeAt(n));for(s=t>0?t+1:0;s=m&&_("invalid-input"),((c=(h=e.charCodeAt(s++))-48<10?h-22:h-65<26?h-65:h-97<26?h-97:36)>=36||c>d((l-g)/i))&&_("overflow"),g+=c*i,!(c<(u=a<=b?1:a>=b+26?26:a-b));a+=36)i>d(l/(p=36-u))&&_("overflow"),i*=p;b=y(g-o,r=f.length+1,0==o),d(g/r)>l-k&&_("overflow"),k+=d(g/r),g%=r,f.splice(g++,0,k)}return v(f)}function A(e){var r,t,n,s,o,i,a,c,u,p,h,f,g,k,v,x=[];for(f=(e=b(e)).length,r=128,t=0,o=72,i=0;i=r&&hd((l-t)/(g=n+1))&&_("overflow"),t+=(a-r)*g,r=a,i=0;il&&_("overflow"),h==r){for(c=t,u=36;!(c<(p=u<=o?1:u>=o+26?26:u-o));u+=36)v=c-p,k=36-p,x.push(m(C(p+v%k,0))),c=d(v/k);x.push(m(C(c,0))),o=y(t,g,n==s),t=0,++n}++t,++r}return x.join("")}if(a={version:"1.4.1",ucs2:{decode:b,encode:v},decode:x,encode:A,toASCII:function(e){return k(e,(function(e){return p.test(e)?"xn--"+A(e):e}))},toUnicode:function(e){return k(e,(function(e){return u.test(e)?x(e.slice(4).toLowerCase()):e}))}},s&&o)if(r.exports==s)o.exports=a;else for(c in a)a.hasOwnProperty(c)&&(s[c]=a[c]);else n.punycode=a}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],61:[function(e,r,t){r.exports=/[\0-\x1F\x7F-\x9F]/},{}],62:[function(e,r,t){r.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/},{}],63:[function(e,r,t){r.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/},{}],64:[function(e,r,t){r.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/},{}],65:[function(e,r,t){"use strict";t.Any=e("./properties/Any/regex"),t.Cc=e("./categories/Cc/regex"),t.Cf=e("./categories/Cf/regex"),t.P=e("./categories/P/regex"),t.Z=e("./categories/Z/regex")},{"./categories/Cc/regex":61,"./categories/Cf/regex":62,"./categories/P/regex":63,"./categories/Z/regex":64,"./properties/Any/regex":66}],66:[function(e,r,t){r.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/},{}],67:[function(e,r,t){"use strict";r.exports=e("./lib/")},{"./lib/":9}]},{},[67])(67)})); diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/squire-rte/squire.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/squire-rte/squire.js new file mode 100644 index 0000000000..dfbdbf79e3 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/squire-rte/squire.js @@ -0,0 +1,2 @@ +!function(e,t){"use strict";function n(e,t,n){this.root=this.currentNode=e,this.nodeType=t,this.filter=n||ue}function o(e,t){for(var n=e.length;n--;)if(!t(e[n]))return!1;return!0}function i(e){return e.nodeType===M&&!!pe[e.nodeName]}function r(e){switch(e.nodeType){case H:return me;case M:case z:if(de&&Ce.has(e))return Ce.get(e);break;default:return ge}var t;return t=o(e.childNodes,a)?fe.test(e.nodeName)?me:ve:Ne,de&&Ce.set(e,t),t}function a(e){return r(e)===me}function s(e){return r(e)===ve}function d(e){return r(e)===Ne}function l(e,t){var o=new n(t,q,s);return o.currentNode=e,o}function c(e,t){return e=l(e,t).previousNode(),e!==t?e:null}function h(e,t){return e=l(e,t).nextNode(),e!==t?e:null}function u(e){return!e.textContent&&!e.querySelector("IMG")}function f(e,t){return!i(e)&&e.nodeType===t.nodeType&&e.nodeName===t.nodeName&&"A"!==e.nodeName&&e.className===t.className&&(!e.style&&!t.style||e.style.cssText===t.style.cssText)}function p(e,t,n){if(e.nodeName!==t)return!1;for(var o in n)if(e.getAttribute(o)!==n[o])return!1;return!0}function g(e,t,n,o){for(;e&&e!==t;){if(p(e,n,o))return e;e=e.parentNode}return null}function m(e,t,n){for(;e&&e!==t;){if(n.test(e.nodeName))return e;e=e.parentNode}return null}function v(e,t){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function N(e,t,n){var o,i,r,a,s,d="";return e&&e!==t&&(d=N(e.parentNode,t,n),e.nodeType===M&&(d+=(d?">":"")+e.nodeName,(o=e.id)&&(d+="#"+o),(i=e.className.trim())&&(r=i.split(/\s\s*/),r.sort(),d+=".",d+=r.join(".")),(a=e.dir)&&(d+="[dir="+a+"]"),r&&(s=n.classNames,ce.call(r,s.highlight)>-1&&(d+="[backgroundColor="+e.style.backgroundColor.replace(/ /g,"")+"]"),ce.call(r,s.colour)>-1&&(d+="[color="+e.style.color.replace(/ /g,"")+"]"),ce.call(r,s.fontFamily)>-1&&(d+="[fontFamily="+e.style.fontFamily.replace(/ /g,"")+"]"),ce.call(r,s.fontSize)>-1&&(d+="[fontSize="+e.style.fontSize+"]")))),d}function C(e){var t=e.nodeType;return t===M||t===z?e.childNodes.length:e.length||0}function _(e){var t=e.parentNode;return t&&t.removeChild(e),e}function S(e,t){var n=e.parentNode;n&&n.replaceChild(t,e)}function y(e){for(var t=e.ownerDocument.createDocumentFragment(),n=e.childNodes,o=n?n.length:0;o--;)t.appendChild(e.firstChild);return t}function T(e,n,o,i){var r,a,s,d=e.createElement(n);if(o instanceof Array&&(i=o,o=null),o)for(r in o)o[r]!==t&&d.setAttribute(r,o[r]);if(i)for(a=0,s=i.length;as?t.startOffset-=1:t.startOffset===s&&(t.startContainer=o,t.startOffset=C(o))),t.endContainer===e&&(t.endOffset>s?t.endOffset-=1:t.endOffset===s&&(t.endContainer=o,t.endOffset=C(o))),_(n),n.nodeType===H?o.appendData(n.data):d.push(y(n));else if(n.nodeType===M){for(i=d.length;i--;)n.appendChild(d.pop());x(n,t)}}function A(e,t){if(e.nodeType===H&&(e=e.parentNode),e.nodeType===M){var n={startContainer:t.startContainer,startOffset:t.startOffset,endContainer:t.endContainer,endOffset:t.endOffset};x(e,n),t.setStart(n.startContainer,n.startOffset),t.setEnd(n.endContainer,n.endOffset)}}function L(e){var t=e.nodeName;return"TD"===t||"TH"===t||"TR"===t||"TBODY"===t||"THEAD"===t}function B(e,t,n,o){var i,r,a,s=t;if(!L(e)||!L(t)){for(;(i=s.parentNode)&&i!==o&&i.nodeType===M&&1===i.childNodes.length;)s=i;_(s),a=e.childNodes.length,r=e.lastChild,r&&"BR"===r.nodeName&&(e.removeChild(r),a-=1),e.appendChild(y(t)),n.setStart(e,a),n.collapse(!0),A(e,n),J&&(r=e.lastChild)&&"BR"===r.nodeName&&e.removeChild(r)}}function O(e,t){var n,o,i=e.previousSibling,r=e.firstChild,a=e.ownerDocument,s="LI"===e.nodeName;if((!s||r&&/^[OU]L$/.test(r.nodeName))&&!L(e))if(i&&f(i,e)&&i.isContentEditable&&e.isContentEditable){if(!d(i)){if(!s)return;o=T(a,"DIV"),o.appendChild(y(i)),i.appendChild(o)}_(e),n=!d(e),i.appendChild(y(e)),n&&b(i,t),r&&O(r,t)}else s&&(i=T(a,"DIV"),e.insertBefore(i,r),E(i,t))}function R(e){this.isShiftDown=e.shiftKey}function D(e,t,n){var o,i;if(e||(e={}),t)for(o in t)!n&&o in e||(i=t[o],e[o]=i&&i.constructor===Object?D(e[o],i,n):i);return e}function P(e,t){e.nodeType===W&&(e=e.body);var n,o=e.ownerDocument,i=o.defaultView;this._win=i,this._doc=o,this._root=e,this._events={},this._isFocused=!1,this._lastSelection=null,ae&&this.addEventListener("beforedeactivate",this.getSelection),this._hasZWS=!1,this._lastAnchorNode=null,this._lastFocusNode=null,this._path="",this._willUpdatePath=!1,"onselectionchange"in o?this.addEventListener("selectionchange",this._updatePathOnEvent):(this.addEventListener("keyup",this._updatePathOnEvent),this.addEventListener("mouseup",this._updatePathOnEvent)),this._undoIndex=-1,this._undoStack=[],this._undoStackLength=0,this._isInUndoState=!1,this._ignoreChange=!1,this._ignoreAllChanges=!1,se?(n=new MutationObserver(this._docWasChanged.bind(this)),n.observe(e,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),this._mutation=n):this.addEventListener("keyup",this._keyUpDetectChange),this._restoreSelection=!1,this.addEventListener("blur",U),this.addEventListener("mousedown",I),this.addEventListener("touchstart",I),this.addEventListener("focus",w),this._awaitingPaste=!1,this.addEventListener(X?"beforecut":"cut",nt),this.addEventListener("copy",ot),this.addEventListener("keydown",R),this.addEventListener("keyup",R),this.addEventListener(X?"beforepaste":"paste",it),this.addEventListener("drop",rt),this.addEventListener(J?"keypress":"keydown",Ie),this._keyHandlers=Object.create(He),this.setConfig(t),X&&(i.Text.prototype.splitText=function(e){var t=this.ownerDocument.createTextNode(this.data.slice(e)),n=this.nextSibling,o=this.parentNode,i=this.length-e;return n?o.insertBefore(t,n):o.appendChild(t),i&&this.deleteData(e,i),t}),e.setAttribute("contenteditable","true");try{o.execCommand("enableObjectResizing",!1,"false"),o.execCommand("enableInlineTableEditing",!1,"false")}catch(e){}e.__squire__=this,this.setHTML("")}function U(){this._restoreSelection=!0}function I(){this._restoreSelection=!1}function w(){this._restoreSelection&&this.setSelection(this._lastSelection)}function F(e,t,n){var o,i;for(o=t.firstChild;o;o=i){if(i=o.nextSibling,a(o)){if(o.nodeType===H||"BR"===o.nodeName||"IMG"===o.nodeName){n.appendChild(o);continue}}else if(s(o)){n.appendChild(e.createDefaultBlock([F(e,o,e._doc.createDocumentFragment())]));continue}F(e,o,n)}return n}var M=1,H=3,W=9,z=11,q=1,K="​",G=e.defaultView,Z=navigator.userAgent,j=/Android/.test(Z),Q=/iP(?:ad|hone|od)/.test(Z),$=/Mac OS X/.test(Z),V=/Windows NT/.test(Z),Y=/Gecko\//.test(Z),X=/Trident\/[456]\./.test(Z),J=!!G.opera,ee=/Edge\//.test(Z),te=!ee&&/WebKit\//.test(Z),ne=/Trident\/[4567]\./.test(Z),oe=$?"meta-":"ctrl-",ie=X||J,re=X||te,ae=X,se="undefined"!=typeof MutationObserver,de="undefined"!=typeof WeakMap,le=/[^ \t\r\n]/,ce=Array.prototype.indexOf;Object.create||(Object.create=function(e){var t=function(){};return t.prototype=e,new t});var he={1:1,2:2,3:4,8:128,9:256,11:1024},ue=function(){return!0};n.prototype.nextNode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){for(e=t.firstChild;!e&&t&&t!==n;)(e=t.nextSibling)||(t=t.parentNode);if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}},n.prototype.previousNode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){if(t===n)return null;if(e=t.previousSibling)for(;t=e.lastChild;)e=t;else e=t.parentNode;if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}},n.prototype.previousPONode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){for(e=t.lastChild;!e&&t&&t!==n;)(e=t.previousSibling)||(t=t.parentNode);if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}};var fe=/^(?:#text|A(?:BBR|CRONYM)?|B(?:R|D[IO])?|C(?:ITE|ODE)|D(?:ATA|EL|FN)|EM|FONT|I(?:FRAME|MG|NPUT|NS)?|KBD|Q|R(?:P|T|UBY)|S(?:AMP|MALL|PAN|TR(?:IKE|ONG)|U[BP])?|TIME|U|VAR|WBR)$/,pe={BR:1,HR:1,IFRAME:1,IMG:1,INPUT:1},ge=0,me=1,ve=2,Ne=3,Ce=de?new WeakMap:null,_e=function(e,t){for(var n=e.childNodes;t&&e.nodeType===M;)e=n[t-1],n=e.childNodes,t=n.length;return e},Se=function(e,t){if(e.nodeType===M){var n=e.childNodes;if(t-1,r=e.compareBoundaryPoints(1,o)<1;return!i&&!r}var a=e.compareBoundaryPoints(0,o)<1,s=e.compareBoundaryPoints(2,o)>-1;return a&&s},xe=function(e){for(var t,n=e.startContainer,o=e.startOffset,r=e.endContainer,a=e.endOffset,s=!0;n.nodeType!==H&&(t=n.childNodes[o])&&!i(t);)n=t,o=0;if(a)for(;r.nodeType!==H;){if(!(t=r.childNodes[a-1])||i(t)){if(s&&t&&"BR"===t.nodeName){a-=1,s=!1;continue}break}r=t,a=C(r)}else for(;r.nodeType!==H&&(t=r.firstChild)&&!i(t);)r=t;e.collapsed?(e.setStart(r,a),e.setEnd(n,o)):(e.setStart(n,o),e.setEnd(r,a))},Ae=function(e,t,n,o){var i,r=e.startContainer,a=e.startOffset,s=e.endContainer,d=e.endOffset,l=!0;for(t||(t=e.commonAncestorContainer),n||(n=t);!a&&r!==t&&r!==o;)i=r.parentNode,a=ce.call(i.childNodes,r),r=i;for(;;){if(l&&s.nodeType!==H&&s.childNodes[d]&&"BR"===s.childNodes[d].nodeName&&(d+=1,l=!1),s===n||s===o||d!==C(s))break;i=s.parentNode,d=ce.call(i.childNodes,s)+1,s=i}e.setStart(r,a),e.setEnd(s,d)},Le=function(e,t){var n,o=e.startContainer;return a(o)?n=c(o,t):o!==t&&s(o)?n=o:(n=_e(o,e.startOffset),n=h(n,t)),n&&ke(e,n,!0)?n:null},Be=function(e,t){var n,o,i=e.endContainer;if(a(i))n=c(i,t);else if(i!==t&&s(i))n=i;else{if(!(n=Se(i,e.endOffset))||!v(t,n))for(n=t;o=n.lastChild;)n=o;n=c(n,t)}return n&&ke(e,n,!0)?n:null},Oe=new n(null,4|q,function(e){return e.nodeType===H?le.test(e.data):"IMG"===e.nodeName}),Re=function(e,t){var n,o=e.startContainer,i=e.startOffset;if(Oe.root=null,o.nodeType===H){if(i)return!1;n=o}else if(n=Se(o,i),n&&!v(t,n)&&(n=null),!n&&(n=_e(o,i),n.nodeType===H&&n.length))return!1;return Oe.currentNode=n,Oe.root=Le(e,t),!Oe.previousNode()},De=function(e,t){var n,o=e.endContainer,i=e.endOffset;if(Oe.root=null,o.nodeType===H){if((n=o.data.length)&&i-1||!Y&&ce.call(i,"text/plain")>-1&&ce.call(i,"text/rtf")<0))return e.preventDefault(),void(!d&&(r=a.getData("text/html"))?this.insertHTML(r,!0):((r=a.getData("text/plain"))||(r=a.getData("text/uri-list")))&&this.insertPlainText(r,!0));this._awaitingPaste=!0;var f=this._doc.body,p=this.getSelection(),g=p.startContainer,m=p.startOffset,v=p.endContainer,N=p.endOffset,C=this.createElement("DIV",{contenteditable:"true",style:"position:fixed; overflow:hidden; top:0; right:100%; width:1px; height:1px;"});f.appendChild(C),p.selectNodeContents(C),this.setSelection(p),setTimeout(function(){try{u._awaitingPaste=!1;for(var e,t,n="",o=C;C=o;)o=C.nextSibling,_(C),e=C.firstChild,e&&e===C.lastChild&&"DIV"===e.nodeName&&(C=e),n+=C.innerHTML;t=u.createRange(g,m,v,N),u.setSelection(t),n&&u.insertHTML(n,!0)}catch(e){u.didError(e)}},0)},rt=function(e){for(var t=e.dataTransfer.types,n=t.length,o=!1,i=!1;n--;)switch(t[n]){case"text/plain":o=!0;break;case"text/html":i=!0;break;default:return}(i||o)&&this.saveUndoState()},at=P.prototype,st=function(e,t,n){var o=n._doc,i=e?DOMPurify.sanitize(e,{ALLOW_UNKNOWN_PROTOCOLS:!0,WHOLE_DOCUMENT:!1,RETURN_DOM:!0,RETURN_DOM_FRAGMENT:!0}):null;return i?o.importNode(i,!0):o.createDocumentFragment()};at.setConfig=function(e){return e=D({blockTag:"DIV",blockAttributes:null,tagAttributes:{blockquote:null,ul:null,ol:null,li:null,a:null},classNames:{colour:"colour",fontFamily:"font",fontSize:"size",highlight:"highlight"},leafNodeNames:pe,undo:{documentSizeThreshold:-1,undoLimit:-1},isInsertedHTMLSanitized:!0,isSetHTMLSanitized:!0,sanitizeToDOMFragment:"undefined"!=typeof DOMPurify&&DOMPurify.isSupported?st:null,willCutCopy:null,allowedBlocks:[]},e,!0),e.blockTag=e.blockTag.toUpperCase(),this._config=e,this},at.createElement=function(e,t,n){return T(this._doc,e,t,n)},at.createDefaultBlock=function(e){var t=this._config;return E(this.createElement(t.blockTag,t.blockAttributes,e),this._root)},at.didError=function(e){console.log(e)},at.getDocument=function(){return this._doc},at.getRoot=function(){return this._root},at.modifyDocument=function(e){var t=this._mutation;t&&(t.takeRecords().length&&this._docWasChanged(),t.disconnect()),this._ignoreAllChanges=!0,e(),this._ignoreAllChanges=!1,t&&(t.observe(this._root,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),this._ignoreChange=!1)};var dt={pathChange:1,select:1,input:1,undoStateChange:1};at.fireEvent=function(e,t){var n,o,i,r=this._events[e];if(/^(?:focus|blur)/.test(e))if(n=this._root===this._doc.activeElement,"focus"===e){if(!n||this._isFocused)return this;this._isFocused=!0}else{if(n||!this._isFocused)return this;this._isFocused=!1}if(r)for(t||(t={}),t.type!==e&&(t.type=e),r=r.slice(),o=r.length;o--;){i=r[o];try{i.handleEvent?i.handleEvent(t):i.call(this,t)}catch(t){t.details="Squire: fireEvent error. Event type: "+e,this.didError(t)}}return this},at.destroy=function(){var e,t=this._events;for(e in t)this.removeEventListener(e);this._mutation&&this._mutation.disconnect(),delete this._root.__squire__,this._undoIndex=-1,this._undoStack=[],this._undoStackLength=0},at.handleEvent=function(e){this.fireEvent(e.type,e)},at.addEventListener=function(e,t){var n=this._events[e],o=this._root;return t?(n||(n=this._events[e]=[],dt[e]||("selectionchange"===e&&(o=this._doc),o.addEventListener(e,this,!0))),n.push(t),this):(this.didError({name:"Squire: addEventListener with null or undefined fn",message:"Event type: "+e}),this)},at.removeEventListener=function(e,t){var n,o=this._events[e],i=this._root;if(o){if(t)for(n=o.length;n--;)o[n]===t&&o.splice(n,1);else o.length=0;o.length||(delete this._events[e],dt[e]||("selectionchange"===e&&(i=this._doc),i.removeEventListener(e,this,!0)))}return this},at.createRange=function(e,t,n,o){if(e instanceof this._win.Range)return e.cloneRange();var i=this._doc.createRange();return i.setStart(e,t),n?i.setEnd(n,o):i.setEnd(e,t),i},at.getCursorPosition=function(e){if(!e&&!(e=this.getSelection())||!e.getBoundingClientRect)return null;var t,n,o=e.getBoundingClientRect();return o&&!o.top&&(this._ignoreChange=!0,t=this._doc.createElement("SPAN"),t.textContent=K,ye(e,t),o=t.getBoundingClientRect(),n=t.parentNode,n.removeChild(t),A(n,e)),o},at._moveCursorTo=function(e){var t=this._root,n=this.createRange(t,e?0:t.childNodes.length);return xe(n),this.setSelection(n),this},at.moveCursorToStart=function(){return this._moveCursorTo(!0)},at.moveCursorToEnd=function(){return this._moveCursorTo(!1)};var lt=function(e){return e._win.getSelection()||null};at.setSelection=function(e){if(e)if(this._lastSelection=e,this._isFocused)if(j&&!this._restoreSelection)U.call(this),this.blur(),this.focus();else{Q&&this._win.focus();var t=lt(this);t&&(t.removeAllRanges(),t.addRange(e))}else U.call(this);return this},at.getSelection=function(){var e,t,n,o,r=lt(this),a=this._root;return this._isFocused&&r&&r.rangeCount&&(e=r.getRangeAt(0).cloneRange(),t=e.startContainer,n=e.endContainer,t&&i(t)&&e.setStartBefore(t),n&&i(n)&&e.setEndBefore(n)),e&&v(a,e.commonAncestorContainer)?this._lastSelection=e:(e=this._lastSelection,o=e.commonAncestorContainer,v(o.ownerDocument,o)||(e=null)),e||(e=this.createRange(a.firstChild,0)),e},at.getSelectedText=function(){var e=this.getSelection();if(!e||e.collapsed)return"";var t,o=new n(e.commonAncestorContainer,4|q,function(t){return ke(e,t,!0)}),i=e.startContainer,r=e.endContainer,s=o.currentNode=i,d="",l=!1;for(o.filter(s)||(s=o.nextNode());s;)s.nodeType===H?(t=s.data)&&/\S/.test(t)&&(s===r&&(t=t.slice(0,e.endOffset)),s===i&&(t=t.slice(e.startOffset)),d+=t,l=!0):("BR"===s.nodeName||l&&!a(s))&&(d+="\n",l=!1),s=o.nextNode();return d},at.getPath=function(){return this._path};var ct=function(e,t){for(var o,i,r,s=new n(e,4);i=s.nextNode();)for(;(r=i.data.indexOf(K))>-1&&(!t||i.parentNode!==t);){if(1===i.length){do{o=i.parentNode,o.removeChild(i),i=o,s.currentNode=o}while(a(i)&&!C(i));break}i.deleteData(r,1)}};at._didAddZWS=function(){this._hasZWS=!0},at._removeZWS=function(){this._hasZWS&&(ct(this._root),this._hasZWS=!1)},at._updatePath=function(e,t){if(e){var n,o=e.startContainer,i=e.endContainer;(t||o!==this._lastAnchorNode||i!==this._lastFocusNode)&&(this._lastAnchorNode=o,this._lastFocusNode=i, +n=o&&i?o===i?N(i,this._root,this._config):"(selection)":"",this._path!==n&&(this._path=n,this.fireEvent("pathChange",{path:n}))),this.fireEvent(e.collapsed?"cursor":"select",{range:e})}},at._updatePathOnEvent=function(e){var t=this;t._isFocused&&!t._willUpdatePath&&(t._willUpdatePath=!0,setTimeout(function(){t._willUpdatePath=!1,t._updatePath(t.getSelection())},0))},at.focus=function(){if(ne){try{this._root.setActive()}catch(e){}this.fireEvent("focus")}else this._root.focus();return this},at.blur=function(){return this._root.blur(),ne&&this.fireEvent("blur"),this};var ht="squire-selection-end";at._saveRangeToBookmark=function(e){var t,n=this.createElement("INPUT",{id:"squire-selection-start",type:"hidden"}),o=this.createElement("INPUT",{id:ht,type:"hidden"});ye(e,n),e.collapse(!1),ye(e,o),2&n.compareDocumentPosition(o)&&(n.id=ht,o.id="squire-selection-start",t=n,n=o,o=t),e.setStartAfter(n),e.setEndBefore(o)},at._getRangeAndRemoveBookmark=function(e){var t=this._root,n=t.querySelector("#squire-selection-start"),o=t.querySelector("#"+ht);if(n&&o){var i=n.parentNode,r=o.parentNode,a=ce.call(i.childNodes,n),s=ce.call(r.childNodes,o);i===r&&(s-=1),_(n),_(o),e||(e=this._doc.createRange()),e.setStart(i,a),e.setEnd(r,s),A(i,e),i!==r&&A(r,e),e.collapsed&&(i=e.startContainer,i.nodeType===H&&(r=i.childNodes[e.startOffset],r&&r.nodeType===H||(r=i.childNodes[e.startOffset-1]),r&&r.nodeType===H&&(e.setStart(r,0),e.collapse(!0))))}return e||null},at._keyUpDetectChange=function(e){var t=e.keyCode;e.ctrlKey||e.metaKey||e.altKey||!(t<16||t>20)||!(t<33||t>45)||this._docWasChanged()},at._docWasChanged=function(){if(de&&(Ce=new WeakMap),!this._ignoreAllChanges){if(se&&this._ignoreChange)return void(this._ignoreChange=!1);this._isInUndoState&&(this._isInUndoState=!1,this.fireEvent("undoStateChange",{canUndo:!0,canRedo:!1})),this.fireEvent("input")}},at._recordUndoState=function(e,t){if(!this._isInUndoState||t){var n,o=this._undoIndex,i=this._undoStack,r=this._config.undo,a=r.documentSizeThreshold,s=r.undoLimit;t||(o+=1),o-1&&2*n.length>a&&s>-1&&o>s&&(i.splice(0,o-s),o=s,this._undoStackLength=s),i[o]=n,this._undoIndex=o,this._undoStackLength+=1,this._isInUndoState=!0}},at.saveUndoState=function(e){return e===t&&(e=this.getSelection()),this._recordUndoState(e,this._isInUndoState),this._getRangeAndRemoveBookmark(e),this},at.undo=function(){if(0!==this._undoIndex||!this._isInUndoState){this._recordUndoState(this.getSelection(),!1),this._undoIndex-=1,this._setHTML(this._undoStack[this._undoIndex]);var e=this._getRangeAndRemoveBookmark();e&&this.setSelection(e),this._isInUndoState=!0,this.fireEvent("undoStateChange",{canUndo:0!==this._undoIndex,canRedo:!0}),this.fireEvent("input")}return this},at.redo=function(){var e=this._undoIndex,t=this._undoStackLength;if(e+1c&&h.splitText(c),h===s&&l&&(h=h.splitText(l),d===s&&(d=h,c-=l),s=h,l=0),i=this.createElement(e,t),S(h,i),i.appendChild(h))}while(r.nextNode());d.nodeType!==H&&(h.nodeType===H?(d=h,c=h.length):(d=h.parentNode,c=1)),o=this.createRange(s,l,d,c)}return o},at._removeFormat=function(e,t,n,o){this._saveRangeToBookmark(n);var i,r=this._doc;n.collapsed&&(re?(i=r.createTextNode(K),this._didAddZWS()):i=r.createTextNode(""),ye(n,i));for(var s=n.commonAncestorContainer;a(s);)s=s.parentNode;var d=n.startContainer,l=n.startOffset,c=n.endContainer,h=n.endOffset,u=[],f=function(e,t){if(!ke(n,e,!1)){var o,i,r=e.nodeType===H;if(!ke(n,e,!0))return void("INPUT"===e.nodeName||r&&!e.data||u.push([t,e]));if(r)e===c&&h!==e.length&&u.push([t,e.splitText(h)]),e===d&&l&&(e.splitText(l),u.push([t,e]));else for(o=e.firstChild;o;o=i)i=o.nextSibling,f(o,t)}},g=Array.prototype.filter.call(s.getElementsByTagName(e),function(o){return ke(n,o,!0)&&p(o,e,t)});return o||g.forEach(function(e){f(e,e)}),u.forEach(function(e){var t=e[0].cloneNode(!1),n=e[1];S(n,t),t.appendChild(n)}),g.forEach(function(e){S(e,y(e))}),this._getRangeAndRemoveBookmark(n),i&&n.collapse(!1),A(s,n),n},at.changeFormat=function(e,t,n,o){return n||(n=this.getSelection())?(this.saveUndoState(n),t&&(n=this._removeFormat(t.tag.toUpperCase(),t.attributes||{},n,o)),e&&(n=this._addFormat(e.tag.toUpperCase(),e.attributes||{},n)),this.setSelection(n),this._updatePath(n,!0),se||this._docWasChanged(),this):this};var ut={DT:"DD",DD:"DT",LI:"LI",PRE:"PRE"},ft=function(e,t,n,o){var i=ut[t.nodeName],r=null,a=k(n,o,t.parentNode,e._root),s=e._config;return i||(i=s.blockTag,r=s.blockAttributes),p(a,i,r)||(t=T(a.ownerDocument,i,r),a.dir&&(t.dir=a.dir),S(a,t),t.appendChild(y(a)),a=t),a};at.forEachBlock=function(e,t,n){if(!n&&!(n=this.getSelection()))return this;t&&this.saveUndoState(n);var o=this._root,i=Le(n,o),r=Be(n,o);if(i&&r)do{if(e(i)||i===r)break}while(i=h(i,o));return t&&(this.setSelection(n),this._updatePath(n,!0),se||this._docWasChanged()),this},at.modifyBlocks=function(e,t){if(!t&&!(t=this.getSelection()))return this;this._recordUndoState(t,this._isInUndoState);var n,o=this._root;return Pe(t,o),Ae(t,o,o,o),n=Te(t,o,o),ye(t,e.call(this,n)),t.endOffset]+|\([^\s()<>]+\))+(?:\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))|([\w\-.%+]+@(?:[\w\-]+\.)+[A-Z]{2,}\b)(?:\?[^&?\s]+=[^&?\s]+(?:&[^&?\s]+=[^&?\s]+)*)?/i;var yt=function(e,t,o){var i,r,a,s,d,l,c,h=e.ownerDocument,u=new n(e,4,function(e){return!g(e,t,"A")}),f=o.linkRegExp,p=o._config.tagAttributes.a;if(f)for(;i=u.nextNode();)for(r=i.data,a=i.parentNode;s=f.exec(r);)d=s.index,l=d+s[0].length,d&&(c=h.createTextNode(r.slice(0,d)),a.insertBefore(c,i)),c=o.createElement("A",D({href:s[1]?/^(?:ht|f)tps?:/i.test(s[1])?s[1]:"http://"+s[1]:"mailto:"+s[0]},p,!1)),c.textContent=r.slice(d,l),a.insertBefore(c,i),i.data=r=r.slice(l)};at.insertHTML=function(e,t){var n,o,i,r,a,s,d,l=this._config,c=l.isInsertedHTMLSanitized?l.sanitizeToDOMFragment:null,u=this.getSelection(),f=this._doc;"function"==typeof c?r=c(e,t,this):(t&&(n=e.indexOf("\x3c!--StartFragment--\x3e"),o=e.lastIndexOf("\x3c!--EndFragment--\x3e"),n>-1&&o>-1&&(e=e.slice(n+20,o))),/<\/td>((?!<\/tr>)[\s\S])*$/i.test(e)&&(e=""+e+""),/<\/tr>((?!<\/table>)[\s\S])*$/i.test(e)&&(e=""+e+"
"),i=this.createElement("DIV"),i.innerHTML=e,r=f.createDocumentFragment(),r.appendChild(y(i))),this.saveUndoState(u);try{for(a=this._root,s=r,d={fragment:r,preventDefault:function(){this.defaultPrevented=!0},defaultPrevented:!1},yt(r,r,this),Ve(r,l),et(r,a,!1),Ye(r),r.normalize();s=h(s,r);)E(s,a);t&&this.fireEvent("willPaste",d),d.defaultPrevented||(be(u,d.fragment,a),se||this._docWasChanged(),u.collapse(!1),this._ensureBottomLine()),this.setSelection(u),this._updatePath(u,!0),t&&this.focus()}catch(e){this.didError(e)}return this};var Tt=function(e){return e.split("&").join("&").split("<").join("<").split(">").join(">").split('"').join(""")};at.insertPlainText=function(e,t){var n=this.getSelection();if(n.collapsed&&g(n.startContainer,this._root,"PRE")){var o,i,r=n.startContainer,a=n.startOffset;return r&&r.nodeType===H||(o=this._doc.createTextNode(""),r.insertBefore(o,r.childNodes[a]),r=o,a=0),i={text:e,preventDefault:function(){this.defaultPrevented=!0},defaultPrevented:!1},t&&this.fireEvent("willPaste",i),i.defaultPrevented||(e=i.text,r.insertData(a,e),n.setStart(r,a+e.length),n.collapse(!0)),this.setSelection(n),this}var s,d,l,c,h=e.split("\n"),u=this._config,f=u.blockTag,p=u.blockAttributes,m="",v="<"+f;for(s in p)v+=" "+s+'="'+Tt(p[s])+'"';for(v+=">",d=0,l=h.length;d")+m;return this.insertHTML(h.join(""),t)};var Et=function(e,t,n){return function(){return this[e](t,n),this.focus()}};at.addStyles=function(e){if(e){var t=this._doc.documentElement.firstChild,n=this.createElement("STYLE",{type:"text/css"});n.appendChild(this._doc.createTextNode(e)),t.appendChild(n)}return this},at.bold=Et("changeFormat",{tag:"B"}),at.italic=Et("changeFormat",{tag:"I"}),at.underline=Et("changeFormat",{tag:"U"}),at.strikethrough=Et("changeFormat",{tag:"S"}),at.subscript=Et("changeFormat",{tag:"SUB"},{tag:"SUP"}),at.superscript=Et("changeFormat",{tag:"SUP"},{tag:"SUB"}),at.removeBold=Et("changeFormat",null,{tag:"B"}),at.removeItalic=Et("changeFormat",null,{tag:"I"}),at.removeUnderline=Et("changeFormat",null,{tag:"U"}),at.removeStrikethrough=Et("changeFormat",null,{tag:"S"}),at.removeSubscript=Et("changeFormat",null,{tag:"SUB"}),at.removeSuperscript=Et("changeFormat",null,{tag:"SUP"}),at.makeLink=function(e,t){var n=this.getSelection();if(n.collapsed){var o=e.indexOf(":")+1;if(o)for(;"/"===e[o];)o+=1;ye(n,this._doc.createTextNode(e.slice(o)))}return t=D(D({href:e},t,!0),this._config.tagAttributes.a,!1),this.changeFormat({tag:"A",attributes:t},{tag:"A"},n),this.focus()},at.removeLink=function(){return this.changeFormat(null,{tag:"A"},this.getSelection(),!0),this.focus()},at.setFontFace=function(e){var t=this._config.classNames.fontFamily;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"font-family: "+e+", sans-serif;"}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},at.setFontSize=function(e){var t=this._config.classNames.fontSize;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"font-size: "+("number"==typeof e?e+"px":e)}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},at.setTextColour=function(e){var t=this._config.classNames.colour;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"color:"+e}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},at.setHighlightColour=function(e){var t=this._config.classNames.highlight;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"background-color:"+e}}:e,{tag:"SPAN",attributes:{class:t}}),this.focus()},at.setTextAlignment=function(e){return this.forEachBlock(function(t){var n=t.className.split(/\s+/).filter(function(e){return!!e&&!/^align/.test(e)}).join(" ");e?(t.className=n+" align-"+e,t.style.textAlign=e):(t.className=n,t.style.textAlign="")},!0),this.focus()},at.setTextDirection=function(e){return this.forEachBlock(function(t){e?t.dir=e:t.removeAttribute("dir")},!0),this.focus()};var bt=function(e){for(var t,o=this._root,i=this._doc,r=i.createDocumentFragment(),a=l(e,o);t=a.nextNode();){var s,d,c=t.querySelectorAll("BR"),h=[],u=c.length;for(s=0;s-1;)a.appendChild(d.createTextNode(r.slice(0,s))),a.appendChild(d.createElement("BR")),r=r.slice(s+1);i.parentNode.insertBefore(a,i),i.data=r}b(t,l),S(t,y(t))}return e};at.code=function(){var e=this.getSelection();return e.collapsed||d(e.commonAncestorContainer)?this.modifyBlocks(bt,e):this.changeFormat({tag:"CODE",attributes:this._config.tagAttributes.code},null,e),this.focus()},at.removeCode=function(){var e=this.getSelection();return g(e.commonAncestorContainer,this._root,"PRE")?this.modifyBlocks(kt,e):this.changeFormat(null,{tag:"CODE"},e),this.focus()},at.toggleCode=function(){return this.hasFormat("PRE")||this.hasFormat("CODE")?this.removeCode():this.code(),this},at.removeAllFormatting=function(e){if(!e&&!(e=this.getSelection())||e.collapsed)return this;for(var t=this._root,n=e.commonAncestorContainer;n&&!s(n);)n=n.parentNode;if(n||(Pe(e,t),n=t),n.nodeType===H)return this;this.saveUndoState(e),Ae(e,n,n,t);for(var o,i,r=n.ownerDocument,a=e.startContainer,d=e.startOffset,l=e.endContainer,c=e.endOffset,h=r.createDocumentFragment(),u=r.createDocumentFragment(),f=k(l,c,n,t),p=k(a,d,n,t);p!==f;)o=p.nextSibling,h.appendChild(p),p=o;return F(this,h,u),u.normalize(),p=u.firstChild,o=u.lastChild,i=n.childNodes,p?(n.insertBefore(u,f),d=ce.call(i,p),c=ce.call(i,o)+1):(d=ce.call(i,f),c=d),e.setStart(n,d),e.setEnd(n,c),A(n,e),xe(e),this.setSelection(e),this._updatePath(e,!0),this.focus()},at.increaseQuoteLevel=Et("modifyBlocks",pt),at.decreaseQuoteLevel=Et("modifyBlocks",gt),at.makeUnorderedList=Et("modifyBlocks",Nt),at.makeOrderedList=Et("modifyBlocks",Ct),at.removeList=Et("modifyBlocks",_t),P.isInline=a,P.isBlock=s,P.isContainer=d,P.getBlockWalker=l,P.getPreviousBlock=c,P.getNextBlock=h,P.areAlike=f,P.hasTagAttributes=p,P.getNearest=g,P.isOrContains=v,P.detach=_,P.replaceWith=S,P.empty=y,P.getNodeBefore=_e,P.getNodeAfter=Se,P.insertNodeInRange=ye,P.extractContentsOfRange=Te,P.deleteContentsOfRange=Ee,P.insertTreeFragmentIntoRange=be,P.isNodeContainedInRange=ke,P.moveRangeBoundariesDownTree=xe,P.moveRangeBoundariesUpTree=Ae,P.getStartBlockOfRange=Le,P.getEndBlockOfRange=Be,P.contentWalker=Oe,P.rangeDoesStartAtBlockBoundary=Re,P.rangeDoesEndAtBlockBoundary=De,P.expandRangeToBlockBoundaries=Pe,P.onPaste=it,P.addLinks=yt,P.splitBlock=ft,P.startSelectionId="squire-selection-start",P.endSelectionId=ht,"object"==typeof exports?module.exports=P:"function"==typeof define&&define.amd?define(function(){return P}):(G.Squire=P,top!==G&&"true"===e.documentElement.getAttribute("data-squireinit")&&(G.editor=new P(e),G.onEditorLoad&&(G.onEditorLoad(G.editor),G.onEditorLoad=null)))}(document); \ No newline at end of file diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/to-mark/to-mark.min.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/to-mark/to-mark.min.js new file mode 100644 index 0000000000..393914cd51 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/to-mark/to-mark.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["to-mark"]=t():e.toMark=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,n){"use strict";var r=n(1),o=/\n$/g,i=/[ \xA0]+\n\n/g,a=/([ \xA0]+\n){2,}/g,u=/href\=\"(.*?)\"/,c=/^/gm,s=r.factory({TEXT_NODE:function(e){var t=this.trim(this.getSpaceCollapsedText(e.nodeValue));return this._isNeedEscapeBackSlash(t)&&(t=this.escapeTextBackSlash(t)),t=this.escapePairedCharacters(t),this._isNeedEscapeHtml(t)&&(t=this.escapeTextHtml(t)),this._isNeedEscape(t)&&(t=this.escapeText(t)),this.getSpaceControlled(t,e)},"CODE TEXT_NODE":function(e){return e.nodeValue},"EM, I":function(e,t){var n="";return this.isEmptyText(t)||(n="*"+t+"*"),n},"STRONG, B":function(e,t){var n="";return this.isEmptyText(t)||(n="**"+t+"**"),n},A:function(e,t){var n,r,o=t,i="";return n=u.exec(e.outerHTML),n&&(r=n[1].replace(/&/g,"&")),e.title&&(i=' "'+e.title+'"'),!this.isEmptyText(t)&&r&&(o="["+this.escapeTextForLink(t)+"]("+r+i+")"),o},IMG:function(e){var t="",n=e.getAttribute("src"),r=e.alt;return n&&(t="!["+this.escapeTextForLink(r)+"]("+n+")"),t},BR:function(){return" \n"},CODE:function(e,t){var n,r,o="";return this.isEmptyText(t)||(r=parseInt(e.getAttribute("data-backticks"),10),n=isNaN(r)?"`":Array(r+1).join("`"),o=n+t+n),o},P:function(e,t){var n="";return t=t.replace(a," \n"),this.isEmptyText(t)||(n="\n\n"+t+"\n\n"),n},"BLOCKQUOTE P":function(e,t){return t},"LI P":function(e,t){var n="";return this.isEmptyText(t)||(n=t),n},"H1, H2, H3, H4, H5, H6":function(e,t){for(var n="",r=parseInt(e.tagName.charAt(1),10);r;)n+="#",r-=1;return n+=" ",n+=t,"\n\n"+n+"\n\n"},"LI H1, LI H2, LI H3, LI H4, LI H5, LI H6":function(e,t){var n=parseInt(e.tagName.charAt(1),10);return Array(n+1).join("#")+" "+t},"UL, OL":function(e,t){return"\n\n"+t+"\n\n"},"LI OL, LI UL":function(e,t){var n,r;return r=t.replace(i,"\n"),r=r.replace(o,""),n=r.replace(c," "),"\n"+n},"UL LI":function(e,t){var n="";return t=t.replace(a," \n"),e.firstChild&&"P"===e.firstChild.tagName&&(n+="\n"),n+="* "+t+"\n"},"OL LI":function(e,t){for(var n="",r=parseInt(e.parentNode.getAttribute("start")||1,10);e.previousSibling;)e=e.previousSibling,1===e.nodeType&&"LI"===e.tagName&&(r+=1);return t=t.replace(a," \n"),e.firstChild&&"P"===e.firstChild.tagName&&(n+="\n"),n+=r+". "+t+"\n"},HR:function(){return"\n\n- - -\n\n"},BLOCKQUOTE:function(e,t){var n,r;return t=t.replace(a,"\n\n"),r=this.trim(t),n=r.replace(c,"> "),"\n\n"+n+"\n\n"},"PRE CODE":function(e,t){var n,r;return r=t.replace(o,""),n=r.replace(c," "),"\n\n"+n+"\n\n"}});e.exports=s},function(e,t,n){"use strict";function r(e,t,n){var r;n=n||null;for(r in e)if(e.hasOwnProperty(r)&&t.call(n,e[r],r,e)===!1)break}function o(e){this.rules={},e&&this.addRules(e)}function i(e){var t=e.tagName;return"S"===t||"B"===t||"I"===t||"EM"===t||"STRONG"===t||"A"===t||"IMG"===t||"CODE"===t}function a(e,t){var n=e.cloneNode(!1);return n.innerHTML=t,n.outerHTML}function u(e,t){r(t,function(t,n){"converter"!==n?(e[n]||(e[n]={}),u(e[n],t)):e[n]=t})}var c=/^\u0020/,s=/.+\u0020$/,p=/[\n\s\t]+/g,l=/^[\u0020\r\n\t]+|[\u0020\r\n\t]+$/g,f=/[\u0020]+/g,d=/[>(){}\[\]+-.!#|]/g,h=/[\[\]]/g,g=/!\[.*\]\(.*\)/g,x=3;o.prototype.lineFeedReplacement="​​",o.prototype.addRule=function(e,t){var n=e.split(", "),r=n.pop();for(t.fname=e;r;)this._setConverterWithSelector(r,t),r=n.pop()},o.prototype.addRules=function(e){r(e,function(e,t){this.addRule(t,e)},this)},o.prototype.getSpaceControlled=function(e,t){var n,r="",o="";return t.previousSibling&&(t.previousSibling.nodeType===x||i(t.previousSibling))&&(n=t.previousSibling.innerHTML||t.previousSibling.nodeValue,(s.test(n)||c.test(t.innerHTML||t.nodeValue))&&(r=" ")),t.nextSibling&&(t.nextSibling.nodeType===x||i(t.nextSibling))&&(n=t.nextSibling.innerHTML||t.nextSibling.nodeValue,(c.test(n)||s.test(t.innerHTML||t.nodeValue))&&(o=" ")),r+e+o},o.prototype.convert=function(e,t){var n,r=this._getConverter(e);return e&&e.nodeType===Node.ELEMENT_NODE&&e.hasAttribute("data-tomark-pass")?(e.removeAttribute("data-tomark-pass"),n=a(e,t)):r?n=r.call(this,e,t):e&&(n=this.getSpaceControlled(this._getInlineHtml(e,t),e)),n||""},o.prototype._getInlineHtml=function(e,t){var n=e.outerHTML,r=e.tagName,o=t.replace(/\$/g,"$$$$");return n.replace(new RegExp("(<"+r+" ?.*?>).*()","i"),"$1"+o+"$2")},o.prototype._getConverter=function(e){for(var t,n=this.rules;e&&n;)n=this._getNextRule(n,this._getRuleNameFromNode(e)),e=this._getPrevNode(e),n&&n.converter&&(t=n.converter);return t},o.prototype._getNextRule=function(e,t){return e[t]},o.prototype._getRuleNameFromNode=function(e){return e.tagName||"TEXT_NODE"},o.prototype._getPrevNode=function(e){var t,n=e.parentNode;return n&&!n.__htmlRootByToMark&&(t=n),t},o.prototype._setConverterWithSelector=function(e,t){var n=this.rules;this._eachSelector(e,function(e){n[e]||(n[e]={}),n=n[e]}),n.converter=t},o.prototype._eachSelector=function(e,t){var n,r;for(n=e.split(" "),r=n.length-1;r>=0;)t(n[r]),r-=1},o.prototype.trim=function(e){return e.replace(l,"")},o.prototype.isEmptyText=function(e){return""===e.replace(p,"")},o.prototype.getSpaceCollapsedText=function(e){return e.replace(f," ")},o.prototype.escapeText=function(e){return e.replace(d,function(e){return"\\"+e})},o.prototype.escapeTextForLink=function(e){for(var t=[],n=g.exec(e);n;)t.push([n.index,n.index+n[0].length]),n=g.exec(e);return e.replace(h,function(e,n){var r=t.some(function(e){return n>e[0]&&n[^\n]+.*)+/,list:/^ *(\*+|-+|\d+\.) [\s\S]+/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? */,link:/!?\[.*\]\(.*\)/,reflink:/!?\[.*\]\s*\[([^\]]*)\]/,verticalBar:/\u007C/,codeblockGfm:/^(`{3,})/,codeblockTildes:/^(~{3,})/},o.markdownTextToEscapeHtmlRx=/<([a-zA-Z_][a-zA-Z0-9\-\._]*)(\s|[^\\\/>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-\._]*)\s*\/?>||<([a-zA-Z_][a-zA-Z0-9\-\.:\/]*)>/,o.markdownTextToEscapeBackSlashRx=/\\[!"#$%&'()*+,-.\/:;<=>?@[\]^_`{|}~\\]/,o.markdownTextToEscapePairedCharsRx=/[*_~`]/,o.prototype._isNeedEscape=function(e){var t,n=!1,r=o.markdownTextToEscapeRx;for(t in r)if(r.hasOwnProperty(t)&&r[t].test(e)){n=!0;break}return n},o.prototype._isNeedEscapeHtml=function(e){return o.markdownTextToEscapeHtmlRx.test(e)},o.prototype._isNeedEscapeBackSlash=function(e){return o.markdownTextToEscapeBackSlashRx.test(e)},o.prototype.mix=function(e){u(this.rules,e.rules)},o.factory=function(e,t){var n=new o;return t?n.mix(e):t=e,n.addRules(t),n},e.exports=o},function(e,t,n){"use strict";function r(e,t){var n;return e.className.indexOf("task-list-item")!==-1&&(n=e.className.indexOf("checked")!==-1?"x":" ",t="["+n+"] "+t),t}function o(e){var t,n,r,o;return t=e.align,o=e.textContent?e.textContent.length:e.innerText.length,n="",r="",t&&("left"===t?(n=":",o-=1):"right"===t?(r=":",o-=1):"center"===t&&(r=":",n=":",o-=2)),n+a("-",o)+r}function i(e,t){var n,r=e.childNodes,o=r.length,i=[];for(n=0;n1;)n+=e,t-=1;return n}var u=n(1),c=n(0),s=u.factory(c,{"DEL, S":function(e,t){return"~~"+t+"~~"},"PRE CODE":function(e,t){var n,r="",o=e.getAttribute("data-backticks");return e.getAttribute("data-language")&&(r=" "+e.getAttribute("data-language")),o=parseInt(o,10),n=isNaN(o)?"```":Array(o+1).join("`"),t=t.replace(/(\r\n)|(\r)|(\n)/g,this.lineFeedReplacement),"\n\n"+n+r+"\n"+t+"\n"+n+"\n\n"},PRE:function(e,t){return t},"UL LI":function(e,t){return c.convert(e,r(e,t))},"OL LI":function(e,t){return c.convert(e,r(e,t))},TABLE:function(e,t){return"\n\n"+t+"\n\n"},"TBODY, TFOOT":function(e,t){return t},"TR TD, TR TH":function(e,t){return t=t.replace(/(\r\n)|(\r)|(\n)/g,"")," "+t+" |"},"TD BR, TH BR":function(){return"
"},TR:function(e,t){return"|"+t+"\n"},THEAD:function(e,t){var n,r,a,u="";for(r=i(i(e,"TR")[0],"TH"),a=r.length,n=0;n=3?"\n\n":e>=1?"\n":e}),e=e.replace(f,""),e=e.replace(new RegExp(n,"g"),"\n"),t&&(e=e.replace(h,"\n")),e}function a(e,t){var n,r,o,i="",u=e.getNode();for(n=0,r=u.childNodes.length;n<"),e=e.replace(u,"> <")}var i=/^[\s\r\n\t]+|[\s\r\n\t]+$/g,a=/>[\r\n\t]+[ ]+ + * @license MIT + */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["util"] = factory(); + else + root["tui"] = root["tui"] || {}, root["tui"]["util"] = factory(); +})(window, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = "dist"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 36); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is an instance of Array or not. + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is an instance of Array or not. + * If the given variable is an instance of Array, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is array instance? + * @memberof module:type + */ +function isArray(obj) { + return obj instanceof Array; +} + +module.exports = isArray; + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Execute the provided callback once for each property of object(or element of array) which actually exist. + * @author NHN FE Development Lab + */ + + + +var isArray = __webpack_require__(0); +var forEachArray = __webpack_require__(3); +var forEachOwnProperties = __webpack_require__(5); + +/** + * @module collection + */ + +/** + * Execute the provided callback once for each property of object(or element of array) which actually exist. + * If the object is Array-like object(ex-arguments object), It needs to transform to Array.(see 'ex2' of example). + * If the callback function returns false, the loop will be stopped. + * Callback function(iteratee) is invoked with three arguments: + * 1) The value of the property(or The value of the element) + * 2) The name of the property(or The index of the element) + * 3) The object being traversed + * @param {Object} obj The object that will be traversed + * @param {function} iteratee Callback function + * @param {Object} [context] Context(this) of callback function + * @memberof module:collection + * @example + * var forEach = require('tui-code-snippet/collection/forEach'); // node, commonjs + * + * var sum = 0; + * + * forEach([1,2,3], function(value){ + * sum += value; + * }); + * alert(sum); // 6 + * + * // In case of Array-like object + * var array = Array.prototype.slice.call(arrayLike); // change to array + * forEach(array, function(value){ + * sum += value; + * }); + */ +function forEach(obj, iteratee, context) { + if (isArray(obj)) { + forEachArray(obj, iteratee, context); + } else { + forEachOwnProperties(obj, iteratee, context); + } +} + +module.exports = forEach; + + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is undefined or not. + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is undefined or not. + * If the given variable is undefined, returns true. + * @param {*} obj - Target for checking + * @returns {boolean} Is undefined? + * @memberof module:type + */ +function isUndefined(obj) { + return obj === undefined; // eslint-disable-line no-undefined +} + +module.exports = isUndefined; + + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Execute the provided callback once for each element present in the array(or Array-like object) in ascending order. + * @author NHN FE Development Lab + */ + + + +/** + * Execute the provided callback once for each element present + * in the array(or Array-like object) in ascending order. + * If the callback function returns false, the loop will be stopped. + * Callback function(iteratee) is invoked with three arguments: + * 1) The value of the element + * 2) The index of the element + * 3) The array(or Array-like object) being traversed + * @param {Array|Arguments|NodeList} arr The array(or Array-like object) that will be traversed + * @param {function} iteratee Callback function + * @param {Object} [context] Context(this) of callback function + * @memberof module:collection + * @example + * var forEachArray = require('tui-code-snippet/collection/forEachArray'); // node, commonjs + * + * var sum = 0; + * + * forEachArray([1,2,3], function(value){ + * sum += value; + * }); + * alert(sum); // 6 + */ +function forEachArray(arr, iteratee, context) { + var index = 0; + var len = arr.length; + + context = context || null; + + for (; index < len; index += 1) { + if (iteratee.call(context, arr[index], index, arr) === false) { + break; + } + } +} + +module.exports = forEachArray; + + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* eslint-disable complexity */ +/** + * @fileoverview Returns the first index at which a given element can be found in the array. + * @author NHN FE Development Lab + */ + + + +var isArray = __webpack_require__(0); + +/** + * @module array + */ + +/** + * Returns the first index at which a given element can be found in the array + * from start index(default 0), or -1 if it is not present. + * It compares searchElement to elements of the Array using strict equality + * (the same method used by the ===, or triple-equals, operator). + * @param {*} searchElement Element to locate in the array + * @param {Array} array Array that will be traversed. + * @param {number} startIndex Start index in array for searching (default 0) + * @returns {number} the First index at which a given element, or -1 if it is not present + * @memberof module:array + * @example + * var inArray = require('tui-code-snippet/array/inArray'); // node, commonjs + * + * var arr = ['one', 'two', 'three', 'four']; + * var idx1 = inArray('one', arr, 3); // -1 + * var idx2 = inArray('one', arr); // 0 + */ +function inArray(searchElement, array, startIndex) { + var i; + var length; + startIndex = startIndex || 0; + + if (!isArray(array)) { + return -1; + } + + if (Array.prototype.indexOf) { + return Array.prototype.indexOf.call(array, searchElement, startIndex); + } + + length = array.length; + for (i = startIndex; startIndex >= 0 && i < length; i += 1) { + if (array[i] === searchElement) { + return i; + } + } + + return -1; +} + +module.exports = inArray; + + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Execute the provided callback once for each property of object which actually exist. + * @author NHN FE Development Lab + */ + + + +/** + * Execute the provided callback once for each property of object which actually exist. + * If the callback function returns false, the loop will be stopped. + * Callback function(iteratee) is invoked with three arguments: + * 1) The value of the property + * 2) The name of the property + * 3) The object being traversed + * @param {Object} obj The object that will be traversed + * @param {function} iteratee Callback function + * @param {Object} [context] Context(this) of callback function + * @memberof module:collection + * @example + * var forEachOwnProperties = require('tui-code-snippet/collection/forEachOwnProperties'); // node, commonjs + * + * var sum = 0; + * + * forEachOwnProperties({a:1,b:2,c:3}, function(value){ + * sum += value; + * }); + * alert(sum); // 6 + */ +function forEachOwnProperties(obj, iteratee, context) { + var key; + + context = context || null; + + for (key in obj) { + if (obj.hasOwnProperty(key)) { + if (iteratee.call(context, obj[key], key, obj) === false) { + break; + } + } + } +} + +module.exports = forEachOwnProperties; + + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Extend the target object from other objects. + * @author NHN FE Development Lab + */ + + + +/** + * @module object + */ + +/** + * Extend the target object from other objects. + * @param {object} target - Object that will be extended + * @param {...object} objects - Objects as sources + * @returns {object} Extended object + * @memberof module:object + */ +function extend(target, objects) { // eslint-disable-line no-unused-vars + var hasOwnProp = Object.prototype.hasOwnProperty; + var source, prop, i, len; + + for (i = 1, len = arguments.length; i < len; i += 1) { + source = arguments[i]; + for (prop in source) { + if (hasOwnProp.call(source, prop)) { + target[prop] = source[prop]; + } + } + } + + return target; +} + +module.exports = extend; + + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is an object or not. + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is an object or not. + * If the given variable is an object, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is object? + * @memberof module:type + */ +function isObject(obj) { + return obj === Object(obj); +} + +module.exports = isObject; + + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is a string or not. + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is a string or not. + * If the given variable is a string, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is string? + * @memberof module:type + */ +function isString(obj) { + return typeof obj === 'string' || obj instanceof String; +} + +module.exports = isString; + + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is existing or not. + * @author NHN FE Development Lab + */ + + + +var isUndefined = __webpack_require__(2); +var isNull = __webpack_require__(11); + +/** + * Check whether the given variable is existing or not. + * If the given variable is not null and not undefined, returns true. + * @param {*} param - Target for checking + * @returns {boolean} Is existy? + * @memberof module:type + * @example + * var isExisty = require('tui-code-snippet/type/isExisty'); // node, commonjs + * + * isExisty(''); //true + * isExisty(0); //true + * isExisty([]); //true + * isExisty({}); //true + * isExisty(null); //false + * isExisty(undefined); //false +*/ +function isExisty(param) { + return !isUndefined(param) && !isNull(param); +} + +module.exports = isExisty; + + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Get HTML element's design classes. + * @author NHN FE Development Lab + */ + + + +var isUndefined = __webpack_require__(2); + +/** + * Get HTML element's design classes. + * @param {(HTMLElement|SVGElement)} element target element + * @returns {string} element css class name + * @memberof module:domUtil + */ +function getClass(element) { + if (!element || !element.className) { + return ''; + } + + if (isUndefined(element.className.baseVal)) { + return element.className; + } + + return element.className.baseVal; +} + +module.exports = getClass; + + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is null or not. + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is null or not. + * If the given variable(arguments[0]) is null, returns true. + * @param {*} obj - Target for checking + * @returns {boolean} Is null? + * @memberof module:type + */ +function isNull(obj) { + return obj === null; +} + +module.exports = isNull; + + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is a function or not. + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is a function or not. + * If the given variable is a function, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is function? + * @memberof module:type + */ +function isFunction(obj) { + return obj instanceof Function; +} + +module.exports = isFunction; + + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* eslint-disable complexity */ +/** + * @fileoverview Check whether the given variable is empty(null, undefined, or empty array, empty object) or not. + * @author NHN FE Development Lab + */ + + + +var isString = __webpack_require__(8); +var isExisty = __webpack_require__(9); +var isArray = __webpack_require__(0); +var isArguments = __webpack_require__(20); +var isObject = __webpack_require__(7); +var isFunction = __webpack_require__(12); + +/** + * Check whether given argument is empty string + * @param {*} obj - Target for checking + * @returns {boolean} whether given argument is empty string + * @private + */ +function _isEmptyString(obj) { + return isString(obj) && obj === ''; +} + +/** + * Check whether given argument has own property + * @param {Object} obj - Target for checking + * @returns {boolean} - whether given argument has own property + * @private + */ +function _hasOwnProperty(obj) { + var key; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + return true; + } + } + + return false; +} + +/** + * Check whether the given variable is empty(null, undefined, or empty array, empty object) or not. + * If the given variables is empty, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is empty? + * @memberof module:type + */ +function isEmpty(obj) { + if (!isExisty(obj) || _isEmptyString(obj)) { + return true; + } + + if (isArray(obj) || isArguments(obj)) { + return obj.length === 0; + } + + if (isObject(obj) && !isFunction(obj)) { + return !_hasOwnProperty(obj); + } + + return true; +} + +module.exports = isEmpty; + + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Transform the Array-like object to Array. + * @author NHN FE Development Lab + */ + + + +var forEachArray = __webpack_require__(3); + +/** + * Transform the Array-like object to Array. + * In low IE (below 8), Array.prototype.slice.call is not perfect. So, try-catch statement is used. + * @param {*} arrayLike Array-like object + * @returns {Array} Array + * @memberof module:collection + * @example + * var toArray = require('tui-code-snippet/collection/toArray'); // node, commonjs + * + * var arrayLike = { + * 0: 'one', + * 1: 'two', + * 2: 'three', + * 3: 'four', + * length: 4 + * }; + * var result = toArray(arrayLike); + * + * alert(result instanceof Array); // true + * alert(result); // one,two,three,four + */ +function toArray(arrayLike) { + var arr; + try { + arr = Array.prototype.slice.call(arrayLike); + } catch (e) { + arr = []; + forEachArray(arrayLike, function(value) { + arr.push(value); + }); + } + + return arr; +} + +module.exports = toArray; + + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Unbind DOM events + * @author NHN FE Development Lab + */ + + + +var isString = __webpack_require__(8); +var forEach = __webpack_require__(1); + +var safeEvent = __webpack_require__(24); + +/** + * Unbind DOM events + * If a handler function is not passed, remove all events of that type. + * @param {HTMLElement} element - element to unbind events + * @param {(string|object)} types - Space splitted events names or eventName:handler object + * @param {function} [handler] - handler function + * @memberof module:domEvent + * @example + * // Following the example of domEvent#on + * + * // Unbind one event from an element. + * off(div, 'click', toggle); + * + * // Unbind multiple events with a same handler from multiple elements at once. + * // Use event names splitted by a space. + * off(element, 'mouseenter mouseleave', changeColor); + * + * // Unbind multiple events with different handlers from an element at once. + * // Use an object which of key is an event name and value is a handler function. + * off(div, { + * keydown: highlight, + * keyup: dehighlight + * }); + * + * // Unbind events without handlers. + * off(div, 'drag'); + */ +function off(element, types, handler) { + if (isString(types)) { + forEach(types.split(/\s+/g), function(type) { + unbindEvent(element, type, handler); + }); + + return; + } + + forEach(types, function(func, type) { + unbindEvent(element, type, func); + }); +} + +/** + * Unbind DOM events + * If a handler function is not passed, remove all events of that type. + * @param {HTMLElement} element - element to unbind events + * @param {string} type - events name + * @param {function} [handler] - handler function + * @private + */ +function unbindEvent(element, type, handler) { + var events = safeEvent(element, type); + var index; + + if (!handler) { + forEach(events, function(item) { + removeHandler(element, type, item.wrappedHandler); + }); + events.splice(0, events.length); + } else { + forEach(events, function(item, idx) { + if (handler === item.handler) { + removeHandler(element, type, item.wrappedHandler); + index = idx; + + return false; + } + + return true; + }); + events.splice(index, 1); + } +} + +/** + * Remove an event handler + * @param {HTMLElement} element - An element to remove an event + * @param {string} type - event type + * @param {function} handler - event handler + * @private + */ +function removeHandler(element, type, handler) { + if ('removeEventListener' in element) { + element.removeEventListener(type, handler); + } else if ('detachEvent' in element) { + element.detachEvent('on' + type, handler); + } +} + +module.exports = off; + + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Bind DOM events + * @author NHN FE Development Lab + */ + + + +var isString = __webpack_require__(8); +var forEach = __webpack_require__(1); + +var safeEvent = __webpack_require__(24); + +/** + * Bind DOM events. + * @param {HTMLElement} element - element to bind events + * @param {(string|object)} types - Space splitted events names or eventName:handler object + * @param {(function|object)} handler - handler function or context for handler method + * @param {object} [context] context - context for handler method. + * @memberof module:domEvent + * @example + * var div = document.querySelector('div'); + * + * // Bind one event to an element. + * on(div, 'click', toggle); + * + * // Bind multiple events with a same handler to multiple elements at once. + * // Use event names splitted by a space. + * on(div, 'mouseenter mouseleave', changeColor); + * + * // Bind multiple events with different handlers to an element at once. + * // Use an object which of key is an event name and value is a handler function. + * on(div, { + * keydown: highlight, + * keyup: dehighlight + * }); + * + * // Set a context for handler method. + * var name = 'global'; + * var repository = {name: 'CodeSnippet'}; + * on(div, 'drag', function() { + * console.log(this.name); + * }, repository); + * // Result when you drag a div: "CodeSnippet" + */ +function on(element, types, handler, context) { + if (isString(types)) { + forEach(types.split(/\s+/g), function(type) { + bindEvent(element, type, handler, context); + }); + + return; + } + + forEach(types, function(func, type) { + bindEvent(element, type, func, handler); + }); +} + +/** + * Bind DOM events + * @param {HTMLElement} element - element to bind events + * @param {string} type - events name + * @param {function} handler - handler function or context for handler method + * @param {object} [context] context - context for handler method. + * @private + */ +function bindEvent(element, type, handler, context) { + /** + * Event handler + * @param {Event} e - event object + */ + function eventHandler(e) { + handler.call(context || element, e || window.event); + } + + if ('addEventListener' in element) { + element.addEventListener(type, eventHandler); + } else if ('attachEvent' in element) { + element.attachEvent('on' + type, eventHandler); + } + memorizeHandler(element, type, handler, eventHandler); +} + +/** + * Memorize DOM event handler for unbinding. + * @param {HTMLElement} element - element to bind events + * @param {string} type - events name + * @param {function} handler - handler function that user passed at on() use + * @param {function} wrappedHandler - handler function that wrapped by domevent for implementing some features + * @private + */ +function memorizeHandler(element, type, handler, wrappedHandler) { + var events = safeEvent(element, type); + var existInEvents = false; + + forEach(events, function(obj) { + if (obj.handler === handler) { + existInEvents = true; + + return false; + } + + return true; + }); + + if (!existInEvents) { + events.push({ + handler: handler, + wrappedHandler: wrappedHandler + }); + } +} + +module.exports = on; + + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Prevent default action + * @author NHN FE Development Lab + */ + + + +/** + * Prevent default action + * @param {Event} e - event object + * @memberof module:domEvent + */ +function preventDefault(e) { + if (e.preventDefault) { + e.preventDefault(); + + return; + } + + e.returnValue = false; +} + +module.exports = preventDefault; + + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Set className value + * @author NHN FE Development Lab + */ + + + +var isArray = __webpack_require__(0); +var isUndefined = __webpack_require__(2); + +/** + * Set className value + * @param {(HTMLElement|SVGElement)} element - target element + * @param {(string|string[])} cssClass - class names + * @private + */ +function setClassName(element, cssClass) { + cssClass = isArray(cssClass) ? cssClass.join(' ') : cssClass; + + cssClass = cssClass.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + + if (isUndefined(element.className.baseVal)) { + element.className = cssClass; + + return; + } + + element.className.baseVal = cssClass; +} + +module.exports = setClassName; + + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Convert kebab-case + * @author NHN FE Development Lab + */ + + + +/** + * Convert kebab-case + * @param {string} key - string to be converted to Kebab-case + * @private + */ +function convertToKebabCase(key) { + return key.replace(/([A-Z])/g, function(match) { + return '-' + match.toLowerCase(); + }); +} + +module.exports = convertToKebabCase; + + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is an arguments object or not. + * @author NHN FE Development Lab + */ + + + +var isExisty = __webpack_require__(9); + +/** + * @module type + */ + +/** + * Check whether the given variable is an arguments object or not. + * If the given variable is an arguments object, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is arguments? + * @memberof module:type + */ +function isArguments(obj) { + var result = isExisty(obj) && + ((Object.prototype.toString.call(obj) === '[object Arguments]') || !!obj.callee); + + return result; +} + +module.exports = isArguments; + + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview This module detects the kind of well-known browser and version. + * @author NHN FE Development Lab + */ + + + +/** + * Browser module + * @module browser + */ + +/** + * This object has an information that indicate the kind of browser. It can detect IE8 ~ IE11, Chrome, Firefox, Safari, and Edge. + * @memberof module:browser + * @example + * var browser = require('tui-code-snippet/browser/browser'); // node, commonjs + * + * browser.chrome === true; // chrome + * browser.firefox === true; // firefox + * browser.safari === true; // safari + * browser.msie === true; // IE + * browser.edge === true; // edge + * browser.others === true; // other browser + * browser.version; // browser version + */ +var browser = { + chrome: false, + firefox: false, + safari: false, + msie: false, + edge: false, + others: false, + version: 0 +}; + +if (typeof window !== 'undefined' && window.navigator) { + detectBrowser(); +} + +/** + * Detect the browser. + * @private + */ +function detectBrowser() { + var nav = window.navigator; + var appName = nav.appName.replace(/\s/g, '_'); + var userAgent = nav.userAgent; + + var rIE = /MSIE\s([0-9]+[.0-9]*)/; + var rIE11 = /Trident.*rv:11\./; + var rEdge = /Edge\/(\d+)\./; + var versionRegex = { + firefox: /Firefox\/(\d+)\./, + chrome: /Chrome\/(\d+)\./, + safari: /Version\/([\d.]+).*Safari\/(\d+)/ + }; + + var key, tmp; + + var detector = { + Microsoft_Internet_Explorer: function() { // eslint-disable-line camelcase + var detectedVersion = userAgent.match(rIE); + + if (detectedVersion) { // ie8 ~ ie10 + browser.msie = true; + browser.version = parseFloat(detectedVersion[1]); + } else { // no version information + browser.others = true; + } + }, + Netscape: function() { // eslint-disable-line complexity + var detected = false; + + if (rIE11.exec(userAgent)) { + browser.msie = true; + browser.version = 11; + detected = true; + } else if (rEdge.exec(userAgent)) { + browser.edge = true; + browser.version = userAgent.match(rEdge)[1]; + detected = true; + } else { + for (key in versionRegex) { + if (versionRegex.hasOwnProperty(key)) { + tmp = userAgent.match(versionRegex[key]); + if (tmp && tmp.length > 1) { // eslint-disable-line max-depth + browser[key] = detected = true; + browser.version = parseFloat(tmp[1] || 0); + break; + } + } + } + } + if (!detected) { + browser.others = true; + } + } + }; + + var fn = detector[appName]; + + if (fn) { + detector[appName](); + } +} + +module.exports = browser; + + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Provide a simple inheritance in prototype-oriented. + * @author NHN FE Development Lab + */ + + + +var createObject = __webpack_require__(23); + +/** + * Provide a simple inheritance in prototype-oriented. + * Caution : + * Don't overwrite the prototype of child constructor. + * + * @param {function} subType Child constructor + * @param {function} superType Parent constructor + * @memberof module:inheritance + * @example + * var inherit = require('tui-code-snippet/inheritance/inherit'); // node, commonjs + * + * // Parent constructor + * function Animal(leg) { + * this.leg = leg; + * } + * Animal.prototype.growl = function() { + * // ... + * }; + * + * // Child constructor + * function Person(name) { + * this.name = name; + * } + * + * // Inheritance + * inherit(Person, Animal); + * + * // After this inheritance, please use only the extending of property. + * // Do not overwrite prototype. + * Person.prototype.walk = function(direction) { + * // ... + * }; + */ +function inherit(subType, superType) { + var prototype = createObject(superType.prototype); + prototype.constructor = subType; + subType.prototype = prototype; +} + +module.exports = inherit; + + +/***/ }), +/* 23 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Create a new object with the specified prototype object and properties. + * @author NHN FE Development Lab + */ + + + +/** + * @module inheritance + */ + +/** + * Create a new object with the specified prototype object and properties. + * @param {Object} obj This object will be a prototype of the newly-created object. + * @returns {Object} + * @memberof module:inheritance + */ +function createObject(obj) { + function F() {} // eslint-disable-line require-jsdoc + F.prototype = obj; + + return new F(); +} + +module.exports = createObject; + + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Get event collection for specific HTML element + * @author NHN FE Development Lab + */ + + + +var EVENT_KEY = '_feEventKey'; + +/** + * Get event collection for specific HTML element + * @param {HTMLElement} element - HTML element + * @param {string} type - event type + * @returns {array} + * @private + */ +function safeEvent(element, type) { + var events = element[EVENT_KEY]; + var handlers; + + if (!events) { + events = element[EVENT_KEY] = {}; + } + + handlers = events[type]; + if (!handlers) { + handlers = events[type] = []; + } + + return handlers; +} + +module.exports = safeEvent; + + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check element match selector + * @author NHN FE Development Lab + */ + + + +var inArray = __webpack_require__(4); +var toArray = __webpack_require__(14); + +var elProto = Element.prototype; +var matchSelector = elProto.matches || + elProto.webkitMatchesSelector || + elProto.mozMatchesSelector || + elProto.msMatchesSelector || + function(selector) { + var doc = this.document || this.ownerDocument; + + return inArray(this, toArray(doc.querySelectorAll(selector))) > -1; + }; + +/** + * Check element match selector + * @param {HTMLElement} element - element to check + * @param {string} selector - selector to check + * @returns {boolean} is selector matched to element? + * @memberof module:domUtil + */ +function matches(element, selector) { + return matchSelector.call(element, selector); +} + +module.exports = matches; + + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Set data attribute to target element + * @author NHN FE Development Lab + */ + + + +var convertToKebabCase = __webpack_require__(19); + +/** + * Set data attribute to target element + * @param {HTMLElement} element - element to set data attribute + * @param {string} key - key + * @param {string} value - value + * @memberof module:domUtil + */ +function setData(element, key, value) { + if (element.dataset) { + element.dataset[key] = value; + + return; + } + + element.setAttribute('data-' + convertToKebabCase(key), value); +} + +module.exports = setData; + + +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check specific CSS style is available. + * @author NHN FE Development Lab + */ + + + +/** + * Check specific CSS style is available. + * @param {array} props property name to testing + * @returns {(string|boolean)} return true when property is available + * @private + */ +function testCSSProp(props) { + var style = document.documentElement.style; + var i, len; + + for (i = 0, len = props.length; i < len; i += 1) { + if (props[i] in style) { + return props[i]; + } + } + + return false; +} + +module.exports = testCSSProp; + + +/***/ }), +/* 28 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Get data value from data-attribute + * @author NHN FE Development Lab + */ + + + +var convertToKebabCase = __webpack_require__(19); + +/** + * Get data value from data-attribute + * @param {HTMLElement} element - target element + * @param {string} key - key + * @returns {string} value + * @memberof module:domUtil + */ +function getData(element, key) { + if (element.dataset) { + return element.dataset[key]; + } + + return element.getAttribute('data-' + convertToKebabCase(key)); +} + +module.exports = getData; + + +/***/ }), +/* 29 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Remove data property + * @author NHN FE Development Lab + */ + + + +var convertToKebabCase = __webpack_require__(19); + +/** + * Remove data property + * @param {HTMLElement} element - target element + * @param {string} key - key + * @memberof module:domUtil + */ +function removeData(element, key) { + if (element.dataset) { + delete element.dataset[key]; + + return; + } + + element.removeAttribute('data-' + convertToKebabCase(key)); +} + +module.exports = removeData; + + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is a number or not. + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is a number or not. + * If the given variable is a number, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is number? + * @memberof module:type + */ +function isNumber(obj) { + return typeof obj === 'number' || obj instanceof Number; +} + +module.exports = isNumber; + + +/***/ }), +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Retrieve a nested item from the given object/array. + * @author NHN FE Development Lab + */ + + + +var isUndefined = __webpack_require__(2); +var isNull = __webpack_require__(11); + +/** + * Retrieve a nested item from the given object/array. + * @param {object|Array} obj - Object for retrieving + * @param {...string|number} paths - Paths of property + * @returns {*} Value + * @memberof module:object + * @example + * var pick = require('tui-code-snippet/object/pick'); // node, commonjs + * + * var obj = { + * 'key1': 1, + * 'nested' : { + * 'key1': 11, + * 'nested': { + * 'key1': 21 + * } + * } + * }; + * pick(obj, 'nested', 'nested', 'key1'); // 21 + * pick(obj, 'nested', 'nested', 'key2'); // undefined + * + * var arr = ['a', 'b', 'c']; + * pick(arr, 1); // 'b' + */ +function pick(obj, paths) { // eslint-disable-line no-unused-vars + var args = arguments; + var target = args[0]; + var i = 1; + var length = args.length; + + for (; i < length; i += 1) { + if (isUndefined(target) || + isNull(target)) { + return; + } + + target = target[args[i]]; + } + + return target; // eslint-disable-line consistent-return +} + +module.exports = pick; + + +/***/ }), +/* 32 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is an instance of Date or not. + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is an instance of Date or not. + * If the given variables is an instance of Date, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is an instance of Date? + * @memberof module:type + */ +function isDate(obj) { + return obj instanceof Date; +} + +module.exports = isDate; + + +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Request image ping. + * @author NHN FE Development Lab + */ + + + +var forEachOwnProperties = __webpack_require__(5); + +/** + * @module request + */ + +/** + * Request image ping. + * @param {String} url url for ping request + * @param {Object} trackingInfo infos for make query string + * @returns {HTMLElement} + * @memberof module:request + * @example + * var imagePing = require('tui-code-snippet/request/imagePing'); // node, commonjs + * + * imagePing('https://www.google-analytics.com/collect', { + * v: 1, + * t: 'event', + * tid: 'trackingid', + * cid: 'cid', + * dp: 'dp', + * dh: 'dh' + * }); + */ +function imagePing(url, trackingInfo) { + var trackingElement = document.createElement('img'); + var queryString = ''; + forEachOwnProperties(trackingInfo, function(value, key) { + queryString += '&' + key + '=' + value; + }); + queryString = queryString.substring(1); + + trackingElement.src = url + '?' + queryString; + + trackingElement.style.display = 'none'; + document.body.appendChild(trackingElement); + document.body.removeChild(trackingElement); + + return trackingElement; +} + +module.exports = imagePing; + + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Creates a debounced function that delays invoking fn until after delay milliseconds has elapsed since the last time the debouced function was invoked. + * @author NHN FE Development Lab + */ + + + +/** + * @module tricks + */ + +/** + * Creates a debounced function that delays invoking fn until after delay milliseconds has elapsed + * since the last time the debouced function was invoked. + * @param {function} fn The function to debounce. + * @param {number} [delay=0] The number of milliseconds to delay + * @returns {function} debounced function. + * @memberof module:tricks + * @example + * var debounce = require('tui-code-snippet/tricks/debounce'); // node, commonjs + * + * function someMethodToInvokeDebounced() {} + * + * var debounced = debounce(someMethodToInvokeDebounced, 300); + * + * // invoke repeatedly + * debounced(); + * debounced(); + * debounced(); + * debounced(); + * debounced(); + * debounced(); // last invoke of debounced() + * + * // invoke someMethodToInvokeDebounced() after 300 milliseconds. + */ +function debounce(fn, delay) { + var timer, args; + + /* istanbul ignore next */ + delay = delay || 0; + + function debounced() { // eslint-disable-line require-jsdoc + args = Array.prototype.slice.call(arguments); + + window.clearTimeout(timer); + timer = window.setTimeout(function() { + fn.apply(null, args); + }, delay); + } + + return debounced; +} + +module.exports = debounce; + + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is truthy or not. + * @author NHN FE Development Lab + */ + + + +var isExisty = __webpack_require__(9); + +/** + * Check whether the given variable is truthy or not. + * If the given variable is not null or not undefined or not false, returns true. + * (It regards 0 as true) + * @param {*} obj - Target for checking + * @returns {boolean} Is truthy? + * @memberof module:type + */ +function isTruthy(obj) { + return isExisty(obj) && obj !== false; +} + +module.exports = isTruthy; + + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * TOAST UI Code Snippet + * @author NHN FE Development Lab + */ + + + +__webpack_require__(37); +__webpack_require__(4); +__webpack_require__(38); +__webpack_require__(39); +__webpack_require__(21); +__webpack_require__(1); +__webpack_require__(3); +__webpack_require__(5); +__webpack_require__(40); +__webpack_require__(14); +__webpack_require__(41); +__webpack_require__(42); +__webpack_require__(43); +__webpack_require__(44); +__webpack_require__(45); +__webpack_require__(15); +__webpack_require__(16); +__webpack_require__(46); +__webpack_require__(17); +__webpack_require__(47); +__webpack_require__(48); +__webpack_require__(49); +__webpack_require__(50); +__webpack_require__(51); +__webpack_require__(52); +__webpack_require__(10); +__webpack_require__(28); +__webpack_require__(53); +__webpack_require__(25); +__webpack_require__(54); +__webpack_require__(29); +__webpack_require__(55); +__webpack_require__(26); +__webpack_require__(56); +__webpack_require__(57); +__webpack_require__(58); +__webpack_require__(59); +__webpack_require__(23); +__webpack_require__(22); +__webpack_require__(6); +__webpack_require__(31); +__webpack_require__(33); +__webpack_require__(60); +__webpack_require__(61); +__webpack_require__(62); +__webpack_require__(34); +__webpack_require__(63); +__webpack_require__(20); +__webpack_require__(0); +__webpack_require__(64); +__webpack_require__(65); +__webpack_require__(66); +__webpack_require__(32); +__webpack_require__(67); +__webpack_require__(13); +__webpack_require__(9); +__webpack_require__(68); +__webpack_require__(12); +__webpack_require__(69); +__webpack_require__(70); +__webpack_require__(71); +__webpack_require__(72); +__webpack_require__(11); +__webpack_require__(30); +__webpack_require__(73); +__webpack_require__(7); +__webpack_require__(8); +__webpack_require__(74); +__webpack_require__(35); +__webpack_require__(2); + + +/***/ }), +/* 37 */ +/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _collection_forEachArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); +/* harmony import */ var _collection_forEachOwnProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5); +/* harmony import */ var _object_extend__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6); +/* harmony import */ var _type_isArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(0); +/* harmony import */ var _type_isEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(13); +/* harmony import */ var _type_isFunction__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(12); +/* harmony import */ var _type_isNull__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(11); +/* harmony import */ var _type_isObject__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(7); +/* harmony import */ var _type_isUndefined__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2); + + + + + + + + + + +function encodePairs(key, value) { + return `${encodeURIComponent(key)}=${encodeURIComponent( + _type_isNull__WEBPACK_IMPORTED_MODULE_6__(value) || _type_isUndefined__WEBPACK_IMPORTED_MODULE_8__(value) ? '' : value + )}`; +} + +function serializeParams(key, value, serializedList) { + if (_type_isArray__WEBPACK_IMPORTED_MODULE_3__(value)) { + _collection_forEachArray__WEBPACK_IMPORTED_MODULE_0__(value, (arrVal, index) => { + serializeParams(`${key}[${_type_isObject__WEBPACK_IMPORTED_MODULE_7__(arrVal) ? index : ''}]`, arrVal, serializedList); + }); + } else if (_type_isObject__WEBPACK_IMPORTED_MODULE_7__(value)) { + _collection_forEachOwnProperties__WEBPACK_IMPORTED_MODULE_1__(value, (objValue, objKey) => { + serializeParams(`${key}[${objKey}]`, objValue, serializedList); + }); + } else { + serializedList.push(encodePairs(key, value)); + } +} + +/** + * Serializer to serialize parameters + * @callback ajax/serializer + * @param {*} params - parameter to serialize + * @returns {string} - serialized strings + */ + +/** + * Serializer + * + * 1. Array format + * + * The default array format to serialize is 'bracket'. + * However in case of nested array, only the deepest format follows the 'bracket', the rest follow 'indice' format. + * + * - basic + * { a: [1, 2, 3] } => a[]=1&a[]=2&a[]=3 + * - nested + * { a: [1, 2, [3]] } => a[]=1&a[]=2&a[2][]=3 + * + * 2. Object format + * + * The default object format to serialize is 'bracket' notation and doesn't allow the 'dot' notation. + * + * - basic + * { a: { b: 1, c: 2 } } => a[b]=1&a[c]=2 + * + * @param {*} params - parameters to serialize + * @returns {string} + * @private + */ +function serialize(params) { + if (!params || _type_isEmpty__WEBPACK_IMPORTED_MODULE_4__(params)) { + return ''; + } + const serializedList = []; + _collection_forEachOwnProperties__WEBPACK_IMPORTED_MODULE_1__(params, (value, key) => { + serializeParams(key, value, serializedList); + }); + + return serializedList.join('&'); +} + +const getDefaultOptions = () => ({ + baseURL: '', + headers: { + common: {}, + get: {}, + post: {}, + put: {}, + delete: {}, + patch: {}, + options: {}, + head: {} + }, + serializer: serialize +}); + +const HTTP_PROTOCOL_REGEXP = /^(http|https):\/\//i; + +/** + * Combine an absolute URL string (baseURL) and a relative URL string (url). + * @param {string} baseURL - An absolute URL string + * @param {string} url - An relative URL string + * @returns {string} + * @private + */ +function combineURL(baseURL, url) { + if (HTTP_PROTOCOL_REGEXP.test(url)) { + return url; + } + + if (baseURL.slice(-1) === '/' && url.slice(0, 1) === '/') { + url = url.slice(1); + } + + return baseURL + url; +} + +/** + * Get merged options by its priorities. + * defaults.common < defaults[method] < custom options + * @param {Object} defaultOptions - The default options + * @param {Object} customOptions - The custom options + * @returns {Object} + * @private + */ +function getComputedOptions(defaultOptions, customOptions) { + const { + baseURL, + headers: defaultHeaders, + serializer: defaultSerializer, + beforeRequest: defaultBeforeRequest, + success: defaultSuccess, + error: defaultError, + complete: defaultComplete + } = defaultOptions; + const { + url, + contentType, + method, + params, + headers, + serializer, + beforeRequest, + success, + error, + complete, + withCredentials, + mimeType + } = customOptions; + + const options = { + url: combineURL(baseURL, url), + method, + params, + headers: _object_extend__WEBPACK_IMPORTED_MODULE_2__(defaultHeaders.common, defaultHeaders[method.toLowerCase()], headers), + serializer: serializer || defaultSerializer || serialize, + beforeRequest: [defaultBeforeRequest, beforeRequest], + success: [defaultSuccess, success], + error: [defaultError, error], + complete: [defaultComplete, complete], + withCredentials, + mimeType + }; + + options.contentType = contentType || options.headers['Content-Type']; + delete options.headers['Content-Type']; + + return options; +} + +function validateStatus(status) { + return status >= 200 && status < 300; +} + +function hasRequestBody(method) { + return /^(?:POST|PUT|PATCH)$/.test(method.toUpperCase()); +} + +function executeCallback(callback, param) { + if (_type_isArray__WEBPACK_IMPORTED_MODULE_3__(callback)) { + _collection_forEachArray__WEBPACK_IMPORTED_MODULE_0__(callback, fn => executeCallback(fn, param)); + } else if (_type_isFunction__WEBPACK_IMPORTED_MODULE_5__(callback)) { + callback(param); + } +} + +function parseHeaders(text) { + const headers = {}; + + _collection_forEachArray__WEBPACK_IMPORTED_MODULE_0__(text.split('\r\n'), header => { + const [key, value] = header.split(': '); + + if (key !== '' && !_type_isUndefined__WEBPACK_IMPORTED_MODULE_8__(value)) { + headers[key] = value; + } + }); + + return headers; +} + +function parseJSONData(data) { + let result = ''; + try { + result = JSON.parse(data); + } catch (_) { + result = data; + } + + return result; +} + +const REQUEST_DONE = 4; + +function handleReadyStateChange(xhr, options) { + const { readyState } = xhr; + + // eslint-disable-next-line eqeqeq + if (readyState != REQUEST_DONE) { + return; + } + + const { status, statusText, responseText } = xhr; + const { success, resolve, error, reject, complete } = options; + + if (validateStatus(status)) { + const contentType = xhr.getResponseHeader('Content-Type'); + let data = responseText; + + if (contentType && contentType.indexOf('application/json') > -1) { + data = parseJSONData(data); + } + + /** + * successCallback is executed when the response is received successfully + * @callback ajax/successCallback + * @param {Object} response - success response wrapper + * @param {number} response.status - response status code + * @param {string} response.statusText - response status text + * @param {*} response.data - response data. If its Content-Type is 'application/json', the parsed object will be passed. + * @param {Object.} response.headers - response headers + */ + executeCallback([success, resolve], { + status, + statusText, + data, + headers: parseHeaders(xhr.getAllResponseHeaders()) + }); + } else { + /** + * errorCallback executed when the request failed + * @callback ajax/errorCallback + * @param {Object} response - error response wrapper + * @param {number} response.status - response status code + * @param {string} response.statusText - response status text + */ + executeCallback([error, reject], { status, statusText }); + } + + /** + * completeCallback executed when the request is completed after success or error callbacks are executed + * @callback ajax/completeCallback + * @param {Object} response - error response wrapper + * @param {number} response.status - response status code + * @param {string} response.statusText - response status text + */ + executeCallback(complete, { status, statusText }); +} + +const QS_DELIM_REGEXP = /\?/; + +function open(xhr, options) { + const { url, method, serializer, params } = options; + + let requestUrl = url; + + if (!hasRequestBody(method) && params) { + // serialize query string + const qs = (QS_DELIM_REGEXP.test(url) ? '&' : '?') + serializer(params); + requestUrl = `${url}${qs}`; + } + + xhr.open(method, requestUrl); +} + +function applyConfig(xhr, options) { + const { method, contentType, mimeType, headers, withCredentials = false } = options; + + // set withCredentials (IE10+) + if (withCredentials) { + xhr.withCredentials = withCredentials; + } + + // override MIME type (IE11+) + if (mimeType) { + xhr.overrideMimeType(mimeType); + } + + _collection_forEachOwnProperties__WEBPACK_IMPORTED_MODULE_1__(headers, (value, header) => { + if (!_type_isObject__WEBPACK_IMPORTED_MODULE_7__(value)) { + xhr.setRequestHeader(header, value); + } + }); + + if (hasRequestBody(method)) { + xhr.setRequestHeader('Content-Type', `${contentType}; charset=UTF-8`); + } + + // set 'x-requested-with' header to prevent CSRF in old browser + xhr.setRequestHeader('x-requested-with', 'XMLHttpRequest'); +} + +const ENCODED_SPACE_REGEXP = /%20/g; + +function send(xhr, options) { + const { + method, + serializer, + beforeRequest, + params = {}, + contentType = 'application/x-www-form-urlencoded' + } = options; + + let body = null; + + if (hasRequestBody(method)) { + // The space character '%20' is replaced to '+', because application/x-www-form-urlencoded follows rfc-1866 + body = + contentType.indexOf('application/x-www-form-urlencoded') > -1 + ? serializer(params).replace(ENCODED_SPACE_REGEXP, '+') + : JSON.stringify(params); + } + + xhr.onreadystatechange = () => handleReadyStateChange(xhr, options); + + /** + * beforeRequestCallback is executed before the Ajax request is sent + * @callback ajax/beforeRequestCallback + * @param {XMLHttpRequest} xhr - XMLHttpRequest object + */ + executeCallback(beforeRequest, xhr); + xhr.send(body); +} + +/** + * @module ajax + * @description + * A module for the Ajax request. + * If the browser supports Promise, return the Promise object. If not, return null. + * @param {Object} options - Options for the Ajax request + * @param {string} options.url - URL string + * @param {('GET'|'POST'|'PUT'|'DELETE'|'PATCH'|'OPTIONS'|'HEAD')} options.method - Method of the Ajax request + * @param {Object.} [options.headers] - Headers for the Ajax request + * @param {string} [options.contentType] - Content-Type for the Ajax request. It is applied to POST, PUT, and PATCH requests only. Its encoding automatically sets to UTF-8. + * @param {*} [options.params] - Parameters to send by the Ajax request + * @param {serializer} [options.serializer] - {@link ajax_serializer Serializer} that determine how to serialize the parameters. Default serializer is {@link https://github.com/nhn/tui.code-snippet/tree/v2.3.0/ajax/index.mjs#L38 serialize()}. + * @param {beforeRequestCallback} [options.beforeRequest] - {@link ajax_beforeRequestCallback beforeRequest callback} executed before the Ajax request is sent. + * @param {successCallback} [options.success] - {@link ajax_successCallback success callback} executed when the response is received successfully. + * @param {errorCallback} [options.error] - {@link ajax_errorCallback error callback} executed when the request failed. + * @param {completeCallback} [options.complete] - {@link ajax_completeCallback complete callback} executed when the request is completed after success or error callbacks are executed. + * @param {boolean} [options.withCredentials] - Determine whether cross-site Access-Control requests should be made using credentials or not. This option can be used on IE10+ + * @param {string} [options.mimeType] - Override the MIME type returned by the server. This options can be used on IE11+ + * @returns {?Promise} - If the browser supports Promise, return the Promise object. If not, return null. + * @example + * import ajax from 'tui-code-snippet/ajax'; // import ES6 module (written in ES6) + * // import ajax from 'tui-code-snippet/ajax/index.js'; // import transfiled file (IE8+) + * // var ajax = require('tui-code-snippet/ajax/index.js'); // commonjs + * + * // If the browser supports Promise, return the Promise object + * ajax({ + * url: 'https://nhn.github.io/tui-code-snippet/', + * method: 'POST', + * contentType: 'application/json', + * params: { + * version: 'v2.3.0', + * author: 'NHN. FE Development Lab ' + * }, + * success: res => console.log(`success: ${res.status} ${res.statusText}`), + * error: res => console.log(`error: ${res.status} ${res.statusText}`) + * }).then(res => console.log(`resolve: ${res.status} ${res.statusText}`)) + * .catch(res => console.log(`reject: ${res.status} ${res.statusText}`)); + * + * // If the request succeeds (200, OK) + * // success: 200 OK + * // resolve: 200 OK + * + * // If the request failed (503, Service Unavailable) + * // error: 503 Service Unavailable + * // reject: 503 Service Unavailable + * + * // If the browser does not support Promise, return null + * ajax({ + * url: 'https://ui.toast.com/fe-guide/', + * method: 'GET', + * contentType: 'application/json', + * params: { + * lang: 'en' + * title: 'PERFORMANCE', + * }, + * success: res => console.log(`success: ${res.status} ${res.statusText}`), + * error: res => console.log(`error: ${res.status} ${res.statusText}`) + * }); + * + * // If the request succeeds (200, OK) + * // success: 200 OK + * + * // If the request failed (503, Service Unavailable) + * // error: 503 Service Unavailable + */ +function ajax(options) { + const xhr = new XMLHttpRequest(); + const request = opts => _collection_forEachArray__WEBPACK_IMPORTED_MODULE_0__([open, applyConfig, send], fn => fn(xhr, opts)); + + options = getComputedOptions(ajax.defaults, options); + + if (typeof Promise !== 'undefined') { + return new Promise((resolve, reject) => { + request(_object_extend__WEBPACK_IMPORTED_MODULE_2__(options, { resolve, reject })); + }); + } + + request(options); + + return null; +} + +/** + * Default configuration for the Ajax request. + * @property {string} baseURL - baseURL appended with url of ajax options. If url is absolute, baseURL is ignored. + * ex) baseURL = 'https://nhn.github.io', url = '/tui.code-snippet' => request is sent to 'https://nhn.github.io/tui.code-snippet' + * ex) baseURL = 'https://nhn.github.io', url = 'https://ui.toast.com' => request is sent to 'https://ui.toast.com' + * @property {Object} headers - request headers. It extends the header object in the following order: headers.common -> headers\[method\] -> headers in ajax options. + * @property {Object.} headers.common - Common headers regardless of the type of request + * @property {Object.} headers.get - Headers for the GET method + * @property {Object.} headers.post - Headers for the POST method + * @property {Object.} headers.put - Headers for the PUT method + * @property {Object.} headers.delete - Headers for the DELETE method + * @property {Object.} headers.patch - Headers for the PATCH method + * @property {Object.} headers.options - Headers for the OPTIONS method + * @property {Object.} headers.head - Headers for the HEAD method + * @property {serializer} serializer - {@link ajax_serializer Serializer} that determine how to serialize the parameters. If serializer is specified in both default options and ajax options, use serializer in ajax options. + * @property {beforeRequestCallback} beforeRequest - {@link ajax_beforeRequestCallback beforeRequest callback} executed before the Ajax request is sent. Callbacks in both default options and ajax options are executed, but default callbacks are called first. + * @property {successCallback} success - {@link ajax_successCallback success callback} executed when the response is received successfully. Callbacks in both default options and ajax options are executed, but default callbacks are called first. + * @property {errorCallback} error - {@link ajax_errorCallback error callback} executed when the request failed. Callbacks in both default options and ajax options are executed, but default callbacks are called first. + * @property {completeCallback} complete - {@link ajax_completeCallback complete callback} executed when the request is completed after success or error callbacks are executed. Callbacks in both default options and ajax options are executed, but default callbacks are called first. + * @example + * ajax.defaults.baseURL = 'https://nhn.github.io/tui.code-snippet'; + * ajax.defaults.headers.common = { + * 'Content-Type': 'application/json' + * }; + * ajax.defaults.beforeRequest = () => showProgressBar(); + * ajax.defaults.complete = () => hideProgressBar(); + */ +ajax.defaults = getDefaultOptions(); + +/** + * Reset the default options + * @private + */ +ajax._reset = function() { + ajax.defaults = getDefaultOptions(); +}; + +/** + * Ajax request + * @private + */ +ajax._request = function(url, method, options = {}) { + return ajax(_object_extend__WEBPACK_IMPORTED_MODULE_2__(options, { url, method })); +}; + +/** + * Send the Ajax request by GET + * @memberof module:ajax + * @function get + * @param {string} url - URL string + * @param {object} options - Options for the Ajax request. Refer to {@link ajax options of ajax()}. + * @example + * ajax.get('https://nhn.github.io/tui.code-snippet/', { + * params: { + * version: 'v2.3.0' + * } + * }); + */ + +/** + * Send the Ajax request by POST + * @memberof module:ajax + * @function post + * @param {string} url - URL string + * @param {object} options - Options for the Ajax request. Refer to {@link ajax options of ajax()}. + * @example + * ajax.post('https://nhn.github.io/tui.code-snippet/', { + * contentType: 'application/json', + * params: { + * version: 'v2.3.0' + * } + * }); + */ + +/** + * Send the Ajax request by PUT + * @memberof module:ajax + * @function put + * @param {string} url - URL string + * @param {object} options - Options for the Ajax request. Refer to {@link ajax options of ajax()}. + * @example + * ajax.put('https://nhn.github.io/tui.code-snippet/v2.3.0', { + * success: ({status, statusText}) => alert(`success: ${status} ${statusText}`), + * error: ({status, statusText}) => alert(`error: ${status} ${statusText}`) + * }); + */ + +/** + * Send the Ajax request by DELETE + * @memberof module:ajax + * @function delete + * @param {string} url - URL string + * @param {object} options - Options for the Ajax request. Refer to {@link ajax options of ajax()}. + * @example + * ajax.delete('https://nhn.github.io/tui.code-snippet/v2.3.0'); + */ + +/** + * Send the Ajax request by PATCH + * @memberof module:ajax + * @function patch + * @param {string} url - URL string + * @param {object} options - Options for the Ajax request. Refer to {@link ajax options of ajax()}. + * @example + * ajax.patch('https://nhn.github.io/tui.code-snippet/v2.3.0', { + * beforeRequest: () => showProgressBar(), + * complete: () => hideProgressBar() + * }); + */ + +/** + * Send the Ajax request by OPTIONS + * @memberof module:ajax + * @function options + * @param {string} url - URL string + * @param {object} options - Options for the Ajax request. Refer to {@link ajax options of ajax()}. + * @example + * ajax.head('https://nhn.github.io/tui.code-snippet/v2.3.0'); + */ + +/** + * Send the Ajax request by HEAD + * @memberof module:ajax + * @function head + * @param {string} url - URL string + * @param {object} options - Options for the Ajax request. Refer to {@link ajax options of ajax()}. + * @example + * ajax.options('https://nhn.github.io/tui.code-snippet/v2.3.0'); + */ +_collection_forEachArray__WEBPACK_IMPORTED_MODULE_0__(['get', 'post', 'put', 'delete', 'patch', 'options', 'head'], type => { + ajax[type] = (url, options) => ajax._request(url, type.toUpperCase(), options); +}); + +/* harmony default export */ __webpack_exports__["default"] = (ajax); + + +/***/ }), +/* 38 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Generate an integer Array containing an arithmetic progression. + * @author NHN FE Development Lab + */ + + + +var isUndefined = __webpack_require__(2); + +/** + * Generate an integer Array containing an arithmetic progression. + * @param {number} start - start index + * @param {number} stop - stop index + * @param {number} step - next visit index = current index + step + * @returns {Array} + * @memberof module:array + * @example + * var range = require('tui-code-snippet/array/range'); // node, commonjs + * + * range(5); // [0, 1, 2, 3, 4] + * range(1, 5); // [1,2,3,4] + * range(2, 10, 2); // [2,4,6,8] + * range(10, 2, -2); // [10,8,6,4] + */ +function range(start, stop, step) { + var arr = []; + var flag; + + if (isUndefined(stop)) { + stop = start || 0; + start = 0; + } + + step = step || 1; + flag = step < 0 ? -1 : 1; + stop *= flag; + + for (; start * flag < stop; start += step) { + arr.push(start); + } + + return arr; +} + +module.exports = range; + + +/***/ }), +/* 39 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Zip together multiple lists into a single array. + * @author NHN FE Development Lab + */ + + + +var forEach = __webpack_require__(1); + +/** + * Zip together multiple lists into a single array. + * @param {...Array} ...Arrays - Arrays to be zipped + * @returns {Array} + * @memberof module:array + * @example + * var zip = require('tui-code-snippet/array/zip'); // node, commonjs + * + * var result = zip([1, 2, 3], ['a', 'b','c'], [true, false, true]); + * console.log(result[0]); // [1, 'a', true] + * console.log(result[1]); // [2, 'b', false] + * console.log(result[2]); // [3, 'c', true] + */ +function zip() { + var arr2d = Array.prototype.slice.call(arguments); + var result = []; + + forEach(arr2d, function(arr) { + forEach(arr, function(value, index) { + if (!result[index]) { + result[index] = []; + } + result[index].push(value); + }); + }); + + return result; +} + +module.exports = zip; + + +/***/ }), +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Fetch a property + * @author NHN FE Development Lab + */ + + + +var forEach = __webpack_require__(1); + +/** + * fetching a property + * @param {Array} arr target collection + * @param {String|Number} property property name + * @returns {Array} + * @memberof module:collection + * @example + * var pluck = require('tui-code-snippe/collection/pluck'); // node, commonjs + * + * var objArr = [ + * {'abc': 1, 'def': 2, 'ghi': 3}, + * {'abc': 4, 'def': 5, 'ghi': 6}, + * {'abc': 7, 'def': 8, 'ghi': 9} + * ]; + * var arr2d = [ + * [1, 2, 3], + * [4, 5, 6], + * [7, 8, 9] + * ]; + * pluck(objArr, 'abc'); // [1, 4, 7] + * pluck(arr2d, 2); // [3, 6, 9] + */ +function pluck(arr, property) { + var resultArray = []; + + forEach(arr, function(item) { + resultArray.push(item[property]); + }); + + return resultArray; +} + +module.exports = pluck; + + +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview This module provides some functions for custom events. And it is implemented in the observer design pattern. + * @author NHN FE Development Lab + */ + + + +var extend = __webpack_require__(6); +var isExisty = __webpack_require__(9); +var isString = __webpack_require__(8); +var isObject = __webpack_require__(7); +var isArray = __webpack_require__(0); +var isFunction = __webpack_require__(12); +var forEach = __webpack_require__(1); + +var R_EVENTNAME_SPLIT = /\s+/g; + +/** + * @class + * @example + * // node, commonjs + * var CustomEvents = require('tui-code-snippet/customEvents/customEvents'); + */ +function CustomEvents() { + /** + * @type {HandlerItem[]} + */ + this.events = null; + + /** + * only for checking specific context event was binded + * @type {object[]} + */ + this.contexts = null; +} + +/** + * Mixin custom events feature to specific constructor + * @param {function} func - constructor + * @example + * var CustomEvents = require('tui-code-snippet/customEvents/customEvents'); // node, commonjs + * + * var model; + * function Model() { + * this.name = ''; + * } + * CustomEvents.mixin(Model); + * + * model = new Model(); + * model.on('change', function() { this.name = 'model'; }, this); + * model.fire('change'); + * alert(model.name); // 'model'; + */ +CustomEvents.mixin = function(func) { + extend(func.prototype, CustomEvents.prototype); +}; + +/** + * Get HandlerItem object + * @param {function} handler - handler function + * @param {object} [context] - context for handler + * @returns {HandlerItem} HandlerItem object + * @private + */ +CustomEvents.prototype._getHandlerItem = function(handler, context) { + var item = {handler: handler}; + + if (context) { + item.context = context; + } + + return item; +}; + +/** + * Get event object safely + * @param {string} [eventName] - create sub event map if not exist. + * @returns {(object|array)} event object. if you supplied `eventName` + * parameter then make new array and return it + * @private + */ +CustomEvents.prototype._safeEvent = function(eventName) { + var events = this.events; + var byName; + + if (!events) { + events = this.events = {}; + } + + if (eventName) { + byName = events[eventName]; + + if (!byName) { + byName = []; + events[eventName] = byName; + } + + events = byName; + } + + return events; +}; + +/** + * Get context array safely + * @returns {array} context array + * @private + */ +CustomEvents.prototype._safeContext = function() { + var context = this.contexts; + + if (!context) { + context = this.contexts = []; + } + + return context; +}; + +/** + * Get index of context + * @param {object} ctx - context that used for bind custom event + * @returns {number} index of context + * @private + */ +CustomEvents.prototype._indexOfContext = function(ctx) { + var context = this._safeContext(); + var index = 0; + + while (context[index]) { + if (ctx === context[index][0]) { + return index; + } + + index += 1; + } + + return -1; +}; + +/** + * Memorize supplied context for recognize supplied object is context or + * name: handler pair object when off() + * @param {object} ctx - context object to memorize + * @private + */ +CustomEvents.prototype._memorizeContext = function(ctx) { + var context, index; + + if (!isExisty(ctx)) { + return; + } + + context = this._safeContext(); + index = this._indexOfContext(ctx); + + if (index > -1) { + context[index][1] += 1; + } else { + context.push([ctx, 1]); + } +}; + +/** + * Forget supplied context object + * @param {object} ctx - context object to forget + * @private + */ +CustomEvents.prototype._forgetContext = function(ctx) { + var context, contextIndex; + + if (!isExisty(ctx)) { + return; + } + + context = this._safeContext(); + contextIndex = this._indexOfContext(ctx); + + if (contextIndex > -1) { + context[contextIndex][1] -= 1; + + if (context[contextIndex][1] <= 0) { + context.splice(contextIndex, 1); + } + } +}; + +/** + * Bind event handler + * @param {(string|{name:string, handler:function})} eventName - custom + * event name or an object {eventName: handler} + * @param {(function|object)} [handler] - handler function or context + * @param {object} [context] - context for binding + * @private + */ +CustomEvents.prototype._bindEvent = function(eventName, handler, context) { + var events = this._safeEvent(eventName); + this._memorizeContext(context); + events.push(this._getHandlerItem(handler, context)); +}; + +/** + * Bind event handlers + * @param {(string|{name:string, handler:function})} eventName - custom + * event name or an object {eventName: handler} + * @param {(function|object)} [handler] - handler function or context + * @param {object} [context] - context for binding + * //-- #1. Get Module --// + * var CustomEvents = require('tui-code-snippet/customEvents/customEvents'); // node, commonjs + * + * //-- #2. Use method --// + * // # 2.1 Basic Usage + * CustomEvents.on('onload', handler); + * + * // # 2.2 With context + * CustomEvents.on('onload', handler, myObj); + * + * // # 2.3 Bind by object that name, handler pairs + * CustomEvents.on({ + * 'play': handler, + * 'pause': handler2 + * }); + * + * // # 2.4 Bind by object that name, handler pairs with context object + * CustomEvents.on({ + * 'play': handler + * }, myObj); + */ +CustomEvents.prototype.on = function(eventName, handler, context) { + var self = this; + + if (isString(eventName)) { + // [syntax 1, 2] + eventName = eventName.split(R_EVENTNAME_SPLIT); + forEach(eventName, function(name) { + self._bindEvent(name, handler, context); + }); + } else if (isObject(eventName)) { + // [syntax 3, 4] + context = handler; + forEach(eventName, function(func, name) { + self.on(name, func, context); + }); + } +}; + +/** + * Bind one-shot event handlers + * @param {(string|{name:string,handler:function})} eventName - custom + * event name or an object {eventName: handler} + * @param {function|object} [handler] - handler function or context + * @param {object} [context] - context for binding + */ +CustomEvents.prototype.once = function(eventName, handler, context) { + var self = this; + + if (isObject(eventName)) { + context = handler; + forEach(eventName, function(func, name) { + self.once(name, func, context); + }); + + return; + } + + function onceHandler() { // eslint-disable-line require-jsdoc + handler.apply(context, arguments); + self.off(eventName, onceHandler, context); + } + + this.on(eventName, onceHandler, context); +}; + +/** + * Splice supplied array by callback result + * @param {array} arr - array to splice + * @param {function} predicate - function return boolean + * @private + */ +CustomEvents.prototype._spliceMatches = function(arr, predicate) { + var i = 0; + var len; + + if (!isArray(arr)) { + return; + } + + for (len = arr.length; i < len; i += 1) { + if (predicate(arr[i]) === true) { + arr.splice(i, 1); + len -= 1; + i -= 1; + } + } +}; + +/** + * Get matcher for unbind specific handler events + * @param {function} handler - handler function + * @returns {function} handler matcher + * @private + */ +CustomEvents.prototype._matchHandler = function(handler) { + var self = this; + + return function(item) { + var needRemove = handler === item.handler; + + if (needRemove) { + self._forgetContext(item.context); + } + + return needRemove; + }; +}; + +/** + * Get matcher for unbind specific context events + * @param {object} context - context + * @returns {function} object matcher + * @private + */ +CustomEvents.prototype._matchContext = function(context) { + var self = this; + + return function(item) { + var needRemove = context === item.context; + + if (needRemove) { + self._forgetContext(item.context); + } + + return needRemove; + }; +}; + +/** + * Get matcher for unbind specific hander, context pair events + * @param {function} handler - handler function + * @param {object} context - context + * @returns {function} handler, context matcher + * @private + */ +CustomEvents.prototype._matchHandlerAndContext = function(handler, context) { + var self = this; + + return function(item) { + var matchHandler = (handler === item.handler); + var matchContext = (context === item.context); + var needRemove = (matchHandler && matchContext); + + if (needRemove) { + self._forgetContext(item.context); + } + + return needRemove; + }; +}; + +/** + * Unbind event by event name + * @param {string} eventName - custom event name to unbind + * @param {function} [handler] - handler function + * @private + */ +CustomEvents.prototype._offByEventName = function(eventName, handler) { + var self = this; + var andByHandler = isFunction(handler); + var matchHandler = self._matchHandler(handler); + + eventName = eventName.split(R_EVENTNAME_SPLIT); + + forEach(eventName, function(name) { + var handlerItems = self._safeEvent(name); + + if (andByHandler) { + self._spliceMatches(handlerItems, matchHandler); + } else { + forEach(handlerItems, function(item) { + self._forgetContext(item.context); + }); + + self.events[name] = []; + } + }); +}; + +/** + * Unbind event by handler function + * @param {function} handler - handler function + * @private + */ +CustomEvents.prototype._offByHandler = function(handler) { + var self = this; + var matchHandler = this._matchHandler(handler); + + forEach(this._safeEvent(), function(handlerItems) { + self._spliceMatches(handlerItems, matchHandler); + }); +}; + +/** + * Unbind event by object(name: handler pair object or context object) + * @param {object} obj - context or {name: handler} pair object + * @param {function} handler - handler function + * @private + */ +CustomEvents.prototype._offByObject = function(obj, handler) { + var self = this; + var matchFunc; + + if (this._indexOfContext(obj) < 0) { + forEach(obj, function(func, name) { + self.off(name, func); + }); + } else if (isString(handler)) { + matchFunc = this._matchContext(obj); + + self._spliceMatches(this._safeEvent(handler), matchFunc); + } else if (isFunction(handler)) { + matchFunc = this._matchHandlerAndContext(handler, obj); + + forEach(this._safeEvent(), function(handlerItems) { + self._spliceMatches(handlerItems, matchFunc); + }); + } else { + matchFunc = this._matchContext(obj); + + forEach(this._safeEvent(), function(handlerItems) { + self._spliceMatches(handlerItems, matchFunc); + }); + } +}; + +/** + * Unbind custom events + * @param {(string|object|function)} eventName - event name or context or + * {name: handler} pair object or handler function + * @param {(function)} handler - handler function + * @example + * //-- #1. Get Module --// + * var CustomEvents = require('tui-code-snippet/customEvents/customEvents'); // node, commonjs + * + * //-- #2. Use method --// + * // # 2.1 off by event name + * CustomEvents.off('onload'); + * + * // # 2.2 off by event name and handler + * CustomEvents.off('play', handler); + * + * // # 2.3 off by handler + * CustomEvents.off(handler); + * + * // # 2.4 off by context + * CustomEvents.off(myObj); + * + * // # 2.5 off by context and handler + * CustomEvents.off(myObj, handler); + * + * // # 2.6 off by context and event name + * CustomEvents.off(myObj, 'onload'); + * + * // # 2.7 off by an Object. that is {eventName: handler} + * CustomEvents.off({ + * 'play': handler, + * 'pause': handler2 + * }); + * + * // # 2.8 off the all events + * CustomEvents.off(); + */ +CustomEvents.prototype.off = function(eventName, handler) { + if (isString(eventName)) { + // [syntax 1, 2] + this._offByEventName(eventName, handler); + } else if (!arguments.length) { + // [syntax 8] + this.events = {}; + this.contexts = []; + } else if (isFunction(eventName)) { + // [syntax 3] + this._offByHandler(eventName); + } else if (isObject(eventName)) { + // [syntax 4, 5, 6] + this._offByObject(eventName, handler); + } +}; + +/** + * Fire custom event + * @param {string} eventName - name of custom event + */ +CustomEvents.prototype.fire = function(eventName) { // eslint-disable-line + this.invoke.apply(this, arguments); +}; + +/** + * Fire a event and returns the result of operation 'boolean AND' with all + * listener's results. + * + * So, It is different from {@link CustomEvents#fire}. + * + * In service code, use this as a before event in component level usually + * for notifying that the event is cancelable. + * @param {string} eventName - Custom event name + * @param {...*} data - Data for event + * @returns {boolean} The result of operation 'boolean AND' + * @example + * var map = new Map(); + * map.on({ + * 'beforeZoom': function() { + * // It should cancel the 'zoom' event by some conditions. + * if (that.disabled && this.getState()) { + * return false; + * } + * return true; + * } + * }); + * + * if (this.invoke('beforeZoom')) { // check the result of 'beforeZoom' + * // if true, + * // doSomething + * } + */ +CustomEvents.prototype.invoke = function(eventName) { + var events, args, index, item; + + if (!this.hasListener(eventName)) { + return true; + } + + events = this._safeEvent(eventName); + args = Array.prototype.slice.call(arguments, 1); + index = 0; + + while (events[index]) { + item = events[index]; + + if (item.handler.apply(item.context, args) === false) { + return false; + } + + index += 1; + } + + return true; +}; + +/** + * Return whether at least one of the handlers is registered in the given + * event name. + * @param {string} eventName - Custom event name + * @returns {boolean} Is there at least one handler in event name? + */ +CustomEvents.prototype.hasListener = function(eventName) { + return this.getListenerLength(eventName) > 0; +}; + +/** + * Return a count of events registered. + * @param {string} eventName - Custom event name + * @returns {number} number of event + */ +CustomEvents.prototype.getListenerLength = function(eventName) { + var events = this._safeEvent(eventName); + + return events.length; +}; + +module.exports = CustomEvents; + + +/***/ }), +/* 42 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview + * This module provides a function to make a constructor + * that can inherit from the other constructors like the CLASS easily. + * @author NHN FE Development Lab + */ + + + +var inherit = __webpack_require__(22); +var extend = __webpack_require__(6); + +/** + * @module defineClass + */ + +/** + * Help a constructor to be defined and to inherit from the other constructors + * @param {*} [parent] Parent constructor + * @param {Object} props Members of constructor + * @param {Function} props.init Initialization method + * @param {Object} [props.static] Static members of constructor + * @returns {*} Constructor + * @memberof module:defineClass + * @example + * var defineClass = require('tui-code-snippet/defineClass/defineClass'); // node, commonjs + * + * //-- #2. Use property --// + * var Parent = defineClass({ + * init: function() { // constuructor + * this.name = 'made by def'; + * }, + * method: function() { + * // ... + * }, + * static: { + * staticMethod: function() { + * // ... + * } + * } + * }); + * + * var Child = defineClass(Parent, { + * childMethod: function() {} + * }); + * + * Parent.staticMethod(); + * + * var parentInstance = new Parent(); + * console.log(parentInstance.name); //made by def + * parentInstance.staticMethod(); // Error + * + * var childInstance = new Child(); + * childInstance.method(); + * childInstance.childMethod(); + */ +function defineClass(parent, props) { + var obj; + + if (!props) { + props = parent; + parent = null; + } + + obj = props.init || function() {}; + + if (parent) { + inherit(obj, parent); + } + + if (props.hasOwnProperty('static')) { + extend(obj, props['static']); + delete props['static']; + } + + extend(obj.prototype, props); + + return obj; +} + +module.exports = defineClass; + + +/***/ }), +/* 43 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Normalize mouse event's button attributes. + * @author NHN FE Development Lab + */ + + + +var browser = __webpack_require__(21); +var inArray = __webpack_require__(4); + +var primaryButton = ['0', '1', '3', '5', '7']; +var secondaryButton = ['2', '6']; +var wheelButton = ['4']; + +/** + * @module domEvent + */ + +/** + * Normalize mouse event's button attributes. + * + * Can detect which button is clicked by this method. + * + * Meaning of return numbers + * + * - 0: primary mouse button + * - 1: wheel button or center button + * - 2: secondary mouse button + * @param {MouseEvent} mouseEvent - The mouse event object want to know. + * @returns {number} - The value of meaning which button is clicked? + * @memberof module:domEvent + */ +function getMouseButton(mouseEvent) { + if (browser.msie && browser.version <= 8) { + return getMouseButtonIE8AndEarlier(mouseEvent); + } + + return mouseEvent.button; +} + +/** + * Normalize return value of mouseEvent.button + * Make same to standard MouseEvent's button value + * @param {DispCEventObj} mouseEvent - mouse event object + * @returns {number|null} - id indicating which mouse button is clicked + * @private + */ +function getMouseButtonIE8AndEarlier(mouseEvent) { + var button = String(mouseEvent.button); + + if (inArray(button, primaryButton) > -1) { + return 0; + } + + if (inArray(button, secondaryButton) > -1) { + return 2; + } + + if (inArray(button, wheelButton) > -1) { + return 1; + } + + return null; +} + +module.exports = getMouseButton; + + +/***/ }), +/* 44 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Get mouse position from mouse event + * @author NHN FE Development Lab + */ + + + +var isArray = __webpack_require__(0); + +/** + * Get mouse position from mouse event + * + * If supplied relatveElement parameter then return relative position based on + * element + * @param {(MouseEvent|object|number[])} position - mouse position object + * @param {HTMLElement} relativeElement HTML element that calculate relative + * position + * @returns {number[]} mouse position + * @memberof module:domEvent + */ +function getMousePosition(position, relativeElement) { + var positionArray = isArray(position); + var clientX = positionArray ? position[0] : position.clientX; + var clientY = positionArray ? position[1] : position.clientY; + var rect; + + if (!relativeElement) { + return [clientX, clientY]; + } + + rect = relativeElement.getBoundingClientRect(); + + return [ + clientX - rect.left - relativeElement.clientLeft, + clientY - rect.top - relativeElement.clientTop + ]; +} + +module.exports = getMousePosition; + + +/***/ }), +/* 45 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Get a target element from an event object. + * @author NHN FE Development Lab + */ + + + +/** + * Get a target element from an event object. + * @param {Event} e - event object + * @returns {HTMLElement} - target element + * @memberof module:domEvent + */ +function getTarget(e) { + return e.target || e.srcElement; +} + +module.exports = getTarget; + + +/***/ }), +/* 46 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Bind DOM event. this event will unbind after invokes. + * @author NHN FE Development Lab + */ + + + +var forEachOwnProperties = __webpack_require__(5); +var isObject = __webpack_require__(7); +var on = __webpack_require__(16); +var off = __webpack_require__(15); + +/** + * Bind DOM event. this event will unbind after invokes. + * @param {HTMLElement} element - HTMLElement to bind events. + * @param {(string|object)} types - Space splitted events names or + * eventName:handler object. + * @param {(function|object)} handler - handler function or context for handler method. + * @param {object} [context] - context object for handler method. + * @memberof module:domEvent + */ +function once(element, types, handler, context) { + /** + * Event handler for one time. + */ + function onceHandler() { + handler.apply(context || element, arguments); + off(element, types, onceHandler, context); + } + + if (isObject(types)) { + forEachOwnProperties(types, function(fn, type) { + once(element, type, fn, handler); + }); + + return; + } + + on(element, types, onceHandler, context); +} + +module.exports = once; + + +/***/ }), +/* 47 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Stop event propagation. + * @author NHN FE Development Lab + */ + + + +/** + * Stop event propagation. + * @param {Event} e - event object + * @memberof module:domEvent + */ +function stopPropagation(e) { + if (e.stopPropagation) { + e.stopPropagation(); + + return; + } + + e.cancelBubble = true; +} + +module.exports = stopPropagation; + + +/***/ }), +/* 48 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Add css class to element + * @author NHN FE Development Lab + */ + + + +var forEach = __webpack_require__(1); +var inArray = __webpack_require__(4); +var getClass = __webpack_require__(10); +var setClassName = __webpack_require__(18); + +/** + * domUtil module + * @module domUtil + */ + +/** + * Add css class to element + * @param {(HTMLElement|SVGElement)} element - target element + * @param {...string} cssClass - css classes to add + * @memberof module:domUtil + */ +function addClass(element) { + var cssClass = Array.prototype.slice.call(arguments, 1); + var classList = element.classList; + var newClass = []; + var origin; + + if (classList) { + forEach(cssClass, function(name) { + element.classList.add(name); + }); + + return; + } + + origin = getClass(element); + + if (origin) { + cssClass = [].concat(origin.split(/\s+/), cssClass); + } + + forEach(cssClass, function(cls) { + if (inArray(cls, newClass) < 0) { + newClass.push(cls); + } + }); + + setClassName(element, newClass); +} + +module.exports = addClass; + + +/***/ }), +/* 49 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Find parent element recursively + * @author NHN FE Development Lab + */ + + + +var matches = __webpack_require__(25); + +/** + * Find parent element recursively + * @param {HTMLElement} element - base element to start find + * @param {string} selector - selector string for find + * @returns {HTMLElement} - element finded or null + * @memberof module:domUtil + */ +function closest(element, selector) { + var parent = element.parentNode; + + if (matches(element, selector)) { + return element; + } + + while (parent && parent !== document) { + if (matches(parent, selector)) { + return parent; + } + + parent = parent.parentNode; + } + + return null; +} + +module.exports = closest; + + +/***/ }), +/* 50 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Setting element style + * @author NHN FE Development Lab + */ + + + +var isString = __webpack_require__(8); +var forEach = __webpack_require__(1); + +/** + * Setting element style + * @param {(HTMLElement|SVGElement)} element - element to setting style + * @param {(string|object)} key - style prop name or {prop: value} pair object + * @param {string} [value] - style value + * @memberof module:domUtil + */ +function css(element, key, value) { + var style = element.style; + + if (isString(key)) { + style[key] = value; + + return; + } + + forEach(key, function(v, k) { + style[k] = v; + }); +} + +module.exports = css; + + +/***/ }), +/* 51 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Disable browser's text selection behaviors. + * @author NHN FE Development Lab + */ + + + +var on = __webpack_require__(16); +var preventDefault = __webpack_require__(17); +var setData = __webpack_require__(26); +var testCSSProp = __webpack_require__(27); + +var SUPPORT_SELECTSTART = 'onselectstart' in document; +var KEY_PREVIOUS_USER_SELECT = 'prevUserSelect'; +var userSelectProperty = testCSSProp([ + 'userSelect', + 'WebkitUserSelect', + 'OUserSelect', + 'MozUserSelect', + 'msUserSelect' +]); + +/** + * Disable browser's text selection behaviors. + * @param {HTMLElement} [el] - target element. if not supplied, use `document` + * @memberof module:domUtil + */ +function disableTextSelection(el) { + if (!el) { + el = document; + } + + if (SUPPORT_SELECTSTART) { + on(el, 'selectstart', preventDefault); + } else { + el = (el === document) ? document.documentElement : el; + setData(el, KEY_PREVIOUS_USER_SELECT, el.style[userSelectProperty]); + el.style[userSelectProperty] = 'none'; + } +} + +module.exports = disableTextSelection; + + +/***/ }), +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Transform the Array-like object to Array. + * @author NHN FE Development Lab + */ + + + +var off = __webpack_require__(15); +var preventDefault = __webpack_require__(17); +var getData = __webpack_require__(28); +var removeData = __webpack_require__(29); +var testCSSProp = __webpack_require__(27); + +var SUPPORT_SELECTSTART = 'onselectstart' in document; +var KEY_PREVIOUS_USER_SELECT = 'prevUserSelect'; +var userSelectProperty = testCSSProp([ + 'userSelect', + 'WebkitUserSelect', + 'OUserSelect', + 'MozUserSelect', + 'msUserSelect' +]); + +/** + * Enable browser's text selection behaviors. + * @param {HTMLElement} [el] - target element. if not supplied, use `document` + * @memberof module:domUtil + */ +function enableTextSelection(el) { + if (!el) { + el = document; + } + + if (SUPPORT_SELECTSTART) { + off(el, 'selectstart', preventDefault); + } else { + el = (el === document) ? document.documentElement : el; + el.style[userSelectProperty] = getData(el, KEY_PREVIOUS_USER_SELECT) || 'auto'; + removeData(el, KEY_PREVIOUS_USER_SELECT); + } +} + +module.exports = enableTextSelection; + + +/***/ }), +/* 53 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check element has specific css class + * @author NHN FE Development Lab + */ + + + +var inArray = __webpack_require__(4); +var getClass = __webpack_require__(10); + +/** + * Check element has specific css class + * @param {(HTMLElement|SVGElement)} element - target element + * @param {string} cssClass - css class + * @returns {boolean} + * @memberof module:domUtil + */ +function hasClass(element, cssClass) { + var origin; + + if (element.classList) { + return element.classList.contains(cssClass); + } + + origin = getClass(element).split(/\s+/); + + return inArray(cssClass, origin) > -1; +} + +module.exports = hasClass; + + +/***/ }), +/* 54 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Remove css class from element + * @author NHN FE Development Lab + */ + + + +var forEachArray = __webpack_require__(3); +var inArray = __webpack_require__(4); +var getClass = __webpack_require__(10); +var setClassName = __webpack_require__(18); + +/** + * Remove css class from element + * @param {(HTMLElement|SVGElement)} element - target element + * @param {...string} cssClass - css classes to remove + * @memberof module:domUtil + */ +function removeClass(element) { + var cssClass = Array.prototype.slice.call(arguments, 1); + var classList = element.classList; + var origin, newClass; + + if (classList) { + forEachArray(cssClass, function(name) { + classList.remove(name); + }); + + return; + } + + origin = getClass(element).split(/\s+/); + newClass = []; + forEachArray(origin, function(name) { + if (inArray(name, cssClass) < 0) { + newClass.push(name); + } + }); + + setClassName(element, newClass); +} + +module.exports = removeClass; + + +/***/ }), +/* 55 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Remove element from parent node. + * @author NHN FE Development Lab + */ + + + +/** + * Remove element from parent node. + * @param {HTMLElement} element - element to remove. + * @memberof module:domUtil + */ +function removeElement(element) { + if (element && element.parentNode) { + element.parentNode.removeChild(element); + } +} + +module.exports = removeElement; + + +/***/ }), +/* 56 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Convert text by binding expressions with context. + * @author NHN FE Development Lab + */ + + + +var inArray = __webpack_require__(4); +var forEach = __webpack_require__(1); +var isArray = __webpack_require__(0); +var isString = __webpack_require__(8); +var extend = __webpack_require__(6); + +// IE8 does not support capture groups. +var EXPRESSION_REGEXP = /{{\s?|\s?}}/g; +var BRACKET_NOTATION_REGEXP = /^[a-zA-Z0-9_@]+\[[a-zA-Z0-9_@"']+\]$/; +var BRACKET_REGEXP = /\[\s?|\s?\]/; +var DOT_NOTATION_REGEXP = /^[a-zA-Z_]+\.[a-zA-Z_]+$/; +var DOT_REGEXP = /\./; +var STRING_NOTATION_REGEXP = /^["']\w+["']$/; +var STRING_REGEXP = /"|'/g; +var NUMBER_REGEXP = /^-?\d+\.?\d*$/; + +var EXPRESSION_INTERVAL = 2; + +var BLOCK_HELPERS = { + 'if': handleIf, + 'each': handleEach, + 'with': handleWith +}; + +var isValidSplit = 'a'.split(/a/).length === 3; + +/** + * Split by RegExp. (Polyfill for IE8) + * @param {string} text - text to be splitted\ + * @param {RegExp} regexp - regular expression + * @returns {Array.} + */ +var splitByRegExp = (function() { + if (isValidSplit) { + return function(text, regexp) { + return text.split(regexp); + }; + } + + return function(text, regexp) { + var result = []; + var prevIndex = 0; + var match, index; + + if (!regexp.global) { + regexp = new RegExp(regexp, 'g'); + } + + match = regexp.exec(text); + while (match !== null) { + index = match.index; + result.push(text.slice(prevIndex, index)); + + prevIndex = index + match[0].length; + match = regexp.exec(text); + } + result.push(text.slice(prevIndex)); + + return result; + }; +})(); + +/** + * Find value in the context by an expression. + * @param {string} exp - an expression + * @param {object} context - context + * @returns {*} + * @private + */ +// eslint-disable-next-line complexity +function getValueFromContext(exp, context) { + var splitedExps; + var value = context[exp]; + + if (exp === 'true') { + value = true; + } else if (exp === 'false') { + value = false; + } else if (STRING_NOTATION_REGEXP.test(exp)) { + value = exp.replace(STRING_REGEXP, ''); + } else if (BRACKET_NOTATION_REGEXP.test(exp)) { + splitedExps = exp.split(BRACKET_REGEXP); + value = getValueFromContext(splitedExps[0], context)[getValueFromContext(splitedExps[1], context)]; + } else if (DOT_NOTATION_REGEXP.test(exp)) { + splitedExps = exp.split(DOT_REGEXP); + value = getValueFromContext(splitedExps[0], context)[splitedExps[1]]; + } else if (NUMBER_REGEXP.test(exp)) { + value = parseFloat(exp); + } + + return value; +} + +/** + * Extract elseif and else expressions. + * @param {Array.} ifExps - args of if expression + * @param {Array.} sourcesInsideBlock - sources inside if block + * @returns {object} - exps: expressions of if, elseif, and else / sourcesInsideIf: sources inside if, elseif, and else block. + * @private + */ +function extractElseif(ifExps, sourcesInsideBlock) { + var exps = [ifExps]; + var sourcesInsideIf = []; + var otherIfCount = 0; + var start = 0; + + // eslint-disable-next-line complexity + forEach(sourcesInsideBlock, function(source, index) { + if (source.indexOf('if') === 0) { + otherIfCount += 1; + } else if (source === '/if') { + otherIfCount -= 1; + } else if (!otherIfCount && (source.indexOf('elseif') === 0 || source === 'else')) { + exps.push(source === 'else' ? ['true'] : source.split(' ').slice(1)); + sourcesInsideIf.push(sourcesInsideBlock.slice(start, index)); + start = index + 1; + } + }); + + sourcesInsideIf.push(sourcesInsideBlock.slice(start)); + + return { + exps: exps, + sourcesInsideIf: sourcesInsideIf + }; +} + +/** + * Helper function for "if". + * @param {Array.} exps - array of expressions split by spaces + * @param {Array.} sourcesInsideBlock - array of sources inside the if block + * @param {object} context - context + * @returns {string} + * @private + */ +function handleIf(exps, sourcesInsideBlock, context) { + var analyzed = extractElseif(exps, sourcesInsideBlock); + var result = false; + var compiledSource = ''; + + forEach(analyzed.exps, function(exp, index) { + result = handleExpression(exp, context); + if (result) { + compiledSource = compile(analyzed.sourcesInsideIf[index], context); + } + + return !result; + }); + + return compiledSource; +} + +/** + * Helper function for "each". + * @param {Array.} exps - array of expressions split by spaces + * @param {Array.} sourcesInsideBlock - array of sources inside the each block + * @param {object} context - context + * @returns {string} + * @private + */ +function handleEach(exps, sourcesInsideBlock, context) { + var collection = handleExpression(exps, context); + var additionalKey = isArray(collection) ? '@index' : '@key'; + var additionalContext = {}; + var result = ''; + + forEach(collection, function(item, key) { + additionalContext[additionalKey] = key; + additionalContext['@this'] = item; + extend(context, additionalContext); + + result += compile(sourcesInsideBlock.slice(), context); + }); + + return result; +} + +/** + * Helper function for "with ... as" + * @param {Array.} exps - array of expressions split by spaces + * @param {Array.} sourcesInsideBlock - array of sources inside the with block + * @param {object} context - context + * @returns {string} + * @private + */ +function handleWith(exps, sourcesInsideBlock, context) { + var asIndex = inArray('as', exps); + var alias = exps[asIndex + 1]; + var result = handleExpression(exps.slice(0, asIndex), context); + + var additionalContext = {}; + additionalContext[alias] = result; + + return compile(sourcesInsideBlock, extend(context, additionalContext)) || ''; +} + +/** + * Extract sources inside block in place. + * @param {Array.} sources - array of sources + * @param {number} start - index of start block + * @param {number} end - index of end block + * @returns {Array.} + * @private + */ +function extractSourcesInsideBlock(sources, start, end) { + var sourcesInsideBlock = sources.splice(start + 1, end - start); + sourcesInsideBlock.pop(); + + return sourcesInsideBlock; +} + +/** + * Handle block helper function + * @param {string} helperKeyword - helper keyword (ex. if, each, with) + * @param {Array.} sourcesToEnd - array of sources after the starting block + * @param {object} context - context + * @returns {Array.} + * @private + */ +function handleBlockHelper(helperKeyword, sourcesToEnd, context) { + var executeBlockHelper = BLOCK_HELPERS[helperKeyword]; + var helperCount = 1; + var startBlockIndex = 0; + var endBlockIndex; + var index = startBlockIndex + EXPRESSION_INTERVAL; + var expression = sourcesToEnd[index]; + + while (helperCount && isString(expression)) { + if (expression.indexOf(helperKeyword) === 0) { + helperCount += 1; + } else if (expression.indexOf('/' + helperKeyword) === 0) { + helperCount -= 1; + endBlockIndex = index; + } + + index += EXPRESSION_INTERVAL; + expression = sourcesToEnd[index]; + } + + if (helperCount) { + throw Error(helperKeyword + ' needs {{/' + helperKeyword + '}} expression.'); + } + + sourcesToEnd[startBlockIndex] = executeBlockHelper( + sourcesToEnd[startBlockIndex].split(' ').slice(1), + extractSourcesInsideBlock(sourcesToEnd, startBlockIndex, endBlockIndex), + context + ); + + return sourcesToEnd; +} + +/** + * Helper function for "custom helper". + * If helper is not a function, return helper itself. + * @param {Array.} exps - array of expressions split by spaces (first element: helper) + * @param {object} context - context + * @returns {string} + * @private + */ +function handleExpression(exps, context) { + var result = getValueFromContext(exps[0], context); + + if (result instanceof Function) { + return executeFunction(result, exps.slice(1), context); + } + + return result; +} + +/** + * Execute a helper function. + * @param {Function} helper - helper function + * @param {Array.} argExps - expressions of arguments + * @param {object} context - context + * @returns {string} - result of executing the function with arguments + * @private + */ +function executeFunction(helper, argExps, context) { + var args = []; + forEach(argExps, function(exp) { + args.push(getValueFromContext(exp, context)); + }); + + return helper.apply(null, args); +} + +/** + * Get a result of compiling an expression with the context. + * @param {Array.} sources - array of sources split by regexp of expression. + * @param {object} context - context + * @returns {Array.} - array of sources that bind with its context + * @private + */ +function compile(sources, context) { + var index = 1; + var expression = sources[index]; + var exps, firstExp, result; + + while (isString(expression)) { + exps = expression.split(' '); + firstExp = exps[0]; + + if (BLOCK_HELPERS[firstExp]) { + result = handleBlockHelper(firstExp, sources.splice(index, sources.length - index), context); + sources = sources.concat(result); + } else { + sources[index] = handleExpression(exps, context); + } + + index += EXPRESSION_INTERVAL; + expression = sources[index]; + } + + return sources.join(''); +} + +/** + * Convert text by binding expressions with context. + *
+ * If expression exists in the context, it will be replaced. + * ex) '{{title}}' with context {title: 'Hello!'} is converted to 'Hello!'. + * An array or object can be accessed using bracket and dot notation. + * ex) '{{odds\[2\]}}' with context {odds: \[1, 3, 5\]} is converted to '5'. + * ex) '{{evens\[first\]}}' with context {evens: \[2, 4\], first: 0} is converted to '2'. + * ex) '{{project\["name"\]}}' and '{{project.name}}' with context {project: {name: 'CodeSnippet'}} is converted to 'CodeSnippet'. + *
+ * If replaced expression is a function, next expressions will be arguments of the function. + * ex) '{{add 1 2}}' with context {add: function(a, b) {return a + b;}} is converted to '3'. + *
+ * It has 3 predefined block helpers '{{helper ...}} ... {{/helper}}': 'if', 'each', 'with ... as ...'. + * 1) 'if' evaluates conditional statements. It can use with 'elseif' and 'else'. + * 2) 'each' iterates an array or object. It provides '@index'(array), '@key'(object), and '@this'(current element). + * 3) 'with ... as ...' provides an alias. + * @param {string} text - text with expressions + * @param {object} context - context + * @returns {string} - text that bind with its context + * @memberof module:domUtil + * @example + * var template = require('tui-code-snippet/domUtil/template'); + * + * var source = + * '

' + * + '{{if isValidNumber title}}' + * + '{{title}}th' + * + '{{elseif isValidDate title}}' + * + 'Date: {{title}}' + * + '{{/if}}' + * + '

' + * + '{{each list}}' + * + '{{with addOne @index as idx}}' + * + '

{{idx}}: {{@this}}

' + * + '{{/with}}' + * + '{{/each}}'; + * + * var context = { + * isValidDate: function(text) { + * return /^\d{4}-(0|1)\d-(0|1|2|3)\d$/.test(text); + * }, + * isValidNumber: function(text) { + * return /^\d+$/.test(text); + * } + * title: '2019-11-25', + * list: ['Clean the room', 'Wash the dishes'], + * addOne: function(num) { + * return num + 1; + * } + * }; + * + * var result = template(source, context); + * console.log(result); //

Date: 2019-11-25

1: Clean the room

2: Wash the dishes

+ */ +function template(text, context) { + return compile(splitByRegExp(text, EXPRESSION_REGEXP), context); +} + +module.exports = template; + + +/***/ }), +/* 57 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Toggle css class + * @author NHN FE Development Lab + */ + + + +var forEach = __webpack_require__(1); +var inArray = __webpack_require__(4); +var getClass = __webpack_require__(10); +var setClassName = __webpack_require__(18); + +/** + * Toggle css class + * @param {(HTMLElement|SVGElement)} element - target element + * @param {...string} cssClass - css classes to toggle + * @memberof module:domUtil + */ +function toggleClass(element) { + var cssClass = Array.prototype.slice.call(arguments, 1); + var newClass; + + if (element.classList) { + forEach(cssClass, function(name) { + element.classList.toggle(name); + }); + + return; + } + + newClass = getClass(element).split(/\s+/); + + forEach(cssClass, function(name) { + var idx = inArray(name, newClass); + + if (idx > -1) { + newClass.splice(idx, 1); + } else { + newClass.push(name); + } + }); + + setClassName(element, newClass); +} + +module.exports = toggleClass; + + +/***/ }), +/* 58 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview This module provides a Enum Constructor. + * @author NHN FE Development Lab + * @example + * // node, commonjs + * var Enum = require('tui-code-snippet/enum/enum'); + */ + + + +var isNumber = __webpack_require__(30); +var isArray = __webpack_require__(0); +var toArray = __webpack_require__(14); +var forEach = __webpack_require__(1); + +/** + * Check whether the defineProperty() method is supported. + * @type {boolean} + * @ignore + */ +var isSupportDefinedProperty = (function() { + try { + Object.defineProperty({}, 'x', {}); + + return true; + } catch (e) { + return false; + } +})(); + +/** + * A unique value of a constant. + * @type {number} + * @ignore + */ +var enumValue = 0; + +/** + * Make a constant-list that has unique values. + * In modern browsers (except IE8 and lower), + * a value defined once can not be changed. + * + * @param {...string|string[]} itemList Constant-list (An array of string is available) + * @class + * + * @example + * var Enum = require('tui-code-snippet/enum/enum'); // node, commonjs + * + * var MYENUM = new Enum('TYPE1', 'TYPE2'); + * var MYENUM2 = new Enum(['TYPE1', 'TYPE2']); + * + * //usage + * if (value === MYENUM.TYPE1) { + * .... + * } + * + * //add (If a duplicate name is inputted, will be disregarded.) + * MYENUM.set('TYPE3', 'TYPE4'); + * + * //get name of a constant by a value + * MYENUM.getName(MYENUM.TYPE1); // 'TYPE1' + * + * // In modern browsers (except IE8 and lower), a value can not be changed in constants. + * var originalValue = MYENUM.TYPE1; + * MYENUM.TYPE1 = 1234; // maybe TypeError + * MYENUM.TYPE1 === originalValue; // true + **/ +function Enum(itemList) { + if (itemList) { + this.set.apply(this, arguments); + } +} + +/** + * Define a constants-list + * @param {...string|string[]} itemList Constant-list (An array of string is available) + */ +Enum.prototype.set = function(itemList) { + var self = this; + + if (!isArray(itemList)) { + itemList = toArray(arguments); + } + + forEach(itemList, function itemListIteratee(item) { + self._addItem(item); + }); +}; + +/** + * Return a key of the constant. + * @param {number} value A value of the constant. + * @returns {string|undefined} Key of the constant. + */ +Enum.prototype.getName = function(value) { + var self = this; + var foundedKey; + + forEach(this, function(itemValue, key) { // eslint-disable-line consistent-return + if (self._isEnumItem(key) && value === itemValue) { + foundedKey = key; + + return false; + } + }); + + return foundedKey; +}; + +/** + * Create a constant. + * @private + * @param {string} name Constant name. (It will be a key of a constant) + */ +Enum.prototype._addItem = function(name) { + var value; + + if (!this.hasOwnProperty(name)) { + value = this._makeEnumValue(); + + if (isSupportDefinedProperty) { + Object.defineProperty(this, name, { + enumerable: true, + configurable: false, + writable: false, + value: value + }); + } else { + this[name] = value; + } + } +}; + +/** + * Return a unique value for assigning to a constant. + * @private + * @returns {number} A unique value + */ +Enum.prototype._makeEnumValue = function() { + var value; + + value = enumValue; + enumValue += 1; + + return value; +}; + +/** + * Return whether a constant from the given key is in instance or not. + * @param {string} key - A constant key + * @returns {boolean} Result + * @private + */ +Enum.prototype._isEnumItem = function(key) { + return isNumber(this[key]); +}; + +module.exports = Enum; + + +/***/ }), +/* 59 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview This module has a function for date format. + * @author NHN FE Development Lab + */ + + + +var pick = __webpack_require__(31); +var isDate = __webpack_require__(32); + +var tokens = /[\\]*YYYY|[\\]*YY|[\\]*MMMM|[\\]*MMM|[\\]*MM|[\\]*M|[\\]*DD|[\\]*D|[\\]*HH|[\\]*H|[\\]*A/gi; +var MONTH_STR = [ + 'Invalid month', 'January', 'February', 'March', 'April', 'May', + 'June', 'July', 'August', 'September', 'October', 'November', 'December' +]; +var MONTH_DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; +var replaceMap = { + M: function(date) { + return Number(date.month); + }, + MM: function(date) { + var month = date.month; + + return (Number(month) < 10) ? '0' + month : month; + }, + MMM: function(date) { + return MONTH_STR[Number(date.month)].substr(0, 3); + }, + MMMM: function(date) { + return MONTH_STR[Number(date.month)]; + }, + D: function(date) { + return Number(date.date); + }, + d: function(date) { + return replaceMap.D(date); // eslint-disable-line new-cap + }, + DD: function(date) { + var dayInMonth = date.date; + + return (Number(dayInMonth) < 10) ? '0' + dayInMonth : dayInMonth; + }, + dd: function(date) { + return replaceMap.DD(date); // eslint-disable-line new-cap + }, + YY: function(date) { + return Number(date.year) % 100; + }, + yy: function(date) { + return replaceMap.YY(date); // eslint-disable-line new-cap + }, + YYYY: function(date) { + var prefix = '20', + year = date.year; + if (year > 69 && year < 100) { + prefix = '19'; + } + + return (Number(year) < 100) ? prefix + String(year) : year; + }, + yyyy: function(date) { + return replaceMap.YYYY(date); // eslint-disable-line new-cap + }, + A: function(date) { + return date.meridiem; + }, + a: function(date) { + return date.meridiem; + }, + hh: function(date) { + var hour = date.hour; + + return (Number(hour) < 10) ? '0' + hour : hour; + }, + HH: function(date) { + return replaceMap.hh(date); + }, + h: function(date) { + return String(Number(date.hour)); + }, + H: function(date) { + return replaceMap.h(date); + }, + m: function(date) { + return String(Number(date.minute)); + }, + mm: function(date) { + var minute = date.minute; + + return (Number(minute) < 10) ? '0' + minute : minute; + } +}; + +/** + * Check whether the given variables are valid date or not. + * @param {number} year - Year + * @param {number} month - Month + * @param {number} date - Day in month. + * @returns {boolean} Is valid? + * @private + */ +function isValidDate(year, month, date) { // eslint-disable-line complexity + var isValidYear, isValidMonth, isValid, lastDayInMonth; + + year = Number(year); + month = Number(month); + date = Number(date); + + isValidYear = (year > -1 && year < 100) || ((year > 1969) && (year < 2070)); + isValidMonth = (month > 0) && (month < 13); + + if (!isValidYear || !isValidMonth) { + return false; + } + + lastDayInMonth = MONTH_DAYS[month]; + if (month === 2 && year % 4 === 0) { + if (year % 100 !== 0 || year % 400 === 0) { + lastDayInMonth = 29; + } + } + + isValid = (date > 0) && (date <= lastDayInMonth); + + return isValid; +} + +/** + * @module formatDate + */ + +/** + * Return a string that transformed from the given form and date. + * @param {string} form - Date form + * @param {Date|Object} date - Date object + * @param {{meridiemSet: {AM: string, PM: string}}} option - Option + * @returns {boolean|string} A transformed string or false. + * @memberof module:formatDate + * @example + * // key | Shorthand + * // --------------- |----------------------- + * // years | YY / YYYY / yy / yyyy + * // months(n) | M / MM + * // months(str) | MMM / MMMM + * // days | D / DD / d / dd + * // hours | H / HH / h / hh + * // minutes | m / mm + * // meridiem(AM,PM) | A / a + * + * var formatDate = require('tui-code-snippet/formatDate/formatDate'); // node, commonjs + * + * var dateStr1 = formatDate('yyyy-MM-dd', { + * year: 2014, + * month: 12, + * date: 12 + * }); + * alert(dateStr1); // '2014-12-12' + * + * var dateStr2 = formatDate('MMM DD YYYY HH:mm', { + * year: 1999, + * month: 9, + * date: 9, + * hour: 0, + * minute: 2 + * }); + * alert(dateStr2); // 'Sep 09 1999 00:02' + * + * var dt = new Date(2010, 2, 13), + * dateStr3 = formatDate('yyyy년 M월 dd일', dt); + * alert(dateStr3); // '2010년 3월 13일' + * + * var option4 = { + * meridiemSet: { + * AM: '오전', + * PM: '오후' + * } + * }; + * var date4 = {year: 1999, month: 9, date: 9, hour: 13, minute: 2}; + * var dateStr4 = formatDate('yyyy-MM-dd A hh:mm', date4, option4)); + * alert(dateStr4); // '1999-09-09 오후 01:02' + */ +function formatDate(form, date, option) { // eslint-disable-line complexity + var am = pick(option, 'meridiemSet', 'AM') || 'AM'; + var pm = pick(option, 'meridiemSet', 'PM') || 'PM'; + var meridiem, nDate, resultStr; + + if (isDate(date)) { + nDate = { + year: date.getFullYear(), + month: date.getMonth() + 1, + date: date.getDate(), + hour: date.getHours(), + minute: date.getMinutes() + }; + } else { + nDate = { + year: date.year, + month: date.month, + date: date.date, + hour: date.hour, + minute: date.minute + }; + } + + if (!isValidDate(nDate.year, nDate.month, nDate.date)) { + return false; + } + + nDate.meridiem = ''; + if (/([^\\]|^)[aA]\b/.test(form)) { + meridiem = (nDate.hour > 11) ? pm : am; + if (nDate.hour > 12) { // See the clock system: https://en.wikipedia.org/wiki/12-hour_clock + nDate.hour %= 12; + } + if (nDate.hour === 0) { + nDate.hour = 12; + } + nDate.meridiem = meridiem; + } + + resultStr = form.replace(tokens, function(key) { + if (key.indexOf('\\') > -1) { // escape character + return key.replace(/\\/, ''); + } + + return replaceMap[key](nDate) || ''; + }); + + return resultStr; +} + +module.exports = formatDate; + + +/***/ }), +/* 60 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Send hostname on DOMContentLoaded. + * @author NHN FE Development Lab + */ + + + +var isUndefined = __webpack_require__(2); +var imagePing = __webpack_require__(33); + +var ms7days = 7 * 24 * 60 * 60 * 1000; + +/** + * Check if the date has passed 7 days + * @param {number} date - milliseconds + * @returns {boolean} + * @private + */ +function isExpired(date) { + var now = new Date().getTime(); + + return now - date > ms7days; +} + +/** + * Send hostname on DOMContentLoaded. + * To prevent hostname set tui.usageStatistics to false. + * @param {string} appName - application name + * @param {string} trackingId - GA tracking ID + * @ignore + */ +function sendHostname(appName, trackingId) { + var url = 'https://www.google-analytics.com/collect'; + var hostname = location.hostname; + var hitType = 'event'; + var eventCategory = 'use'; + var applicationKeyForStorage = 'TOAST UI ' + appName + ' for ' + hostname + ': Statistics'; + var date = window.localStorage.getItem(applicationKeyForStorage); + + // skip if the flag is defined and is set to false explicitly + if (!isUndefined(window.tui) && window.tui.usageStatistics === false) { + return; + } + + // skip if not pass seven days old + if (date && !isExpired(date)) { + return; + } + + window.localStorage.setItem(applicationKeyForStorage, new Date().getTime()); + + setTimeout(function() { + if (document.readyState === 'interactive' || document.readyState === 'complete') { + imagePing(url, { + v: 1, + t: hitType, + tid: trackingId, + cid: hostname, + dp: hostname, + dh: appName, + el: appName, + ec: eventCategory + }); + } + }, 1000); +} + +module.exports = sendHostname; + + +/***/ }), +/* 61 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Transform the given HTML Entity string into plain string. + * @author NHN FE Development Lab + */ + + + +/** + * @module string + */ + +/** + * Transform the given HTML Entity string into plain string. + * @param {String} htmlEntity - HTML Entity type string + * @returns {String} Plain string + * @memberof module:string + * @example + * var decodeHTMLEntity = require('tui-code-snippet/string/decodeHTMLEntity'); // node, commonjs + * + * var htmlEntityString = "A 'quote' is <b>bold</b>" + * var result = decodeHTMLEntity(htmlEntityString); //"A 'quote' is bold" + */ +function decodeHTMLEntity(htmlEntity) { + var entities = { + '"': '"', + '&': '&', + '<': '<', + '>': '>', + ''': '\'', + ' ': ' ' + }; + + return htmlEntity.replace(/&|<|>|"|'| /g, function(m0) { + return entities[m0] ? entities[m0] : m0; + }); +} + +module.exports = decodeHTMLEntity; + + +/***/ }), +/* 62 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Transform the given string into HTML Entity string. + * @author NHN FE Development Lab + */ + + + +/** + * Transform the given string into HTML Entity string. + * @param {String} html - String for encoding + * @returns {String} HTML Entity + * @memberof module:string + * @example + * var encodeHTMLEntity = require('tui-code-snippet/string/encodeHTMLEntity'); // node, commonjs + * + * var htmlEntityString = ""; + * var result = encodeHTMLEntity(htmlEntityString); + */ +function encodeHTMLEntity(html) { + var entities = { + '"': 'quot', + '&': 'amp', + '<': 'lt', + '>': 'gt', + '\'': '#39' + }; + + return html.replace(/[<>&"']/g, function(m0) { + return entities[m0] ? '&' + entities[m0] + ';' : m0; + }); +} + +module.exports = encodeHTMLEntity; + + +/***/ }), +/* 63 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Creates a throttled function that only invokes fn at most once per every interval milliseconds. + * @author NHN FE Development Lab + */ + + + +var debounce = __webpack_require__(34); + +/** + * Creates a throttled function that only invokes fn at most once per every interval milliseconds. + * You can use this throttle short time repeatedly invoking functions. (e.g MouseMove, Resize ...) + * if you need reuse throttled method. you must remove slugs (e.g. flag variable) related with throttling. + * @param {function} fn function to throttle + * @param {number} [interval=0] the number of milliseconds to throttle invocations to. + * @returns {function} throttled function + * @memberof module:tricks + * @example + * var throttle = require('tui-code-snippet/tricks/throttle'); // node, commonjs + * + * function someMethodToInvokeThrottled() {} + * + * var throttled = throttle(someMethodToInvokeThrottled, 300); + * + * // invoke repeatedly + * throttled(); // invoke (leading) + * throttled(); + * throttled(); // invoke (near 300 milliseconds) + * throttled(); + * throttled(); + * throttled(); // invoke (near 600 milliseconds) + * // ... + * // invoke (trailing) + * + * // if you need reuse throttled method. then invoke reset() + * throttled.reset(); + */ +function throttle(fn, interval) { + var base; + var isLeading = true; + var tick = function(_args) { + fn.apply(null, _args); + base = null; + }; + var debounced, stamp, args; + + /* istanbul ignore next */ + interval = interval || 0; + + debounced = debounce(tick, interval); + + function throttled() { // eslint-disable-line require-jsdoc + args = Array.prototype.slice.call(arguments); + + if (isLeading) { + tick(args); + isLeading = false; + + return; + } + + stamp = Number(new Date()); + + base = base || stamp; + + // pass array directly because `debounce()`, `tick()` are already use + // `apply()` method to invoke developer's `fn` handler. + // + // also, this `debounced` line invoked every time for implements + // `trailing` features. + debounced(args); + + if ((stamp - base) >= interval) { + tick(args); + } + } + + function reset() { // eslint-disable-line require-jsdoc + isLeading = true; + base = null; + } + + throttled.reset = reset; + + return throttled; +} + +module.exports = throttle; + + +/***/ }), +/* 64 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is an instance of Array or not. (for multiple frame environments) + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is an instance of Array or not. + * If the given variable is an instance of Array, return true. + * (It is used for multiple frame environments) + * @param {*} obj - Target for checking + * @returns {boolean} Is an instance of array? + * @memberof module:type + */ +function isArraySafe(obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; +} + +module.exports = isArraySafe; + + +/***/ }), +/* 65 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is a string or not. + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is a boolean or not. + * If the given variable is a boolean, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is boolean? + * @memberof module:type + */ +function isBoolean(obj) { + return typeof obj === 'boolean' || obj instanceof Boolean; +} + +module.exports = isBoolean; + + +/***/ }), +/* 66 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is a boolean or not. (for multiple frame environments) + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is a boolean or not. + * If the given variable is a boolean, return true. + * (It is used for multiple frame environments) + * @param {*} obj - Target for checking + * @returns {boolean} Is a boolean? + * @memberof module:type + */ +function isBooleanSafe(obj) { + return Object.prototype.toString.call(obj) === '[object Boolean]'; +} + +module.exports = isBooleanSafe; + + +/***/ }), +/* 67 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is an instance of Date or not. (for multiple frame environments) + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is an instance of Date or not. + * If the given variables is an instance of Date, return true. + * (It is used for multiple frame environments) + * @param {*} obj - Target for checking + * @returns {boolean} Is an instance of Date? + * @memberof module:type + */ +function isDateSafe(obj) { + return Object.prototype.toString.call(obj) === '[object Date]'; +} + +module.exports = isDateSafe; + + +/***/ }), +/* 68 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is falsy or not. + * @author NHN FE Development Lab + */ + + + +var isTruthy = __webpack_require__(35); + +/** + * Check whether the given variable is falsy or not. + * If the given variable is null or undefined or false, returns true. + * @param {*} obj - Target for checking + * @returns {boolean} Is falsy? + * @memberof module:type + */ +function isFalsy(obj) { + return !isTruthy(obj); +} + +module.exports = isFalsy; + + +/***/ }), +/* 69 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is a function or not. (for multiple frame environments) + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is a function or not. + * If the given variable is a function, return true. + * (It is used for multiple frame environments) + * @param {*} obj - Target for checking + * @returns {boolean} Is a function? + * @memberof module:type + */ +function isFunctionSafe(obj) { + return Object.prototype.toString.call(obj) === '[object Function]'; +} + +module.exports = isFunctionSafe; + + +/***/ }), +/* 70 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is a instance of HTMLNode or not. + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is a instance of HTMLNode or not. + * If the given variables is a instance of HTMLNode, return true. + * @param {*} html - Target for checking + * @returns {boolean} Is HTMLNode ? + * @memberof module:type + */ +function isHTMLNode(html) { + if (typeof HTMLElement === 'object') { + return (html && (html instanceof HTMLElement || !!html.nodeType)); + } + + return !!(html && html.nodeType); +} + +module.exports = isHTMLNode; + + +/***/ }), +/* 71 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is a HTML tag or not. + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is a HTML tag or not. + * If the given variables is a HTML tag, return true. + * @param {*} html - Target for checking + * @returns {boolean} Is HTML tag? + * @memberof module:type + */ +function isHTMLTag(html) { + if (typeof HTMLElement === 'object') { + return (html && (html instanceof HTMLElement)); + } + + return !!(html && html.nodeType && html.nodeType === 1); +} + +module.exports = isHTMLTag; + + +/***/ }), +/* 72 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is not empty(not null, not undefined, or not empty array, not empty object) or not. + * @author NHN FE Development Lab + */ + + + +var isEmpty = __webpack_require__(13); + +/** + * Check whether the given variable is not empty + * (not null, not undefined, or not empty array, not empty object) or not. + * If the given variables is not empty, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is not empty? + * @memberof module:type + */ +function isNotEmpty(obj) { + return !isEmpty(obj); +} + +module.exports = isNotEmpty; + + +/***/ }), +/* 73 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is a number or not. (for multiple frame environments) + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is a number or not. + * If the given variable is a number, return true. + * (It is used for multiple frame environments) + * @param {*} obj - Target for checking + * @returns {boolean} Is a number? + * @memberof module:type + */ +function isNumberSafe(obj) { + return Object.prototype.toString.call(obj) === '[object Number]'; +} + +module.exports = isNumberSafe; + + +/***/ }), +/* 74 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @fileoverview Check whether the given variable is a string or not. (for multiple frame environments) + * @author NHN FE Development Lab + */ + + + +/** + * Check whether the given variable is a string or not. + * If the given variable is a string, return true. + * (It is used for multiple frame environments) + * @param {*} obj - Target for checking + * @returns {boolean} Is a string? + * @memberof module:type + */ +function isStringSafe(obj) { + return Object.prototype.toString.call(obj) === '[object String]'; +} + +module.exports = isStringSafe; + + +/***/ }) +/******/ ]); +}); \ No newline at end of file diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-2x.png b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-2x.png new file mode 100644 index 0000000000000000000000000000000000000000..557607b4cbb6d5849dbb0054ef3d1feeff8b3aeb GIT binary patch literal 24489 zcmd?RWmFqc`!5Oj0s8Pld=IS%lA=aHUtnET zrNm&WCWwz=U_Qghh>NOw!Jc;@rISc`U-(bhXHE;xST{21)HUi1c=e>82cOv?a;DI>8|9N`+IhjkK^g#=2qRE*{S38RQT>*Ph&kv)|mWNHH~+kGb3Fyo@!H0dl?*72M_o6v6lv)f`a?ar&KQkQ)#|Tm}CO*zq6kv!XU+eW`SeH+evU3 zWFgh{VEjH!am15fRAi1Gt>ayLjQ@y9sJP&au5duuS8gV33mbabiGX>b#@cWR7*Uvu zrHT{#Fv!Q*@XT~A%UJ8~;h_lXr83}z{ z+tAC5imuz;V55-ts{4O)_bq+9dp|xDK=2HlPJ6SzIT&xlR5Dk)v2X-MACYmqzP<|W z@9*c(yIS^zV>!gc#NZPCPpYe{ubsFhHf#6h%p}Q%fc=TM?Rlf_ z@A(>$Ua|N0i{8yj2f~Mv!sgys^lp_I1i#{)Z3c%m;LMUMvFOz8IXL57aTvWfqs8FC zWwk8CGIYB?TSjPXY;@JE)J|BcG1plmhZ_mtGJX_~>aCCV$F(e=>l=_Jr-VCdc9aZT zAm6zx>LjEh5Q&p^qc+`ojsC>Qm__l+81a60`%axYmR)k3UNARd-w4l4$WD`bOTGO#2P^tkzlj#(O ze=I7{agcN=-R3FnSIvBHsXs_AiW>R#{aD&Q6+qGx+1wymX`S31`)2A3`*I6cc6uQg zFtHjQb^Q>VfkZ9Vb*9Y+pm zNav2~oyv#o+sSaq(=d9YH~B+9-@E0wcqS?)ZH93Klf*%2?>ywgm3FdAVdA&2v$FK} z$GTnM*F3PX#NS7Ynm07wzjo^Ol&Ks9555B6-CFO#2p?;{Eq(ODCS?5nnV`ecByH|c z6$a<}xsMg#h#+GS_15Rlp#%wj(jHV0W|{%it_Ay)3d{In|*I+Yj1446LnV}Qs%Lg#qe@WY4bSGtcp!S<#Al2CtVRcTmHs{?(mbs z0bjEAE$|D^uUT{pb=4n{;<((LoVQ~+0-hMDdt{yo%O64(kuc5_&J4VYyH7cSYC9&0 zGVD%V5-r&W+~vMtv41&r?TDh?n942O0a@5{N!im(zT#8Y1nwbQg}_9uMtBp+>38P=%&5ZowL$&#CY2(-}&w6_1zA zg~}B@$gA44=)TZ^O&7nAjPse{=pnmkf3k_EoKBAxMccZaKt-q#{pu^4swH6-G@hu`~+SLExH;mtHsuEktv5YOF~ zVw#nZNZ~1rTf(&^eo0=bslbxMj z3HlEDDqT3$Ya?tN_4`cnKz+yNY#(f#JKGqeQ zKL`=b?t!d$N@5qfXIiG!zl5=DE+qaKoKGc(ob-2k|NmJ6Z*0m`(4d zCbIc%0E!2A=U?B#|C}yKnFR>kt1R_vSB7n`wz;1!Y?4Ek-aDOP2jUydEd({N5GVf% zA)a1bqp_X&!Gs~1}CWCF=4n{%*dN;^Lvl-1N`<9}5Hf z<{O>)m(XKnL045j)N2vSn5|IWn5?@4X1%5t%~%T%7-2>vjA-AGSU9zTEyPL_&5T>q zEg=h!=aiA(t$Bo|y7TFTIyocw1t*K!L3S@VTzE}7ZwV35wRo}p@bp*gC%u$MAGslm zfO&OK$hio`3o1A&D0F7;q19{$t-hp*~uEk!D93uY_$Iann z02fl>`;LM9i^t8W!<-|f&EPLAvHj0(KBbr;sYmUEfMgSEXC^m7*qn0X?!L=3Q?i#ykx4N8 z70=T;kKC46+5Isyw0nLtaZJ4&Hx6SjL$?f6p|jREfm$uB-t0V~Ew5egA2gQsgMO`j zu^({2%FyyfIRU%v4#bQ%wM%1II97Ia_%o1F4}^s6Z}~0h_8gx}0o)v6( zd^yz#cWJ~i(yptaaTj}cx|n-eo@5SLV+9027#w~zxo=0<;X}B6lID8Kn4goFz)MEo zJoPTrn=oze>2y#Bxy|SwzficDWL@FJ^Krby<_=c*!iQaEJqkja0|=USlQ${&TOab( zUbrVDLs9FAe*0#$`PfzQajnJG4atWxjiXg0`EGq8F0ZN*#({1g+t%3V{?S}9X`7=y z!8IXm`&dG_91Z2dwFS@nCIDVDP{|3i83{awVMf}-K zM>X^KIQX9N4LKFi$I9PW-k1AU~o&`Hvi8=O^dJo*@#cmoVP^i{0V3JXxSP z;wx?8dem)Gz7~)r^~ejAr>>gKuLGRy%w}#nB~I&BtIv4!oB#Kg)Q2`f5%)8TzW4~y zB)6eaU&UW6i!u*;wB#H$FO`>q1lt90)a8XQ-QClzIFbT&5AhIZ#Hgbr7a3z@4(rVhMuZf#R_TJm**qxKvR-YGe84hn&=xY_yuYeDiSF3DCVe(GBLO%>57JT?;JQfDld zEsUB`x)O6=?3~>X6A~zY7rm~0-g6GOE;Vagv3hsVIgVda?;XvA-l-SPtd8$~11I>F zs~pSoJ>qn~OKq2bwNdy*(YG0SN>Vo6?N5_)d$V+x5*rZr*g9$LfDyg}dur;1j-wHZ zYBdZOTdKu0`jWszoP>Z@&K#Xh9AirY!#j$y@5!*tn#z7M9r%Sx)A$1PoT?RN|N0eB zBYilUOv)f0zza%UuQ1z2^^a3ZXWj05haotHCdB-jx}ns^W%S)`x;NO{niYNZ3)Vj6 z>yWav@HY)kqK!DaehK+)$_eb^%RaVt>*PX8>Ud08w-t;YV?X4av`i=bkQ+g8n^8Pp zbqym)%)<{nvA0dpD#x*>;&c5Hq;+%HG@Gfut?+HpFv8$wj)&gmfo!8E9 zT4lk|Ukt?{>r~wc(y$@TA4}_R5;tl@dEL7UKYOoKfeV!Gs){~?YF-)(fy$_4&HZ)a z0iVsJ>7h($1Yj8dR>Xs>1g-*_2;_Xuwz*ah)ex%7)^?Z_6>)`)kTsWv17*NOFNzd^ zp2g!``!4!sel7_{W*1DAi6CB_CGnvYz?hHjV3kntE}l$HvKQp}eymEVBp4*8I*c!E zjC@W281Ib~L>cYO>hk1Y9J>Q^gsiT@O*4S5w)l*!)tsn40#&1=ZBmxiRD!z@VExZe zgC}L9pMdI_*_dENqD#|)3afV)R*(g0BFFf?=;cUUM#;~E8O_f61l{S!W-IshU&YX^x8>`M*aV6mCh27(}ZHF(soOwC8%9&Qd>qBB%v z4o2}p@8T5@T*T+Hm%_2A?hn~5DP<2vS#R6uB0XVUOD%_EErziE8rc&@&rg0)Q|uQ% zX*1^SjMmHz6pgRlI1A-#;0wG3xkrDgz>DKT_Gh?kpr}Sk?zN8TyCP~9UHw9pu{(DS z$7|RL33Aaf=o^pK_ypp0tBsb}J#c#mSVFWq){E-Rsdwlgb ziq2>_E{RP}*kr!fy3$Lf82t>%+~jU>8DuTNeH@H%p4jL8OZN2ok^E2kjYFnmt;Doe zNx$?X@q2}B!TZ7Q(P3NKsDzq~2GQJM1m_cC%?Q3kf=wbjzZxmPY`^R<%gF{R0C9f> zW0O|;^2(YRr;g-b08hr|o8tQIHIemJlbH}2$WW_s9+f}kjc>sgwGpyR&v^BN9^J4@ zx>P*yThX7#3hFYt%~TU(;fT#}Cd1};gzaQ)sCO}_Wiins#NBVy{I~6Y{iCl~ePBW# z0Hk#;Z_j`(e$YZ-0NFb{aK(pDiwGfCG32<3OpL@+A4dEPRGex7ocfoWCg8Jkm`j+6 zH_-c_+CLO)dDi4r1(V&zYj1yc<8n2ToWrK7Nr3VfeFB!IUW0)1VO2GqYrAE0V!(it z$O$$3TDXV&BvL5Tb1^2Ht#bKBfp!pjUhXkp8O@97TwZMD$PRZOk}=z&9Iu4`d|@@m z!iAj??lsd_kG<8%4{LL!C{Y~dZI|B? zmnLpLi@nN2*sp&hcB7oP8L$EnuGYi&PBl16E1CC>WV3MImX8&ScG-HR6guk% z(Is&5TYKxCd=+&}nveZ9r9@CKZoD@g&Ti?gZh;FWNJOx=Y#1wvktdk1CVNJA;k)n( zPUPs@$r&QBZK84~NQ>129wC}XboyOB^~6Z=-BUDq2MM9S3D9RalK40T8~q!#=hOH& zyy_)Hz8hA)l;T4*;9Gc8B9~~xc@$7VCxg;B2VRoNtk%AXHMg&d^%6_8Z<3V^T)$!< zscwQ11)F7m>o1k52)141LCUU(Qqun$`0W2f$>GW4(UrN?rzN8BEZX7iSDTpG46<(n z!HfLG6`V&8m67;r=}{F1i$#2gJ12QYMcEL1@Bjup$zV?XnAT{jXP{V+dhxG}-A_=?-m-qDdaNF&NvBlvGB z_vAkFSVAcpnPiw&R&^!s$?-sCRh1*tEfKzyKr#VFP#8CnX=h>m@Q0Cv!OhV7pb6l<)df| zvW3tdE-fzpR2I=%+giQb6&s8r6A_kOgys1|@S5%nCGanZ&47AjX~urTFNFu@W5!?R zIT2%Y!D&KQx)w4`;aNT=w60(Vw5xNOrrZkVBMw#IJAddGQSU_I109J4JkAWz(9oQo zY=AZw9>a+=X=7PD7oYw8{kxQ2kx$lX#|JTRI>wA2-a@WZOeA|baLm3pVcVyM$)sR$ zqmF2W67+M-M(b#PtE;OMCwuFKJbcp?nT~=Fsa5_EQ&MpL0uyyF;lh$nh>w_JP&%8Hz3a z1V0HaDZasDb68)SV{lnnm;WA=Em&;a4VGN2)ZsuyK2nNVw_B__XNXrd9qTKd$1U}r zwDk4$WxQf#cRHRa=7Jz(c=uq%`@$8X{#^y{^qY>c)+y75j#iPyWaJEO2`Y}|IlnPo zqOlWmk)}`#%~xp2wU=`1Phta_2(I&j6)9_2~c3!ESu@xa3VwodY6z>bmRx@ z2V+TGCm=$;$0I3>gN(1%V;>`W$Y{C41|I8Q9P!K$ule0Dqgcr<>kN<+CzWJZI7nhc zCcJsWYp4l8@l<((hC{z=%y(dpAr}wJqaSi^Y8Ekkh?8>-z;lA<*CE&Si%O9tmSa_Y zLRr5qIQ6HCl0VX8 zGO8GN-w>%yr+5PnE=>0rzM)gb^Q1y;wMVGKBk{v%?oiJA5NT_atSbQ)Ki;7^ZEoeM2tF7o9F`<%nDnDw{9fbu<(md~rEG zPBpRyJNlH}njV(is#Dzh!`(2{k?%R5UC+3Agjn6mJkR)DjU}=})p<7CDJ8@7Ccnng zy1MHvs1?8@chk?o*uXaG9)RZ)%e?rSaZ9X6`5ukuT+AIL6R!BB4Xl5}>$no!6>!kK zr2wdJi=1cd`OJ+?h!uqAV}mpPSy^sQ1QgzXtVdYPX@jv_k4mh35q^LCVw zt2doQ;}IJ#gl+cDWQ{CnDU6s8I_+Xhvd-bt@4tqHLfBUC^u z!gOY|7AVkncl)&>aJ9bH&1`rl<=v-CRb=@5hW49IV_bdO)`l&i0F)nOt3Xn?P!&ef zZ}yo0$??>Y-X3{!kC0IG%o{7%-3JTuQz;&Nq!e@o#w@J4NqI9=(wIg!hIX>%D;F#Yz7W zO|z*mv%(JU_d+R#{DV`+NxIzV5hyy%x_2>j$?0wbzsc4tgotdwowYTqUbKLohOJmxp&t5qh z=jH@Z>s5b|O3U9DtSo&0)Dqi!jXFY?CVc-=>do*trv*Z%;j0Q<|p$i}R>4|G%Y_7fZX{ z>k3Ue04elTV5u79S9yk=#yQL}LVn_#72GP<*4CB_b#fj#HyeqOt8^P}KcY^-0jg|R zEqhgp)IB2PGWTQ%!pf^;O103dZ*Nz@uFGZy}wm#<1OLz%_xd}etNP!bKomp z9_{m%55c1|7@-ZKkc7#3d^Yg{$If1}^UoHICDO>fS&^2Apoi{WT$iT(fHUKLf(8ZZ z`(av!;{`uaS*(wE6{Y=(y5;wbD}Sr+_AUZ=`J%}r3HtiX3{HuXVh${?rf?3|m(aP( zhopYAX#&B8WOx7gxxtS>Du$y-CGhpoouB@JL-0q}mc{_pg+Hlxl}?3LHA`3+4@!>h z#C9VTf;3@KNxC&7-wXw+$o$G<3PE1>=)QiaBVv%r+{5)D3OmheBm)fit9hslNfQ|# zC8{{e-H|{07(qv#xJmch}DSr>CcK9_K4u|4jJmQwQFdhto&r z!KiO>tKN8-aao3n$E3xyCk5uzn=$vG42Dbp|;3({JO#OMFge0 z17ggTbX(xXVRJ{vt7&q**9TU8I$HVksWs?cN3|zRsYPEWKqD26KEn-0_(xU~u-@JQ zhU_7GqJsiG6nY3(7jp1}?Cp%MDeNDY$*;s5nh)4TG8{;+%&>c|P?2abM7b4Wlh&-K z5{q)I^!~6JY^ko4^@onC*$(c?POYV>{ht>eXCAx>32xPXa(AKhJNF=}Z{|0SUc zhJWD#swFrwpBrI9agW14smQp2X`rc~U?=;7@lanh779h4-ddU zo=>E+IFsZlOJc_h8Col{_lIhCLZ1>y1U!b6?LDegM|hdh6I`4fiCvWxyt0#-JW?KVb;Y=c; z%~WDuwiFS2UwDdXOz9K7#~o*KSdmxx5GEDvD^OI5rx(BzS3)7nj0|^)jJNW!r7J(5 zA~lx8!Qp3P$_*w87gGhEiCgS1*38~?J_LCBK;Jj{z@4DT9azm=s?jatHyI?>os;ZT z0t*cfN{W>RruRMU{;t+4alI8xLp$-jp~U^gWJz@E)S>V8UU6P!IKsQC0DH zVubsSbZ{-^(SGYFTI|RGZ?lP3=E49e*3kUKc*}=DxTe0+FqPoz+Onh@*8hNR26IMC z3Z+p*SjfQN(FOH9P~0h{(xVX~HR?AuVp{@=Kv6pk1`zPV*`Np`y#Iz{Wf4E*h34hzc zJ4lA@D06f#XtkOrl!&TLRZ2{38!jLs49*-iTz+dVm}UAu$e#!#yV@dG!2wI(&}Mh@7~z$m*9%`6z^F;ROHJoPVQ zq=O>15)4oaa>JO%nJUsEI2@V&3~|FAeE0mmGBGMI zu;V*dODaoR*^)u+J|6Oi(uG6w)0K9sUTkyWA&s|}kpylE>jV+sDmnnhh`dB@5qQrF zo+GHVjOrla{tSmt2rD=?Vjap?5Y%}!C|z$n^(^;^(Vg=47qi1MhJBQ1A0xzK5yQrk z>xf_QxSzt=%Nm$z^%ar-@ZosSXN_V~RSQUDvUdF&2{qN?%)n{zzZDJQiUHD)%F~)I z;*>G^{Ys;*H+aZ|=XS(Av2D1jumvu2&~B@x7k2IsGAT@qyJF0>q&lX}HACO?#_Wrc zjBozptWK$YX=2w`&DUkSyU`!;V9lb^glqb`ll@LmlXpaDTrki`45%t^@$mwRP*^dnnCZnpi4ALPSD{;;jH~IXd_!`@9K(p^7(H z?AbjCJmRWqguHwz6}!nEUwzQ`qN%cP?mTpu=TyoEq8VcrCra%ncicZazML_44)^;z zGt;#)D&bDtBHD`*Rc*X;?KF)Q(64-b4K>_0jq5H+v)9OI&_FR-ROeaYnKZ~Pbh_-1Z~%fo_Tq*8B%?BkL>GhUnmljD5GkF1WFl={ z=x>;rc2}3O+r<9HCJ+LDqo(=iT=8pXZKc~+{Y7_Jyy9SzaM;Nagj2FY;7hue`z?w{ zFew?=iS+vW>T9gM<0#RUn$P=Oz>K2{phSSk!V&&hKZT)t!BA8&&adH(sHkfV`gC_E zn71FiEdl+`_5arIU3j13$~m@JGYoF0jWwqCvUbu3b1WegZK@s-W;}<>MU`{YBXoHC znC7OX%kdvzqc!bCo8FRzNT?96l?fk1J56kr^ONY5QW1!rG=r4f4T|W*al>kpy&p<> zT#qm@Uf$t_ED_bGu$}&!_~`qwZOJv1f3?-=(IfZs{Q}|G{=A;g7E@S@qr3t;Mqx95 z@!Kj*Pm-a^j_h?&bh3m#8lSj-?7KY~y+7i!CNGGFVwNcP9{Pc#fs;cl&d_BYy5c9z zVVvu7H=hD~ecRFbhhB829j2<^8KEpi*kugG+fTzb!+iWTGzwk|SiM#Iw*5#f$xWJ4 z;`}%TY!B6|`Aayskb>${oWApqo3d+CWHKA?87H9Ogtk2gYU$LVDnB56z8L<(zh=KBLN4*V)=S)i#W5v4Mq(jg*Wyy&2Uu%#iKu2 z1eD&p{WLqmKhD-u7IyS$DGuAWakF&X0hLG%)r$QINa&*>Jouf~@x zy0ejbr3}%F&G!Ck2_W;G*lbAd3F&?4`QsZ3N4YyepIkc%1DX{GN#H-w5)l+6?(JYx z*dt)ShRimc?s*VLg&iyaW}z96_dr-dcb>v`Kl%yw{033>-#(JIJw7SM*GsOSi;h&( znPwZiJ&e#t$-1IU_r&(^u)6B@{K!`0k2Y1r=r4n)5u%oK0*c;^`NjPLSj>-{YIhRD zy^i&h|H7qW>y$Dns%*t$wU6-Qqh`k#KaChY7CVqddET>2ySVGK0G=N5j?fv2oY$fv zeS8PI_Mr6Zxs^cDO6Yc2*k9nt9Z~6ukxlHT0c2Q3eazYwUlFe-EG+3q__zHgB{nuT z!_n1X$3#Oz3UP{Pg<3#U8uD=IH+Ud-1pel>+P|b% z+{-kvuQ!QS$)a-)cqeicK8&WN#$z7cUr2(($Sc0}Bi<2Q@lXRx*>I=;vuR?`YvqWp zBIBJy6aV+h&tihepiaKE@EcEJ;rmj^%;`~G`w45@|H*^=Hx=@K#WN*Ee5`mRt@(6; z1i?9LBQ#Dtv^ur_AqLcCcgH_ zlKgq2H|RdUKktz2LAl7^nhoQX_anhaU940L-`oTK;+hBNrRTXYFhWOM8k3HTjFHi% zFlh31%Uy;gCuz*6-g3MqH8qtnn!7E3GfJjuvZ;XPGX}FRBv}%UIu9$5O|KLk8jAM7 z1*Ts9x!NsEW+^T%wo=dD-lF~-!p&Pv)JPi?j05FN&K+llk=^0U>W@&G*A^*vRMKfE zY)!net-joGB3hEbK-St+(fk#Ba=K3d6b!2K)0hg=WwlprHSP(P|0nPnkY0lW8|EdS za!MDCfjEO~D{Nu9UuG@CG@W~OHH~H4pqwFV8XDd)JNg217u%nYVUgIaOi4a~*j3@X zpN*;Hu-@9Zar~lenJ*jmp~0a4bwO)CB-Au|i$pQOC%mM|e%WP7=KV-Isjh-T%yItX zj|=J~n{QO{KSgIXLi4?hq0-r`aeHbnxi-Wlo`;C1k)cyhA`$g!w*_#n@wv-?s#?j3 zi078oUC?%}R1w#TmlJ90NnnC#cZ1bQmCv-B?4=$e_(DvQxu>WywxUWbYzMcxn=N_0i3@XE;M_waZ7`x7E$0321)UlCt&4K=#R zR4iiJMas>PoZlJD&&}PoL-4pamX~#^hD-Tvjk#F>T@cE*z$~_2r(-0#_pI6|(<0{en2w91(j+hF{iR$Kz-J`d9>D+M0A3*DV`GrNo>i*%us>8>}Hd6m8G+&4_I_EDg>a+uIe`Q2Jt=Fsej-t&yyC7{)zBD=XzwJFM00kGt|4qIaDw1VL3pVBr$h&{l3NfLtZmhk)2afZo`7a=hc$fFFvNh1}V?ejF#0el&n;mu{dt5f~3@9T^X?B>k^ zVaaMj)x~IqrlW90>N&13aB53->4e^J5IELVnnA=`8nW$uU^aI7obXuhKX7;L_ZM~X zh^n=O*8R(i#?NoG_rBz0W_WwA9A38by!f+fN%zyaT!p|d`qrk4lap-3fmzd=oYFeC z92IP;cdi|VOMV8L!p{1IZ0U&^6z)*5d*25#v;TE`(c)V~*!`6HE_*O~$_G zzuHKy70536Mb!wR_oes5r;JviX0g!Pcd{_b3$lmM%5MF-7)%@KagN)xj)l!rHA?p*Ue|L_?2Kn){kY^ z0BBo8HWdt2lX7kMg@0RQ+qX+uu^8g!VRyMO#i|=CNB4BY7kEkzYi$KyILAYy9hsf3 zFDnP*rsU0Q+Dz9h$r*uJuXt1)D2D61b-UW*J^s=ofX4)cc%8`oUrFXFh!9fd!Zbf3`=o7=VoFp|zSyiw-=}a{ zS7a5(eA&Twdmgx+$P#!XPFTwfMk}`*d-T0v_Lq{A{J%1zmwBi-<(ws$7J`S9xBN1w zd<6kIG29r#j(zU9b-nQ>*UZ1JdE-qa1s@)uXtXW7=F!9Zku(g<@GHLWr!!S2E^<45 zTMIQQPmz~sR{T$CIsC#qvL%Zll>sPY`fkABJhU8LCr2H7J_`u_6XrVoB_IuGB#c%Q z1{#rWS$3G|Q`V?(W77@KmCQJ+p+t3HY@g^*{lIg_1lT`|gU7#%?=+pIO$w6`hsi1S z!5p^z_B;Z{FrO`CImCxuX&jRg6B*>|D;<5DS4u%)zfIqJ$(R8SO_|k>=a#t|10aF@ zYQs{*(NpWC58$)!Y#@CIr(+9=D z#zm5!3Tb}reR>B}xez_9#W?mg9`d1Cr#G8O=-J8y#rP1vPwb6_i(W+lk%yNYc)p=Z z^3R!Kl7KOl#xGuUupt>>^yn};%$2-l^`)TLzd)&I02`4=UPLse6HVt`aknMxS`zE%@mzq z)eK{|TliSfwYI(obiZkKGU174c$x)F07-{pY@LUQtX;{X&(KkEelOLS^r}4b(8VZi zoJsPzBABxXJu2$5h>ej&!mmYV`c25@08t0Ta6L0cda-XG|M+JC)#Y@EpEEhsT-L>S z3TboeRoz|2b9&s=XcjRejb?m(v6piz95op3b`^c z+OW$<5D6}L&aACiwg$i*Wiz>2zu7%8MuashcTrruy*4HreL6birAy0gxM{rQ<5~wi z=7_jf1ayA;!sf52z#|DhoLoBzn~iMTr8Vv}C-ww2c}_z5FwWm8I_!LSyO2)fqIoujnIM|yLut^0*^Uj+PBB64@?UePhD z*2TY~e@wPLhTm!__Kb?-f4u{XqbI<}p7h+Wyf3?ovrn$yf7F!Ivl{VyD6I zmz{Xz&{!zz95I7VmDptdBOkMu!9kl<^S0hqe=ObFi3}t;!SCx&X@j42D#fQ45K&9A zx1U)R3GCNTMGk3UH73<5xgW-Pf!7$3AcBII7yesMx$z>wa>vt*< zJL^ZqO#Dv=3I7_vT;Q>Z> zhdD3H|H5>9Y*@kulw;c){eLLl7!fB=l;{_JS_u?nLv=LlpgLYf4=549A%D18+6?iZ zXmVJ!ZC^ps-H=PoZHM~5X}Lna9;#4herRK3Ll)Y(qScYN-(fD1;Q8lrdkz{hGse0r zQ}Sovaz9a*)6GXmC+6KM-Ml@XMJdK!rGdq6hCvi}oU*mE`->WCO0^Vo+Y7Yz7Gdug znVX-F5rX2EvCd9mqYay>YeNUAl!vqWcZ&+ry0w4?k(X_ZcZwP_)>H3|P2ix1{wq8s zmo?O^2Lq#*HIK9?_`lB{yW`^G8hOt0SbOvEfoHXT=yD-LmYI%9HJ?Z-pg9DO3bKaw ztZe#OlW?_3A)cxHT?j;lX7``yWeM094Oam zM~c>SUUI#=8Aemn$UR`DhbHoc-bX530A-2;*gejQd<_ktSQMEHlO)N9;%{sbaa-Np|${t+bj_J$;xAKiFt7{WT=ch_F#bH z{VAJoCIoy7lI3)$F)@P1qTkdHIOvqPjI@k$y^Z|+TSXuq6Eb&PX9rS2iHV6>Ch%2L zBf>kDOhxij*O_bW1wS{z&wvczECboY4D_fdI996oH(xn8`Rd7fG#-01Fdr+EIkq2U z+Nsu6C`_u^^nZ+GJ3Tt`lJ&4yij)yyvxHg^IaF=z_Webh_+5YcyP6LnzUFUhu1V~w z3-!vV88cO5VTahv7BAUSEPN^lQ6Dr_G9fl885_W38E>nFrgx+ksuz!gi?M!!#y`6I zsW_}J{e*4p{I{CZHOZ~Lf7lvMPfSeI`bc#^Ql2zv0+y`{&9&nT3Yc$S(Jn zJ|1VUPwiYi4 znRrw%V=RA|78C_lKb8&9I9kW6`}3oc4C@UyTPTdPGc zqnjDUSGX$5N*$Z`2W~?u#idq1we`8WPskk8of|{7t*K)gaf23{0sElj6n>dwubsY# zCjGT!Hnr?xMb)QA+mcP&DOH+&v#CBgCK3&91_RA&^vmbs-N&N(F5qBgDK>Pjm4|lF zoz|MKH?cD2Rw24RIdBq zUGboHeQ|6#ndj2f)YRb~`4=`^RIxpV*M_IJk2AZaAnwkKQ&IPAoClEZYn1RJ;gety_zf7w0ubg3fg zZX`;MOvELpSw_e#o$VC%H2ZZZx-J@rCjq#@5^cZmjz!XpyQS(e@ptD~=M9tjoBasQ zVO&x~%MX{i!>fUHXH(tsiqpIh$;rYs4fNv#8j0h4iSHi~(5Nx{ZjeiwVcxe7_$T#zI}z)e(qrl#c+f8NTy`SOygcOsSTNYmhV^(CM~m-lrEfXvag>WcX#4Ug8I2K)B`}{4$NfQ+PONd9m40o zC%*BL5H?_5CYF|W`O=Qwc0?!Zj>OR%9SGP^Nj*IkS#FdR`0CZkZ;ncr6~8!jK3Xo+ z$gH!O4eYIRGvbNB?waIT48f(>yU4G%*=QVkImL2mD2y8yzBo`9j^un@=eX+rSFM{LT}ZUb^>k&JiTO#16bjuuI} z1*K0{cPxY>I|!#DY5dOioYv0DG0NXJw@$B+eN(zeYS$O zC^sX19DTNeBHs2eT8okm@XpS}M%BA=24S0w2Z ziyxRttYh5awB&0r=Kfdz|H%0G3HD8-fwF^DJ?cLljWz%7K@nfS(d3{f`t;?<+u^fN zE}E+FX5CAG^<$!$(0{;mPywYf=Bc4N{D1pGspZK_>G0G$N(F!BL9|JIBu`qVK`1^5 z+K~Tf#d-8d$+*Ru>XA^)Ifc_b>n{O~nd;Ie>3pIK`Qy{~mv95*Nug8)?OWVS(K5_f z+1wOSyruv2iH{H3kJ2lB0W31K7Z8N?vEC+7g+tP>frlcF}r0D4)@a*we-jW+aGig3kWxP0Fq&u)GC^=TUUlxid)96Cow;CdN&X!unZsBnmb-?S}j$T%`@Rm2CEuadM2} zT+SyGz(Fj6rh`Jx0hKEo6elqV@!!oYFMG2^&%*T5_ zcf9A6qnrx%vN7?#&DC5P|DQkVZyK){(W?=Wx#b@-Q^t9+PmcV`L{c8n-C9^uWMWbb zb`oj5RcWP(N(B(uQ@^*iLC8D@BWy%Z>X@Jbra+UW&|8uveB*!>R(VAUgV|&@4)Zgp ziuPZuB}Vd(hoDKU*qaxicQczlilM~#31e85|Glhs8vTRWti?`9O`?Uxa%s^f1k5ky>Cf!Tb9)29(Ej)j3KmGm_O~q(jwI& zt}9F~6Re`Qkfb;bzMI<0@MlVr@fRmI<^AoZqjTJ*RGI68cK`RV@97hd0_1_LNrz>Sdxu<7m3ENEL zvYI!up8v5&b7ujkJQ4vLm+kCmqjbWbBvIPXTu|e!-0VkqVYe>n53_Lr)+L1D=PL-qfY*{Y5gN1b`vsR-3cEXQc-wniy@LQEs#xV;z?7% zB5+Y+^R3Uje$;H+(|J>mnWxh%($9uGokul6mn2ocQnNTrgJbQx)s&Q!2u?GTBMfc! z^|m76JV3Jd)iwD!84mM$Itf`|B<=6Rz$&B2d~vG7`|e%-4q!V@b*HUlA7R%R=2toA zgY^`SLxpu!%3N?=nP6WcLjF1uK9!KOZrFpbh$n%+Q1b^R39_PS3ytc$Ke?v8NDk{L zwvU|Gch()3XR}m|%GN8~sp;=t_r&a1WaIE~@X&_I$dK-&En~A(T!Ud;meb^ruC6Ut zp?&crsP*8^%*WN_HXHLV&oQSl2Dz+mtU&gO#T4_meziLFTVC6pNXwKx!356Omzz9K zTJL`9e;Xx4J}H?qsv9inQYCC=KgA!lbRp`rDZ98QPdu$s(6$wPj;hEg&loCoyrRK@ zgBsIk>K@68T*pY-#x4f)&(L_fttriB-L0CJBGwWHc;+)%P9ecRUHH%9H8lONPI|rU zCo*V`?Cw;#r2k~gvyVbwLai^UW9Q63@@@DfoE5vK@ap3cT5ogt4{Q{ogwxa0E?_&F z#_527!g?P`D!4}TaG7blWuEP0%F97f+QZo_c$A39 z!1e9ZP!AQ{#wNCO!FR0>C2yC#ADcP+k;=0E;>(pt?3`GU3Me&3C+ja%}kU$OrAps~X1tfIf zCLVXAtouDWg3D=sOZo>_tByXsVff4%NF5?*c6gRER5JpZmr>&sjuifz0g?eNXI(2U zov*LeINg58u{XbElx`|7e0a$>HTk_8-Q)CV<7X_eqDHc|9TNwxi!Q77%H4eK7NIer zJ*btA4l3o1GZM`C>NV(Eai-A0g%dRqVCF`RR7_p`vkyAipSb{i1a0cney%C*cqe8o z=1l0BSC6e1Z8_^dk;UsK7|AK~+w=?1gskkrU+^SN6C7OG;^8~pd z9COWu4_QGuMs3{Z$bpUGN7>;Z%@kq&+1NxDkY7P4Xs@1mhxk+~z^rW-kg$GlodszMK^qlDVX&E-{l^l=+}cBA zYKh&!#}i4_T;1%!A-Zh=<%&B0?8WdjKVcV*2~+9vS&!s`2@pLntY5kzIk~PESKNuM z$}_2j#~)9o{C1u5LOn?t-7bl5pl(wV%9F`U|IPP6An5qY15z6(UFyM?4P0do#^bNs zi?meUAHYGsV0OkT=0ckZ0bG+>LeDZx;h_zj{9c0^%4Ga(i?)wf1ZWEHBZaZcP z>q22xnXTs8^sC!)PvsB1A}ca-o|4tN=M!3O#qNLTs#(3gQsZEM80aV&q*-35C&M3k zYrDPTQfRIRu2k#}*{m_6T^e z-aeWtFm%dSVv2cFRN(lT{8lv)#l>bI<@zgLV3rF-ZPd)C!7PdgqsT3t2Q|<`vTLEw zy-N@~*x9bbre5x(pJG-qNMbn453N`h{`gJ~nAbCy0In6}F?E<~m-xzvknS|>v6G*w zCfzex6v;pz>-#_f@~Ic&-lvQdZFEGt7MFkg-`77`Qx=OgYJM@O%2K3P8^H;u3K^Wb z%_qh}Uz<5+$w`OK;$NAz9~>ww-rI2+sP2SJazuB!54K_w7YkD=D=SkYIiO3K1B!Zx zgdS(4f+oUuF|<_TQ7onFTU1XITF5XuZ(-j$r&-&lfzV3OVINOu|I0R?s&4&cS#k{& zjpeJ@1p6E!v;TIKYG?ZZYt1w>>vx5(N%PNEsi>f}kzmgBIo+gshKF*5@ zvjWkjRu`~gD$T`&=7mQmm%@2W9r+j9MvfA$!|%pv3?R!wuIN>ZJSNJFcwYAY}`#{g5Ico5z7Ixtgtz7#EF7Y&Td<`Ddb=-(LgV&;$2HSepHIWDya zK6;Fm;htQ)u76$};$*Kh)N;Sl`QotKC?yx%zMMH-VTZ1jXe(P{%T~41F&XxKo|If( zH+uT!_=>dq{jz5_vyGWsh=o~sl|Y*Ja-E&*kt?Xth0eB2vq4G{otYwedQZ76mRw@H z&vI?E-zo?oM+|b}y^m~?m~N!X5>F#dfgSN@OGtKXtlA+HSvS!;rEE`s#%A@YO|~x` z9SudIlX(C!@boK3!dJDGEoWAsXv+;JTe}n6KVKnxE;4WZDoc86q^@WpI`%YAes{-y zMH2MSo?EELv7BDKtRfT$YPFR2EN^I_H?Is_UG@xzUY1B-J06{ojD9B&f+I8JiE;`W*(%mgr*LnvS!ABw8#o_|HB{GBC!tv4$8m**IQxkcg0!JB zLO-{e&1ARUq!_UH1!%fq3Bbl|gXvGss35k1YzuxR1ij>Z6vAJJ`oc!hJ(p)T>xDeE zr5L-0CRStdznmK19>G7(4z4Gt2TOhyr4D((<$hTSwjuFl5SCCuPFFYNRVJNss{jj# z7!Kd3TpF^n4o@dUZM69@2ve6EJl&=MIl{TrV;OBwR~#|svd+xRBX1-vBYO zqbN42nyDM;|6CtU$6a>3IJR*%R-*3nE+e&2Rse^AqkN}Wk}b$czlYiuaEC7UaVXP5 zQIhuQ6^bn-cKt~GVd0K~f`WNRkpg>elVV&(%KE|~^++CHQAAcdBCzx>X<{gG*bRkZ zWwGTGpW{3@Dv43}vgs)E|BU%WCdZyE zAOw{6_>V6VGzqWWU6y5o8(VUqxxY;MxJxOQ=N@yyx^C1EJo(HDOSOxI)lBa_GfbrL zH~6?J*lQjZa;+Qh``}cj`+zObzh!W6aD<#mbXU*X+L~v=df8#jN(o7HLuq0cy9J6m z`#81y(jv2^!N}@~RR{s%G&Sq4C!v450u9hIV{C6GK4g3{He{S;M^?31?kGUQF#cw0 ztl04g1aDcfb^TohtmT0Ot-2rj%DddN@ij=pQq0cJOAgWFiT4-9LPzvmj%r|K-g}#C^^;@4VT=Q+B6rh$T1mi*o#O_RjD9>;sOlXZAFug|v$FKy9~L%# z@j?veTv(5dkZ&~Z0^&@k++Ao9{;y^#8GMd6$Nj)|wyME?eivI3o|xS`9Bj5jxTl3# zo_#YOko!@K({_B=m+4`Ovnh~^A>@p_DXWBr;NyBje?_D!-c&GdPIb)Uh&~b}BP{5| z-K8zHU>BEP2okp!hk#(prP1qo5A*RNwTzK)9uawcn7t1z(OF`OOz?3;D+3r+XC>Uy z70ULum2+F%Svj0Oo&BFm>nR>SSSDuWzyd65gW>@e$Xkgx=O!tWMuWgo9c-#$N2v@6AY$g_`5kdkPGq z(w-P3bIzzCB2&f4kIE&s5W)05;#_RI_fCEynoMK)2m z_P@eg3SMmI0y|b{nuxsTMNdkSwGn*+C3g8`?C~e4zFwqI`Kj41W|I;2>s0N2?7RSV zzuN2^#cP@3H94pe2|lN7b$;rb{#4-YrY)TN-^dJ{@&n4cbfWGxO%0t5Fch@$>M_wR zf*|u@mDD{5BV@VMF!3fXzf*@M0czA-7B^91r39_(CnBJjovB*t_UO-~mm$_{pMCL( zK8K+ClZyMog*rNO7ujFsMiWy!dGe&MToNqKz?`Smx6fX(CIzdoCeM0XDLpt`*^b9qcxdDM+w~D` zlLc&xiy9iorttZ8i-ZFFaQIK1U#fKJ02oeQ6x=y{MMi>Y8hM(q%M3KoH?SIUu6wLT z@8dk*uvJ=IvMEN>LN043mb#^Vk^Hi?K7DvH({XsPtG^UW$i?z_YCAYnBjo!1ySYf9aqb@Pyr9KL7$xS;7+5BK zRSwibQ>Qv!yzxNr^_O0+z2}&bKl(EBLZc={Xr^cPc`a@m{$s&DX2&m3tk)c2u_`eueEK1VBM}`#T8N!RmM_Uw6E2}VWI(gwt=MGLQ>*^=kA`oI%!Gn zzkfFIoLKkQgCIG1fj}*upRS^&S9@Aw2UOz`fedE>? z075jv=~F>N|I+MVLgR+=Kc=aHb%Q@&HY~kjb)ZHzn%yo)Gs71c;I(JuN7lY;ec!N# zE$Sgq9EWYCSw)0l z3t&z74?C8F3y;9d@EuesIEx|hh1(uf4mMm}0#WK=xqtR8$@WUqIz8(*S<^56g4Zhvi9nKfE;0e$)n+GbAD?s?lMNX>jWlzry#PvHS`WhK?+M zSH5Z)&KwZJYJx8OZi7@IZTA@@f401F^YP|99_q~e6*(@64ZfAWfn%TPf$HZRoSVZ1 zQzYukz|EeCZj8d(mF4Bzp%L0H5C`p~Lgt&S(=Ug&G_|K~Q}Yluf@K0L&!JEDUz$gB zeY?{l5mGcbC+~SqNwmj^YGZ3TL>6u?CZ4FhL$y>{bePlUW*(Wdu(0Ub@@k{xe2B@X zZoSt&awgl5U~aK(S5H5!INO)vBknJhyMq^_c(dy440)B8yi~l69xRY@900o3FHLTNfF@H16)IA zHyL-jFNTAPrJ~m}l4Lu@p-O`Nm-$zN?M^0Nw;#sg=(0C};W^=oe$l~2sqE7$ePf!l z?|>k67R0NHr+p#9t=Vrl)z<<5e~HO+BMzqlMqURhyOWlIs2qE^TUP>;R2(prbqXjT+yem*v5e1Z zrB$cnG|h&?pC1VufU8|_E^*6L1vZpHe_Uw%2kmR;KiS&|=1}|;Nu2)&N6Lf z)NaUXB#=X-b^GV$rw4b*|1GE`KFB{%K=R7P!6zR&DZu$_7OV%?!iY<8G89+Ho5l_W z7Fs0iTUD7eEz!Jxw<_ZqnV$}P=yb(7Y6Mos1h}exL>9$`OH|9k zQr8X5Fo>5qkHf0dr=#N|+h|%2{w}`K9yu$+IE>Mf!fqgz)>Hib8P`zll*oH~r1?ax z1smFX#NfL)dopLaZH%r#t4JWJ&BN_%tW|Fb^Mw;uu(jEpS#oEu_M$Sk1w>)&`s|V1 zO#|#5^}n+O`FIfE**3us`+Q4=_#B+5l&p6}d`-YAgr0S-L-C@BqJY98%-0!Y%uEsV z%=%;v%n% (https://nhn.github.io/tui.editor/) + * @license MIT + */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("jquery"), require("tui-code-snippet"), require("codemirror"), require("to-mark"), require("tui-chart"), require("squire-rte"), require("markdown-it"), require("highlight.js"), require("tui-color-picker"), require("plantuml-encoder")); + else if(typeof define === 'function' && define.amd) + define(["jquery", "tui-code-snippet", "codemirror", "to-mark", "tui-chart", "squire-rte", "markdown-it", "highlight.js", "tui-color-picker", "plantuml-encoder"], factory); + else if(typeof exports === 'object') + exports["Editor"] = factory(require("jquery"), require("tui-code-snippet"), require("codemirror"), require("to-mark"), require("tui-chart"), require("squire-rte"), require("markdown-it"), require("highlight.js"), require("tui-color-picker"), require("plantuml-encoder")); + else + root["tui"] = root["tui"] || {}, root["tui"]["Editor"] = factory(root["$"], root["tui"]["util"], root["CodeMirror"], root["toMark"], root["tui"]["chart"], root["Squire"], root["markdownit"], root["hljs"], root["tui"]["colorPicker"], root["plantumlEncoder"]); +})(window, function(__WEBPACK_EXTERNAL_MODULE__0__, __WEBPACK_EXTERNAL_MODULE__1__, __WEBPACK_EXTERNAL_MODULE__10__, __WEBPACK_EXTERNAL_MODULE__24__, __WEBPACK_EXTERNAL_MODULE__57__, __WEBPACK_EXTERNAL_MODULE__79__, __WEBPACK_EXTERNAL_MODULE__85__, __WEBPACK_EXTERNAL_MODULE__94__, __WEBPACK_EXTERNAL_MODULE__207__, __WEBPACK_EXTERNAL_MODULE__209__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = "/dist"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 55); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__0__; + +/***/ }), +/* 1 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__1__; + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * @fileoverview Implements CommandManager + * @author NHN FE Development Lab + */ + + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _command = __webpack_require__(84); + +var _command2 = _interopRequireDefault(_command); + +var _util = __webpack_require__(39); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var KEYMAP_OS_INDEX = _util.isMac ? 1 : 0; + +/** + * Class CommandManager + * @param {ToastUIEditor} base nedInstance + * @param {object} [options={}] - option object + * @param {boolean} [options.useCommandShortcut=true] - execute command with keyMap + * @ignore + */ + +var CommandManager = function () { + function CommandManager(base) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + _classCallCheck(this, CommandManager); + + this._command = new _tuiCodeSnippet2.default.Map(); + this._mdCommand = new _tuiCodeSnippet2.default.Map(); + this._wwCommand = new _tuiCodeSnippet2.default.Map(); + this._options = _jquery2.default.extend({ + 'useCommandShortcut': true + }, options); + + this.base = base; + + this.keyMapCommand = {}; + + this._initEvent(); + } + + /** + * You can change command before command addition by addCommandBefore event. + * @param {object} command - command + * @returns {object} + * @private + */ + + + _createClass(CommandManager, [{ + key: '_addCommandBefore', + value: function _addCommandBefore(command) { + var commandWrapper = { command: command }; + + this.base.eventManager.emit('addCommandBefore', commandWrapper); + + return commandWrapper.command || command; + } + + /** + * Add command + * @param {Command} command Command instance + * @returns {Command} Command + */ + + }, { + key: 'addCommand', + value: function addCommand(command) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + if (args.length) { + command = CommandManager.command.apply(CommandManager, [command].concat(args)); + } + + command = this._addCommandBefore(command); + + var name = command.getName(); + + var commandBase = void 0; + + if (command.isMDType()) { + commandBase = this._mdCommand; + } else if (command.isWWType()) { + commandBase = this._wwCommand; + } else if (command.isGlobalType()) { + commandBase = this._command; + } + + commandBase.set(name, command); + + if (command.keyMap) { + this.keyMapCommand[command.keyMap[KEYMAP_OS_INDEX]] = name; + } + + return command; + } + + /** + * _initEvent + * Bind event handler to eventManager + * @private + */ + + }, { + key: '_initEvent', + value: function _initEvent() { + var _this = this; + + this.base.eventManager.listen('command', function () { + _this.exec.apply(_this, arguments); + }); + + this.base.eventManager.listen('keyMap', function (ev) { + if (!_this._options.useCommandShortcut) { + return; + } + var command = _this.keyMapCommand[ev.keyMap]; + + if (command) { + ev.data.preventDefault(); + _this.exec(command); + } + }); + } + + /** + * Execute command + * @param {String} name Command name + * @param {*} ...args Command argument + * @returns {*} + */ + + }, { + key: 'exec', + value: function exec(name) { + var commandToRun = void 0, + result = void 0; + var context = this.base; + + commandToRun = this._command.get(name); + + if (!commandToRun) { + if (this.base.isMarkdownMode()) { + commandToRun = this._mdCommand.get(name); + context = this.base.mdEditor; + } else { + commandToRun = this._wwCommand.get(name); + context = this.base.wwEditor; + } + } + + if (commandToRun) { + var _commandToRun; + + for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } + + args.unshift(context); + result = (_commandToRun = commandToRun).exec.apply(_commandToRun, args); + } + + return result; + } + }]); + + return CommandManager; +}(); + +/** + * Create command by given editor type and property object + * @param {string} type Command type + * @param {{name: string, keyMap: Array}} props Property + * @returns {*} + * @static + */ + + +CommandManager.command = function (type, props) { + var command = _command2.default.factory(type, props.name, props.keyMap); + + _tuiCodeSnippet2.default.extend(command, props); + + return command; +}; + +exports.default = CommandManager; + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.I18n = undefined; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * @fileoverview Implements i18n + * @author NHN FE Development Lab + */ + + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var sharedInstance = void 0; + +var DEFAULT_CODE = 'en_US'; + +/** + * Class I18n + */ + +var I18n = function () { + function I18n() { + _classCallCheck(this, I18n); + + this._code = DEFAULT_CODE; + this._langs = new _tuiCodeSnippet2.default.Map(); + } + + /** + * Set locale code + * @param {string} code locale code + */ + + + _createClass(I18n, [{ + key: 'setCode', + value: function setCode(code) { + this._code = code; + } + + /** + * Set language set + * @param {string|string[]} codes locale code + * @param {object} data language set + */ + + }, { + key: 'setLanguage', + value: function setLanguage(codes, data) { + var _this = this; + + codes = [].concat(codes); + + codes.forEach(function (code) { + if (!_this._langs.has(code)) { + _this._langs.set(code, data); + } else { + var langData = _this._langs.get(code); + _this._langs.set(code, _tuiCodeSnippet2.default.extend(langData, data)); + } + }); + } + + /** + * Get text of key + * @param {string} key key of text + * @param {string} code locale code + * @returns {string} + */ + + }, { + key: 'get', + value: function get(key, code) { + if (!code) { + code = this._code; + } + + var langSet = this._langs.get(code); + + if (!langSet) { + langSet = this._langs.get(DEFAULT_CODE); + } + + var text = langSet[key]; + + if (!text) { + throw new Error('There is no text key "' + key + '" in ' + code); + } + + return text; + } + }], [{ + key: 'getSharedInstance', + value: function getSharedInstance() { + if (!sharedInstance) { + sharedInstance = new I18n(); + } + + return sharedInstance; + } + }]); + + return I18n; +}(); + +exports.I18n = I18n; +exports.default = new I18n(); + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @fileoverview DOM Utils + * @author NHN FE Development Lab + */ +var FIND_ZWB = /\u200B/g; + +/** + * Check if node is text node + * @param {Node} node node to check + * @returns {boolean} result + * @ignore + */ +var isTextNode = function isTextNode(node) { + return node && node.nodeType === Node.TEXT_NODE; +}; + +/** + * Check if node is element node + * @param {Node} node node to check + * @returns {boolean} result + * @ignore + */ +var isElemNode = function isElemNode(node) { + return node && node.nodeType === Node.ELEMENT_NODE; +}; + +/** + * Check that the node is block node + * @param {Node} node node + * @returns {boolean} + * @ignore + */ +var isBlockNode = function isBlockNode(node) { + return (/^(ADDRESS|ARTICLE|ASIDE|BLOCKQUOTE|DETAILS|DIALOG|DD|DIV|DL|DT|FIELDSET|FIGCAPTION|FIGURE|FOOTER|FORM|H[\d]|HEADER|HGROUP|HR|LI|MAIN|NAV|OL|P|PRE|SECTION|UL)$/ig.test(this.getNodeName(node)) + ); +}; + +/** + * Get node name of node + * @param {Node} node node + * @returns {string} node name + * @ignore + */ +var getNodeName = function getNodeName(node) { + if (isElemNode(node)) { + return node.tagName; + } + + return 'TEXT'; +}; + +/** + * Get node offset length of node(for Range API) + * @param {Node} node node + * @returns {number} length + * @ignore + */ +var getTextLength = function getTextLength(node) { + var len = void 0; + + if (isElemNode(node)) { + len = node.textContent.replace(FIND_ZWB, '').length; + } else if (isTextNode(node)) { + len = node.nodeValue.replace(FIND_ZWB, '').length; + } + + return len; +}; + +/** + * Get node offset length of node(for Range API) + * @param {Node} node node + * @returns {number} length + * @ignore + */ +var getOffsetLength = function getOffsetLength(node) { + var len = void 0; + + if (isElemNode(node)) { + len = node.childNodes.length; + } else if (isTextNode(node)) { + len = node.nodeValue.replace(FIND_ZWB, '').length; + } + + return len; +}; + +/** + * get node offset between parent's childnodes + * @param {Node} node node + * @returns {number} offset(index) + * @ignore + */ +var getNodeOffsetOfParent = function getNodeOffsetOfParent(node) { + var childNodesOfParent = node.parentNode.childNodes; + var i = void 0, + t = void 0, + found = void 0; + + for (i = 0, t = childNodesOfParent.length; i < t; i += 1) { + if (childNodesOfParent[i] === node) { + found = i; + break; + } + } + + return found; +}; + +/** + * get child node by offset + * @param {Node} node node + * @param {number} index offset index + * @returns {Node} foudned node + * @ignore + */ +var getChildNodeByOffset = function getChildNodeByOffset(node, index) { + var currentNode = void 0; + + if (isTextNode(node)) { + currentNode = node; + } else if (node.childNodes.length && index >= 0) { + currentNode = node.childNodes[index]; + } + + return currentNode; +}; + +/** + * find next node from passed node + * @param {strong} direction previous or next + * @param {Node} node node + * @param {string} untilNodeName parent node name to limit + * @returns {Node} founded node + * @ignore + */ +var getNodeWithDirectionUntil = function getNodeWithDirectionUntil(direction, node, untilNodeName) { + var directionKey = direction + 'Sibling'; + var nodeName = void 0, + foundedNode = void 0; + + while (node && !node[directionKey]) { + nodeName = getNodeName(node.parentNode); + + if (nodeName === untilNodeName || nodeName === 'BODY') { + break; + } + + node = node.parentNode; + } + + if (node[directionKey]) { + foundedNode = node[directionKey]; + } + + return foundedNode; +}; + +/** + * get prev node of childnode pointed with index + * @param {Node} node node + * @param {number} index offset index + * @param {string} untilNodeName parent node name to limit + * @returns {Node} founded node + * @ignore + */ +var getPrevOffsetNodeUntil = function getPrevOffsetNodeUntil(node, index, untilNodeName) { + var prevNode = void 0; + + if (index > 0) { + prevNode = getChildNodeByOffset(node, index - 1); + } else { + prevNode = getNodeWithDirectionUntil('previous', node, untilNodeName); + } + + return prevNode; +}; + +var getParentUntilBy = function getParentUntilBy(node, matchCondition, stopCondition) { + var foundedNode = void 0; + + while (node.parentNode && !matchCondition(node.parentNode)) { + node = node.parentNode; + + if (stopCondition && stopCondition(node.parentNode)) { + break; + } + } + + if (matchCondition(node.parentNode)) { + foundedNode = node; + } + + return foundedNode; +}; + +/** + * get parent node until paseed node name + * @param {Node} node node + * @param {string|HTMLNode} untilNode node name or node to limit + * @returns {Node} founded node + * @ignore + */ +var getParentUntil = function getParentUntil(node, untilNode) { + var foundedNode = void 0; + + if (_tuiCodeSnippet2.default.isString(untilNode)) { + foundedNode = getParentUntilBy(node, function (targetNode) { + return untilNode === getNodeName(targetNode); + }); + } else { + foundedNode = getParentUntilBy(node, function (targetNode) { + return untilNode === targetNode; + }); + } + + return foundedNode; +}; + +/** + * get node on the given direction under given parent + * @param {strong} direction previous or next + * @param {Node} node node + * @param {string|Node} underNode parent node name to limit + * @returns {Node} founded node + * @ignore + */ +var getNodeWithDirectionUnderParent = function getNodeWithDirectionUnderParent(direction, node, underNode) { + var directionKey = direction + 'Sibling'; + var foundedNode = void 0; + + node = getParentUntil(node, underNode); + + if (node && node[directionKey]) { + foundedNode = node[directionKey]; + } + + return foundedNode; +}; + +/** + * get top previous top level node under given node + * @param {Node} node node + * @param {Node} underNode underNode + * @returns {Node} founded node + * @ignore + */ +var getTopPrevNodeUnder = function getTopPrevNodeUnder(node, underNode) { + return getNodeWithDirectionUnderParent('previous', node, underNode); +}; + +/** + * get next top level block node + * @param {Node} node node + * @param {Node} underNode underNode + * @returns {Node} founded node + * @ignore + */ +var getTopNextNodeUnder = function getTopNextNodeUnder(node, underNode) { + return getNodeWithDirectionUnderParent('next', node, underNode); +}; + +/** + * Get parent element the body element + * @param {Node} node Node for start searching + * @returns {Node} + * @ignore + */ +var getTopBlockNode = function getTopBlockNode(node) { + return getParentUntil(node, 'BODY'); +}; + +/** + * Get previous text node + * @param {Node} node Node for start searching + * @returns {Node} + * @ignore + */ +var getPrevTextNode = function getPrevTextNode(node) { + node = node.previousSibling || node.parentNode; + + while (!isTextNode(node) && getNodeName(node) !== 'BODY') { + if (node.previousSibling) { + node = node.previousSibling; + + while (node.lastChild) { + node = node.lastChild; + } + } else { + node = node.parentNode; + } + } + + if (getNodeName(node) === 'BODY') { + node = null; + } + + return node; +}; + +/** + * test whether root contains the given node + * @param {HTMLNode} root - root node + * @param {HTMLNode} node - node to test + * @returns {Boolean} true if root contains node + * @ignore + */ +var containsNode = function containsNode(root, node) { + var walker = document.createTreeWalker(root, 4, null, false); + var found = root === node; + + while (!found && walker.nextNode()) { + found = walker.currentNode === node; + } + + return found; +}; + +/** + * find node by offset + * @param {HTMLElement} root Root element + * @param {Array.} offsetList offset list + * @param {function} textNodeFilter Text node filter + * @returns {Array} + * @ignore + */ +var findOffsetNode = function findOffsetNode(root, offsetList, textNodeFilter) { + var result = []; + var text = ''; + var walkerOffset = 0; + var newWalkerOffset = void 0; + + if (!offsetList.length) { + return result; + } + + var offset = offsetList.shift(); + var walker = document.createTreeWalker(root, 4, null, false); + + while (walker.nextNode()) { + text = walker.currentNode.nodeValue || ''; + + if (textNodeFilter) { + text = textNodeFilter(text); + } + + newWalkerOffset = walkerOffset + text.length; + + while (newWalkerOffset >= offset) { + result.push({ + container: walker.currentNode, + offsetInContainer: offset - walkerOffset, + offset: offset + }); + + if (!offsetList.length) { + return result; + } + offset = offsetList.shift(); + } + walkerOffset = newWalkerOffset; + } + + // there should be offset left + do { + result.push({ + container: walker.currentNode, + offsetInContainer: text.length, + offset: offset + }); + offset = offsetList.shift(); + } while (!_tuiCodeSnippet2.default.isUndefined(offset)); + + return result; +}; + +var getNodeInfo = function getNodeInfo(node) { + var path = {}; + + path.tagName = node.nodeName; + + if (node.id) { + path.id = node.id; + } + + var className = node.className.trim(); + + if (className) { + path.className = className; + } + + return path; +}; + +var getPath = function getPath(node, root) { + var paths = []; + + while (node && node !== root) { + if (isElemNode(node)) { + paths.unshift(getNodeInfo(node)); + } + + node = node.parentNode; + } + + return paths; +}; + +/** + * Find next, previous TD or TH element by given TE element + * @param {HTMLElement} node TD element + * @param {string} direction 'next' or 'previous' + * @returns {HTMLElement|null} + * @ignore + */ +var getTableCellByDirection = function getTableCellByDirection(node, direction) { + var targetElement = null; + + if (!_tuiCodeSnippet2.default.isUndefined(direction) && (direction === 'next' || direction === 'previous')) { + if (direction === 'next') { + targetElement = node.nextElementSibling; + } else { + targetElement = node.previousElementSibling; + } + } + + return targetElement; +}; + +/** + * Find sibling TR's TD element by given TD and direction + * @param {HTMLElement} node TD element + * @param {string} direction Boolean value for find first TD in next line + * @param {boolean} [needEdgeCell=false] Boolean value for find first TD in next line + * @returns {HTMLElement|null} + * @ignore + */ +var getSiblingRowCellByDirection = function getSiblingRowCellByDirection(node, direction, needEdgeCell) { + var tableCellElement = null; + var $node = void 0, + index = void 0, + $targetRowElement = void 0, + $currentContainer = void 0, + $siblingContainer = void 0, + isSiblingContainerExists = void 0; + + if (!_tuiCodeSnippet2.default.isUndefined(direction) && (direction === 'next' || direction === 'previous')) { + if (node) { + $node = (0, _jquery2.default)(node); + + if (direction === 'next') { + $targetRowElement = $node.parent().next(); + $currentContainer = $node.parents('thead'); + $siblingContainer = $currentContainer[0] && $currentContainer.next(); + isSiblingContainerExists = $siblingContainer && getNodeName($siblingContainer[0]) === 'TBODY'; + + index = 0; + } else { + $targetRowElement = $node.parent().prev(); + $currentContainer = $node.parents('tbody'); + $siblingContainer = $currentContainer[0] && $currentContainer.prev(); + isSiblingContainerExists = $siblingContainer && getNodeName($siblingContainer[0]) === 'THEAD'; + + index = node.parentNode.childNodes.length - 1; + } + + if (_tuiCodeSnippet2.default.isUndefined(needEdgeCell) || !needEdgeCell) { + index = getNodeOffsetOfParent(node); + } + + if ($targetRowElement[0]) { + tableCellElement = $targetRowElement.children('td,th')[index]; + } else if ($currentContainer[0] && isSiblingContainerExists) { + tableCellElement = $siblingContainer.find('td,th')[index]; + } + } + } + + return tableCellElement; +}; + +/** + * Check that the inline node is supported by markdown + * @param {Node} node TD element + * @returns {boolean} + * @ignore + */ +var isMDSupportInlineNode = function isMDSupportInlineNode(node) { + return (/^(A|B|BR|CODE|DEL|EM|I|IMG|S|SPAN|STRONG)$/ig.test(node.nodeName) + ); +}; + +/** + * Check that node is styled node. + * Styled node is a node that has text and decorates text. + * @param {Node} node TD element + * @returns {boolean} + * @ignore + */ +var isStyledNode = function isStyledNode(node) { + return (/^(A|ABBR|ACRONYM|B|BDI|BDO|BIG|CITE|CODE|DEL|DFN|EM|I|INS|KBD|MARK|Q|S|SAMP|SMALL|SPAN|STRONG|SUB|SUP|U|VAR)$/ig.test(node.nodeName) + ); +}; + +/** + * remove node from 'start' node to 'end-1' node inside parent + * if 'end' node is null, remove all child nodes after 'start' node. + * @param {Node} parent - parent node + * @param {Node} start - start node to remove + * @param {Node} end - end node to remove + * @ignore + */ +var removeChildFromStartToEndNode = function removeChildFromStartToEndNode(parent, start, end) { + var child = start; + + if (!child || parent !== child.parentNode) { + return; + } + + while (child !== end) { + var next = child.nextSibling; + parent.removeChild(child); + child = next; + } +}; + +/** + * remove nodes along the direction from the node to reach targetParent node + * @param {Node} targetParent - stop removing when reach target parent node + * @param {Node} node - start node + * @param {boolean} isForward - direction + * @ignore + */ +var removeNodesByDirection = function removeNodesByDirection(targetParent, node, isForward) { + var parent = node; + + while (parent !== targetParent) { + var nextParent = parent.parentNode; + var _parent = parent, + nextSibling = _parent.nextSibling, + previousSibling = _parent.previousSibling; + + + if (!isForward && nextSibling) { + removeChildFromStartToEndNode(nextParent, nextSibling, null); + } else if (isForward && previousSibling) { + removeChildFromStartToEndNode(nextParent, nextParent.childNodes[0], parent); + } + + parent = nextParent; + } +}; + +var getLeafNode = function getLeafNode(node) { + var result = node; + while (result.childNodes && result.childNodes.length) { + var _result = result, + nextLeaf = _result.firstChild; + + // When inline tag have empty text node with other childnodes, ignore empty text node. + + if (isTextNode(nextLeaf) && !getTextLength(nextLeaf)) { + result = nextLeaf.nextSibling || nextLeaf; + } else { + result = nextLeaf; + } + } + + return result; +}; +/** + * check if a coordinates is inside a task box + * @param {object} style - computed style of task box + * @param {number} offsetX - event x offset + * @param {number} offsetY - event y offset + * @returns {boolean} + * @ignore + */ +var isInsideTaskBox = function isInsideTaskBox(style, offsetX, offsetY) { + var rect = { + left: parseInt(style.left, 10), + top: parseInt(style.top, 10), + width: parseInt(style.width, 10), + height: parseInt(style.height, 10) + }; + + return offsetX >= rect.left && offsetX <= rect.left + rect.width && offsetY >= rect.top && offsetY <= rect.top + rect.height; +}; + +/** + * Check whether node is OL or UL + * @param {node} node - node + * @returns {boolean} - whether node is OL or UL + * @ignore + */ +var isListNode = function isListNode(node) { + if (!node) { + return false; + } + + return node.nodeName === 'UL' || node.nodeName === 'OL'; +}; + +/** + * Check whether node is first list item + * @param {node} node - node + * @returns {boolean} whether node is first list item + * @ignore + */ +var isFirstListItem = function isFirstListItem(node) { + var nodeName = node.nodeName, + parentNode = node.parentNode; + + + return nodeName === 'LI' && node === parentNode.firstChild; +}; + +/** + * Check whether node is first level list item + * @param {node} node - node + * @returns {boolean} whether node is first level list item + * @ignore + */ +var isFirstLevelListItem = function isFirstLevelListItem(node) { + var nodeName = node.nodeName, + listNode = node.parentNode; + var listParentNode = listNode.parentNode; + + + return nodeName === 'LI' && !isListNode(listParentNode); +}; + +/** + * Merge node to target node and detach node + * @param {node} node - node + * @param {node} targetNode - target node + * @ignore + */ +var mergeNode = function mergeNode(node, targetNode) { + if (node.hasChildNodes()) { + _tuiCodeSnippet2.default.forEachArray(node.childNodes, function () { + targetNode.appendChild(node.firstChild); + }); + + targetNode.normalize(); + } + + if (node.parentNode) { + node.parentNode.removeChild(node); + } +}; + +/** + * Create hr that is not contenteditable + * @returns {node} hr is wraped div + * @ignore + */ +var createHorizontalRule = function createHorizontalRule() { + var div = document.createElement('div'); + var hr = document.createElement('hr'); + + div.setAttribute('contenteditable', false); + hr.setAttribute('contenteditable', false); + + div.appendChild(hr); + + return div; +}; + +/** + * Create Empty Line + * @returns {node}

+ * @private + */ +var createEmptyLine = function createEmptyLine() { + var div = document.createElement('div'); + div.appendChild(document.createElement('br')); + + return div; +}; + +/** + * Find same tagName child node and change wrapping order. + * For example, if below node need to optimize 'B' tag. + * test + * should be changed tag's order. + * test + * @param {node} node + * @param {string} tagName + * @returns {node} + * @private + */ +var changeTagOrder = function changeTagOrder(node, tagName) { + if (node.nodeName !== 'SPAN') { + var parentNode = node.parentNode; + + var tempNode = node; + + while (tempNode.childNodes && tempNode.childNodes.length === 1 && !isTextNode(tempNode.firstChild)) { + tempNode = tempNode.firstChild; + + if (tempNode.nodeName === 'SPAN') { + break; + } + + if (tempNode.nodeName === tagName) { + var wrapper = document.createElement(tagName); + + mergeNode(tempNode, tempNode.parentNode); + parentNode.replaceChild(wrapper, node); + wrapper.appendChild(node); + + return wrapper; + } + } + } + + return node; +}; + +/** + * Find same tagName nodes and merge from startNode to endNode. + * @param {node} startNode + * @param {node} endNode + * @param {string} tagName + * @returns {node} + * @private + */ +var mergeSameNodes = function mergeSameNodes(startNode, endNode, tagName) { + var startBlockNode = changeTagOrder(startNode, tagName); + + if (startBlockNode.nodeName === tagName) { + var endBlockNode = changeTagOrder(endNode, tagName); + var mergeTargetNode = startBlockNode; + var nextNode = startBlockNode.nextSibling; + + while (nextNode) { + var tempNext = nextNode.nextSibling; + + nextNode = changeTagOrder(nextNode, tagName); + + if (nextNode.nodeName === tagName) { + // eslint-disable-next-line max-depth + if (mergeTargetNode) { + mergeNode(nextNode, mergeTargetNode); + } else { + mergeTargetNode = nextNode; + } + } else { + mergeTargetNode = null; + } + + if (nextNode === endBlockNode) { + break; + } + + nextNode = tempNext; + } + } +}; + +/** + * Find same tagName nodes in range and merge nodes. + * For example range is like this + * AAABBB + * nodes is changed below + * AAABBB + * @param {range} range + * @param {string} tagName + * @private + */ +var optimizeRange = function optimizeRange(range, tagName) { + var collapsed = range.collapsed, + commonAncestorContainer = range.commonAncestorContainer, + startContainer = range.startContainer, + endContainer = range.endContainer; + + + if (!collapsed) { + var optimizedNode = null; + + if (startContainer !== endContainer) { + mergeSameNodes(getParentUntil(startContainer, commonAncestorContainer), getParentUntil(endContainer, commonAncestorContainer), tagName); + + optimizedNode = commonAncestorContainer; + } else if (isTextNode(startContainer)) { + optimizedNode = startContainer.parentNode; + } + + if (optimizedNode && optimizedNode.nodeName === tagName) { + var _optimizedNode = optimizedNode, + previousSibling = _optimizedNode.previousSibling; + + var tempNode = void 0; + + if (previousSibling) { + tempNode = changeTagOrder(previousSibling); + + if (tempNode.nodeName === tagName) { + mergeNode(optimizedNode, tempNode); + } + } + + var _optimizedNode2 = optimizedNode, + nextSibling = _optimizedNode2.nextSibling; + + + if (nextSibling) { + tempNode = changeTagOrder(nextSibling); + + if (tempNode.nodeName === tagName) { + mergeNode(tempNode, optimizedNode); + } + } + } + } +}; + +/** + * Gets all text node from root element. + * @param {HTMLElement} root Root element + * @returns {Array} list of text nodes + * @ignore + */ +var getAllTextNode = function getAllTextNode(root) { + var walker = document.createTreeWalker(root, 4, null, false); + var result = []; + + while (walker.nextNode()) { + var node = walker.currentNode; + + if (isTextNode(node)) { + result.push(node); + } + } + + return result; +}; + +/** + * Check whether the node is 'TD' or 'TH' + * @param {HTMLElement} node - the target node + * @returns {boolean} - whether the node is 'TD' or 'TH' + * @ignore + */ +var isCellNode = function isCellNode(node) { + if (!node) { + return false; + } + + return node.nodeName === 'TD' || node.nodeName === 'TH'; +}; + +/** + * Get the last node on the target node by the condition + * @param {HTMLElement} node - the target node + * @returns {function} - the condition to find the node + * @ignore + */ +var getLastNodeBy = function getLastNodeBy(node, condition) { + var lastNode = node && node.lastChild; + + while (lastNode && condition(lastNode)) { + lastNode = lastNode.lastChild; + } + + return lastNode; +}; + +/** + * Get the parent node on the target node by the condition + * @param {HTMLElement} node - the target node + * @returns {function} - the condition to find the node + * @ignore + */ +var getParentNodeBy = function getParentNodeBy(node, condition) { + while (node && condition(node.parentNode, node)) { + node = node.parentNode; + } + + return node; +}; + +/** + * Get the sibling node on the target node by the condition + * @param {HTMLElement} node - the target node + * @param {string} direction - the direction to find node ('previous', 'next') + * @returns {function} - the condition to find the node + * @ignore + */ +var getSiblingNodeBy = function getSiblingNodeBy(node, direction, condition) { + var directionKey = direction + 'Sibling'; + + while (node && condition(node[directionKey], node)) { + node = node[directionKey]; + } + + return node; +}; + +exports.default = { + getNodeName: getNodeName, + isTextNode: isTextNode, + isElemNode: isElemNode, + isBlockNode: isBlockNode, + getTextLength: getTextLength, + getOffsetLength: getOffsetLength, + getPrevOffsetNodeUntil: getPrevOffsetNodeUntil, + getNodeOffsetOfParent: getNodeOffsetOfParent, + getChildNodeByOffset: getChildNodeByOffset, + getNodeWithDirectionUntil: getNodeWithDirectionUntil, + containsNode: containsNode, + getTopPrevNodeUnder: getTopPrevNodeUnder, + getTopNextNodeUnder: getTopNextNodeUnder, + getParentUntilBy: getParentUntilBy, + getParentUntil: getParentUntil, + getTopBlockNode: getTopBlockNode, + getPrevTextNode: getPrevTextNode, + findOffsetNode: findOffsetNode, + getPath: getPath, + getNodeInfo: getNodeInfo, + getTableCellByDirection: getTableCellByDirection, + getSiblingRowCellByDirection: getSiblingRowCellByDirection, + isMDSupportInlineNode: isMDSupportInlineNode, + isStyledNode: isStyledNode, + removeChildFromStartToEndNode: removeChildFromStartToEndNode, + removeNodesByDirection: removeNodesByDirection, + getLeafNode: getLeafNode, + isInsideTaskBox: isInsideTaskBox, + isListNode: isListNode, + isFirstListItem: isFirstListItem, + isFirstLevelListItem: isFirstLevelListItem, + mergeNode: mergeNode, + createHorizontalRule: createHorizontalRule, + createEmptyLine: createEmptyLine, + changeTagOrder: changeTagOrder, + mergeSameNodes: mergeSameNodes, + optimizeRange: optimizeRange, + getAllTextNode: getAllTextNode, + isCellNode: isCellNode, + getLastNodeBy: getLastNodeBy, + getParentNodeBy: getParentNodeBy, + getSiblingNodeBy: getSiblingNodeBy +}; + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +/** +* @fileoverview Editor/Viewer proxy for extensions +* @author NHN FE Development Lab +*/ +/* eslint global-require: 0 no-empty: 0 */ + +var Editor = void 0; +try { + Editor = __webpack_require__(30); +} catch (e) {} +if (!Editor) { + try { + Editor = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module '../viewer'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + } catch (e) {} +} + +exports.default = Editor; + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createTableData = createTableData; +exports.createCellIndexData = createCellIndexData; + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Parse cell like td or th. + * @param {HTMLElement} cell - cell element like td or th + * @param {number} rowIndex - row index + * @param {number} colIndex - column index + * @returns {{ + * nodeName: string, + * colspan: number, + * rowspan: number, + * content: string, + * align: ?string + * }} + * @private + */ +/** +* @fileoverview Implements tableDataHandler +* @author NHN FE Development Lab +*/ +function _parseCell(cell, rowIndex, colIndex) { + var $cell = (0, _jquery2.default)(cell); + var colspan = $cell.attr('colspan'); + var rowspan = $cell.attr('rowspan'); + var nodeName = cell.nodeName; + + + if (nodeName !== 'TH' && nodeName !== 'TD') { + return null; + } + + var cellData = { + nodeName: cell.nodeName, + colspan: colspan ? parseInt(colspan, 10) : 1, + rowspan: rowspan ? parseInt(rowspan, 10) : 1, + content: $cell.html(), + elementIndex: { + rowIndex: rowIndex, + colIndex: colIndex + } + }; + + if (cell.nodeName === 'TH' && cell.align) { + cellData.align = cell.align; + } + + return cellData; +} + +/** + * Add merged cell. + * @param {object} base - base table data + * @param {object} cellData - cell data + * @param {number} startRowIndex - start row index + * @param {number} startCellIndex - start cell index + * @private + */ +function _addMergedCell(base, cellData, startRowIndex, startCellIndex) { + var colspan = cellData.colspan, + rowspan = cellData.rowspan, + nodeName = cellData.nodeName; + + var colMerged = colspan > 1; + var rowMerged = rowspan > 1; + + if (!colMerged && !rowMerged) { + return; + } + + var limitRowIndex = startRowIndex + rowspan; + var limitCellIndex = startCellIndex + colspan; + + _tuiCodeSnippet2.default.range(startRowIndex, limitRowIndex).forEach(function (rowIndex) { + base[rowIndex] = base[rowIndex] || []; + + _tuiCodeSnippet2.default.range(startCellIndex, limitCellIndex).forEach(function (cellIndex) { + var mergedData = { + nodeName: nodeName + }; + + if (rowIndex === startRowIndex && cellIndex === startCellIndex) { + return; + } + + if (colMerged) { + mergedData.colMergeWith = startCellIndex; + } + + if (rowMerged) { + mergedData.rowMergeWith = startRowIndex; + } + + base[rowIndex][cellIndex] = mergedData; + }); + }); +} + +/** + * Create table data from jQuery table Element. + * @param {jQuery} $table - jQuery table element + * @returns {Array.>} + * @ignore + */ +function createTableData($table) { + var tableData = []; + + $table.find('tr').each(function (rowIndex, tr) { + var stackedColCount = 0; + + tableData[rowIndex] = tableData[rowIndex] || []; + + (0, _jquery2.default)(tr).children().each(function (colIndex, cell) { + var cellData = _parseCell(cell, rowIndex, colIndex); + + if (!cellData) { + return; + } + var dataColIndex = colIndex + stackedColCount; + + while (tableData[rowIndex][dataColIndex]) { + dataColIndex += 1; + stackedColCount += 1; + } + + tableData[rowIndex][dataColIndex] = cellData; + _addMergedCell(tableData, cellData, rowIndex, dataColIndex); + }); + }); + + if ($table[0].className) { + tableData.className = $table[0].className; + } + + return tableData; +} + +/** + * Create cell index data of table data. + * @param {Array.>} tableData - table data + * @returns {Array.>} + * @ignore + */ +function createCellIndexData(tableData) { + var mappingData = []; + + tableData.forEach(function (row, rowIndex) { + var mappingRow = []; + + row.forEach(function (cell, colIndex) { + if (_tuiCodeSnippet2.default.isUndefined(cell.colMergeWith) && _tuiCodeSnippet2.default.isUndefined(cell.rowMergeWith)) { + mappingRow.push({ + rowIndex: rowIndex, + colIndex: colIndex + }); + } + }); + mappingData.push(mappingRow); + }); + + return mappingData; +} + +/** + * Get header aligns. + * @param {Array.>} tableData - table data + * @returns {Array.} + * @private + */ +function _getHeaderAligns(tableData) { + var headRowData = tableData[0]; + + + return headRowData.map(function (cellData) { + var align = void 0; + + if (_tuiCodeSnippet2.default.isExisty(cellData.colMergeWith)) { + align = headRowData[cellData.colMergeWith].align; + } else { + align = cellData.align; + } + + return align; + }); +} + +/** + * Create render data. + * @param {Array.} tableData - table data + * @param {Array.} cellIndexData - cell index data + * @returns {Array.>} + * @ignore + */ +function createRenderData(tableData, cellIndexData) { + var headerAligns = _getHeaderAligns(tableData); + var renderData = cellIndexData.map(function (row) { + return row.map(function (_ref) { + var rowIndex = _ref.rowIndex, + colIndex = _ref.colIndex; + return _tuiCodeSnippet2.default.extend({ + align: headerAligns[colIndex] + }, tableData[rowIndex][colIndex]); + }); + }); + + if (tableData.className) { + renderData.className = tableData.className; + } + + return renderData; +} + +var BASIC_CELL_CONTENT = _tuiCodeSnippet2.default.browser.msie ? '' : '
'; + +/** + * Create basic cell data. + * @param {number} rowIndex - row index + * @param {number} colIndex - column index + * @param {string} nodeName - node name + * @returns {{ + * nodeName: string, + * colspan: number, + * rowspan: number, + * content: string + * }} + * @ignore + */ +function createBasicCell(rowIndex, colIndex, nodeName) { + return { + nodeName: nodeName || 'TD', + colspan: 1, + rowspan: 1, + content: BASIC_CELL_CONTENT, + elementIndex: { + rowIndex: rowIndex, + colIndex: colIndex + } + }; +} + +/** + * Find element row index. + * @param {jQuery} $cell - cell jQuery element like td or th + * @returns {number} + * @ignore + */ +function findElementRowIndex($cell) { + var $tr = $cell.closest('tr'); + var rowIndex = $tr.prevAll().length; + + if ($tr.parent()[0].nodeName === 'TBODY') { + rowIndex += 1; + } + + return rowIndex; +} + +/** + * Find element col index. + * @param {jQuery} $cell - cell jQuery element like td or th + * @returns {number} + * @ignore + */ +function findElementColIndex($cell) { + return $cell.closest('td, th').prevAll().length; +} + +/** + * Find indexes of base table data from mappin data. + * @param {Array.>} cellIndexData - cell index data + * @param {jQuery} $cell - cell jQuery element like td or th + * @returns {{rowIndex: number, cellIndex: number}} + * @ignore + */ +function findCellIndex(cellIndexData, $cell) { + var elementRowIndex = findElementRowIndex($cell); + var elementColIndex = findElementColIndex($cell); + + return cellIndexData[elementRowIndex][elementColIndex]; +} + +/** + * Find last index of col merged cells. + * @param {Array.>} tableData - tableData data + * @param {number} rowIndex - row index of base data + * @param {number} colIndex - column index of tabld data + * @returns {number} + * @ignore + */ +function findRowMergedLastIndex(tableData, rowIndex, colIndex) { + var cellData = tableData[rowIndex][colIndex]; + var foundRowIndex = rowIndex; + + if (cellData.rowspan > 1) { + foundRowIndex += cellData.rowspan - 1; + } + + return foundRowIndex; +} + +/** + * Find last index of col merged cells. + * @param {Array.>} tableData - tableData data + * @param {number} rowIndex - row index of base data + * @param {number} colIndex - column index of tabld data + * @returns {number} + * @ignore + */ +function findColMergedLastIndex(tableData, rowIndex, colIndex) { + var cellData = tableData[rowIndex][colIndex]; + var foundColIndex = colIndex; + + if (cellData.colspan > 1) { + foundColIndex += cellData.colspan - 1; + } + + return foundColIndex; +} + +/** + * Find cell element index. + * @param {Array.>} tableData - tableData data + * @param {number} rowIndex - row index of base data + * @param {number} colIndex - col index of base data + * @returns {{rowIndex: number, colIndex: number}} + * @ignore + */ +function findElementIndex(tableData, rowIndex, colIndex) { + var cellData = tableData[rowIndex][colIndex]; + + rowIndex = _tuiCodeSnippet2.default.isExisty(cellData.rowMergeWith) ? cellData.rowMergeWith : rowIndex; + colIndex = _tuiCodeSnippet2.default.isExisty(cellData.colMergeWith) ? cellData.colMergeWith : colIndex; + + return tableData[rowIndex][colIndex].elementIndex; +} + +/** + * Stuff cells into incomplete row. + * @param {Array.>} tableData - table data + * @param {number} limitIndex - limit index + * @ignore + */ +function stuffCellsIntoIncompleteRow(tableData, limitIndex) { + tableData.forEach(function (rowData, rowIndex) { + var startIndex = rowData.length; + if (startIndex) { + var nodeName = rowData[0].nodeName; + + + _tuiCodeSnippet2.default.range(startIndex, limitIndex).forEach(function (colIndex) { + rowData.push(createBasicCell(rowIndex, colIndex, nodeName)); + }); + } + }); +} + +/** + * Add tbody or thead of table data if need. + * @param {Array.>} tableData - table data + * @returns {boolean} + * @ignore + */ +function addTbodyOrTheadIfNeed(tableData) { + var header = tableData[0]; + + var cellCount = header.length; + var added = true; + + if (!cellCount && tableData[1]) { + _tuiCodeSnippet2.default.range(0, tableData[1].length).forEach(function (colIndex) { + header.push(createBasicCell(0, colIndex, 'TH')); + }); + } else if (tableData[0][0].nodeName !== 'TH') { + var _ref2; + + var newHeader = _tuiCodeSnippet2.default.range(0, cellCount).map(function (colIndex) { + return createBasicCell(0, colIndex, 'TH'); + }); + + (_ref2 = []).concat.apply(_ref2, tableData).forEach(function (cellData) { + if (cellData.elementIndex) { + cellData.elementIndex.rowIndex += 1; + } + }); + + tableData.unshift(newHeader); + } else if (tableData.length === 1) { + var newRow = _tuiCodeSnippet2.default.range(0, cellCount).map(function (colIndex) { + return createBasicCell(1, colIndex, 'TD'); + }); + + tableData.push(newRow); + } else { + added = false; + } + + return added; +} + +exports.default = { + createTableData: createTableData, + createCellIndexData: createCellIndexData, + createRenderData: createRenderData, + findElementRowIndex: findElementRowIndex, + findElementColIndex: findElementColIndex, + findCellIndex: findCellIndex, + createBasicCell: createBasicCell, + findRowMergedLastIndex: findRowMergedLastIndex, + findColMergedLastIndex: findColMergedLastIndex, + findElementIndex: findElementIndex, + stuffCellsIntoIncompleteRow: stuffCellsIntoIncompleteRow, + addTbodyOrTheadIfNeed: addTbodyOrTheadIfNeed +}; + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _uicontroller = __webpack_require__(14); + +var _uicontroller2 = _interopRequireDefault(_uicontroller); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview Implements LayerPopup + * @author NHN FE Development Lab + */ + + +var CLASS_PREFIX = 'tui-popup-'; +var CLASS_FIT_WINDOW = 'fit-window'; + +var LAYOUT_TEMPLATE_MODELESS = '
\n \n
\n \n
\n
\n
'; + +var LAYOUT_TEMPLATE_MODAL = '
\n
\n \n
\n \n
\n
\n
\n
'; + +/** + * A number, or a string containing a number. + * @typedef {object} LayerPopupOption + * @property {string[]} [openerCssQuery] - Css Query list to bind clickevent that open popup + * @property {string[]} [closerCssQuery] - Css Query list to bind clickevent that close popup + * @property {jQuery} $el - popup root element + * @property {jQuery|string} [content] - popup content that html string or jQuery element + * @property {string} [textContent] - popup text content + * @property {string} title - popup title + * @property {boolean} [header] - whether to draw header + * @property {jQuery} [$target] - element to append popup + * @property {boolean} modal - true: modal, false: modeless + * @property {string} [headerButtons] - replace header(close) button + */ + +/** + * Class LayerPopup + * @param {LayerPopupOption} options - popup option + */ + +var LayerPopup = function (_UIController) { + _inherits(LayerPopup, _UIController); + + function LayerPopup(options) { + _classCallCheck(this, LayerPopup); + + options = _tuiCodeSnippet2.default.extend({ + header: true, + $target: (0, _jquery2.default)('body'), + textContent: '' + }, options); + + var _this = _possibleConstructorReturn(this, (LayerPopup.__proto__ || Object.getPrototypeOf(LayerPopup)).call(this, { + tagName: 'div', + className: options.modal ? CLASS_PREFIX + 'modal-background' : CLASS_PREFIX + 'wrapper', + rootElement: options.$el + })); + + _this._initInstance(options); + _this._initDOM(options); + _this._initDOMEvent(options); + _this._initEditorEvent(options); + return _this; + } + + /** + * init instance. + * store properties & prepare before initialize DOM + * @param {LayerPopupOption} options - layer popup options + * @private + */ + + + _createClass(LayerPopup, [{ + key: '_initInstance', + value: function _initInstance(options) { + this._$target = options.$target; + + if (options.$el) { + this.$el = options.$el; + this._isExternalHtmlUse = true; + } + + if (options.content) { + this.$content = (0, _jquery2.default)(options.content); + } else { + this.$content = options.textContent; + } + + this.options = options; + } + + /** + * initialize DOM, render popup + * @private + */ + + }, { + key: '_initDOM', + value: function _initDOM() { + this._initLayout(); + + if (!this._isExternalHtmlUse) { + if (_tuiCodeSnippet2.default.isExisty(this.options.title)) { + this.setTitle(this.options.title); + } + this.setContent(this.$content); + } + + var buttons = this.options.headerButtons; + if (buttons) { + this.$el.find('.' + CLASS_PREFIX + 'close-button').remove(); + + var $buttonWrapper = this.$el.find('.' + CLASS_PREFIX + 'header-buttons'); + $buttonWrapper.empty(); + $buttonWrapper.append((0, _jquery2.default)(buttons)); + } + + if (this.options.css) { + this.$el.css(this.options.css); + } + } + + /** + * bind DOM events + * @private + */ + + }, { + key: '_initDOMEvent', + value: function _initDOMEvent() { + var _this2 = this; + + var _options = this.options, + openerCssQuery = _options.openerCssQuery, + closerCssQuery = _options.closerCssQuery; + + if (openerCssQuery) { + (0, _jquery2.default)(openerCssQuery).on('click.' + this._id, function () { + return _this2.show(); + }); + } + if (closerCssQuery) { + (0, _jquery2.default)(closerCssQuery).on('click.' + this._id, function () { + return _this2.hide(); + }); + } + + this.on('click .' + CLASS_PREFIX + 'close-button', function () { + return _this2.hide(); + }); + } + + /** + * bind editor events + * @private + * @abstract + */ + + }, { + key: '_initEditorEvent', + value: function _initEditorEvent() {} + }, { + key: '_initLayout', + value: function _initLayout() { + var options = this.options; + + + if (!this._isExternalHtmlUse) { + var layout = options.modal ? LAYOUT_TEMPLATE_MODAL : LAYOUT_TEMPLATE_MODELESS; + this.$el.html(layout); + this.$el.addClass(options.className); + this.hide(); + this._$target.append(this.$el); + this.$body = this.$el.find('.' + CLASS_PREFIX + 'body'); + + if (!options.header) { + this.$el.find('.' + CLASS_PREFIX + 'header').remove(); + } + } else { + this.hide(); + this._$target.append(this.$el); + } + } + + /** + * set popup content + * @param {jQuery|HTMLElement|string} $content - content + */ + + }, { + key: 'setContent', + value: function setContent($content) { + this.$body.empty(); + this.$body.append($content); + } + + /** + * set title + * @param {string} title - title text + */ + + }, { + key: 'setTitle', + value: function setTitle(title) { + var $title = this.$el.find('.' + CLASS_PREFIX + 'title'); + + $title.empty(); + $title.append(title); + } + + /** + * get title element + * @returns {HTMLElement} - title html element + */ + + }, { + key: 'getTitleElement', + value: function getTitleElement() { + return this.$el.find('.' + CLASS_PREFIX + 'title').get(0); + } + + /** + * hide popup + */ + + }, { + key: 'hide', + value: function hide() { + this.$el.css('display', 'none'); + this._isShow = false; + this.trigger('hidden', this); + } + + /** + * show popup + */ + + }, { + key: 'show', + value: function show() { + this.$el.css('display', 'block'); + this._isShow = true; + this.trigger('shown', this); + } + + /** + * whether this popup is visible + * @returns {boolean} - true: shown, false: hidden + */ + + }, { + key: 'isShow', + value: function isShow() { + return this._isShow; + } + + /** + * remove popup content + */ + + }, { + key: 'remove', + value: function remove() { + var _options2 = this.options, + openerCssQuery = _options2.openerCssQuery, + closerCssQuery = _options2.closerCssQuery; + + + this.trigger('remove', this); + this.off(); + + if (openerCssQuery) { + (0, _jquery2.default)(openerCssQuery).off('.' + this._id); + } + if (closerCssQuery) { + (0, _jquery2.default)(closerCssQuery).off('.' + this._id); + } + + this.$el.remove(); + this.$el = null; + } + + /** + * make popup size fit to window + * @param {boolean} fit - true to make popup fit to window + * @protected + * @ignore + */ + + }, { + key: 'setFitToWindow', + value: function setFitToWindow(fit) { + this.$el.toggleClass(CLASS_FIT_WINDOW, fit); + } + + /** + * make popup size fit to window + * @returns {boolean} - true for fit to window + * @protected + * @ignore + */ + + }, { + key: 'isFitToWindow', + value: function isFitToWindow() { + return this.$el.hasClass(CLASS_FIT_WINDOW); + } + + /** + * toggle size fit to window + * @returns {boolean} - true for fit to window + * @protected + * @ignore + */ + + }, { + key: 'toggleFitToWindow', + value: function toggleFitToWindow() { + var fitToWindow = !this.isFitToWindow(); + this.setFitToWindow(fitToWindow); + + return fitToWindow; + } + }]); + + return LayerPopup; +}(_uicontroller2.default); + +exports.default = LayerPopup; + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tableDataHandler = __webpack_require__(6); + +var _tableDataHandler2 = _interopRequireDefault(_tableDataHandler); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Create cell html. + * @param {object} cell - cell data of table base data + * @returns {string} + * @private + */ +/** +* @fileoverview Implements tableRenderer +* @author NHN FE Development Lab +*/ +function _createCellHtml(cell) { + var attrs = cell.colspan > 1 ? ' colspan="' + cell.colspan + '"' : ''; + attrs += cell.rowspan > 1 ? ' rowspan="' + cell.rowspan + '"' : ''; + attrs += cell.align ? ' align="' + cell.align + '"' : ''; + + return '<' + cell.nodeName + attrs + '>' + cell.content + ''; +} + +/** + * Create html for thead or tbody. + * @param {Array.>} trs - tr list + * @param {string} wrapperNodeName - wrapper node name like THEAD, TBODY + * @returns {string} + * @private + */ +function _createTheadOrTbodyHtml(trs, wrapperNodeName) { + var html = ''; + + if (trs.length) { + html = trs.map(function (tr) { + var tdHtml = tr.map(_createCellHtml).join(''); + + return '' + tdHtml + ''; + }).join(''); + html = '<' + wrapperNodeName + '>' + html + ''; + } + + return html; +} + +/** + * Create table html. + * @param {Array.>} renderData - table data for render + * @returns {string} + * @private + */ +function createTableHtml(renderData) { + var thead = renderData[0] ? [renderData[0]] : []; + var tbody = renderData.slice(1); + var theadHtml = _createTheadOrTbodyHtml(thead, 'THEAD'); + var tbodyHtml = _createTheadOrTbodyHtml(tbody, 'TBODY'); + var className = renderData.className ? ' class="' + renderData.className + '"' : ''; + + return '' + (theadHtml + tbodyHtml) + ''; +} + +/** + * Replace table. + * @param {jQuery} $table - table jQuery element + * @param {Array.>} tableData - table data + * @returns {jQuery} + * @ignore + */ +function replaceTable($table, tableData) { + var cellIndexData = _tableDataHandler2.default.createCellIndexData(tableData); + var renderData = _tableDataHandler2.default.createRenderData(tableData, cellIndexData); + var $newTable = (0, _jquery2.default)(createTableHtml(renderData)); + + $table.replaceWith($newTable); + + return $newTable; +} + +/** + * Focus to cell. + * @param {squireext} sq - squire instance + * @param {range} range - range object + * @param {HTMLElement} targetCell - cell element for focus + * @ignore + */ +function focusToCell(sq, range, targetCell) { + range.selectNodeContents(targetCell); + range.collapse(true); + sq.setSelection(range); +} + +exports.default = { + createTableHtml: createTableHtml, + replaceTable: replaceTable, + focusToCell: focusToCell +}; + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _tableDataHandler = __webpack_require__(6); + +var _tableDataHandler2 = _interopRequireDefault(_tableDataHandler); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Find unmerged table range. + * @param {Array.>} tableData - table data + * @param {jQuery} $start - start talbe cell jQuery element + * @param {jQuery} $end - end table cell jQuery element + * @returns {{ + * start: {rowIndex: number, colIndex: number}, + * end: {rowIndex: number, colIndex: number} + * }} + * @private + */ +function _findUnmergedRange(tableData, $start, $end) { + var cellIndexData = _tableDataHandler2.default.createCellIndexData(tableData); + var startCellIndex = _tableDataHandler2.default.findCellIndex(cellIndexData, $start); + var endCellIndex = _tableDataHandler2.default.findCellIndex(cellIndexData, $end); + var startRowIndex = void 0, + endRowIndex = void 0, + startColIndex = void 0, + endColIndex = void 0; + + if (startCellIndex.rowIndex > endCellIndex.rowIndex) { + startRowIndex = endCellIndex.rowIndex; + endRowIndex = startCellIndex.rowIndex; + } else { + startRowIndex = startCellIndex.rowIndex; + endRowIndex = endCellIndex.rowIndex; + } + + if (startCellIndex.colIndex > endCellIndex.colIndex) { + startColIndex = endCellIndex.colIndex; + endColIndex = startCellIndex.colIndex; + } else { + startColIndex = startCellIndex.colIndex; + endColIndex = endCellIndex.colIndex; + } + + return { + start: { + rowIndex: startRowIndex, + colIndex: startColIndex + }, + end: { + rowIndex: endRowIndex, + colIndex: endColIndex + } + }; +} + +/** + * Expand table range by row merge properties like rowspan, rowMergeWith. + * @param {Array.>} tableData - table data + * @param {{ + * start: {rowIndex: number, colIndex: number}, + * end: {rowIndex: number, colIndex: number} + * }} tableRange - table range + * @param {string} rangeType - range type like start, end + * @private + */ +/** +* @fileoverview Implements tableRangeHandler +* @author NHN FE Development Lab +*/ +function _expandRowMergedRange(tableData, tableRange, rangeType) { + var rowIndex = tableRange[rangeType].rowIndex; + + var rowData = tableData[rowIndex]; + + _tuiCodeSnippet2.default.range(tableRange.start.colIndex, tableRange.end.colIndex + 1).forEach(function (colIndex) { + var cellData = rowData[colIndex]; + var rowMergeWith = cellData.rowMergeWith; + + var lastRowMergedIndex = -1; + + if (_tuiCodeSnippet2.default.isExisty(rowMergeWith)) { + if (rowMergeWith < tableRange.start.rowIndex) { + tableRange.start.rowIndex = rowMergeWith; + } + + lastRowMergedIndex = rowMergeWith + tableData[rowMergeWith][colIndex].rowspan - 1; + } else if (cellData.rowspan > 1) { + lastRowMergedIndex = rowIndex + cellData.rowspan - 1; + } + + if (lastRowMergedIndex > tableRange.end.rowIndex) { + tableRange.end.rowIndex = lastRowMergedIndex; + } + }); +} + +/** + * Expand table range by column merge properties like colspan, colMergeWith. + * @param {Array.>} tableData - table data + * @param {{ + * start: {rowIndex: number, colIndex: number}, + * end: {rowIndex: number, colIndex: number} + * }} tableRange - table range + * @param {number} rowIndex - row index + * @param {number} colIndex - column index + * @private + */ +function _expandColMergedRange(tableData, tableRange, rowIndex, colIndex) { + var rowData = tableData[rowIndex]; + var cellData = rowData[colIndex]; + var colMergeWith = cellData.colMergeWith; + + var lastColMergedIndex = -1; + + if (_tuiCodeSnippet2.default.isExisty(colMergeWith)) { + if (colMergeWith < tableRange.start.colIndex) { + tableRange.start.colIndex = colMergeWith; + } + + lastColMergedIndex = colMergeWith + rowData[colMergeWith].colspan - 1; + } else if (cellData.colspan > 1) { + lastColMergedIndex = colIndex + cellData.colspan - 1; + } + + if (lastColMergedIndex > tableRange.end.colIndex) { + tableRange.end.colIndex = lastColMergedIndex; + } +} + +/** + * Expand table range by merge properties like colspan, rowspan. + * @param {Array.>} tableData - table data + * @param {{ + * start: {rowIndex: number, colIndex: number}, + * end: {rowIndex: number, colIndex: number} + * }} tableRange - table range + * @returns {{ + * start: {rowIndex: number, colIndex: number}, + * end: {rowIndex: number, colIndex: number} + * }} + * @private + */ +function _expandMergedRange(tableData, tableRange) { + var rangeStr = ''; + + while (rangeStr !== JSON.stringify(tableRange)) { + rangeStr = JSON.stringify(tableRange); + + _expandRowMergedRange(tableData, tableRange, 'start'); + _expandRowMergedRange(tableData, tableRange, 'end'); + + _tuiCodeSnippet2.default.range(tableRange.start.rowIndex, tableRange.end.rowIndex + 1).forEach(function (rowIndex) { + _expandColMergedRange(tableData, tableRange, rowIndex, tableRange.start.colIndex); + _expandColMergedRange(tableData, tableRange, rowIndex, tableRange.end.colIndex); + }); + } + + return tableRange; +} + +/** + * Find table range for selection. + * @param {Array.>} tableData - table data + * @param {jQuery} $start - start jQuery element + * @param {jQuery} $end - end jQuery element + * @returns {{ + * start: {rowIndex: number, colIndex: number}, + * end: {rowIndex: number, colIndex: number} + * }} + * @ignore + */ +function findSelectionRange(tableData, $start, $end) { + var unmergedRange = _findUnmergedRange(tableData, $start, $end); + + return _expandMergedRange(tableData, unmergedRange); +} + +/** + * Get table selection range. + * @param {Array.>} tableData - table data + * @param {jQuery} $selectedCells - selected cells jQuery elements + * @param {jQuery} $startContainer - start container jQuery element of text range + * @returns {{ + * start: {rowIndex: number, colIndex: number}, + * end: {rowIndex: number, colIndex: number} + *}} + * @ignore + */ +function getTableSelectionRange(tableData, $selectedCells, $startContainer) { + var cellIndexData = _tableDataHandler2.default.createCellIndexData(tableData); + var tableRange = {}; + + if ($selectedCells.length) { + var startRange = _tableDataHandler2.default.findCellIndex(cellIndexData, $selectedCells.first()); + var endRange = _tuiCodeSnippet2.default.extend({}, startRange); + + $selectedCells.each(function (index, cell) { + var cellIndex = _tableDataHandler2.default.findCellIndex(cellIndexData, (0, _jquery2.default)(cell)); + var cellData = tableData[cellIndex.rowIndex][cellIndex.colIndex]; + var lastRowMergedIndex = cellIndex.rowIndex + cellData.rowspan - 1; + var lastColMergedIndex = cellIndex.colIndex + cellData.colspan - 1; + + endRange.rowIndex = Math.max(endRange.rowIndex, lastRowMergedIndex); + endRange.colIndex = Math.max(endRange.colIndex, lastColMergedIndex); + }); + + tableRange.start = startRange; + tableRange.end = endRange; + } else { + var cellIndex = _tableDataHandler2.default.findCellIndex(cellIndexData, $startContainer); + + tableRange.start = cellIndex; + tableRange.end = _tuiCodeSnippet2.default.extend({}, cellIndex); + } + + return tableRange; +} + +exports.default = { + findSelectionRange: findSelectionRange, + getTableSelectionRange: getTableSelectionRange +}; + +/***/ }), +/* 10 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__10__; + +/***/ }), +/* 11 */ +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || new Function("return this")(); +} catch (e) { + // This works if the window reference is available + if (typeof window === "object") g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + + + +/**/ + +var pna = __webpack_require__(19); +/**/ + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + }return keys; +}; +/**/ + +module.exports = Duplex; + +/**/ +var util = __webpack_require__(16); +util.inherits = __webpack_require__(13); +/**/ + +var Readable = __webpack_require__(48); +var Writable = __webpack_require__(29); + +util.inherits(Duplex, Readable); + +{ + // avoid scope creep, the keys array can then be collected + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} + +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) this.readable = false; + + if (options && options.writable === false) this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; + + this.once('end', onend); +} + +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + } +}); + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + pna.nextTick(onEndNT, this); +} + +function onEndNT(self) { + self.end(); +} + +Object.defineProperty(Duplex.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); + +Duplex.prototype._destroy = function (err, cb) { + this.push(null); + this.end(); + + pna.nextTick(cb, err); +}; + +/***/ }), +/* 13 */ +/***/ (function(module, exports) { + +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} + + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * @fileoverview Implements ui controller + * @author NHN FE Development Lab + */ + + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var _uiInstanceId = -1; + +/** + * get ui instance id + * @returns {number} - new instance id + * @ignore + */ +function makeUIInstanceId() { + _uiInstanceId += 1; + + return _uiInstanceId; +} + +/** + * Class UIController + * @param {Object} [options] - options + * @param {jQuery} [options.rootElement] - root element + * @param {string} [options.tagName] - tag name + * @param {string} [options.className] - class name + */ + +var UIController = function () { + + /** + * UI jQuery element + * @type {Object} + */ + + /** + * tag name + * @type {string} + */ + function UIController() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + _classCallCheck(this, UIController); + + options = _tuiCodeSnippet2.default.extend({ + tagName: 'div' + }, options); + + this.tagName = options.tagName; + + this.className = options.className; + + this._id = makeUIInstanceId(); + + this._setRootElement(options.rootElement); + } + + /** + * @param {string|object} aType - event name and selector string + * @param {function} aFn - event handler + */ + + + /** + * UI Id + * @type {number} + * @private + */ + + + /** + * ui controller class name + * @type {string} + */ + + + _createClass(UIController, [{ + key: 'on', + value: function on(aType, aFn) { + var _this = this; + + if (_tuiCodeSnippet2.default.isObject(aType)) { + _tuiCodeSnippet2.default.forEach(aType, function (fn, type) { + _this._addEvent(type, fn); + }); + } else { + this._addEvent(aType, aFn); + } + } + + /** + * bind event + * @param {string} type - event name and selector + * @param {function} fn - handler function + * @private + */ + + }, { + key: '_addEvent', + value: function _addEvent(type, fn) { + var _parseEventType2 = this._parseEventType(type), + event = _parseEventType2.event, + selector = _parseEventType2.selector; + + if (selector) { + this.$el.on(event, selector, fn); + } else { + this.$el.on(event, fn); + } + } + + /** + * unbind event handler + * @param {string} type - event name and selector + * @param {function} fn - handler function + */ + + }, { + key: 'off', + value: function off(type, fn) { + if (type) { + var _parseEventType3 = this._parseEventType(type), + event = _parseEventType3.event, + selector = _parseEventType3.selector; + + if (selector) { + this.$el.off(event, selector, fn); + } else { + this.$el.off(event, fn); + } + } else { + this.$el.off(); + } + } + + /** + * parse string into event name & selector + * 'click td' => ['click', 'td] + * @param {string} type - string to be parsed + * @returns {Object} event, selector + * @private + */ + + }, { + key: '_parseEventType', + value: function _parseEventType(type) { + var splitType = type.split(' '); + var event = splitType.shift(); + var selector = splitType.join(' '); + + return { + event: event, + selector: selector + }; + } + + /** + * set root element + * @param {jQuery} $el - root jQuery element + * @private + */ + + }, { + key: '_setRootElement', + value: function _setRootElement($el) { + var tagName = this.tagName; + var className = this.className; + + + if (!$el) { + className = className || 'uic' + this._id; + $el = (0, _jquery2.default)('<' + tagName + ' class="' + className + '"/>'); + } + this.$el = $el; + } + + /** + * trigger event + * @param {...object} args - event name & extra params + */ + + }, { + key: 'trigger', + value: function trigger() { + var _$el; + + (_$el = this.$el).trigger.apply(_$el, arguments); + } + }, { + key: '_getEventNameWithNamespace', + value: function _getEventNameWithNamespace(event) { + var eventSplited = event.split(' '); + eventSplited[0] += '.uicEvent' + this._id; + + return eventSplited.join(' '); + } + + /** + * remove + */ + + }, { + key: 'remove', + value: function remove() { + if (this.$el) { + this.$el.remove(); + } + } + + /** + * destroy + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + this.remove(); + + _tuiCodeSnippet2.default.forEachOwnProperties(this, function (value, key) { + _this2[key] = null; + }); + } + }]); + + return UIController; +}(); + +exports.default = UIController; + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * @fileoverview Implement Module for managing import external data such as image + * @author NHN FE Development Lab + */ + + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var URLRegex = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})(\/([^\s]*))?$/g; + +/** + * Class ImportManager + * @param {EventManager} eventManager - eventManager + * @ignore + */ + +var ImportManager = function () { + function ImportManager(eventManager) { + _classCallCheck(this, ImportManager); + + this.eventManager = eventManager; + + this._initEvent(); + this._initDefaultImageImporter(); + } + + /** + * graceful decode uri component + * @param {string} originalURI - string to be decoded + * @returns {string} decoded string + * @static + */ + + + _createClass(ImportManager, [{ + key: '_initEvent', + + + /** + * Initialize event handler + * @private + */ + value: function _initEvent() { + var _this = this; + + this.eventManager.listen('drop', function (ev) { + var items = ev.data.dataTransfer && ev.data.dataTransfer.files; + _this._processBlobItems(items, ev.data); + }); + + this.eventManager.listen('willPaste', function (ev) { + // IE has no interface to handle clipboard image. #976 + var fragment = ev.data.fragment; + var descendant = fragment.querySelectorAll('*'); + // only if paste event data has one img element and the element has base64 encoded image + if (descendant.length !== 1 || descendant[0].tagName !== 'IMG' || !/^data:image/.test(descendant[0].src)) { + return; + } + ev.data.preventDefault(); + + var blob = dataURItoBlob(descendant[0].src); + _this._emitAddImageBlobHook(blob, 'paste'); + }); + + this.eventManager.listen('paste', function (ev) { + _this._processClipboard(ev.data); + }); + + this.eventManager.listen('pasteBefore', function (ev) { + _this._decodeURL(ev); + }); + } + + /** + * Initialize default image importer + * @private + */ + + }, { + key: '_initDefaultImageImporter', + value: function _initDefaultImageImporter() { + this.eventManager.listen('addImageBlobHook', function (blob, callback) { + var reader = new FileReader(); + + reader.onload = function (event) { + callback(event.target.result); + }; + + reader.readAsDataURL(blob); + }); + } + + /** + * Emit add image blob hook + * @param {object} blob - blob or file + * @param {string} type - type of an event the item belongs to. paste or drop + * @private + */ + + }, { + key: '_emitAddImageBlobHook', + value: function _emitAddImageBlobHook(blob, type) { + var _this2 = this; + + this.eventManager.emit('addImageBlobHook', blob, function (imageUrl, altText) { + _this2.eventManager.emit('command', 'AddImage', { + imageUrl: imageUrl, + altText: altText || blob.name || 'image' + }); + }, type); + } + + /** + * Decode url when paste link + * @param {object} ev - event object + * @private + */ + + }, { + key: '_decodeURL', + value: function _decodeURL(ev) { + var decodeURIGraceful = ImportManager.decodeURIGraceful, + encodeMarkdownCharacters = ImportManager.encodeMarkdownCharacters; + + + if (ev.source === 'markdown' && ev.data.text) { + var texts = ev.data.text; + var text = texts[0]; + if (texts.length === 1 && text.match(URLRegex)) { + text = decodeURIGraceful(text); + text = encodeMarkdownCharacters(text); + ev.data.update(null, null, [text]); + } + } else if (ev.source === 'wysiwyg') { + var container = ev.$clipboardContainer.get(0); + var firstChild = container.childNodes[0]; + var _text = firstChild.innerText; + if (container.childNodes.length === 1 && firstChild.tagName === 'A' && _text.match(URLRegex)) { + firstChild.innerText = decodeURIGraceful(_text); + firstChild.href = encodeMarkdownCharacters(firstChild.href); + } + } + } + + /** + * Get blob or excel data from clipboard + * @param {object} evData Clipboard data + * @private + */ + + }, { + key: '_processClipboard', + value: function _processClipboard(evData) { + var cbData = evData.clipboardData || window.clipboardData; + var blobItems = cbData && cbData.items; + var types = cbData.types; + + + if (blobItems && types && types.length === 1 && _tuiCodeSnippet2.default.inArray('Files', [].slice.call(types)) !== -1) { + this._processBlobItems(blobItems, evData); + } + } + + /** + * Process for blob item + * @param {Array.} items Item array + * @param {object} evData Event data + * @private + */ + + }, { + key: '_processBlobItems', + value: function _processBlobItems(items, evData) { + var _this3 = this; + + if (items) { + _tuiCodeSnippet2.default.forEachArray(items, function (item) { + if (item.type.indexOf('image') !== -1) { + evData.preventDefault(); + evData.stopPropagation(); + evData.codemirrorIgnore = true; + + var blob = item.name ? item : item.getAsFile(); // Blob or File + _this3._emitAddImageBlobHook(blob, evData.type); + + return false; + } + + return true; + }); + } + } + }], [{ + key: 'decodeURIGraceful', + value: function decodeURIGraceful(originalURI) { + var uris = originalURI.split(' '); + var decodedURIs = []; + var decodedURI = void 0; + + _tuiCodeSnippet2.default.forEachArray(uris, function (uri) { + try { + decodedURI = decodeURIComponent(uri); + decodedURI = decodedURI.replace(/ /g, '%20'); + } catch (e) { + decodedURI = uri; + } + + return decodedURIs.push(decodedURI); + }); + + return decodedURIs.join(' '); + } + + /** + * encode markdown critical characters + * @param {string} text - string to encode + * @returns {string} - markdown character encoded string + * @static + */ + + }, { + key: 'encodeMarkdownCharacters', + value: function encodeMarkdownCharacters(text) { + return text.replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\[/g, '%5B').replace(/\]/g, '%5D').replace(//g, '%3E'); + } + + /** + * escape markdown critical characters + * @param {string} text - string to escape + * @returns {string} - markdown character escaped string + * @static + */ + + }, { + key: 'escapeMarkdownCharacters', + value: function escapeMarkdownCharacters(text) { + return text.replace(/\(/g, '\\(').replace(/\)/g, '\\)').replace(/\[/g, '\\[').replace(/\]/g, '\\]').replace(//g, '\\>'); + } + }]); + + return ImportManager; +}(); + +/** + * data URI to Blob + * @param {string} dataURI - data URI string + * @returns {Blob} - blob data + * @ignore + */ + + +function dataURItoBlob(dataURI) { + var byteString = atob(dataURI.split(',')[1]); + var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; + var ab = new ArrayBuffer(byteString.length); + var ia = new Uint8Array(ab); + for (var i = 0; i < byteString.length; i += 1) { + ia[i] = byteString.charCodeAt(i); + } + var blob = new Blob([ab], { type: mimeString }); + + return blob; +} + +exports.default = ImportManager; + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(51).Buffer)) + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _uicontroller = __webpack_require__(14); + +var _uicontroller2 = _interopRequireDefault(_uicontroller); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview Implements Toolbar Item + * @author NHN FE Development Lab + */ + + +/** + * Class ToolbarItem + * @param {Object} [options={name: 'toolbar-item'}] [description] + */ +var ToolbarItem = function (_UIController) { + _inherits(ToolbarItem, _UIController); + + /** + * item name + * @type {String} + * @static + * @private + */ + function ToolbarItem() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { + name: ToolbarItem.name + }; + + _classCallCheck(this, ToolbarItem); + + var _this = _possibleConstructorReturn(this, (ToolbarItem.__proto__ || Object.getPrototypeOf(ToolbarItem)).call(this, _tuiCodeSnippet2.default.extend({ + className: ToolbarItem.className + }, options))); + + _this._name = options.name; + return _this; + } + + /** + * get the name of the toolbar item + * @returns {string} - the name of the toolbar item + */ + + + /** + * toolbar item class name + * @type {String} + * @static + * @private + */ + + + _createClass(ToolbarItem, [{ + key: 'getName', + value: function getName() { + return this._name; + } + }]); + + return ToolbarItem; +}(_uicontroller2.default); + +Object.defineProperty(ToolbarItem, 'name', { + enumerable: true, + writable: true, + value: 'item' +}); +Object.defineProperty(ToolbarItem, 'className', { + enumerable: true, + writable: true, + value: 'tui-toolbar-item' +}); +exports.default = ToolbarItem; + +/***/ }), +/* 18 */ +/***/ (function(module, exports) { + +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { + +if (typeof process === 'undefined' || + !process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = { nextTick: nextTick }; +} else { + module.exports = process +} + +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } +} + + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(18))) + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + +/* eslint-disable node/no-deprecated-api */ +var buffer = __webpack_require__(51) +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _toolbarItem = __webpack_require__(17); + +var _toolbarItem2 = _interopRequireDefault(_toolbarItem); + +var _tooltip = __webpack_require__(31); + +var _tooltip2 = _interopRequireDefault(_tooltip); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview Implements UI Button + * @author NHN FE Development Lab + */ + + +/** + * Class Button UI + * @param {object} options - button options + * @param {string} options.className - button class name + * @param {string} options.command - command name to execute on click + * @param {string} options.event - event name to trigger on click + * @param {string} options.text - text on button + * @param {string} options.tooltip - text on tooltip + * @param {string} options.style - button style + * @param {string} options.state - button state + * @param {jquery} $el - button rootElement + * @deprecated + */ +var Button = function (_ToolbarItem) { + _inherits(Button, _ToolbarItem); + + /** + * item name + * @type {String} + * @static + */ + function Button() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { + tagName: 'button', + name: Button.name + }; + + _classCallCheck(this, Button); + + var _this = _possibleConstructorReturn(this, (Button.__proto__ || Object.getPrototypeOf(Button)).call(this, { + name: options.name, + tagName: 'button', + className: options.className + ' ' + Button.className, + rootElement: options.$el + })); + + _this._setOptions(options); + + _this._render(); + _this.on('click', _this._onClick.bind(_this)); + if (options.tooltip) { + _this.on('mouseover', _this._onOver.bind(_this)); + _this.on('mouseout', _this._onOut.bind(_this)); + } + return _this; + } + + /** + * set tooltip text + * @param {string} text - tooltip text to show + */ + + + /** + * ToolbarItem className + * @type {String} + * @static + */ + + + _createClass(Button, [{ + key: 'setTooltip', + value: function setTooltip(text) { + this._tooltip = text; + } + }, { + key: '_setOptions', + value: function _setOptions(options) { + this._command = options.command; + this._event = options.event; + this._text = options.text; + this._tooltip = options.tooltip; + this._style = options.style; + this._state = options.state; + } + }, { + key: '_render', + value: function _render() { + this.$el.text(this._text); + this.$el.attr('type', 'button'); + + if (this._style) { + this.$el.attr('style', this._style); + } + } + }, { + key: '_onClick', + value: function _onClick() { + if (!this.isEnabled()) { + return; + } + + if (this._command) { + this.trigger('command', this._command); + } else if (this._event) { + this.trigger('event', this._event); + } + + this.trigger('clicked'); + } + }, { + key: '_onOver', + value: function _onOver() { + if (!this.isEnabled()) { + return; + } + + _tooltip2.default.show(this.$el, this._tooltip); + } + }, { + key: '_onOut', + value: function _onOut() { + _tooltip2.default.hide(); + } + + /** + * enable button + */ + + }, { + key: 'enable', + value: function enable() { + this.$el.attr('disabled', false); + } + + /** + * disable button + */ + + }, { + key: 'disable', + value: function disable() { + this.$el.attr('disabled', true); + } + + /** + * check whether this button is enabled + * @returns {Boolean} - true for enabled + */ + + }, { + key: 'isEnabled', + value: function isEnabled() { + return !this.$el.attr('disabled'); + } + }]); + + return Button; +}(_toolbarItem2.default); + +Object.defineProperty(Button, 'name', { + enumerable: true, + writable: true, + value: 'button' +}); +Object.defineProperty(Button, 'className', { + enumerable: true, + writable: true, + value: 'tui-toolbar-icons' +}); +exports.default = Button; + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * @fileoverview Implements KeyMapper + * @author NHN FE Development Lab + */ + +/** + * Constant of key mapping + * @type {string[]} + * @ignore + */ +var KEYBOARD_MAP = ['', // [0] +'', // [1] +'', // [2] +'CANCEL', // [3] +'', // [4] +'', // [5] +'HELP', // [6] +'', // [7] +'BACK_SPACE', // [8] +'TAB', // [9] +'', // [10] +'', // [11] +'CLEAR', // [12] +'ENTER', // [13] +'ENTER_SPECIAL', // [14] +'', // [15] +'', // [16] SHIFT +'', // [17] CONTROL +'', // [18] ALT +'PAUSE', // [19] +'CAPS_LOCK', // [20] +'KANA', // [21] +'EISU', // [22] +'JUNJA', // [23] +'FINAL', // [24] +'HANJA', // [25] +'', // [26] +'ESCAPE', // [27] +'CONVERT', // [28] +'NONCONVERT', // [29] +'ACCEPT', // [30] +'MODECHANGE', // [31] +'SPACE', // [32] +'PAGE_UP', // [33] +'PAGE_DOWN', // [34] +'END', // [35] +'HOME', // [36] +'LEFT', // [37] +'UP', // [38] +'RIGHT', // [39] +'DOWN', // [40] +'SELECT', // [41] +'PRINT', // [42] +'EXECUTE', // [43] +'PRINTSCREEN', // [44] +'INSERT', // [45] +'DELETE', // [46] +'', // [47] +'0', // [48] +'1', // [49] +'2', // [50] +'3', // [51] +'4', // [52] +'5', // [53] +'6', // [54] +'7', // [55] +'8', // [56] +'9', // [57] +':', // [58] +';', // [59] +'<', // [60] +'=', // [61] +'>', // [62] +'?', // [63] +'AT', // [64] +'A', // [65] +'B', // [66] +'C', // [67] +'D', // [68] +'E', // [69] +'F', // [70] +'G', // [71] +'H', // [72] +'I', // [73] +'J', // [74] +'K', // [75] +'L', // [76] +'M', // [77] +'N', // [78] +'O', // [79] +'P', // [80] +'Q', // [81] +'R', // [82] +'S', // [83] +'T', // [84] +'U', // [85] +'V', // [86] +'W', // [87] +'X', // [88] +'Y', // [89] +'Z', // [90] +'', // [91] META +'', // [92] +'CONTEXT_MENU', // [93] +'', // [94] +'SLEEP', // [95] +'NUMPAD0', // [96] +'NUMPAD1', // [97] +'NUMPAD2', // [98] +'NUMPAD3', // [99] +'NUMPAD4', // [100] +'NUMPAD5', // [101] +'NUMPAD6', // [102] +'NUMPAD7', // [103] +'NUMPAD8', // [104] +'NUMPAD9', // [105] +'MULTIPLY', // [106] +'ADD', // [107] +'SEPARATOR', // [108] +'SUBTRACT', // [109] +'DECIMAL', // [110] +'DIVIDE', // [111] +'F1', // [112] +'F2', // [113] +'F3', // [114] +'F4', // [115] +'F5', // [116] +'F6', // [117] +'F7', // [118] +'F8', // [119] +'F9', // [120] +'F10', // [121] +'F11', // [122] +'F12', // [123] +'F13', // [124] +'F14', // [125] +'F15', // [126] +'F16', // [127] +'F17', // [128] +'F18', // [129] +'F19', // [130] +'F20', // [131] +'F21', // [132] +'F22', // [133] +'F23', // [134] +'F24', // [135] +'', // [136] +'', // [137] +'', // [138] +'', // [139] +'', // [140] +'', // [141] +'', // [142] +'', // [143] +'NUM_LOCK', // [144] +'SCROLL_LOCK', // [145] +'WIN_OEM_FJ_JISHO', // [146] +'WIN_OEM_FJ_MASSHOU', // [147] +'WIN_OEM_FJ_TOUROKU', // [148] +'WIN_OEM_FJ_LOYA', // [149] +'WIN_OEM_FJ_ROYA', // [150] +'', // [151] +'', // [152] +'', // [153] +'', // [154] +'', // [155] +'', // [156] +'', // [157] +'', // [158] +'', // [159] +'@', // [160] +'!', // [161] +'"', // [162] +'#', // [163] +'$', // [164] +'%', // [165] +'&', // [166] +'_', // [167] +'(', // [168] +')', // [169] +'*', // [170] +'+', // [171] +'|', // [172] +'-', // [173] +'{', // [174] +'}', // [175] +'~', // [176] +'', // [177] +'', // [178] +'', // [179] +'', // [180] +'VOLUME_MUTE', // [181] +'VOLUME_DOWN', // [182] +'VOLUME_UP', // [183] +'', // [184] +'', // [185] +';', // [186] +'=', // [187] +',', // [188] +'-', // [189] +'.', // [190] +'/', // [191] +'`', // [192] +'', // [193] +'', // [194] +'', // [195] +'', // [196] +'', // [197] +'', // [198] +'', // [199] +'', // [200] +'', // [201] +'', // [202] +'', // [203] +'', // [204] +'', // [205] +'', // [206] +'', // [207] +'', // [208] +'', // [209] +'', // [210] +'', // [211] +'', // [212] +'', // [213] +'', // [214] +'', // [215] +'', // [216] +'', // [217] +'', // [218] +'[', // [219] +'\\', // [220] +']', // [221] +'\'', // [222] +'', // [223] +'META', // [224] +'ALTGR', // [225] +'', // [226] +'WIN_ICO_HELP', // [227] +'WIN_ICO_00', // [228] +'', // [229] +'WIN_ICO_CLEAR', // [230] +'', // [231] +'', // [232] +'WIN_OEM_RESET', // [233] +'WIN_OEM_JUMP', // [234] +'WIN_OEM_PA1', // [235] +'WIN_OEM_PA2', // [236] +'WIN_OEM_PA3', // [237] +'WIN_OEM_WSCTRL', // [238] +'WIN_OEM_CUSEL', // [239] +'WIN_OEM_ATTN', // [240] +'WIN_OEM_FINISH', // [241] +'WIN_OEM_COPY', // [242] +'WIN_OEM_AUTO', // [243] +'WIN_OEM_ENLW', // [244] +'WIN_OEM_BACKTAB', // [245] +'ATTN', // [246] +'CRSEL', // [247] +'EXSEL', // [248] +'EREOF', // [249] +'PLAY', // [250] +'ZOOM', // [251] +'', // [252] +'PA1', // [253] +'WIN_OEM_CLEAR', // [254] +'' // [255] +]; + +var sharedInstance = void 0; + +/** + * Class KeyMapper + * @param {object} [options] options + * @param {string} options.splitter splitter string default is + + * @ignore + */ + +var KeyMapper = function () { + function KeyMapper(options) { + _classCallCheck(this, KeyMapper); + + this._setSplitter(options); + } + + /** + * Set key splitter + * @param {object} options Option object + * @private + */ + + + _createClass(KeyMapper, [{ + key: '_setSplitter', + value: function _setSplitter(options) { + var splitter = options ? options.splitter : '+'; + this._splitter = splitter; + } + + /** + * Convert event to keyMap + * @param {event} event Event object + * @returns {string} + */ + + }, { + key: 'convert', + value: function convert(event) { + var keyMap = []; + + if (event.shiftKey) { + keyMap.push('SHIFT'); + } + + if (event.ctrlKey) { + keyMap.push('CTRL'); + } + + if (event.metaKey) { + keyMap.push('META'); + } + + if (event.altKey) { + keyMap.push('ALT'); + } + + var keyChar = this._getKeyCodeChar(event.keyCode); + + if (keyChar) { + keyMap.push(keyChar); + } + + return keyMap.join(this._splitter); + } + + /** + * Get character from key code + * @param {number} keyCode Key code + * @returns {string} + * @private + */ + + }, { + key: '_getKeyCodeChar', + value: function _getKeyCodeChar(keyCode) { + var keyCodeCharacter = KEYBOARD_MAP[keyCode]; + + return keyCodeCharacter; + } + + /** + * Get sharedInstance + * @returns {KeyMapper} + */ + + }], [{ + key: 'getSharedInstance', + value: function getSharedInstance() { + if (!sharedInstance) { + sharedInstance = new KeyMapper(); + } + + return sharedInstance; + } + + /** + * get key code for a character + * @param {string} char - a character to be converted + * @returns {number} key code for the char + * @static + */ + + }, { + key: 'keyCode', + value: function keyCode(char) { + return KEYBOARD_MAP.indexOf(char); + } + }]); + + return KeyMapper; +}(); + +exports.default = KeyMapper; + +/***/ }), +/* 23 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @fileoverview Implements htmlSanitizer + * @author NHN FE Development Lab + */ +var HTML_ATTR_LIST_RX = new RegExp('^(abbr|align|alt|axis|bgcolor|border|cellpadding|cellspacing|class|clear|' + 'color|cols|compact|coords|dir|face|headers|height|hreflang|hspace|' + 'ismap|lang|language|nohref|nowrap|rel|rev|rows|rules|' + 'scope|scrolling|shape|size|span|start|summary|tabindex|target|title|type|' + 'valign|value|vspace|width|checked|mathvariant|encoding|id|name|' + 'background|cite|href|longdesc|src|usemap|xlink:href|data-+|checked|style)', 'g'); + +var SVG_ATTR_LIST_RX = new RegExp('^(accent-height|accumulate|additive|alphabetic|arabic-form|ascent|' + 'baseProfile|bbox|begin|by|calcMode|cap-height|class|color|color-rendering|content|' + 'cx|cy|d|dx|dy|descent|display|dur|end|fill|fill-rule|font-family|font-size|font-stretch|' + 'font-style|font-variant|font-weight|from|fx|fy|g1|g2|glyph-name|gradientUnits|hanging|' + 'height|horiz-adv-x|horiz-origin-x|ideographic|k|keyPoints|keySplines|keyTimes|lang|' + 'marker-end|marker-mid|marker-start|markerHeight|markerUnits|markerWidth|mathematical|' + 'max|min|offset|opacity|orient|origin|overline-position|overline-thickness|panose-1|' + 'path|pathLength|points|preserveAspectRatio|r|refX|refY|repeatCount|repeatDur|' + 'requiredExtensions|requiredFeatures|restart|rotate|rx|ry|slope|stemh|stemv|stop-color|' + 'stop-opacity|strikethrough-position|strikethrough-thickness|stroke|stroke-dasharray|' + 'stroke-dashoffset|stroke-linecap|stroke-linejoin|stroke-miterlimit|stroke-opacity|' + 'stroke-width|systemLanguage|target|text-anchor|to|transform|type|u1|u2|underline-position|' + 'underline-thickness|unicode|unicode-range|units-per-em|values|version|viewBox|visibility|' + 'width|widths|x|x-height|x1|x2|xlink:actuate|xlink:arcrole|xlink:role|xlink:show|xlink:title|' + 'xlink:type|xml:base|xml:lang|xml:space|xmlns|xmlns:xlink|y|y1|y2|zoomAndPan)', 'g'); + +var ATTR_VALUE_BLACK_LIST_RX = { + 'href': /^(javascript:).*/g +}; + +/** + * htmlSanitizer + * @param {string|Node} html html or Node + * @param {boolean} [needHtmlText] pass true if need html text + * @returns {string|DocumentFragment} result + * @ignore + */ +function htmlSanitizer(html, needHtmlText) { + var $html = (0, _jquery2.default)('
'); + + html = html.replace(//g, ''); + + $html.append(html); + + removeUnnecessaryTags($html); + leaveOnlyWhitelistAttribute($html); + removeInvalidAttributeValues($html); + + return finalizeHtml($html, needHtmlText); +} + +/** + * Remove unnecessary tags + * @private + * @param {jQuery} $html jQuery instance + */ +function removeUnnecessaryTags($html) { + $html.find('script, iframe, textarea, form, button, select, meta, style, link, title, embed, object, details, summary').remove(); +} + +/** + * Leave only white list attributes + * @private + * @param {jQuery} $html jQuery instance + */ +function leaveOnlyWhitelistAttribute($html) { + $html.find('*').each(function (index, node) { + var attrs = node.attributes; + var blacklist = _tuiCodeSnippet2.default.toArray(attrs).filter(function (attr) { + var isHTMLAttr = attr.name.match(HTML_ATTR_LIST_RX); + var isSVGAttr = attr.name.match(SVG_ATTR_LIST_RX); + + return !isHTMLAttr && !isSVGAttr; + }); + + _tuiCodeSnippet2.default.forEachArray(blacklist, function (attr) { + // Edge svg attribute name returns uppercase bug. error guard. + // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/5579311/ + if (attrs.getNamedItem(attr.name)) { + attrs.removeNamedItem(attr.name); + } + }); + }); +} + +/** + * Remove invalid attribute values + * @private + * @param {jQuery} $html jQuery instance + */ +function removeInvalidAttributeValues($html) { + var _loop = function _loop(attr) { + if (ATTR_VALUE_BLACK_LIST_RX.hasOwnProperty(attr)) { + $html.find('[' + attr + ']').each(function (index, node) { + var attrs = node.attributes; + var valueBlackListRX = ATTR_VALUE_BLACK_LIST_RX[attr]; + var attrItem = attrs.getNamedItem(attr); + if (valueBlackListRX && attrItem && attrItem.value.toLowerCase().match(valueBlackListRX)) { + attrs.removeNamedItem(attr); + } + }); + } + }; + + for (var attr in ATTR_VALUE_BLACK_LIST_RX) { + _loop(attr); + } +} + +/** + * Finalize html result + * @private + * @param {jQuery} $html jQuery instance + * @param {boolean} needHtmlText pass true if need html text + * @returns {string|DocumentFragment} result + */ +function finalizeHtml($html, needHtmlText) { + var returnValue = void 0; + + if (needHtmlText) { + returnValue = $html[0].innerHTML; + } else { + var frag = document.createDocumentFragment(); + var childNodes = _tuiCodeSnippet2.default.toArray($html[0].childNodes); + var length = childNodes.length; + + + for (var i = 0; i < length; i += 1) { + frag.appendChild(childNodes[i]); + } + returnValue = frag; + } + + return returnValue; +} + +exports.default = htmlSanitizer; + +/***/ }), +/* 24 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__24__; + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.CodeBlockManager = undefined; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * @fileoverview Implements CodeBlockManager + * @author NHN FE Development Lab + */ + + +var _highlight = __webpack_require__(94); + +var _highlight2 = _interopRequireDefault(_highlight); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * Class Code Block Manager + */ +var CodeBlockManager = function () { + function CodeBlockManager() { + _classCallCheck(this, CodeBlockManager); + + this._replacers = {}; + } + + /** + * Set replacer for code block + * @param {string} language - code block language + * @param {function} replacer - replacer function to code block element + */ + + + _createClass(CodeBlockManager, [{ + key: 'setReplacer', + value: function setReplacer(language, replacer) { + this._replacers[language] = replacer; + } + + /** + * get replacer for code block + * @param {string} language - code block type + * @returns {function} - replacer function + */ + + }, { + key: 'getReplacer', + value: function getReplacer(language) { + return this._replacers[language]; + } + + /** + * Create code block html. + * @param {string} language - code block language + * @param {string} codeText - code text + * @returns {string} + */ + + }, { + key: 'createCodeBlockHtml', + value: function createCodeBlockHtml(language, codeText) { + var replacer = this.getReplacer(language); + var html = void 0; + + if (replacer) { + html = replacer(codeText, language); + } else { + html = _highlight2.default.getLanguage(language) ? _highlight2.default.highlight(language, codeText).value : escape(codeText, false); + } + + return html; + } + + /** + * get supported languages by highlight-js + * @returns {Array} - supported languages by highlight-js + */ + + }], [{ + key: 'getHighlightJSLanguages', + value: function getHighlightJSLanguages() { + return _highlight2.default.listLanguages(); + } + }]); + + return CodeBlockManager; +}(); + +/** + * escape code from markdown-it + * @param {string} html HTML string + * @param {string} encode Boolean value of whether encode or not + * @returns {string} + * @ignore + */ + + +function escape(html, encode) { + return html.replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, '''); +} + +exports.CodeBlockManager = CodeBlockManager; +exports.default = new CodeBlockManager(); + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +/** + * @fileoverview This file is common logic for italic, bold, strike makrdown commands. + * @author NHN FE Development Lab + */ + +/** + * range expand according to expendSize + * If can not expand, return null + * @param {range} range - range + * @param {number} expendSize - expendSize + * @returns {object} expanded range or null + * @ignore + */ +var getExpandedRange = function getExpandedRange(range, expendSize) { + var start = range.start, + end = range.end; + + var expendRange = void 0; + + if (start.ch >= expendSize) { + var from = { + line: start.line, + ch: start.ch - expendSize + }; + var to = { + line: end.line, + ch: end.ch + expendSize + }; + + expendRange = { + from: from, + to: to + }; + } + + return expendRange; +}; + +/** + * remove symbol in the front and back of text + * @param {string} text - text + * @param {string} symbol - text + * @returns {string} + * @ignore + */ +var removeSyntax = exports.removeSyntax = function removeSyntax(text, symbol) { + var symbolLength = symbol.length; + + return text.substr(symbolLength, text.length - symbolLength * 2); +}; + +/** + * append symbol in the front and back of text + * @param {string} text - text + * @param {string} symbol - text + * @returns {string} + * @ignore + */ +var appendSyntax = exports.appendSyntax = function appendSyntax(text, symbol) { + return '' + symbol + text + symbol; +}; + +/** + * check expanded text and replace text using replacer + * @param {CodeMirror.doc} doc - doc of codemirror + * @param {range} range - origin range + * @param {number} expandSize - expandSize + * @param {function} checker - sytax check function + * @param {function} replacer - text replace function + * @returns {boolean} - if replace text, return true. + * @ignore + */ +var expandReplace = exports.expandReplace = function expandReplace(doc, range, expandSize, checker, replacer) { + var expendRange = getExpandedRange(range, expandSize); + var result = false; + + if (expendRange) { + var from = expendRange.from, + to = expendRange.to; + + var expendRangeText = doc.getRange(from, to); + if (checker(expendRangeText)) { + doc.setSelection(from, to); + doc.replaceSelection(replacer(expendRangeText), 'around'); + result = true; + } + } + + return result; +}; + +/** + * check text and replace text using replacer + * @param {CodeMirror.doc} doc - doc of codemirror + * @param {string} text - text + * @param {function} checker - sytax check function + * @param {function} replacer - text replace function + * @returns {boolean} - if replace text, return true. + * @ignore + */ +var replace = exports.replace = function replace(doc, text, checker, replacer) { + var result = false; + + if (checker(text)) { + doc.replaceSelection(replacer(text), 'around'); + result = true; + } + + return result; +}; + +var changeSyntax = exports.changeSyntax = function changeSyntax(doc, range, symbol, syntaxRegex, contentRegex) { + var _doc$getCursor = doc.getCursor(), + line = _doc$getCursor.line, + ch = _doc$getCursor.ch; + + var selectionStr = doc.getSelection(); + var symbolLength = symbol.length; + var isSyntax = function isSyntax(t) { + return syntaxRegex.test(t); + }; + + // 1. expand text and check syntax => remove syntax + // 2. check text is syntax => remove syntax + // 3. If text does not match syntax, remove syntax inside text and then append syntax + if (!(expandReplace(doc, range, symbolLength, isSyntax, function (t) { + return removeSyntax(t, symbol); + }) || replace(doc, selectionStr, isSyntax, function (t) { + return removeSyntax(t, symbol); + }))) { + var removeSyntaxInsideText = selectionStr.replace(contentRegex, '$1'); + doc.replaceSelection(appendSyntax(removeSyntaxInsideText, symbol), 'around'); + } + + var afterSelectStr = doc.getSelection(); + var size = ch; + + if (!selectionStr) { + // If text was not selected, after replace text, move cursor + // For example **|** => | (move cusor -symbolLenth) + if (isSyntax(afterSelectStr)) { + size += symbolLength; + } else { + size -= symbolLength; + } + doc.setCursor(line, size); + } +}; + +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); + } + +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); +} +module.exports = EventEmitter; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +var defaultMaxListeners = 10; + +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } + this._maxListeners = n; + return this; +}; + +function $getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return $getMaxListeners(this); +}; + +EventEmitter.prototype.emit = function emit(type) { + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); + var doError = (type === 'error'); + + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); + else if (!doError) + return false; + + // If there is no 'error' event listener then throw. + if (doError) { + var er; + if (args.length > 0) + er = args[0]; + if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event + } + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event + } + + var handler = events[type]; + + if (handler === undefined) + return false; + + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); + } + + return true; +}; + +function _addListener(target, type, listener, prepend) { + var m; + var events; + var existing; + + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } + + events = target._events; + if (events === undefined) { + events = target._events = Object.create(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, + listener.listener ? listener.listener : listener); + + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } + + if (existing === undefined) { + // Optimize the case of one listener. Don't need the extra array object. + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } + + // Check for listener leak + m = $getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); + } + } + + return target; +} + +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; + +function onceWrapper() { + var args = []; + for (var i = 0; i < arguments.length; i++) args.push(arguments[i]); + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + ReflectApply(this.listener, this.target, args); + } +} + +function _onceWrap(target, type, listener) { + var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; + var wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} + +EventEmitter.prototype.once = function once(type, listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } + this.on(type, _onceWrap(this, type, listener)); + return this; +}; + +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; + +// Emits a 'removeListener' event if and only if the listener was removed. +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + var list, events, position, i, originalListener; + + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } + + events = this._events; + if (events === undefined) + return this; + + list = events[type]; + if (list === undefined) + return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; + + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } + + if (position < 0) + return this; + + if (position === 0) + list.shift(); + else { + spliceOne(list, position); + } + + if (list.length === 1) + events[type] = list[0]; + + if (events.removeListener !== undefined) + this.emit('removeListener', type, originalListener || listener); + } + + return this; + }; + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + var listeners, events, i; + + events = this._events; + if (events === undefined) + return this; + + // not listening for removeListener, no need to emit + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = Object.create(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else + delete events[type]; + } + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + var keys = Object.keys(events); + var key; + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = Object.create(null); + this._eventsCount = 0; + return this; + } + + listeners = events[type]; + + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } + + return this; + }; + +function _listeners(target, type, unwrap) { + var events = target._events; + + if (events === undefined) + return []; + + var evlistener = events[type]; + if (evlistener === undefined) + return []; + + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} + +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; + +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); + } +}; + +EventEmitter.prototype.listenerCount = listenerCount; +function listenerCount(type) { + var events = this._events; + + if (events !== undefined) { + var evlistener = events[type]; + + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener !== undefined) { + return evlistener.length; + } + } + + return 0; +} + +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; +}; + +function arrayClone(arr, n) { + var copy = new Array(n); + for (var i = 0; i < n; ++i) + copy[i] = arr[i]; + return copy; +} + +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + +function unwrapListeners(arr) { + var ret = new Array(arr.length); + for (var i = 0; i < ret.length; ++i) { + ret[i] = arr[i].listener || arr[i]; + } + return ret; +} + + +/***/ }), +/* 28 */ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(48); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = __webpack_require__(29); +exports.Duplex = __webpack_require__(12); +exports.Transform = __webpack_require__(54); +exports.PassThrough = __webpack_require__(182); + + +/***/ }), +/* 29 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process, setImmediate, global) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + + + +/**/ + +var pna = __webpack_require__(19); +/**/ + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; +/**/ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var util = __webpack_require__(16); +util.inherits = __webpack_require__(13); +/**/ + +/**/ +var internalUtil = { + deprecate: __webpack_require__(181) +}; +/**/ + +/**/ +var Stream = __webpack_require__(50); +/**/ + +/**/ + +var Buffer = __webpack_require__(20).Buffer; +var OurUint8Array = global.Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ + +var destroyImpl = __webpack_require__(52); + +util.inherits(Writable, Stream); + +function nop() {} + +function WritableState(options, stream) { + Duplex = Duplex || __webpack_require__(12); + + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + var writableHwm = options.writableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; + + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} + +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; + +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function () { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function (object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function (object) { + return object instanceof this; + }; +} + +function Writable(options) { + Duplex = Duplex || __webpack_require__(12); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { + return new Writable(options); + } + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + if (options) { + if (typeof options.write === 'function') this._write = options.write; + + if (typeof options.writev === 'function') this._writev = options.writev; + + if (typeof options.destroy === 'function') this._destroy = options.destroy; + + if (typeof options.final === 'function') this._final = options.final; + } + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + this.emit('error', new Error('Cannot pipe, not readable')); +}; + +function writeAfterEnd(stream, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + pna.nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var valid = true; + var er = false; + + if (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + if (er) { + stream.emit('error', er); + pna.nextTick(cb, er); + valid = false; + } + return valid; +} + +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + + if (typeof cb !== 'function') cb = nop; + + if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + + return ret; +}; + +Writable.prototype.cork = function () { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function () { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; + +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} + +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + } +}); + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + + return ret; +} + +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + pna.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + pna.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state); + + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + + if (sync) { + /**/ + asyncWrite(afterWrite, stream, state, finished, cb); + /**/ + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + + if (entry === null) state.lastBufferedRequest = null; + } + + state.bufferedRequest = entry; + state.bufferProcessing = false; +} + +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new Error('_write() is not implemented')); +}; + +Writable.prototype._writev = null; + +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) endWritable(this, state, cb); +}; + +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + stream.emit('error', err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function') { + state.pendingcb++; + state.finalCalled = true; + pna.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} + +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + } + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} + +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + if (state.corkedRequestsFree) { + state.corkedRequestsFree.next = corkReq; + } else { + state.corkedRequestsFree = corkReq; + } +} + +Object.defineProperty(Writable.prototype, 'destroyed', { + get: function () { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); + +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + this.end(); + cb(err); +}; +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(18), __webpack_require__(179).setImmediate, __webpack_require__(11))) + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * @fileoverview Implements Editor + * @author NHN FE Development Lab + */ + + +// markdown commands + + +// wysiwyg Commands + + +// langs + + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _button = __webpack_require__(21); + +var _button2 = _interopRequireDefault(_button); + +var _markdownEditor = __webpack_require__(58); + +var _markdownEditor2 = _interopRequireDefault(_markdownEditor); + +var _mdPreview = __webpack_require__(34); + +var _mdPreview2 = _interopRequireDefault(_mdPreview); + +var _wysiwygEditor = __webpack_require__(69); + +var _wysiwygEditor2 = _interopRequireDefault(_wysiwygEditor); + +var _layout = __webpack_require__(83); + +var _layout2 = _interopRequireDefault(_layout); + +var _eventManager = __webpack_require__(40); + +var _eventManager2 = _interopRequireDefault(_eventManager); + +var _commandManager2 = __webpack_require__(2); + +var _commandManager3 = _interopRequireDefault(_commandManager2); + +var _extManager = __webpack_require__(41); + +var _extManager2 = _interopRequireDefault(_extManager); + +var _importManager = __webpack_require__(15); + +var _importManager2 = _interopRequireDefault(_importManager); + +var _wwCodeBlockManager = __webpack_require__(38); + +var _wwCodeBlockManager2 = _interopRequireDefault(_wwCodeBlockManager); + +var _convertor = __webpack_require__(42); + +var _convertor2 = _interopRequireDefault(_convertor); + +var _viewer = __webpack_require__(95); + +var _viewer2 = _interopRequireDefault(_viewer); + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _defaultUI = __webpack_require__(96); + +var _defaultUI2 = _interopRequireDefault(_defaultUI); + +var _domUtils = __webpack_require__(4); + +var _domUtils2 = _interopRequireDefault(_domUtils); + +var _wwTableManager = __webpack_require__(36); + +var _wwTableManager2 = _interopRequireDefault(_wwTableManager); + +var _wwTableSelectionManager = __webpack_require__(37); + +var _wwTableSelectionManager2 = _interopRequireDefault(_wwTableSelectionManager); + +var _codeBlockManager = __webpack_require__(25); + +var _codeBlockManager2 = _interopRequireDefault(_codeBlockManager); + +var _toMarkRenderer = __webpack_require__(113); + +var _toMarkRenderer2 = _interopRequireDefault(_toMarkRenderer); + +var _bold = __webpack_require__(114); + +var _bold2 = _interopRequireDefault(_bold); + +var _italic = __webpack_require__(115); + +var _italic2 = _interopRequireDefault(_italic); + +var _strike = __webpack_require__(116); + +var _strike2 = _interopRequireDefault(_strike); + +var _blockquote = __webpack_require__(117); + +var _blockquote2 = _interopRequireDefault(_blockquote); + +var _heading = __webpack_require__(118); + +var _heading2 = _interopRequireDefault(_heading); + +var _paragraph = __webpack_require__(119); + +var _paragraph2 = _interopRequireDefault(_paragraph); + +var _hr = __webpack_require__(120); + +var _hr2 = _interopRequireDefault(_hr); + +var _addLink = __webpack_require__(121); + +var _addLink2 = _interopRequireDefault(_addLink); + +var _addImage = __webpack_require__(122); + +var _addImage2 = _interopRequireDefault(_addImage); + +var _ul = __webpack_require__(123); + +var _ul2 = _interopRequireDefault(_ul); + +var _ol = __webpack_require__(124); + +var _ol2 = _interopRequireDefault(_ol); + +var _indent = __webpack_require__(125); + +var _indent2 = _interopRequireDefault(_indent); + +var _outdent = __webpack_require__(126); + +var _outdent2 = _interopRequireDefault(_outdent); + +var _table = __webpack_require__(127); + +var _table2 = _interopRequireDefault(_table); + +var _task = __webpack_require__(128); + +var _task2 = _interopRequireDefault(_task); + +var _code = __webpack_require__(129); + +var _code2 = _interopRequireDefault(_code); + +var _codeBlock = __webpack_require__(130); + +var _codeBlock2 = _interopRequireDefault(_codeBlock); + +var _bold3 = __webpack_require__(131); + +var _bold4 = _interopRequireDefault(_bold3); + +var _italic3 = __webpack_require__(132); + +var _italic4 = _interopRequireDefault(_italic3); + +var _strike3 = __webpack_require__(133); + +var _strike4 = _interopRequireDefault(_strike3); + +var _blockquote3 = __webpack_require__(134); + +var _blockquote4 = _interopRequireDefault(_blockquote3); + +var _addImage3 = __webpack_require__(135); + +var _addImage4 = _interopRequireDefault(_addImage3); + +var _addLink3 = __webpack_require__(136); + +var _addLink4 = _interopRequireDefault(_addLink3); + +var _hr3 = __webpack_require__(137); + +var _hr4 = _interopRequireDefault(_hr3); + +var _heading3 = __webpack_require__(138); + +var _heading4 = _interopRequireDefault(_heading3); + +var _paragraph3 = __webpack_require__(139); + +var _paragraph4 = _interopRequireDefault(_paragraph3); + +var _ul3 = __webpack_require__(140); + +var _ul4 = _interopRequireDefault(_ul3); + +var _ol3 = __webpack_require__(141); + +var _ol4 = _interopRequireDefault(_ol3); + +var _table3 = __webpack_require__(142); + +var _table4 = _interopRequireDefault(_table3); + +var _tableAddRow = __webpack_require__(143); + +var _tableAddRow2 = _interopRequireDefault(_tableAddRow); + +var _tableAddCol = __webpack_require__(144); + +var _tableAddCol2 = _interopRequireDefault(_tableAddCol); + +var _tableRemoveRow = __webpack_require__(145); + +var _tableRemoveRow2 = _interopRequireDefault(_tableRemoveRow); + +var _tableRemoveCol = __webpack_require__(146); + +var _tableRemoveCol2 = _interopRequireDefault(_tableRemoveCol); + +var _tableAlignCol = __webpack_require__(147); + +var _tableAlignCol2 = _interopRequireDefault(_tableAlignCol); + +var _tableRemove = __webpack_require__(148); + +var _tableRemove2 = _interopRequireDefault(_tableRemove); + +var _indent3 = __webpack_require__(149); + +var _indent4 = _interopRequireDefault(_indent3); + +var _outdent3 = __webpack_require__(150); + +var _outdent4 = _interopRequireDefault(_outdent3); + +var _task3 = __webpack_require__(151); + +var _task4 = _interopRequireDefault(_task3); + +var _code3 = __webpack_require__(152); + +var _code4 = _interopRequireDefault(_code3); + +var _codeBlock3 = __webpack_require__(153); + +var _codeBlock4 = _interopRequireDefault(_codeBlock3); + +__webpack_require__(154); + +__webpack_require__(155); + +__webpack_require__(156); + +__webpack_require__(157); + +__webpack_require__(158); + +__webpack_require__(159); + +__webpack_require__(160); + +__webpack_require__(161); + +__webpack_require__(162); + +__webpack_require__(163); + +__webpack_require__(164); + +__webpack_require__(165); + +__webpack_require__(166); + +__webpack_require__(167); + +__webpack_require__(168); + +__webpack_require__(169); + +__webpack_require__(170); + +__webpack_require__(171); + +__webpack_require__(172); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __nedInstance = []; +var gaTrackingId = 'UA-129966929-1'; + +var availableLinkAttributes = ['rel', 'target', 'contenteditable', 'hreflang', 'type']; + +/** + * @callback addImageBlobHook + * @param {File|Blob} fileOrBlob - image blob + * @param {callback} callback - callback function to be called after + * @param {string} source - source of an event the item belongs to. 'paste', 'drop', 'ui' + */ + +/** + * ToastUI Editor + * @param {object} options Option object + * @param {HTMLElement} options.el - container element + * @param {string} [options.height='300px'] - Editor's height style value. Height is applied as border-box ex) '300px', '100%', 'auto' + * @param {string} [options.minHeight='200px'] - Editor's min-height style value in pixel ex) '300px' + * @param {string} [options.initialValue] - Editor's initial value + * @param {string} [options.previewStyle] - Markdown editor's preview style (tab, vertical) + * @param {string} [options.initialEditType] - Initial editor type (markdown, wysiwyg) + * @param {object[]} [options.events] - eventlist Event list + * @param {function} options.events.load - It would be emitted when editor fully load + * @param {function} options.events.change - It would be emitted when content changed + * @param {function} options.events.stateChange - It would be emitted when format change by cursor position + * @param {function} options.events.focus - It would be emitted when editor get focus + * @param {function} options.events.blur - It would be emitted when editor loose focus + * @param {object[]} [options.hooks] - Hook list + * @param {function} options.hooks.previewBeforeHook - Submit preview to hook URL before preview be shown + * @param {addImageBlobHook} options.hooks.addImageBlobHook - hook for image upload. + * @param {string} [options.language='en_US'] - language + * @param {boolean} [options.useCommandShortcut=true] - whether use keyboard shortcuts to perform commands + * @param {boolean} [options.useDefaultHTMLSanitizer=true] - use default htmlSanitizer + * @param {string[]} [options.codeBlockLanguages] - supported code block languages to be listed. default is what highlight.js supports + * @param {boolean} [options.usageStatistics=true] - send hostname to google analytics + * @param {string[]} [options.toolbarItems] - toolbar items. + * @param {boolean} [options.hideModeSwitch=false] - hide mode switch tab bar + * @param {string[]} [options.exts] - extensions + * @param {object} [options.customConvertor] - convertor extention + * @param {string} [options.placeholder] - The placeholder text of the editable element. + * @param {string} [options.previewDelayTime] - the delay time for rendering preview + * @param {object} [options.linkAttribute] - Attributes of anchor element that shold be rel, target, contenteditable, hreflang, type + */ + +var ToastUIEditor = function () { + function ToastUIEditor(options) { + var _this = this; + + _classCallCheck(this, ToastUIEditor); + + this.initialHtml = options.el.innerHTML; + options.el.innerHTML = ''; + + this.options = _jquery2.default.extend({ + previewStyle: 'tab', + initialEditType: 'markdown', + height: '300px', + minHeight: '200px', + language: 'en_US', + useDefaultHTMLSanitizer: true, + useCommandShortcut: true, + codeBlockLanguages: _codeBlockManager.CodeBlockManager.getHighlightJSLanguages(), + usageStatistics: true, + toolbarItems: ['heading', 'bold', 'italic', 'strike', 'divider', 'hr', 'quote', 'divider', 'ul', 'ol', 'task', 'indent', 'outdent', 'divider', 'table', 'image', 'link', 'divider', 'code', 'codeblock'], + hideModeSwitch: false, + customConvertor: null + }, options); + + this.eventManager = new _eventManager2.default(); + + this.importManager = new _importManager2.default(this.eventManager); + + this.commandManager = new _commandManager3.default(this, { + useCommandShortcut: this.options.useCommandShortcut + }); + + if (this.options.customConvertor) { + // eslint-disable-next-line new-cap + this.convertor = new this.options.customConvertor(this.eventManager); + } else { + this.convertor = new _convertor2.default(this.eventManager); + } + + if (this.options.useDefaultHTMLSanitizer) { + this.convertor.initHtmlSanitizer(); + } + + if (this.options.hooks) { + _tuiCodeSnippet2.default.forEach(this.options.hooks, function (fn, key) { + return _this.addHook(key, fn); + }); + } + + if (this.options.events) { + _tuiCodeSnippet2.default.forEach(this.options.events, function (fn, key) { + return _this.on(key, fn); + }); + } + + this.layout = new _layout2.default(options, this.eventManager); + + this.i18n = _i18n2.default; + this.i18n.setCode(this.options.language); + + this.setUI(this.options.UI || new _defaultUI2.default(this)); + + this.mdEditor = _markdownEditor2.default.factory(this.layout.getMdEditorContainerEl(), this.eventManager, this.options); + this.preview = new _mdPreview2.default(this.layout.getPreviewEl(), this.eventManager, this.convertor, false, this.options.previewDelayTime); + this.wwEditor = _wysiwygEditor2.default.factory(this.layout.getWwEditorContainerEl(), this.eventManager, { + useDefaultHTMLSanitizer: this.options.useDefaultHTMLSanitizer + }); + this.toMarkOptions = { + gfm: true, + renderer: _toMarkRenderer2.default + }; + + if (this.options.linkAttribute) { + var attribute = this._sanitizeLinkAttribute(this.options.linkAttribute); + + this.convertor.setLinkAttribute(attribute); + this.wwEditor.setLinkAttribute(attribute); + } + + this.changePreviewStyle(this.options.previewStyle); + + this.changeMode(this.options.initialEditType, true); + + this.minHeight(this.options.minHeight); + + this.height(this.options.height); + + this.setValue(this.options.initialValue, false); + + if (this.options.placeholder) { + this.setPlaceholder(this.options.placeholder); + } + + if (!this.options.initialValue) { + this.setHtml(this.initialHtml, false); + } + + _extManager2.default.applyExtension(this, this.options.exts); + + this.eventManager.emit('load', this); + + __nedInstance.push(this); + + this._addDefaultCommands(); + + if (this.options.usageStatistics) { + _tuiCodeSnippet2.default.sendHostname('editor', gaTrackingId); + } + } + + /** + * sanitize attribute for link + * @param {object} attribute - attribute for link + * @returns {object} sanitized attribute + * @private + */ + + + _createClass(ToastUIEditor, [{ + key: '_sanitizeLinkAttribute', + value: function _sanitizeLinkAttribute(attribute) { + var linkAttribute = {}; + + availableLinkAttributes.forEach(function (key) { + if (!_tuiCodeSnippet2.default.isUndefined(attribute[key])) { + linkAttribute[key] = attribute[key]; + } + }); + + return linkAttribute; + } + + /** + * change preview style + * @param {string} style - 'tab'|'vertical' + */ + + }, { + key: 'changePreviewStyle', + value: function changePreviewStyle(style) { + this.layout.changePreviewStyle(style); + this.mdPreviewStyle = style; + this.eventManager.emit('changePreviewStyle', style); + this.eventManager.emit('previewNeedsRefresh'); + } + + /** + * call commandManager's exec method + * @param {*} ...args Command argument + */ + + }, { + key: 'exec', + value: function exec() { + var _commandManager; + + (_commandManager = this.commandManager).exec.apply(_commandManager, arguments); + } + + /** + * add default commands + * @private + */ + + }, { + key: '_addDefaultCommands', + value: function _addDefaultCommands() { + this.addCommand(_bold2.default); + this.addCommand(_italic2.default); + this.addCommand(_blockquote2.default); + this.addCommand(_heading2.default); + this.addCommand(_paragraph2.default); + this.addCommand(_hr2.default); + this.addCommand(_addLink2.default); + this.addCommand(_addImage2.default); + this.addCommand(_ul2.default); + this.addCommand(_ol2.default); + this.addCommand(_indent2.default); + this.addCommand(_outdent2.default); + this.addCommand(_table2.default); + this.addCommand(_task2.default); + this.addCommand(_code2.default); + this.addCommand(_codeBlock2.default); + this.addCommand(_strike2.default); + + this.addCommand(_bold4.default); + this.addCommand(_italic4.default); + this.addCommand(_blockquote4.default); + this.addCommand(_ul4.default); + this.addCommand(_ol4.default); + this.addCommand(_addImage4.default); + this.addCommand(_addLink4.default); + this.addCommand(_hr4.default); + this.addCommand(_heading4.default); + this.addCommand(_paragraph4.default); + this.addCommand(_indent4.default); + this.addCommand(_outdent4.default); + this.addCommand(_task4.default); + this.addCommand(_table4.default); + this.addCommand(_tableAddRow2.default); + this.addCommand(_tableAddCol2.default); + this.addCommand(_tableRemoveRow2.default); + this.addCommand(_tableRemoveCol2.default); + this.addCommand(_tableAlignCol2.default); + this.addCommand(_tableRemove2.default); + this.addCommand(_code4.default); + this.addCommand(_codeBlock4.default); + this.addCommand(_strike4.default); + } + }, { + key: 'addCommand', + value: function addCommand(type, props) { + if (!props) { + this.commandManager.addCommand(type); + } else { + this.commandManager.addCommand(_commandManager3.default.command(type, props)); + } + } + + /** + * After added command. + */ + + }, { + key: 'afterAddedCommand', + value: function afterAddedCommand() { + this.eventManager.emit('afterAddedCommand', this); + } + + /** + * Bind eventHandler to event type + * @param {string} type Event type + * @param {function} handler Event handler + */ + + }, { + key: 'on', + value: function on(type, handler) { + this.eventManager.listen(type, handler); + } + + /** + * Unbind eventHandler from event type + * @param {string} type Event type + */ + + }, { + key: 'off', + value: function off(type) { + this.eventManager.removeEventHandler(type); + } + + /** + * Add hook to TUIEditor event + * @param {string} type Event type + * @param {function} handler Event handler + */ + + }, { + key: 'addHook', + value: function addHook(type, handler) { + this.eventManager.removeEventHandler(type); + this.eventManager.listen(type, handler); + } + + /** + * Remove hook from TUIEditor event + * @param {string} type Event type + */ + + }, { + key: 'removeHook', + value: function removeHook(type) { + this.eventManager.removeEventHandler(type); + } + + /** + * Get CodeMirror instance + * @returns {CodeMirror} + */ + + }, { + key: 'getCodeMirror', + value: function getCodeMirror() { + return this.mdEditor.getEditor(); + } + + /** + * Get SquireExt instance + * @returns {SquireExt} + */ + + }, { + key: 'getSquire', + value: function getSquire() { + return this.wwEditor.getEditor(); + } + + /** + * Set focus to current Editor + */ + + }, { + key: 'focus', + value: function focus() { + this.getCurrentModeEditor().focus(); + } + + /** + * Remove focus of current Editor + */ + + }, { + key: 'blur', + value: function blur() { + this.getCurrentModeEditor().blur(); + } + + /** + * Set cursor position to end + */ + + }, { + key: 'moveCursorToEnd', + value: function moveCursorToEnd() { + this.getCurrentModeEditor().moveCursorToEnd(); + } + + /** + * Set cursor position to start + */ + + }, { + key: 'moveCursorToStart', + value: function moveCursorToStart() { + this.getCurrentModeEditor().moveCursorToStart(); + } + + /** + * Set markdown syntax text. + * @param {string} markdown - markdown syntax text. + * @param {boolean} [cursorToEnd=true] - move cursor to contents end + */ + + }, { + key: 'setMarkdown', + value: function setMarkdown(markdown) { + var cursorToEnd = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + markdown = markdown || ''; + + if (this.isMarkdownMode()) { + this.mdEditor.setValue(markdown, cursorToEnd); + } else { + this.wwEditor.setValue(this.convertor.toHTML(markdown), cursorToEnd); + } + + this.eventManager.emit('setMarkdownAfter', markdown); + } + + /** + * Set html value. + * @param {string} html - html syntax text + * @param {boolean} [cursorToEnd=true] - move cursor to contents end + */ + + }, { + key: 'setHtml', + value: function setHtml(html) { + var cursorToEnd = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + html = html || ''; + this.wwEditor.setValue(html, cursorToEnd); + + if (this.isMarkdownMode()) { + var markdown = this.convertor.toMarkdown(this.wwEditor.getValue(), this.toMarkOptions); + this.mdEditor.setValue(markdown, cursorToEnd); + this.eventManager.emit('setMarkdownAfter', markdown); + } + } + + /** + * Set markdown syntax text. + * @param {string} value - markdown syntax text + * @param {boolean} [cursorToEnd=true] - move cursor to contents end + * @deprecated + */ + + }, { + key: 'setValue', + value: function setValue(value) { + var cursorToEnd = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + this.setMarkdown(value, cursorToEnd); + } + + /** + * Get markdown syntax text. + * @returns {string} + */ + + }, { + key: 'getMarkdown', + value: function getMarkdown() { + var markdown = void 0; + + if (this.isMarkdownMode()) { + markdown = this.mdEditor.getValue(); + } else { + markdown = this.convertor.toMarkdown(this.wwEditor.getValue(), this.toMarkOptions); + } + + return markdown; + } + + /** + * Get html syntax text. + * @returns {string} + */ + + }, { + key: 'getHtml', + value: function getHtml() { + if (this.isWysiwygMode()) { + this.mdEditor.setValue(this.convertor.toMarkdown(this.wwEditor.getValue(), this.toMarkOptions)); + } + + return this.convertor.toHTML(this.mdEditor.getValue()); + } + + /** + * Get editor value. + * @returns {string} + * @deprecated + */ + + }, { + key: 'getValue', + value: function getValue() { + return this.getMarkdown(); + } + + /** + * Insert text + * @param {string} text - text string to insert + */ + + }, { + key: 'insertText', + value: function insertText(text) { + if (this.isMarkdownMode()) { + this.mdEditor.replaceSelection(text); + } else { + this.wwEditor.insertText(text); + } + } + + /** + * Add widget to selection + * @param {Range} selection Current selection + * @param {Node} node widget node + * @param {string} style Adding style "over" or "bottom" + * @param {number} [offset] Offset for adjust position + */ + + }, { + key: 'addWidget', + value: function addWidget(selection, node, style, offset) { + this.getCurrentModeEditor().addWidget(selection, node, style, offset); + } + + /** + * Set and return edithr height + * @param {string} height - editor height + * @returns {string} editor height + */ + + }, { + key: 'height', + value: function height(_height) { + if (_tuiCodeSnippet2.default.isExisty(_height)) { + if (_height === 'auto') { + (0, _jquery2.default)(this.options.el).addClass('auto-height'); + this.minHeight(this.minHeight()); + } else { + (0, _jquery2.default)(this.options.el).removeClass('auto-height'); + this.minHeight(_height); + } + if (_tuiCodeSnippet2.default.isNumber(_height)) { + _height = _height + 'px'; + } + + this.options.el.style.height = _height; + this._height = _height; + } + + return this._height; + } + + /** + * Set / Get min content height + * @param {string} minHeight - min content height in pixel + * @returns {string} - min height in pixel + */ + + }, { + key: 'minHeight', + value: function minHeight(_minHeight) { + if (_tuiCodeSnippet2.default.isExisty(_minHeight)) { + var editorHeight = this._ui.getEditorHeight(); + var editorSectionHeight = this._ui.getEditorSectionHeight(); + var diffHeight = editorHeight - editorSectionHeight; + this._minHeight = _minHeight; + + _minHeight = parseInt(_minHeight, 10); + _minHeight = Math.max(_minHeight - diffHeight, 0); + + this.wwEditor.setMinHeight(_minHeight); + this.mdEditor.setMinHeight(_minHeight); + this.preview.setMinHeight(_minHeight); + } + + return this._minHeight; + } + + /** + * Get current editor mode name + * @returns {Object} MarkdownEditor or WysiwygEditor + */ + + }, { + key: 'getCurrentModeEditor', + value: function getCurrentModeEditor() { + var editor = void 0; + + if (this.isMarkdownMode()) { + editor = this.mdEditor; + } else { + editor = this.wwEditor; + } + + return editor; + } + + /** + * Return true if current editor mode is Markdown + * @returns {boolean} + */ + + }, { + key: 'isMarkdownMode', + value: function isMarkdownMode() { + return this.currentMode === 'markdown'; + } + + /** + * Return true if current editor mode is WYSIWYG + * @returns {boolean} + */ + + }, { + key: 'isWysiwygMode', + value: function isWysiwygMode() { + return this.currentMode === 'wysiwyg'; + } + + /** + * Return false + * @returns {boolean} + */ + + }, { + key: 'isViewer', + value: function isViewer() { + return false; + } + + /** + * Get current Markdown editor's preview style + * @returns {string} + */ + + }, { + key: 'getCurrentPreviewStyle', + value: function getCurrentPreviewStyle() { + return this.mdPreviewStyle; + } + + /** + * Change editor's mode to given mode string + * @param {string} mode - Editor mode name of want to change + * @param {boolean} [isWithoutFocus] - Change mode without focus + */ + + }, { + key: 'changeMode', + value: function changeMode(mode, isWithoutFocus) { + if (this.currentMode === mode) { + return; + } + + this.eventManager.emit('changeModeBefore', this.currentMode); + + this.currentMode = mode; + + if (this.isWysiwygMode()) { + this.layout.switchToWYSIWYG(); + this.wwEditor.setValue(this.convertor.toHTML(this.mdEditor.getValue()), !isWithoutFocus); + this.eventManager.emit('changeModeToWysiwyg'); + } else { + this.layout.switchToMarkdown(); + this.mdEditor.resetState(); + this.mdEditor.setValue(this.convertor.toMarkdown(this.wwEditor.getValue(), this.toMarkOptions), !isWithoutFocus); + this.getCodeMirror().refresh(); + this.eventManager.emit('changeModeToMarkdown'); + } + + this.eventManager.emit('changeMode', mode); + + if (!isWithoutFocus) { + this.focus(); + } + } + + /** + * Remove TUIEditor from document + */ + + }, { + key: 'remove', + value: function remove() { + var self = this; + var i = __nedInstance.length - 1; + this.wwEditor.remove(); + this.mdEditor.remove(); + this.layout.remove(); + this.preview.remove(); + + if (this.getUI()) { + this.getUI().remove(); + } + + this.eventManager.emit('removeEditor'); + this.eventManager.events.forEach(function (value, key) { + self.off(key); + }); + this.eventManager = null; + + for (; i >= 0; i -= 1) { + if (__nedInstance[i] === this) { + __nedInstance.splice(i, 1); + } + } + } + + /** + * Hide TUIEditor + */ + + }, { + key: 'hide', + value: function hide() { + this.eventManager.emit('hide', this); + } + + /** + * Show TUIEditor + */ + + }, { + key: 'show', + value: function show() { + this.eventManager.emit('show', this); + this.getCodeMirror().refresh(); + } + + /** + * Scroll Editor content to Top + * @param {number} value Scroll amount + * @returns {number} + */ + + }, { + key: 'scrollTop', + value: function scrollTop(value) { + return this.getCurrentModeEditor().scrollTop(value); + } + + /** + * Set UI to private UI property + * @param {UI} UI UI instance + */ + + }, { + key: 'setUI', + value: function setUI(UI) { + this._ui = UI; + } + + /** + * Get _ui property + * @returns {DefaultUI|UI} + */ + + }, { + key: 'getUI', + value: function getUI() { + return this._ui; + } + + /** + * Reset TUIEditor + */ + + }, { + key: 'reset', + value: function reset() { + this.wwEditor.reset(); + this.mdEditor.reset(); + } + + /** + * Get current range + * @returns {{start, end}|Range} + */ + + }, { + key: 'getRange', + value: function getRange() { + return this.getCurrentModeEditor().getRange(); + } + + /** + * Get text object of current range + * @param {{start, end}|Range} range Range object of each editor + * @returns {MdTextObject|WwTextObject} TextObject class + */ + + }, { + key: 'getTextObject', + value: function getTextObject(range) { + return this.getCurrentModeEditor().getTextObject(range); + } + + /** + * get selected text + * @returns {string} - selected text + */ + + }, { + key: 'getSelectedText', + value: function getSelectedText() { + var range = this.getRange(); + var textObject = this.getTextObject(range); + + return textObject.getTextContent() || ''; + } + + /** + * Set the placeholder on all editors + * @param {string} placeholder - placeholder to set + */ + + }, { + key: 'setPlaceholder', + value: function setPlaceholder(placeholder) { + this.mdEditor.setPlaceholder(placeholder); + this.wwEditor.setPlaceholder(placeholder); + } + + /** + * Get instance of TUIEditor + * @returns {Array} + */ + + }], [{ + key: 'getInstances', + value: function getInstances() { + return __nedInstance; + } + + /** + * Define extension + * @param {string} name Extension name + * @param {function} ext extension + */ + + }, { + key: 'defineExtension', + value: function defineExtension(name, ext) { + _extManager2.default.defineExtension(name, ext); + } + + /** + * Factory method for Editor + * @param {object} options Option for initialize TUIEditor + * @returns {object} ToastUIEditor or ToastUIEditorViewer + */ + + }, { + key: 'factory', + value: function factory(options) { + var tuiEditor = void 0; + + if (options.viewer) { + tuiEditor = new _viewer2.default(options); + } else { + tuiEditor = new ToastUIEditor(options); + } + + return tuiEditor; + } + }]); + + return ToastUIEditor; +}(); + +/** + * check whther is viewer + * @type {boolean} + */ + + +ToastUIEditor.isViewer = false; + +/** + * I18n instance + * @type {I18n} + */ +ToastUIEditor.i18n = _i18n2.default; + +/** + * domUtil instance + * @type {DomUtil} + * @ignore + */ +ToastUIEditor.domUtils = _domUtils2.default; + +/** + * CodeBlockManager instance + * @type {CodeBlockManager} + */ +ToastUIEditor.codeBlockManager = _codeBlockManager2.default; + +/** + * Button class + * @type {Class.'); + this.$el.append(this._$buttonOpenModalEditor); + this._eventManager.emit('removeEditor', function () { + _this2._$buttonOpenModalEditor.off('click'); + _this2._$buttonOpenModalEditor = null; + }); + } + }, { + key: '_initDOMEvent', + value: function _initDOMEvent() { + var _this3 = this; + + this._$buttonOpenModalEditor.on('click', function () { + return _this3._openPopupCodeBlockEditor(); + }); + } + }, { + key: '_openPopupCodeBlockEditor', + value: function _openPopupCodeBlockEditor() { + this._eventManager.emit('openPopupCodeBlockEditor', this.getAttachedElement()); + } + }, { + key: '_updateLanguage', + value: function _updateLanguage() { + var attachedElement = this.getAttachedElement(); + var language = attachedElement ? attachedElement.getAttribute('data-language') : null; + + this._$languageLabel.text(language ? language : 'text'); + } + + /** + * update gadget position + * @protected + * @override + */ + + }, { + key: 'syncLayout', + value: function syncLayout() { + var $attachedElement = (0, _jquery2.default)(this.getAttachedElement()); + var offset = $attachedElement.offset(); + + offset.left = offset.left + ($attachedElement.outerWidth() - GADGET_WIDTH); + + this.$el.offset(offset); + this.$el.height(GADGET_HEIGHT); + this.$el.width(GADGET_WIDTH); + } + + /** + * on show + * @protected + * @override + */ + + }, { + key: 'onShow', + value: function onShow() { + var _this4 = this; + + _get(CodeBlockGadget.prototype.__proto__ || Object.getPrototypeOf(CodeBlockGadget.prototype), 'onShow', this).call(this); + + this._onAttachedElementChange = function () { + return _this4._updateLanguage(); + }; + (0, _jquery2.default)(this.getAttachedElement()).on(EVENT_LANGUAGE_CHANGED, this._onAttachedElementChange); + + this._updateLanguage(); + } + + /** + * on hide + * @protected + * @override + */ + + }, { + key: 'onHide', + value: function onHide() { + (0, _jquery2.default)(this.getAttachedElement()).off(EVENT_LANGUAGE_CHANGED, this._onAttachedElementChange); + + _get(CodeBlockGadget.prototype.__proto__ || Object.getPrototypeOf(CodeBlockGadget.prototype), 'onHide', this).call(this); + } + }]); + + return CodeBlockGadget; +}(_blockOverlay2.default); + +exports.default = CodeBlockGadget; + +/***/ }), +/* 82 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * @fileoverview Implements UI block overlay + * @author NHN FE Development Lab + */ + + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * Class BlockOverlay + * @param {Object} options - options + * @param {EventManager} options.eventManager - event manager instance + * @param {HTMLElement} options.container - container element + * @param {string} options.attachedSelector - selector string to find attached element + * @ignore + */ +var BlockOverlay = function () { + function BlockOverlay(_ref) { + var eventManager = _ref.eventManager, + container = _ref.container, + attachedSelector = _ref.attachedSelector; + + _classCallCheck(this, BlockOverlay); + + this._eventManager = eventManager; + this._attachedSelector = '[contenteditable=true] ' + attachedSelector; + this._$container = (0, _jquery2.default)(container); + this._$attachedElement = null; + + /** + * is activated. + * if this blockOverlay is active, It always be visible unconditionally. + * @type {boolean} + * @private + */ + this.active = false; + + this._createElement(); + this._initEvent(); + } + + _createClass(BlockOverlay, [{ + key: '_createElement', + value: function _createElement() { + this.$el = (0, _jquery2.default)('
'); + this.$el.css({ + position: 'absolute', + display: 'none', + 'z-index': 1 + }); + this._$container.append(this.$el); + } + }, { + key: '_initEvent', + value: function _initEvent() { + var _this = this; + + this._eventManager.listen('change', this._onChange.bind(this)); + this._eventManager.listen('mouseover', this._onMouseOver.bind(this)); + this._eventManager.listen('focus', function () { + _this.setVisibility(false); + }); + this._eventManager.listen('mousedown', function () { + _this.setVisibility(false); + }); + } + }, { + key: '_onChange', + value: function _onChange() { + if (this._$attachedElement && _jquery2.default.contains(document, this._$attachedElement[0])) { + this.syncLayout(); + } else { + this.setVisibility(false); + } + } + }, { + key: '_onMouseOver', + value: function _onMouseOver(ev) { + var originalEvent = ev.data; + var $eventTarget = (0, _jquery2.default)(originalEvent.target); + var $attachedElement = $eventTarget.closest(this._attachedSelector); + + if ($attachedElement.length) { + this._$attachedElement = $attachedElement; + this.setVisibility(true); + } else if ($eventTarget.closest(this.$el).length) { + this.setVisibility(true); + } else if (!this.active) { + this.setVisibility(false); + } + } + + /** + * update blockOverlay position & size update to attached element + * you may want to override this to adjust position & size + * @protected + */ + + }, { + key: 'syncLayout', + value: function syncLayout() { + this.$el.offset(this._$attachedElement.offset()); + this.$el.width(this._$attachedElement.outerWidth()); + this.$el.height(this._$attachedElement.outerHeight()); + } + + /** + * attached element + * @protected + * @returns {HTMLElement} - attached element + */ + + }, { + key: 'getAttachedElement', + value: function getAttachedElement() { + return this._$attachedElement ? this._$attachedElement.get(0) : null; + } + + /** + * visibility + * @protected + * @returns {boolean} visibility + */ + + }, { + key: 'getVisibility', + value: function getVisibility() { + return this.$el.css('display') === 'block'; + } + + /** + * visibility + * @param {boolean} visibility - is visible + * @protected + */ + + }, { + key: 'setVisibility', + value: function setVisibility(visibility) { + if (visibility && this._$attachedElement) { + if (!this.getVisibility()) { + this.$el.css('display', 'block'); + this.syncLayout(); + this.onShow(); + } + } else if (!visibility) { + if (this.getVisibility()) { + this.$el.css('display', 'none'); + this.onHide(); + } + } + } + + /** + * called on show. you may want to override to get the event + * @protected + * @abstract + */ + + }, { + key: 'onShow', + value: function onShow() {} + + /** + * called on hide. you may want to override to get the event + * @protected + */ + + }, { + key: 'onHide', + value: function onHide() { + this.active = false; + this._$attachedElement = null; + } + }]); + + return BlockOverlay; +}(); + +exports.default = BlockOverlay; + +/***/ }), +/* 83 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * @fileoverview editor layout + * @author NHN FE Development Lab + */ + + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * Editor container template + * @type {string} + * @ignore + */ +var containerTmpl = ['
', '
', '
', '
', '
', '
', '
', '
', '
', '
'].join(''); + +/** + * Class Layout + * @param {object} options - Option object + * @param {EventManager} eventManager - Event manager instance + * @ignore + */ + +var Layout = function () { + function Layout(options, eventManager) { + _classCallCheck(this, Layout); + + this.$el = (0, _jquery2.default)(options.el); + this.height = options.height; + this.type = options.initialEditType; + this.eventManager = eventManager; + + this.init(); + this._initEvent(); + } + + /** + * Initializer + * @protected + */ + + + _createClass(Layout, [{ + key: 'init', + value: function init() { + this._renderLayout(); + + this._initMarkdownAndPreviewSection(); + this._initWysiwygSection(); + } + + /** + * Initialize show and hide event + * @private + */ + + }, { + key: '_initEvent', + value: function _initEvent() { + this.eventManager.listen('hide', this.hide.bind(this)); + this.eventManager.listen('show', this.show.bind(this)); + } + + /** + * Create editor container with template + * @private + */ + + }, { + key: '_renderLayout', + value: function _renderLayout() { + this.$el.css('box-sizing', 'border-box'); + this.$containerEl = (0, _jquery2.default)(containerTmpl).appendTo(this.$el); + } + + /** + * Switch editor mode to WYSIWYG + */ + + }, { + key: 'switchToWYSIWYG', + value: function switchToWYSIWYG() { + this.$containerEl.removeClass('te-md-mode'); + this.$containerEl.addClass('te-ww-mode'); + } + + /** + * Switch editor mode to Markdown + */ + + }, { + key: 'switchToMarkdown', + value: function switchToMarkdown() { + this.$containerEl.removeClass('te-ww-mode'); + this.$containerEl.addClass('te-md-mode'); + } + + /** + * Initialize editor to Markdown and set preview section + * @private + */ + + }, { + key: '_initMarkdownAndPreviewSection', + value: function _initMarkdownAndPreviewSection() { + this.$mdEditorContainerEl = this.$containerEl.find('.te-md-container .te-editor'); + this.$previewEl = this.$containerEl.find('.te-md-container .te-preview'); + } + + /** + * Initialize editor to WYSIWYG + * @private + */ + + }, { + key: '_initWysiwygSection', + value: function _initWysiwygSection() { + this.$wwEditorContainerEl = this.$containerEl.find('.te-ww-container .te-editor'); + } + + /** + * Set preview to vertical split style + * @private + */ + + }, { + key: '_verticalSplitStyle', + value: function _verticalSplitStyle() { + this.$containerEl.find('.te-md-container').removeClass('te-preview-style-tab'); + this.$containerEl.find('.te-md-container').addClass('te-preview-style-vertical'); + } + + /** + * Set tab style preview mode + * @private + */ + + }, { + key: '_tabStyle', + value: function _tabStyle() { + this.$containerEl.find('.te-md-container').removeClass('te-preview-style-vertical'); + this.$containerEl.find('.te-md-container').addClass('te-preview-style-tab'); + } + + /** + * Toggle preview style between tab and vertical split + * @param {string} style Preview style ('tab' or 'vertical') + */ + + }, { + key: 'changePreviewStyle', + value: function changePreviewStyle(style) { + if (style === 'tab') { + this._tabStyle(); + } else if (style === 'vertical') { + this._verticalSplitStyle(); + } + } + + /** + * Hide Editor + */ + + }, { + key: 'hide', + value: function hide() { + this.$el.find('.tui-editor').addClass('te-hide'); + } + + /** + * Show Editor + */ + + }, { + key: 'show', + value: function show() { + this.$el.find('.tui-editor').removeClass('te-hide'); + } + + /** + * Remove Editor + */ + + }, { + key: 'remove', + value: function remove() { + this.$el.find('.tui-editor').remove(); + } + + /** + * Get jQuery wrapped editor container element + * @returns {jQuery} + */ + + }, { + key: 'getEditorEl', + value: function getEditorEl() { + return this.$containerEl; + } + + /** + * Get jQuery wrapped preview element + * @returns {jQuery} + */ + + }, { + key: 'getPreviewEl', + value: function getPreviewEl() { + return this.$previewEl; + } + + /** + * Get jQuery wrapped Markdown editor element + * @returns {jQuery} + */ + + }, { + key: 'getMdEditorContainerEl', + value: function getMdEditorContainerEl() { + return this.$mdEditorContainerEl; + } + + /** + * Get jQuery wrapped WYSIWYG editor element + * @returns {jQuery} + */ + + }, { + key: 'getWwEditorContainerEl', + value: function getWwEditorContainerEl() { + return this.$wwEditorContainerEl; + } + }]); + + return Layout; +}(); + +exports.default = Layout; + +/***/ }), +/* 84 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * @fileoverview Implements Command + * @author NHN FE Development Lab + */ + + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * Class Command + * @param {string} name Command name + * @param {number} type Command type (Command.TYPE) + * @param {Array.} [keyMap] keyMap + * @ignore + */ +var Command = function () { + function Command(name, type, keyMap) { + _classCallCheck(this, Command); + + this.name = name; + this.type = type; + + if (keyMap) { + this.setKeyMap(keyMap); + } + } + + /** + * returns Name of command + * @returns {string} Command Name + */ + + + _createClass(Command, [{ + key: 'getName', + value: function getName() { + return this.name; + } + + /** + * returns Type of command + * @returns {number} Command Command type number + */ + + }, { + key: 'getType', + value: function getType() { + return this.type; + } + + /** + * returns whether Command Type is Markdown or not + * @returns {boolean} result + */ + + }, { + key: 'isMDType', + value: function isMDType() { + return this.type === Command.TYPE.MD; + } + + /** + * returns whether Command Type is Wysiwyg or not + * @returns {boolean} result + */ + + }, { + key: 'isWWType', + value: function isWWType() { + return this.type === Command.TYPE.WW; + } + + /** + * returns whether Command Type is Global or not + * @returns {boolean} result + */ + + }, { + key: 'isGlobalType', + value: function isGlobalType() { + return this.type === Command.TYPE.GB; + } + + /** + * Set keymap value for each os + * @param {string} win Windows Key(and etc) + * @param {string} mac Mac osx key + */ + + }, { + key: 'setKeyMap', + value: function setKeyMap(win, mac) { + this.keyMap = [win, mac]; + } + }]); + + return Command; +}(); + +/** + * Command factory method + * @param {string} typeStr Editor type name + * @param {object} props Property + * @param {string} props.name Command name + * @param {number} props.type Command type number + * @returns {Command} + * @static + */ + + +Command.factory = function (typeStr, props) { + var type = void 0; + + if (typeStr === 'markdown') { + type = Command.TYPE.MD; + } else if (typeStr === 'wysiwyg') { + type = Command.TYPE.WW; + } else if (typeStr === 'global') { + type = Command.TYPE.GB; + } + + var command = new Command(props.name, type); + + _tuiCodeSnippet2.default.extend(command, props); + + return command; +}; + +/** + * Command Type Constant + * markdown : 0 + * wysiwyg : 1 + * global : 2 + * @type {object} + * @private + */ +Command.TYPE = { + MD: 0, + WW: 1, + GB: 2 +}; + +exports.default = Command; + +/***/ }), +/* 85 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__85__; + +/***/ }), +/* 86 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +// Copyright (c) 2016, Revin Guillen. +// Distributed under an MIT license: https://github.com/revin/markdown-it-task-lists/ + +/** + * @fileoverview Implements markdownitTaskPlugin + * @modifier Sungho Kim(sungho-kim@nhn.com) FE Development Lab/NHN + * @modifier Junghwan Park(junghwan.park@nhn.com) FE Development Lab/NHN + */ +/* eslint-disable */ + +/** + * Task list renderer for Markdown-it + * @param {object} markdownit Markdown-it instance + * @ignore + */ +var MarkdownitTaskRenderer = function MarkdownitTaskRenderer(markdownit) { + markdownit.core.ruler.after('inline', 'tui-task-list', function (state) { + var TASK_LIST_ITEM_CLASS_NAME = 'task-list-item'; + var CHECKED_CLASS_NAME = 'checked'; + var tokens = state.tokens; + var className; + var tokenIndex; + + // tokenIndex=0 'ul', tokenIndex=1 'li', tokenIndex=2 'p_open' + for (tokenIndex = 2; tokenIndex < tokens.length; tokenIndex += 1) { + if (isTaskListItemToken(tokens, tokenIndex)) { + if (isChecked(tokens[tokenIndex])) { + className = TASK_LIST_ITEM_CLASS_NAME + ' ' + CHECKED_CLASS_NAME; + } else { + className = TASK_LIST_ITEM_CLASS_NAME; + } + + removeMarkdownTaskFormatText(tokens[tokenIndex]); + + setTokenAttribute(tokens[tokenIndex - 2], 'class', className); + setTokenAttribute(tokens[tokenIndex - 2], 'data-te-task', ''); + } + } + }); +}; + +/** + * Remove task format text for rendering + * @param {object} token Token object + * @ignore + */ +function removeMarkdownTaskFormatText(token) { + // '[X] ' length is 4 + // FIXED: we don't need first space + token.content = token.content.slice(4); + token.children[0].content = token.children[0].content.slice(4); +} + +/** + * Return boolean value whether task checked or not + * @param {object} token Token object + * @returns {boolean} + * @ignore + */ +function isChecked(token) { + var checked = false; + + if (token.content.indexOf('[x]') === 0 || token.content.indexOf('[X]') === 0) { + checked = true; + } + + return checked; +} + +/** + * Set attribute of passed token + * @param {object} token Token object + * @param {string} attributeName Attribute name for set + * @param {string} attributeValue Attribute value for set + * @ignore + */ +function setTokenAttribute(token, attributeName, attributeValue) { + var index = token.attrIndex(attributeName); + var attr = [attributeName, attributeValue]; + + if (index < 0) { + token.attrPush(attr); + } else { + token.attrs[index] = attr; + } +} + +/** + * Return boolean value whether task list item or not + * @param {array} tokens Token object + * @param {number} index Number of token index + * @returns {boolean} + * @ignore + */ +function isTaskListItemToken(tokens, index) { + return tokens[index].type === 'inline' && tokens[index - 1].type === 'paragraph_open' && tokens[index - 2].type === 'list_item_open' && (tokens[index].content.indexOf('[ ]') === 0 || tokens[index].content.indexOf('[x]') === 0 || tokens[index].content.indexOf('[X]') === 0); +} +/* eslint-enable */ + +module.exports = MarkdownitTaskRenderer; + +/***/ }), +/* 87 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +// Copyright (c) 2016, Revin Guillen. +// Distributed under an MIT license: https://github.com/revin/markdown-it-task-lists/ +/* eslint-disable */ +/** + * @fileoverview Implements markdownitCodeBlockPlugin + * @modifier NHN FE Development Lab + */ + +/** + * Code block renderer for Markdown-it + * @param {object} markdownit Markdown-it instance + * @ignore + */ +var MarkdownitCodeBlockRenderer = function MarkdownitCodeBlockRenderer(markdownit) { + markdownit.core.ruler.after('block', 'tui-code-block', function (state) { + var DEFAULT_NUMBER_OF_BACKTICKS = 3; + var tokens = state.tokens; + var currentToken, tokenIndex, numberOfBackticks; + + for (tokenIndex = 0; tokenIndex < tokens.length; tokenIndex += 1) { + currentToken = tokens[tokenIndex]; + + if (isCodeFenceToken(currentToken)) { + numberOfBackticks = currentToken.markup.length; + if (numberOfBackticks > DEFAULT_NUMBER_OF_BACKTICKS) { + setTokenAttribute(currentToken, 'data-backticks', numberOfBackticks, true); + } + if (currentToken.info) { + setTokenAttribute(currentToken, 'data-language', escape(currentToken.info.replace(' ', ''), true)); + } + } + } + }); +}; + +/** + * Set attribute of passed token + * @param {object} token Token object + * @param {string} attributeName Attribute name for set + * @param {string} attributeValue Attribute value for set + * @ignore + */ +function setTokenAttribute(token, attributeName, attributeValue) { + var index = token.attrIndex(attributeName); + var attr = [attributeName, attributeValue]; + + if (index < 0) { + token.attrPush(attr); + } else { + token.attrs[index] = attr; + } +} +/** + * Return boolean value whether passed token is code fence or not + * @param {object} token Token object + * @returns {boolean} + * @ignore + */ +function isCodeFenceToken(token) { + return token.block === true && token.tag === 'code' && token.type === 'fence'; +} + +/** + * escape code from markdown-it + * @param {string} html HTML string + * @param {string} encode Boolean value of whether encode or not + * @returns {string} + * @ignore + */ +function escape(html, encode) { + return html.replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, '''); +} +/* eslint-enable */ + +module.exports = MarkdownitCodeBlockRenderer; + +/***/ }), +/* 88 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +// Copyright (c) 2014 Vitaly Puzrin, Alex Kocharin. +// Distributed under an ISC license: https://github.com/markdown-it/markdown-it/ +/** + * @fileoverview Implements MarkdownItCodeRenderer + * @modifier NHN FE Development Lab + */ + +/* eslint-disable */ +module.exports = function code(state, startLine, endLine /*, silent*/) { + // Added by Junghwan Park + var FIND_LIST_RX = / {0,3}(?:-|\*|\d\.) /; + var lines = state.src.split('\n'); + var currentLine = lines[startLine]; + // Added by Junghwan Park + + var nextLine, + last, + token, + emptyLines = 0; + + // Add condition by Junghwan Park + if (currentLine.match(FIND_LIST_RX) || state.sCount[startLine] - state.blkIndent < 4) { + // Add condition by Junghwan Park + return false; + } + + last = nextLine = startLine + 1; + + while (nextLine < endLine) { + if (state.isEmpty(nextLine)) { + emptyLines++; + + // workaround for lists: 2 blank lines should terminate indented + // code block, but not fenced code block + if (emptyLines >= 2 && state.parentType === 'list') { + break; + } + + nextLine++; + continue; + } + + emptyLines = 0; + + if (state.sCount[nextLine] - state.blkIndent >= 4) { + nextLine++; + last = nextLine; + continue; + } + break; + } + + state.line = last; + + token = state.push('code_block', 'code', 0); + token.content = state.getLines(startLine, last, 4 + state.blkIndent, true); + token.map = [startLine, state.line]; + + return true; +}; +/* eslint-enable */ + +/***/ }), +/* 89 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright (c) 2014 Vitaly Puzrin, Alex Kocharin. +// Distributed under MIT license: https://github.com/markdown-it/markdown-it/ +/** + * @fileoverview Implements markdownitCodeBlockQuoteRenderer + * @modifier NHN FE Development Lab + */ + +/* eslint-disable */ + +// Block quotes + + + +// prevent quote, pre in list #811 +// ref: #989 +// #811 START +// var isSpace = require('../common/utils').isSpace; + +function isSpace(code) { + switch (code) { + case 0x09: + case 0x20: + return true; + } + return false; +} +// #811 END + +module.exports = function blockquote(state, startLine, endLine, silent) { + var adjustTab, + ch, + i, + initial, + l, + lastLineEmpty, + lines, + nextLine, + offset, + oldBMarks, + oldBSCount, + oldIndent, + oldParentType, + oldSCount, + oldTShift, + spaceAfterMarker, + terminate, + terminatorRules, + token, + wasOutdented, + oldLineMax = state.lineMax, + pos = state.bMarks[startLine] + state.tShift[startLine], + max = state.eMarks[startLine]; + + // #811 START + var FIND_LIST_RX = /(?:-|\*|\d+\.) {1,4}(?:> {0,3})[^>]*$/; + var sourceLines = state.src.split('\n'); + var currentLine = sourceLines[startLine]; + // #811 END + + // if it's indented more than 3 spaces, it should be a code block + if (state.sCount[startLine] - state.blkIndent >= 4) { + return false; + } + + // check the block quote marker + if (state.src.charCodeAt(pos++) !== 0x3E /* > */) { + return false; + } + // #811 START + // check block quote in list + if (currentLine.match(FIND_LIST_RX) /*&& !currentLine.match(/^ {0,6}>/)*/) { + return false; + } + // #811 END + + // we know that it's going to be a valid blockquote, + // so no point trying to find the end of it in silent mode + if (silent) { + return true; + } + + // skip spaces after ">" and re-calculate offset + initial = offset = state.sCount[startLine] + pos - (state.bMarks[startLine] + state.tShift[startLine]); + + // skip one optional space after '>' + if (state.src.charCodeAt(pos) === 0x20 /* space */) { + // ' > test ' + // ^ -- position start of line here: + pos++; + initial++; + offset++; + adjustTab = false; + spaceAfterMarker = true; + } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) { + spaceAfterMarker = true; + + if ((state.bsCount[startLine] + offset) % 4 === 3) { + // ' >\t test ' + // ^ -- position start of line here (tab has width===1) + pos++; + initial++; + offset++; + adjustTab = false; + } else { + // ' >\t test ' + // ^ -- position start of line here + shift bsCount slightly + // to make extra space appear + adjustTab = true; + } + } else { + spaceAfterMarker = false; + } + + oldBMarks = [state.bMarks[startLine]]; + state.bMarks[startLine] = pos; + + while (pos < max) { + ch = state.src.charCodeAt(pos); + + if (isSpace(ch)) { + if (ch === 0x09) { + offset += 4 - (offset + state.bsCount[startLine] + (adjustTab ? 1 : 0)) % 4; + } else { + offset++; + } + } else { + break; + } + + pos++; + } + + oldBSCount = [state.bsCount[startLine]]; + state.bsCount[startLine] = state.sCount[startLine] + 1 + (spaceAfterMarker ? 1 : 0); + + lastLineEmpty = pos >= max; + + oldSCount = [state.sCount[startLine]]; + state.sCount[startLine] = offset - initial; + + oldTShift = [state.tShift[startLine]]; + state.tShift[startLine] = pos - state.bMarks[startLine]; + + terminatorRules = state.md.block.ruler.getRules('blockquote'); + + oldParentType = state.parentType; + state.parentType = 'blockquote'; + wasOutdented = false; + + // Search the end of the block + // + // Block ends with either: + // 1. an empty line outside: + // ``` + // > test + // + // ``` + // 2. an empty line inside: + // ``` + // > + // test + // ``` + // 3. another tag: + // ``` + // > test + // - - - + // ``` + for (nextLine = startLine + 1; nextLine < endLine; nextLine++) { + // check if it's outdented, i.e. it's inside list item and indented + // less than said list item: + // + // ``` + // 1. anything + // > current blockquote + // 2. checking this line + // ``` + if (state.sCount[nextLine] < state.blkIndent) wasOutdented = true; + + pos = state.bMarks[nextLine] + state.tShift[nextLine]; + max = state.eMarks[nextLine]; + + if (pos >= max) { + // Case 1: line is not inside the blockquote, and this line is empty. + break; + } + + if (state.src.charCodeAt(pos++) === 0x3E /* > */ && !wasOutdented) { + // This line is inside the blockquote. + + // skip spaces after ">" and re-calculate offset + initial = offset = state.sCount[nextLine] + pos - (state.bMarks[nextLine] + state.tShift[nextLine]); + + // skip one optional space after '>' + if (state.src.charCodeAt(pos) === 0x20 /* space */) { + // ' > test ' + // ^ -- position start of line here: + pos++; + initial++; + offset++; + adjustTab = false; + spaceAfterMarker = true; + } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) { + spaceAfterMarker = true; + + if ((state.bsCount[nextLine] + offset) % 4 === 3) { + // ' >\t test ' + // ^ -- position start of line here (tab has width===1) + pos++; + initial++; + offset++; + adjustTab = false; + } else { + // ' >\t test ' + // ^ -- position start of line here + shift bsCount slightly + // to make extra space appear + adjustTab = true; + } + } else { + spaceAfterMarker = false; + } + + oldBMarks.push(state.bMarks[nextLine]); + state.bMarks[nextLine] = pos; + + while (pos < max) { + ch = state.src.charCodeAt(pos); + + if (isSpace(ch)) { + if (ch === 0x09) { + offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4; + } else { + offset++; + } + } else { + break; + } + + pos++; + } + + lastLineEmpty = pos >= max; + + oldBSCount.push(state.bsCount[nextLine]); + state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0); + + oldSCount.push(state.sCount[nextLine]); + state.sCount[nextLine] = offset - initial; + + oldTShift.push(state.tShift[nextLine]); + state.tShift[nextLine] = pos - state.bMarks[nextLine]; + continue; + } + + // Case 2: line is not inside the blockquote, and the last line was empty. + if (lastLineEmpty) { + break; + } + + // Case 3: another tag found. + terminate = false; + for (i = 0, l = terminatorRules.length; i < l; i++) { + if (terminatorRules[i](state, nextLine, endLine, true)) { + terminate = true; + break; + } + } + + if (terminate) { + // Quirk to enforce "hard termination mode" for paragraphs; + // normally if you call `tokenize(state, startLine, nextLine)`, + // paragraphs will look below nextLine for paragraph continuation, + // but if blockquote is terminated by another tag, they shouldn't + state.lineMax = nextLine; + + if (state.blkIndent !== 0) { + // state.blkIndent was non-zero, we now set it to zero, + // so we need to re-calculate all offsets to appear as + // if indent wasn't changed + oldBMarks.push(state.bMarks[nextLine]); + oldBSCount.push(state.bsCount[nextLine]); + oldTShift.push(state.tShift[nextLine]); + oldSCount.push(state.sCount[nextLine]); + state.sCount[nextLine] -= state.blkIndent; + } + + break; + } + + oldBMarks.push(state.bMarks[nextLine]); + oldBSCount.push(state.bsCount[nextLine]); + oldTShift.push(state.tShift[nextLine]); + oldSCount.push(state.sCount[nextLine]); + + // A negative indentation means that this is a paragraph continuation + // + state.sCount[nextLine] = -1; + } + + oldIndent = state.blkIndent; + state.blkIndent = 0; + + token = state.push('blockquote_open', 'blockquote', 1); + token.markup = '>'; + token.map = lines = [startLine, 0]; + + state.md.block.tokenize(state, startLine, nextLine); + + token = state.push('blockquote_close', 'blockquote', -1); + token.markup = '>'; + + state.lineMax = oldLineMax; + state.parentType = oldParentType; + lines[1] = state.line; + + // Restore original tShift; this might not be necessary since the parser + // has already been here, but just to make sure we can do that. + for (i = 0; i < oldTShift.length; i++) { + state.bMarks[i + startLine] = oldBMarks[i]; + state.tShift[i + startLine] = oldTShift[i]; + state.sCount[i + startLine] = oldSCount[i]; + state.bsCount[i + startLine] = oldBSCount[i]; + } + state.blkIndent = oldIndent; + + return true; +}; + +/***/ }), +/* 90 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +// Copyright (c) 2014 Vitaly Puzrin, Alex Kocharin. +// Distributed under an ISC license: https://github.com/markdown-it/markdown-it/ + +/** + * @fileoverview Implements markdownitTableRenderer + * @modifier NHN FE Development Lab + */ + +/*eslint-disable */ +function getLine(state, line) { + var pos = state.bMarks[line] + state.blkIndent, + max = state.eMarks[line]; + + return state.src.substr(pos, max - pos); +} + +function escapedSplit(str) { + var result = [], + pos = 0, + max = str.length, + ch, + escapes = 0, + lastPos = 0, + backTicked = false, + lastBackTick = 0; + + ch = str.charCodeAt(pos); + + while (pos < max) { + if (ch === 0x60 /* ` */ && escapes % 2 === 0) { + backTicked = !backTicked; + lastBackTick = pos; + } else if (ch === 0x7c /* | */ && escapes % 2 === 0 && !backTicked) { + result.push(str.substring(lastPos, pos)); + lastPos = pos + 1; + } else if (ch === 0x5c /* \ */) { + escapes += 1; + } else { + escapes = 0; + } + + pos += 1; + + // If there was an un-closed backtick, go back to just after + // the last backtick, but as if it was a normal character + if (pos === max && backTicked) { + backTicked = false; + pos = lastBackTick + 1; + } + + ch = str.charCodeAt(pos); + } + + result.push(str.substring(lastPos)); + + return result; +} + +module.exports = function table(state, startLine, endLine, silent) { + var ch, lineText, pos, i, nextLine, columns, columnCount, token, aligns, alignCount, t, tableLines, tbodyLines; + + // should have at least three lines + if (startLine + 2 > endLine) { + return false; + } + + nextLine = startLine + 1; + + if (state.sCount[nextLine] < state.blkIndent) { + return false; + } + + // first character of the second line should be '|' or '-' + + pos = state.bMarks[nextLine] + state.tShift[nextLine]; + if (pos >= state.eMarks[nextLine]) { + return false; + } + + ch = state.src.charCodeAt(pos); + if (ch !== 0x7C /* | */ && ch !== 0x2D /* - */ && ch !== 0x3A /* : */) { + return false; + } + + lineText = getLine(state, startLine + 1); + if (!/^[-:| ]+$/.test(lineText)) { + return false; + } + + columns = lineText.split('|'); + aligns = []; + for (i = 0; i < columns.length; i += 1) { + t = columns[i].trim(); + if (!t) { + // allow empty columns before and after table, but not in between columns; + // e.g. allow ` |---| `, disallow ` ---||--- ` + if (i === 0 || i === columns.length - 1) { + continue; + } else { + return false; + } + } + + if (!/^:?-+:?$/.test(t)) { + return false; + } + if (t.charCodeAt(t.length - 1) === 0x3A /* : */) { + aligns.push(t.charCodeAt(0) === 0x3A /* : */ ? 'center' : 'right'); + } else if (t.charCodeAt(0) === 0x3A /* : */) { + aligns.push('left'); + } else { + aligns.push(''); + } + } + alignCount = aligns.length; + + lineText = getLine(state, startLine).trim(); + if (lineText.indexOf('|') === -1) { + return false; + } + columns = escapedSplit(lineText.replace(/^\||\|$/g, '')); + + // header row will define an amount of columns in the entire table, + // and align row shouldn't be smaller than that (the rest of the rows can) + columnCount = columns.length; + if (columnCount > alignCount) { + return false; + } else if (columnCount < alignCount) { + for (i = 0; i < alignCount - columnCount; i += 1) { + columns.push(''); + } + columnCount = columns.length; + } + + if (silent) { + return true; + } + + token = state.push('table_open', 'table', 1); + token.map = tableLines = [startLine, 0]; + + token = state.push('thead_open', 'thead', 1); + token.map = [startLine, startLine + 1]; + + token = state.push('tr_open', 'tr', 1); + token.map = [startLine, startLine + 1]; + + for (i = 0; i < columnCount; i += 1) { + token = state.push('th_open', 'th', 1); + token.map = [startLine, startLine + 1]; + if (aligns[i]) { + // FIXED: change property style to align + token.attrs = [['align', aligns[i]]]; + } + + token = state.push('inline', '', 0); + token.content = columns[i].trim(); + token.map = [startLine, startLine + 1]; + token.children = []; + + token = state.push('th_close', 'th', -1); + } + + token = state.push('tr_close', 'tr', -1); + token = state.push('thead_close', 'thead', -1); + + token = state.push('tbody_open', 'tbody', 1); + token.map = tbodyLines = [startLine + 2, 0]; + + for (nextLine = startLine + 2; nextLine < endLine; nextLine += 1) { + if (state.sCount[nextLine] < state.blkIndent) { + break; + } + + lineText = getLine(state, nextLine); + if (lineText.indexOf('|') === -1) { + break; + } + + // keep spaces at beginning of line to indicate an empty first cell, but + // strip trailing whitespace + columns = escapedSplit(lineText.replace(/^\||\|\s*$/g, '')); + + token = state.push('tr_open', 'tr', 1); + for (i = 0; i < columnCount; i += 1) { + token = state.push('td_open', 'td', 1); + if (aligns[i]) { + // FIXED: change property style to align + token.attrs = [['align', aligns[i]]]; + } + + token = state.push('inline', '', 0); + token.content = columns[i] ? columns[i].trim() : ''; + token.children = []; + + token = state.push('td_close', 'td', -1); + } + token = state.push('tr_close', 'tr', -1); + } + token = state.push('tbody_close', 'tbody', -1); + token = state.push('table_close', 'table', -1); + + tableLines[1] = tbodyLines[1] = nextLine; + state.line = nextLine; + return true; +}; + +/***/ }), +/* 91 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright (c) 2014 Vitaly Puzrin, Alex Kocharin. +// Distributed under an ISC license: https://github.com/markdown-it/markdown-it/ + +/** + * @fileoverview Implements markdownitHtmlBlockRenderer + * @modifier NHN FE Development Lab + */ +/* eslint-disable */ +// HTML block + + + +// An array of opening and corresponding closing sequences for html tags, +// last argument defines whether it can terminate a paragraph or not +// + +// void tag names --- Added by Junghwan Park + +var voidTagNames = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; +var HTML_SEQUENCES = [[/^<(script|pre|style)(?=(\s|>|$))/i, /<\/(script|pre|style)>/i, true], [/^/, true], [/^<\?/, /\?>/, true], [/^/, true], [/^/, true], [new RegExp('^<(' + voidTagNames.join('|') + ')', 'i'), /^\/?>$/, true], [new RegExp('^|$))', 'i'), /^$/, true], [/^(?:<[A-Za-z][A-Za-z0-9\-]*(?:\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\s*=\s*(?:[^"'=<>`\x00-\x20]+|'[^']*'|"[^"]*"))?)*\s*\/?>|<\/[A-Za-z][A-Za-z0-9\-]*\s*>)\s*$/, /^$/, false]]; + +module.exports = function html_block(state, startLine, endLine, silent) { + var i, + nextLine, + token, + lineText, + pos = state.bMarks[startLine] + state.tShift[startLine], + max = state.eMarks[startLine]; + + if (!state.md.options.html) { + return false; + } + + if (state.src.charCodeAt(pos) !== 0x3C /* < */) { + return false; + } + + lineText = state.src.slice(pos, max); + + for (i = 0; i < HTML_SEQUENCES.length; i++) { + if (HTML_SEQUENCES[i][0].test(lineText)) { + // add condition for return when meet void element --- Added by Junghwan Park + if (i === 5) { + return false; + } else { + break; + } + } + } + + if (i === HTML_SEQUENCES.length) { + return false; + } + + if (silent) { + // true if this sequence can be a terminator, false otherwise + return HTML_SEQUENCES[i][2]; + } + + nextLine = startLine + 1; + + // If we are here - we detected HTML block. + // Let's roll down till block end. + if (!HTML_SEQUENCES[i][1].test(lineText)) { + for (; nextLine < endLine; nextLine++) { + if (state.sCount[nextLine] < state.blkIndent) { + break; + } + + pos = state.bMarks[nextLine] + state.tShift[nextLine]; + max = state.eMarks[nextLine]; + lineText = state.src.slice(pos, max); + + if (HTML_SEQUENCES[i][1].test(lineText)) { + if (lineText.length !== 0) { + nextLine++; + } + break; + } + } + } + + state.line = nextLine; + + token = state.push('html_block', '', 0); + token.map = [startLine, nextLine]; + token.content = state.getLines(startLine, nextLine, state.blkIndent, true); + + return true; +}; +/* eslint-enable */ + +/***/ }), +/* 92 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +// Copyright (c) 2014 Vitaly Puzrin, Alex Kocharin. +// Distributed under MIT license: https://github.com/markdown-it/markdown-it/ +/** + * @fileoverview Implements markdownitBackticksRenderer + * @modifier NHN FE Development Lab + */ +/* eslint-disable */ + +// Parse backticks +module.exports = function backtick(state, silent) { + var start, + max, + marker, + matchStart, + matchEnd, + token, + pos = state.pos, + ch = state.src.charCodeAt(pos); + + if (ch !== 0x60 /* ` */) { + return false; + } + + start = pos; + pos++; + max = state.posMax; + + while (pos < max && state.src.charCodeAt(pos) === 0x60 /* ` */) { + pos++; + } + + marker = state.src.slice(start, pos); + + matchStart = matchEnd = pos; + + while ((matchStart = state.src.indexOf('`', matchEnd)) !== -1) { + matchEnd = matchStart + 1; + + while (matchEnd < max && state.src.charCodeAt(matchEnd) === 0x60 /* ` */) { + matchEnd++; + } + + if (matchEnd - matchStart === marker.length) { + if (!silent) { + token = state.push('code_inline', 'code', 0); + token.markup = marker; + token.content = state.src.slice(pos, matchStart).replace(/[ \n]+/g, ' ').trim(); + // TUI.EDITOR MODIFICATION START + // store number of backtick in data-backtick + // https://github.nhn.com/fe/tui.editor/pull/981 + token.attrSet('data-backticks', token.markup.length); + // TUI.EDITOR MODIFICATION END + } + state.pos = matchEnd; + return true; + } + } + + if (!silent) { + state.pending += marker; + } + state.pos += marker.length; + return true; +}; + +/***/ }), +/* 93 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +// Copyright (c) 2014, Vitaly Puzrin. +// Distributed under an MIT license: https://github.com/markdown-it/markdown-it-for-inline +/* eslint-disable */ + +/** + * @fileoverview Implements markdownItLinkPlugin + * @modifier NHN FE Development Lab + */ + +function for_inline_plugin(md, ruleName, tokenType, iteartor) { + + function scan(state) { + var i, blkIdx, inlineTokens; + + for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) { + if (state.tokens[blkIdx].type !== 'inline') { + continue; + } + + inlineTokens = state.tokens[blkIdx].children; + + for (i = inlineTokens.length - 1; i >= 0; i--) { + if (inlineTokens[i].type !== tokenType) { + continue; + } + + iteartor(inlineTokens, i); + } + } + } + + md.core.ruler.push(ruleName, scan); +}; + +var linkAttribute = exports.linkAttribute = function linkAttribute(markdownit, iteartor) { + for_inline_plugin(markdownit, 'url_attribute', 'link_open', iteartor); +}; + +/***/ }), +/* 94 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__94__; + +/***/ }), +/* 95 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * @fileoverview Implements editor preivew + * @author NHN FE Development Lab + */ + + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _mdPreview = __webpack_require__(34); + +var _mdPreview2 = _interopRequireDefault(_mdPreview); + +var _eventManager = __webpack_require__(40); + +var _eventManager2 = _interopRequireDefault(_eventManager); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _extManager = __webpack_require__(41); + +var _extManager2 = _interopRequireDefault(_extManager); + +var _convertor = __webpack_require__(42); + +var _convertor2 = _interopRequireDefault(_convertor); + +var _domUtils = __webpack_require__(4); + +var _domUtils2 = _interopRequireDefault(_domUtils); + +var _codeBlockManager = __webpack_require__(25); + +var _codeBlockManager2 = _interopRequireDefault(_codeBlockManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var TASK_ATTR_NAME = 'data-te-task'; +var TASK_CHECKED_CLASS_NAME = 'checked'; + +/** + * Class ToastUIEditorViewer + * @param {object} options Option object + * @param {HTMLElement} options.el - container element + * @param {string} options.initialValue Editor's initial value + * @param {object} options.events eventlist Event list + * @param {function} options.events.load It would be emitted when editor fully load + * @param {function} options.events.change It would be emitted when content changed + * @param {function} options.events.stateChange It would be emitted when format change by cursor position + * @param {function} options.events.focus It would be emitted when editor get focus + * @param {function} options.events.blur It would be emitted when editor loose focus + * @param {object} options.hooks Hook list + * @param {function} options.hooks.previewBeforeHook Submit preview to hook URL before preview be shown + * @param {string[]} [options.exts] - extensions + */ + +var ToastUIEditorViewer = function () { + function ToastUIEditorViewer(options) { + var _this = this; + + _classCallCheck(this, ToastUIEditorViewer); + + this.options = _jquery2.default.extend({ + useDefaultHTMLSanitizer: true, + codeBlockLanguages: _codeBlockManager.CodeBlockManager.getHighlightJSLanguages(), + customConvertor: null + }, options); + + this.eventManager = new _eventManager2.default(); + this.commandManager = new _commandManager2.default(this); + if (this.options.customConvertor) { + // eslint-disable-next-line new-cap + this.convertor = new this.options.customConvertor(this.eventManager); + } else { + this.convertor = new _convertor2.default(this.eventManager); + } + + if (this.options.useDefaultHTMLSanitizer) { + this.convertor.initHtmlSanitizer(); + } + + if (this.options.hooks) { + _tuiCodeSnippet2.default.forEach(this.options.hooks, function (fn, key) { + _this.addHook(key, fn); + }); + } + + if (this.options.events) { + _tuiCodeSnippet2.default.forEach(this.options.events, function (fn, key) { + _this.on(key, fn); + }); + } + + var _options = this.options, + el = _options.el, + initialValue = _options.initialValue; + + var existingHTML = el.innerHTML; + el.innerHTML = ''; + + this.preview = new _mdPreview2.default((0, _jquery2.default)(el), this.eventManager, this.convertor, true); + + this.preview.$el.on('mousedown', _jquery2.default.proxy(this._toggleTask, this)); + + _extManager2.default.applyExtension(this, this.options.exts); + + if (initialValue) { + this.setValue(initialValue); + } else if (existingHTML) { + this.preview.setHTML(existingHTML); + } + + this.eventManager.emit('load', this); + } + + /** + * Toggle task by detecting mousedown event. + * @param {MouseEvent} ev - event + * @private + */ + + + _createClass(ToastUIEditorViewer, [{ + key: '_toggleTask', + value: function _toggleTask(ev) { + var style = getComputedStyle(ev.target, ':before'); + + if (ev.target.hasAttribute(TASK_ATTR_NAME) && _domUtils2.default.isInsideTaskBox(style, ev.offsetX, ev.offsetY)) { + (0, _jquery2.default)(ev.target).toggleClass(TASK_CHECKED_CLASS_NAME); + this.eventManager.emit('change', { + source: 'viewer', + data: ev + }); + } + } + + /** + * Set content for preview + * @param {string} markdown Markdown text + */ + + }, { + key: 'setMarkdown', + value: function setMarkdown(markdown) { + this.markdownValue = markdown = markdown || ''; + + this.preview.refresh(this.markdownValue); + this.eventManager.emit('setMarkdownAfter', this.markdownValue); + } + + /** + * Set content for preview + * @param {string} markdown Markdown text + * @deprecated + */ + + }, { + key: 'setValue', + value: function setValue(markdown) { + this.setMarkdown(markdown); + } + + /** + * Bind eventHandler to event type + * @param {string} type Event type + * @param {function} handler Event handler + */ + + }, { + key: 'on', + value: function on(type, handler) { + this.eventManager.listen(type, handler); + } + + /** + * Unbind eventHandler from event type + * @param {string} type Event type + */ + + }, { + key: 'off', + value: function off(type) { + this.eventManager.removeEventHandler(type); + } + + /** + * Remove Viewer preview from document + */ + + }, { + key: 'remove', + value: function remove() { + this.eventManager.emit('removeEditor'); + this.preview.$el.off('mousedown', _jquery2.default.proxy(this._toggleTask, this)); + this.preview.remove(); + this.options = null; + this.eventManager = null; + this.commandManager = null; + this.convertor = null; + this.preview = null; + } + + /** + * Add hook to Viewer preview's event + * @param {string} type Event type + * @param {function} handler Event handler + */ + + }, { + key: 'addHook', + value: function addHook(type, handler) { + this.eventManager.removeEventHandler(type); + this.eventManager.listen(type, handler); + } + + /** + * Return true + * @returns {boolean} + */ + + }, { + key: 'isViewer', + value: function isViewer() { + return true; + } + + /** + * Return false + * @returns {boolean} + */ + + }, { + key: 'isMarkdownMode', + value: function isMarkdownMode() { + return false; + } + + /** + * Return false + * @returns {boolean} + */ + + }, { + key: 'isWysiwygMode', + value: function isWysiwygMode() { + return false; + } + + /** + * Define extension + * @param {string} name Extension name + * @param {ExtManager~extension} ext extension + */ + + }], [{ + key: 'defineExtension', + value: function defineExtension(name, ext) { + _extManager2.default.defineExtension(name, ext); + } + }]); + + return ToastUIEditorViewer; +}(); + +/** + * check whther is viewer + * @type {boolean} + */ + + +ToastUIEditorViewer.isViewer = true; + +/** + * domUtil instance + * @type {DomUtil} + * @ignore + */ +ToastUIEditorViewer.domUtils = _domUtils2.default; + +/** + * CodeBlockManager instance + * @type {CodeBlockManager} + */ +ToastUIEditorViewer.codeBlockManager = _codeBlockManager2.default; + +/** + * MarkdownIt hightlight instance + * @type {MarkdownIt} + */ +ToastUIEditorViewer.markdownitHighlight = _convertor2.default.getMarkdownitHighlightRenderer(); + +/** + * MarkdownIt instance + * @type {MarkdownIt} + */ +ToastUIEditorViewer.markdownit = _convertor2.default.getMarkdownitRenderer(); + +/** + * @ignore + */ +ToastUIEditorViewer.i18n = null; + +/** + * @ignore + */ +ToastUIEditorViewer.Button = null; + +/** + * @ignore + */ +ToastUIEditorViewer.WwCodeBlockManager = null; + +/** + * @ignore + */ +ToastUIEditorViewer.WwTableManager = null; + +/** + * @ignore + */ +ToastUIEditorViewer.WwTableSelectionManager = null; + +module.exports = ToastUIEditorViewer; + +/***/ }), +/* 96 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * @fileoverview default UI + * @author NHN FE Development Lab + */ + + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _defaultToolbar = __webpack_require__(97); + +var _defaultToolbar2 = _interopRequireDefault(_defaultToolbar); + +var _tab = __webpack_require__(46); + +var _tab2 = _interopRequireDefault(_tab); + +var _layerpopup = __webpack_require__(7); + +var _layerpopup2 = _interopRequireDefault(_layerpopup); + +var _modeSwitch = __webpack_require__(101); + +var _modeSwitch2 = _interopRequireDefault(_modeSwitch); + +var _popupAddLink = __webpack_require__(102); + +var _popupAddLink2 = _interopRequireDefault(_popupAddLink); + +var _popupAddImage = __webpack_require__(103); + +var _popupAddImage2 = _interopRequireDefault(_popupAddImage); + +var _popupTableUtils = __webpack_require__(104); + +var _popupTableUtils2 = _interopRequireDefault(_popupTableUtils); + +var _popupAddTable = __webpack_require__(105); + +var _popupAddTable2 = _interopRequireDefault(_popupAddTable); + +var _popupAddHeading = __webpack_require__(106); + +var _popupAddHeading2 = _interopRequireDefault(_popupAddHeading); + +var _popupCodeBlockLanguages = __webpack_require__(107); + +var _popupCodeBlockLanguages2 = _interopRequireDefault(_popupCodeBlockLanguages); + +var _popupCodeBlockEditor = __webpack_require__(108); + +var _popupCodeBlockEditor2 = _interopRequireDefault(_popupCodeBlockEditor); + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _tooltip = __webpack_require__(31); + +var _tooltip2 = _interopRequireDefault(_tooltip); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CLASS_TOOLBAR = 'te-toolbar-section'; +var CLASS_MARKDOWN_TAB = 'te-markdown-tab-section'; +var CLASS_EDITOR = 'te-editor-section'; +var CLASS_MODE_SWITCH = 'te-mode-switch-section'; +var CONTAINER_TEMPLATE = '\n
\n
\n
\n
\n
\n'; + +/** + * Class DefaultUI + * @param {ToastUIEditor} editor - editor instance + */ + +var DefaultUI = function () { + + /** + * mode switch instance + * @private + * @type {ModeSwitch} + */ + + + /** + * markdown tab section jQuery element + * @private + * @type {HTMLElement} + */ + + + /** + * editor type ww/md + * @private + * @type {string} + */ + + + /** + * @type {HTMLElement} + * @private + */ + + + /** + * DefaultToolbar wrapper element + * @type {jQuery} + */ + function DefaultUI(editor) { + _classCallCheck(this, DefaultUI); + + Object.defineProperty(this, 'name', { + enumerable: true, + writable: true, + value: 'default' + }); + Object.defineProperty(this, '_popups', { + enumerable: true, + writable: true, + value: [] + }); + + this._editor = editor; + this._initialEditType = editor.options.initialEditType; + + this._init(editor.options); + this._initEvent(); + } + + /** + * popup instances + * @private + * @type {Array} + */ + + + /** + * markdown tab + * @private + * @type {Tab} + */ + + + /** + * editor instance + * @private + * @type {ToastUIEditor} + */ + + + /** + * editor section element + * @private + * @type {HTMLElement} + */ + + + /** + * DefaultToolbar instance + * @type {DefaultToolbar} + * @private + */ + + /** + * UI name + * @type {string} + */ + + + _createClass(DefaultUI, [{ + key: '_init', + value: function _init(_ref) { + var container = _ref.el, + toolbarItems = _ref.toolbarItems, + hideModeSwitch = _ref.hideModeSwitch; + + this.$el = (0, _jquery2.default)(CONTAINER_TEMPLATE).appendTo(container); + this._container = container; + this._editorSection = this.$el.find('.' + CLASS_EDITOR).get(0); + this._editorSection.appendChild(this._editor.layout.getEditorEl().get(0)); + + this._initToolbar(this._editor.eventManager, toolbarItems); + this._initModeSwitch(hideModeSwitch); + + this._initPopupAddLink(); + this._initPopupAddImage(); + this._initPopupAddTable(); + this._initPopupAddHeading(); + this._initPopupTableUtils(); + this._initPopupCodeBlockLanguages(); + this._initPopupCodeBlockEditor(); + + this._initMarkdownTab(); + } + }, { + key: '_initEvent', + value: function _initEvent() { + this._editor.eventManager.listen('hide', this.hide.bind(this)); + this._editor.eventManager.listen('show', this.show.bind(this)); + this._editor.eventManager.listen('changeMode', this._markdownTabControl.bind(this)); + this._editor.eventManager.listen('changePreviewStyle', this._markdownTabControl.bind(this)); + } + }, { + key: '_initToolbar', + value: function _initToolbar(eventManager, toolbarItems) { + var toolbar = new _defaultToolbar2.default(eventManager, toolbarItems); + this._toolbar = toolbar; + this.$el.find('.' + CLASS_TOOLBAR).append(toolbar.$el); + } + }, { + key: '_initModeSwitch', + value: function _initModeSwitch(hideModeSwitch) { + var _this = this; + + var modeSwitchTabBar = this.$el.find('.' + CLASS_MODE_SWITCH); + var editType = this._initialEditType === 'markdown' ? _modeSwitch2.default.TYPE.MARKDOWN : _modeSwitch2.default.TYPE.WYSIWYG; + var modeSwitch = new _modeSwitch2.default(modeSwitchTabBar, editType); + this._modeSwitch = modeSwitch; + + if (hideModeSwitch) { + modeSwitch.hide(); + } + + modeSwitch.on('modeSwitched', function (ev, type) { + return _this._editor.changeMode(type); + }); + } + }, { + key: '_initMarkdownTab', + value: function _initMarkdownTab() { + var editor = this._editor; + + this._markdownTab = new _tab2.default({ + initName: _i18n2.default.get('Write'), + items: [_i18n2.default.get('Write'), _i18n2.default.get('Preview')], + sections: [editor.layout.getMdEditorContainerEl(), editor.layout.getPreviewEl()] + }); + this._$markdownTabSection = this.$el.find('.' + CLASS_MARKDOWN_TAB); + this._$markdownTabSection.append(this._markdownTab.$el); + + this._markdownTab.on('itemClick', function (ev, itemText) { + if (itemText === _i18n2.default.get('Preview')) { + editor.eventManager.emit('previewNeedsRefresh'); + editor.eventManager.emit('changePreviewTabPreview'); + editor.eventManager.emit('closeAllPopup'); + } else { + editor.getCodeMirror().focus(); + editor.eventManager.emit('changePreviewTabWrite'); + } + }); + } + }, { + key: '_markdownTabControl', + value: function _markdownTabControl() { + if (this._editor.isMarkdownMode() && this._editor.getCurrentPreviewStyle() === 'tab') { + this._$markdownTabSection.show(); + this._markdownTab.activate(_i18n2.default.get('Write')); + } else { + this._$markdownTabSection.hide(); + } + } + }, { + key: '_initPopupAddLink', + value: function _initPopupAddLink() { + this._popups.push(new _popupAddLink2.default({ + $target: this.$el, + editor: this._editor + })); + } + }, { + key: '_initPopupAddImage', + value: function _initPopupAddImage() { + this._popups.push(new _popupAddImage2.default({ + $target: this.$el, + eventManager: this._editor.eventManager + })); + } + }, { + key: '_initPopupAddTable', + value: function _initPopupAddTable() { + this._popups.push(new _popupAddTable2.default({ + $target: this._toolbar.$el, + eventManager: this._editor.eventManager, + $button: this.$el.find('button.tui-table'), + css: { + 'position': 'absolute' + } + })); + } + }, { + key: '_initPopupAddHeading', + value: function _initPopupAddHeading() { + this._popups.push(new _popupAddHeading2.default({ + $target: this._toolbar.$el, + eventManager: this._editor.eventManager, + $button: this.$el.find('button.tui-heading'), + css: { + 'position': 'absolute' + } + })); + } + }, { + key: '_initPopupTableUtils', + value: function _initPopupTableUtils() { + var _this2 = this; + + this._editor.eventManager.listen('contextmenu', function (ev) { + if ((0, _jquery2.default)(ev.data.target).parents('[contenteditable=true] table').length > 0) { + ev.data.preventDefault(); + _this2._editor.eventManager.emit('openPopupTableUtils', ev.data); + } + }); + + this._popups.push(new _popupTableUtils2.default({ + $target: this.$el, + eventManager: this._editor.eventManager + })); + } + }, { + key: '_initPopupCodeBlockLanguages', + value: function _initPopupCodeBlockLanguages() { + var editor = this._editor; + this._popups.push(new _popupCodeBlockLanguages2.default({ + $target: this.$el, + eventManager: editor.eventManager, + languages: editor.options.codeBlockLanguages + })); + } + }, { + key: '_initPopupCodeBlockEditor', + value: function _initPopupCodeBlockEditor() { + this._popups.push(new _popupCodeBlockEditor2.default({ + $target: this.$el, + eventManager: this._editor.eventManager, + convertor: this._editor.convertor + })); + } + + /** + * get toolbar instance + * @returns {Toolbar} - toolbar instance + */ + + }, { + key: 'getToolbar', + value: function getToolbar() { + return this._toolbar; + } + + /** + * set toolbar instance + * @param {Toolbar} toolbar - toolbar + */ + + }, { + key: 'setToolbar', + value: function setToolbar(toolbar) { + this._toolbar.destroy(); + this._toolbar = toolbar; + } + + /** + * get mode switch instance + * @returns {ModeSwitch} - mode switch instance + */ + + }, { + key: 'getModeSwitch', + value: function getModeSwitch() { + return this._modeSwitch; + } + + /** + * get editor section height + * @returns {Number} - height of editor section + */ + + }, { + key: 'getEditorSectionHeight', + value: function getEditorSectionHeight() { + var clientRect = this._editorSection.getBoundingClientRect(); + + return clientRect.bottom - clientRect.top; + } + + /** + * get editor height + * @returns {Number} - height of editor + */ + + }, { + key: 'getEditorHeight', + value: function getEditorHeight() { + var clientRect = this._container.getBoundingClientRect(); + + return clientRect.bottom - clientRect.top; + } + + /** + * get Table Popup + * @returns {PopupTableUtils} - PopupTableUtils + */ + + }, { + key: 'getPopupTableUtils', + value: function getPopupTableUtils() { + var tablePopup = void 0; + this._popups.forEach(function (popup) { + if (popup instanceof _popupTableUtils2.default) { + tablePopup = popup; + } + }); + + return tablePopup; + } + + /** + * hide + */ + + }, { + key: 'hide', + value: function hide() { + this.$el.addClass('te-hide'); + } + + /** + * show + */ + + }, { + key: 'show', + value: function show() { + this.$el.removeClass('te-hide'); + } + + /** + * remove + */ + + }, { + key: 'remove', + value: function remove() { + this.$el.remove(); + this._markdownTab.remove(); + this._modeSwitch.remove(); + this._toolbar.destroy(); + this._popups.forEach(function (popup) { + return popup.remove(); + }); + this._popups = []; + _tooltip2.default.hide(); + } + + /** + * creates popup + * @param {LayerPopupOption} options - layerPopup options + * @returns {LayerPopup} - crated layerPopup + */ + + }, { + key: 'createPopup', + value: function createPopup(options) { + return new _layerpopup2.default(options); + } + }]); + + return DefaultUI; +}(); + +exports.default = DefaultUI; + +/***/ }), +/* 97 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +var _resizeObserverPolyfill = __webpack_require__(98); + +var _resizeObserverPolyfill2 = _interopRequireDefault(_resizeObserverPolyfill); + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _toolbar = __webpack_require__(43); + +var _toolbar2 = _interopRequireDefault(_toolbar); + +var _popupDropdownToolbar = __webpack_require__(100); + +var _popupDropdownToolbar2 = _interopRequireDefault(_popupDropdownToolbar); + +var _toolbarItemFactory = __webpack_require__(45); + +var _toolbarItemFactory2 = _interopRequireDefault(_toolbarItemFactory); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview implements DefaultToolbar + * @author NHN FE Development Lab + */ + + +var MORE_BUTTON_NAME = 'more'; + +/** + * Class DefaultToolbar + */ + +var DefaultToolbar = function (_Toolbar) { + _inherits(DefaultToolbar, _Toolbar); + + /** + * popup dropdown toolbar + * @type {PopupDropdownToolbar} + * @private + */ + function DefaultToolbar(eventManager, options) { + _classCallCheck(this, DefaultToolbar); + + var _this = _possibleConstructorReturn(this, (DefaultToolbar.__proto__ || Object.getPrototypeOf(DefaultToolbar)).call(this, eventManager, options)); + + _this._init(eventManager); + _this._bindWidthChangedEvent(); + return _this; + } + + /** + * insert toolbar item + * @param {number} index - index at given item inserted + * @param {ToolbarItem|string|object} item - toolbar item + * @override + */ + + + /** + * resize observer + * @type {ResizeObserver} + * @private + */ + + /** + * more button + * @type {ToolbarButton} + * @private + */ + + + _createClass(DefaultToolbar, [{ + key: 'insertItem', + value: function insertItem(index, item) { + _get(DefaultToolbar.prototype.__proto__ || Object.getPrototypeOf(DefaultToolbar.prototype), 'insertItem', this).call(this, index, item); + this._arrangeMoreButton(); + } + }, { + key: '_init', + value: function _init(eventManager) { + var moreButton = _toolbarItemFactory2.default.create('button', { + name: MORE_BUTTON_NAME, + className: 'tui-more', + tooltip: _i18n2.default.get('More'), + event: _popupDropdownToolbar2.default.OPEN_EVENT + }); + this._moreButton = moreButton; + + this._popupDropdownToolbar = new _popupDropdownToolbar2.default({ + eventManager: eventManager, + $target: this.$el, + $button: moreButton.$el + }); + + this.addItem(moreButton); + } + }, { + key: '_bindWidthChangedEvent', + value: function _bindWidthChangedEvent() { + var _this2 = this; + + this._observer = new _resizeObserverPolyfill2.default(function () { + _this2._popupDropdownToolbar.hide(); + _this2._balanceButtons(); + }); + this._observer.observe(this.$el.get(0)); + } + }, { + key: '_balanceButtons', + value: function _balanceButtons() { + var _this3 = this; + + var dropDownToolbarItems = this._popupDropdownToolbar.getItems(); + dropDownToolbarItems.forEach(function (item) { + _this3._popupDropdownToolbar.removeItem(item, false); + + var itemLength = _this3.getItems().length; + _get(DefaultToolbar.prototype.__proto__ || Object.getPrototypeOf(DefaultToolbar.prototype), 'insertItem', _this3).call(_this3, itemLength, item); + }); + + this.removeItem(this._moreButton, false); + _get(DefaultToolbar.prototype.__proto__ || Object.getPrototypeOf(DefaultToolbar.prototype), 'insertItem', this).call(this, 0, this._moreButton); + + var toolbarHeight = this.$el.height(); + var defaultToolbarItems = this.getItems(); + var overflowItems = defaultToolbarItems.filter(function (item) { + return item.$el.position().top > toolbarHeight; + }); + + overflowItems.forEach(function (item) { + _this3.removeItem(item, false); + _this3._popupDropdownToolbar.addItem(item); + }); + + this._arrangeMoreButton(); + } + }, { + key: '_arrangeMoreButton', + value: function _arrangeMoreButton() { + if (!this._popupDropdownToolbar) { + return; + } + + this.removeItem(this._moreButton, false); + + var hasOverflow = this._popupDropdownToolbar.getItems().length > 0; + var itemLength = this.getItems().length; + if (hasOverflow) { + _get(DefaultToolbar.prototype.__proto__ || Object.getPrototypeOf(DefaultToolbar.prototype), 'insertItem', this).call(this, itemLength, this._moreButton); + } + } + + /** + * destroy + * @override + */ + + }, { + key: 'destroy', + value: function destroy() { + if (this._observer) { + this._observer.disconnect(); + this._observer = null; + } + } + }]); + + return DefaultToolbar; +}(_toolbar2.default); + +exports.default = DefaultToolbar; + +/***/ }), +/* 98 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* WEBPACK VAR INJECTION */(function(global) {/** + * A collection of shims that provide minimal functionality of the ES6 collections. + * + * These implementations are not meant to be used outside of the ResizeObserver + * modules as they cover only a limited range of use cases. + */ +/* eslint-disable require-jsdoc, valid-jsdoc */ +var MapShim = (function () { + if (typeof Map !== 'undefined') { + return Map; + } + /** + * Returns index in provided array that matches the specified key. + * + * @param {Array} arr + * @param {*} key + * @returns {number} + */ + function getIndex(arr, key) { + var result = -1; + arr.some(function (entry, index) { + if (entry[0] === key) { + result = index; + return true; + } + return false; + }); + return result; + } + return /** @class */ (function () { + function class_1() { + this.__entries__ = []; + } + Object.defineProperty(class_1.prototype, "size", { + /** + * @returns {boolean} + */ + get: function () { + return this.__entries__.length; + }, + enumerable: true, + configurable: true + }); + /** + * @param {*} key + * @returns {*} + */ + class_1.prototype.get = function (key) { + var index = getIndex(this.__entries__, key); + var entry = this.__entries__[index]; + return entry && entry[1]; + }; + /** + * @param {*} key + * @param {*} value + * @returns {void} + */ + class_1.prototype.set = function (key, value) { + var index = getIndex(this.__entries__, key); + if (~index) { + this.__entries__[index][1] = value; + } + else { + this.__entries__.push([key, value]); + } + }; + /** + * @param {*} key + * @returns {void} + */ + class_1.prototype.delete = function (key) { + var entries = this.__entries__; + var index = getIndex(entries, key); + if (~index) { + entries.splice(index, 1); + } + }; + /** + * @param {*} key + * @returns {void} + */ + class_1.prototype.has = function (key) { + return !!~getIndex(this.__entries__, key); + }; + /** + * @returns {void} + */ + class_1.prototype.clear = function () { + this.__entries__.splice(0); + }; + /** + * @param {Function} callback + * @param {*} [ctx=null] + * @returns {void} + */ + class_1.prototype.forEach = function (callback, ctx) { + if (ctx === void 0) { ctx = null; } + for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) { + var entry = _a[_i]; + callback.call(ctx, entry[1], entry[0]); + } + }; + return class_1; + }()); +})(); + +/** + * Detects whether window and document objects are available in current environment. + */ +var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document; + +// Returns global object of a current environment. +var global$1 = (function () { + if (typeof global !== 'undefined' && global.Math === Math) { + return global; + } + if (typeof self !== 'undefined' && self.Math === Math) { + return self; + } + if (typeof window !== 'undefined' && window.Math === Math) { + return window; + } + // eslint-disable-next-line no-new-func + return Function('return this')(); +})(); + +/** + * A shim for the requestAnimationFrame which falls back to the setTimeout if + * first one is not supported. + * + * @returns {number} Requests' identifier. + */ +var requestAnimationFrame$1 = (function () { + if (typeof requestAnimationFrame === 'function') { + // It's required to use a bounded function because IE sometimes throws + // an "Invalid calling object" error if rAF is invoked without the global + // object on the left hand side. + return requestAnimationFrame.bind(global$1); + } + return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); }; +})(); + +// Defines minimum timeout before adding a trailing call. +var trailingTimeout = 2; +/** + * Creates a wrapper function which ensures that provided callback will be + * invoked only once during the specified delay period. + * + * @param {Function} callback - Function to be invoked after the delay period. + * @param {number} delay - Delay after which to invoke callback. + * @returns {Function} + */ +function throttle (callback, delay) { + var leadingCall = false, trailingCall = false, lastCallTime = 0; + /** + * Invokes the original callback function and schedules new invocation if + * the "proxy" was called during current request. + * + * @returns {void} + */ + function resolvePending() { + if (leadingCall) { + leadingCall = false; + callback(); + } + if (trailingCall) { + proxy(); + } + } + /** + * Callback invoked after the specified delay. It will further postpone + * invocation of the original function delegating it to the + * requestAnimationFrame. + * + * @returns {void} + */ + function timeoutCallback() { + requestAnimationFrame$1(resolvePending); + } + /** + * Schedules invocation of the original function. + * + * @returns {void} + */ + function proxy() { + var timeStamp = Date.now(); + if (leadingCall) { + // Reject immediately following calls. + if (timeStamp - lastCallTime < trailingTimeout) { + return; + } + // Schedule new call to be in invoked when the pending one is resolved. + // This is important for "transitions" which never actually start + // immediately so there is a chance that we might miss one if change + // happens amids the pending invocation. + trailingCall = true; + } + else { + leadingCall = true; + trailingCall = false; + setTimeout(timeoutCallback, delay); + } + lastCallTime = timeStamp; + } + return proxy; +} + +// Minimum delay before invoking the update of observers. +var REFRESH_DELAY = 20; +// A list of substrings of CSS properties used to find transition events that +// might affect dimensions of observed elements. +var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight']; +// Check if MutationObserver is available. +var mutationObserverSupported = typeof MutationObserver !== 'undefined'; +/** + * Singleton controller class which handles updates of ResizeObserver instances. + */ +var ResizeObserverController = /** @class */ (function () { + /** + * Creates a new instance of ResizeObserverController. + * + * @private + */ + function ResizeObserverController() { + /** + * Indicates whether DOM listeners have been added. + * + * @private {boolean} + */ + this.connected_ = false; + /** + * Tells that controller has subscribed for Mutation Events. + * + * @private {boolean} + */ + this.mutationEventsAdded_ = false; + /** + * Keeps reference to the instance of MutationObserver. + * + * @private {MutationObserver} + */ + this.mutationsObserver_ = null; + /** + * A list of connected observers. + * + * @private {Array} + */ + this.observers_ = []; + this.onTransitionEnd_ = this.onTransitionEnd_.bind(this); + this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY); + } + /** + * Adds observer to observers list. + * + * @param {ResizeObserverSPI} observer - Observer to be added. + * @returns {void} + */ + ResizeObserverController.prototype.addObserver = function (observer) { + if (!~this.observers_.indexOf(observer)) { + this.observers_.push(observer); + } + // Add listeners if they haven't been added yet. + if (!this.connected_) { + this.connect_(); + } + }; + /** + * Removes observer from observers list. + * + * @param {ResizeObserverSPI} observer - Observer to be removed. + * @returns {void} + */ + ResizeObserverController.prototype.removeObserver = function (observer) { + var observers = this.observers_; + var index = observers.indexOf(observer); + // Remove observer if it's present in registry. + if (~index) { + observers.splice(index, 1); + } + // Remove listeners if controller has no connected observers. + if (!observers.length && this.connected_) { + this.disconnect_(); + } + }; + /** + * Invokes the update of observers. It will continue running updates insofar + * it detects changes. + * + * @returns {void} + */ + ResizeObserverController.prototype.refresh = function () { + var changesDetected = this.updateObservers_(); + // Continue running updates if changes have been detected as there might + // be future ones caused by CSS transitions. + if (changesDetected) { + this.refresh(); + } + }; + /** + * Updates every observer from observers list and notifies them of queued + * entries. + * + * @private + * @returns {boolean} Returns "true" if any observer has detected changes in + * dimensions of it's elements. + */ + ResizeObserverController.prototype.updateObservers_ = function () { + // Collect observers that have active observations. + var activeObservers = this.observers_.filter(function (observer) { + return observer.gatherActive(), observer.hasActive(); + }); + // Deliver notifications in a separate cycle in order to avoid any + // collisions between observers, e.g. when multiple instances of + // ResizeObserver are tracking the same element and the callback of one + // of them changes content dimensions of the observed target. Sometimes + // this may result in notifications being blocked for the rest of observers. + activeObservers.forEach(function (observer) { return observer.broadcastActive(); }); + return activeObservers.length > 0; + }; + /** + * Initializes DOM listeners. + * + * @private + * @returns {void} + */ + ResizeObserverController.prototype.connect_ = function () { + // Do nothing if running in a non-browser environment or if listeners + // have been already added. + if (!isBrowser || this.connected_) { + return; + } + // Subscription to the "Transitionend" event is used as a workaround for + // delayed transitions. This way it's possible to capture at least the + // final state of an element. + document.addEventListener('transitionend', this.onTransitionEnd_); + window.addEventListener('resize', this.refresh); + if (mutationObserverSupported) { + this.mutationsObserver_ = new MutationObserver(this.refresh); + this.mutationsObserver_.observe(document, { + attributes: true, + childList: true, + characterData: true, + subtree: true + }); + } + else { + document.addEventListener('DOMSubtreeModified', this.refresh); + this.mutationEventsAdded_ = true; + } + this.connected_ = true; + }; + /** + * Removes DOM listeners. + * + * @private + * @returns {void} + */ + ResizeObserverController.prototype.disconnect_ = function () { + // Do nothing if running in a non-browser environment or if listeners + // have been already removed. + if (!isBrowser || !this.connected_) { + return; + } + document.removeEventListener('transitionend', this.onTransitionEnd_); + window.removeEventListener('resize', this.refresh); + if (this.mutationsObserver_) { + this.mutationsObserver_.disconnect(); + } + if (this.mutationEventsAdded_) { + document.removeEventListener('DOMSubtreeModified', this.refresh); + } + this.mutationsObserver_ = null; + this.mutationEventsAdded_ = false; + this.connected_ = false; + }; + /** + * "Transitionend" event handler. + * + * @private + * @param {TransitionEvent} event + * @returns {void} + */ + ResizeObserverController.prototype.onTransitionEnd_ = function (_a) { + var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b; + // Detect whether transition may affect dimensions of an element. + var isReflowProperty = transitionKeys.some(function (key) { + return !!~propertyName.indexOf(key); + }); + if (isReflowProperty) { + this.refresh(); + } + }; + /** + * Returns instance of the ResizeObserverController. + * + * @returns {ResizeObserverController} + */ + ResizeObserverController.getInstance = function () { + if (!this.instance_) { + this.instance_ = new ResizeObserverController(); + } + return this.instance_; + }; + /** + * Holds reference to the controller's instance. + * + * @private {ResizeObserverController} + */ + ResizeObserverController.instance_ = null; + return ResizeObserverController; +}()); + +/** + * Defines non-writable/enumerable properties of the provided target object. + * + * @param {Object} target - Object for which to define properties. + * @param {Object} props - Properties to be defined. + * @returns {Object} Target object. + */ +var defineConfigurable = (function (target, props) { + for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) { + var key = _a[_i]; + Object.defineProperty(target, key, { + value: props[key], + enumerable: false, + writable: false, + configurable: true + }); + } + return target; +}); + +/** + * Returns the global object associated with provided element. + * + * @param {Object} target + * @returns {Object} + */ +var getWindowOf = (function (target) { + // Assume that the element is an instance of Node, which means that it + // has the "ownerDocument" property from which we can retrieve a + // corresponding global object. + var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView; + // Return the local global object if it's not possible extract one from + // provided element. + return ownerGlobal || global$1; +}); + +// Placeholder of an empty content rectangle. +var emptyRect = createRectInit(0, 0, 0, 0); +/** + * Converts provided string to a number. + * + * @param {number|string} value + * @returns {number} + */ +function toFloat(value) { + return parseFloat(value) || 0; +} +/** + * Extracts borders size from provided styles. + * + * @param {CSSStyleDeclaration} styles + * @param {...string} positions - Borders positions (top, right, ...) + * @returns {number} + */ +function getBordersSize(styles) { + var positions = []; + for (var _i = 1; _i < arguments.length; _i++) { + positions[_i - 1] = arguments[_i]; + } + return positions.reduce(function (size, position) { + var value = styles['border-' + position + '-width']; + return size + toFloat(value); + }, 0); +} +/** + * Extracts paddings sizes from provided styles. + * + * @param {CSSStyleDeclaration} styles + * @returns {Object} Paddings box. + */ +function getPaddings(styles) { + var positions = ['top', 'right', 'bottom', 'left']; + var paddings = {}; + for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) { + var position = positions_1[_i]; + var value = styles['padding-' + position]; + paddings[position] = toFloat(value); + } + return paddings; +} +/** + * Calculates content rectangle of provided SVG element. + * + * @param {SVGGraphicsElement} target - Element content rectangle of which needs + * to be calculated. + * @returns {DOMRectInit} + */ +function getSVGContentRect(target) { + var bbox = target.getBBox(); + return createRectInit(0, 0, bbox.width, bbox.height); +} +/** + * Calculates content rectangle of provided HTMLElement. + * + * @param {HTMLElement} target - Element for which to calculate the content rectangle. + * @returns {DOMRectInit} + */ +function getHTMLElementContentRect(target) { + // Client width & height properties can't be + // used exclusively as they provide rounded values. + var clientWidth = target.clientWidth, clientHeight = target.clientHeight; + // By this condition we can catch all non-replaced inline, hidden and + // detached elements. Though elements with width & height properties less + // than 0.5 will be discarded as well. + // + // Without it we would need to implement separate methods for each of + // those cases and it's not possible to perform a precise and performance + // effective test for hidden elements. E.g. even jQuery's ':visible' filter + // gives wrong results for elements with width & height less than 0.5. + if (!clientWidth && !clientHeight) { + return emptyRect; + } + var styles = getWindowOf(target).getComputedStyle(target); + var paddings = getPaddings(styles); + var horizPad = paddings.left + paddings.right; + var vertPad = paddings.top + paddings.bottom; + // Computed styles of width & height are being used because they are the + // only dimensions available to JS that contain non-rounded values. It could + // be possible to utilize the getBoundingClientRect if only it's data wasn't + // affected by CSS transformations let alone paddings, borders and scroll bars. + var width = toFloat(styles.width), height = toFloat(styles.height); + // Width & height include paddings and borders when the 'border-box' box + // model is applied (except for IE). + if (styles.boxSizing === 'border-box') { + // Following conditions are required to handle Internet Explorer which + // doesn't include paddings and borders to computed CSS dimensions. + // + // We can say that if CSS dimensions + paddings are equal to the "client" + // properties then it's either IE, and thus we don't need to subtract + // anything, or an element merely doesn't have paddings/borders styles. + if (Math.round(width + horizPad) !== clientWidth) { + width -= getBordersSize(styles, 'left', 'right') + horizPad; + } + if (Math.round(height + vertPad) !== clientHeight) { + height -= getBordersSize(styles, 'top', 'bottom') + vertPad; + } + } + // Following steps can't be applied to the document's root element as its + // client[Width/Height] properties represent viewport area of the window. + // Besides, it's as well not necessary as the itself neither has + // rendered scroll bars nor it can be clipped. + if (!isDocumentElement(target)) { + // In some browsers (only in Firefox, actually) CSS width & height + // include scroll bars size which can be removed at this step as scroll + // bars are the only difference between rounded dimensions + paddings + // and "client" properties, though that is not always true in Chrome. + var vertScrollbar = Math.round(width + horizPad) - clientWidth; + var horizScrollbar = Math.round(height + vertPad) - clientHeight; + // Chrome has a rather weird rounding of "client" properties. + // E.g. for an element with content width of 314.2px it sometimes gives + // the client width of 315px and for the width of 314.7px it may give + // 314px. And it doesn't happen all the time. So just ignore this delta + // as a non-relevant. + if (Math.abs(vertScrollbar) !== 1) { + width -= vertScrollbar; + } + if (Math.abs(horizScrollbar) !== 1) { + height -= horizScrollbar; + } + } + return createRectInit(paddings.left, paddings.top, width, height); +} +/** + * Checks whether provided element is an instance of the SVGGraphicsElement. + * + * @param {Element} target - Element to be checked. + * @returns {boolean} + */ +var isSVGGraphicsElement = (function () { + // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement + // interface. + if (typeof SVGGraphicsElement !== 'undefined') { + return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; }; + } + // If it's so, then check that element is at least an instance of the + // SVGElement and that it has the "getBBox" method. + // eslint-disable-next-line no-extra-parens + return function (target) { return (target instanceof getWindowOf(target).SVGElement && + typeof target.getBBox === 'function'); }; +})(); +/** + * Checks whether provided element is a document element (). + * + * @param {Element} target - Element to be checked. + * @returns {boolean} + */ +function isDocumentElement(target) { + return target === getWindowOf(target).document.documentElement; +} +/** + * Calculates an appropriate content rectangle for provided html or svg element. + * + * @param {Element} target - Element content rectangle of which needs to be calculated. + * @returns {DOMRectInit} + */ +function getContentRect(target) { + if (!isBrowser) { + return emptyRect; + } + if (isSVGGraphicsElement(target)) { + return getSVGContentRect(target); + } + return getHTMLElementContentRect(target); +} +/** + * Creates rectangle with an interface of the DOMRectReadOnly. + * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly + * + * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions. + * @returns {DOMRectReadOnly} + */ +function createReadOnlyRect(_a) { + var x = _a.x, y = _a.y, width = _a.width, height = _a.height; + // If DOMRectReadOnly is available use it as a prototype for the rectangle. + var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object; + var rect = Object.create(Constr.prototype); + // Rectangle's properties are not writable and non-enumerable. + defineConfigurable(rect, { + x: x, y: y, width: width, height: height, + top: y, + right: x + width, + bottom: height + y, + left: x + }); + return rect; +} +/** + * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates. + * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit + * + * @param {number} x - X coordinate. + * @param {number} y - Y coordinate. + * @param {number} width - Rectangle's width. + * @param {number} height - Rectangle's height. + * @returns {DOMRectInit} + */ +function createRectInit(x, y, width, height) { + return { x: x, y: y, width: width, height: height }; +} + +/** + * Class that is responsible for computations of the content rectangle of + * provided DOM element and for keeping track of it's changes. + */ +var ResizeObservation = /** @class */ (function () { + /** + * Creates an instance of ResizeObservation. + * + * @param {Element} target - Element to be observed. + */ + function ResizeObservation(target) { + /** + * Broadcasted width of content rectangle. + * + * @type {number} + */ + this.broadcastWidth = 0; + /** + * Broadcasted height of content rectangle. + * + * @type {number} + */ + this.broadcastHeight = 0; + /** + * Reference to the last observed content rectangle. + * + * @private {DOMRectInit} + */ + this.contentRect_ = createRectInit(0, 0, 0, 0); + this.target = target; + } + /** + * Updates content rectangle and tells whether it's width or height properties + * have changed since the last broadcast. + * + * @returns {boolean} + */ + ResizeObservation.prototype.isActive = function () { + var rect = getContentRect(this.target); + this.contentRect_ = rect; + return (rect.width !== this.broadcastWidth || + rect.height !== this.broadcastHeight); + }; + /** + * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data + * from the corresponding properties of the last observed content rectangle. + * + * @returns {DOMRectInit} Last observed content rectangle. + */ + ResizeObservation.prototype.broadcastRect = function () { + var rect = this.contentRect_; + this.broadcastWidth = rect.width; + this.broadcastHeight = rect.height; + return rect; + }; + return ResizeObservation; +}()); + +var ResizeObserverEntry = /** @class */ (function () { + /** + * Creates an instance of ResizeObserverEntry. + * + * @param {Element} target - Element that is being observed. + * @param {DOMRectInit} rectInit - Data of the element's content rectangle. + */ + function ResizeObserverEntry(target, rectInit) { + var contentRect = createReadOnlyRect(rectInit); + // According to the specification following properties are not writable + // and are also not enumerable in the native implementation. + // + // Property accessors are not being used as they'd require to define a + // private WeakMap storage which may cause memory leaks in browsers that + // don't support this type of collections. + defineConfigurable(this, { target: target, contentRect: contentRect }); + } + return ResizeObserverEntry; +}()); + +var ResizeObserverSPI = /** @class */ (function () { + /** + * Creates a new instance of ResizeObserver. + * + * @param {ResizeObserverCallback} callback - Callback function that is invoked + * when one of the observed elements changes it's content dimensions. + * @param {ResizeObserverController} controller - Controller instance which + * is responsible for the updates of observer. + * @param {ResizeObserver} callbackCtx - Reference to the public + * ResizeObserver instance which will be passed to callback function. + */ + function ResizeObserverSPI(callback, controller, callbackCtx) { + /** + * Collection of resize observations that have detected changes in dimensions + * of elements. + * + * @private {Array} + */ + this.activeObservations_ = []; + /** + * Registry of the ResizeObservation instances. + * + * @private {Map} + */ + this.observations_ = new MapShim(); + if (typeof callback !== 'function') { + throw new TypeError('The callback provided as parameter 1 is not a function.'); + } + this.callback_ = callback; + this.controller_ = controller; + this.callbackCtx_ = callbackCtx; + } + /** + * Starts observing provided element. + * + * @param {Element} target - Element to be observed. + * @returns {void} + */ + ResizeObserverSPI.prototype.observe = function (target) { + if (!arguments.length) { + throw new TypeError('1 argument required, but only 0 present.'); + } + // Do nothing if current environment doesn't have the Element interface. + if (typeof Element === 'undefined' || !(Element instanceof Object)) { + return; + } + if (!(target instanceof getWindowOf(target).Element)) { + throw new TypeError('parameter 1 is not of type "Element".'); + } + var observations = this.observations_; + // Do nothing if element is already being observed. + if (observations.has(target)) { + return; + } + observations.set(target, new ResizeObservation(target)); + this.controller_.addObserver(this); + // Force the update of observations. + this.controller_.refresh(); + }; + /** + * Stops observing provided element. + * + * @param {Element} target - Element to stop observing. + * @returns {void} + */ + ResizeObserverSPI.prototype.unobserve = function (target) { + if (!arguments.length) { + throw new TypeError('1 argument required, but only 0 present.'); + } + // Do nothing if current environment doesn't have the Element interface. + if (typeof Element === 'undefined' || !(Element instanceof Object)) { + return; + } + if (!(target instanceof getWindowOf(target).Element)) { + throw new TypeError('parameter 1 is not of type "Element".'); + } + var observations = this.observations_; + // Do nothing if element is not being observed. + if (!observations.has(target)) { + return; + } + observations.delete(target); + if (!observations.size) { + this.controller_.removeObserver(this); + } + }; + /** + * Stops observing all elements. + * + * @returns {void} + */ + ResizeObserverSPI.prototype.disconnect = function () { + this.clearActive(); + this.observations_.clear(); + this.controller_.removeObserver(this); + }; + /** + * Collects observation instances the associated element of which has changed + * it's content rectangle. + * + * @returns {void} + */ + ResizeObserverSPI.prototype.gatherActive = function () { + var _this = this; + this.clearActive(); + this.observations_.forEach(function (observation) { + if (observation.isActive()) { + _this.activeObservations_.push(observation); + } + }); + }; + /** + * Invokes initial callback function with a list of ResizeObserverEntry + * instances collected from active resize observations. + * + * @returns {void} + */ + ResizeObserverSPI.prototype.broadcastActive = function () { + // Do nothing if observer doesn't have active observations. + if (!this.hasActive()) { + return; + } + var ctx = this.callbackCtx_; + // Create ResizeObserverEntry instance for every active observation. + var entries = this.activeObservations_.map(function (observation) { + return new ResizeObserverEntry(observation.target, observation.broadcastRect()); + }); + this.callback_.call(ctx, entries, ctx); + this.clearActive(); + }; + /** + * Clears the collection of active observations. + * + * @returns {void} + */ + ResizeObserverSPI.prototype.clearActive = function () { + this.activeObservations_.splice(0); + }; + /** + * Tells whether observer has active observations. + * + * @returns {boolean} + */ + ResizeObserverSPI.prototype.hasActive = function () { + return this.activeObservations_.length > 0; + }; + return ResizeObserverSPI; +}()); + +// Registry of internal observers. If WeakMap is not available use current shim +// for the Map collection as it has all required methods and because WeakMap +// can't be fully polyfilled anyway. +var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim(); +/** + * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation + * exposing only those methods and properties that are defined in the spec. + */ +var ResizeObserver = /** @class */ (function () { + /** + * Creates a new instance of ResizeObserver. + * + * @param {ResizeObserverCallback} callback - Callback that is invoked when + * dimensions of the observed elements change. + */ + function ResizeObserver(callback) { + if (!(this instanceof ResizeObserver)) { + throw new TypeError('Cannot call a class as a function.'); + } + if (!arguments.length) { + throw new TypeError('1 argument required, but only 0 present.'); + } + var controller = ResizeObserverController.getInstance(); + var observer = new ResizeObserverSPI(callback, controller, this); + observers.set(this, observer); + } + return ResizeObserver; +}()); +// Expose public methods of ResizeObserver. +[ + 'observe', + 'unobserve', + 'disconnect' +].forEach(function (method) { + ResizeObserver.prototype[method] = function () { + var _a; + return (_a = observers.get(this))[method].apply(_a, arguments); + }; +}); + +var index = (function () { + // Export existing implementation if available. + if (typeof global$1.ResizeObserver !== 'undefined') { + return global$1.ResizeObserver; + } + return ResizeObserver; +})(); + +/* harmony default export */ __webpack_exports__["default"] = (index); + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11))) + +/***/ }), +/* 99 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _button = __webpack_require__(21); + +var _button2 = _interopRequireDefault(_button); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview Implements UI Button + * @author NHN FE Development Lab + */ + + +/** + * Toolbar Button UI + * @ignore + */ +var ToolbarButton = function (_Button) { + _inherits(ToolbarButton, _Button); + + function ToolbarButton() { + _classCallCheck(this, ToolbarButton); + + return _possibleConstructorReturn(this, (ToolbarButton.__proto__ || Object.getPrototypeOf(ToolbarButton)).apply(this, arguments)); + } + + return ToolbarButton; +}(_button2.default); + +exports.default = ToolbarButton; + +/***/ }), +/* 100 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _layerpopup = __webpack_require__(7); + +var _layerpopup2 = _interopRequireDefault(_layerpopup); + +var _toolbar = __webpack_require__(43); + +var _toolbar2 = _interopRequireDefault(_toolbar); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview implements DefaultToolbar + * @author NHN FE Development Lab + */ + + +/** + * Class PopupDropdownToolbar + * @param {LayerPopupOption} options - layer popup option + * @ignore + */ +var PopupDropdownToolbar = function (_LayerPopup) { + _inherits(PopupDropdownToolbar, _LayerPopup); + + function PopupDropdownToolbar(options) { + _classCallCheck(this, PopupDropdownToolbar); + + options = _tuiCodeSnippet2.default.extend({ + header: false, + className: 'te-dropdown-toolbar' + }, options); + return _possibleConstructorReturn(this, (PopupDropdownToolbar.__proto__ || Object.getPrototypeOf(PopupDropdownToolbar)).call(this, options)); + } + + /** + * get toolbar instance it contains + * @returns {Toolbar} - toolbar instance + */ + + /** + * open event string + * @type {string} + */ + + + _createClass(PopupDropdownToolbar, [{ + key: 'getToolbar', + value: function getToolbar() { + return this._toolbar; + } + + /** + * get toolbar items + * @returns {ToolbarItem[]} - toolbar items + */ + + }, { + key: 'getItems', + value: function getItems() { + return this.getToolbar().getItems(); + } + + /** + * get toolbar item at given index + * @param {number} index - item index + * @returns {ToolbarItem} - toolbar item at the index + */ + + }, { + key: 'getItem', + value: function getItem(index) { + return this.getToolbar().getItem(index); + } + + /** + * set toolbar items + * @param {ToolbarItem[]} items - toolbar items + */ + + }, { + key: 'setItems', + value: function setItems(items) { + this.getToolbar().setItems(items); + } + + /** + * add toolbar item + * @param {ToolbarItem|string|object} item - toolbar item + */ + + }, { + key: 'addItem', + value: function addItem(item) { + this.getToolbar().addItem(item); + } + + /** + * insert toolbar item + * @param {number} index - index at given item inserted + * @param {ToolbarItem|string|object} item - toolbar item + */ + + }, { + key: 'insertItem', + value: function insertItem(index, item) { + this.getToolbar().insertItem(index, item); + } + + /** + * get index of given item + * @param {ToolbarItem} item - toolbar item + * @returns {number} - index of given toolbar item + */ + + }, { + key: 'indexOfItem', + value: function indexOfItem(item) { + return this.getToolbar().indexOfItem(item); + } + + /** + * remove an item + * @param {number} index - item index to remove + * @param {boolean} destroy - destroy item or not + * @returns {ToolbarItem} - removed item + */ + + }, { + key: 'removeItem', + value: function removeItem(index, destroy) { + return this.getToolbar().removeItem(index, destroy); + } + + /** + * remove all toolbar items + */ + + }, { + key: 'removeAllItems', + value: function removeAllItems() { + this.getToolbar().removeAllItems(); + } + + /** + * init instance. + * store properties & prepare before initialize DOM + * @param {LayerPopupOption} options - layer popup options + * @private + * @override + */ + + }, { + key: '_initInstance', + value: function _initInstance(options) { + _get(PopupDropdownToolbar.prototype.__proto__ || Object.getPrototypeOf(PopupDropdownToolbar.prototype), '_initInstance', this).call(this, options); + + var $button = options.$button, + eventManager = options.eventManager; + + + this._$button = $button; + this._eventManager = eventManager; + this._toolbar = new _toolbar2.default(eventManager); + } + + /** + * initialize DOM, render popup + * @private + * @override + */ + + }, { + key: '_initDOM', + value: function _initDOM() { + _get(PopupDropdownToolbar.prototype.__proto__ || Object.getPrototypeOf(PopupDropdownToolbar.prototype), '_initDOM', this).call(this); + + this.setContent(this._toolbar.$el); + } + + /** + * bind editor events + * @private + * @override + */ + + }, { + key: '_initEditorEvent', + value: function _initEditorEvent() { + var _this2 = this; + + _get(PopupDropdownToolbar.prototype.__proto__ || Object.getPrototypeOf(PopupDropdownToolbar.prototype), '_initEditorEvent', this).call(this); + + this._eventManager.listen('focus', function () { + return _this2.hide(); + }); + this._eventManager.listen('closeAllPopup', function () { + return _this2.hide(); + }); + this._eventManager.listen(PopupDropdownToolbar.OPEN_EVENT, function () { + var isShown = _this2.isShow(); + _this2._eventManager.emit('closeAllPopup'); + if (!isShown) { + _this2.show(); + } + + // to give toolbar element enough width before the calculation + _this2.$el.css({ + left: '-1000px' + }); + var $button = _this2._$button; + var position = $button.position(); + var buttonOuterHeightWithMargin = $button.outerHeight(true); + var buttonMarginBottom = (buttonOuterHeightWithMargin - $button.outerHeight()) / 2; + var top = position.top + buttonOuterHeightWithMargin - buttonMarginBottom; + var left = position.left + $button.outerWidth(true) - _this2.$el.outerWidth(true); + + _this2.$el.css({ + top: top, + left: left + }); + }); + } + }]); + + return PopupDropdownToolbar; +}(_layerpopup2.default); + +Object.defineProperty(PopupDropdownToolbar, 'OPEN_EVENT', { + enumerable: true, + writable: true, + value: 'openDropdownToolbar' +}); +exports.default = PopupDropdownToolbar; + +/***/ }), +/* 101 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _uicontroller = __webpack_require__(14); + +var _uicontroller2 = _interopRequireDefault(_uicontroller); + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview Implements ui mode switch + * @author NHN FE Development Lab + */ + + +var MARKDOWN = 'markdown'; +var WYSIWYG = 'wysiwyg'; + +/** + * Class ModeSwitch + * UI Control for switch between Markdown and WYSIWYG + * @param {jQuery} $rootElement - root jquery element + * @param {string} initialType - initial type of editor + */ + +var ModeSwitch = function (_UIController) { + _inherits(ModeSwitch, _UIController); + + /** + * current mode + * @type {String} + * @private + */ + + /** + * mode switch type + * @property {string} MARKDOWN - Markdown + * @property {string} WYSIWYG - WYSIWYG + * @static + * @ignore + */ + function ModeSwitch($rootElement, initialType) { + _classCallCheck(this, ModeSwitch); + + var _this = _possibleConstructorReturn(this, (ModeSwitch.__proto__ || Object.getPrototypeOf(ModeSwitch)).call(this, { + tagName: 'div', + className: 'te-mode-switch' + })); + + Object.defineProperty(_this, '_buttons', { + enumerable: true, + writable: true, + value: {} + }); + + + _this._render($rootElement); + _this._switchType(_tuiCodeSnippet2.default.isExisty(initialType) ? initialType : MARKDOWN); + return _this; + } + + /** + * is the switch tab bar shown + * @returns {Boolean} - showing status + */ + + + /** + * root element + * @type {jQuery} + * @private + */ + + + /** + * mode switch buttons + * @type {Object} + * @private + */ + + + _createClass(ModeSwitch, [{ + key: 'isShown', + value: function isShown() { + return this._$rootElement.css('display') === 'block'; + } + + /** + * show switch tab bar + */ + + }, { + key: 'show', + value: function show() { + this._$rootElement.css('display', 'block'); + } + + /** + * hide switch tab bar + */ + + }, { + key: 'hide', + value: function hide() { + this._$rootElement.css('display', 'none'); + } + }, { + key: '_render', + value: function _render($rootElement) { + this._buttons.$markdown = (0, _jquery2.default)(''); + this._buttons.$wysiwyg = (0, _jquery2.default)(''); + this.$el.append(this._buttons.$markdown); + this.$el.append(this._buttons.$wysiwyg); + + if ($rootElement) { + $rootElement.append(this.$el); + this._$rootElement = $rootElement; + } + + this.on('click .markdown', this._changeMarkdown.bind(this)); + this.on('click .wysiwyg', this._changeWysiwyg.bind(this)); + + this.show(); + } + }, { + key: '_changeMarkdown', + value: function _changeMarkdown() { + this._switchType(MARKDOWN); + } + }, { + key: '_changeWysiwyg', + value: function _changeWysiwyg() { + this._switchType(WYSIWYG); + } + }, { + key: '_setActiveButton', + value: function _setActiveButton(type) { + this._buttons.$markdown.removeClass('active'); + this._buttons.$wysiwyg.removeClass('active'); + this._buttons['$' + type].addClass('active'); + } + }, { + key: '_switchType', + value: function _switchType(type) { + if (this._type === type) { + return; + } + + this._type = type; + this._setActiveButton(type); + this.trigger('modeSwitched', this._type); + } + }]); + + return ModeSwitch; +}(_uicontroller2.default); + +Object.defineProperty(ModeSwitch, 'TYPE', { + enumerable: true, + writable: true, + value: { + MARKDOWN: MARKDOWN, + WYSIWYG: WYSIWYG + } +}); +exports.default = ModeSwitch; + +/***/ }), +/* 102 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _layerpopup = __webpack_require__(7); + +var _layerpopup2 = _interopRequireDefault(_layerpopup); + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview Implements PopupAddLink + * @author NHN FE Development Lab + */ + + +var URL_REGEX = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})(\/([^\s]*))?$/; + +/** + * Class PopupAddLink + * It implements a link Add Popup + * @param {LayerPopupOption} options - layer popup options + * @ignore + */ + +var PopupAddLink = function (_LayerPopup) { + _inherits(PopupAddLink, _LayerPopup); + + function PopupAddLink(options) { + _classCallCheck(this, PopupAddLink); + + var POPUP_CONTENT = '\n \n \n \n \n
\n \n \n
\n '; + options = _tuiCodeSnippet2.default.extend({ + header: true, + title: _i18n2.default.get('Insert link'), + className: 'te-popup-add-link tui-editor-popup', + content: POPUP_CONTENT + }, options); + return _possibleConstructorReturn(this, (PopupAddLink.__proto__ || Object.getPrototypeOf(PopupAddLink)).call(this, options)); + } + + /** + * init instance. + * store properties & prepare before initialize DOM + * @param {LayerPopupOption} options - layer popup options + * @private + * @override + */ + + + _createClass(PopupAddLink, [{ + key: '_initInstance', + value: function _initInstance(options) { + _get(PopupAddLink.prototype.__proto__ || Object.getPrototypeOf(PopupAddLink.prototype), '_initInstance', this).call(this, options); + + this._editor = options.editor; + this._eventManager = options.editor.eventManager; + } + + /** + * initialize DOM, render popup + * @private + * @override + */ + + }, { + key: '_initDOM', + value: function _initDOM() { + _get(PopupAddLink.prototype.__proto__ || Object.getPrototypeOf(PopupAddLink.prototype), '_initDOM', this).call(this); + + var el = this.$el.get(0); + this._inputText = el.querySelector('.te-link-text-input'); + this._inputURL = el.querySelector('.te-url-input'); + } + + /** + * bind DOM events + * @private + * @override + */ + + }, { + key: '_initDOMEvent', + value: function _initDOMEvent() { + var _this2 = this; + + _get(PopupAddLink.prototype.__proto__ || Object.getPrototypeOf(PopupAddLink.prototype), '_initDOMEvent', this).call(this); + + this.on('click .te-close-button', function () { + return _this2.hide(); + }); + this.on('click .te-ok-button', function () { + return _this2._addLink(); + }); + + this.on('shown', function () { + var inputText = _this2._inputText; + var inputURL = _this2._inputURL; + + var selectedText = _this2._editor.getSelectedText().trim(); + + inputText.value = selectedText; + if (URL_REGEX.exec(selectedText)) { + inputURL.value = selectedText; + } + + inputURL.focus(); + }); + + this.on('hidden', function () { + _this2._resetInputs(); + }); + } + + /** + * bind editor events + * @private + * @override + */ + + }, { + key: '_initEditorEvent', + value: function _initEditorEvent() { + var _this3 = this; + + _get(PopupAddLink.prototype.__proto__ || Object.getPrototypeOf(PopupAddLink.prototype), '_initEditorEvent', this).call(this); + + var eventManager = this._eventManager; + eventManager.listen('focus', function () { + return _this3.hide(); + }); + eventManager.listen('closeAllPopup', function () { + return _this3.hide(); + }); + eventManager.listen('openPopupAddLink', function () { + eventManager.emit('closeAllPopup'); + _this3.show(); + }); + } + }, { + key: '_addLink', + value: function _addLink() { + var _getValue2 = this._getValue(), + url = _getValue2.url, + linkText = _getValue2.linkText; + + this._clearValidationStyle(); + + if (linkText.length < 1) { + (0, _jquery2.default)(this._inputText).addClass('wrong'); + + return; + } + if (url.length < 1) { + (0, _jquery2.default)(this._inputURL).addClass('wrong'); + + return; + } + + this._eventManager.emit('command', 'AddLink', { + linkText: linkText, + url: url + }); + this.hide(); + } + }, { + key: '_getValue', + value: function _getValue() { + var url = this._inputURL.value; + var linkText = this._inputText.value; + + return { + url: url, + linkText: linkText + }; + } + }, { + key: '_clearValidationStyle', + value: function _clearValidationStyle() { + (0, _jquery2.default)(this._inputURL).removeClass('wrong'); + (0, _jquery2.default)(this._inputText).removeClass('wrong'); + } + }, { + key: '_resetInputs', + value: function _resetInputs() { + this._inputText.value = ''; + this._inputURL.value = ''; + this._clearValidationStyle(); + } + }]); + + return PopupAddLink; +}(_layerpopup2.default); + +exports.default = PopupAddLink; + +/***/ }), +/* 103 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _layerpopup = __webpack_require__(7); + +var _layerpopup2 = _interopRequireDefault(_layerpopup); + +var _tab = __webpack_require__(46); + +var _tab2 = _interopRequireDefault(_tab); + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview Implements PopupAddImage + * @author NHN FE Development Lab + */ + + +var CLASS_IMAGE_URL_INPUT = 'te-image-url-input'; +var CLASS_IMAGE_FILE_INPUT = 'te-image-file-input'; +var CLASS_ALT_TEXT_INPUT = 'te-alt-text-input'; +var CLASS_OK_BUTTON = 'te-ok-button'; +var CLASS_CLOSE_BUTTON = 'te-close-button'; +var CLASS_FILE_TYPE = 'te-file-type'; +var CLASS_URL_TYPE = 'te-url-type'; +var CLASS_TAB_SECTION = 'te-tab-section'; +var TYPE_UI = 'ui'; + +/** + * Class PopupAddImage + * It implements a Image Add Popup + * @param {LayerPopupOption} options - layer popup option + * @ignore + */ + +var PopupAddImage = function (_LayerPopup) { + _inherits(PopupAddImage, _LayerPopup); + + function PopupAddImage(options) { + _classCallCheck(this, PopupAddImage); + + var POPUP_CONTENT = '\n
\n
\n \n \n
\n
\n \n \n
\n \n \n
\n \n \n
\n '; + options = _tuiCodeSnippet2.default.extend({ + header: true, + title: _i18n2.default.get('Insert image'), + className: 'te-popup-add-image tui-editor-popup', + content: POPUP_CONTENT + }, options); + return _possibleConstructorReturn(this, (PopupAddImage.__proto__ || Object.getPrototypeOf(PopupAddImage)).call(this, options)); + } + + /** + * init instance. + * store properties & prepare before initialize DOM + * @param {LayerPopupOption} options - layer popup options + * @private + * @override + */ + + + _createClass(PopupAddImage, [{ + key: '_initInstance', + value: function _initInstance(options) { + _get(PopupAddImage.prototype.__proto__ || Object.getPrototypeOf(PopupAddImage.prototype), '_initInstance', this).call(this, options); + + this.eventManager = options.eventManager; + } + + /** + * initialize DOM, render popup + * @private + * @override + */ + + }, { + key: '_initDOM', + value: function _initDOM() { + _get(PopupAddImage.prototype.__proto__ || Object.getPrototypeOf(PopupAddImage.prototype), '_initDOM', this).call(this); + + var $popup = this.$el; + + this._$imageUrlInput = $popup.find('.' + CLASS_IMAGE_URL_INPUT); + this._$imageFileInput = $popup.find('.' + CLASS_IMAGE_FILE_INPUT); + this._$altTextInput = $popup.find('.' + CLASS_ALT_TEXT_INPUT); + + var $fileTypeSection = $popup.find('.' + CLASS_FILE_TYPE); + var $urlTypeSection = $popup.find('.' + CLASS_URL_TYPE); + var $tabSection = this.$body.find('.' + CLASS_TAB_SECTION); + this.tab = new _tab2.default({ + initName: _i18n2.default.get('File'), + items: [_i18n2.default.get('File'), _i18n2.default.get('URL')], + sections: [$fileTypeSection, $urlTypeSection] + }); + $tabSection.append(this.tab.$el); + } + + /** + * bind DOM events + * @private + * @override + */ + + }, { + key: '_initDOMEvent', + value: function _initDOMEvent() { + var _this2 = this; + + _get(PopupAddImage.prototype.__proto__ || Object.getPrototypeOf(PopupAddImage.prototype), '_initDOMEvent', this).call(this); + + this.on('shown', function () { + return _this2._$imageUrlInput.focus(); + }); + this.on('hidden', function () { + return _this2._resetInputs(); + }); + + this.on('change .' + CLASS_IMAGE_FILE_INPUT, function () { + var filename = _this2._$imageFileInput.val().split('\\').pop(); + _this2._$altTextInput.val(filename); + }); + + this.on('click .' + CLASS_CLOSE_BUTTON, function () { + return _this2.hide(); + }); + this.on('click .' + CLASS_OK_BUTTON, function () { + var imageUrl = _this2._$imageUrlInput.val(); + var altText = _this2._$altTextInput.val(); + + if (imageUrl) { + _this2._applyImage(imageUrl, altText); + } else { + var _$imageFileInput$get = _this2._$imageFileInput.get(0), + files = _$imageFileInput$get.files; + + if (files.length) { + var imageFile = files.item(0); + var hookCallback = function hookCallback(url, text) { + return _this2._applyImage(url, text || altText); + }; + + _this2.eventManager.emit('addImageBlobHook', imageFile, hookCallback, TYPE_UI); + } + } + + _this2.hide(); + }); + + this.tab.on('itemClick', function () { + return _this2._resetInputs(); + }); + } + + /** + * bind editor events + * @private + * @override + */ + + }, { + key: '_initEditorEvent', + value: function _initEditorEvent() { + var _this3 = this; + + _get(PopupAddImage.prototype.__proto__ || Object.getPrototypeOf(PopupAddImage.prototype), '_initEditorEvent', this).call(this); + + this.eventManager.listen('focus', function () { + return _this3.hide(); + }); + this.eventManager.listen('closeAllPopup', function () { + return _this3.hide(); + }); + + this.eventManager.listen('openPopupAddImage', function () { + _this3.eventManager.emit('closeAllPopup'); + _this3.show(); + }); + } + }, { + key: '_applyImage', + value: function _applyImage(imageUrl, altText) { + this.eventManager.emit('command', 'AddImage', { + imageUrl: imageUrl, + altText: altText || 'image' + }); + this.hide(); + } + }, { + key: '_resetInputs', + value: function _resetInputs() { + this.$el.find('input').val(''); + } + + /** + * Remove popup + * @override + */ + + }, { + key: 'remove', + value: function remove() { + this.tab.remove(); + _get(PopupAddImage.prototype.__proto__ || Object.getPrototypeOf(PopupAddImage.prototype), 'remove', this).call(this); + } + }]); + + return PopupAddImage; +}(_layerpopup2.default); + +exports.default = PopupAddImage; + +/***/ }), +/* 104 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.DISABLED_MENU_CLASS_NAME = exports.REMOVE_ROW_MENU_CLASS_NAME = undefined; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _layerpopup = __webpack_require__(7); + +var _layerpopup2 = _interopRequireDefault(_layerpopup); + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview Implements PopupTableUtils + * @author NHN FE Development Lab + */ + + +var REMOVE_ROW_MENU_CLASS_NAME = exports.REMOVE_ROW_MENU_CLASS_NAME = 'te-table-remove-row'; +var DISABLED_MENU_CLASS_NAME = exports.DISABLED_MENU_CLASS_NAME = 'te-context-menu-disabled'; + +/** + * PopupTableUtils + * It implements table utils popup + * @param {LayerPopupOption} options - layer popup options + */ + +var PopupTableUtils = function (_LayerPopup) { + _inherits(PopupTableUtils, _LayerPopup); + + function PopupTableUtils(options) { + _classCallCheck(this, PopupTableUtils); + + var POPUP_CONTENT = '\n \n \n \n \n
\n \n \n \n
\n \n '; + options = _tuiCodeSnippet2.default.extend({ + header: false, + className: 'te-popup-table-utils', + content: POPUP_CONTENT + }, options); + return _possibleConstructorReturn(this, (PopupTableUtils.__proto__ || Object.getPrototypeOf(PopupTableUtils)).call(this, options)); + } + + /** + * init instance. + * store properties & prepare before initialize DOM + * @param {LayerPopupOption} options - layer popup options + * @private + * @override + */ + + + _createClass(PopupTableUtils, [{ + key: '_initInstance', + value: function _initInstance(options) { + _get(PopupTableUtils.prototype.__proto__ || Object.getPrototypeOf(PopupTableUtils.prototype), '_initInstance', this).call(this, options); + this.eventManager = options.eventManager; + } + + /** + * bind DOM events + * @private + * @override + */ + + }, { + key: '_initDOMEvent', + value: function _initDOMEvent() { + var _this2 = this; + + _get(PopupTableUtils.prototype.__proto__ || Object.getPrototypeOf(PopupTableUtils.prototype), '_initDOMEvent', this).call(this); + + this.on('click .te-table-add-row', function () { + return _this2.eventManager.emit('command', 'AddRow'); + }); + this.on('click .te-table-add-col', function () { + return _this2.eventManager.emit('command', 'AddCol'); + }); + this.on('click .te-table-col-align-left', function () { + return _this2.eventManager.emit('command', 'AlignCol', 'left'); + }); + this.on('click .te-table-col-align-center', function () { + return _this2.eventManager.emit('command', 'AlignCol', 'center'); + }); + this.on('click .te-table-col-align-right', function () { + return _this2.eventManager.emit('command', 'AlignCol', 'right'); + }); + this.on('click .te-table-remove-col', function () { + return _this2.eventManager.emit('command', 'RemoveCol'); + }); + this.on('click .te-table-remove', function () { + return _this2.eventManager.emit('command', 'RemoveTable'); + }); + this._bindClickEventOnRemoveRowMenu(); + } + + /** + * bind editor events + * @private + * @override + */ + + }, { + key: '_initEditorEvent', + value: function _initEditorEvent() { + var _this3 = this; + + _get(PopupTableUtils.prototype.__proto__ || Object.getPrototypeOf(PopupTableUtils.prototype), '_initEditorEvent', this).call(this); + + this.eventManager.listen('focus', function () { + return _this3.hide(); + }); + this.eventManager.listen('mousedown', function () { + return _this3.hide(); + }); + this.eventManager.listen('closeAllPopup', function () { + return _this3.hide(); + }); + this.eventManager.listen('openPopupTableUtils', function (ev) { + var offset = _this3.$el.parent().offset(); + var x = ev.clientX - offset.left; + var y = ev.clientY - offset.top + (0, _jquery2.default)(window).scrollTop(); + + _this3._disableRemoveRowMenu(ev.target); + + _this3.$el.css({ + position: 'absolute', + top: y + 5, // beside mouse pointer + left: x + 10 + }); + _this3.eventManager.emit('closeAllPopup'); + _this3.show(); + }); + } + }, { + key: '_bindClickEventOnRemoveRowMenu', + value: function _bindClickEventOnRemoveRowMenu() { + var _this4 = this; + + this.on('click .' + REMOVE_ROW_MENU_CLASS_NAME, function (ev) { + var target = ev.target; + + + if ((0, _jquery2.default)(target).hasClass(DISABLED_MENU_CLASS_NAME)) { + ev.preventDefault(); + } else { + _this4.eventManager.emit('command', 'RemoveRow'); + } + }); + } + }, { + key: '_disableRemoveRowMenu', + value: function _disableRemoveRowMenu(target) { + var $menu = this.$el.find('.' + REMOVE_ROW_MENU_CLASS_NAME); + + if (target.nodeName === 'TH') { + $menu.addClass(DISABLED_MENU_CLASS_NAME); + } else { + $menu.removeClass(DISABLED_MENU_CLASS_NAME); + } + } + }]); + + return PopupTableUtils; +}(_layerpopup2.default); + +exports.default = PopupTableUtils; + +/***/ }), +/* 105 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _layerpopup = __webpack_require__(7); + +var _layerpopup2 = _interopRequireDefault(_layerpopup); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview Implements PopupAddTable + * @author NHN FE Development Lab + */ + + +var CLASS_TABLE_SELECTION = 'te-table-selection'; +var CLASS_TABLE_HEADER = 'te-table-header'; +var CLASS_TABLE_BODY = 'te-table-body'; +var CLASS_SELECTION_AREA = 'te-selection-area'; +var CLASS_DESCRIPTION = 'te-description'; + +var POPUP_CONTENT = '\n
\n
\n
\n
\n
\n

\n'; + +var CELL_WIDTH = 25; +var CELL_HEIGHT = 17; +var MIN_ROW_INDEX = 7; +var MAX_ROW_INDEX = 14; +var MIN_COL_INDEX = 5; +var MAX_COL_INDEX = 9; +var MIN_ROW_SELECTION_INDEX = 1; +var MIN_COL_SELECTION_INDEX = 1; +var HEADER_ROW_COUNT = 1; +var LAST_BORDER = 1; + +/** + * Class PopupAddTable + * It implements Popup to add a table + * @param {LayerPopupOption} options - layer popup option + * @ignore + */ + +var PopupAddTable = function (_LayerPopup) { + _inherits(PopupAddTable, _LayerPopup); + + /** + * Toolbar Button which the Popup is bound to. + * @type {jQuery} + * @private + */ + function PopupAddTable(options) { + _classCallCheck(this, PopupAddTable); + + options = _tuiCodeSnippet2.default.extend({ + header: false, + className: 'te-popup-add-table', + content: POPUP_CONTENT + }, options); + return _possibleConstructorReturn(this, (PopupAddTable.__proto__ || Object.getPrototypeOf(PopupAddTable)).call(this, options)); + } + + /** + * init instance. + * store properties & prepare before initialize DOM + * @param {LayerPopupOption} options - layer popup options + * @private + * @override + */ + + + /** + * EventManager instance + * @type {EventManager} + * @private + */ + + + _createClass(PopupAddTable, [{ + key: '_initInstance', + value: function _initInstance(options) { + _get(PopupAddTable.prototype.__proto__ || Object.getPrototypeOf(PopupAddTable.prototype), '_initInstance', this).call(this, options); + + this._selectedBound = {}; + this._tableBound = {}; + this._eventManager = options.eventManager; + this._$button = options.$button; + } + + /** + * initialize DOM, render popup + * @private + * @override + */ + + }, { + key: '_initDOM', + value: function _initDOM() { + _get(PopupAddTable.prototype.__proto__ || Object.getPrototypeOf(PopupAddTable.prototype), '_initDOM', this).call(this); + + this._cacheElements(); + this._setTableSizeByBound(MIN_COL_INDEX, MIN_ROW_INDEX); + } + + /** + * bind DOM events + * @private + * @override + */ + + }, { + key: '_initDOMEvent', + value: function _initDOMEvent(options) { + var _this2 = this; + + _get(PopupAddTable.prototype.__proto__ || Object.getPrototypeOf(PopupAddTable.prototype), '_initDOMEvent', this).call(this, options); + + this.on('mousemove .' + CLASS_TABLE_SELECTION, function (ev) { + var x = ev.pageX - _this2._selectionOffset.left; + var y = ev.pageY - _this2._selectionOffset.top; + var bound = _this2._getSelectionBoundByOffset(x, y); + + _this2._resizeTableBySelectionIfNeed(bound.col, bound.row); + + _this2._setSelectionAreaByBound(bound.col, bound.row); + _this2._setDisplayText(bound.col, bound.row); + _this2._setSelectedBound(bound.col, bound.row); + }); + + this.on('click .' + CLASS_TABLE_SELECTION, function () { + var tableSize = _this2._getSelectedTableSize(); + _this2._eventManager.emit('command', 'Table', tableSize.col, tableSize.row); + }); + } + + /** + * bind editor events + * @private + * @override + */ + + }, { + key: '_initEditorEvent', + value: function _initEditorEvent() { + var _this3 = this; + + _get(PopupAddTable.prototype.__proto__ || Object.getPrototypeOf(PopupAddTable.prototype), '_initEditorEvent', this).call(this); + + this._eventManager.listen('focus', function () { + return _this3.hide(); + }); + this._eventManager.listen('closeAllPopup', function () { + return _this3.hide(); + }); + + this._eventManager.listen('openPopupAddTable', function () { + var $button = _this3._$button; + + var _$button$get = $button.get(0), + offsetTop = _$button$get.offsetTop, + offsetLeft = _$button$get.offsetLeft; + + _this3.$el.css({ + top: offsetTop + $button.outerHeight(), + left: offsetLeft + }); + _this3._eventManager.emit('closeAllPopup'); + _this3.show(); + _this3._selectionOffset = _this3.$el.find('.' + CLASS_TABLE_SELECTION).offset(); + }); + } + + /** + * Cache elements for use + * @private + */ + + }, { + key: '_cacheElements', + value: function _cacheElements() { + this.$header = this.$el.find('.' + CLASS_TABLE_HEADER); + this.$body = this.$el.find('.' + CLASS_TABLE_BODY); + this.$selection = this.$el.find('.' + CLASS_SELECTION_AREA); + this.$desc = this.$el.find('.' + CLASS_DESCRIPTION); + } + + /** + * Resize table if need + * @param {number} col column index + * @param {number} row row index + * @private + */ + + }, { + key: '_resizeTableBySelectionIfNeed', + value: function _resizeTableBySelectionIfNeed(col, row) { + var resizedBound = this._getResizedTableBound(col, row); + + if (resizedBound) { + this._setTableSizeByBound(resizedBound.col, resizedBound.row); + } + } + + /** + * Get resized table bound if Need + * @param {number} col column index + * @param {number} row row index + * @returns {object} bound + * @private + */ + + }, { + key: '_getResizedTableBound', + value: function _getResizedTableBound(col, row) { + var resizedCol = void 0, + resizedRow = void 0, + resizedBound = void 0; + + if (col >= MIN_COL_INDEX && col < MAX_COL_INDEX) { + resizedCol = col + 1; + } else if (col < MIN_COL_INDEX) { + resizedCol = MIN_COL_INDEX; + } + + if (row >= MIN_ROW_INDEX && row < MAX_ROW_INDEX) { + resizedRow = row + 1; + } else if (row < MIN_ROW_INDEX) { + resizedRow = MIN_ROW_INDEX; + } + + if (this._isNeedResizeTable(resizedCol, resizedRow)) { + resizedBound = { + row: resizedRow || this._tableBound.row, + col: resizedCol || this._tableBound.col + }; + } + + return resizedBound; + } + + /** + * check if need resize table + * @param {number} col column index + * @param {number} row row index + * @returns {boolean} result + * @private + */ + + }, { + key: '_isNeedResizeTable', + value: function _isNeedResizeTable(col, row) { + return col && col !== this._tableBound.col || row && row !== this._tableBound.row; + } + + /** + * Get bound by offset + * @param {number} x offset + * @param {number} y offset + * @returns {object} bound + * @private + */ + + }, { + key: '_getBoundByOffset', + value: function _getBoundByOffset(x, y) { + var row = parseInt(y / CELL_HEIGHT, 10); + var col = parseInt(x / CELL_WIDTH, 10); + + return { + row: row, + col: col + }; + } + + /** + * Get offset by bound + * @param {number} col column index + * @param {number} row row index + * @returns {object} offset + * @private + */ + + }, { + key: '_getOffsetByBound', + value: function _getOffsetByBound(col, row) { + var x = col * CELL_WIDTH + CELL_WIDTH, + y = row * CELL_HEIGHT + CELL_HEIGHT; + + return { + x: x, + y: y + }; + } + + /** + * Set table size with bound + * @param {number} col column index + * @param {number} row row index + * @private + */ + + }, { + key: '_setTableSizeByBound', + value: function _setTableSizeByBound(col, row) { + var boundOffset = this._getOffsetByBound(col, row - HEADER_ROW_COUNT); + this._setTableSize(boundOffset.x, boundOffset.y); + this._tableBound.row = row; + this._tableBound.col = col; + } + + /** + * Get selection bound that process with range by offset + * @param {number} x offset + * @param {number} y offset + * @returns {object} bound + * @private + */ + + }, { + key: '_getSelectionBoundByOffset', + value: function _getSelectionBoundByOffset(x, y) { + var bound = this._getBoundByOffset(x, y); + + if (bound.row < MIN_ROW_SELECTION_INDEX) { + bound.row = MIN_ROW_SELECTION_INDEX; + } else if (bound.row > this._tableBound.row) { + bound.row = this._tableBound.row; + } + + if (bound.col < MIN_COL_SELECTION_INDEX) { + bound.col = MIN_COL_SELECTION_INDEX; + } else if (bound.col > this._tableBound.col) { + bound.col = this._tableBound.col; + } + + return bound; + } + + /** + * Set selection area with bound + * @param {number} col column index + * @param {number} row row index + * @private + */ + + }, { + key: '_setSelectionAreaByBound', + value: function _setSelectionAreaByBound(col, row) { + var boundOffset = this._getOffsetByBound(col, row); + this._setSelectionArea(boundOffset.x, boundOffset.y); + } + + /** + * Set selected bound + * @param {number} col column index + * @param {number} row row index + * @private + */ + + }, { + key: '_setSelectedBound', + value: function _setSelectedBound(col, row) { + this._selectedBound.col = col; + this._selectedBound.row = row; + } + + /** + * Get selected table size + * @returns {object} bound + * @private + */ + + }, { + key: '_getSelectedTableSize', + value: function _getSelectedTableSize() { + return { + row: this._selectedBound.row + 1, + col: this._selectedBound.col + 1 + }; + } + + /** + * Set selected table size text for display + * @param {number} col column index + * @param {number} row row index + * @private + */ + + }, { + key: '_setDisplayText', + value: function _setDisplayText(col, row) { + this.$desc.html(col + 1 + ' x ' + (row + 1)); + } + + /** + * Set table element size + * @param {number} x offset + * @param {number} y offset + * @private + */ + + }, { + key: '_setTableSize', + value: function _setTableSize(x, y) { + x += LAST_BORDER; + y += LAST_BORDER; + + this.$header.css({ + height: CELL_HEIGHT, + width: x + }); + + this.$body.css({ + height: y, + width: x + }); + + this.$el.css({ + width: x + 30 + }); + } + + /** + * Set selection element size + * @param {number} x offset + * @param {number} y offset + * @private + */ + + }, { + key: '_setSelectionArea', + value: function _setSelectionArea(x, y) { + x += LAST_BORDER; + y += LAST_BORDER; + + this.$selection.css({ + height: y, + width: x + }); + } + }]); + + return PopupAddTable; +}(_layerpopup2.default); + +PopupAddTable.CELL_WIDTH = CELL_WIDTH; +PopupAddTable.CELL_HEIGHT = CELL_HEIGHT; +PopupAddTable.MIN_ROW_SELECTION_INDEX = MIN_ROW_SELECTION_INDEX; +PopupAddTable.MIN_COL_SELECTION_INDEX = MIN_COL_SELECTION_INDEX; + +exports.default = PopupAddTable; + +/***/ }), +/* 106 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _layerpopup = __webpack_require__(7); + +var _layerpopup2 = _interopRequireDefault(_layerpopup); + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview Implements PopupAddHeading + * @author NHN FE Development Lab + */ + + +/** + * Class PopupAddHeading + * It implements Popup to add headings + * @param {LayerPopupOption} options - layer popup option + * @ignore + */ +var PopupAddHeading = function (_LayerPopup) { + _inherits(PopupAddHeading, _LayerPopup); + + function PopupAddHeading(options) { + _classCallCheck(this, PopupAddHeading); + + var POPUP_CONTENT = '\n
    \n
  • ' + _i18n2.default.get('Heading') + ' 1

  • \n
  • ' + _i18n2.default.get('Heading') + ' 2

  • \n
  • ' + _i18n2.default.get('Heading') + ' 3

  • \n
  • ' + _i18n2.default.get('Heading') + ' 4

  • \n
  • ' + _i18n2.default.get('Heading') + ' 5
  • \n
  • ' + _i18n2.default.get('Heading') + ' 6
  • \n
  • ' + _i18n2.default.get('Paragraph') + '
  • \n
\n '; + options = _tuiCodeSnippet2.default.extend({ + header: false, + className: 'te-heading-add', + content: POPUP_CONTENT + }, options); + return _possibleConstructorReturn(this, (PopupAddHeading.__proto__ || Object.getPrototypeOf(PopupAddHeading)).call(this, options)); + } + + /** + * init instance. + * store properties & prepare before initialize DOM + * @param {LayerPopupOption} options - layer popup options + * @private + * @override + */ + + + _createClass(PopupAddHeading, [{ + key: '_initInstance', + value: function _initInstance(options) { + _get(PopupAddHeading.prototype.__proto__ || Object.getPrototypeOf(PopupAddHeading.prototype), '_initInstance', this).call(this, options); + + this._eventManager = options.eventManager; + this._$button = options.$button; + } + + /** + * bind DOM events + * @private + * @override + */ + + }, { + key: '_initDOMEvent', + value: function _initDOMEvent() { + var _this2 = this; + + _get(PopupAddHeading.prototype.__proto__ || Object.getPrototypeOf(PopupAddHeading.prototype), '_initDOMEvent', this).call(this); + + this.on('click li', function (ev) { + var $li = (0, _jquery2.default)(ev.target).closest('li'); + _this2._eventManager.emit('command', $li.data('type'), $li.data('value')); + }); + } + + /** + * bind editor events + * @private + * @override + */ + + }, { + key: '_initEditorEvent', + value: function _initEditorEvent() { + var _this3 = this; + + _get(PopupAddHeading.prototype.__proto__ || Object.getPrototypeOf(PopupAddHeading.prototype), '_initEditorEvent', this).call(this); + + this._eventManager.listen('focus', this.hide.bind(this)); + this._eventManager.listen('closeAllPopup', this.hide.bind(this)); + this._eventManager.listen('openHeadingSelect', function () { + var $button = _this3._$button; + + var _$button$get = $button.get(0), + offsetTop = _$button$get.offsetTop, + offsetLeft = _$button$get.offsetLeft; + + _this3.$el.css({ + top: offsetTop + $button.outerHeight(), + left: offsetLeft + }); + + _this3._eventManager.emit('closeAllPopup'); + _this3.show(); + }); + } + }]); + + return PopupAddHeading; +}(_layerpopup2.default); + +exports.default = PopupAddHeading; + +/***/ }), +/* 107 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _layerpopup = __webpack_require__(7); + +var _layerpopup2 = _interopRequireDefault(_layerpopup); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview Implements popup code block languages + * @author NHN FE Development Lab + */ + + +var BUTTON_CLASS_PREFIX = 'te-popup-code-block-lang-'; + +/** + * Class Popup code block languages select list + * @param {LayerPopupOption} options - layer popup option + * @ignore + */ + +var PopupCodeBlockLanguages = function (_LayerPopup) { + _inherits(PopupCodeBlockLanguages, _LayerPopup); + + function PopupCodeBlockLanguages(options) { + _classCallCheck(this, PopupCodeBlockLanguages); + + var popupButtonsHTML = []; + var _options = options, + languages = _options.languages; + + languages.forEach(function (lang) { + return popupButtonsHTML.push(''); + }); + + options = _tuiCodeSnippet2.default.extend({ + header: false, + className: 'te-popup-code-block-languages', + content: popupButtonsHTML.join('') + }, options); + return _possibleConstructorReturn(this, (PopupCodeBlockLanguages.__proto__ || Object.getPrototypeOf(PopupCodeBlockLanguages)).call(this, options)); + } + + /** + * init instance. + * store properties & prepare before initialize DOM + * @param {LayerPopupOption} options - layer popup options + * @private + * @override + */ + + + _createClass(PopupCodeBlockLanguages, [{ + key: '_initInstance', + value: function _initInstance(options) { + _get(PopupCodeBlockLanguages.prototype.__proto__ || Object.getPrototypeOf(PopupCodeBlockLanguages.prototype), '_initInstance', this).call(this, options); + + this._onSelectedLanguage = null; + this._onDismissed = null; + this._currentButton = null; + this._$buttons = null; + this._languages = options.languages; + + this.eventManager = options.eventManager; + } + + /** + * initialize DOM, render popup + * @private + * @override + */ + + }, { + key: '_initDOM', + value: function _initDOM(options) { + _get(PopupCodeBlockLanguages.prototype.__proto__ || Object.getPrototypeOf(PopupCodeBlockLanguages.prototype), '_initDOM', this).call(this, options); + + this.$el.css('z-index', 10000); + + this._$buttons = this.$el.find('button'); + this._activateButtonByIndex(0); + } + + /** + * bind DOM events + * @private + * @override + */ + + }, { + key: '_initDOMEvent', + value: function _initDOMEvent() { + var _this2 = this; + + _get(PopupCodeBlockLanguages.prototype.__proto__ || Object.getPrototypeOf(PopupCodeBlockLanguages.prototype), '_initDOMEvent', this).call(this); + + var handler = function handler(event) { + var language = (0, _jquery2.default)(event.target).data('lang'); + if (_this2._onSelectedLanguage) { + _this2._onSelectedLanguage(language); + } + _this2.hide(); + }; + this._languages.forEach(function (lang) { + return _this2.on('mousedown .' + BUTTON_CLASS_PREFIX + lang, handler); + }); + } + + /** + * bind editor events + * @private + * @override + */ + + }, { + key: '_initEditorEvent', + value: function _initEditorEvent() { + var _this3 = this; + + _get(PopupCodeBlockLanguages.prototype.__proto__ || Object.getPrototypeOf(PopupCodeBlockLanguages.prototype), '_initEditorEvent', this).call(this); + + this.eventManager.listen('openPopupCodeBlockLanguages', function (data) { + _this3.show(data.callback); + var elementStyle = _this3.$el.get(0).style; + elementStyle.top = data.offset.top + 'px'; + elementStyle.left = data.offset.left + 'px'; + _this3.setCurrentLanguage(data.language); + + return _this3; + }); + this.eventManager.listen('focus', function () { + return _this3.hide(); + }); + this.eventManager.listen('mousedown', function () { + return _this3.hide(); + }); + this.eventManager.listen('closeAllPopup', function () { + return _this3.hide(); + }); + this.eventManager.listen('closePopupCodeBlockLanguages', function () { + return _this3.hide(); + }); + this.eventManager.listen('scroll', function () { + return _this3.hide(); + }); + } + + /** + * activate an item by index + * @param {number} index - item index + * @private + */ + + }, { + key: '_activateButtonByIndex', + value: function _activateButtonByIndex(index) { + if (this._currentButton) { + (0, _jquery2.default)(this._currentButton).removeClass('active'); + } + this._currentButton = this._$buttons.get(index); + (0, _jquery2.default)(this._currentButton).addClass('active'); + this._currentButton.scrollIntoView(); + } + + /** + * move to prev language + */ + + }, { + key: 'prev', + value: function prev() { + var index = this._$buttons.index(this._currentButton) - 1; + if (index < 0) { + index = this._$buttons.length - 1; + } + this._activateButtonByIndex(index); + } + + /** + * move to next language + */ + + }, { + key: 'next', + value: function next() { + var index = this._$buttons.index(this._currentButton) + 1; + if (index >= this._$buttons.length) { + index = 0; + } + this._activateButtonByIndex(index); + } + + /** + * current language + * @returns {string} language + */ + + }, { + key: 'getCurrentLanguage', + value: function getCurrentLanguage() { + var language = (0, _jquery2.default)(this._currentButton).data('lang'); + + return language; + } + + /** + * set current language + * @param {string} language - current language + */ + + }, { + key: 'setCurrentLanguage', + value: function setCurrentLanguage(language) { + var item = this._$buttons.filter('.' + BUTTON_CLASS_PREFIX + language); + if (item.length > 0) { + var index = this._$buttons.index(item); + this._activateButtonByIndex(index); + } + } + + /** + * show popup + * @param {object} callback - to be called on language selected & dismissed + * @override + */ + + }, { + key: 'show', + value: function show(callback) { + this._onSelectedLanguage = callback.selected; + this._onDismissed = callback.dismissed; + _get(PopupCodeBlockLanguages.prototype.__proto__ || Object.getPrototypeOf(PopupCodeBlockLanguages.prototype), 'show', this).call(this); + } + + /** + * hide popup + * @override + */ + + }, { + key: 'hide', + value: function hide() { + if (this._onDismissed) { + this._onDismissed(); + } + this._onSelectedLanguage = null; + this._onDismissed = null; + _get(PopupCodeBlockLanguages.prototype.__proto__ || Object.getPrototypeOf(PopupCodeBlockLanguages.prototype), 'hide', this).call(this); + } + }]); + + return PopupCodeBlockLanguages; +}(_layerpopup2.default); + +exports.default = PopupCodeBlockLanguages; + +/***/ }), +/* 108 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _layerpopup = __webpack_require__(7); + +var _layerpopup2 = _interopRequireDefault(_layerpopup); + +var _scrollSyncSplit = __webpack_require__(109); + +var _scrollSyncSplit2 = _interopRequireDefault(_scrollSyncSplit); + +var _codeBlockEditor = __webpack_require__(110); + +var _codeBlockEditor2 = _interopRequireDefault(_codeBlockEditor); + +var _codeBlockPreview = __webpack_require__(111); + +var _codeBlockPreview2 = _interopRequireDefault(_codeBlockPreview); + +var _codeBlockLanguagesCombo = __webpack_require__(112); + +var _codeBlockLanguagesCombo2 = _interopRequireDefault(_codeBlockLanguagesCombo); + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview Implements popup code block editor + * @author NHN FE Development Lab + */ + + +var CLASS_PREFIX = 'popup-editor-'; +var CLASS_OK_BUTTON = 'te-ok-button'; +var CLASS_CLOSE_BUTTON = 'te-close-button'; +var CLASS_POPUP_CLOSE_BUTTON = 'tui-popup-close-button'; +var TEMPLATE_HEADER_BUTTONS = '\n \n \n \n \n'; + +/** + * Class popup code block editor + * @param {LayerPopupOption} options - layer popup option + * @ignore + */ + +var PopupCodeBlockEditor = function (_LayerPopup) { + _inherits(PopupCodeBlockEditor, _LayerPopup); + + function PopupCodeBlockEditor(options) { + _classCallCheck(this, PopupCodeBlockEditor); + + var TEMPLATE_CONTENT = '\n
\n
\n \n \n
\n '; + options = _tuiCodeSnippet2.default.extend({ + header: true, + title: 'CodeBlock Editor', + content: TEMPLATE_CONTENT, + className: 'tui-popup-code-block-editor', + headerButtons: TEMPLATE_HEADER_BUTTONS, + modal: true + }, options); + return _possibleConstructorReturn(this, (PopupCodeBlockEditor.__proto__ || Object.getPrototypeOf(PopupCodeBlockEditor)).call(this, options)); + } + + /** + * init instance. + * store properties & prepare before initialize DOM + * @param {LayerPopupOption} options - layer popup options + * @private + * @override + */ + + + _createClass(PopupCodeBlockEditor, [{ + key: '_initInstance', + value: function _initInstance(options) { + _get(PopupCodeBlockEditor.prototype.__proto__ || Object.getPrototypeOf(PopupCodeBlockEditor.prototype), '_initInstance', this).call(this, options); + + this.eventManager = options.eventManager; + this.convertor = options.convertor; + } + + /** + * initialize DOM, render popup + * @private + * @override + */ + + }, { + key: '_initDOM', + value: function _initDOM(options) { + _get(PopupCodeBlockEditor.prototype.__proto__ || Object.getPrototypeOf(PopupCodeBlockEditor.prototype), '_initDOM', this).call(this, options); + + var el = this.$el.get(0); + this._body = el.querySelector('.' + CLASS_PREFIX + 'body'); + this._toggleFitButton = el.querySelector('.' + CLASS_PREFIX + 'toggle-fit'); + this._togglePreviewButton = el.querySelector('.' + CLASS_PREFIX + 'toggle-preview'); + this._toggleScrollButton = el.querySelector('.' + CLASS_PREFIX + 'toggle-scroll'); + this._okButton = el.querySelector('.' + CLASS_OK_BUTTON); + this._closeButton = el.querySelector('.' + CLASS_CLOSE_BUTTON); + + this._codeMirrorWrapper = this._createCodeBlockEditor(); + this._previewWrapper = this._createPreview(); + this._scrollSyncSplit = new _scrollSyncSplit2.default(this._body, this._codeMirrorWrapper, this._previewWrapper); + + this._updateFitWindowButton(); + this._updatePreviewButton(); + this._updateScrollButton(); + + this._codeBlockLanguagesCombo = this._createCodeBlockLanguagesCombo(); + } + + /** + * bind DOM events + * @private + * @override + */ + + }, { + key: '_initDOMEvent', + value: function _initDOMEvent() { + var _this2 = this; + + _get(PopupCodeBlockEditor.prototype.__proto__ || Object.getPrototypeOf(PopupCodeBlockEditor.prototype), '_initDOMEvent', this).call(this); + + this.on('scroll', function (ev) { + return ev.preventDefault(); + }); + this.on('click .' + CLASS_PREFIX + 'toggle-fit', function () { + return _this2._toggleFitToWindow(); + }); + this.on('click .' + CLASS_PREFIX + 'toggle-preview', function () { + return _this2._togglePreview(); + }); + this.on('click .' + CLASS_PREFIX + 'toggle-scroll', function () { + return _this2._toggleScroll(); + }); + this.on('click .' + CLASS_OK_BUTTON, function () { + return _this2._save(); + }); + this.on('click .' + CLASS_CLOSE_BUTTON, function () { + return _this2.hide(); + }); + this.on('click .' + CLASS_PREFIX + 'close', function () { + return _this2.hide(); + }); + this.on('click .' + CLASS_PREFIX + 'editor-wrapper', function (ev) { + if (ev.target === _this2._codeMirrorWrapper) { + _this2._focusEditor(true); + } + }); + } + + /** + * bind editor events + * @private + * @override + */ + + }, { + key: '_initEditorEvent', + value: function _initEditorEvent() { + var _this3 = this; + + _get(PopupCodeBlockEditor.prototype.__proto__ || Object.getPrototypeOf(PopupCodeBlockEditor.prototype), '_initEditorEvent', this).call(this); + + this.eventManager.listen('openPopupCodeBlockEditor', function (codeBlockElement) { + _this3.eventManager.emit('closeAllPopup'); + _this3.show(codeBlockElement); + + return _this3; + }); + this.eventManager.listen('closeAllPopup', this.hide.bind(this)); + this.eventManager.listen('closePopupCodeBlockEditor', this.hide.bind(this)); + } + }, { + key: '_createCodeBlockEditor', + value: function _createCodeBlockEditor() { + var codeMirrorWrapper = document.createElement('div'); + codeMirrorWrapper.className = CLASS_PREFIX + 'editor-wrapper'; + + this._codeBlockEditor = new _codeBlockEditor2.default(codeMirrorWrapper, this.eventManager); + + return codeMirrorWrapper; + } + }, { + key: '_createPreview', + value: function _createPreview() { + var previewWrapper = document.createElement('div'); + this._codeBlockPreview = new _codeBlockPreview2.default((0, _jquery2.default)(previewWrapper), this.eventManager, this.convertor, this._codeBlockEditor); + + return previewWrapper; + } + }, { + key: '_createCodeBlockLanguagesCombo', + value: function _createCodeBlockLanguagesCombo() { + var _this4 = this; + + var titleElement = this.getTitleElement(); + var codeBlockLanguagesCombo = new _codeBlockLanguagesCombo2.default(this.eventManager); + + codeBlockLanguagesCombo.setOnLanguageSelected(function (selectedLanguage) { + _this4._codeBlockEditor.setLanguage(selectedLanguage); + _this4._codeBlockEditor.refresh(); + _this4._focusEditor(); + }); + + titleElement.innerHTML = 'CodeBlock Editor'; + titleElement.appendChild(codeBlockLanguagesCombo.getElement()); + + return codeBlockLanguagesCombo; + } + }, { + key: '_updateFitWindowButton', + value: function _updateFitWindowButton() { + (0, _jquery2.default)(this._toggleFitButton).toggleClass('active', this.isFitToWindow()); + } + }, { + key: '_updatePreviewButton', + value: function _updatePreviewButton() { + (0, _jquery2.default)(this._togglePreviewButton).toggleClass('active', this._scrollSyncSplit.isSplitView()); + } + }, { + key: '_updateScrollButton', + value: function _updateScrollButton() { + if (this._scrollSyncSplit.isSplitView()) { + this._toggleScrollButton.style.display = 'inline-block'; + } else { + this._toggleScrollButton.style.display = 'none'; + } + (0, _jquery2.default)(this._toggleScrollButton).toggleClass('active', this._scrollSyncSplit.isScrollSynced()); + } + }, { + key: '_focusEditor', + value: function _focusEditor(cursorToEnd) { + this._codeBlockEditor.focus(); + if (cursorToEnd) { + this._codeBlockEditor.moveCursorToEnd(); + } else { + this._codeBlockEditor.moveCursorToStart(); + } + } + }, { + key: '_togglePreview', + value: function _togglePreview() { + this._scrollSyncSplit.toggleSplitView(); + this._updatePreviewButton(); + this._updateScrollButton(); + this._codeBlockEditor.refresh(); + } + }, { + key: '_toggleFitToWindow', + value: function _toggleFitToWindow() { + this.toggleFitToWindow(); + this._updateFitWindowButton(); + this._codeBlockEditor.refresh(); + } + }, { + key: '_toggleScroll', + value: function _toggleScroll() { + this._scrollSyncSplit.toggleScrollSync(); + this._updateScrollButton(); + } + + /** + * store code mirror text to wysiwyg code block + * @private + */ + + }, { + key: '_save', + value: function _save() { + this._codeBlockEditor.save(this._codeBlockElement); + this.hide(); + } + + /** + * load code mirror text from wysiwyg code block + * @param {HTMLElement} codeBlockElement - code block element instance to load code from + * @private + */ + + }, { + key: '_load', + value: function _load(codeBlockElement) { + this._codeBlockElement = codeBlockElement; + this._codeBlockEditor.load(codeBlockElement); + this._codeBlockLanguagesCombo.setLanguage(this._codeBlockEditor.getLanguage()); + this._focusEditor(); + this._codeBlockPreview.refresh(); + } + + /** + * show popup + * @param {HTMLElement} codeBlockElement - code block element + * @override + */ + + }, { + key: 'show', + value: function show(codeBlockElement) { + _get(PopupCodeBlockEditor.prototype.__proto__ || Object.getPrototypeOf(PopupCodeBlockEditor.prototype), 'show', this).call(this); + + if (!codeBlockElement) { + throw new Error('should be called with codeBlockElement'); + } + this._load(codeBlockElement); + } + + /** + * hide popup + * @override + */ + + }, { + key: 'hide', + value: function hide() { + this.setFitToWindow(false); + + if (this._codeBlockEditor) { + this._codeBlockEditor.clear(); + } + if (this._codeBlockPreview) { + this._codeBlockPreview.clear(); + } + this._codeBlockElement = null; + + _get(PopupCodeBlockEditor.prototype.__proto__ || Object.getPrototypeOf(PopupCodeBlockEditor.prototype), 'hide', this).call(this); + } + }]); + + return PopupCodeBlockEditor; +}(_layerpopup2.default); + +exports.default = PopupCodeBlockEditor; + +/***/ }), +/* 109 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * @fileoverview Implements scroll sync split + * @author NHN FE Development Lab + */ + + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CLASS_SPLIT_SCROLL = 'tui-split-scroll'; +var CLASS_SINGLE_CONTENT = 'single-content'; +var CLASS_SCROLL_SYNC = 'scroll-sync'; +var CLASS_SCROLL_WRAPPER = 'tui-split-scroll-wrapper'; +var CLASS_SCROLL_CONTENT = 'tui-split-scroll-content'; +var CLASS_SPLITTER = 'tui-splitter'; +var EVENT_REQUIRE_SCROLL_SYNC = 'requireScrollSync'; +var EVENT_REQUIRE_SCROLL_INTO_VIEW = 'requireScrollIntoView'; +var CLASS_CONTENT_LEFT = 'tui-split-content-left'; +var CLASS_CONTENT_RIGHT = 'tui-split-content-right'; +var CLASS_CONTENT = { + 'left': CLASS_CONTENT_LEFT, + 'right': CLASS_CONTENT_RIGHT +}; + +/** + * Class ScrollSyncSplit + * @param {Element} baseElement - an element which attach a splitSyncSplit + * @param {Element} leftElement - an element to be on left side split view + * @param {Element} rightElement - an element to be on right side split view + * @param {object} options - options + * @param {boolean} [options.showScrollSyncButton=false] - show scroll sync button on top right corner + * @param {boolean} [options.scrollSync=true] - true for enable scroll sync + * @param {boolean} [options.splitView=true] - true for split, false for single view + * @ignore + */ + +var ScrollSyncSplit = function () { + function ScrollSyncSplit(baseElement, leftElement, rightElement) { + var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + + _classCallCheck(this, ScrollSyncSplit); + + options = _tuiCodeSnippet2.default.extend({ + showScrollSyncButton: false, + scrollSync: true, + splitView: true + }, options); + this._baseElement = baseElement; + + /** + * left, right side content elements + * @type {HTMLElement[]} + * @private + */ + this._contentElements = []; + + this._initDom(leftElement, rightElement, options); + this._initDomEvent(); + } + + _createClass(ScrollSyncSplit, [{ + key: '_initDom', + value: function _initDom(leftElement, rightElement, options) { + var el = document.createElement('div'); + el.className = CLASS_SPLIT_SCROLL; + this._el = el; + + var scrollWrapper = document.createElement('div'); + scrollWrapper.className = CLASS_SCROLL_WRAPPER; + this._scrollWrapper = scrollWrapper; + this._setScrollSync(options.scrollSync); + this.setSplitView(options.splitView); + + var contentWrapper = document.createElement('div'); + contentWrapper.className = CLASS_SCROLL_CONTENT; + this._contentWrapper = contentWrapper; + + var splitter = document.createElement('div'); + splitter.className = CLASS_SPLITTER; + + this._baseElement.appendChild(el); + el.appendChild(scrollWrapper); + scrollWrapper.appendChild(contentWrapper); + scrollWrapper.appendChild(splitter); + this._setLeft(leftElement); + this._setRight(rightElement); + } + }, { + key: '_initDomEvent', + value: function _initDomEvent() { + this._contentWrapper.addEventListener('scroll', this.sync.bind(this)); + } + }, { + key: '_requireScrollIntoView', + value: function _requireScrollIntoView(event) { + var element = event.target; + + var _element$getBoundingC = element.getBoundingClientRect(), + targetTop = _element$getBoundingC.top, + targetBottom = _element$getBoundingC.bottom; + + var wrapperTop = void 0, + wrapperBottom = void 0, + wrapperElement = void 0; + + if (this.isScrollSynced()) { + wrapperElement = this._contentWrapper; + } else if ((0, _jquery2.default)(element).parents(this._contentElements.left).length) { + wrapperElement = this._contentElements.left; + } else if ((0, _jquery2.default)(element).parents(this._contentElements.right).length) { + wrapperElement = this._contentElements.right; + } else { + return; + } + + var _wrapperElement$getBo = wrapperElement.getBoundingClientRect(); + + wrapperTop = _wrapperElement$getBo.top; + wrapperBottom = _wrapperElement$getBo.bottom; + + + if (targetTop < wrapperTop) { + wrapperElement.scrollTop = wrapperElement.scrollTop + targetTop - wrapperTop; + } else if (targetBottom > wrapperBottom) { + wrapperElement.scrollTop = wrapperElement.scrollTop + targetBottom - wrapperBottom; + } + + this.sync(); + } + + /** + * set content element for given side + * @param {Element} element - content element + * @param {string} side - 'left' | 'right' + * @private + */ + + }, { + key: '_setContentElement', + value: function _setContentElement(element, side) { + var _this = this; + + var contentElement = this._contentElements[side]; + + if (contentElement) { + (0, _jquery2.default)(contentElement).off(EVENT_REQUIRE_SCROLL_INTO_VIEW); + this._contentWrapper.removeChild(contentElement); + } + (0, _jquery2.default)(element).addClass(CLASS_CONTENT[side]); + this._contentWrapper.appendChild(element); + (0, _jquery2.default)(element).on(EVENT_REQUIRE_SCROLL_INTO_VIEW, function (ev) { + return _this._requireScrollIntoView(ev); + }); + (0, _jquery2.default)(element).on(EVENT_REQUIRE_SCROLL_SYNC, function () { + return _this.sync(); + }); + + this._contentElements[side] = element; + + this.sync(); + } + + /** + * set left side element + * @param {Element} element - an element to be on left side split view + * @private + */ + + }, { + key: '_setLeft', + value: function _setLeft(element) { + this._setContentElement(element, 'left'); + } + + /** + * set right side element + * @param {Element} element - an element to be on right side split view + * @private + */ + + }, { + key: '_setRight', + value: function _setRight(element) { + this._setContentElement(element, 'right'); + } + }, { + key: '_setScrollSync', + value: function _setScrollSync(activate) { + (0, _jquery2.default)(this._el).toggleClass(CLASS_SCROLL_SYNC, activate); + } + + /** + * toggle multi scroll + */ + + }, { + key: 'toggleScrollSync', + value: function toggleScrollSync() { + (0, _jquery2.default)(this._el).toggleClass(CLASS_SCROLL_SYNC); + } + }, { + key: 'setSplitView', + value: function setSplitView(activate) { + (0, _jquery2.default)(this._el).toggleClass(CLASS_SINGLE_CONTENT, !activate); + } + + /** + * toggle split + */ + + }, { + key: 'toggleSplitView', + value: function toggleSplitView() { + (0, _jquery2.default)(this._el).toggleClass(CLASS_SINGLE_CONTENT); + } + + /** + * is scroll synced + * @returns {boolean} - true for synced, false for each scroll + */ + + }, { + key: 'isScrollSynced', + value: function isScrollSynced() { + return (0, _jquery2.default)(this._el).hasClass(CLASS_SCROLL_SYNC); + } + + /** + * is split view + * @returns {boolean} - true for split view, false for single view + */ + + }, { + key: 'isSplitView', + value: function isSplitView() { + return !(0, _jquery2.default)(this._el).hasClass(CLASS_SINGLE_CONTENT); + } + + /** + * sync scroll + */ + + }, { + key: 'sync', + value: function sync() { + if (!this._contentElements.left || !this._contentElements.right) { + return; + } + + var wrapperHeight = this._contentWrapper.clientHeight; + var scrollTop = this._contentWrapper.scrollTop; + + var leftElement = this._contentElements.left; + var rightElement = this._contentElements.right; + + var scrollingElement = leftElement.offsetHeight - wrapperHeight > 0 ? leftElement : rightElement; + var followingElement = scrollingElement === leftElement ? rightElement : leftElement; + + var scrollingElementHeight = scrollingElement.offsetHeight; + var scrollingElementScrollMax = Math.max(scrollingElementHeight - wrapperHeight, 0); + var followingElementHeight = Math.max(followingElement.offsetHeight, wrapperHeight); + var followingElementTopMax = scrollingElementHeight - followingElementHeight; + + scrollingElement.style.top = '0px'; + followingElement.style.top = scrollTop / scrollingElementScrollMax * followingElementTopMax + 'px'; + } + + /** + * scroll top + * @param {number} top - scroll top in pixel + */ + + }, { + key: 'scrollTop', + value: function scrollTop(top) { + this._contentWrapper.scrollTop = top; + } + }]); + + return ScrollSyncSplit; +}(); + +exports.default = ScrollSyncSplit; + +/***/ }), +/* 110 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _codeMirrorExt = __webpack_require__(32); + +var _codeMirrorExt2 = _interopRequireDefault(_codeMirrorExt); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview Implements code block editor + * @author NHN FE Development Lab + */ + + +var EVENT_LANGUAGE_CHANGED = 'language-changed'; + +/** + * Class Code Block Editor + * @param {HTMLElement} el - code block editor container element + * @param {EventManager} eventManager - event manager + * @ignore + */ + +var CodeBlockEditor = function (_CodeMirrorExt) { + _inherits(CodeBlockEditor, _CodeMirrorExt); + + function CodeBlockEditor(el, eventManager) { + _classCallCheck(this, CodeBlockEditor); + + var _this = _possibleConstructorReturn(this, (CodeBlockEditor.__proto__ || Object.getPrototypeOf(CodeBlockEditor)).call(this, el, { + singleCursorHeightPerLine: false, + theme: 'none' + })); + + _this._language = ''; + _this._eventManager = eventManager; + + _this._initEvent(); + return _this; + } + + _createClass(CodeBlockEditor, [{ + key: '_initEvent', + value: function _initEvent() { + var _this2 = this; + + this.on('cursorActivity', this._onRequireScrollIntoView.bind(this)); + this.on('beforeChange', function (cm, ev) { + if (ev.origin === 'paste') { + _this2._eventManager.emit('pasteBefore', { + source: 'codeblock', + data: ev + }); + } + }); + } + }, { + key: '_onRequireScrollIntoView', + value: function _onRequireScrollIntoView() { + var cursor = this.getCursor(); + var wrapper = this.getWrapperElement(); + + // CodeMirror cursorActivity event fires before actually attach a new line element to DOM + // we should proceed at next tick + setTimeout(function () { + var lineElement = wrapper.querySelector('pre:nth-child(' + (cursor.line + 1) + ')'); + (0, _jquery2.default)(lineElement).trigger('requireScrollIntoView'); + }, 0); + } + + /** + * load code from code block element + * @param {HTMLElement} codeBlockElement - code block element + */ + + }, { + key: 'load', + value: function load(codeBlockElement) { + var el = codeBlockElement.cloneNode(true); + this.setLanguage(el.getAttribute('data-language') || ''); + this.setEditorCodeText(el.textContent); + } + + /** + * save code to code block element + * @param {HTMLElement} codeBlockElement - code block element + */ + + }, { + key: 'save', + value: function save(codeBlockElement) { + codeBlockElement.innerHTML = ''; + codeBlockElement.textContent = this.getEditorCodeText(); + codeBlockElement.setAttribute('data-language', this._language); + (0, _jquery2.default)(codeBlockElement).trigger(EVENT_LANGUAGE_CHANGED); + } + + /** + * clear code and language + */ + + }, { + key: 'clear', + value: function clear() { + this.setLanguage(''); + this.setEditorCodeText(''); + } + + /** + * get code language + * @returns {string} - code language + */ + + }, { + key: 'getLanguage', + value: function getLanguage() { + return this._language; + } + + /** + * set code language + * @param {string} [language=''] - code language + */ + + }, { + key: 'setLanguage', + value: function setLanguage() { + var language = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + this._language = language; + } + + /** + * get code text + * @returns {string} - code text + */ + + }, { + key: 'getEditorCodeText', + value: function getEditorCodeText() { + return this.getValue(); + } + + /** + * set code text + * @param {string} [code=''] - code text + */ + + }, { + key: 'setEditorCodeText', + value: function setEditorCodeText() { + var code = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + this.setValue(code); + } + + /** + * refresh. call if codemirror resized + */ + + }, { + key: 'refresh', + value: function refresh() { + this.cm.refresh(); + } + }]); + + return CodeBlockEditor; +}(_codeMirrorExt2.default); + +exports.default = CodeBlockEditor; + +/***/ }), +/* 111 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +var _preview = __webpack_require__(35); + +var _preview2 = _interopRequireDefault(_preview); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * @fileoverview Implements CodeBlockPreview + * @author NHN FE Development Lab + */ + + +var EVENT_REQUIRE_SCROLL_SYNC = 'requireScrollSync'; + +/** + * Class Code block preview + * @param {jQuery} $el - base element + * @param {EventManager} eventManager - event manager + * @param {Convertor} convertor - convertor + * @param {CodeBlockEditor} codeBlockEditor - code block editor + * @ignore + */ + +var CodeBlockPreview = function (_Preview) { + _inherits(CodeBlockPreview, _Preview); + + function CodeBlockPreview($el, eventManager, convertor, codeBlockEditor) { + _classCallCheck(this, CodeBlockPreview); + + var _this = _possibleConstructorReturn(this, (CodeBlockPreview.__proto__ || Object.getPrototypeOf(CodeBlockPreview)).call(this, $el, eventManager, convertor, true)); + + _this._codeBlockEditor = codeBlockEditor; + + _this._initEvent(); + return _this; + } + + _createClass(CodeBlockPreview, [{ + key: '_initEvent', + value: function _initEvent() { + var _this2 = this; + + this._codeBlockEditor.on('update', function () { + return _this2.lazyRunner.run('refresh'); + }); + } + + /** + * refresh preview + * @override + */ + + }, { + key: 'refresh', + value: function refresh() { + var language = this._codeBlockEditor.getLanguage(); + var codeText = this._codeBlockEditor.getEditorCodeText(); + + _get(CodeBlockPreview.prototype.__proto__ || Object.getPrototypeOf(CodeBlockPreview.prototype), 'refresh', this).call(this, '```' + language + '\n' + codeText + '\n```'); + this.$el.trigger(EVENT_REQUIRE_SCROLL_SYNC); + } + + /** + * clear preview + */ + + }, { + key: 'clear', + value: function clear() { + _get(CodeBlockPreview.prototype.__proto__ || Object.getPrototypeOf(CodeBlockPreview.prototype), 'render', this).call(this, ''); + } + }]); + + return CodeBlockPreview; +}(_preview2.default); + +exports.default = CodeBlockPreview; + +/***/ }), +/* 112 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * @fileoverview Implements UI code block languages combo + * @author NHN FE Development Lab + */ + + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _keyMapper = __webpack_require__(22); + +var _keyMapper2 = _interopRequireDefault(_keyMapper); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * Class CodeBlockLanguagesCombo + * @param {EventManager} eventManager - event manager instance + * @ignore + */ +var CodeBlockLanguagesCombo = function () { + function CodeBlockLanguagesCombo(eventManager) { + _classCallCheck(this, CodeBlockLanguagesCombo); + + this._eventManager = eventManager; + + this._initDOM(); + this._initDOMEvent(); + } + + _createClass(CodeBlockLanguagesCombo, [{ + key: '_initDOM', + value: function _initDOM() { + this._inputLanguage = (0, _jquery2.default)('').get(0); + this._wrapper = (0, _jquery2.default)('').get(0); + this._wrapper.appendChild(this._inputLanguage); + } + }, { + key: '_initDOMEvent', + value: function _initDOMEvent() { + var _this = this; + + this._inputLanguage.addEventListener('keydown', function (event) { + return _this._onKeyEvent(event); + }); + this._inputLanguage.addEventListener('focus', function () { + return _this._showPopupCodeBlockLanguages(); + }); + this._inputLanguage.addEventListener('focusout', function () { + return _this._onFocusOut(); + }); + this._wrapper.addEventListener('mousedown', function (ev) { + if (ev.target !== _this._wrapper) { + return; + } + ev.preventDefault(); + _this._toggleFocus(); + }); + } + + /** + * show popup + * @private + */ + + }, { + key: '_showPopupCodeBlockLanguages', + value: function _showPopupCodeBlockLanguages() { + var _this2 = this; + + var clientRect = this._inputLanguage.getBoundingClientRect(); + (0, _jquery2.default)(this._wrapper).toggleClass('active', true); + this.active = true; + + this._popupCodeBlockLanguages = this._eventManager.emitReduce('openPopupCodeBlockLanguages', { + language: this._prevStoredLanguage, + offset: { + left: clientRect.left, + top: clientRect.bottom + }, + callback: { + selected: function selected(selectedLanguage) { + return _this2._onLanguageSelectedFromList(selectedLanguage); + }, + dismissed: function dismissed() { + _this2._popupCodeBlockLanguages = null; + } + } + }); + } + }, { + key: '_toggleFocus', + value: function _toggleFocus() { + var inputLanguage = this._inputLanguage; + if ((0, _jquery2.default)(this._wrapper).hasClass('active')) { + inputLanguage.blur(); + } else { + inputLanguage.focus(); + } + } + }, { + key: '_onFocusOut', + value: function _onFocusOut() { + (0, _jquery2.default)(this._wrapper).toggleClass('active', false); + this._inputLanguage.value = this._prevStoredLanguage; + this._hidePopupCodeBlockLanguages(); + } + }, { + key: '_onKeyEvent', + value: function _onKeyEvent(event) { + if (this._popupCodeBlockLanguages) { + switch (event.which) { + case _keyMapper2.default.keyCode('UP'): + this._popupCodeBlockLanguages.prev(); + event.preventDefault(); + break; + case _keyMapper2.default.keyCode('DOWN'): + this._popupCodeBlockLanguages.next(); + event.preventDefault(); + break; + case _keyMapper2.default.keyCode('ENTER'): + case _keyMapper2.default.keyCode('TAB'): + { + var language = this._popupCodeBlockLanguages.getCurrentLanguage(); + this._inputLanguage.value = language; + this._storeInputLanguage(); + event.preventDefault(); + break; + } + default: + this._popupCodeBlockLanguages.hide(); + } + } else if (event.which === _keyMapper2.default.keyCode('ENTER') || event.which === _keyMapper2.default.keyCode('TAB')) { + this._storeInputLanguage(); + event.preventDefault(); + } + } + }, { + key: '_onLanguageSelectedFromList', + value: function _onLanguageSelectedFromList(selectedLanguage) { + this._inputLanguage.value = selectedLanguage; + this._storeInputLanguage(); + } + + /** + * set a callback to be called on language selected + * @param {function} callback - callback function + * @protected + */ + + }, { + key: 'setOnLanguageSelected', + value: function setOnLanguageSelected(callback) { + this._onLanguageSelected = callback; + } + + /** + * hide popup + * @private + */ + + }, { + key: '_hidePopupCodeBlockLanguages', + value: function _hidePopupCodeBlockLanguages() { + this._eventManager.emit('closePopupCodeBlockLanguages'); + } + + /** + * set language + * @param {string} language - code block language + * @protected + */ + + }, { + key: 'setLanguage', + value: function setLanguage(language) { + this._prevStoredLanguage = language; + this._inputLanguage.value = language; + } + + /** + * store selection(typed) language & hide popup + * @private + */ + + }, { + key: '_storeInputLanguage', + value: function _storeInputLanguage() { + var selectedLanguage = this._inputLanguage.value; + + this.setLanguage(selectedLanguage); + if (this._onLanguageSelected) { + this._onLanguageSelected(selectedLanguage); + } + + this._hidePopupCodeBlockLanguages(); + } + + /** + * get element body + * @returns {HTMLElement} - CodeBlockLanguagesCombo body element + * @protected + */ + + }, { + key: 'getElement', + value: function getElement() { + return this._wrapper; + } + }]); + + return CodeBlockLanguagesCombo; +}(); + +exports.default = CodeBlockLanguagesCombo; + +/***/ }), +/* 113 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _toMark = __webpack_require__(24); + +var _toMark2 = _interopRequireDefault(_toMark); + +var _domUtils = __webpack_require__(4); + +var _domUtils2 = _interopRequireDefault(_domUtils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Check if given node is valid delimiter run. + * According to common-mark spec, following examples are not valid delimiter runs. + * 1. opening (*|**) preceded by an alphanumeric and followed by a punctuation. + * (ex: a**~~c~~b**) + * 2. closing (*|**) preceded by a punctuation and followed by an alphanumeric. + * (ex: **b~~c~~**a) + * @see {@link https://spec.commonmark.org/0.29/#delimiter-run} + * @see {@link https://github.com/commonmark/commonmark-spec/issues/611#issuecomment-533578503} + */ +function isValidDelimiterRun(node) { + var isElemNode = _domUtils2.default.isElemNode, + isTextNode = _domUtils2.default.isTextNode; + + var isInvalidOpener = isTextNode(node.previousSibling) && isElemNode(node.firstChild); + var isInvalidCloser = isTextNode(node.nextSibling) && isElemNode(node.lastChild); + + return !isInvalidOpener && !isInvalidCloser; +} + +function convertEmphasis(node, subContent, delimiter) { + var FIND_BEFORE_AND_AFTER_SPACES_RX = /^(\s*)((?:.|\n)*\S)(\s*)$/m; + + var _subContent$match = subContent.match(FIND_BEFORE_AND_AFTER_SPACES_RX), + beforeSpaces = _subContent$match[1], + trimmedContent = _subContent$match[2], + afterSpaces = _subContent$match[3]; + + var convertedContent = void 0; + + if (isValidDelimiterRun(node)) { + convertedContent = '' + delimiter + trimmedContent + delimiter; + } else { + var tagName = node.nodeName.toLowerCase(); + + convertedContent = '<' + tagName + '>' + trimmedContent + ''; + } + + return '' + beforeSpaces + convertedContent + afterSpaces; +} + +exports.default = _toMark2.default.Renderer.factory(_toMark2.default.gfmRenderer, { + 'EM, I': function EMI(node, subContent) { + if (this.isEmptyText(subContent)) { + return ''; + } + + return convertEmphasis(node, subContent, '*'); + }, + 'STRONG, B': function STRONGB(node, subContent) { + if (this.isEmptyText(subContent)) { + return ''; + } + + return convertEmphasis(node, subContent, '**'); + }, + 'DEL, S': function DELS(node, subContent) { + if (this.isEmptyText(subContent)) { + return ''; + } + + return convertEmphasis(node, subContent, '~~'); + } +}); + +/***/ }), +/* 114 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _emphasisCommon = __webpack_require__(26); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** +* @fileoverview Implements Bold markdown command +* @author NHN FE Development Lab +*/ +var boldRangeRegex = /^(\*{2}|_{2}).*\1$/; +var boldContentRegex = /[*_]{2,}([^*_]*)[*_]{2,}/g; +var boldSymbol = '**'; + +/** + * Bold + * Add bold markdown syntax to markdown editor + * @extends Command + * @module markdownCommands/Bold + * @ignore + */ +var Bold = _commandManager2.default.command('markdown', /** @lends Bold */{ + name: 'Bold', + keyMap: ['CTRL+B', 'META+B'], + /** + * Command Handler + * @param {MarkdownEditor} mde MarkdownEditor instance + */ + exec: function exec(mde) { + var cm = mde.getEditor(); + var doc = cm.getDoc(); + var originRange = mde.getRange(); + + (0, _emphasisCommon.changeSyntax)(doc, originRange, boldSymbol, boldRangeRegex, boldContentRegex); + + cm.focus(); + } +}); + +exports.default = Bold; + +/***/ }), +/* 115 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _emphasisCommon = __webpack_require__(26); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @fileoverview Implements Italic markdown command + * @author NHN FE Development Lab + */ +var boldItalicRangeRegex = /^(\*{3}|_{3}).*\1$/; +var boldRangeRegex = /^(\*{2}|_{2}).*\1$/; +var italicRangeRegex = /^(\*|_).*\1$/; +var italicContentRegex = /([^*_])[*_]([^*_]+)[*_]([^*_])/g; + +var isBoldItalic = function isBoldItalic(t) { + return boldItalicRangeRegex.test(t); +}; +var isBold = function isBold(t) { + return boldRangeRegex.test(t); +}; +var isItalic = function isItalic(t) { + return italicRangeRegex.test(t); +}; + +var italicSymbol = '*'; +var boldSymbol = '**'; +var boldItalicSymbol = '***'; +var italicLength = italicSymbol.length; +var boldLength = boldSymbol.length; +var boldItalicLength = boldItalicSymbol.length; + +/** + * remove italic syntax in the middle of given text + * @param {string} text - text selected + * @returns {string} - text eliminated all italic in the middle of it's content + * @ignore + */ +var removeItalicInsideText = function removeItalicInsideText(text) { + return text ? text.replace(italicContentRegex, '$1$2$3') : ''; +}; + +var replaceText = function replaceText(doc, text, range) { + // Check 3 cases when both text and expand text + // case 1 : bold & italic (when expand 3 both front and end) => remove italic + // case 2 : bold (when expand 2 both front and end) => append + // case 3 : italic (expand 1 both front and end) => remove + var expandReplaceBind = _emphasisCommon.expandReplace.bind(this, doc, range); + + return expandReplaceBind(boldItalicLength, isBoldItalic, function (t) { + return (0, _emphasisCommon.removeSyntax)(t, italicSymbol); + }) || expandReplaceBind(boldLength, isBold, function (t) { + return (0, _emphasisCommon.appendSyntax)(removeItalicInsideText(t), italicSymbol); + }) || expandReplaceBind(italicLength, isItalic, function (t) { + return (0, _emphasisCommon.removeSyntax)(t, italicSymbol); + }) || (0, _emphasisCommon.replace)(doc, text, isBoldItalic, function (t) { + return (0, _emphasisCommon.removeSyntax)(t, italicSymbol); + }) || (0, _emphasisCommon.replace)(doc, text, isBold, function (t) { + return (0, _emphasisCommon.appendSyntax)(removeItalicInsideText(t), italicSymbol); + }) || (0, _emphasisCommon.replace)(doc, text, isItalic, function (t) { + return (0, _emphasisCommon.removeSyntax)(t, italicSymbol); + }); +}; + +var replaceEmptyText = function replaceEmptyText(doc, range) { + // Check 3 cases when expand text + // case 1 : bold & italic => remove italic + // case 2 : bold => append + // case 3 : italic => remove + // if there is no match, make italic + return (0, _emphasisCommon.expandReplace)(doc, range, boldItalicLength, isBoldItalic, function (t) { + return (0, _emphasisCommon.removeSyntax)(t, italicSymbol); + }) || (0, _emphasisCommon.expandReplace)(doc, range, boldLength, isBold, function (t) { + return (0, _emphasisCommon.appendSyntax)(t, italicSymbol); + }) || (0, _emphasisCommon.expandReplace)(doc, range, italicLength, isItalic, function () { + return ''; + }) || doc.replaceSelection('' + italicSymbol + italicSymbol, 'around'); +}; + +/** + * Italic + * Add italic markdown syntax to markdown editor + * @extends Command + * @module markdownCommands/Italic + * @ignore + */ +var Italic = _commandManager2.default.command('markdown', /** @lends Italic */{ + name: 'Italic', + keyMap: ['CTRL+I', 'META+I'], + /** + * Command handler + * @param {MarkdownEditor} mde MarkdownEditor instance + */ + exec: function exec(mde) { + var cm = mde.getEditor(); + var doc = cm.getDoc(); + + var _doc$getCursor = doc.getCursor(), + line = _doc$getCursor.line, + ch = _doc$getCursor.ch; + + var range = mde.getRange(); + var selectionStr = doc.getSelection(); + + if (selectionStr) { + // check selectionStr match bold & italic, bold, italic and then + // if there is no match, append italic + if (!replaceText(doc, selectionStr, range)) { + // Before append italic, remove italic inside text and then append italic + // Example: One*Two*Three => *OneTwoThree* + doc.replaceSelection((0, _emphasisCommon.appendSyntax)(removeItalicInsideText(selectionStr), italicSymbol), 'around'); + } + } else { + replaceEmptyText(doc, range); + + var afterSelectStr = doc.getSelection(); + var size = ch; + + // If text was not selected, after replace text, move cursor + if (isBoldItalic(afterSelectStr) || isItalic(afterSelectStr) && !isBold(afterSelectStr)) { + // For example **|** => ***|*** (move cusor +symbolLenth) + size += italicLength; + } else { + // For example *|* => | (move cusor -symbolLenth) + size -= italicLength; + } + + doc.setCursor(line, size); + } + + cm.focus(); + } +}); + +exports.default = Italic; + +/***/ }), +/* 116 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _emphasisCommon = __webpack_require__(26); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @fileoverview Implements StrikeThrough markdown command + * @author NHN FE Development Lab + */ +var strikeRangeRegex = /^~~.*~~$/; +var strikeContentRegex = /~~([^~]*)~~/g; +var strikeSymbol = '~~'; + +/** + * Strike + * Add strike markdown syntax to markdown editor + * @extends Command + * @module markdownCommands/Strike + * @ignore + */ +var Strike = _commandManager2.default.command('markdown', /** @lends Strike */{ + name: 'Strike', + keyMap: ['CTRL+S', 'META+S'], + /** + * Command handler + * @param {MarkdownEditor} mde MarkdownEditor instance + */ + exec: function exec(mde) { + var cm = mde.getEditor(); + var doc = cm.getDoc(); + var originRange = mde.getRange(); + + (0, _emphasisCommon.changeSyntax)(doc, originRange, strikeSymbol, strikeRangeRegex, strikeContentRegex); + + cm.focus(); + } +}); + +exports.default = Strike; + +/***/ }), +/* 117 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var BlockquoteRegex = /^> ?/; + +/** + * Blockquote + * Add blockquote markdown syntax to markdown editor + * @extends Command + * @module markdownCommands/Blockquote + * @ignore + */ +/** +* @fileoverview Implements Blockquote markdown command +* @author NHN FE Development Lab +*/ +var Blockquote = _commandManager2.default.command('markdown', /** @lends Blockquote */{ + name: 'Blockquote', + keyMap: ['ALT+Q', 'ALT+Q'], + /** + * command handler + * @param {MarkdownEditor} mde MarkdownEditor instance + */ + exec: function exec(mde) { + var cm = mde.getEditor(); + var doc = cm.getDoc(); + + var range = mde.getCurrentRange(); + + var from = { + line: range.from.line, + ch: 0 + }; + + var to = { + line: range.to.line, + ch: doc.getLineHandle(range.to.line).text.length + }; + + var textToModify = doc.getRange(from, to); + var textLinesToModify = textToModify.split('\n'); + var isNeedToRemove = this._haveBlockquote(textLinesToModify); + var resultText = void 0; + + if (isNeedToRemove) { + resultText = this._removeBlockquote(textLinesToModify); + } else { + resultText = this._addBlockquote(textLinesToModify); + } + + doc.replaceRange(resultText.join('\n'), from, to); + + if (isNeedToRemove) { + var length = textLinesToModify.length; + if (this._isBlockquoteWithSpace(textLinesToModify[length - 1])) { + range.to.ch -= 2; + } else { + range.to.ch -= 1; + } + } else { + range.to.ch += 2; + } + + doc.setCursor(range.to); + + cm.focus(); + }, + + + /** + * check all text in textArr starts with '>' + * @param {Array} textArr - text array + * @returns {boolean} - true if all text in textArr starts with '>' + * @private + */ + _haveBlockquote: function _haveBlockquote(textArr) { + for (var i = 0; i < textArr.length; i += 1) { + if (!BlockquoteRegex.test(textArr[i])) { + return false; + } + } + + return true; + }, + + + /** + * add '> ' to all text in textArr + * @param {Array} textArr - text array + * @returns {Array} - new text array added '> ' + * @private + */ + _addBlockquote: function _addBlockquote(textArr) { + return textArr.map(function (text) { + return '> ' + text; + }); + }, + + + /** + * remove '> ' or '>' to all text in textArr + * @param {Array} textArr - text array + * @returns {Array} - new text array removed '> ' or '>' + * @private + */ + _removeBlockquote: function _removeBlockquote(textArr) { + return textArr.map(function (text) { + return text.replace(BlockquoteRegex, ''); + }); + }, + + + /** + * check text start '> ' + * @param {string} text - text + * @returns {boolean} - if text start '> ', true + * @private + */ + _isBlockquoteWithSpace: function _isBlockquoteWithSpace(text) { + return (/^> /.test(text) + ); + } +}); + +exports.default = Blockquote; + +/***/ }), +/* 118 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @fileoverview Implements Heading markdown command + * @author NHN FE Development Lab + */ +var FIND_HEADING_RX = /^#+\s/g; + +/** + * Heading + * Add heading markdown syntax to markdown editor + * @extends Command + * @module markdownCommands/Heading + * @ignore + */ +var Heading = _commandManager2.default.command('markdown', /** @lends Heading */{ + name: 'Heading', + /** + * Command Handler + * @param {MarkdownEditor} mde MarkdownEditor instance + * @param {number} size heading size + */ + exec: function exec(mde, size) { + var cm = mde.getEditor(); + var doc = cm.getDoc(); + + var range = mde.getCurrentRange(); + + var from = { + line: range.from.line, + ch: 0 + }; + + var to = { + line: range.to.line, + ch: doc.getLineHandle(range.to.line).text.length + }; + + var lengthOfCurrentLineBefore = doc.getLine(to.line).length; + var textToModify = doc.getRange(from, to); + var textLinesToModify = textToModify.split('\n'); + + _tuiCodeSnippet2.default.forEachArray(textLinesToModify, function (line, index) { + textLinesToModify[index] = getHeadingMarkdown(line, size); + }); + + doc.replaceRange(textLinesToModify.join('\n'), from, to); + + range.to.ch += doc.getLine(to.line).length - lengthOfCurrentLineBefore; + + doc.setSelection(from, range.to); + + cm.focus(); + } +}); + +/** + * Get heading markdown + * @param {string} text Source test + * @param {number} size size + * @returns {string} + */ +function getHeadingMarkdown(text, size) { + var foundedHeading = text.match(FIND_HEADING_RX); + var heading = ''; + + do { + heading += '#'; + size -= 1; + } while (size > 0); + + if (foundedHeading) { + var _text$split = text.split(foundedHeading[0]); + + text = _text$split[1]; + } + + return heading + ' ' + text; +} + +exports.default = Heading; + +/***/ }), +/* 119 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Paragraph + * Convert selected lines to paragraph + * @extends Command + * @module markdownCommands/Paragraph + * @ignore + */ +/** + * @fileoverview Implements Paragraph markdown command + * @author NHN FE Development Lab + */ +var Paragraph = _commandManager2.default.command('markdown', /** @lends Paragraph */{ + name: 'Paragraph', + /** + * Command Handler + * @param {MarkdownEditor} mde MarkdownEditor instance + */ + exec: function exec(mde) { + var cm = mde.getEditor(); + var doc = cm.getDoc(); + var range = mde.getCurrentRange(); + var from = { + line: range.from.line, + ch: 0 + }; + var to = { + line: range.to.line, + ch: doc.getLineHandle(range.to.line).text.length + }; + + var lengthOfCurrentLineBefore = doc.getLine(to.line).length; + var textToModify = doc.getRange(from, to); + var textLines = textToModify.split('\n'); + + _tuiCodeSnippet2.default.forEachArray(textLines, function (line, index) { + textLines[index] = getParagraphMarkdown(line); + }); + + doc.replaceRange(textLines.join('\n'), from, to); + + range.to.ch += doc.getLine(to.line).length - lengthOfCurrentLineBefore; + + doc.setSelection(from, to); + + cm.focus(); + } +}); +/** + * Get paragraph markdown lineText + * @param {string} lineText line lineText + * @returns {string} + */ +function getParagraphMarkdown(lineText) { + var headingRx = /^(#{1,6}| *((?:\*|-|\d\.)(?: \[[ xX]])?)) /; + + return lineText.replace(headingRx, ''); +} + +exports.default = Paragraph; + +/***/ }), +/* 120 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * HR + * Add HR markdown syntax to markdown editor + * @extends Command + * @module markdownCommands/HR + * @ignore + */ +var HR = _commandManager2.default.command('markdown', /** @lends HR */{ + name: 'HR', + keyMap: ['CTRL+L', 'META+L'], + /** + * Command handler + * @param {MarkdownEditor} mde MarkdownEditor instance + */ + exec: function exec(mde) { + var cm = mde.getEditor(); + var doc = cm.getDoc(); + var replaceText = ''; + + var range = mde.getCurrentRange(); + + var from = { + line: range.from.line, + ch: range.from.ch + }; + + var to = { + line: range.to.line, + ch: range.to.ch + }; + + if (range.collapsed) { + replaceText = doc.getLine(from.line); + from.ch = 0; + to.ch = doc.getLineHandle(range.to.line).text.length; + } + + if (doc.getLine(from.line).length) { + replaceText += '\n\n* * *\n\n'; + } else { + replaceText += '\n* * *\n'; + } + + doc.replaceRange(replaceText, from, to); + + cm.focus(); + } +}); /** + * @fileoverview Implements HR markdown command + * @author NHN FE Development Lab + */ + +exports.default = HR; + +/***/ }), +/* 121 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _importManager = __webpack_require__(15); + +var _importManager2 = _interopRequireDefault(_importManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** +* @fileoverview Implements Addlink markdown command +* @author NHN FE Development Lab +*/ +var decodeURIGraceful = _importManager2.default.decodeURIGraceful, + encodeMarkdownCharacters = _importManager2.default.encodeMarkdownCharacters, + escapeMarkdownCharacters = _importManager2.default.escapeMarkdownCharacters; + +/** + * AddLink + * Add link markdown syntax to markdown editor + * @extends Command + * @module markdownCommands/AddLink + * @ignore + */ + +var AddLink = _commandManager2.default.command('markdown', /** @lends AddLink */{ + name: 'AddLink', + /** + * command handler for AddLink + * @param {MarkdownEditor} mde - MarkdownEditor instance + * @param {object} data - data for image + */ + exec: function exec(mde, data) { + var cm = mde.getEditor(); + var doc = cm.getDoc(); + + var range = mde.getCurrentRange(); + + var from = { + line: range.from.line, + ch: range.from.ch + }; + + var to = { + line: range.to.line, + ch: range.to.ch + }; + + var linkText = data.linkText, + url = data.url; + + linkText = decodeURIGraceful(linkText); + linkText = escapeMarkdownCharacters(linkText); + url = encodeMarkdownCharacters(url); + + var replaceText = '[' + linkText + '](' + url + ')'; + + doc.replaceRange(replaceText, from, to); + + cm.focus(); + } +}); + +exports.default = AddLink; + +/***/ }), +/* 122 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _importManager = __webpack_require__(15); + +var _importManager2 = _interopRequireDefault(_importManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** +* @fileoverview Implments AddImage markdown command +* @author NHN FE Development Lab +*/ +var decodeURIGraceful = _importManager2.default.decodeURIGraceful, + encodeMarkdownCharacters = _importManager2.default.encodeMarkdownCharacters, + escapeMarkdownCharacters = _importManager2.default.escapeMarkdownCharacters; + +/** + * AddImage + * Add Image markdown syntax to markdown Editor + * @extends Command + * @module markdownCommands/AddImage + * @ignore + */ + +var AddImage = _commandManager2.default.command('markdown', /** @lends AddImage */{ + name: 'AddImage', + /** + * Command Handler + * @param {MarkdownEditor} mde MarkdownEditor instance + * @param {object} data data for image + */ + exec: function exec(mde, data) { + var cm = mde.getEditor(); + var doc = cm.getDoc(); + + var range = mde.getCurrentRange(); + + var from = { + line: range.from.line, + ch: range.from.ch + }; + + var to = { + line: range.to.line, + ch: range.to.ch + }; + + var altText = data.altText, + imageUrl = data.imageUrl; + + altText = decodeURIGraceful(altText); + altText = escapeMarkdownCharacters(altText); + imageUrl = encodeMarkdownCharacters(imageUrl); + var replaceText = '![' + altText + '](' + imageUrl + ')'; + + doc.replaceRange(replaceText, from, to, '+addImage'); + + cm.focus(); + } +}); + +exports.default = AddImage; + +/***/ }), +/* 123 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * UL + * Add unordered list markdown syntax to markdown editor + * @extends Command + * @module markdownCommands/UL + * @ignore + */ +var UL = _commandManager2.default.command('markdown', /** @lends UL */{ + name: 'UL', + keyMap: ['CTRL+U', 'META+U'], + /** + * Command handler + * @param {MarkdownEditor} mde MarkdownEditor instance + */ + exec: function exec(mde) { + var range = mde.getCurrentRange(); + var listManager = mde.componentManager.getManager('list'); + + listManager.changeSyntax(range, 'ul'); + } +}); /** + * @fileoverview Implements UL markdown command + * @author NHN FE Development Lab + */ +exports.default = UL; + +/***/ }), +/* 124 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * OL + * Add ordered list markdown syntax to markdown editor + * @extends Command + * @module markdownCommands/OL + * @ignore + */ +var OL = _commandManager2.default.command('markdown', /** @lends OL */{ + name: 'OL', + keyMap: ['CTRL+O', 'META+O'], + /** + * Command handler + * @param {MarkdownEditor} mde MarkdownEditor instance + */ + exec: function exec(mde) { + var range = mde.getCurrentRange(); + var listManager = mde.componentManager.getManager('list'); + + listManager.changeSyntax(range, 'ol'); + } +}); /** + * @fileoverview Implements OL markdown command + * @author NHN FE Development Lab + */ + +exports.default = OL; + +/***/ }), +/* 125 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Indent + * Add Indent markdown syntax to markdown editor + * @extends Command + * @module markdownCommands/inent + * @ignore + */ +var Indent = _commandManager2.default.command('markdown', /** @lends Indent */{ + name: 'Indent', + /** + * Command handler + * @param {MarkdownEditor} mde MarkdownEditor instance + */ + exec: function exec(mde) { + var cm = mde.getEditor(); + cm.execCommand('indentOrderedList'); + } +}); /** + * @fileoverview Implements Indent markdown command + * @author NHN FE Development Lab + */ + +exports.default = Indent; + +/***/ }), +/* 126 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Outdent + * Add Outdent markdown syntax to markdown editor + * @extends Command + * @module markdownCommands/outdent + * @ignore + */ +var Outdent = _commandManager2.default.command('markdown', /** @lends Outdent */{ + name: 'Outdent', + /** + * Command handler + * @param {MarkdownEditor} mde MarkdownEditor instance + */ + exec: function exec(mde) { + var cm = mde.getEditor(); + cm.execCommand('indentLessOrderedList'); + } +}); /** + * @fileoverview Implements Outdent markdown command + * @author NHN FE Development Lab + */ + +exports.default = Outdent; + +/***/ }), +/* 127 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Table + * Add table markdown syntax to markdown editor + * @extends Command + * @module markdownCommands/Table + * @ignore + */ +var Table = _commandManager2.default.command('markdown', /** @lends Table */{ + name: 'Table', + /** + * Command handler + * @param {MarkdownEditor} mde MarkdownEditor instance + * @param {number} col column count + * @param {number} row row count + * @param {Array} data initial table data + */ + exec: function exec(mde, col, row, data) { + var cm = mde.getEditor(); + var doc = cm.getDoc(); + var table = '\n'; + + if (cm.getCursor().ch > 0) { + table += '\n'; + } + + table += makeHeader(col, data); + table += makeBody(col, row - 1, data); + + doc.replaceSelection(table); + + if (!data) { + cm.setCursor(cm.getCursor().line - row, 2); + } + + mde.focus(); + } +}); + +/** + * makeHeader + * make table header markdown string + * @param {number} col Column count + * @param {array} data Cell's text content + * @returns {string} markdown string + */ +/** + * @fileoverview Implements Table markdown command + * @author NHN FE Development Lab + */ + +function makeHeader(col, data) { + var header = '|'; + var border = '|'; + var index = 0; + + while (col) { + if (data) { + header += ' ' + data[index] + ' |'; + index += 1; + } else { + header += ' |'; + } + + border += ' --- |'; + + col -= 1; + } + + return header + '\n' + border + '\n'; +} + +/** + * makeBody + * make table body markdown string + * @param {number} col column count + * @param {number} row row count + * @param {Array} data initial table data + * @returns {string} html string + */ +function makeBody(col, row, data) { + var body = ''; + var index = col; + + for (var irow = 0; irow < row; irow += 1) { + body += '|'; + + for (var icol = 0; icol < col; icol += 1) { + if (data) { + body += ' ' + data[index] + ' |'; + index += 1; + } else { + body += ' |'; + } + } + + body += '\n'; + } + + body = body.replace(/\n$/g, ''); + + return body; +} +exports.default = Table; + +/***/ }), +/* 128 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Task + * @extends Command + * @module markdownCommands/Task + * @ignore + */ +var Task = _commandManager2.default.command('markdown', /** @lends Task */{ + name: 'Task', + keyMap: ['ALT+T', 'ALT+T'], + /** + * Command handler + * @param {MarkdownEditor} mde MarkdownEditor instance + */ + exec: function exec(mde) { + var range = mde.getCurrentRange(); + var listManager = mde.componentManager.getManager('list'); + + listManager.changeSyntax(range, 'task'); + } +}); /** + * @fileoverview Implements Task markdown command + * @author NHN FE Development Lab + */ +exports.default = Task; + +/***/ }), +/* 129 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var codeRangeRegex = /^`([^`]+)`$/; /** + * @fileoverview Implements Code markdown command + * @author NHN FE Development Lab + */ + +var codeContentRegex = /`([^`]+)`/g; + +/** + * Code + * Add code markdown syntax to markdown editor + * @extends Command + * @module markdownCommands/Code + * @ignore + */ +var Code = _commandManager2.default.command('markdown', /** @lends Code */{ + name: 'Code', + keyMap: ['SHIFT+CTRL+C', 'SHIFT+META+C'], + /** + * Command Handler + * @param {MarkdownEditor} mde MarkdownEditor instance + */ + exec: function exec(mde) { + var cm = mde.getEditor(); + var doc = cm.getDoc(); + var selection = doc.getSelection(); + var cursor = cm.getCursor(); + var hasSyntax = this.hasStrikeSyntax(selection); + + var result = void 0; + if (hasSyntax) { + result = this.remove(selection); + result = this._removeCodeSyntax(result); + } else { + result = this._removeCodeSyntax(selection); + result = this.append(result); + } + + doc.replaceSelection(result, 'around'); + + if (!selection && !hasSyntax) { + this.setCursorToCenter(doc, cursor, hasSyntax); + } + + cm.focus(); + }, + + + /** + * set cursor to center + * @param {CodeMirror.doc} doc - codemirror document + * @param {object} cursor - codemirror cursor + * @param {boolean} isRemoved - whether it involes deletion + */ + setCursorToCenter: function setCursorToCenter(doc, cursor, isRemoved) { + var pos = isRemoved ? -1 : 1; + doc.setCursor(cursor.line, cursor.ch + pos); + }, + + + /** + * has code syntax + * @param {string} text Source text + * @returns {boolean} true if the given text has a code syntax + */ + hasStrikeSyntax: function hasStrikeSyntax(text) { + return codeRangeRegex.test(text); + }, + + + /** + * apply Code + * @param {string} text - selected text + * @returns {string} - text after code syntax applied + */ + append: function append(text) { + return '`' + text + '`'; + }, + + + /** + * remove Code + * @param {string} text - selected text + * @returns {string} - text after code syntax removed + */ + remove: function remove(text) { + return text.substr(1, text.length - 2); + }, + + + /** + * remove bold syntax in the middle of given text + * @param {string} text - text selected + * @returns {string} - text eliminated all code in the middle of it's content + * @private + */ + _removeCodeSyntax: function _removeCodeSyntax(text) { + return text ? text.replace(codeContentRegex, '$1') : ''; + } +}); + +exports.default = Code; + +/***/ }), +/* 130 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * CodeBlock + * Add CodeBlock markdown syntax to markdown editor + * @extends Command + * @module markdownCommands/CodeBlock + * @ignore + */ +var CodeBlock = _commandManager2.default.command('markdown', /** @lends CodeBlock */{ + name: 'CodeBlock', + keyMap: ['SHIFT+CTRL+P', 'SHIFT+META+P'], + /** + * Command handler + * @param {MarkdownEditor} mde MarkdownEditor instance + */ + exec: function exec(mde) { + var cm = mde.getEditor(); + var doc = cm.getDoc(); + var range = mde.getCurrentRange(); + var replaceText = ['```', doc.getSelection(), '```']; + var cursorOffset = 1; + // insert a line break to the front if the selection starts in the middle of a text + if (range.from.ch !== 0) { + replaceText.unshift(''); + cursorOffset += 1; + } + // insert a line break to the end if the selection has trailing text + if (range.to.ch !== doc.getLine(range.to.line).length) { + replaceText.push(''); + } + doc.replaceSelection(replaceText.join('\n')); + + cm.setCursor(range.from.line + cursorOffset, 0); + + cm.focus(); + } +}); /** + * @fileoverview Implements CodeBlock markdown command + * @author NHN FE Development Lab + */ +exports.default = CodeBlock; + +/***/ }), +/* 131 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _domUtils = __webpack_require__(4); + +var _domUtils2 = _interopRequireDefault(_domUtils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Bold + * Add bold to selected wysiwyg editor content + * @extends Command + * @module wysiwygCommands/Bold + * @ignore + */ +/** + * @fileoverview Implements bold WysiwygCommand + * @author NHN FE Development Lab + */ +var Bold = _commandManager2.default.command('wysiwyg', /** @lends Bold */{ + name: 'Bold', + keyMap: ['CTRL+B', 'META+B'], + /** + * command handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + var tableSelectionManager = wwe.componentManager.getManager('tableSelection'); + + wwe.focus(); + + if (sq.hasFormat('table') && tableSelectionManager.getSelectedCells().length) { + tableSelectionManager.styleToSelectedCells(styleBold); + + var range = sq.getSelection(); + range.collapse(true); + sq.setSelection(range); + } else { + styleBold(sq); + _domUtils2.default.optimizeRange(sq.getSelection(), 'B'); + } + } +}); + +/** + * Style bold. + * @param {object} sq - squire editor instance + */ +function styleBold(sq) { + if (sq.hasFormat('b') || sq.hasFormat('strong')) { + sq.changeFormat(null, { tag: 'b' }); + } else if (!sq.hasFormat('PRE')) { + if (sq.hasFormat('code')) { + sq.changeFormat(null, { tag: 'code' }); + } + sq.bold(); + } +} + +exports.default = Bold; + +/***/ }), +/* 132 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _domUtils = __webpack_require__(4); + +var _domUtils2 = _interopRequireDefault(_domUtils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Italic + * Add Italic to selected wysiwyg editor content + * @extends Command + * @module wysiwygCommands/Italic + * @ignore + */ +/** + * @fileoverview Implements italic WysiwygCommand + * @author NHN FE Development Lab + */ + +var Italic = _commandManager2.default.command('wysiwyg', /** @lends Italic */{ + name: 'Italic', + keyMap: ['CTRL+I', 'META+I'], + /** + * command handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + var tableSelectionManager = wwe.componentManager.getManager('tableSelection'); + + wwe.focus(); + + if (sq.hasFormat('table') && tableSelectionManager.getSelectedCells().length) { + tableSelectionManager.styleToSelectedCells(styleItalic); + + var range = sq.getSelection(); + range.collapse(true); + sq.setSelection(range); + } else { + styleItalic(sq); + _domUtils2.default.optimizeRange(sq.getSelection(), 'I'); + } + } +}); + +/** + * Style italic. + * @param {object} sq - squire editor instance + */ +function styleItalic(sq) { + if (sq.hasFormat('i') || sq.hasFormat('em')) { + sq.changeFormat(null, { tag: 'i' }); + } else if (!sq.hasFormat('PRE')) { + if (sq.hasFormat('code')) { + sq.changeFormat(null, { tag: 'code' }); + } + sq.italic(); + } +} + +exports.default = Italic; + +/***/ }), +/* 133 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _domUtils = __webpack_require__(4); + +var _domUtils2 = _interopRequireDefault(_domUtils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Strike + * Add strike to selected wysiwyg editor content + * @extends Command + * @module wysiwygCommands/Strike + * @ignore + */ +/** + * @fileoverview Implements strike WysiwygCommand + * @author NHN FE Development Lab + */ + +var Strike = _commandManager2.default.command('wysiwyg', /** @lends Strike */{ + name: 'Strike', + keyMap: ['CTRL+S', 'META+S'], + /** + * command handler + * @param {WysiwygEditor} wwe WysiwygEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + var tableSelectionManager = wwe.componentManager.getManager('tableSelection'); + + wwe.focus(); + + if (sq.hasFormat('table') && tableSelectionManager.getSelectedCells().length) { + tableSelectionManager.styleToSelectedCells(styleStrike); + + var range = sq.getSelection(); + range.collapse(true); + sq.setSelection(range); + } else { + styleStrike(sq); + _domUtils2.default.optimizeRange(sq.getSelection(), 'S'); + } + } +}); + +/** + * Style strike. + * @param {object} sq - squire editor instance + */ +function styleStrike(sq) { + if (sq.hasFormat('S')) { + sq.changeFormat(null, { tag: 'S' }); + } else if (!sq.hasFormat('PRE')) { + if (sq.hasFormat('code')) { + sq.changeFormat(null, { tag: 'code' }); + } + sq.strikethrough(); + } +} + +exports.default = Strike; + +/***/ }), +/* 134 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Blockquote + * Add Blockquote to selected wysiwyg editor content + * @extends Command + * @module wysiwygCommands/Blockquote + * @ignore + */ +var Blockquote = _commandManager2.default.command('wysiwyg', /** @lends Blockquote */{ + name: 'Blockquote', + keyMap: ['ALT+Q', 'ALT+Q'], + /** + * command handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + + wwe.focus(); + + if (!sq.hasFormat('TABLE') && !sq.hasFormat('PRE')) { + if (sq.hasFormat('BLOCKQUOTE')) { + sq.decreaseQuoteLevel(); + } else { + sq.increaseQuoteLevel(); + } + } + } +}); /** + * @fileoverview Implements block quote WysiwygCommand + * @author NHN FE Development Lab + */ + +exports.default = Blockquote; + +/***/ }), +/* 135 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _importManager = __webpack_require__(15); + +var _importManager2 = _interopRequireDefault(_importManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @fileoverview Implements AddImage wysiwyg command + * @author NHN FE Development Lab + */ +var decodeURIGraceful = _importManager2.default.decodeURIGraceful, + encodeMarkdownCharacters = _importManager2.default.encodeMarkdownCharacters; + +/** + * AddImage + * Add Image markdown syntax to wysiwyg Editor + * @extends Command + * @module wysiwygCommands/AddImage + * @ignore + */ + +var AddImage = _commandManager2.default.command('wysiwyg', /** @lends AddImage */{ + name: 'AddImage', + /** + * command handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + * @param {object} data data for image + */ + exec: function exec(wwe, data) { + var sq = wwe.getEditor(); + var altText = data.altText, + imageUrl = data.imageUrl; + + altText = decodeURIGraceful(altText); + imageUrl = encodeMarkdownCharacters(imageUrl); + + wwe.focus(); + + if (!sq.hasFormat('PRE')) { + sq.insertImage(imageUrl, { 'alt': altText }); + } + } +}); + +exports.default = AddImage; + +/***/ }), +/* 136 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _importManager = __webpack_require__(15); + +var _importManager2 = _interopRequireDefault(_importManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @fileoverview Implements AddLink wysiwyg command + * @author NHN FE Development Lab + */ +var decodeURIGraceful = _importManager2.default.decodeURIGraceful, + encodeMarkdownCharacters = _importManager2.default.encodeMarkdownCharacters; + +/** + * AddLink + * Add link markdown syntax to wysiwyg Editor + * @extends Command + * @module wysiwygCommands/AddLink + * @ignore + */ + +var AddLink = _commandManager2.default.command('wysiwyg', /** @lends AddLink */{ + name: 'AddLink', + /** + * command handler + * @param {WysiwygEditor} wwe - wysiwygEditor instance + * @param {object} data - data for image + */ + exec: function exec(wwe, data) { + var sq = wwe.getEditor(); + var linkAttibute = wwe.getLinkAttribute(); + var url = data.url, + linkText = data.linkText; + + linkText = decodeURIGraceful(linkText); + url = encodeMarkdownCharacters(url); + + wwe.focus(); + + if (!sq.hasFormat('PRE')) { + sq.removeAllFormatting(); + + if (sq.getSelectedText()) { + sq.makeLink(url, linkAttibute); + } else { + var link = sq.createElement('A', _tuiCodeSnippet2.default.extend({ + href: url + }, linkAttibute)); + + (0, _jquery2.default)(link).text(linkText); + sq.insertElement(link); + } + } + } +}); + +exports.default = AddLink; + +/***/ }), +/* 137 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _domUtils = __webpack_require__(4); + +var _domUtils2 = _interopRequireDefault(_domUtils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * HR + * Add horizontal line markdown syntax to wysiwyg Editor + * @extends Command + * @module wysiwygCommands/HR + * @ignore + */ +/** + * @fileoverview Implements HR wysiwyg command + * @author NHN FE Development Lab + */ +var HR = _commandManager2.default.command('wysiwyg', /** @lends HR */{ + name: 'HR', + keyMap: ['CTRL+L', 'META+L'], + /** + * command handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + var range = sq.getSelection(); + + if (range.collapsed && !sq.hasFormat('TABLE') && !sq.hasFormat('PRE')) { + var hr = document.createElement('hr'); + var currentNode = _domUtils2.default.getChildNodeByOffset(range.startContainer, range.startOffset); + var nextBlockNode = _domUtils2.default.getTopNextNodeUnder(currentNode, wwe.get$Body()[0]); + + // If nextBlockNode is div that has hr and has contenteditable as false, + // nextBlockNode should be set as nextSibling that is normal block. + if (nextBlockNode && !_domUtils2.default.isTextNode(nextBlockNode)) { + while (nextBlockNode && nextBlockNode.getAttribute('contenteditable') === 'false') { + nextBlockNode = nextBlockNode.nextSibling; + } + } + + if (!nextBlockNode) { + nextBlockNode = _domUtils2.default.createEmptyLine(); + wwe.get$Body().append(nextBlockNode); + } + + sq.modifyBlocks(function (frag) { + frag.appendChild(hr); + + return frag; + }); + + var previousSibling = hr.previousSibling; + + if (previousSibling && _domUtils2.default.isTextNode(previousSibling) && _domUtils2.default.getTextLength(previousSibling) === 0) { + hr.parentNode.removeChild(previousSibling); + } + + hr.parentNode.replaceChild(_domUtils2.default.createHorizontalRule(), hr); + + range.selectNodeContents(nextBlockNode); + range.collapse(true); + + sq.setSelection(range); + sq.saveUndoState(range); + } + + wwe.focus(); + } +}); + +exports.default = HR; + +/***/ }), +/* 138 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Heading + * Convert selected root level contents to heading with size wysiwyg Editor + * @extends Command + * @module wysiwygCommands/Heading + * @ignore + */ +/** + * @fileoverview Implements Heading wysiwyg command + * @author NHN FE Development Lab + */ +var Heading = _commandManager2.default.command('wysiwyg', /** @lends Heading */{ + name: 'Heading', + /** + * Command handler + * @param {WysiwygEditor} wwe WYSIWYGEditor instance + * @param {Number} size size + */ + exec: function exec(wwe, size) { + var sq = wwe.getEditor(); + var blockTagName = 'h1, h2, h3, h4, h5, h6, div'; + + wwe.focus(); + + if (!sq.hasFormat('TABLE') && !sq.hasFormat('PRE')) { + sq.modifyBlocks(function (fragment) { + (0, _jquery2.default)(fragment).children(blockTagName).each(function (index, block) { + var headingHTML = ''; + var $block = (0, _jquery2.default)(block); + + if ($block.is('DIV')) { + $block.wrap(headingHTML); + } else { + var $wrapperHeading = (0, _jquery2.default)(headingHTML); + + $wrapperHeading.insertBefore(block); + $wrapperHeading.html($block.html()); + $block.remove(); + } + }); + + return fragment; + }); + } + } +}); + +exports.default = Heading; + +/***/ }), +/* 139 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Paragraph + * Convert selected contents to paragraph only heading and list + * @extends Command + * @module wysiwygCommands/Paragraph + * @ignore + */ +/** + * @fileoverview Implements Paragraph wysiwyg command + * @author NHN FE Development Lab + */ +var Paragraph = _commandManager2.default.command('wysiwyg', /** @lends Paragraph */{ + name: 'Paragraph', + /** + * Command handler + * @param {WysiwygEditor} wwe WYSIWYGEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + + wwe.focus(); + + if (!sq.hasFormat('TABLE') && !sq.hasFormat('PRE')) { + sq.modifyBlocks(function (fragment) { + var $newFragment = (0, _jquery2.default)(document.createDocumentFragment()); + + (0, _jquery2.default)(fragment).children().each(function (index, block) { + if (block.nodeName.match(/h\d/i)) { + $newFragment.append((0, _jquery2.default)(block).children()); + } else if (block.nodeName.match(/ul|ol/i)) { + (0, _jquery2.default)(block).find('li').each(function (i, listItem) { + $newFragment.append((0, _jquery2.default)(listItem).children()); + }); + } else { + $newFragment.append(block); + } + }); + + return $newFragment[0]; + }); + } + } +}); + +exports.default = Paragraph; + +/***/ }), +/* 140 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * UL + * Add UL to selected wysiwyg editor content + * @extends Command + * @module wysiwygCommands/UL + * @ignore + */ +var UL = _commandManager2.default.command('wysiwyg', /** @lends UL */{ + name: 'UL', + keyMap: ['CTRL+U', 'META+U'], + /** + * Command Handler + * @param {WysiwygEditor} wwe WYSIWYGEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + var range = sq.getSelection(); + var listManager = wwe.componentManager.getManager('list'); + var startContainer = range.startContainer, + endContainer = range.endContainer, + startOffset = range.startOffset, + endOffset = range.endOffset; + + var newLIs = []; + + wwe.focus(); + sq.saveUndoState(range); + + if (listManager.isAvailableMakeListInTable()) { + newLIs = listManager.createListInTable(range, 'UL'); + } else { + var lines = listManager.getLinesOfSelection(startContainer, endContainer); + + for (var i = 0; i < lines.length; i += 1) { + var newLI = this._changeFormatToUnorderedListIfNeed(wwe, lines[i]); + if (newLI) { + newLIs.push(newLI); + } + } + } + + if (newLIs.length) { + listManager.adjustRange(startContainer, endContainer, startOffset, endOffset, newLIs); + } + }, + + + /** + * Change format to unordered list if need + * @param {WysiwygEditor} wwe Wysiwyg editor instance + * @param {HTMLElement} target Element target for change + * @returns {HTMLElement} newly created list + * @private + */ + _changeFormatToUnorderedListIfNeed: function _changeFormatToUnorderedListIfNeed(wwe, target) { + var sq = wwe.getEditor(); + var range = sq.getSelection(); + var taskManager = wwe.componentManager.getManager('task'); + var newLI = void 0; + + if (!sq.hasFormat('PRE')) { + range.setStart(target, 0); + range.collapse(true); + sq.setSelection(range); + + if (sq.hasFormat('LI')) { + wwe.saveSelection(range); + taskManager.unformatTask(range.startContainer); + sq.replaceParent(range.startContainer, 'ol', 'ul'); + wwe.restoreSavedSelection(); + } else { + wwe.unwrapBlockTag(); + sq.makeUnorderedList(); + } + + newLI = sq.getSelection().startContainer; + } + + return newLI; + } +}); /** + * @fileoverview Implements ul WysiwygCommand + * @author NHN FE Development Lab + */ +exports.default = UL; + +/***/ }), +/* 141 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * OL + * Add OL to selected wysiwyg editor content + * @extends Command + * @module wysiwygCommands/OL + * @ignore + */ +var OL = _commandManager2.default.command('wysiwyg', /** @lends OL */{ + name: 'OL', + keyMap: ['CTRL+O', 'META+O'], + /** + * Command Handler + * @param {WysiwygEditor} wwe WYSIWYGEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + var range = sq.getSelection(); + var listManager = wwe.componentManager.getManager('list'); + var startContainer = range.startContainer, + startOffset = range.startOffset, + endContainer = range.endContainer, + endOffset = range.endOffset; + + var newLIs = []; + + wwe.focus(); + sq.saveUndoState(range); + + if (listManager.isAvailableMakeListInTable()) { + newLIs = listManager.createListInTable(range, 'OL'); + } else { + var lines = listManager.getLinesOfSelection(startContainer, endContainer); + + for (var i = 0; i < lines.length; i += 1) { + var newLI = this._changeFormatToOrderedListIfNeed(wwe, lines[i]); + if (newLI) { + newLIs.push(newLI); + } + } + } + + if (newLIs.length) { + listManager.adjustRange(startContainer, endContainer, startOffset, endOffset, newLIs); + } + }, + + + /** + * Change format to unordered list if need + * @param {WysiwygEditor} wwe Wysiwyg editor instance + * @param {HTMLElement} target Element target for change + * @returns {HTMLElement} newly created list item + * @private + */ + _changeFormatToOrderedListIfNeed: function _changeFormatToOrderedListIfNeed(wwe, target) { + var sq = wwe.getEditor(); + var range = sq.getSelection(); + var taskManager = wwe.componentManager.getManager('task'); + var newLI = void 0; + + if (!sq.hasFormat('PRE')) { + range.setStart(target, 0); + range.collapse(true); + sq.setSelection(range); + + if (sq.hasFormat('LI')) { + wwe.saveSelection(range); + taskManager.unformatTask(range.startContainer); + sq.replaceParent(range.startContainer, 'ul', 'ol'); + wwe.restoreSavedSelection(); + } else { + wwe.unwrapBlockTag(); + sq.makeOrderedList(); + } + + newLI = sq.getSelection().startContainer; + } + + return newLI; + } +}); /** + * @fileoverview Implements ol WysiwygCommand + * @author NHN FE Development Lab + */ + +exports.default = OL; + +/***/ }), +/* 142 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Table + * Add table to selected wysiwyg editor content + * @extends Command + * @module wysiwygCommands/Table + * @ignore + */ +var Table = _commandManager2.default.command('wysiwyg', /** @lends Table */{ + name: 'Table', + /** + * Command Handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + * @param {number} col column count + * @param {number} row row count + * @param {Array} data initial table data + */ + exec: function exec(wwe, col, row, data) { + var sq = wwe.getEditor(); + var tableIDClassName = wwe.componentManager.getManager('table').getTableIDClassName(); + var tableHTMLString = void 0; + + if (!sq.getSelection().collapsed || sq.hasFormat('TABLE') || sq.hasFormat('PRE')) { + wwe.focus(); + + return; + } + + tableHTMLString = ''; + tableHTMLString += makeHeader(col, data); + tableHTMLString += makeBody(col, row - 1, data); + tableHTMLString += '
'; + + sq.insertHTML(tableHTMLString); + + wwe.focus(); + + if (!data) { + focusToFirstTh(sq, wwe.get$Body().find('.' + tableIDClassName)); + } + } +}); + +/** + * Focus to first th + * @param {Squire} sq Squire instance + * @param {jQuery} $table jQuery wrapped table element + */ +/** + * @fileoverview Implements table WysiwygCommand + * @author NHN FE Development Lab + */ +function focusToFirstTh(sq, $table) { + var range = sq.getSelection(); + + range.selectNodeContents($table.find('th')[0]); + range.collapse(true); + sq.setSelection(range); +} + +/** + * makeHeader + * make table header html string + * @param {number} col column count + * @param {string} data cell data + * @returns {string} html string + */ +function makeHeader(col, data) { + var header = ''; + var index = 0; + + while (col) { + header += ''; + + if (data) { + header += data[index]; + index += 1; + } + + header += ''; + col -= 1; + } + + header += ''; + + return header; +} + +/** + * makeBody + * make table body html string + * @param {number} col column count + * @param {number} row row count + * @param {string} data cell data + * @returns {string} html string + */ +function makeBody(col, row, data) { + var body = ''; + var index = col; + + for (var irow = 0; irow < row; irow += 1) { + body += ''; + + for (var icol = 0; icol < col; icol += 1) { + body += ''; + + if (data) { + body += data[index]; + index += 1; + } + + body += ''; + } + + body += ''; + } + + body += ''; + + return body; +} + +exports.default = Table; + +/***/ }), +/* 143 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * AddRow + * Add Row to selected table + * @extends Command + * @module wysiwygCommands/TableAddRow + * @ignore + */ +var TableAddRow = _commandManager2.default.command('wysiwyg', /** @lends AddRow */{ + name: 'AddRow', + /** + * command handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + var range = sq.getSelection().cloneRange(); + var selectedRowLength = getSelectedRowsLength(wwe); + var $tr = void 0, + $newRow = void 0; + + wwe.focus(); + + if (sq.hasFormat('TD')) { + sq.saveUndoState(range); + $tr = (0, _jquery2.default)(range.startContainer).closest('tr'); + for (var i = 0; i < selectedRowLength; i += 1) { + $newRow = getNewRow($tr); + $newRow.insertAfter($tr); + } + + focusToFirstTd(sq, $newRow); + } else if (sq.hasFormat('TH')) { + sq.saveUndoState(range); + $tr = (0, _jquery2.default)(range.startContainer).parents('thead').next('tbody').children('tr').eq(0); + for (var _i = 0; _i < selectedRowLength; _i += 1) { + $newRow = getNewRow($tr); + $newRow.insertBefore($tr); + } + + focusToFirstTd(sq, $newRow); + } + } +}); + +/** + * get number of selected rows + * @param {WysiwygEditor} wwe - wysiwygEditor instance + * @returns {number} - number of selected rows + * @ignore + */ +/** + * @fileoverview Implements table add row WysiwygCommand + * @author NHN FE Development Lab + */ +function getSelectedRowsLength(wwe) { + var selectionMgr = wwe.componentManager.getManager('tableSelection'); + var $selectedCells = selectionMgr.getSelectedCells(); + var length = 1; + + if ($selectedCells.length > 1) { + var first = $selectedCells.first().get(0); + var last = $selectedCells.last().get(0); + var range = selectionMgr.getSelectionRangeFromTable(first, last); + length = range.to.row - range.from.row + 1; + } + + return length; +} + +/** + * Get new row of given row + * @param {jQuery} $tr - jQuery wrapped table row + * @returns {jQuery} - new cloned jquery element + * @ignore + */ +function getNewRow($tr) { + var cloned = $tr.clone(); + var htmlString = _tuiCodeSnippet2.default.browser.msie ? '' : '
'; + + cloned.find('td').html(htmlString); + + return cloned; +} + +/** + * Focus to first table cell + * @param {Squire} sq - Squire instance + * @param {jQuery} $tr - jQuery wrapped table row + * @ignore + */ +function focusToFirstTd(sq, $tr) { + var range = sq.getSelection(); + + range.selectNodeContents($tr.find('td')[0]); + range.collapse(true); + sq.setSelection(range); +} + +exports.default = TableAddRow; + +/***/ }), +/* 144 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _domUtils = __webpack_require__(4); + +var _domUtils2 = _interopRequireDefault(_domUtils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * AddCol + * Add col to selected table + * @extends Command + * @module wysiwygCommands/TableAddCol + * @ignore + */ +/** + * @fileoverview Implements table add column WysiwygCommand + * @author NHN FE Development Lab + */ +var TableAddCol = _commandManager2.default.command('wysiwyg', /** @lends AddCol */{ + name: 'AddCol', + /** + * command handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + var range = sq.getSelection().cloneRange(); + var numberOfCols = getNumberOfCols(wwe); + var $cell = void 0; + + wwe.focus(); + + if (sq.hasFormat('TR')) { + sq.saveUndoState(range); + + $cell = getCellByRange(range); + addColToCellAfter($cell, numberOfCols); + + focusToNextCell(sq, $cell); + } + } +}); + +/** + * get number of selected cols + * @param {WysiwygEditor} wwe - wysiwyg editor instance + * @returns {number} - number of selected cols + * @ignore + */ +function getNumberOfCols(wwe) { + var selectionMgr = wwe.componentManager.getManager('tableSelection'); + var $selectedCells = selectionMgr.getSelectedCells(); + var length = 1; + + if ($selectedCells.length > 0) { + var maxLength = $selectedCells.get(0).parentNode.querySelectorAll('td, th').length; + length = Math.min(maxLength, $selectedCells.length); + } + + return length; +} + +/** + * Get cell by range object + * @param {Range} range - range + * @returns {jQuery} - jQuery html element + * @ignore + */ +function getCellByRange(range) { + var cell = range.startContainer; + + if (_domUtils2.default.getNodeName(cell) === 'TD' || _domUtils2.default.getNodeName(cell) === 'TH') { + cell = (0, _jquery2.default)(cell); + } else { + cell = (0, _jquery2.default)(cell).parentsUntil('tr'); + } + + return cell; +} + +/** + * Add column to after the current cell + * @param {jQuery} $cell - jQuery wrapped table cell + * @param {number} [numberOfCols=1] - number of cols + * @ignore + */ +function addColToCellAfter($cell) { + var numberOfCols = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; + + var index = $cell.index(); + var cellToAdd = void 0; + + $cell.parents('table').find('tr').each(function (n, tr) { + var isTBody = _domUtils2.default.getNodeName(tr.parentNode) === 'TBODY'; + var isMSIE = _tuiCodeSnippet2.default.browser.msie; + var cell = tr.children[index]; + for (var i = 0; i < numberOfCols; i += 1) { + if (isTBody) { + cellToAdd = document.createElement('td'); + } else { + cellToAdd = document.createElement('th'); + } + if (!isMSIE) { + cellToAdd.appendChild(document.createElement('br')); + } + (0, _jquery2.default)(cellToAdd).insertAfter(cell); + } + }); +} + +/** + * Focus to next cell + * @param {Squire} sq - Squire instance + * @param {jQuery} $cell - jQuery wrapped table cell + * @ignore + */ +function focusToNextCell(sq, $cell) { + var range = sq.getSelection(); + + range.selectNodeContents($cell.next()[0]); + range.collapse(true); + + sq.setSelection(range); +} + +exports.default = TableAddCol; + +/***/ }), +/* 145 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * RemoveRow + * remove Row to selected table + * @extends Command + * @module wysiwygCommands/TableRemoveRow + * @ignore + */ +/** + * @fileoverview Implements table remove row WysiwygCommand + * @author NHN FE Development Lab + */ +var TableRemoveRow = _commandManager2.default.command('wysiwyg', /** @lends RemoveRow */{ + name: 'RemoveRow', + /** + * command handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + var range = sq.getSelection().cloneRange(); + var $table = (0, _jquery2.default)(range.startContainer).parents('table'); + var selectionMgr = wwe.componentManager.getManager('tableSelection'); + var tableMgr = wwe.componentManager.getManager('table'); + var $tr = getTrs(range, selectionMgr, $table); + var tbodyRowLength = $table.find('tbody tr').length; + + wwe.focus(); + + if ((sq.hasFormat('TD') || sq.hasFormat('TABLE')) && tbodyRowLength > 1) { + sq.saveUndoState(range); + var $nextFocus = $tr.last().next()[0] ? $tr.last().next() : $tr.first().prev(); + + if ($nextFocus.length) { + focusToFirstTd(sq, range, $nextFocus, tableMgr); + } + $tr.remove(); + } + selectionMgr.removeClassAttrbuteFromAllCellsIfNeed(); + } +}); + +/** + * Focus to first TD in given TR + * @param {SquireExt} sq Squire instance + * @param {Range} range Range object + * @param {jQuery} $tr jQuery wrapped TR + * @param {object} tableMgr Table manager + */ +function focusToFirstTd(sq, range, $tr, tableMgr) { + var nextFocusCell = $tr.find('td').get(0); + range.setStart(nextFocusCell, 0); + range.collapse(true); + + tableMgr.setLastCellNode(nextFocusCell); + sq.setSelection(range); +} + +/** + * Get start, end row index from current range + * @param {HTMLElement} firstSelectedCell Range object + * @param {object} rangeInformation Range information object + * @param {jQuery} $table jquery wrapped TABLE + * @returns {jQuery} + */ +function getSelectedRows(firstSelectedCell, rangeInformation, $table) { + var tbodyRowLength = $table.find('tbody tr').length; + var isStartContainerInThead = (0, _jquery2.default)(firstSelectedCell).parents('thead').length; + var startRowIndex = rangeInformation.from.row; + var endRowIndex = rangeInformation.to.row; + + if (isStartContainerInThead) { + startRowIndex += 1; + } + + var isWholeTbodySelected = (startRowIndex === 1 || isStartContainerInThead) && endRowIndex === tbodyRowLength; + + if (isWholeTbodySelected) { + endRowIndex -= 1; + } + + return $table.find('tr').slice(startRowIndex, endRowIndex + 1); +} + +/** + * Get TRs + * @param {Range} range Range object + * @param {object} selectionMgr Table selection manager + * @param {jQuery} $table current table + * @returns {jQuery} + */ +function getTrs(range, selectionMgr, $table) { + var $selectedCells = selectionMgr.getSelectedCells(); + var rangeInformation = void 0, + trs = void 0; + + if ($selectedCells.length) { + rangeInformation = selectionMgr.getSelectionRangeFromTable($selectedCells.first().get(0), $selectedCells.last().get(0)); + trs = getSelectedRows($selectedCells.first()[0], rangeInformation, $table); + } else { + var cell = (0, _jquery2.default)(range.startContainer).closest('td,th').get(0); + rangeInformation = selectionMgr.getSelectionRangeFromTable(cell, cell); + trs = getSelectedRows(cell, rangeInformation, $table); + } + + return trs; +} +exports.default = TableRemoveRow; + +/***/ }), +/* 146 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _domUtils = __webpack_require__(4); + +var _domUtils2 = _interopRequireDefault(_domUtils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * RemoveCol + * remove Row to selected table + * @extends Command + * @module wysiwygCommands/TableRemoveCol + * @ignore + */ +var TableRemoveCol = _commandManager2.default.command('wysiwyg', /** @lends RemoveCol */{ + name: 'RemoveCol', + /** + * command handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + var range = sq.getSelection().cloneRange(); + var $table = (0, _jquery2.default)(range.startContainer).parents('table'); + var tableMgr = wwe.componentManager.getManager('table'); + var selectionMgr = wwe.componentManager.getManager('tableSelection'); + var hasMultipleCols = (0, _jquery2.default)(range.startContainer).closest('table').find('thead tr th').length > 1; + + wwe.focus(); + // IE 800a025e error on removing part of selection range. collapse + range.collapse(true); + sq.setSelection(range); + + if (sq.hasFormat('TR', null, range) && hasMultipleCols) { + var tbodyColLength = $table.find('tbody tr:first td').length; + var $selectedCellsByManager = selectionMgr.getSelectedCells(); + + if ($selectedCellsByManager.length < tbodyColLength) { + sq.saveUndoState(range); + var $nextFocus = void 0; + + if ($selectedCellsByManager.length > 1) { + var $tailCell = $selectedCellsByManager.last(); + var $headCell = $selectedCellsByManager.first(); + $nextFocus = $tailCell.next().length ? $tailCell.next() : $headCell.prev(); + + removeMultipleColsByCells($selectedCellsByManager); + } else { + var $cell = getCellByRange(range); + $nextFocus = $cell.next().length ? $cell.next() : $cell.prev(); + + removeColByCell($cell); + } + + focusToCell(sq, $nextFocus, tableMgr); + } + } + } +}); + +/** + * Get cell by range object + * @param {Range} range range + * @returns {HTMLElement|Node} + */ +/** + * @fileoverview Implements table remove column WysiwygCommand + * @author NHN FE Development Lab + */ +function getCellByRange(range) { + var cell = range.startContainer; + + if (_domUtils2.default.getNodeName(cell) === 'TD' || _domUtils2.default.getNodeName(cell) === 'TH') { + cell = (0, _jquery2.default)(cell); + } else { + cell = (0, _jquery2.default)(cell).parentsUntil('tr'); + } + + return cell; +} + +/** + * Remove columns by given cells + * @param {jQuery} $cells - jQuery table cells + */ +function removeMultipleColsByCells($cells) { + var numberOfCells = $cells.length; + for (var i = 0; i < numberOfCells; i += 1) { + var $cellToDelete = $cells.eq(i); + if ($cellToDelete.length > 0) { + removeColByCell($cells.eq(i)); + } + } +} + +/** + * Remove column by given cell + * @param {jQuery} $cell - jQuery wrapped table cell + */ +function removeColByCell($cell) { + var index = $cell.index(); + + $cell.parents('table').find('tr').each(function (n, tr) { + (0, _jquery2.default)(tr).children().eq(index).remove(); + }); +} + +/** + * Focus to given cell + * @param {Squire} sq - Squire instance + * @param {jQuery} $cell - jQuery wrapped table cell + * @param {object} tableMgr - Table manager instance + */ +function focusToCell(sq, $cell, tableMgr) { + var nextFocusCell = $cell.get(0); + + if ($cell.length && _jquery2.default.contains(document, $cell)) { + var range = sq.getSelection(); + range.selectNodeContents($cell[0]); + range.collapse(true); + sq.setSelection(range); + + tableMgr.setLastCellNode(nextFocusCell); + } +} + +exports.default = TableRemoveCol; + +/***/ }), +/* 147 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _domUtils = __webpack_require__(4); + +var _domUtils2 = _interopRequireDefault(_domUtils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * AlignCol + * Align selected column's text content to given direction + * @extends Command + * @module wysiwygCommands/TableAlignCol + * @ignore + */ +var TableAlignCol = _commandManager2.default.command('wysiwyg', /** @lends AlignCol */{ + name: 'AlignCol', + /** + * command handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + * @param {string} alignDirection Align direction + */ + exec: function exec(wwe, alignDirection) { + var sq = wwe.getEditor(); + var range = sq.getSelection().cloneRange(); + var selectionMgr = wwe.componentManager.getManager('tableSelection'); + var rangeInformation = getRangeInformation(range, selectionMgr); + + wwe.focus(); + + if (sq.hasFormat('TR')) { + sq.saveUndoState(range); + + var $table = (0, _jquery2.default)(range.startContainer).parents('table'); + + var selectionInformation = getSelectionInformation($table, rangeInformation); + + setAlignAttributeToTableCells($table, alignDirection, selectionInformation); + } + selectionMgr.removeClassAttrbuteFromAllCellsIfNeed(); + } +}); + +/** + * Set Column align + * @param {jQuery} $table jQuery wrapped TABLE + * @param {string} alignDirection 'left' or 'center' or 'right' + * @param {{ + * startColumnIndex: number, + * endColumnIndex: number, + * isDivided: boolean + * }} selectionInformation start, end column index and boolean value for whether range divided or not + */ +/** + * @fileoverview Implements table align column WysiwygCommand + * @author NHN FE Development Lab + */ +function setAlignAttributeToTableCells($table, alignDirection, selectionInformation) { + var isDivided = selectionInformation.isDivided || false; + var start = selectionInformation.startColumnIndex; + var end = selectionInformation.endColumnIndex; + var columnLength = $table.find('tr').eq(0).find('td,th').length; + + $table.find('tr').each(function (n, tr) { + (0, _jquery2.default)(tr).children('td,th').each(function (index, cell) { + if (isDivided && (start <= index && index <= columnLength || index <= end)) { + (0, _jquery2.default)(cell).attr('align', alignDirection); + } else if (start <= index && index <= end) { + (0, _jquery2.default)(cell).attr('align', alignDirection); + } + }); + }); +} + +/** + * Return start, end column index and boolean value for whether range divided or not + * @param {jQuery} $table jQuery wrapped TABLE + * @param {{startColumnIndex: number, endColumnIndex: number}} rangeInformation Range information + * @returns {{startColumnIndex: number, endColumnIndex: number, isDivided: boolean}} + */ +function getSelectionInformation($table, rangeInformation) { + var columnLength = $table.find('tr').eq(0).find('td,th').length; + var from = rangeInformation.from, + to = rangeInformation.to; + + var startColumnIndex = void 0, + endColumnIndex = void 0, + isDivided = void 0; + + if (from.row === to.row) { + startColumnIndex = from.cell; + endColumnIndex = to.cell; + } else if (from.row < to.row) { + if (from.cell <= to.cell) { + startColumnIndex = 0; + endColumnIndex = columnLength - 1; + } else { + startColumnIndex = from.cell; + endColumnIndex = to.cell; + isDivided = true; + } + } + + return { + startColumnIndex: startColumnIndex, + endColumnIndex: endColumnIndex, + isDivided: isDivided + }; +} + +/** + * Get range information + * @param {Range} range Range object + * @param {object} selectionMgr Table selection manager + * @returns {object} + */ +function getRangeInformation(range, selectionMgr) { + var $selectedCells = selectionMgr.getSelectedCells(); + var rangeInformation = void 0, + startCell = void 0; + + if ($selectedCells.length) { + rangeInformation = selectionMgr.getSelectionRangeFromTable($selectedCells.first().get(0), $selectedCells.last().get(0)); + } else { + var startContainer = range.startContainer; + + startCell = _domUtils2.default.isTextNode(startContainer) ? (0, _jquery2.default)(startContainer).parent('td,th')[0] : startContainer; + rangeInformation = selectionMgr.getSelectionRangeFromTable(startCell, startCell); + } + + return rangeInformation; +} + +exports.default = TableAlignCol; + +/***/ }), +/* 148 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * RemoveTable + * Remove selected table + * @extends Command + * @module wysiwygCommands/TableRemove + * @ignore + */ +/** + * @fileoverview Implements table remove WysiwygCommand + * @author NHN FE Development Lab + */ +var TableRemove = _commandManager2.default.command('wysiwyg', /** @lends RemoveTable */{ + name: 'RemoveTable', + /** + * command handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + var range = sq.getSelection().cloneRange(); + + if (sq.hasFormat('TABLE')) { + sq.saveUndoState(range); + var $table = (0, _jquery2.default)(range.startContainer).closest('table'); + + $table.remove(); + } + + wwe.focus(); + } +}); + +exports.default = TableRemove; + +/***/ }), +/* 149 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Indent + * Indent list or task to wysiwyg Editor + * @extends Command + * @module wysiwygCommands/indent + * @ignore + */ +/** + * @fileoverview Implements Indent wysiwyg command + * @author NHN FE Development Lab + */ +var Indent = _commandManager2.default.command('wysiwyg', /** @lends Indent */{ + name: 'Indent', + /** + * Command Handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + */ + exec: function exec(wwe) { + var listManager = wwe.componentManager.getManager('list'); + var range = wwe.getEditor().getSelection(); + var $node = (0, _jquery2.default)(range.startContainer).closest('li'); + var prevClasses = void 0, + nodeClasses = void 0, + nextClasses = void 0; + + var $prev = $node.prev(); + + if ($prev.length && $node.length) { + var $next = $node.find('li').eq(0); + + wwe.getEditor().saveUndoState(); + + nodeClasses = $node.attr('class'); + prevClasses = $prev.attr('class'); + nextClasses = $next.attr('class'); + + $node.removeAttr('class'); + $prev.removeAttr('class'); + + if ($next.length && !$next.children('div').length) { + $next.removeAttr('class'); + } + + wwe.getEditor().increaseListLevel(); + listManager.mergeList($node.get(0)); + + $node.attr('class', nodeClasses); + $prev.attr('class', prevClasses); + $next.attr('class', nextClasses); + } + } +}); + +exports.default = Indent; + +/***/ }), +/* 150 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Outdent + * Outdent list or task to wysiwyg Editor + * @extends Command + * @module wysiwygCommands/Outdent + * @ignore + */ +/** + * @fileoverview Implements Outdent wysiwyg command + * @author NHN FE Development Lab + */ +var Outdent = _commandManager2.default.command('wysiwyg', /** @lends Outdent */{ + name: 'Outdent', + + /** + * Command Handler + * @param {WysiwygEditor} wwe WysiwygEditor instance + */ + exec: function exec(wwe) { + var $node = getCurrent$Li(wwe); + + if ($node.length && isExecutable($node)) { + wwe.getEditor().saveUndoState(); + + var nodeClasses = $node.attr('class'); + wwe.getEditor().decreaseListLevel(); + + $node = getCurrent$Li(wwe); + $node.attr('class', nodeClasses); + } + } +}); + +/** + * test if outdent the given list item + * arbitrary list allows list item to be in any position + * while markdown spec does not + * @param {jQuery} $currentLiNode - jQuery list item element + * @returns {boolean} - true to executable + * @ignore + */ +function isExecutable($currentLiNode) { + return !$currentLiNode.next().is('OL,UL'); +} + +/** + * Get list item element of current selection + * @param {object} wwe Wysiwyg editor instance + * @returns {jQuery} + * @ignore + */ +function getCurrent$Li(wwe) { + var range = wwe.getEditor().getSelection(); + + return (0, _jquery2.default)(range.startContainer).closest('li'); +} + +exports.default = Outdent; + +/***/ }), +/* 151 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Task + * Add Task to selected wysiwyg editor content + * @extends Command + * @module wysiwygCommands/Task + * @ignore + */ +/** + * @fileoverview Implements Task WysiwygCommand + * @author NHN FE Development Lab + */ +var Task = _commandManager2.default.command('wysiwyg', /** @lends Task */{ + name: 'Task', + keyMap: ['ALT+T', 'ALT+T'], + /** + * Command Handler + * @param {WysiwygEditor} wwe WYSIWYGEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + var range = sq.getSelection(); + var listManager = wwe.componentManager.getManager('list'); + var startContainer = range.startContainer, + endContainer = range.endContainer, + startOffset = range.startOffset, + endOffset = range.endOffset; + + var newLIs = []; + + wwe.focus(); + + sq.saveUndoState(range); + + if (listManager.isAvailableMakeListInTable()) { + newLIs = listManager.createListInTable(range, 'TASK'); + } else { + var lines = listManager.getLinesOfSelection(startContainer, endContainer); + + for (var i = 0; i < lines.length; i += 1) { + var newLI = this._changeFormatToTaskIfNeed(wwe, lines[i]); + if (newLI) { + newLIs.push(newLI); + } + } + } + + if (newLIs.length) { + listManager.adjustRange(startContainer, endContainer, startOffset, endOffset, newLIs); + } + }, + + + /** + * Change format to unordered list and return current li element if need + * @param {WysiwygEditor} wwe Wysiwyg editor instance + * @param {HTMLElement} target Element target for change + * @returns {HTMLElement} newly created list + * @private + */ + _changeFormatToTaskIfNeed: function _changeFormatToTaskIfNeed(wwe, target) { + var sq = wwe.getEditor(); + var range = sq.getSelection(); + var taskManager = wwe.componentManager.getManager('task'); + var newLI = void 0; + + if (!sq.hasFormat('PRE')) { + range.setStart(target, 0); + range.collapse(true); + sq.setSelection(range); + + if (!sq.hasFormat('li')) { + sq.makeUnorderedList(); + target = sq.getSelection().startContainer; + } + + if ((0, _jquery2.default)(target).hasClass('task-list-item')) { + taskManager.unformatTask(target); + } else { + taskManager.formatTask(target); + } + + newLI = sq.getSelection().startContainer; + } + + return newLI; + } +}); + +exports.default = Task; + +/***/ }), +/* 152 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +var _domUtils = __webpack_require__(4); + +var _domUtils2 = _interopRequireDefault(_domUtils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Code + * Add bold to selected wysiwyg editor content + * @extends Command + * @module wysiwygCommands/Code + * @ignore + */ +/** + * @fileoverview Implements code WysiwygCommand + * @author NHN FE Development Lab + */ +var Code = _commandManager2.default.command('wysiwyg', /** @lends Code */{ + name: 'Code', + keyMap: ['SHIFT+CTRL+C', 'SHIFT+META+C'], + /** + * command handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + */ + exec: function exec(wwe) { + var sq = wwe.getEditor(); + var tableSelectionManager = wwe.componentManager.getManager('tableSelection'); + var _styleCode = _tuiCodeSnippet2.default.bind(styleCode, null, wwe.getEditor()); + + wwe.focus(); + + if (sq.hasFormat('table') && tableSelectionManager.getSelectedCells().length) { + tableSelectionManager.styleToSelectedCells(_styleCode); + + var range = sq.getSelection(); + range.collapse(true); + sq.setSelection(range); + } else { + _styleCode(sq); + } + } +}); + +/** + * removeUnnecessaryCodeInNextToRange + * Remove unnecessary code tag next to range, code tag made by squire + * @param {Range} range range object + */ +function removeUnnecessaryCodeInNextToRange(range) { + if (_domUtils2.default.getNodeName(range.startContainer.nextSibling) === 'CODE' && _domUtils2.default.getTextLength(range.startContainer.nextSibling) === 0) { + (0, _jquery2.default)(range.startContainer.nextSibling).remove(); + } +} + +/** + * Style code. + * @param {object} editor - editor instance + * @param {object} sq - squire editor instance + */ +function styleCode(editor, sq) { + if (!sq.hasFormat('PRE') && sq.hasFormat('code')) { + sq.changeFormat(null, { tag: 'code' }); + removeUnnecessaryCodeInNextToRange(editor.getSelection().cloneRange()); + } else if (!sq.hasFormat('a') && !sq.hasFormat('PRE')) { + if (sq.hasFormat('b')) { + sq.removeBold(); + } else if (sq.hasFormat('i')) { + sq.removeItalic(); + } + + sq.changeFormat({ tag: 'code' }); + + var range = sq.getSelection().cloneRange(); + range.setStart(range.endContainer, range.endOffset); + range.collapse(true); + + sq.setSelection(range); + } +} + +exports.default = Code; + +/***/ }), +/* 153 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = __webpack_require__(0); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _tuiCodeSnippet = __webpack_require__(1); + +var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet); + +var _commandManager = __webpack_require__(2); + +var _commandManager2 = _interopRequireDefault(_commandManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var CODEBLOCK_CLASS_TEMP = 'te-content-codeblock-temp'; /** + * @fileoverview Implements code block WysiwygCommand + * @author NHN FE Development Lab + */ + +var CODEBLOCK_ATTR_NAME = 'data-te-codeblock'; + +/** + * CodeBlock + * Add CodeBlock to wysiwygEditor + * @extends Command + * @module wysiwygCommands/Codeblock + * @ignore + */ +var CodeBlock = _commandManager2.default.command('wysiwyg', /** @lends CodeBlock */{ + name: 'CodeBlock', + keyMap: ['SHIFT+CTRL+P', 'SHIFT+META+P'], + /** + * Command handler + * @param {WysiwygEditor} wwe wysiwygEditor instance + * @param {string} type of language + */ + exec: function exec(wwe, type) { + var sq = wwe.getEditor(); + var range = sq.getSelection().cloneRange(); + if (!sq.hasFormat('PRE') && !sq.hasFormat('TABLE')) { + var attr = CODEBLOCK_ATTR_NAME + ' class = "' + CODEBLOCK_CLASS_TEMP + '"'; + + if (type) { + attr += ' data-language="' + type + '"'; + } + + var codeBlockBody = getCodeBlockBody(range, wwe); + sq.insertHTML('
' + codeBlockBody + '
'); + + focusToFirstCode(wwe.get$Body().find('.' + CODEBLOCK_CLASS_TEMP), wwe); + } + + wwe.focus(); + } +}); + +/** + * focusToFirstCode + * Focus to first code tag content of pre tag + * @param {jQuery} $pre pre tag + * @param {WysiwygEditor} wwe wysiwygEditor + */ +function focusToFirstCode($pre, wwe) { + var range = wwe.getEditor().getSelection().cloneRange(); + $pre.removeClass(CODEBLOCK_CLASS_TEMP); + + range.setStartBefore($pre.get(0).firstChild); + range.collapse(true); + + wwe.getEditor().setSelection(range); +} +/** + * getCodeBlockBody + * get text wrapped by code + * @param {object} range range object + * @param {object} wwe wysiwyg editor + * @returns {string} + */ +function getCodeBlockBody(range, wwe) { + var mgr = wwe.componentManager.getManager('codeblock'); + var codeBlock = void 0; + if (range.collapsed) { + codeBlock = '
'; + } else { + var contents = range.extractContents(); + var nodes = _tuiCodeSnippet2.default.toArray(contents.childNodes); + var tempDiv = (0, _jquery2.default)('
').append(mgr.prepareToPasteOnCodeblock(nodes)); + codeBlock = tempDiv.html(); + } + + return codeBlock; +} + +exports.default = CodeBlock; + +/***/ }), +/* 154 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['en', 'en_US'], { + 'Markdown': 'Markdown', + 'WYSIWYG': 'WYSIWYG', + 'Write': 'Write', + 'Preview': 'Preview', + 'Headings': 'Headings', + 'Paragraph': 'Paragraph', + 'Bold': 'Bold', + 'Italic': 'Italic', + 'Strike': 'Strike', + 'Code': 'Inline code', + 'Line': 'Line', + 'Blockquote': 'Blockquote', + 'Unordered list': 'Unordered list', + 'Ordered list': 'Ordered list', + 'Task': 'Task', + 'Indent': 'Indent', + 'Outdent': 'Outdent', + 'Insert link': 'Insert link', + 'Insert CodeBlock': 'Insert codeBlock', + 'Insert table': 'Insert table', + 'Insert image': 'Insert image', + 'Heading': 'Heading', + 'Image URL': 'Image URL', + 'Select image file': 'Select image file', + 'Description': 'Description', + 'OK': 'OK', + 'More': 'More', + 'Cancel': 'Cancel', + 'File': 'File', + 'URL': 'URL', + 'Link text': 'Link text', + 'Add row': 'Add row', + 'Add col': 'Add col', + 'Remove row': 'Remove row', + 'Remove col': 'Remove col', + 'Align left': 'Align left', + 'Align center': 'Align center', + 'Align right': 'Align right', + 'Remove table': 'Remove table', + 'Would you like to paste as table?': 'Would you like to paste as table?', + 'Text color': 'Text color', + 'Auto scroll enabled': 'Auto scroll enabled', + 'Auto scroll disabled': 'Auto scroll disabled', + 'Choose language': 'Choose language' +}); /** + * @fileoverview I18N for English + * @author NHN FE Development Lab + */ + +/***/ }), +/* 155 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['ko', 'ko_KR'], { + 'Markdown': '마크다운', + 'WYSIWYG': '위지윅', + 'Write': '편집하기', + 'Preview': '미리보기', + 'Headings': '제목크기', + 'Paragraph': '본문', + 'Bold': '굵게', + 'Italic': '기울임꼴', + 'Strike': '취소선', + 'Code': '인라인 코드', + 'Line': '문단나눔', + 'Blockquote': '인용구', + 'Unordered list': '글머리 기호', + 'Ordered list': '번호 매기기', + 'Task': '체크박스', + 'Indent': '들여쓰기', + 'Outdent': '내어쓰기', + 'Insert link': '링크 삽입', + 'Insert CodeBlock': '코드블럭 삽입', + 'Insert table': '표 삽입', + 'Insert image': '이미지 삽입', + 'Heading': '제목', + 'Image URL': '이미지 주소', + 'Select image file': '이미지 파일을 선택하세요.', + 'Description': '설명', + 'OK': '확인', + 'More': '더 보기', + 'Cancel': '취소', + 'File': '파일', + 'URL': '주소', + 'Link text': '링크 텍스트', + 'Add row': '행 추가', + 'Add col': '열 추가', + 'Remove row': '행 삭제', + 'Remove col': '열 삭제', + 'Align left': '왼쪽 정렬', + 'Align center': '가운데 정렬', + 'Align right': '오른쪽 정렬', + 'Remove table': '표 삭제', + 'Would you like to paste as table?': '표형태로 붙여 넣겠습니까?', + 'Text color': '글자 색상', + 'Auto scroll enabled': '자동 스크롤 켜짐', + 'Auto scroll disabled': '자동 스크롤 꺼짐', + 'Choose language': '언어 선택' +}); /** + * @fileoverview I18N for Korean + * @author NHN FE Development Lab + */ + +/***/ }), +/* 156 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['zh', 'zh_CN'], { + 'Markdown': 'Markdown', + 'WYSIWYG': '所见即所得', + 'Write': '编辑', + 'Preview': '预览', + 'Headings': '标题', + 'Paragraph': '文本', + 'Bold': '加粗', + 'Italic': '斜体字', + 'Strike': '删除线', + 'Code': '内嵌代码', + 'Line': '水平线', + 'Blockquote': '引用块', + 'Unordered list': '无序列表', + 'Ordered list': '有序列表', + 'Task': '任务', + 'Indent': '缩进', + 'Outdent': '减少缩进', + 'Insert link': '插入链接', + 'Insert CodeBlock': '插入代码块', + 'Insert table': '插入表格', + 'Insert image': '插入图片', + 'Heading': '标题', + 'Image URL': '图片网址', + 'Select image file': '选择图片文件', + 'Description': '说明', + 'OK': '确认', + 'More': '更多', + 'Cancel': '取消', + 'File': '文件', + 'URL': 'URL', + 'Link text': '链接文本', + 'Add row': '添加行', + 'Add col': '添加列', + 'Remove row': '删除行', + 'Remove col': '删除列', + 'Align left': '左对齐', + 'Align center': '居中对齐', + 'Align right': '右对齐', + 'Remove table': '删除表格', + 'Would you like to paste as table?': '需要粘贴为表格吗?', + 'Text color': '文字颜色', + 'Auto scroll enabled': '自动滚动已启用', + 'Auto scroll disabled': '自动滚动已禁用', + 'Choose language': '选择语言' +}); /** + * @fileoverview I18N for Chinese + * @author NHN FE Development Lab + */ + +/***/ }), +/* 157 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['ja', 'ja_JP'], { + 'Markdown': 'マークダウン', + 'WYSIWYG': 'WYSIWYG', + 'Write': '編集する', + 'Preview': 'プレビュー', + 'Headings': '見出し', + 'Paragraph': '本文', + 'Bold': '太字', + 'Italic': 'イタリック', + 'Strike': 'ストライク', + 'Code': 'インラインコード', + 'Line': 'ライン', + 'Blockquote': '引用', + 'Unordered list': '番号なしリスト', + 'Ordered list': '順序付きリスト', + 'Task': 'タスク', + 'Indent': 'インデント', + 'Outdent': 'アウトデント', + 'Insert link': 'リンク挿入', + 'Insert CodeBlock': 'コードブロック挿入', + 'Insert table': 'テーブル挿入', + 'Insert image': '画像挿入', + 'Heading': '見出し', + 'Image URL': 'イメージURL', + 'Select image file': '画像ファイル選択', + 'Description': 'ディスクリプション ', + 'OK': 'はい', + 'More': 'もっと', + 'Cancel': 'キャンセル', + 'File': 'ファイル', + 'URL': 'URL', + 'Link text': 'リンクテキスト', + 'Add row': '行追加', + 'Add col': '列追加', + 'Remove row': '行削除', + 'Remove col': '列削除', + 'Align left': '左揃え', + 'Align center': '中央揃え', + 'Align right': '右揃え', + 'Remove table': 'テーブル削除', + 'Would you like to paste as table?': 'テーブルを貼り付けますか?', + 'Text color': '文字色相', + 'Auto scroll enabled': '自動スクロールが有効', + 'Auto scroll disabled': '自動スクロールを無効に', + 'Choose language': '言語選択' +}); /** + * @fileoverview I18N for Japanese + * @author NHN FE Development Lab + */ + +/***/ }), +/* 158 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['nl', 'nl_NL'], { + 'Markdown': 'Markdown', + 'WYSIWYG': 'WYSIWYG', + 'Write': 'Opslaan', + 'Preview': 'Voorbeeld', + 'Headings': 'Koppen', + 'Paragraph': 'Alinea', + 'Bold': 'Vet', + 'Italic': 'Cursief', + 'Strike': 'Doorhalen', + 'Code': 'Inline code', + 'Line': 'Regel', + 'Blockquote': 'Citaatblok', + 'Unordered list': 'Opsomming', + 'Ordered list': 'Genummerde opsomming', + 'Task': 'Taak', + 'Indent': 'Niveau verhogen', + 'Outdent': 'Niveau verlagen', + 'Insert link': 'Link invoegen', + 'Insert CodeBlock': 'Codeblok toevoegen', + 'Insert table': 'Tabel invoegen', + 'Insert image': 'Afbeelding invoegen', + 'Heading': 'Kop', + 'Image URL': 'Afbeelding URL', + 'Select image file': 'Selecteer een afbeelding', + 'Description': 'Omschrijving', + 'OK': 'OK', + 'More': 'Meer', + 'Cancel': 'Annuleren', + 'File': 'Bestand', + 'URL': 'URL', + 'Link text': 'Link tekst', + 'Add row': 'Rij toevoegen', + 'Add col': 'Kolom toevoegen', + 'Remove row': 'Rij verwijderen', + 'Remove col': 'Kolom verwijderen', + 'Align left': 'Links uitlijnen', + 'Align center': 'Centreren', + 'Align right': 'Rechts uitlijnen', + 'Remove table': 'Verwijder tabel', + 'Would you like to paste as table?': 'Wil je dit als tabel plakken?', + 'Text color': 'Tekstkleur', + 'Auto scroll enabled': 'Autoscroll ingeschakeld', + 'Auto scroll disabled': 'Autoscroll uitgeschakeld', + 'Choose language': 'Kies een taal' +}); /** + * @fileoverview I18N for Dutch + * @author NHN FE Development Lab + */ + +/***/ }), +/* 159 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['es', 'es_ES'], { + 'Markdown': 'Markdown', + 'WYSIWYG': 'WYSIWYG', + 'Write': 'Escribir', + 'Preview': 'Vista previa', + 'Headings': 'Encabezados', + 'Paragraph': 'Párrafo', + 'Bold': 'Negrita', + 'Italic': 'Itálica', + 'Strike': 'Tachado', + 'Code': 'Código', + 'Line': 'Línea', + 'Blockquote': 'Cita', + 'Unordered list': 'Lista desordenada', + 'Ordered list': 'Lista ordenada', + 'Task': 'Tarea', + 'Indent': 'Sangría', + 'Outdent': 'Saliendo', + 'Insert link': 'Insertar enlace', + 'Insert CodeBlock': 'Insertar bloque de código', + 'Insert table': 'Insertar tabla', + 'Insert image': 'Insertar imagen', + 'Heading': 'Encabezado', + 'Image URL': 'URL de la imagen', + 'Select image file': 'Seleccionar archivo de imagen', + 'Description': 'Descripción', + 'OK': 'Aceptar', + 'More': 'Más', + 'Cancel': 'Cancelar', + 'File': 'Archivo', + 'URL': 'URL', + 'Link text': 'Texto del enlace', + 'Add row': 'Agregar fila', + 'Add col': 'Agregar columna', + 'Remove row': 'Eliminar fila', + 'Remove col': 'Eliminar columna', + 'Align left': 'Alinear a la izquierda', + 'Align center': 'Centrar', + 'Align right': 'Alinear a la derecha', + 'Remove table': 'Eliminar tabla', + 'Would you like to paste as table?': '¿Desea pegar como tabla?', + 'Text color': 'Color del texto', + 'Auto scroll enabled': 'Desplazamiento automático habilitado', + 'Auto scroll disabled': 'Desplazamiento automático deshabilitado', + 'Choose language': 'Elegir idioma' +}); /** + * @fileoverview I18N for Spanish + * @author Enrico Lamperti + */ + +/***/ }), +/* 160 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['de', 'de_DE'], { + 'Markdown': 'Markdown', + 'WYSIWYG': 'WYSIWYG', + 'Write': 'Verfassen', + 'Preview': 'Vorschau', + 'Headings': 'Überschriften', + 'Paragraph': 'Text', + 'Bold': 'Fett', + 'Italic': 'Kursiv', + 'Strike': 'Durchgestrichen', + 'Code': 'Code', + 'Line': 'Trennlinie', + 'Blockquote': 'Blocktext', + 'Unordered list': 'Aufzählung', + 'Ordered list': 'Nummerierte Aufzählung', + 'Task': 'Aufgabe', + 'Indent': 'Einrücken', + 'Outdent': 'Ausrücken', + 'Insert link': 'Link einfügen', + 'Insert CodeBlock': 'Codeblock einfügen', + 'Insert table': 'Tabelle einfügen', + 'Insert image': 'Grafik einfügen', + 'Heading': 'Titel', + 'Image URL': 'Bild URL', + 'Select image file': 'Grafik auswählen', + 'Description': 'Beschreibung', + 'OK': 'OK', + 'More': 'Mehr', + 'Cancel': 'Abbrechen', + 'File': 'Datei', + 'URL': 'URL', + 'Link text': 'Anzuzeigender Text', + 'Add row': 'Zeile hinzufügen', + 'Add col': 'Spalte hinzufügen', + 'Remove row': 'Zeile entfernen', + 'Remove col': 'Spalte entfernen', + 'Align left': 'Links ausrichten', + 'Align center': 'Zentrieren', + 'Align right': 'Rechts ausrichten', + 'Remove table': 'Tabelle entfernen', + 'Would you like to paste as table?': 'Möchten Sie eine Tabelle einfügen?', + 'Text color': 'Textfarbe', + 'Auto scroll enabled': 'Autoscrollen aktiviert', + 'Auto scroll disabled': 'Autoscrollen deaktiviert', + 'Choose language': 'Sprache auswählen' +}); /** + * @fileoverview I18N for German + * @author Jann-Niklas Kiepert + */ + +/***/ }), +/* 161 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['ru', 'ru_RU'], { + 'Markdown': 'Markdown', + 'WYSIWYG': 'WYSIWYG', + 'Write': 'Написать', + 'Preview': 'Предварительный просмотр', + 'Headings': 'Заголовки', + 'Paragraph': 'Абзац', + 'Bold': 'Жирный', + 'Italic': 'Курсив', + 'Strike': 'Зачеркнутый', + 'Code': 'Встроенный код', + 'Line': 'Строка', + 'Blockquote': 'Блок цитирования', + 'Unordered list': 'Неупорядоченный список', + 'Ordered list': 'Упорядоченный список', + 'Task': 'Задача', + 'Indent': 'отступ', + 'Outdent': 'Выступ', + 'Insert link': 'Вставить ссылку', + 'Insert CodeBlock': 'Вставить код', + 'Insert table': 'Вставить таблицу', + 'Insert image': 'Вставить изображение', + 'Heading': 'Заголовок', + 'Image URL': 'URL изображения', + 'Select image file': 'Выбрать файл изображения', + 'Description': 'Описание', + 'OK': 'Хорошо', + 'More': 'еще', + 'Cancel': 'Отмена', + 'File': 'Файл', + 'URL': 'URL', + 'Link text': 'Текст ссылки', + 'Add row': 'Добавить ряд', + 'Add col': 'Добавить столбец', + 'Remove row': 'Удалить ряд', + 'Remove col': 'Удалить столбец', + 'Align left': 'Выровнять по левому краю', + 'Align center': 'Выровнять по центру', + 'Align right': 'Выровнять по правому краю', + 'Remove table': 'Удалить таблицу', + 'Would you like to paste as table?': 'Вы хотите вставить в виде таблицы?', + 'Text color': 'Цвет текста', + 'Auto scroll enabled': 'Автоматическая прокрутка включена', + 'Auto scroll disabled': 'Автоматическая прокрутка отключена', + 'Choose language': 'Выбрать язык' +}); /** + * @fileoverview I18N for Russian + * @author Stepan Samko + */ + +/***/ }), +/* 162 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['fr', 'fr_FR'], { + 'Markdown': 'Markdown', + 'WYSIWYG': 'WYSIWYG', + 'Write': 'Écrire', + 'Preview': 'Aperçu', + 'Headings': 'En-têtes', + 'Paragraph': 'Paragraphe', + 'Bold': 'Gras', + 'Italic': 'Italique', + 'Strike': 'Barré', + 'Code': 'Code en ligne', + 'Line': 'Ligne', + 'Blockquote': 'Citation', + 'Unordered list': 'Liste non-ordonnée', + 'Ordered list': 'Liste ordonnée', + 'Task': 'Tâche', + 'Indent': 'Retrait', + 'Outdent': 'Sortir', + 'Insert link': 'Insérer un lien', + 'Insert CodeBlock': 'Insérer un bloc de code', + 'Insert table': 'Insérer un tableau', + 'Insert image': 'Insérer une image', + 'Heading': 'En-tête', + 'Image URL': 'URL de l\'image', + 'Select image file': 'Sélectionnez un fichier image', + 'Description': 'Description', + 'OK': 'OK', + 'More': 'de plus', + 'Cancel': 'Annuler', + 'File': 'Fichier', + 'URL': 'URL', + 'Link text': 'Texte du lien', + 'Add row': 'Ajouter une ligne', + 'Add col': 'Ajouter une colonne', + 'Remove row': 'Supprimer une ligne', + 'Remove col': 'Supprimer une colonne', + 'Align left': 'Aligner à gauche', + 'Align center': 'Aligner au centre', + 'Align right': 'Aligner à droite', + 'Remove table': 'Supprimer le tableau', + 'Would you like to paste as table?': 'Voulez-vous coller ce contenu en tant que tableau ?', + 'Text color': 'Couleur du texte', + 'Auto scroll enabled': 'Défilement automatique activé', + 'Auto scroll disabled': 'Défilement automatique désactivé', + 'Choose language': 'Choix de la langue' +}); /** + * @fileoverview I18N for French + * @author Stanislas Michalak + */ + +/***/ }), +/* 163 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['uk', 'uk_UA'], { + 'Markdown': 'Markdown', + 'WYSIWYG': 'WYSIWYG', + 'Write': 'Написати', + 'Preview': 'Попередній перегляд', + 'Headings': 'Заголовки', + 'Paragraph': 'Абзац', + 'Bold': 'Жирний', + 'Italic': 'Курсив', + 'Strike': 'Закреслений', + 'Code': 'Вбудований код', + 'Line': 'Лінія', + 'Blockquote': 'Блок цитування', + 'Unordered list': 'Невпорядкований список', + 'Ordered list': 'Упорядкований список', + 'Task': 'Завдання', + 'Indent': 'відступ', + 'Outdent': 'застарілий', + 'Insert link': 'Вставити посилання', + 'Insert CodeBlock': 'Вставити код', + 'Insert table': 'Вставити таблицю', + 'Insert image': 'Вставити зображення', + 'Heading': 'Заголовок', + 'Image URL': 'URL зображення', + 'Select image file': 'Вибрати файл зображення', + 'Description': 'Опис', + 'OK': 'OK', + 'More': 'ще', + 'Cancel': 'Скасувати', + 'File': 'Файл', + 'URL': 'URL', + 'Link text': 'Текст посилання', + 'Add row': 'Додати ряд', + 'Add col': 'Додати стовпчик', + 'Remove row': 'Видалити ряд', + 'Remove col': 'Видалити стовпчик', + 'Align left': 'Вирівняти по лівому краю', + 'Align center': 'Вирівняти по центру', + 'Align right': 'Вирівняти по правому краю', + 'Remove table': 'Видалити таблицю', + 'Would you like to paste as table?': 'Ви хочете вставити у вигляді таблиці?', + 'Text color': 'Колір тексту', + 'Auto scroll enabled': 'Автоматична прокрутка включена', + 'Auto scroll disabled': 'Автоматична прокрутка відключена', + 'Choose language': 'Вибрати мову' +}); /** + * @fileoverview I18N for Ukrainian + * @author Nikolya + */ + +/***/ }), +/* 164 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['tr', 'tr_TR'], { + 'Markdown': 'Markdown', + 'WYSIWYG': 'WYSIWYG', + 'Write': 'Düzenle', + 'Preview': 'Ön izleme', + 'Headings': 'Başlıklar', + 'Paragraph': 'Paragraf', + 'Bold': 'Kalın', + 'Italic': 'İtalik', + 'Strike': 'Altı çizgili', + 'Code': 'Satır içi kod', + 'Line': 'Çizgi', + 'Blockquote': 'Alıntı', + 'Unordered list': 'Sıralanmamış liste', + 'Ordered list': 'Sıralı liste', + 'Task': 'Görev kutusu', + 'Indent': 'Girintiyi arttır', + 'Outdent': 'Girintiyi azalt', + 'Insert link': 'Bağlantı ekle', + 'Insert CodeBlock': 'Kod bloku ekle', + 'Insert table': 'Tablo ekle', + 'Insert image': 'İmaj ekle', + 'Heading': 'Başlık', + 'Image URL': 'İmaj URL', + 'Select image file': 'İmaj dosyası seç', + 'Description': 'Açıklama', + 'OK': 'Onay', + 'More': 'Daha Fazla', + 'Cancel': 'İptal', + 'File': 'Dosya', + 'URL': 'URL', + 'Link text': 'Bağlantı yazısı', + 'Add row': 'Satır ekle', + 'Add col': 'Sütun ekle', + 'Remove row': 'Satır sil', + 'Remove col': 'Sütun sil', + 'Align left': 'Sola hizala', + 'Align center': 'Merkeze hizala', + 'Align right': 'Sağa hizala', + 'Remove table': 'Tabloyu kaldır', + 'Would you like to paste as table?': 'Tablo olarak yapıştırmak ister misiniz?', + 'Text color': 'Metin rengi', + 'Auto scroll enabled': 'Otomatik kaydırma açık', + 'Auto scroll disabled': 'Otomatik kaydırma kapalı', + 'Choose language': 'Dil seçiniz' +}); /** + * @fileoverview I18N for Turkish + * @author Mesut Gölcük + */ + +/***/ }), +/* 165 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['fi', 'fi_FI'], { + 'Markdown': 'Markdown', + 'WYSIWYG': 'WYSIWYG', + 'Write': 'Kirjoita', + 'Preview': 'Esikatselu', + 'Headings': 'Otsikot', + 'Paragraph': 'Kappale', + 'Bold': 'Lihavointi', + 'Italic': 'Kursivointi', + 'Strike': 'Yliviivaus', + 'Code': 'Koodi', + 'Line': 'Vaakaviiva', + 'Blockquote': 'Lainaus', + 'Unordered list': 'Luettelo', + 'Ordered list': 'Numeroitu luettelo', + 'Task': 'Tehtävä', + 'Indent': 'Suurenna sisennystä', + 'Outdent': 'Pienennä sisennystä', + 'Insert link': 'Lisää linkki', + 'Insert CodeBlock': 'Lisää koodia', + 'Insert table': 'Lisää taulukko', + 'Insert image': 'Lisää kuva', + 'Heading': 'Otsikko', + 'Image URL': 'Kuvan URL', + 'Select image file': 'Valitse kuvatiedosto', + 'Description': 'Kuvaus', + 'OK': 'OK', + 'More': 'Lisää', + 'Cancel': 'Peruuta', + 'File': 'Tiedosto', + 'URL': 'URL', + 'Link text': 'Linkkiteksti', + 'Add row': 'Lisää rivi', + 'Add col': 'Lisää sarake', + 'Remove row': 'Poista rivi', + 'Remove col': 'Poista sarake', + 'Align left': 'Tasaus vasemmalle', + 'Align center': 'Keskitä', + 'Align right': 'Tasaus oikealle', + 'Remove table': 'Poista taulukko', + 'Would you like to paste as table?': 'Haluatko liittää taulukkomuodossa?', + 'Text color': 'Tekstin väri', + 'Auto scroll enabled': 'Automaattinen skrollaus käytössä', + 'Auto scroll disabled': 'Automaattinen skrollaus pois käytöstä', + 'Choose language': 'Valitse kieli' +}); /** + * @fileoverview I18N for Finnish + * @author Tomi Mynttinen + */ + +/***/ }), +/* 166 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['cs', 'cs_CZ'], { + 'Markdown': 'Markdown', + 'WYSIWYG': 'WYSIWYG', + 'Write': 'Napsat', + 'Preview': 'Náhled', + 'Headings': 'Nadpisy', + 'Paragraph': 'Odstavec', + 'Bold': 'Tučné', + 'Italic': 'Kurzíva', + 'Strike': 'Přeškrtnuté', + 'Code': 'Kód', + 'Line': 'Vodorovná čára', + 'Blockquote': 'Citace', + 'Unordered list': 'Seznam s odrážkami', + 'Ordered list': 'Číslovaný seznam', + 'Task': 'Úkol', + 'Indent': 'Zvětšit odsazení', + 'Outdent': 'Zmenšit odsazení', + 'Insert link': 'Vložit odkaz', + 'Insert CodeBlock': 'Vložit blok kódu', + 'Insert table': 'Vložit tabulku', + 'Insert image': 'Vložit obrázek', + 'Heading': 'Nadpis', + 'Image URL': 'URL obrázku', + 'Select image file': 'Vybrat obrázek', + 'Description': 'Popis', + 'OK': 'OK', + 'More': 'Více', + 'Cancel': 'Zrušit', + 'File': 'Soubor', + 'URL': 'URL', + 'Link text': 'Text odkazu', + 'Add row': 'Přidat řádek', + 'Add col': 'Přidat sloupec', + 'Remove row': 'Odebrat řádek', + 'Remove col': 'Odebrat sloupec', + 'Align left': 'Zarovnat vlevo', + 'Align center': 'Zarovnat na střed', + 'Align right': 'Zarovnat vpravo', + 'Remove table': 'Odstranit tabulku', + 'Would you like to paste as table?': 'Chcete vložit jako tabulku?', + 'Text color': 'Barva textu', + 'Auto scroll enabled': 'Automatické rolování zapnuto', + 'Auto scroll disabled': 'Automatické rolování vypnuto', + 'Choose language': 'Vybrat jazyk' +}); /** + * @fileoverview I18N for Czech + * @author Dmitrij Tkačenko + */ + +/***/ }), +/* 167 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['ar', 'ar_AR'], { + 'Markdown': 'لغة ترميز', + 'WYSIWYG': 'ما تراه هو ما تحصل عليه', + 'Write': 'يكتب', + 'Preview': 'عرض مسبق', + 'Headings': 'العناوين', + 'Paragraph': 'فقرة', + 'Bold': 'خط عريض', + 'Italic': 'خط مائل', + 'Strike': 'إضراب', + 'Code': 'رمز', + 'Line': 'خط', + 'Blockquote': 'فقرة مقتبسة', + 'Unordered list': 'قائمة غير مرتبة', + 'Ordered list': 'قائمة مرتبة', + 'Task': 'مهمة', + 'Indent': 'المسافة البادئة', + 'Outdent': 'المسافة الخارجة', + 'Insert link': 'أدخل الرابط', + 'Insert CodeBlock': 'أدخل الكود', + 'Insert table': 'أدخل جدول', + 'Insert image': 'أدخل صورة', + 'Heading': 'عنوان', + 'Image URL': 'رابط الصورة', + 'Select image file': 'حدد ملف الصورة', + 'Description': 'وصف', + 'OK': 'موافقة', + 'More': 'أكثر', + 'Cancel': 'إلغاء', + 'File': 'ملف', + 'URL': 'رابط', + 'Link text': 'نص الرابط', + 'Add row': 'ضف سطر', + 'Add col': 'ضف عمود', + 'Remove row': 'حذف سطر', + 'Remove col': 'حذف عمود', + 'Align left': 'محاذاة اليسار', + 'Align center': 'محاذاة الوسط', + 'Align right': 'محاذاة اليمين', + 'Remove table': 'حذف الجدول', + 'Would you like to paste as table?': 'هل تريد اللصق كجدول', + 'Text color': 'لون النص', + 'Auto scroll enabled': 'التحريك التلقائي ممكّن', + 'Auto scroll disabled': 'التحريك التلقائي معطّل', + 'Choose language': 'اختر اللغة' +}); /** + * @fileoverview I18N for Arabic + * @author Amira Salah + */ + +/***/ }), +/* 168 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['pl', 'pl_PL'], { + 'Markdown': 'Markdown', + 'WYSIWYG': 'WYSIWYG', + 'Write': 'Napisz', + 'Preview': 'Podgląd', + 'Headings': 'Nagłówki', + 'Paragraph': 'Akapit', + 'Bold': 'Pogrubienie', + 'Italic': 'Kursywa', + 'Strike': 'Przekreślenie', + 'Code': 'Fragment kodu', + 'Line': 'Linia', + 'Blockquote': 'Cytat', + 'Unordered list': 'Lista nieuporządkowana', + 'Ordered list': 'Lista uporządkowana', + 'Task': 'Zadanie', + 'Indent': 'Utwórz wcięcie', + 'Outdent': 'Usuń wcięcie', + 'Insert link': 'Umieść odnośnik', + 'Insert CodeBlock': 'Umieść blok kodu', + 'Insert table': 'Umieść tabelę', + 'Insert image': 'Umieść obraz', + 'Heading': 'Nagłówek', + 'Image URL': 'Adres URL obrazu', + 'Select image file': 'Wybierz plik obrazu', + 'Description': 'Opis', + 'OK': 'OK', + 'More': 'Więcej', + 'Cancel': 'Anuluj', + 'File': 'Plik', + 'URL': 'URL', + 'Link text': 'Tekst odnośnika', + 'Add row': 'Dodaj rząd', + 'Add col': 'Dodaj kolumnę', + 'Remove row': 'Usuń rząd', + 'Remove col': 'Usuń kolumnę', + 'Align left': 'Wyrównaj do lewej', + 'Align center': 'Wyśrodkuj', + 'Align right': 'Wyrównaj do prawej', + 'Remove table': 'Usuń tabelę', + 'Would you like to paste as table?': 'Czy chcesz wkleić tekst jako tabelę?', + 'Text color': 'Kolor tekstu', + 'Auto scroll enabled': 'Włączono automatyczne przewijanie', + 'Auto scroll disabled': 'Wyłączono automatyczne przewijanie', + 'Choose language': 'Wybierz język' +}); /** + * @fileoverview I18N for Polish + * @author Marcin Mikołajczak + */ + +/***/ }), +/* 169 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['zhtw', 'zh_TW'], { + 'Markdown': 'Markdown', + 'WYSIWYG': '所見即所得', + 'Write': '編輯', + 'Preview': '預覽', + 'Headings': '標題', + 'Paragraph': '內文', + 'Bold': '粗體', + 'Italic': '斜體', + 'Strike': '刪除線', + 'Code': '內嵌程式碼', + 'Line': '分隔線', + 'Blockquote': '引言', + 'Unordered list': '項目符號清單', + 'Ordered list': '編號清單', + 'Task': '核取方塊清單', + 'Indent': '增加縮排', + 'Outdent': '減少縮排', + 'Insert link': '插入超連結', + 'Insert CodeBlock': '插入程式碼區塊', + 'Insert table': '插入表格', + 'Insert image': '插入圖片', + 'Heading': '標題', + 'Image URL': '圖片網址', + 'Select image file': '選擇圖片檔案', + 'Description': '描述', + 'OK': '確認', + 'More': '更多', + 'Cancel': '取消', + 'File': '檔案', + 'URL': 'URL', + 'Link text': '超連結文字', + 'Add row': '增加行', + 'Add col': '增加列', + 'Remove row': '刪除行', + 'Remove col': '刪除列', + 'Align left': '靠左對齊', + 'Align center': '置中', + 'Align right': '靠右對齊', + 'Remove table': '刪除表格', + 'Would you like to paste as table?': '您要以表格貼上嗎?', + 'Text color': '文字顏色', + 'Auto scroll enabled': '已啟用自動滾動', + 'Auto scroll disabled': '已停用自動滾動', + 'Choose language': '選擇語言' +}); /** + * @fileoverview I18N for Traditional Chinese + * @author Tzu-Ray Su + */ + +/***/ }), +/* 170 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['gl', 'gl_ES'], { + 'Markdown': 'Markdown', + 'WYSIWYG': 'WYSIWYG', + 'Write': 'Escribir', + 'Preview': 'Vista previa', + 'Headings': 'Encabezados', + 'Paragraph': 'Parágrafo', + 'Bold': 'Negriña', + 'Italic': 'Cursiva', + 'Strike': 'Riscado', + 'Code': 'Código', + 'Line': 'Liña', + 'Blockquote': 'Cita', + 'Unordered list': 'Lista desordenada', + 'Ordered list': 'Lista ordenada', + 'Task': 'Tarefa', + 'Indent': 'Sangría', + 'Outdent': 'Anular sangría', + 'Insert link': 'Inserir enlace', + 'Insert CodeBlock': 'Inserir bloque de código', + 'Insert table': 'Inserir táboa', + 'Insert image': 'Inserir imaxe', + 'Heading': 'Encabezado', + 'Image URL': 'URL da imaxe', + 'Select image file': 'Seleccionar arquivo da imaxe', + 'Description': 'Descrición', + 'OK': 'Aceptar', + 'More': 'Máis', + 'Cancel': 'Cancelar', + 'File': 'Arquivo', + 'URL': 'URL', + 'Link text': 'Texto do enlace', + 'Add row': 'Agregar fila', + 'Add col': 'Agregar columna', + 'Remove row': 'Eliminar fila', + 'Remove col': 'Eliminar columna', + 'Align left': 'Aliñar á esquerda', + 'Align center': 'Centrar', + 'Align right': 'Aliñar á dereita', + 'Remove table': 'Eliminar táboa', + 'Would you like to paste as table?': 'Desexa pegar como táboa?', + 'Text color': 'Cor do texto', + 'Auto scroll enabled': 'Desprazamento automático habilitado', + 'Auto scroll disabled': 'Desprazamento automático deshabilitado', + 'Choose language': 'Elixir idioma' +}); /** + * @fileoverview I18N for Spanish + * @author Aida Vidal + */ + +/***/ }), +/* 171 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['sv', 'sv_SE'], { + 'Markdown': 'Markdown', + 'WYSIWYG': 'WYSIWYG', + 'Write': 'Skriv', + 'Preview': 'Förhandsgranska', + 'Headings': 'Överskrifter', + 'Paragraph': 'Paragraf', + 'Bold': 'Fet', + 'Italic': 'Kursiv', + 'Strike': 'Genomstruken', + 'Code': 'Kodrad', + 'Line': 'Linje', + 'Blockquote': 'Citatblock', + 'Unordered list': 'Punktlista', + 'Ordered list': 'Numrerad lista', + 'Task': 'Att göra', + 'Indent': 'Öka indrag', + 'Outdent': 'Minska indrag', + 'Insert link': 'Infoga länk', + 'Insert CodeBlock': 'Infoga kodblock', + 'Insert table': 'Infoga tabell', + 'Insert image': 'Infoga bild', + 'Heading': 'Överskrift', + 'Image URL': 'Bildadress', + 'Select image file': 'Välj en bildfil', + 'Description': 'Beskrivning', + 'OK': 'OK', + 'More': 'Mer', + 'Cancel': 'Avbryt', + 'File': 'Fil', + 'URL': 'Adress', + 'Link text': 'Länktext', + 'Add row': 'Infoga rad', + 'Add col': 'Infoga kolumn', + 'Remove row': 'Radera rad', + 'Remove col': 'Radera kolumn', + 'Align left': 'Vänsterjustera', + 'Align center': 'Centrera', + 'Align right': 'Högerjustera', + 'Remove table': 'Radera tabell', + 'Would you like to paste as table?': 'Vill du klistra in som en tabell?', + 'Text color': 'Textfärg', + 'Auto scroll enabled': 'Automatisk scroll aktiverad', + 'Auto scroll disabled': 'Automatisk scroll inaktiverad', + 'Choose language': 'Välj språk' +}); /** + * @fileoverview I18N for Swedish + * @author Magnus Aspling + */ + +/***/ }), +/* 172 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _i18n = __webpack_require__(3); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_i18n2.default.setLanguage(['it', 'it_IT'], { + 'Markdown': 'Markdown', + 'WYSIWYG': 'WYSIWYG', + 'Write': 'Scrivere', + 'Preview': 'Anteprima', + 'Headings': 'Intestazioni', + 'Paragraph': 'Paragrafo', + 'Bold': 'Grassetto', + 'Italic': 'Corsivo', + 'Strike': 'Barrato', + 'Code': 'Codice', + 'Line': 'Linea', + 'Blockquote': 'Blocco citazione', + 'Unordered list': 'Lista puntata', + 'Ordered list': 'Lista numerata', + 'Task': 'Attività', + 'Indent': 'Aggiungi indentazione', + 'Outdent': 'Rimuovi indentazione', + 'Insert link': 'Inserisci link', + 'Insert CodeBlock': 'Inserisci blocco di codice', + 'Insert table': 'Inserisci tabella', + 'Insert image': 'Inserisci immagine', + 'Heading': 'Intestazione', + 'Image URL': 'URL immagine', + 'Select image file': 'Seleziona file immagine', + 'Description': 'Descrizione', + 'OK': 'OK', + 'More': 'Più', + 'Cancel': 'Cancella', + 'File': 'File', + 'URL': 'URL', + 'Link text': 'Testo del collegamento', + 'Add row': 'Aggiungi riga', + 'Add col': 'Aggiungi colonna', + 'Remove row': 'Rimuovi riga', + 'Remove col': 'Rimuovi colonna', + 'Align left': 'Allinea a sinistra', + 'Align center': 'Allinea al centro', + 'Align right': 'Allinea a destra', + 'Remove table': 'Rimuovi tabella', + 'Would you like to paste as table?': 'Desideri incollare sotto forma di tabella?', + 'Text color': 'Colore del testo', + 'Auto scroll enabled': 'Scrolling automatico abilitato', + 'Auto scroll disabled': 'Scrolling automatico disabilitato', + 'Choose language': 'Scegli la lingua' +}); /** + * @fileoverview I18N for Italian + * @author Massimo Redaelli + */ + +/***/ }), +/* 173 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* eslint-disable */ +/* + CSV-JS - A Comma-Separated Values parser for JS + + Built to rfc4180 standard, with options for adjusting strictness: + - optional carriage returns for non-microsoft sources + - automatically type-cast numeric an boolean values + - relaxed mode which: ignores blank lines, ignores gargabe following quoted tokens, does not enforce a consistent record length + + Licensed under the MIT license: 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. + + Author Greg Kindel (twitter @gkindel), 2014 + */ +/** + * @modifier NHN FE Development Lab + */ + +(function (global) { + 'use strict'; + /** + * @name CSV + * @namespace + * @ignore + */ + // implemented as a singleton because JS is single threaded + + var CSV = {}; + CSV.RELAXED = false; + CSV.IGNORE_RECORD_LENGTH = false; + CSV.IGNORE_QUOTES = false; + CSV.LINE_FEED_OK = true; + CSV.CARRIAGE_RETURN_OK = true; + CSV.DETECT_TYPES = true; + CSV.IGNORE_QUOTE_WHITESPACE = true; + CSV.DEBUG = false; + + CSV.COLUMN_SEPARATOR = ","; + + CSV.ERROR_EOF = "UNEXPECTED_END_OF_FILE"; + CSV.ERROR_CHAR = "UNEXPECTED_CHARACTER"; + CSV.ERROR_EOL = "UNEXPECTED_END_OF_RECORD"; + CSV.WARN_SPACE = "UNEXPECTED_WHITESPACE"; // not per spec, but helps debugging + + var QUOTE = "\"", + CR = "\r", + LF = "\n", + SPACE = " ", + TAB = "\t"; + + // states + var PRE_TOKEN = 0, + MID_TOKEN = 1, + POST_TOKEN = 2, + POST_RECORD = 4; + /** + * @name CSV.parse + * @function + * @description rfc4180 standard csv parse + * with options for strictness and data type conversion + * By default, will automatically type-cast numeric an boolean values. + * @param {String} str A CSV string + * @return {Array} An array records, each of which is an array of scalar values. + * @example + * // simple + * var rows = CSV.parse("one,two,three\nfour,five,six") + * // rows equals [["one","two","three"],["four","five","six"]] + * @example + * // Though not a jQuery plugin, it is recommended to use with the $.ajax pipe() method: + * $.get("csv.txt") + * .pipe( CSV.parse ) + * .done( function(rows) { + * for( var i =0; i < rows.length; i++){ + * console.log(rows[i]) + * } + * }); + * @see http://www.ietf.org/rfc/rfc4180.txt + */ + CSV.parse = function (str) { + var result = CSV.result = []; + CSV.COLUMN_SEPARATOR = CSV.COLUMN_SEPARATOR instanceof RegExp ? new RegExp('^' + CSV.COLUMN_SEPARATOR.source) : CSV.COLUMN_SEPARATOR; + + CSV.offset = 0; + CSV.str = str; + CSV.record_begin(); + + CSV.debug("parse()", str); + + var c; + while (1) { + // pull char + c = str[CSV.offset++]; + CSV.debug("c", c); + + // detect eof + if (c == null) { + if (CSV.escaped) { + CSV.error(CSV.ERROR_EOF); + } + + if (CSV.record) { + CSV.token_end(); + CSV.record_end(); + } + + CSV.debug("...bail", c, CSV.state, CSV.record); + CSV.reset(); + break; + } + + if (CSV.record == null) { + // if relaxed mode, ignore blank lines + if (CSV.RELAXED && (c == LF || c == CR && str[CSV.offset + 1] == LF)) { + continue; + } + CSV.record_begin(); + } + + // pre-token: look for start of escape sequence + if (CSV.state == PRE_TOKEN) { + + if ((c === SPACE || c === TAB) && CSV.next_nonspace() == QUOTE) { + if (CSV.RELAXED || CSV.IGNORE_QUOTE_WHITESPACE) { + continue; + } else { + // not technically an error, but ambiguous and hard to debug otherwise + CSV.warn(CSV.WARN_SPACE); + } + } + + if (c == QUOTE && !CSV.IGNORE_QUOTES) { + CSV.debug("...escaped start", c); + CSV.escaped = true; + CSV.state = MID_TOKEN; + continue; + } + CSV.state = MID_TOKEN; + } + + // mid-token and escaped, look for sequences and end quote + if (CSV.state == MID_TOKEN && CSV.escaped) { + if (c == QUOTE) { + if (str[CSV.offset] == QUOTE) { + CSV.debug("...escaped quote", c); + CSV.token += QUOTE; + CSV.offset++; + } else { + CSV.debug("...escaped end", c); + CSV.escaped = false; + CSV.state = POST_TOKEN; + } + } else { + CSV.token += c; + CSV.debug("...escaped add", c, CSV.token); + } + continue; + } + + // fall-through: mid-token or post-token, not escaped + if (c == CR) { + if (str[CSV.offset] == LF) CSV.offset++;else if (!CSV.CARRIAGE_RETURN_OK) CSV.error(CSV.ERROR_CHAR); + CSV.token_end(); + CSV.record_end(); + } else if (c == LF) { + if (!(CSV.LINE_FEED_OK || CSV.RELAXED)) CSV.error(CSV.ERROR_CHAR); + CSV.token_end(); + CSV.record_end(); + } else if (CSV.test_regex_separator(str) || CSV.COLUMN_SEPARATOR == c) { + CSV.token_end(); + } else if (CSV.state == MID_TOKEN) { + CSV.token += c; + CSV.debug("...add", c, CSV.token); + } else if (c === SPACE || c === TAB) { + if (!CSV.IGNORE_QUOTE_WHITESPACE) CSV.error(CSV.WARN_SPACE); + } else if (!CSV.RELAXED) { + CSV.error(CSV.ERROR_CHAR); + } + } + return result; + }; + + /** + * @name CSV.stream + * @function + * @description stream a CSV file + * @example + * node -e "c=require('CSV-JS');require('fs').createReadStream('csv.txt').pipe(c.stream()).pipe(c.stream.json()).pipe(process.stdout)" + * @ignore + */ + CSV.stream = function () { + var stream = __webpack_require__(47); + var s = new stream.Transform({ objectMode: true }); + s.EOL = '\n'; + s.prior = ""; + s.emitter = function (s) { + return function (e) { + s.push(CSV.parse(e + s.EOL)); + }; + }(s); + + s._transform = function (chunk, encoding, done) { + var lines = this.prior == "" ? chunk.toString().split(this.EOL) : (this.prior + chunk.toString()).split(this.EOL); + this.prior = lines.pop(); + lines.forEach(this.emitter); + done(); + }; + + s._flush = function (done) { + if (this.prior != "") { + this.emitter(this.prior); + this.prior = ""; + } + done(); + }; + return s; + }; + + CSV.test_regex_separator = function (str) { + if (!(CSV.COLUMN_SEPARATOR instanceof RegExp)) { + return false; + } + + var match; + str = str.slice(CSV.offset - 1); + match = CSV.COLUMN_SEPARATOR.exec(str); + if (match) { + CSV.offset += match[0].length - 1; + } + + return match !== null; + }; + + CSV.stream.json = function () { + var os = __webpack_require__(187); + var stream = __webpack_require__(47); + var s = new streamTransform({ objectMode: true }); + s._transform = function (chunk, encoding, done) { + s.push(JSON.stringify(chunk.toString()) + os.EOL); + done(); + }; + return s; + }; + + CSV.reset = function () { + CSV.state = null; + CSV.token = null; + CSV.escaped = null; + CSV.record = null; + CSV.offset = null; + CSV.result = null; + CSV.str = null; + }; + + CSV.next_nonspace = function () { + var i = CSV.offset; + var c; + while (i < CSV.str.length) { + c = CSV.str[i++]; + if (!(c == SPACE || c === TAB)) { + return c; + } + } + return null; + }; + + CSV.record_begin = function () { + CSV.escaped = false; + CSV.record = []; + CSV.token_begin(); + CSV.debug("record_begin"); + }; + + CSV.record_end = function () { + CSV.state = POST_RECORD; + if (!(CSV.IGNORE_RECORD_LENGTH || CSV.RELAXED) && CSV.result.length > 0 && CSV.record.length != CSV.result[0].length) { + CSV.error(CSV.ERROR_EOL); + } + CSV.result.push(CSV.record); + CSV.debug("record end", CSV.record); + CSV.record = null; + }; + + CSV.resolve_type = function (token) { + if (token.match(/^[-+]?[0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?$/)) { + token = parseFloat(token); + } else if (token.match(/^(true|false)$/i)) { + token = Boolean(token.match(/true/i)); + } else if (token === "undefined") { + token = undefined; + } else if (token === "null") { + token = null; + } + return token; + }; + + CSV.token_begin = function () { + CSV.state = PRE_TOKEN; + // considered using array, but http://www.sitepen.com/blog/2008/05/09/string-performance-an-analysis/ + CSV.token = ""; + }; + + CSV.token_end = function () { + if (CSV.DETECT_TYPES) { + CSV.token = CSV.resolve_type(CSV.token); + } + CSV.record.push(CSV.token); + CSV.debug("token end", CSV.token); + CSV.token_begin(); + }; + + CSV.debug = function () { + if (CSV.DEBUG) console.log(arguments); + }; + + CSV.dump = function (msg) { + return [msg, "at char", CSV.offset, ":", CSV.str.substr(CSV.offset - 50, 50).replace(/\r/mg, "\\r").replace(/\n/mg, "\\n").replace(/\t/mg, "\\t")].join(" "); + }; + + CSV.error = function (err) { + var msg = CSV.dump(err); + CSV.reset(); + throw msg; + }; + + CSV.warn = function (err) { + if (!CSV.DEBUG) { + return; + } + + var msg = CSV.dump(err); + try { + console.warn(msg); + return; + } catch (e) {} + + try { + console.log(msg); + } catch (e) {} + }; + + // Node, PhantomJS, etc + // eg. var CSV = require("CSV"); CSV.parse(...); + if ( true && module.exports) { + module.exports = CSV; + } + + // CommonJS http://wiki.commonjs.org/wiki/Modules + // eg. var CSV = require("CSV").CSV; CSV.parse(...); + else if (true) { + exports.CSV = CSV; + } + + // AMD https://github.com/amdjs/amdjs-api/wiki/AMD + // eg. require(['./csv.js'], function (CSV) { CSV.parse(...); } ); + else {} +})(undefined); + +/***/ }), +/* 174 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.byteLength = byteLength +exports.toByteArray = toByteArray +exports.fromByteArray = fromByteArray + +var lookup = [] +var revLookup = [] +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array + +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i] + revLookup[code.charCodeAt(i)] = i +} + +// Support decoding URL-safe base64 strings, as Node.js does. +// See: https://en.wikipedia.org/wiki/Base64#URL_applications +revLookup['-'.charCodeAt(0)] = 62 +revLookup['_'.charCodeAt(0)] = 63 + +function getLens (b64) { + var len = b64.length + + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len + + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) + + return [validLen, placeHoldersLen] +} + +// base64 is 4/3 + up to two characters of the original data +function byteLength (b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function _byteLength (b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function toByteArray (b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) + + var curByte = 0 + + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen + + var i + for (i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + return arr +} + +function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + + lookup[num >> 12 & 0x3F] + + lookup[num >> 6 & 0x3F] + + lookup[num & 0x3F] +} + +function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + output.push(tripletToBase64(tmp)) + } + return output.join('') +} + +function fromByteArray (uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk( + uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) + )) + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) + } + + return parts.join('') +} + + +/***/ }), +/* 175 */ +/***/ (function(module, exports) { + +exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var nBits = -7 + var i = isLE ? (nBytes - 1) : 0 + var d = isLE ? -1 : 1 + var s = buffer[offset + i] + + i += d + + e = s & ((1 << (-nBits)) - 1) + s >>= (-nBits) + nBits += eLen + for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & ((1 << (-nBits)) - 1) + e >>= (-nBits) + nBits += mLen + for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen) + e = e - eBias + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) +} + +exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) + var i = isLE ? 0 : (nBytes - 1) + var d = isLE ? 1 : -1 + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 + + value = Math.abs(value) + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0 + e = eMax + } else { + e = Math.floor(Math.log(value) / Math.LN2) + if (value * (c = Math.pow(2, -e)) < 1) { + e-- + c *= 2 + } + if (e + eBias >= 1) { + value += rt / c + } else { + value += rt * Math.pow(2, 1 - eBias) + } + if (value * c >= 2) { + e++ + c /= 2 + } + + if (e + eBias >= eMax) { + m = 0 + e = eMax + } else if (e + eBias >= 1) { + m = ((value * c) - 1) * Math.pow(2, mLen) + e = e + eBias + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) + e = 0 + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = (e << mLen) | m + eLen += mLen + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128 +} + + +/***/ }), +/* 176 */ +/***/ (function(module, exports) { + +/* (ignored) */ + +/***/ }), +/* 177 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Buffer = __webpack_require__(20).Buffer; +var util = __webpack_require__(178); + +function copyBuffer(src, target, offset) { + src.copy(target, offset); +} + +module.exports = function () { + function BufferList() { + _classCallCheck(this, BufferList); + + this.head = null; + this.tail = null; + this.length = 0; + } + + BufferList.prototype.push = function push(v) { + var entry = { data: v, next: null }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + }; + + BufferList.prototype.unshift = function unshift(v) { + var entry = { data: v, next: this.head }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + }; + + BufferList.prototype.shift = function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + }; + + BufferList.prototype.clear = function clear() { + this.head = this.tail = null; + this.length = 0; + }; + + BufferList.prototype.join = function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) { + ret += s + p.data; + }return ret; + }; + + BufferList.prototype.concat = function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + if (this.length === 1) return this.head.data; + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + }; + + return BufferList; +}(); + +if (util && util.inspect && util.inspect.custom) { + module.exports.prototype[util.inspect.custom] = function () { + var obj = util.inspect({ length: this.length }); + return this.constructor.name + ' ' + obj; + }; +} + +/***/ }), +/* 178 */ +/***/ (function(module, exports) { + +/* (ignored) */ + +/***/ }), +/* 179 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) || + (typeof self !== "undefined" && self) || + window; +var apply = Function.prototype.apply; + +// DOM APIs, for completeness + +exports.setTimeout = function() { + return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout); +}; +exports.setInterval = function() { + return new Timeout(apply.call(setInterval, scope, arguments), clearInterval); +}; +exports.clearTimeout = +exports.clearInterval = function(timeout) { + if (timeout) { + timeout.close(); + } +}; + +function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; +} +Timeout.prototype.unref = Timeout.prototype.ref = function() {}; +Timeout.prototype.close = function() { + this._clearFn.call(scope, this._id); +}; + +// Does not start the time, just sets up the members needed. +exports.enroll = function(item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; +}; + +exports.unenroll = function(item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; +}; + +exports._unrefActive = exports.active = function(item) { + clearTimeout(item._idleTimeoutId); + + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } +}; + +// setimmediate attaches itself to the global object +__webpack_require__(180); +// On some exotic environments, it's not clear which object `setimmediate` was +// able to install onto. Search each possibility in the same order as the +// `setimmediate` library. +exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) || + (typeof global !== "undefined" && global.setImmediate) || + (this && this.setImmediate); +exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) || + (typeof global !== "undefined" && global.clearImmediate) || + (this && this.clearImmediate); + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11))) + +/***/ }), +/* 180 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) { + "use strict"; + + if (global.setImmediate) { + return; + } + + var nextHandle = 1; // Spec says greater than zero + var tasksByHandle = {}; + var currentlyRunningATask = false; + var doc = global.document; + var registerImmediate; + + function setImmediate(callback) { + // Callback can either be a function or a string + if (typeof callback !== "function") { + callback = new Function("" + callback); + } + // Copy function arguments + var args = new Array(arguments.length - 1); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i + 1]; + } + // Store and register the task + var task = { callback: callback, args: args }; + tasksByHandle[nextHandle] = task; + registerImmediate(nextHandle); + return nextHandle++; + } + + function clearImmediate(handle) { + delete tasksByHandle[handle]; + } + + function run(task) { + var callback = task.callback; + var args = task.args; + switch (args.length) { + case 0: + callback(); + break; + case 1: + callback(args[0]); + break; + case 2: + callback(args[0], args[1]); + break; + case 3: + callback(args[0], args[1], args[2]); + break; + default: + callback.apply(undefined, args); + break; + } + } + + function runIfPresent(handle) { + // From the spec: "Wait until any invocations of this algorithm started before this one have completed." + // So if we're currently running a task, we'll need to delay this invocation. + if (currentlyRunningATask) { + // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a + // "too much recursion" error. + setTimeout(runIfPresent, 0, handle); + } else { + var task = tasksByHandle[handle]; + if (task) { + currentlyRunningATask = true; + try { + run(task); + } finally { + clearImmediate(handle); + currentlyRunningATask = false; + } + } + } + } + + function installNextTickImplementation() { + registerImmediate = function(handle) { + process.nextTick(function () { runIfPresent(handle); }); + }; + } + + function canUsePostMessage() { + // The test against `importScripts` prevents this implementation from being installed inside a web worker, + // where `global.postMessage` means something completely different and can't be used for this purpose. + if (global.postMessage && !global.importScripts) { + var postMessageIsAsynchronous = true; + var oldOnMessage = global.onmessage; + global.onmessage = function() { + postMessageIsAsynchronous = false; + }; + global.postMessage("", "*"); + global.onmessage = oldOnMessage; + return postMessageIsAsynchronous; + } + } + + function installPostMessageImplementation() { + // Installs an event handler on `global` for the `message` event: see + // * https://developer.mozilla.org/en/DOM/window.postMessage + // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages + + var messagePrefix = "setImmediate$" + Math.random() + "$"; + var onGlobalMessage = function(event) { + if (event.source === global && + typeof event.data === "string" && + event.data.indexOf(messagePrefix) === 0) { + runIfPresent(+event.data.slice(messagePrefix.length)); + } + }; + + if (global.addEventListener) { + global.addEventListener("message", onGlobalMessage, false); + } else { + global.attachEvent("onmessage", onGlobalMessage); + } + + registerImmediate = function(handle) { + global.postMessage(messagePrefix + handle, "*"); + }; + } + + function installMessageChannelImplementation() { + var channel = new MessageChannel(); + channel.port1.onmessage = function(event) { + var handle = event.data; + runIfPresent(handle); + }; + + registerImmediate = function(handle) { + channel.port2.postMessage(handle); + }; + } + + function installReadyStateChangeImplementation() { + var html = doc.documentElement; + registerImmediate = function(handle) { + // Create a + * "; + * var result = util.encodeHTMLEntity(htmlEntityString); + * //"<script> alert('test');</script><a href='test'>" + */ + function encodeHTMLEntity(html) { + var entities = { + '"': 'quot', + '&': 'amp', + '<': 'lt', + '>': 'gt', + '\'': '#39' + }; + + return html.replace(/[<>&"']/g, function(m0) { + return entities[m0] ? '&' + entities[m0] + ';' : m0; + }); + } + + /** + * Return whether the string capable to transform into plain string is in the given string or not. + * @param {String} string - test string + * @memberof tui.util + * @returns {boolean} + */ + function hasEncodableString(string) { + return (/[<>&"']/).test(string); + } + + /** + * Return duplicate charters + * @param {string} operandStr1 The operand string + * @param {string} operandStr2 The operand string + * @private + * @memberof tui.util + * @returns {string} + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * util.getDuplicatedChar('fe dev', 'nhn entertainment'); // 'e' + * util.getDuplicatedChar('fdsa', 'asdf'); // 'asdf' + */ + function getDuplicatedChar(operandStr1, operandStr2) { + var i = 0; + var len = operandStr1.length; + var pool = {}; + var dupl, key; + + for (; i < len; i += 1) { + key = operandStr1.charAt(i); + pool[key] = 1; + } + + for (i = 0, len = operandStr2.length; i < len; i += 1) { + key = operandStr2.charAt(i); + if (pool[key]) { + pool[key] += 1; + } + } + + pool = collection.filter(pool, function(item) { + return item > 1; + }); + + pool = object.keys(pool).sort(); + dupl = pool.join(''); + + return dupl; + } + + module.exports = { + decodeHTMLEntity: decodeHTMLEntity, + encodeHTMLEntity: encodeHTMLEntity, + hasEncodableString: hasEncodableString, + getDuplicatedChar: getDuplicatedChar + }; + + +/***/ }), +/* 8 */ +/***/ (function(module, exports) { + + /** + * @fileoverview collections of some technic methods. + * @author NHN. + * FE Development Lab + */ + + 'use strict'; + + var tricks = {}; + var aps = Array.prototype.slice; + + /** + * Creates a debounced function that delays invoking fn until after delay milliseconds has elapsed + * since the last time the debouced function was invoked. + * @param {function} fn The function to debounce. + * @param {number} [delay=0] The number of milliseconds to delay + * @memberof tui.util + * @returns {function} debounced function. + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * function someMethodToInvokeDebounced() {} + * + * var debounced = util.debounce(someMethodToInvokeDebounced, 300); + * + * // invoke repeatedly + * debounced(); + * debounced(); + * debounced(); + * debounced(); + * debounced(); + * debounced(); // last invoke of debounced() + * + * // invoke someMethodToInvokeDebounced() after 300 milliseconds. + */ + function debounce(fn, delay) { + var timer, args; + + /* istanbul ignore next */ + delay = delay || 0; + + function debounced() { // eslint-disable-line require-jsdoc + args = aps.call(arguments); + + window.clearTimeout(timer); + timer = window.setTimeout(function() { + fn.apply(null, args); + }, delay); + } + + return debounced; + } + + /** + * return timestamp + * @memberof tui.util + * @returns {number} The number of milliseconds from Jan. 1970 00:00:00 (GMT) + */ + function timestamp() { + return Number(new Date()); + } + + /** + * Creates a throttled function that only invokes fn at most once per every interval milliseconds. + * + * You can use this throttle short time repeatedly invoking functions. (e.g MouseMove, Resize ...) + * + * if you need reuse throttled method. you must remove slugs (e.g. flag variable) related with throttling. + * @param {function} fn function to throttle + * @param {number} [interval=0] the number of milliseconds to throttle invocations to. + * @memberof tui.util + * @returns {function} throttled function + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * function someMethodToInvokeThrottled() {} + * + * var throttled = util.throttle(someMethodToInvokeThrottled, 300); + * + * // invoke repeatedly + * throttled(); // invoke (leading) + * throttled(); + * throttled(); // invoke (near 300 milliseconds) + * throttled(); + * throttled(); + * throttled(); // invoke (near 600 milliseconds) + * // ... + * // invoke (trailing) + * + * // if you need reuse throttled method. then invoke reset() + * throttled.reset(); + */ + function throttle(fn, interval) { + var base; + var isLeading = true; + var tick = function(_args) { + fn.apply(null, _args); + base = null; + }; + var debounced, stamp, args; + + /* istanbul ignore next */ + interval = interval || 0; + + debounced = tricks.debounce(tick, interval); + + function throttled() { // eslint-disable-line require-jsdoc + args = aps.call(arguments); + + if (isLeading) { + tick(args); + isLeading = false; + + return; + } + + stamp = tricks.timestamp(); + + base = base || stamp; + + // pass array directly because `debounce()`, `tick()` are already use + // `apply()` method to invoke developer's `fn` handler. + // + // also, this `debounced` line invoked every time for implements + // `trailing` features. + debounced(args); + + if ((stamp - base) >= interval) { + tick(args); + } + } + + function reset() { // eslint-disable-line require-jsdoc + isLeading = true; + base = null; + } + + throttled.reset = reset; + + return throttled; + } + + tricks.timestamp = timestamp; + tricks.debounce = debounce; + tricks.throttle = throttle; + + module.exports = tricks; + + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * @fileoverview This module has some functions for handling object as collection. + * @author NHN. + * FE Development Lab + */ + 'use strict'; + + var object = __webpack_require__(1); + var collection = __webpack_require__(4); + var type = __webpack_require__(2); + var ms7days = 7 * 24 * 60 * 60 * 1000; + + /** + * Check if the date has passed 7 days + * @param {number} date - milliseconds + * @returns {boolean} + * @ignore + */ + function isExpired(date) { + var now = new Date().getTime(); + + return now - date > ms7days; + } + + /** + * Send hostname on DOMContentLoaded. + * To prevent hostname set tui.usageStatistics to false. + * @param {string} appName - application name + * @param {string} trackingId - GA tracking ID + * @ignore + */ + function sendHostname(appName, trackingId) { + var url = 'https://www.google-analytics.com/collect'; + var hostname = location.hostname; + var hitType = 'event'; + var eventCategory = 'use'; + var applicationKeyForStorage = 'TOAST UI ' + appName + ' for ' + hostname + ': Statistics'; + var date = window.localStorage.getItem(applicationKeyForStorage); + + // skip if the flag is defined and is set to false explicitly + if (!type.isUndefined(window.tui) && window.tui.usageStatistics === false) { + return; + } + + // skip if not pass seven days old + if (date && !isExpired(date)) { + return; + } + + window.localStorage.setItem(applicationKeyForStorage, new Date().getTime()); + + setTimeout(function() { + if (document.readyState === 'interactive' || document.readyState === 'complete') { + imagePing(url, { + v: 1, + t: hitType, + tid: trackingId, + cid: hostname, + dp: hostname, + dh: appName, + el: appName, + ec: eventCategory + }); + } + }, 1000); + } + + /** + * Request image ping. + * @param {String} url url for ping request + * @param {Object} trackingInfo infos for make query string + * @returns {HTMLElement} + * @memberof tui.util + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * util.imagePing('https://www.google-analytics.com/collect', { + * v: 1, + * t: 'event', + * tid: 'trackingid', + * cid: 'cid', + * dp: 'dp', + * dh: 'dh' + * }); + */ + function imagePing(url, trackingInfo) { + var queryString = collection.map(object.keys(trackingInfo), function(key, index) { + var startWith = index === 0 ? '' : '&'; + + return startWith + key + '=' + trackingInfo[key]; + }).join(''); + var trackingElement = document.createElement('img'); + + trackingElement.src = url + '?' + queryString; + + trackingElement.style.display = 'none'; + document.body.appendChild(trackingElement); + document.body.removeChild(trackingElement); + + return trackingElement; + } + + module.exports = { + imagePing: imagePing, + sendHostname: sendHostname + }; + + +/***/ }), +/* 10 */ +/***/ (function(module, exports) { + + /** + * @fileoverview This module detects the kind of well-known browser and version. + * @author NHN. + * FE Development Lab + */ + + 'use strict'; + + /** + * This object has an information that indicate the kind of browser.
+ * The list below is a detectable browser list. + * - ie8 ~ ie11 + * - chrome + * - firefox + * - safari + * - edge + * @memberof tui.util + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * util.browser.chrome === true; // chrome + * util.browser.firefox === true; // firefox + * util.browser.safari === true; // safari + * util.browser.msie === true; // IE + * util.browser.edge === true; // edge + * util.browser.others === true; // other browser + * util.browser.version; // browser version + */ + var browser = { + chrome: false, + firefox: false, + safari: false, + msie: false, + edge: false, + others: false, + version: 0 + }; + + if (window && window.navigator) { + detectBrowser(); + } + + /** + * Detect the browser. + * @private + */ + function detectBrowser() { + var nav = window.navigator; + var appName = nav.appName.replace(/\s/g, '_'); + var userAgent = nav.userAgent; + + var rIE = /MSIE\s([0-9]+[.0-9]*)/; + var rIE11 = /Trident.*rv:11\./; + var rEdge = /Edge\/(\d+)\./; + var versionRegex = { + firefox: /Firefox\/(\d+)\./, + chrome: /Chrome\/(\d+)\./, + safari: /Version\/([\d.]+).*Safari\/(\d+)/ + }; + + var key, tmp; + + var detector = { + Microsoft_Internet_Explorer: function() { // eslint-disable-line camelcase + var detectedVersion = userAgent.match(rIE); + + if (detectedVersion) { // ie8 ~ ie10 + browser.msie = true; + browser.version = parseFloat(detectedVersion[1]); + } else { // no version information + browser.others = true; + } + }, + Netscape: function() { // eslint-disable-line complexity + var detected = false; + + if (rIE11.exec(userAgent)) { + browser.msie = true; + browser.version = 11; + detected = true; + } else if (rEdge.exec(userAgent)) { + browser.edge = true; + browser.version = userAgent.match(rEdge)[1]; + detected = true; + } else { + for (key in versionRegex) { + if (versionRegex.hasOwnProperty(key)) { + tmp = userAgent.match(versionRegex[key]); + if (tmp && tmp.length > 1) { // eslint-disable-line max-depth + browser[key] = detected = true; + browser.version = parseFloat(tmp[1] || 0); + break; + } + } + } + } + if (!detected) { + browser.others = true; + } + } + }; + + var fn = detector[appName]; + + if (fn) { + detector[appName](); + } + } + + module.exports = browser; + + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * @fileoverview This module has some methods for handling popup-window + * @author NHN. + * FE Development Lab + */ + + 'use strict'; + + var collection = __webpack_require__(4); + var type = __webpack_require__(2); + var func = __webpack_require__(5); + var browser = __webpack_require__(10); + var object = __webpack_require__(1); + + var popupId = 0; + + /** + * Popup management class + * @constructor + * @memberof tui.util + * @example + * // node, commonjs + * var popup = require('tui-code-snippet').popup; + * @example + * // distribution file, script + * + * + * + */ + function CustomEvents() { + /** + * @type {HandlerItem[]} + */ + this.events = null; + + /** + * only for checking specific context event was binded + * @type {object[]} + */ + this.contexts = null; + } + + /** + * Mixin custom events feature to specific constructor + * @param {function} func - constructor + * @example + * //-- #1. Get Module --// + * var CustomEvents = require('tui-code-snippet').CustomEvents; // node, commonjs + * var CustomEvents = tui.util.CustomEvents; // distribution file + * + * //-- #2. Use property --// + * var model; + * function Model() { + * this.name = ''; + * } + * CustomEvents.mixin(Model); + * + * model = new Model(); + * model.on('change', function() { this.name = 'model'; }, this); + * model.fire('change'); + * alert(model.name); // 'model'; + */ + CustomEvents.mixin = function(func) { + object.extend(func.prototype, CustomEvents.prototype); + }; + + /** + * Get HandlerItem object + * @param {function} handler - handler function + * @param {object} [context] - context for handler + * @returns {HandlerItem} HandlerItem object + * @private + */ + CustomEvents.prototype._getHandlerItem = function(handler, context) { + var item = {handler: handler}; + + if (context) { + item.context = context; + } + + return item; + }; + + /** + * Get event object safely + * @param {string} [eventName] - create sub event map if not exist. + * @returns {(object|array)} event object. if you supplied `eventName` + * parameter then make new array and return it + * @private + */ + CustomEvents.prototype._safeEvent = function(eventName) { + var events = this.events; + var byName; + + if (!events) { + events = this.events = {}; + } + + if (eventName) { + byName = events[eventName]; + + if (!byName) { + byName = []; + events[eventName] = byName; + } + + events = byName; + } + + return events; + }; + + /** + * Get context array safely + * @returns {array} context array + * @private + */ + CustomEvents.prototype._safeContext = function() { + var context = this.contexts; + + if (!context) { + context = this.contexts = []; + } + + return context; + }; + + /** + * Get index of context + * @param {object} ctx - context that used for bind custom event + * @returns {number} index of context + * @private + */ + CustomEvents.prototype._indexOfContext = function(ctx) { + var context = this._safeContext(); + var index = 0; + + while (context[index]) { + if (ctx === context[index][0]) { + return index; + } + + index += 1; + } + + return -1; + }; + + /** + * Memorize supplied context for recognize supplied object is context or + * name: handler pair object when off() + * @param {object} ctx - context object to memorize + * @private + */ + CustomEvents.prototype._memorizeContext = function(ctx) { + var context, index; + + if (!type.isExisty(ctx)) { + return; + } + + context = this._safeContext(); + index = this._indexOfContext(ctx); + + if (index > -1) { + context[index][1] += 1; + } else { + context.push([ctx, 1]); + } + }; + + /** + * Forget supplied context object + * @param {object} ctx - context object to forget + * @private + */ + CustomEvents.prototype._forgetContext = function(ctx) { + var context, contextIndex; + + if (!type.isExisty(ctx)) { + return; + } + + context = this._safeContext(); + contextIndex = this._indexOfContext(ctx); + + if (contextIndex > -1) { + context[contextIndex][1] -= 1; + + if (context[contextIndex][1] <= 0) { + context.splice(contextIndex, 1); + } + } + }; + + /** + * Bind event handler + * @param {(string|{name:string, handler:function})} eventName - custom + * event name or an object {eventName: handler} + * @param {(function|object)} [handler] - handler function or context + * @param {object} [context] - context for binding + * @private + */ + CustomEvents.prototype._bindEvent = function(eventName, handler, context) { + var events = this._safeEvent(eventName); + this._memorizeContext(context); + events.push(this._getHandlerItem(handler, context)); + }; + + /** + * Bind event handlers + * @param {(string|{name:string, handler:function})} eventName - custom + * event name or an object {eventName: handler} + * @param {(function|object)} [handler] - handler function or context + * @param {object} [context] - context for binding + * //-- #1. Get Module --// + * var CustomEvents = require('tui-code-snippet').CustomEvents; // node, commonjs + * var CustomEvents = tui.util.CustomEvents; // distribution file + * + * //-- #2. Use property --// + * // # 2.1 Basic Usage + * CustomEvents.on('onload', handler); + * + * // # 2.2 With context + * CustomEvents.on('onload', handler, myObj); + * + * // # 2.3 Bind by object that name, handler pairs + * CustomEvents.on({ + * 'play': handler, + * 'pause': handler2 + * }); + * + * // # 2.4 Bind by object that name, handler pairs with context object + * CustomEvents.on({ + * 'play': handler + * }, myObj); + */ + CustomEvents.prototype.on = function(eventName, handler, context) { + var self = this; + + if (type.isString(eventName)) { + // [syntax 1, 2] + eventName = eventName.split(R_EVENTNAME_SPLIT); + collection.forEach(eventName, function(name) { + self._bindEvent(name, handler, context); + }); + } else if (type.isObject(eventName)) { + // [syntax 3, 4] + context = handler; + collection.forEach(eventName, function(func, name) { + self.on(name, func, context); + }); + } + }; + + /** + * Bind one-shot event handlers + * @param {(string|{name:string,handler:function})} eventName - custom + * event name or an object {eventName: handler} + * @param {function|object} [handler] - handler function or context + * @param {object} [context] - context for binding + */ + CustomEvents.prototype.once = function(eventName, handler, context) { + var self = this; + + if (type.isObject(eventName)) { + context = handler; + collection.forEach(eventName, function(func, name) { + self.once(name, func, context); + }); + + return; + } + + function onceHandler() { // eslint-disable-line require-jsdoc + handler.apply(context, arguments); + self.off(eventName, onceHandler, context); + } + + this.on(eventName, onceHandler, context); + }; + + /** + * Splice supplied array by callback result + * @param {array} arr - array to splice + * @param {function} predicate - function return boolean + * @private + */ + CustomEvents.prototype._spliceMatches = function(arr, predicate) { + var i = 0; + var len; + + if (!type.isArray(arr)) { + return; + } + + for (len = arr.length; i < len; i += 1) { + if (predicate(arr[i]) === true) { + arr.splice(i, 1); + len -= 1; + i -= 1; + } + } + }; + + /** + * Get matcher for unbind specific handler events + * @param {function} handler - handler function + * @returns {function} handler matcher + * @private + */ + CustomEvents.prototype._matchHandler = function(handler) { + var self = this; + + return function(item) { + var needRemove = handler === item.handler; + + if (needRemove) { + self._forgetContext(item.context); + } + + return needRemove; + }; + }; + + /** + * Get matcher for unbind specific context events + * @param {object} context - context + * @returns {function} object matcher + * @private + */ + CustomEvents.prototype._matchContext = function(context) { + var self = this; + + return function(item) { + var needRemove = context === item.context; + + if (needRemove) { + self._forgetContext(item.context); + } + + return needRemove; + }; + }; + + /** + * Get matcher for unbind specific hander, context pair events + * @param {function} handler - handler function + * @param {object} context - context + * @returns {function} handler, context matcher + * @private + */ + CustomEvents.prototype._matchHandlerAndContext = function(handler, context) { + var self = this; + + return function(item) { + var matchHandler = (handler === item.handler); + var matchContext = (context === item.context); + var needRemove = (matchHandler && matchContext); + + if (needRemove) { + self._forgetContext(item.context); + } + + return needRemove; + }; + }; + + /** + * Unbind event by event name + * @param {string} eventName - custom event name to unbind + * @param {function} [handler] - handler function + * @private + */ + CustomEvents.prototype._offByEventName = function(eventName, handler) { + var self = this; + var forEach = collection.forEachArray; + var andByHandler = type.isFunction(handler); + var matchHandler = self._matchHandler(handler); + + eventName = eventName.split(R_EVENTNAME_SPLIT); + + forEach(eventName, function(name) { + var handlerItems = self._safeEvent(name); + + if (andByHandler) { + self._spliceMatches(handlerItems, matchHandler); + } else { + forEach(handlerItems, function(item) { + self._forgetContext(item.context); + }); + + self.events[name] = []; + } + }); + }; + + /** + * Unbind event by handler function + * @param {function} handler - handler function + * @private + */ + CustomEvents.prototype._offByHandler = function(handler) { + var self = this; + var matchHandler = this._matchHandler(handler); + + collection.forEach(this._safeEvent(), function(handlerItems) { + self._spliceMatches(handlerItems, matchHandler); + }); + }; + + /** + * Unbind event by object(name: handler pair object or context object) + * @param {object} obj - context or {name: handler} pair object + * @param {function} handler - handler function + * @private + */ + CustomEvents.prototype._offByObject = function(obj, handler) { + var self = this; + var matchFunc; + + if (this._indexOfContext(obj) < 0) { + collection.forEach(obj, function(func, name) { + self.off(name, func); + }); + } else if (type.isString(handler)) { + matchFunc = this._matchContext(obj); + + self._spliceMatches(this._safeEvent(handler), matchFunc); + } else if (type.isFunction(handler)) { + matchFunc = this._matchHandlerAndContext(handler, obj); + + collection.forEach(this._safeEvent(), function(handlerItems) { + self._spliceMatches(handlerItems, matchFunc); + }); + } else { + matchFunc = this._matchContext(obj); + + collection.forEach(this._safeEvent(), function(handlerItems) { + self._spliceMatches(handlerItems, matchFunc); + }); + } + }; + + /** + * Unbind custom events + * @param {(string|object|function)} eventName - event name or context or + * {name: handler} pair object or handler function + * @param {(function)} handler - handler function + * @example + * //-- #1. Get Module --// + * var CustomEvents = require('tui-code-snippet').CustomEvents; // node, commonjs + * var CustomEvents = tui.util.CustomEvents; // distribution file + * + * //-- #2. Use property --// + * // # 2.1 off by event name + * CustomEvents.off('onload'); + * + * // # 2.2 off by event name and handler + * CustomEvents.off('play', handler); + * + * // # 2.3 off by handler + * CustomEvents.off(handler); + * + * // # 2.4 off by context + * CustomEvents.off(myObj); + * + * // # 2.5 off by context and handler + * CustomEvents.off(myObj, handler); + * + * // # 2.6 off by context and event name + * CustomEvents.off(myObj, 'onload'); + * + * // # 2.7 off by an Object. that is {eventName: handler} + * CustomEvents.off({ + * 'play': handler, + * 'pause': handler2 + * }); + * + * // # 2.8 off the all events + * CustomEvents.off(); + */ + CustomEvents.prototype.off = function(eventName, handler) { + if (type.isString(eventName)) { + // [syntax 1, 2] + this._offByEventName(eventName, handler); + } else if (!arguments.length) { + // [syntax 8] + this.events = {}; + this.contexts = []; + } else if (type.isFunction(eventName)) { + // [syntax 3] + this._offByHandler(eventName); + } else if (type.isObject(eventName)) { + // [syntax 4, 5, 6] + this._offByObject(eventName, handler); + } + }; + + /** + * Fire custom event + * @param {string} eventName - name of custom event + */ + CustomEvents.prototype.fire = function(eventName) { // eslint-disable-line + this.invoke.apply(this, arguments); + }; + + /** + * Fire a event and returns the result of operation 'boolean AND' with all + * listener's results. + * + * So, It is different from {@link CustomEvents#fire}. + * + * In service code, use this as a before event in component level usually + * for notifying that the event is cancelable. + * @param {string} eventName - Custom event name + * @param {...*} data - Data for event + * @returns {boolean} The result of operation 'boolean AND' + * @example + * var map = new Map(); + * map.on({ + * 'beforeZoom': function() { + * // It should cancel the 'zoom' event by some conditions. + * if (that.disabled && this.getState()) { + * return false; + * } + * return true; + * } + * }); + * + * if (this.invoke('beforeZoom')) { // check the result of 'beforeZoom' + * // if true, + * // doSomething + * } + */ + CustomEvents.prototype.invoke = function(eventName) { + var events, args, index, item; + + if (!this.hasListener(eventName)) { + return true; + } + + events = this._safeEvent(eventName); + args = Array.prototype.slice.call(arguments, 1); + index = 0; + + while (events[index]) { + item = events[index]; + + if (item.handler.apply(item.context, args) === false) { + return false; + } + + index += 1; + } + + return true; + }; + + /** + * Return whether at least one of the handlers is registered in the given + * event name. + * @param {string} eventName - Custom event name + * @returns {boolean} Is there at least one handler in event name? + */ + CustomEvents.prototype.hasListener = function(eventName) { + return this.getListenerLength(eventName) > 0; + }; + + /** + * Return a count of events registered. + * @param {string} eventName - Custom event name + * @returns {number} number of event + */ + CustomEvents.prototype.getListenerLength = function(eventName) { + var events = this._safeEvent(eventName); + + return events.length; + }; + + module.exports = CustomEvents; + + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * @fileoverview This module provides a Enum Constructor. + * @author NHN. + * FE Development Lab + * @example + * // node, commonjs + * var Enum = require('tui-code-snippet').Enum; + * @example + * // distribution file, script + * + * + * + * + * + *
"; + * var result = util.encodeHTMLEntity(htmlEntityString); + * //"<script> alert('test');</script><a href='test'>" + */ + function encodeHTMLEntity(html) { + var entities = { + '"': 'quot', + '&': 'amp', + '<': 'lt', + '>': 'gt', + '\'': '#39' + }; + + return html.replace(/[<>&"']/g, function(m0) { + return entities[m0] ? '&' + entities[m0] + ';' : m0; + }); + } + + /** + * Return whether the string capable to transform into plain string is in the given string or not. + * @param {String} string - test string + * @memberof tui.util + * @returns {boolean} + */ + function hasEncodableString(string) { + return (/[<>&"']/).test(string); + } + + /** + * Return duplicate charters + * @param {string} operandStr1 The operand string + * @param {string} operandStr2 The operand string + * @private + * @memberof tui.util + * @returns {string} + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * util.getDuplicatedChar('fe dev', 'nhn entertainment'); // 'e' + * util.getDuplicatedChar('fdsa', 'asdf'); // 'asdf' + */ + function getDuplicatedChar(operandStr1, operandStr2) { + var i = 0; + var len = operandStr1.length; + var pool = {}; + var dupl, key; + + for (; i < len; i += 1) { + key = operandStr1.charAt(i); + pool[key] = 1; + } + + for (i = 0, len = operandStr2.length; i < len; i += 1) { + key = operandStr2.charAt(i); + if (pool[key]) { + pool[key] += 1; + } + } + + pool = collection.filter(pool, function(item) { + return item > 1; + }); + + pool = object.keys(pool).sort(); + dupl = pool.join(''); + + return dupl; + } + + module.exports = { + decodeHTMLEntity: decodeHTMLEntity, + encodeHTMLEntity: encodeHTMLEntity, + hasEncodableString: hasEncodableString, + getDuplicatedChar: getDuplicatedChar + }; + + +/***/ }), +/* 8 */ +/***/ (function(module, exports) { + + /** + * @fileoverview collections of some technic methods. + * @author NHN. + * FE Development Lab + */ + + 'use strict'; + + var tricks = {}; + var aps = Array.prototype.slice; + + /** + * Creates a debounced function that delays invoking fn until after delay milliseconds has elapsed + * since the last time the debouced function was invoked. + * @param {function} fn The function to debounce. + * @param {number} [delay=0] The number of milliseconds to delay + * @memberof tui.util + * @returns {function} debounced function. + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * function someMethodToInvokeDebounced() {} + * + * var debounced = util.debounce(someMethodToInvokeDebounced, 300); + * + * // invoke repeatedly + * debounced(); + * debounced(); + * debounced(); + * debounced(); + * debounced(); + * debounced(); // last invoke of debounced() + * + * // invoke someMethodToInvokeDebounced() after 300 milliseconds. + */ + function debounce(fn, delay) { + var timer, args; + + /* istanbul ignore next */ + delay = delay || 0; + + function debounced() { // eslint-disable-line require-jsdoc + args = aps.call(arguments); + + window.clearTimeout(timer); + timer = window.setTimeout(function() { + fn.apply(null, args); + }, delay); + } + + return debounced; + } + + /** + * return timestamp + * @memberof tui.util + * @returns {number} The number of milliseconds from Jan. 1970 00:00:00 (GMT) + */ + function timestamp() { + return Number(new Date()); + } + + /** + * Creates a throttled function that only invokes fn at most once per every interval milliseconds. + * + * You can use this throttle short time repeatedly invoking functions. (e.g MouseMove, Resize ...) + * + * if you need reuse throttled method. you must remove slugs (e.g. flag variable) related with throttling. + * @param {function} fn function to throttle + * @param {number} [interval=0] the number of milliseconds to throttle invocations to. + * @memberof tui.util + * @returns {function} throttled function + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * function someMethodToInvokeThrottled() {} + * + * var throttled = util.throttle(someMethodToInvokeThrottled, 300); + * + * // invoke repeatedly + * throttled(); // invoke (leading) + * throttled(); + * throttled(); // invoke (near 300 milliseconds) + * throttled(); + * throttled(); + * throttled(); // invoke (near 600 milliseconds) + * // ... + * // invoke (trailing) + * + * // if you need reuse throttled method. then invoke reset() + * throttled.reset(); + */ + function throttle(fn, interval) { + var base; + var isLeading = true; + var tick = function(_args) { + fn.apply(null, _args); + base = null; + }; + var debounced, stamp, args; + + /* istanbul ignore next */ + interval = interval || 0; + + debounced = tricks.debounce(tick, interval); + + function throttled() { // eslint-disable-line require-jsdoc + args = aps.call(arguments); + + if (isLeading) { + tick(args); + isLeading = false; + + return; + } + + stamp = tricks.timestamp(); + + base = base || stamp; + + // pass array directly because `debounce()`, `tick()` are already use + // `apply()` method to invoke developer's `fn` handler. + // + // also, this `debounced` line invoked every time for implements + // `trailing` features. + debounced(args); + + if ((stamp - base) >= interval) { + tick(args); + } + } + + function reset() { // eslint-disable-line require-jsdoc + isLeading = true; + base = null; + } + + throttled.reset = reset; + + return throttled; + } + + tricks.timestamp = timestamp; + tricks.debounce = debounce; + tricks.throttle = throttle; + + module.exports = tricks; + + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * @fileoverview This module has some functions for handling object as collection. + * @author NHN. + * FE Development Lab + */ + 'use strict'; + + var object = __webpack_require__(1); + var collection = __webpack_require__(4); + var type = __webpack_require__(2); + var ms7days = 7 * 24 * 60 * 60 * 1000; + + /** + * Check if the date has passed 7 days + * @param {number} date - milliseconds + * @returns {boolean} + * @ignore + */ + function isExpired(date) { + var now = new Date().getTime(); + + return now - date > ms7days; + } + + /** + * Send hostname on DOMContentLoaded. + * To prevent hostname set tui.usageStatistics to false. + * @param {string} appName - application name + * @param {string} trackingId - GA tracking ID + * @ignore + */ + function sendHostname(appName, trackingId) { + var url = 'https://www.google-analytics.com/collect'; + var hostname = location.hostname; + var hitType = 'event'; + var eventCategory = 'use'; + var applicationKeyForStorage = 'TOAST UI ' + appName + ' for ' + hostname + ': Statistics'; + var date = window.localStorage.getItem(applicationKeyForStorage); + + // skip if the flag is defined and is set to false explicitly + if (!type.isUndefined(window.tui) && window.tui.usageStatistics === false) { + return; + } + + // skip if not pass seven days old + if (date && !isExpired(date)) { + return; + } + + window.localStorage.setItem(applicationKeyForStorage, new Date().getTime()); + + setTimeout(function() { + if (document.readyState === 'interactive' || document.readyState === 'complete') { + imagePing(url, { + v: 1, + t: hitType, + tid: trackingId, + cid: hostname, + dp: hostname, + dh: appName, + el: appName, + ec: eventCategory + }); + } + }, 1000); + } + + /** + * Request image ping. + * @param {String} url url for ping request + * @param {Object} trackingInfo infos for make query string + * @returns {HTMLElement} + * @memberof tui.util + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * util.imagePing('https://www.google-analytics.com/collect', { + * v: 1, + * t: 'event', + * tid: 'trackingid', + * cid: 'cid', + * dp: 'dp', + * dh: 'dh' + * }); + */ + function imagePing(url, trackingInfo) { + var queryString = collection.map(object.keys(trackingInfo), function(key, index) { + var startWith = index === 0 ? '' : '&'; + + return startWith + key + '=' + trackingInfo[key]; + }).join(''); + var trackingElement = document.createElement('img'); + + trackingElement.src = url + '?' + queryString; + + trackingElement.style.display = 'none'; + document.body.appendChild(trackingElement); + document.body.removeChild(trackingElement); + + return trackingElement; + } + + module.exports = { + imagePing: imagePing, + sendHostname: sendHostname + }; + + +/***/ }), +/* 10 */ +/***/ (function(module, exports) { + + /** + * @fileoverview This module detects the kind of well-known browser and version. + * @author NHN. + * FE Development Lab + */ + + 'use strict'; + + /** + * This object has an information that indicate the kind of browser.
+ * The list below is a detectable browser list. + * - ie8 ~ ie11 + * - chrome + * - firefox + * - safari + * - edge + * @memberof tui.util + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * util.browser.chrome === true; // chrome + * util.browser.firefox === true; // firefox + * util.browser.safari === true; // safari + * util.browser.msie === true; // IE + * util.browser.edge === true; // edge + * util.browser.others === true; // other browser + * util.browser.version; // browser version + */ + var browser = { + chrome: false, + firefox: false, + safari: false, + msie: false, + edge: false, + others: false, + version: 0 + }; + + if (window && window.navigator) { + detectBrowser(); + } + + /** + * Detect the browser. + * @private + */ + function detectBrowser() { + var nav = window.navigator; + var appName = nav.appName.replace(/\s/g, '_'); + var userAgent = nav.userAgent; + + var rIE = /MSIE\s([0-9]+[.0-9]*)/; + var rIE11 = /Trident.*rv:11\./; + var rEdge = /Edge\/(\d+)\./; + var versionRegex = { + firefox: /Firefox\/(\d+)\./, + chrome: /Chrome\/(\d+)\./, + safari: /Version\/([\d.]+).*Safari\/(\d+)/ + }; + + var key, tmp; + + var detector = { + Microsoft_Internet_Explorer: function() { // eslint-disable-line camelcase + var detectedVersion = userAgent.match(rIE); + + if (detectedVersion) { // ie8 ~ ie10 + browser.msie = true; + browser.version = parseFloat(detectedVersion[1]); + } else { // no version information + browser.others = true; + } + }, + Netscape: function() { // eslint-disable-line complexity + var detected = false; + + if (rIE11.exec(userAgent)) { + browser.msie = true; + browser.version = 11; + detected = true; + } else if (rEdge.exec(userAgent)) { + browser.edge = true; + browser.version = userAgent.match(rEdge)[1]; + detected = true; + } else { + for (key in versionRegex) { + if (versionRegex.hasOwnProperty(key)) { + tmp = userAgent.match(versionRegex[key]); + if (tmp && tmp.length > 1) { // eslint-disable-line max-depth + browser[key] = detected = true; + browser.version = parseFloat(tmp[1] || 0); + break; + } + } + } + } + if (!detected) { + browser.others = true; + } + } + }; + + var fn = detector[appName]; + + if (fn) { + detector[appName](); + } + } + + module.exports = browser; + + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * @fileoverview This module has some methods for handling popup-window + * @author NHN. + * FE Development Lab + */ + + 'use strict'; + + var collection = __webpack_require__(4); + var type = __webpack_require__(2); + var func = __webpack_require__(5); + var browser = __webpack_require__(10); + var object = __webpack_require__(1); + + var popupId = 0; + + /** + * Popup management class + * @constructor + * @memberof tui.util + * @example + * // node, commonjs + * var popup = require('tui-code-snippet').popup; + * @example + * // distribution file, script + * + * + * + */ + function CustomEvents() { + /** + * @type {HandlerItem[]} + */ + this.events = null; + + /** + * only for checking specific context event was binded + * @type {object[]} + */ + this.contexts = null; + } + + /** + * Mixin custom events feature to specific constructor + * @param {function} func - constructor + * @example + * //-- #1. Get Module --// + * var CustomEvents = require('tui-code-snippet').CustomEvents; // node, commonjs + * var CustomEvents = tui.util.CustomEvents; // distribution file + * + * //-- #2. Use property --// + * var model; + * function Model() { + * this.name = ''; + * } + * CustomEvents.mixin(Model); + * + * model = new Model(); + * model.on('change', function() { this.name = 'model'; }, this); + * model.fire('change'); + * alert(model.name); // 'model'; + */ + CustomEvents.mixin = function(func) { + object.extend(func.prototype, CustomEvents.prototype); + }; + + /** + * Get HandlerItem object + * @param {function} handler - handler function + * @param {object} [context] - context for handler + * @returns {HandlerItem} HandlerItem object + * @private + */ + CustomEvents.prototype._getHandlerItem = function(handler, context) { + var item = {handler: handler}; + + if (context) { + item.context = context; + } + + return item; + }; + + /** + * Get event object safely + * @param {string} [eventName] - create sub event map if not exist. + * @returns {(object|array)} event object. if you supplied `eventName` + * parameter then make new array and return it + * @private + */ + CustomEvents.prototype._safeEvent = function(eventName) { + var events = this.events; + var byName; + + if (!events) { + events = this.events = {}; + } + + if (eventName) { + byName = events[eventName]; + + if (!byName) { + byName = []; + events[eventName] = byName; + } + + events = byName; + } + + return events; + }; + + /** + * Get context array safely + * @returns {array} context array + * @private + */ + CustomEvents.prototype._safeContext = function() { + var context = this.contexts; + + if (!context) { + context = this.contexts = []; + } + + return context; + }; + + /** + * Get index of context + * @param {object} ctx - context that used for bind custom event + * @returns {number} index of context + * @private + */ + CustomEvents.prototype._indexOfContext = function(ctx) { + var context = this._safeContext(); + var index = 0; + + while (context[index]) { + if (ctx === context[index][0]) { + return index; + } + + index += 1; + } + + return -1; + }; + + /** + * Memorize supplied context for recognize supplied object is context or + * name: handler pair object when off() + * @param {object} ctx - context object to memorize + * @private + */ + CustomEvents.prototype._memorizeContext = function(ctx) { + var context, index; + + if (!type.isExisty(ctx)) { + return; + } + + context = this._safeContext(); + index = this._indexOfContext(ctx); + + if (index > -1) { + context[index][1] += 1; + } else { + context.push([ctx, 1]); + } + }; + + /** + * Forget supplied context object + * @param {object} ctx - context object to forget + * @private + */ + CustomEvents.prototype._forgetContext = function(ctx) { + var context, contextIndex; + + if (!type.isExisty(ctx)) { + return; + } + + context = this._safeContext(); + contextIndex = this._indexOfContext(ctx); + + if (contextIndex > -1) { + context[contextIndex][1] -= 1; + + if (context[contextIndex][1] <= 0) { + context.splice(contextIndex, 1); + } + } + }; + + /** + * Bind event handler + * @param {(string|{name:string, handler:function})} eventName - custom + * event name or an object {eventName: handler} + * @param {(function|object)} [handler] - handler function or context + * @param {object} [context] - context for binding + * @private + */ + CustomEvents.prototype._bindEvent = function(eventName, handler, context) { + var events = this._safeEvent(eventName); + this._memorizeContext(context); + events.push(this._getHandlerItem(handler, context)); + }; + + /** + * Bind event handlers + * @param {(string|{name:string, handler:function})} eventName - custom + * event name or an object {eventName: handler} + * @param {(function|object)} [handler] - handler function or context + * @param {object} [context] - context for binding + * //-- #1. Get Module --// + * var CustomEvents = require('tui-code-snippet').CustomEvents; // node, commonjs + * var CustomEvents = tui.util.CustomEvents; // distribution file + * + * //-- #2. Use property --// + * // # 2.1 Basic Usage + * CustomEvents.on('onload', handler); + * + * // # 2.2 With context + * CustomEvents.on('onload', handler, myObj); + * + * // # 2.3 Bind by object that name, handler pairs + * CustomEvents.on({ + * 'play': handler, + * 'pause': handler2 + * }); + * + * // # 2.4 Bind by object that name, handler pairs with context object + * CustomEvents.on({ + * 'play': handler + * }, myObj); + */ + CustomEvents.prototype.on = function(eventName, handler, context) { + var self = this; + + if (type.isString(eventName)) { + // [syntax 1, 2] + eventName = eventName.split(R_EVENTNAME_SPLIT); + collection.forEach(eventName, function(name) { + self._bindEvent(name, handler, context); + }); + } else if (type.isObject(eventName)) { + // [syntax 3, 4] + context = handler; + collection.forEach(eventName, function(func, name) { + self.on(name, func, context); + }); + } + }; + + /** + * Bind one-shot event handlers + * @param {(string|{name:string,handler:function})} eventName - custom + * event name or an object {eventName: handler} + * @param {function|object} [handler] - handler function or context + * @param {object} [context] - context for binding + */ + CustomEvents.prototype.once = function(eventName, handler, context) { + var self = this; + + if (type.isObject(eventName)) { + context = handler; + collection.forEach(eventName, function(func, name) { + self.once(name, func, context); + }); + + return; + } + + function onceHandler() { // eslint-disable-line require-jsdoc + handler.apply(context, arguments); + self.off(eventName, onceHandler, context); + } + + this.on(eventName, onceHandler, context); + }; + + /** + * Splice supplied array by callback result + * @param {array} arr - array to splice + * @param {function} predicate - function return boolean + * @private + */ + CustomEvents.prototype._spliceMatches = function(arr, predicate) { + var i = 0; + var len; + + if (!type.isArray(arr)) { + return; + } + + for (len = arr.length; i < len; i += 1) { + if (predicate(arr[i]) === true) { + arr.splice(i, 1); + len -= 1; + i -= 1; + } + } + }; + + /** + * Get matcher for unbind specific handler events + * @param {function} handler - handler function + * @returns {function} handler matcher + * @private + */ + CustomEvents.prototype._matchHandler = function(handler) { + var self = this; + + return function(item) { + var needRemove = handler === item.handler; + + if (needRemove) { + self._forgetContext(item.context); + } + + return needRemove; + }; + }; + + /** + * Get matcher for unbind specific context events + * @param {object} context - context + * @returns {function} object matcher + * @private + */ + CustomEvents.prototype._matchContext = function(context) { + var self = this; + + return function(item) { + var needRemove = context === item.context; + + if (needRemove) { + self._forgetContext(item.context); + } + + return needRemove; + }; + }; + + /** + * Get matcher for unbind specific hander, context pair events + * @param {function} handler - handler function + * @param {object} context - context + * @returns {function} handler, context matcher + * @private + */ + CustomEvents.prototype._matchHandlerAndContext = function(handler, context) { + var self = this; + + return function(item) { + var matchHandler = (handler === item.handler); + var matchContext = (context === item.context); + var needRemove = (matchHandler && matchContext); + + if (needRemove) { + self._forgetContext(item.context); + } + + return needRemove; + }; + }; + + /** + * Unbind event by event name + * @param {string} eventName - custom event name to unbind + * @param {function} [handler] - handler function + * @private + */ + CustomEvents.prototype._offByEventName = function(eventName, handler) { + var self = this; + var forEach = collection.forEachArray; + var andByHandler = type.isFunction(handler); + var matchHandler = self._matchHandler(handler); + + eventName = eventName.split(R_EVENTNAME_SPLIT); + + forEach(eventName, function(name) { + var handlerItems = self._safeEvent(name); + + if (andByHandler) { + self._spliceMatches(handlerItems, matchHandler); + } else { + forEach(handlerItems, function(item) { + self._forgetContext(item.context); + }); + + self.events[name] = []; + } + }); + }; + + /** + * Unbind event by handler function + * @param {function} handler - handler function + * @private + */ + CustomEvents.prototype._offByHandler = function(handler) { + var self = this; + var matchHandler = this._matchHandler(handler); + + collection.forEach(this._safeEvent(), function(handlerItems) { + self._spliceMatches(handlerItems, matchHandler); + }); + }; + + /** + * Unbind event by object(name: handler pair object or context object) + * @param {object} obj - context or {name: handler} pair object + * @param {function} handler - handler function + * @private + */ + CustomEvents.prototype._offByObject = function(obj, handler) { + var self = this; + var matchFunc; + + if (this._indexOfContext(obj) < 0) { + collection.forEach(obj, function(func, name) { + self.off(name, func); + }); + } else if (type.isString(handler)) { + matchFunc = this._matchContext(obj); + + self._spliceMatches(this._safeEvent(handler), matchFunc); + } else if (type.isFunction(handler)) { + matchFunc = this._matchHandlerAndContext(handler, obj); + + collection.forEach(this._safeEvent(), function(handlerItems) { + self._spliceMatches(handlerItems, matchFunc); + }); + } else { + matchFunc = this._matchContext(obj); + + collection.forEach(this._safeEvent(), function(handlerItems) { + self._spliceMatches(handlerItems, matchFunc); + }); + } + }; + + /** + * Unbind custom events + * @param {(string|object|function)} eventName - event name or context or + * {name: handler} pair object or handler function + * @param {(function)} handler - handler function + * @example + * //-- #1. Get Module --// + * var CustomEvents = require('tui-code-snippet').CustomEvents; // node, commonjs + * var CustomEvents = tui.util.CustomEvents; // distribution file + * + * //-- #2. Use property --// + * // # 2.1 off by event name + * CustomEvents.off('onload'); + * + * // # 2.2 off by event name and handler + * CustomEvents.off('play', handler); + * + * // # 2.3 off by handler + * CustomEvents.off(handler); + * + * // # 2.4 off by context + * CustomEvents.off(myObj); + * + * // # 2.5 off by context and handler + * CustomEvents.off(myObj, handler); + * + * // # 2.6 off by context and event name + * CustomEvents.off(myObj, 'onload'); + * + * // # 2.7 off by an Object. that is {eventName: handler} + * CustomEvents.off({ + * 'play': handler, + * 'pause': handler2 + * }); + * + * // # 2.8 off the all events + * CustomEvents.off(); + */ + CustomEvents.prototype.off = function(eventName, handler) { + if (type.isString(eventName)) { + // [syntax 1, 2] + this._offByEventName(eventName, handler); + } else if (!arguments.length) { + // [syntax 8] + this.events = {}; + this.contexts = []; + } else if (type.isFunction(eventName)) { + // [syntax 3] + this._offByHandler(eventName); + } else if (type.isObject(eventName)) { + // [syntax 4, 5, 6] + this._offByObject(eventName, handler); + } + }; + + /** + * Fire custom event + * @param {string} eventName - name of custom event + */ + CustomEvents.prototype.fire = function(eventName) { // eslint-disable-line + this.invoke.apply(this, arguments); + }; + + /** + * Fire a event and returns the result of operation 'boolean AND' with all + * listener's results. + * + * So, It is different from {@link CustomEvents#fire}. + * + * In service code, use this as a before event in component level usually + * for notifying that the event is cancelable. + * @param {string} eventName - Custom event name + * @param {...*} data - Data for event + * @returns {boolean} The result of operation 'boolean AND' + * @example + * var map = new Map(); + * map.on({ + * 'beforeZoom': function() { + * // It should cancel the 'zoom' event by some conditions. + * if (that.disabled && this.getState()) { + * return false; + * } + * return true; + * } + * }); + * + * if (this.invoke('beforeZoom')) { // check the result of 'beforeZoom' + * // if true, + * // doSomething + * } + */ + CustomEvents.prototype.invoke = function(eventName) { + var events, args, index, item; + + if (!this.hasListener(eventName)) { + return true; + } + + events = this._safeEvent(eventName); + args = Array.prototype.slice.call(arguments, 1); + index = 0; + + while (events[index]) { + item = events[index]; + + if (item.handler.apply(item.context, args) === false) { + return false; + } + + index += 1; + } + + return true; + }; + + /** + * Return whether at least one of the handlers is registered in the given + * event name. + * @param {string} eventName - Custom event name + * @returns {boolean} Is there at least one handler in event name? + */ + CustomEvents.prototype.hasListener = function(eventName) { + return this.getListenerLength(eventName) > 0; + }; + + /** + * Return a count of events registered. + * @param {string} eventName - Custom event name + * @returns {number} number of event + */ + CustomEvents.prototype.getListenerLength = function(eventName) { + var events = this._safeEvent(eventName); + + return events.length; + }; + + module.exports = CustomEvents; + + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * @fileoverview This module provides a Enum Constructor. + * @author NHN. + * FE Development Lab + * @example + * // node, commonjs + * var Enum = require('tui-code-snippet').Enum; + * @example + * // distribution file, script + * + * + * + * + * + *
"; + * var result = util.encodeHTMLEntity(htmlEntityString); + * //"<script> alert('test');</script><a href='test'>" + */ + function encodeHTMLEntity(html) { + var entities = { + '"': 'quot', + '&': 'amp', + '<': 'lt', + '>': 'gt', + '\'': '#39' + }; + + return html.replace(/[<>&"']/g, function(m0) { + return entities[m0] ? '&' + entities[m0] + ';' : m0; + }); + } + + /** + * Return whether the string capable to transform into plain string is in the given string or not. + * @param {String} string - test string + * @memberof tui.util + * @returns {boolean} + */ + function hasEncodableString(string) { + return (/[<>&"']/).test(string); + } + + /** + * Return duplicate charters + * @param {string} operandStr1 The operand string + * @param {string} operandStr2 The operand string + * @private + * @memberof tui.util + * @returns {string} + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * util.getDuplicatedChar('fe dev', 'nhn entertainment'); // 'e' + * util.getDuplicatedChar('fdsa', 'asdf'); // 'asdf' + */ + function getDuplicatedChar(operandStr1, operandStr2) { + var i = 0; + var len = operandStr1.length; + var pool = {}; + var dupl, key; + + for (; i < len; i += 1) { + key = operandStr1.charAt(i); + pool[key] = 1; + } + + for (i = 0, len = operandStr2.length; i < len; i += 1) { + key = operandStr2.charAt(i); + if (pool[key]) { + pool[key] += 1; + } + } + + pool = collection.filter(pool, function(item) { + return item > 1; + }); + + pool = object.keys(pool).sort(); + dupl = pool.join(''); + + return dupl; + } + + module.exports = { + decodeHTMLEntity: decodeHTMLEntity, + encodeHTMLEntity: encodeHTMLEntity, + hasEncodableString: hasEncodableString, + getDuplicatedChar: getDuplicatedChar + }; /***/ }), /* 8 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * @fileoverview Check whether the given variable is a string or not. - * @author NHN FE Development Lab - */ - - - -/** - * Check whether the given variable is a string or not. - * If the given variable is a string, return true. - * @param {*} obj - Target for checking - * @returns {boolean} Is string? - * @memberof module:type - */ -function isString(obj) { - return typeof obj === 'string' || obj instanceof String; -} - -module.exports = isString; +/***/ (function(module, exports) { + + /** + * @fileoverview collections of some technic methods. + * @author NHN. + * FE Development Lab + */ + + 'use strict'; + + var tricks = {}; + var aps = Array.prototype.slice; + + /** + * Creates a debounced function that delays invoking fn until after delay milliseconds has elapsed + * since the last time the debouced function was invoked. + * @param {function} fn The function to debounce. + * @param {number} [delay=0] The number of milliseconds to delay + * @memberof tui.util + * @returns {function} debounced function. + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * function someMethodToInvokeDebounced() {} + * + * var debounced = util.debounce(someMethodToInvokeDebounced, 300); + * + * // invoke repeatedly + * debounced(); + * debounced(); + * debounced(); + * debounced(); + * debounced(); + * debounced(); // last invoke of debounced() + * + * // invoke someMethodToInvokeDebounced() after 300 milliseconds. + */ + function debounce(fn, delay) { + var timer, args; + + /* istanbul ignore next */ + delay = delay || 0; + + function debounced() { // eslint-disable-line require-jsdoc + args = aps.call(arguments); + + window.clearTimeout(timer); + timer = window.setTimeout(function() { + fn.apply(null, args); + }, delay); + } + + return debounced; + } + + /** + * return timestamp + * @memberof tui.util + * @returns {number} The number of milliseconds from Jan. 1970 00:00:00 (GMT) + */ + function timestamp() { + return Number(new Date()); + } + + /** + * Creates a throttled function that only invokes fn at most once per every interval milliseconds. + * + * You can use this throttle short time repeatedly invoking functions. (e.g MouseMove, Resize ...) + * + * if you need reuse throttled method. you must remove slugs (e.g. flag variable) related with throttling. + * @param {function} fn function to throttle + * @param {number} [interval=0] the number of milliseconds to throttle invocations to. + * @memberof tui.util + * @returns {function} throttled function + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * function someMethodToInvokeThrottled() {} + * + * var throttled = util.throttle(someMethodToInvokeThrottled, 300); + * + * // invoke repeatedly + * throttled(); // invoke (leading) + * throttled(); + * throttled(); // invoke (near 300 milliseconds) + * throttled(); + * throttled(); + * throttled(); // invoke (near 600 milliseconds) + * // ... + * // invoke (trailing) + * + * // if you need reuse throttled method. then invoke reset() + * throttled.reset(); + */ + function throttle(fn, interval) { + var base; + var isLeading = true; + var tick = function(_args) { + fn.apply(null, _args); + base = null; + }; + var debounced, stamp, args; + + /* istanbul ignore next */ + interval = interval || 0; + + debounced = tricks.debounce(tick, interval); + + function throttled() { // eslint-disable-line require-jsdoc + args = aps.call(arguments); + + if (isLeading) { + tick(args); + isLeading = false; + + return; + } + + stamp = tricks.timestamp(); + + base = base || stamp; + + // pass array directly because `debounce()`, `tick()` are already use + // `apply()` method to invoke developer's `fn` handler. + // + // also, this `debounced` line invoked every time for implements + // `trailing` features. + debounced(args); + + if ((stamp - base) >= interval) { + tick(args); + } + } + + function reset() { // eslint-disable-line require-jsdoc + isLeading = true; + base = null; + } + + throttled.reset = reset; + + return throttled; + } + + tricks.timestamp = timestamp; + tricks.debounce = debounce; + tricks.throttle = throttle; + + module.exports = tricks; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; -/** - * @fileoverview Check whether the given variable is existing or not. - * @author NHN FE Development Lab - */ - - - -var isUndefined = __webpack_require__(2); -var isNull = __webpack_require__(11); - -/** - * Check whether the given variable is existing or not. - * If the given variable is not null and not undefined, returns true. - * @param {*} param - Target for checking - * @returns {boolean} Is existy? - * @memberof module:type - * @example - * var isExisty = require('tui-code-snippet/type/isExisty'); // node, commonjs - * - * isExisty(''); //true - * isExisty(0); //true - * isExisty([]); //true - * isExisty({}); //true - * isExisty(null); //false - * isExisty(undefined); //false -*/ -function isExisty(param) { - return !isUndefined(param) && !isNull(param); -} - -module.exports = isExisty; + /** + * @fileoverview This module has some functions for handling object as collection. + * @author NHN. + * FE Development Lab + */ + 'use strict'; + + var object = __webpack_require__(1); + var collection = __webpack_require__(4); + var type = __webpack_require__(2); + var ms7days = 7 * 24 * 60 * 60 * 1000; + + /** + * Check if the date has passed 7 days + * @param {number} date - milliseconds + * @returns {boolean} + * @ignore + */ + function isExpired(date) { + var now = new Date().getTime(); + + return now - date > ms7days; + } + + /** + * Send hostname on DOMContentLoaded. + * To prevent hostname set tui.usageStatistics to false. + * @param {string} appName - application name + * @param {string} trackingId - GA tracking ID + * @ignore + */ + function sendHostname(appName, trackingId) { + var url = 'https://www.google-analytics.com/collect'; + var hostname = location.hostname; + var hitType = 'event'; + var eventCategory = 'use'; + var applicationKeyForStorage = 'TOAST UI ' + appName + ' for ' + hostname + ': Statistics'; + var date = window.localStorage.getItem(applicationKeyForStorage); + + // skip if the flag is defined and is set to false explicitly + if (!type.isUndefined(window.tui) && window.tui.usageStatistics === false) { + return; + } + + // skip if not pass seven days old + if (date && !isExpired(date)) { + return; + } + + window.localStorage.setItem(applicationKeyForStorage, new Date().getTime()); + + setTimeout(function() { + if (document.readyState === 'interactive' || document.readyState === 'complete') { + imagePing(url, { + v: 1, + t: hitType, + tid: trackingId, + cid: hostname, + dp: hostname, + dh: appName, + el: appName, + ec: eventCategory + }); + } + }, 1000); + } + + /** + * Request image ping. + * @param {String} url url for ping request + * @param {Object} trackingInfo infos for make query string + * @returns {HTMLElement} + * @memberof tui.util + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * util.imagePing('https://www.google-analytics.com/collect', { + * v: 1, + * t: 'event', + * tid: 'trackingid', + * cid: 'cid', + * dp: 'dp', + * dh: 'dh' + * }); + */ + function imagePing(url, trackingInfo) { + var queryString = collection.map(object.keys(trackingInfo), function(key, index) { + var startWith = index === 0 ? '' : '&'; + + return startWith + key + '=' + trackingInfo[key]; + }).join(''); + var trackingElement = document.createElement('img'); + + trackingElement.src = url + '?' + queryString; + + trackingElement.style.display = 'none'; + document.body.appendChild(trackingElement); + document.body.removeChild(trackingElement); + + return trackingElement; + } + + module.exports = { + imagePing: imagePing, + sendHostname: sendHostname + }; /***/ }), /* 10 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * @fileoverview Get HTML element's design classes. - * @author NHN FE Development Lab - */ - - - -var isUndefined = __webpack_require__(2); - -/** - * Get HTML element's design classes. - * @param {(HTMLElement|SVGElement)} element target element - * @returns {string} element css class name - * @memberof module:domUtil - */ -function getClass(element) { - if (!element || !element.className) { - return ''; - } - - if (isUndefined(element.className.baseVal)) { - return element.className; - } - - return element.className.baseVal; -} - -module.exports = getClass; +/***/ (function(module, exports) { + + /** + * @fileoverview This module detects the kind of well-known browser and version. + * @author NHN. + * FE Development Lab + */ + + 'use strict'; + + /** + * This object has an information that indicate the kind of browser.
+ * The list below is a detectable browser list. + * - ie8 ~ ie11 + * - chrome + * - firefox + * - safari + * - edge + * @memberof tui.util + * @example + * //-- #1. Get Module --// + * var util = require('tui-code-snippet'); // node, commonjs + * var util = tui.util; // distribution file + * + * //-- #2. Use property --// + * util.browser.chrome === true; // chrome + * util.browser.firefox === true; // firefox + * util.browser.safari === true; // safari + * util.browser.msie === true; // IE + * util.browser.edge === true; // edge + * util.browser.others === true; // other browser + * util.browser.version; // browser version + */ + var browser = { + chrome: false, + firefox: false, + safari: false, + msie: false, + edge: false, + others: false, + version: 0 + }; + + if (window && window.navigator) { + detectBrowser(); + } + + /** + * Detect the browser. + * @private + */ + function detectBrowser() { + var nav = window.navigator; + var appName = nav.appName.replace(/\s/g, '_'); + var userAgent = nav.userAgent; + + var rIE = /MSIE\s([0-9]+[.0-9]*)/; + var rIE11 = /Trident.*rv:11\./; + var rEdge = /Edge\/(\d+)\./; + var versionRegex = { + firefox: /Firefox\/(\d+)\./, + chrome: /Chrome\/(\d+)\./, + safari: /Version\/([\d.]+).*Safari\/(\d+)/ + }; + + var key, tmp; + + var detector = { + Microsoft_Internet_Explorer: function() { // eslint-disable-line camelcase + var detectedVersion = userAgent.match(rIE); + + if (detectedVersion) { // ie8 ~ ie10 + browser.msie = true; + browser.version = parseFloat(detectedVersion[1]); + } else { // no version information + browser.others = true; + } + }, + Netscape: function() { // eslint-disable-line complexity + var detected = false; + + if (rIE11.exec(userAgent)) { + browser.msie = true; + browser.version = 11; + detected = true; + } else if (rEdge.exec(userAgent)) { + browser.edge = true; + browser.version = userAgent.match(rEdge)[1]; + detected = true; + } else { + for (key in versionRegex) { + if (versionRegex.hasOwnProperty(key)) { + tmp = userAgent.match(versionRegex[key]); + if (tmp && tmp.length > 1) { // eslint-disable-line max-depth + browser[key] = detected = true; + browser.version = parseFloat(tmp[1] || 0); + break; + } + } + } + } + if (!detected) { + browser.others = true; + } + } + }; + + var fn = detector[appName]; + + if (fn) { + detector[appName](); + } + } + + module.exports = browser; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; -/** - * @fileoverview Check whether the given variable is null or not. - * @author NHN FE Development Lab - */ - - - -/** - * Check whether the given variable is null or not. - * If the given variable(arguments[0]) is null, returns true. - * @param {*} obj - Target for checking - * @returns {boolean} Is null? - * @memberof module:type - */ -function isNull(obj) { - return obj === null; -} - -module.exports = isNull; + /** + * @fileoverview This module has some methods for handling popup-window + * @author NHN. + * FE Development Lab + */ + + 'use strict'; + + var collection = __webpack_require__(4); + var type = __webpack_require__(2); + var func = __webpack_require__(5); + var browser = __webpack_require__(10); + var object = __webpack_require__(1); + + var popupId = 0; + + /** + * Popup management class + * @constructor + * @memberof tui.util + * @example + * // node, commonjs + * var popup = require('tui-code-snippet').popup; + * @example + * // distribution file, script + * + * + * + */ + function CustomEvents() { + /** + * @type {HandlerItem[]} + */ + this.events = null; + + /** + * only for checking specific context event was binded + * @type {object[]} + */ + this.contexts = null; + } + + /** + * Mixin custom events feature to specific constructor + * @param {function} func - constructor + * @example + * //-- #1. Get Module --// + * var CustomEvents = require('tui-code-snippet').CustomEvents; // node, commonjs + * var CustomEvents = tui.util.CustomEvents; // distribution file + * + * //-- #2. Use property --// + * var model; + * function Model() { + * this.name = ''; + * } + * CustomEvents.mixin(Model); + * + * model = new Model(); + * model.on('change', function() { this.name = 'model'; }, this); + * model.fire('change'); + * alert(model.name); // 'model'; + */ + CustomEvents.mixin = function(func) { + object.extend(func.prototype, CustomEvents.prototype); + }; + + /** + * Get HandlerItem object + * @param {function} handler - handler function + * @param {object} [context] - context for handler + * @returns {HandlerItem} HandlerItem object + * @private + */ + CustomEvents.prototype._getHandlerItem = function(handler, context) { + var item = {handler: handler}; + + if (context) { + item.context = context; + } + + return item; + }; + + /** + * Get event object safely + * @param {string} [eventName] - create sub event map if not exist. + * @returns {(object|array)} event object. if you supplied `eventName` + * parameter then make new array and return it + * @private + */ + CustomEvents.prototype._safeEvent = function(eventName) { + var events = this.events; + var byName; + + if (!events) { + events = this.events = {}; + } + + if (eventName) { + byName = events[eventName]; + + if (!byName) { + byName = []; + events[eventName] = byName; + } + + events = byName; + } + + return events; + }; + + /** + * Get context array safely + * @returns {array} context array + * @private + */ + CustomEvents.prototype._safeContext = function() { + var context = this.contexts; + + if (!context) { + context = this.contexts = []; + } + + return context; + }; + + /** + * Get index of context + * @param {object} ctx - context that used for bind custom event + * @returns {number} index of context + * @private + */ + CustomEvents.prototype._indexOfContext = function(ctx) { + var context = this._safeContext(); + var index = 0; + + while (context[index]) { + if (ctx === context[index][0]) { + return index; + } + + index += 1; + } + + return -1; + }; + + /** + * Memorize supplied context for recognize supplied object is context or + * name: handler pair object when off() + * @param {object} ctx - context object to memorize + * @private + */ + CustomEvents.prototype._memorizeContext = function(ctx) { + var context, index; + + if (!type.isExisty(ctx)) { + return; + } + + context = this._safeContext(); + index = this._indexOfContext(ctx); + + if (index > -1) { + context[index][1] += 1; + } else { + context.push([ctx, 1]); + } + }; + + /** + * Forget supplied context object + * @param {object} ctx - context object to forget + * @private + */ + CustomEvents.prototype._forgetContext = function(ctx) { + var context, contextIndex; + + if (!type.isExisty(ctx)) { + return; + } + + context = this._safeContext(); + contextIndex = this._indexOfContext(ctx); + + if (contextIndex > -1) { + context[contextIndex][1] -= 1; + + if (context[contextIndex][1] <= 0) { + context.splice(contextIndex, 1); + } + } + }; + + /** + * Bind event handler + * @param {(string|{name:string, handler:function})} eventName - custom + * event name or an object {eventName: handler} + * @param {(function|object)} [handler] - handler function or context + * @param {object} [context] - context for binding + * @private + */ + CustomEvents.prototype._bindEvent = function(eventName, handler, context) { + var events = this._safeEvent(eventName); + this._memorizeContext(context); + events.push(this._getHandlerItem(handler, context)); + }; + + /** + * Bind event handlers + * @param {(string|{name:string, handler:function})} eventName - custom + * event name or an object {eventName: handler} + * @param {(function|object)} [handler] - handler function or context + * @param {object} [context] - context for binding + * //-- #1. Get Module --// + * var CustomEvents = require('tui-code-snippet').CustomEvents; // node, commonjs + * var CustomEvents = tui.util.CustomEvents; // distribution file + * + * //-- #2. Use property --// + * // # 2.1 Basic Usage + * CustomEvents.on('onload', handler); + * + * // # 2.2 With context + * CustomEvents.on('onload', handler, myObj); + * + * // # 2.3 Bind by object that name, handler pairs + * CustomEvents.on({ + * 'play': handler, + * 'pause': handler2 + * }); + * + * // # 2.4 Bind by object that name, handler pairs with context object + * CustomEvents.on({ + * 'play': handler + * }, myObj); + */ + CustomEvents.prototype.on = function(eventName, handler, context) { + var self = this; + + if (type.isString(eventName)) { + // [syntax 1, 2] + eventName = eventName.split(R_EVENTNAME_SPLIT); + collection.forEach(eventName, function(name) { + self._bindEvent(name, handler, context); + }); + } else if (type.isObject(eventName)) { + // [syntax 3, 4] + context = handler; + collection.forEach(eventName, function(func, name) { + self.on(name, func, context); + }); + } + }; + + /** + * Bind one-shot event handlers + * @param {(string|{name:string,handler:function})} eventName - custom + * event name or an object {eventName: handler} + * @param {function|object} [handler] - handler function or context + * @param {object} [context] - context for binding + */ + CustomEvents.prototype.once = function(eventName, handler, context) { + var self = this; + + if (type.isObject(eventName)) { + context = handler; + collection.forEach(eventName, function(func, name) { + self.once(name, func, context); + }); + + return; + } + + function onceHandler() { // eslint-disable-line require-jsdoc + handler.apply(context, arguments); + self.off(eventName, onceHandler, context); + } + + this.on(eventName, onceHandler, context); + }; + + /** + * Splice supplied array by callback result + * @param {array} arr - array to splice + * @param {function} predicate - function return boolean + * @private + */ + CustomEvents.prototype._spliceMatches = function(arr, predicate) { + var i = 0; + var len; + + if (!type.isArray(arr)) { + return; + } + + for (len = arr.length; i < len; i += 1) { + if (predicate(arr[i]) === true) { + arr.splice(i, 1); + len -= 1; + i -= 1; + } + } + }; + + /** + * Get matcher for unbind specific handler events + * @param {function} handler - handler function + * @returns {function} handler matcher + * @private + */ + CustomEvents.prototype._matchHandler = function(handler) { + var self = this; + + return function(item) { + var needRemove = handler === item.handler; + + if (needRemove) { + self._forgetContext(item.context); + } + + return needRemove; + }; + }; + + /** + * Get matcher for unbind specific context events + * @param {object} context - context + * @returns {function} object matcher + * @private + */ + CustomEvents.prototype._matchContext = function(context) { + var self = this; + + return function(item) { + var needRemove = context === item.context; + + if (needRemove) { + self._forgetContext(item.context); + } + + return needRemove; + }; + }; + + /** + * Get matcher for unbind specific hander, context pair events + * @param {function} handler - handler function + * @param {object} context - context + * @returns {function} handler, context matcher + * @private + */ + CustomEvents.prototype._matchHandlerAndContext = function(handler, context) { + var self = this; + + return function(item) { + var matchHandler = (handler === item.handler); + var matchContext = (context === item.context); + var needRemove = (matchHandler && matchContext); + + if (needRemove) { + self._forgetContext(item.context); + } + + return needRemove; + }; + }; + + /** + * Unbind event by event name + * @param {string} eventName - custom event name to unbind + * @param {function} [handler] - handler function + * @private + */ + CustomEvents.prototype._offByEventName = function(eventName, handler) { + var self = this; + var forEach = collection.forEachArray; + var andByHandler = type.isFunction(handler); + var matchHandler = self._matchHandler(handler); + + eventName = eventName.split(R_EVENTNAME_SPLIT); + + forEach(eventName, function(name) { + var handlerItems = self._safeEvent(name); + + if (andByHandler) { + self._spliceMatches(handlerItems, matchHandler); + } else { + forEach(handlerItems, function(item) { + self._forgetContext(item.context); + }); + + self.events[name] = []; + } + }); + }; + + /** + * Unbind event by handler function + * @param {function} handler - handler function + * @private + */ + CustomEvents.prototype._offByHandler = function(handler) { + var self = this; + var matchHandler = this._matchHandler(handler); + + collection.forEach(this._safeEvent(), function(handlerItems) { + self._spliceMatches(handlerItems, matchHandler); + }); + }; + + /** + * Unbind event by object(name: handler pair object or context object) + * @param {object} obj - context or {name: handler} pair object + * @param {function} handler - handler function + * @private + */ + CustomEvents.prototype._offByObject = function(obj, handler) { + var self = this; + var matchFunc; + + if (this._indexOfContext(obj) < 0) { + collection.forEach(obj, function(func, name) { + self.off(name, func); + }); + } else if (type.isString(handler)) { + matchFunc = this._matchContext(obj); + + self._spliceMatches(this._safeEvent(handler), matchFunc); + } else if (type.isFunction(handler)) { + matchFunc = this._matchHandlerAndContext(handler, obj); + + collection.forEach(this._safeEvent(), function(handlerItems) { + self._spliceMatches(handlerItems, matchFunc); + }); + } else { + matchFunc = this._matchContext(obj); + + collection.forEach(this._safeEvent(), function(handlerItems) { + self._spliceMatches(handlerItems, matchFunc); + }); + } + }; + + /** + * Unbind custom events + * @param {(string|object|function)} eventName - event name or context or + * {name: handler} pair object or handler function + * @param {(function)} handler - handler function + * @example + * //-- #1. Get Module --// + * var CustomEvents = require('tui-code-snippet').CustomEvents; // node, commonjs + * var CustomEvents = tui.util.CustomEvents; // distribution file + * + * //-- #2. Use property --// + * // # 2.1 off by event name + * CustomEvents.off('onload'); + * + * // # 2.2 off by event name and handler + * CustomEvents.off('play', handler); + * + * // # 2.3 off by handler + * CustomEvents.off(handler); + * + * // # 2.4 off by context + * CustomEvents.off(myObj); + * + * // # 2.5 off by context and handler + * CustomEvents.off(myObj, handler); + * + * // # 2.6 off by context and event name + * CustomEvents.off(myObj, 'onload'); + * + * // # 2.7 off by an Object. that is {eventName: handler} + * CustomEvents.off({ + * 'play': handler, + * 'pause': handler2 + * }); + * + * // # 2.8 off the all events + * CustomEvents.off(); + */ + CustomEvents.prototype.off = function(eventName, handler) { + if (type.isString(eventName)) { + // [syntax 1, 2] + this._offByEventName(eventName, handler); + } else if (!arguments.length) { + // [syntax 8] + this.events = {}; + this.contexts = []; + } else if (type.isFunction(eventName)) { + // [syntax 3] + this._offByHandler(eventName); + } else if (type.isObject(eventName)) { + // [syntax 4, 5, 6] + this._offByObject(eventName, handler); + } + }; + + /** + * Fire custom event + * @param {string} eventName - name of custom event + */ + CustomEvents.prototype.fire = function(eventName) { // eslint-disable-line + this.invoke.apply(this, arguments); + }; + + /** + * Fire a event and returns the result of operation 'boolean AND' with all + * listener's results. + * + * So, It is different from {@link CustomEvents#fire}. + * + * In service code, use this as a before event in component level usually + * for notifying that the event is cancelable. + * @param {string} eventName - Custom event name + * @param {...*} data - Data for event + * @returns {boolean} The result of operation 'boolean AND' + * @example + * var map = new Map(); + * map.on({ + * 'beforeZoom': function() { + * // It should cancel the 'zoom' event by some conditions. + * if (that.disabled && this.getState()) { + * return false; + * } + * return true; + * } + * }); + * + * if (this.invoke('beforeZoom')) { // check the result of 'beforeZoom' + * // if true, + * // doSomething + * } + */ + CustomEvents.prototype.invoke = function(eventName) { + var events, args, index, item; + + if (!this.hasListener(eventName)) { + return true; + } + + events = this._safeEvent(eventName); + args = Array.prototype.slice.call(arguments, 1); + index = 0; + + while (events[index]) { + item = events[index]; + + if (item.handler.apply(item.context, args) === false) { + return false; + } + + index += 1; + } + + return true; + }; + + /** + * Return whether at least one of the handlers is registered in the given + * event name. + * @param {string} eventName - Custom event name + * @returns {boolean} Is there at least one handler in event name? + */ + CustomEvents.prototype.hasListener = function(eventName) { + return this.getListenerLength(eventName) > 0; + }; + + /** + * Return a count of events registered. + * @param {string} eventName - Custom event name + * @returns {number} number of event + */ + CustomEvents.prototype.getListenerLength = function(eventName) { + var events = this._safeEvent(eventName); + + return events.length; + }; + + module.exports = CustomEvents; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; -/** - * @fileoverview Prevent default action - * @author NHN FE Development Lab - */ - - - -/** - * Prevent default action - * @param {Event} e - event object - * @memberof module:domEvent - */ -function preventDefault(e) { - if (e.preventDefault) { - e.preventDefault(); - - return; - } - - e.returnValue = false; -} - -module.exports = preventDefault; + /** + * @fileoverview This module provides a Enum Constructor. + * @author NHN. + * FE Development Lab + * @example + * // node, commonjs + * var Enum = require('tui-code-snippet').Enum; + * @example + * // distribution file, script + * + * + * + *
"; - * var result = encodeHTMLEntity(htmlEntityString); - */ -function encodeHTMLEntity(html) { - var entities = { - '"': 'quot', - '&': 'amp', - '<': 'lt', - '>': 'gt', - '\'': '#39' - }; - - return html.replace(/[<>&"']/g, function(m0) { - return entities[m0] ? '&' + entities[m0] + ';' : m0; - }); -} - -module.exports = encodeHTMLEntity; - - -/***/ }), -/* 63 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * @fileoverview Creates a throttled function that only invokes fn at most once per every interval milliseconds. - * @author NHN FE Development Lab - */ - - - -var debounce = __webpack_require__(34); - -/** - * Creates a throttled function that only invokes fn at most once per every interval milliseconds. - * You can use this throttle short time repeatedly invoking functions. (e.g MouseMove, Resize ...) - * if you need reuse throttled method. you must remove slugs (e.g. flag variable) related with throttling. - * @param {function} fn function to throttle - * @param {number} [interval=0] the number of milliseconds to throttle invocations to. - * @returns {function} throttled function - * @memberof module:tricks - * @example - * var throttle = require('tui-code-snippet/tricks/throttle'); // node, commonjs - * - * function someMethodToInvokeThrottled() {} - * - * var throttled = throttle(someMethodToInvokeThrottled, 300); - * - * // invoke repeatedly - * throttled(); // invoke (leading) - * throttled(); - * throttled(); // invoke (near 300 milliseconds) - * throttled(); - * throttled(); - * throttled(); // invoke (near 600 milliseconds) - * // ... - * // invoke (trailing) - * - * // if you need reuse throttled method. then invoke reset() - * throttled.reset(); - */ -function throttle(fn, interval) { - var base; - var isLeading = true; - var tick = function(_args) { - fn.apply(null, _args); - base = null; - }; - var debounced, stamp, args; - - /* istanbul ignore next */ - interval = interval || 0; - - debounced = debounce(tick, interval); - - function throttled() { // eslint-disable-line require-jsdoc - args = Array.prototype.slice.call(arguments); - - if (isLeading) { - tick(args); - isLeading = false; - - return; - } - - stamp = Number(new Date()); - - base = base || stamp; - - // pass array directly because `debounce()`, `tick()` are already use - // `apply()` method to invoke developer's `fn` handler. - // - // also, this `debounced` line invoked every time for implements - // `trailing` features. - debounced(args); - - if ((stamp - base) >= interval) { - tick(args); - } - } - - function reset() { // eslint-disable-line require-jsdoc - isLeading = true; - base = null; - } - - throttled.reset = reset; - - return throttled; -} - -module.exports = throttle; - - -/***/ }), -/* 64 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * @fileoverview Check whether the given variable is an instance of Array or not. (for multiple frame environments) - * @author NHN FE Development Lab - */ - - - -/** - * Check whether the given variable is an instance of Array or not. - * If the given variable is an instance of Array, return true. - * (It is used for multiple frame environments) - * @param {*} obj - Target for checking - * @returns {boolean} Is an instance of array? - * @memberof module:type - */ -function isArraySafe(obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; -} - -module.exports = isArraySafe; - - -/***/ }), -/* 65 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * @fileoverview Check whether the given variable is a string or not. - * @author NHN FE Development Lab - */ - - - -/** - * Check whether the given variable is a boolean or not. - * If the given variable is a boolean, return true. - * @param {*} obj - Target for checking - * @returns {boolean} Is boolean? - * @memberof module:type - */ -function isBoolean(obj) { - return typeof obj === 'boolean' || obj instanceof Boolean; -} - -module.exports = isBoolean; - - -/***/ }), -/* 66 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * @fileoverview Check whether the given variable is a boolean or not. (for multiple frame environments) - * @author NHN FE Development Lab - */ - - - -/** - * Check whether the given variable is a boolean or not. - * If the given variable is a boolean, return true. - * (It is used for multiple frame environments) - * @param {*} obj - Target for checking - * @returns {boolean} Is a boolean? - * @memberof module:type - */ -function isBooleanSafe(obj) { - return Object.prototype.toString.call(obj) === '[object Boolean]'; -} - -module.exports = isBooleanSafe; - - -/***/ }), -/* 67 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * @fileoverview Check whether the given variable is an instance of Date or not. (for multiple frame environments) - * @author NHN FE Development Lab - */ - - - -/** - * Check whether the given variable is an instance of Date or not. - * If the given variables is an instance of Date, return true. - * (It is used for multiple frame environments) - * @param {*} obj - Target for checking - * @returns {boolean} Is an instance of Date? - * @memberof module:type - */ -function isDateSafe(obj) { - return Object.prototype.toString.call(obj) === '[object Date]'; -} - -module.exports = isDateSafe; - - -/***/ }), -/* 68 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * @fileoverview Check whether the given variable is falsy or not. - * @author NHN FE Development Lab - */ - - - -var isTruthy = __webpack_require__(35); - -/** - * Check whether the given variable is falsy or not. - * If the given variable is null or undefined or false, returns true. - * @param {*} obj - Target for checking - * @returns {boolean} Is falsy? - * @memberof module:type - */ -function isFalsy(obj) { - return !isTruthy(obj); -} - -module.exports = isFalsy; - - -/***/ }), -/* 69 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * @fileoverview Check whether the given variable is a function or not. (for multiple frame environments) - * @author NHN FE Development Lab - */ - - - -/** - * Check whether the given variable is a function or not. - * If the given variable is a function, return true. - * (It is used for multiple frame environments) - * @param {*} obj - Target for checking - * @returns {boolean} Is a function? - * @memberof module:type - */ -function isFunctionSafe(obj) { - return Object.prototype.toString.call(obj) === '[object Function]'; -} - -module.exports = isFunctionSafe; - - -/***/ }), -/* 70 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * @fileoverview Check whether the given variable is a instance of HTMLNode or not. - * @author NHN FE Development Lab - */ - - - -/** - * Check whether the given variable is a instance of HTMLNode or not. - * If the given variables is a instance of HTMLNode, return true. - * @param {*} html - Target for checking - * @returns {boolean} Is HTMLNode ? - * @memberof module:type - */ -function isHTMLNode(html) { - if (typeof HTMLElement === 'object') { - return (html && (html instanceof HTMLElement || !!html.nodeType)); - } - - return !!(html && html.nodeType); -} - -module.exports = isHTMLNode; - - -/***/ }), -/* 71 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * @fileoverview Check whether the given variable is a HTML tag or not. - * @author NHN FE Development Lab - */ - - - -/** - * Check whether the given variable is a HTML tag or not. - * If the given variables is a HTML tag, return true. - * @param {*} html - Target for checking - * @returns {boolean} Is HTML tag? - * @memberof module:type - */ -function isHTMLTag(html) { - if (typeof HTMLElement === 'object') { - return (html && (html instanceof HTMLElement)); - } - - return !!(html && html.nodeType && html.nodeType === 1); -} - -module.exports = isHTMLTag; - - -/***/ }), -/* 72 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * @fileoverview Check whether the given variable is not empty(not null, not undefined, or not empty array, not empty object) or not. - * @author NHN FE Development Lab - */ - - - -var isEmpty = __webpack_require__(13); - -/** - * Check whether the given variable is not empty - * (not null, not undefined, or not empty array, not empty object) or not. - * If the given variables is not empty, return true. - * @param {*} obj - Target for checking - * @returns {boolean} Is not empty? - * @memberof module:type - */ -function isNotEmpty(obj) { - return !isEmpty(obj); -} - -module.exports = isNotEmpty; - - -/***/ }), -/* 73 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * @fileoverview Check whether the given variable is a number or not. (for multiple frame environments) - * @author NHN FE Development Lab - */ - - - -/** - * Check whether the given variable is a number or not. - * If the given variable is a number, return true. - * (It is used for multiple frame environments) - * @param {*} obj - Target for checking - * @returns {boolean} Is a number? - * @memberof module:type - */ -function isNumberSafe(obj) { - return Object.prototype.toString.call(obj) === '[object Number]'; -} - -module.exports = isNumberSafe; - - -/***/ }), -/* 74 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * @fileoverview Check whether the given variable is a string or not. (for multiple frame environments) - * @author NHN FE Development Lab - */ - - - -/** - * Check whether the given variable is a string or not. - * If the given variable is a string, return true. - * (It is used for multiple frame environments) - * @param {*} obj - Target for checking - * @returns {boolean} Is a string? - * @memberof module:type - */ -function isStringSafe(obj) { - return Object.prototype.toString.call(obj) === '[object String]'; -} - -module.exports = isStringSafe; + /** + * @fileoverview This module provides the HashMap constructor. + * @author NHN. + * FE Development Lab + */ + + 'use strict'; + + var collection = __webpack_require__(4); + var type = __webpack_require__(2); + /** + * All the data in hashMap begin with _MAPDATAPREFIX; + * @type {string} + * @private + */ + var _MAPDATAPREFIX = 'å'; + + /** + * HashMap can handle the key-value pairs.
+ * Caution:
+ * HashMap instance has a length property but is not an instance of Array. + * @param {Object} [obj] A initial data for creation. + * @constructor + * @memberof tui.util + * @deprecated since version 1.3.0 + * @example + * // node, commonjs + * var HashMap = require('tui-code-snippet').HashMap; + * var hm = new tui.util.HashMap({ + 'mydata': { + 'hello': 'imfine' + }, + 'what': 'time' + }); + * @example + * // distribution file, script + * + *