diff --git a/NETCORE/Slickflow/Source/DLL/Dapper.dll b/NETCORE/Slickflow/Source/DLL/Dapper.dll deleted file mode 100644 index fbdd721a..00000000 Binary files a/NETCORE/Slickflow/Source/DLL/Dapper.dll and /dev/null differ diff --git a/NETCORE/Slickflow/Source/DLL/Slickflow.Graph.dll b/NETCORE/Slickflow/Source/DLL/Slickflow.Graph.dll index 28cc5c88..88d1f43c 100644 Binary files a/NETCORE/Slickflow/Source/DLL/Slickflow.Graph.dll and b/NETCORE/Slickflow/Source/DLL/Slickflow.Graph.dll differ diff --git a/NETCORE/Slickflow/Source/Dapper/Dapper.csproj b/NETCORE/Slickflow/Source/Dapper/Dapper.csproj index 18aa9b0b..c4780c1e 100644 --- a/NETCORE/Slickflow/Source/Dapper/Dapper.csproj +++ b/NETCORE/Slickflow/Source/Dapper/Dapper.csproj @@ -1,80 +1,11 @@ - - - + + - Debug - AnyCPU - {4DA6306B-B9F0-4E06-ACA0-2A1400DD9BD0} - Library - Properties - Dapper - Dapper - v4.5 - 512 - + netcoreapp2.1 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - \ No newline at end of file + + diff --git a/NETCORE/Slickflow/Source/Dapper/Properties/AssemblyInfo.cs b/NETCORE/Slickflow/Source/Dapper/Properties/AssemblyInfo.cs deleted file mode 100644 index 0a258e94..00000000 --- a/NETCORE/Slickflow/Source/Dapper/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Dapper")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Dapper")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("636ae73c-fc1a-4860-bf39-9dc183667cd5")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/NETCORE/Slickflow/Source/Dapper/SqlMapperExtensions.cs b/NETCORE/Slickflow/Source/Dapper/SqlMapperExtensions.cs deleted file mode 100644 index 3b197505..00000000 --- a/NETCORE/Slickflow/Source/Dapper/SqlMapperExtensions.cs +++ /dev/null @@ -1,534 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Diagnostics; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Collections.Concurrent; -using System.Reflection.Emit; -using System.Threading; -using System.Runtime.CompilerServices; - -namespace Dapper.Contrib.Extensions -{ - - public static class SqlMapperExtensions - { - public interface IProxy - { - bool IsDirty { get; set; } - } - - private static readonly ConcurrentDictionary> KeyProperties = new ConcurrentDictionary>(); - private static readonly ConcurrentDictionary> TypeProperties = new ConcurrentDictionary>(); - private static readonly ConcurrentDictionary GetQueries = new ConcurrentDictionary(); - private static readonly ConcurrentDictionary TypeTableName = new ConcurrentDictionary(); - - private static readonly Dictionary AdapterDictionary = new Dictionary() { - {"sqlconnection", new SqlServerAdapter()}, - {"npgsqlconnection", new PostgresAdapter()} - }; - - private static IEnumerable KeyPropertiesCache(Type type) - { - - IEnumerable pi; - if (KeyProperties.TryGetValue(type.TypeHandle,out pi)) - { - return pi; - } - - var allProperties = TypePropertiesCache(type); - var keyProperties = allProperties.Where(p => p.GetCustomAttributes(true).Any(a => a is KeyAttribute)).ToList(); - - if (keyProperties.Count == 0) - { - var idProp = allProperties.Where(p => p.Name.ToLower() == "id").FirstOrDefault(); - if (idProp != null) - { - keyProperties.Add(idProp); - } - } - - KeyProperties[type.TypeHandle] = keyProperties; - return keyProperties; - } - private static IEnumerable TypePropertiesCache(Type type) - { - IEnumerable pis; - if (TypeProperties.TryGetValue(type.TypeHandle, out pis)) - { - return pis; - } - - var properties = type.GetProperties().Where(IsWriteable).ToArray(); - TypeProperties[type.TypeHandle] = properties; - return properties; - } - - public static bool IsWriteable(PropertyInfo pi) - { - object[] attributes = pi.GetCustomAttributes(typeof (WriteAttribute), false); - if (attributes.Length == 1) - { - WriteAttribute write = (WriteAttribute) attributes[0]; - return write.Write; - } - return true; - } - - /// - /// Returns a single entity by a single id from table "Ts". T must be of interface type. - /// Id must be marked with [Key] attribute. - /// Created entity is tracked/intercepted for changes and used by the Update() extension. - /// - /// Interface type to create and populate - /// Open SqlConnection - /// Id of the entity to get, must be marked with [Key] attribute - /// Entity of T - public static T Get(this IDbConnection connection, dynamic id, IDbTransaction transaction = null, int? commandTimeout = null) where T : class - { - var type = typeof(T); - string sql; - if (!GetQueries.TryGetValue(type.TypeHandle, out sql)) - { - var keys = KeyPropertiesCache(type); - if (keys.Count() > 1) - throw new DataException("Get only supports an entity with a single [Key] property"); - if (keys.Count() == 0) - throw new DataException("Get only supports en entity with a [Key] property"); - - var onlyKey = keys.First(); - - var name = GetTableName(type); - - // TODO: pluralizer - // TODO: query information schema and only select fields that are both in information schema and underlying class / interface - sql = "select * from " + name + " where " + onlyKey.Name + " = @id"; - GetQueries[type.TypeHandle] = sql; - } - - var dynParms = new DynamicParameters(); - dynParms.Add("@id", id); - - T obj = null; - - if (type.IsInterface) - { - var res = connection.Query(sql, dynParms).FirstOrDefault() as IDictionary; - - if (res == null) - return (T)((object)null); - - obj = ProxyGenerator.GetInterfaceProxy(); - - foreach (var property in TypePropertiesCache(type)) - { - var val = res[property.Name]; - property.SetValue(obj, val, null); - } - - ((IProxy)obj).IsDirty = false; //reset change tracking and return - } - else - { - obj = connection.Query(sql, dynParms, transaction: transaction, commandTimeout: commandTimeout).FirstOrDefault(); - } - return obj; - } - - private static string GetTableName(Type type) - { - string name; - if (!TypeTableName.TryGetValue(type.TypeHandle, out name)) - { - name = type.Name + "s"; - if (type.IsInterface && name.StartsWith("I")) - name = name.Substring(1); - - //NOTE: This as dynamic trick should be able to handle both our own Table-attribute as well as the one in EntityFramework - var tableattr = type.GetCustomAttributes(false).Where(attr => attr.GetType().Name == "TableAttribute").SingleOrDefault() as - dynamic; - if (tableattr != null) - name = tableattr.Name; - TypeTableName[type.TypeHandle] = name; - } - return name; - } - - /// - /// Inserts an entity into table "Ts" and returns identity id. - /// - /// Open SqlConnection - /// Entity to insert - /// Identity of inserted entity - public static long Insert(this IDbConnection connection, T entityToInsert, IDbTransaction transaction = null, int? commandTimeout = null) where T : class - { - - var type = typeof(T); - - var name = GetTableName(type); - - var sbColumnList = new StringBuilder(null); - - var allProperties = TypePropertiesCache(type); - var keyProperties = KeyPropertiesCache(type); - var allPropertiesExceptKey = allProperties.Except(keyProperties); - - for (var i = 0; i < allPropertiesExceptKey.Count(); i++) - { - var property = allPropertiesExceptKey.ElementAt(i); - sbColumnList.AppendFormat("[{0}]", property.Name); - if (i < allPropertiesExceptKey.Count() - 1) - sbColumnList.Append(", "); - } - - var sbParameterList = new StringBuilder(null); - for (var i = 0; i < allPropertiesExceptKey.Count(); i++) - { - var property = allPropertiesExceptKey.ElementAt(i); - sbParameterList.AppendFormat("@{0}", property.Name); - if (i < allPropertiesExceptKey.Count() - 1) - sbParameterList.Append(", "); - } - ISqlAdapter adapter = GetFormatter(connection); - int id = adapter.Insert(connection, transaction, commandTimeout, name, sbColumnList.ToString(), sbParameterList.ToString(), keyProperties, entityToInsert); - return id; - } - - /// - /// Updates entity in table "Ts", checks if the entity is modified if the entity is tracked by the Get() extension. - /// - /// Type to be updated - /// Open SqlConnection - /// Entity to be updated - /// true if updated, false if not found or not modified (tracked entities) - public static bool Update(this IDbConnection connection, T entityToUpdate, IDbTransaction transaction = null, int? commandTimeout = null) where T : class - { - var proxy = entityToUpdate as IProxy; - if (proxy != null) - { - if (!proxy.IsDirty) return false; - } - - var type = typeof(T); - - var keyProperties = KeyPropertiesCache(type); - if (!keyProperties.Any()) - throw new ArgumentException("Entity must have at least one [Key] property"); - - var name = GetTableName(type); - - var sb = new StringBuilder(); - sb.AppendFormat("update {0} set ", name); - - var allProperties = TypePropertiesCache(type); - var nonIdProps = allProperties.Where(a => !keyProperties.Contains(a)); - - for (var i = 0; i < nonIdProps.Count(); i++) - { - var property = nonIdProps.ElementAt(i); - sb.AppendFormat("{0} = @{1}", property.Name, property.Name); - if (i < nonIdProps.Count() - 1) - sb.AppendFormat(", "); - } - sb.Append(" where "); - for (var i = 0; i < keyProperties.Count(); i++) - { - var property = keyProperties.ElementAt(i); - sb.AppendFormat("{0} = @{1}", property.Name, property.Name); - if (i < keyProperties.Count() - 1) - sb.AppendFormat(" and "); - } - var updated = connection.Execute(sb.ToString(), entityToUpdate, commandTimeout: commandTimeout, transaction: transaction); - return updated > 0; - } - - /// - /// Delete entity in table "Ts". - /// - /// Type of entity - /// Open SqlConnection - /// Entity to delete - /// true if deleted, false if not found - public static bool Delete(this IDbConnection connection, T entityToDelete, IDbTransaction transaction = null, int? commandTimeout = null) where T : class - { - if (entityToDelete == null) - throw new ArgumentException("Cannot Delete null Object", "entityToDelete"); - - var type = typeof(T); - - var keyProperties = KeyPropertiesCache(type); - if (keyProperties.Count() == 0) - throw new ArgumentException("Entity must have at least one [Key] property"); - - var name = GetTableName(type); - - var sb = new StringBuilder(); - sb.AppendFormat("delete from {0} where ", name); - - for (var i = 0; i < keyProperties.Count(); i++) - { - var property = keyProperties.ElementAt(i); - sb.AppendFormat("{0} = @{1}", property.Name, property.Name); - if (i < keyProperties.Count() - 1) - sb.AppendFormat(" and "); - } - var deleted = connection.Execute(sb.ToString(), entityToDelete, transaction: transaction, commandTimeout: commandTimeout); - return deleted > 0; - } - - public static ISqlAdapter GetFormatter(IDbConnection connection) - { - string name = connection.GetType().Name.ToLower(); - if (!AdapterDictionary.ContainsKey(name)) - return new SqlServerAdapter(); - return AdapterDictionary[name]; - } - - class ProxyGenerator - { - private static readonly Dictionary TypeCache = new Dictionary(); - - private static AssemblyBuilder GetAsmBuilder(string name) - { - var assemblyBuilder = Thread.GetDomain().DefineDynamicAssembly(new AssemblyName { Name = name }, - AssemblyBuilderAccess.Run); //NOTE: to save, use RunAndSave - - return assemblyBuilder; - } - - public static T GetClassProxy() - { - // A class proxy could be implemented if all properties are virtual - // otherwise there is a pretty dangerous case where internal actions will not update dirty tracking - throw new NotImplementedException(); - } - - - public static T GetInterfaceProxy() - { - Type typeOfT = typeof(T); - - object k; - if (TypeCache.TryGetValue(typeOfT, out k)) - { - return (T)k; - } - var assemblyBuilder = GetAsmBuilder(typeOfT.Name); - - var moduleBuilder = assemblyBuilder.DefineDynamicModule("SqlMapperExtensions." + typeOfT.Name); //NOTE: to save, add "asdasd.dll" parameter - - var interfaceType = typeof(Dapper.Contrib.Extensions.SqlMapperExtensions.IProxy); - var typeBuilder = moduleBuilder.DefineType(typeOfT.Name + "_" + Guid.NewGuid(), - TypeAttributes.Public | TypeAttributes.Class); - typeBuilder.AddInterfaceImplementation(typeOfT); - typeBuilder.AddInterfaceImplementation(interfaceType); - - //create our _isDirty field, which implements IProxy - var setIsDirtyMethod = CreateIsDirtyProperty(typeBuilder); - - // Generate a field for each property, which implements the T - foreach (var property in typeof(T).GetProperties()) - { - var isId = property.GetCustomAttributes(true).Any(a => a is KeyAttribute); - CreateProperty(typeBuilder, property.Name, property.PropertyType, setIsDirtyMethod, isId); - } - - var generatedType = typeBuilder.CreateType(); - - //assemblyBuilder.Save(name + ".dll"); //NOTE: to save, uncomment - - var generatedObject = Activator.CreateInstance(generatedType); - - TypeCache.Add(typeOfT, generatedObject); - return (T)generatedObject; - } - - - private static MethodInfo CreateIsDirtyProperty(TypeBuilder typeBuilder) - { - var propType = typeof(bool); - var field = typeBuilder.DefineField("_" + "IsDirty", propType, FieldAttributes.Private); - var property = typeBuilder.DefineProperty("IsDirty", - System.Reflection.PropertyAttributes.None, - propType, - new Type[] { propType }); - - const MethodAttributes getSetAttr = MethodAttributes.Public | MethodAttributes.NewSlot | MethodAttributes.SpecialName | - MethodAttributes.Final | MethodAttributes.Virtual | MethodAttributes.HideBySig; - - // Define the "get" and "set" accessor methods - var currGetPropMthdBldr = typeBuilder.DefineMethod("get_" + "IsDirty", - getSetAttr, - propType, - Type.EmptyTypes); - var currGetIL = currGetPropMthdBldr.GetILGenerator(); - currGetIL.Emit(OpCodes.Ldarg_0); - currGetIL.Emit(OpCodes.Ldfld, field); - currGetIL.Emit(OpCodes.Ret); - var currSetPropMthdBldr = typeBuilder.DefineMethod("set_" + "IsDirty", - getSetAttr, - null, - new Type[] { propType }); - var currSetIL = currSetPropMthdBldr.GetILGenerator(); - currSetIL.Emit(OpCodes.Ldarg_0); - currSetIL.Emit(OpCodes.Ldarg_1); - currSetIL.Emit(OpCodes.Stfld, field); - currSetIL.Emit(OpCodes.Ret); - - property.SetGetMethod(currGetPropMthdBldr); - property.SetSetMethod(currSetPropMthdBldr); - var getMethod = typeof(Dapper.Contrib.Extensions.SqlMapperExtensions.IProxy).GetMethod("get_" + "IsDirty"); - var setMethod = typeof(Dapper.Contrib.Extensions.SqlMapperExtensions.IProxy).GetMethod("set_" + "IsDirty"); - typeBuilder.DefineMethodOverride(currGetPropMthdBldr, getMethod); - typeBuilder.DefineMethodOverride(currSetPropMthdBldr, setMethod); - - return currSetPropMthdBldr; - } - - private static void CreateProperty(TypeBuilder typeBuilder, string propertyName, Type propType, MethodInfo setIsDirtyMethod, bool isIdentity) - { - //Define the field and the property - var field = typeBuilder.DefineField("_" + propertyName, propType, FieldAttributes.Private); - var property = typeBuilder.DefineProperty(propertyName, - System.Reflection.PropertyAttributes.None, - propType, - new Type[] { propType }); - - const MethodAttributes getSetAttr = MethodAttributes.Public | MethodAttributes.Virtual | - MethodAttributes.HideBySig; - - // Define the "get" and "set" accessor methods - var currGetPropMthdBldr = typeBuilder.DefineMethod("get_" + propertyName, - getSetAttr, - propType, - Type.EmptyTypes); - - var currGetIL = currGetPropMthdBldr.GetILGenerator(); - currGetIL.Emit(OpCodes.Ldarg_0); - currGetIL.Emit(OpCodes.Ldfld, field); - currGetIL.Emit(OpCodes.Ret); - - var currSetPropMthdBldr = typeBuilder.DefineMethod("set_" + propertyName, - getSetAttr, - null, - new Type[] { propType }); - - //store value in private field and set the isdirty flag - var currSetIL = currSetPropMthdBldr.GetILGenerator(); - currSetIL.Emit(OpCodes.Ldarg_0); - currSetIL.Emit(OpCodes.Ldarg_1); - currSetIL.Emit(OpCodes.Stfld, field); - currSetIL.Emit(OpCodes.Ldarg_0); - currSetIL.Emit(OpCodes.Ldc_I4_1); - currSetIL.Emit(OpCodes.Call, setIsDirtyMethod); - currSetIL.Emit(OpCodes.Ret); - - //TODO: Should copy all attributes defined by the interface? - if (isIdentity) - { - var keyAttribute = typeof(KeyAttribute); - var myConstructorInfo = keyAttribute.GetConstructor(new Type[] { }); - var attributeBuilder = new CustomAttributeBuilder(myConstructorInfo, new object[] { }); - property.SetCustomAttribute(attributeBuilder); - } - - property.SetGetMethod(currGetPropMthdBldr); - property.SetSetMethod(currSetPropMthdBldr); - var getMethod = typeof(T).GetMethod("get_" + propertyName); - var setMethod = typeof(T).GetMethod("set_" + propertyName); - typeBuilder.DefineMethodOverride(currGetPropMthdBldr, getMethod); - typeBuilder.DefineMethodOverride(currSetPropMthdBldr, setMethod); - } - - } - } - - [AttributeUsage(AttributeTargets.Class)] - public class TableAttribute : Attribute - { - public TableAttribute(string tableName) - { - Name = tableName; - } - public string Name { get; private set; } - } - - // do not want to depend on data annotations that is not in client profile - [AttributeUsage(AttributeTargets.Property)] - public class KeyAttribute : Attribute - { - } - - [AttributeUsage(AttributeTargets.Property)] - public class WriteAttribute : Attribute - { - public WriteAttribute(bool write) - { - Write = write; - } - public bool Write { get; private set; } - } -} - -public interface ISqlAdapter -{ - int Insert(IDbConnection connection, IDbTransaction transaction, int? commandTimeout, String tableName, string columnList, string parameterList, IEnumerable keyProperties, object entityToInsert); -} - -public class SqlServerAdapter : ISqlAdapter -{ - public int Insert(IDbConnection connection, IDbTransaction transaction, int? commandTimeout, String tableName, string columnList, string parameterList, IEnumerable keyProperties, object entityToInsert) - { - string cmd = String.Format("insert into {0} ({1}) values ({2})", tableName, columnList, parameterList); - - connection.Execute(cmd, entityToInsert, transaction: transaction, commandTimeout: commandTimeout); - - //NOTE: would prefer to use IDENT_CURRENT('tablename') or IDENT_SCOPE but these are not available on SQLCE - var r = connection.Query("select @@IDENTITY id", transaction: transaction, commandTimeout: commandTimeout); - int id = (int)r.First().id; - if (keyProperties.Any()) - keyProperties.First().SetValue(entityToInsert, id, null); - return id; - } -} - -public class PostgresAdapter : ISqlAdapter -{ - public int Insert(IDbConnection connection, IDbTransaction transaction, int? commandTimeout, String tableName, string columnList, string parameterList, IEnumerable keyProperties, object entityToInsert) - { - StringBuilder sb = new StringBuilder(); - sb.AppendFormat("insert into {0} ({1}) values ({2})", tableName, columnList, parameterList); - - // If no primary key then safe to assume a join table with not too much data to return - if (!keyProperties.Any()) - sb.Append(" RETURNING *"); - else - { - sb.Append(" RETURNING "); - bool first = true; - foreach (var property in keyProperties) - { - if (!first) - sb.Append(", "); - first = false; - sb.Append(property.Name); - } - } - - var results = connection.Query(sb.ToString(), entityToInsert, transaction: transaction, commandTimeout: commandTimeout); - - // Return the key by assinging the corresponding property in the object - by product is that it supports compound primary keys - int id = 0; - foreach (var p in keyProperties) - { - var value = ((IDictionary)results.First())[p.Name.ToLower()]; - p.SetValue(entityToInsert, value, null); - if (id == 0) - id = Convert.ToInt32(value); - } - return id; - } -} \ No newline at end of file diff --git a/NETCORE/Slickflow/Source/Dommel/Dommel.csproj b/NETCORE/Slickflow/Source/Dommel/Dommel.csproj deleted file mode 100644 index 0ae14966..00000000 --- a/NETCORE/Slickflow/Source/Dommel/Dommel.csproj +++ /dev/null @@ -1,26 +0,0 @@ - - - Simple CRUD operations for Dapper. - Copyright © Henk Mollema 2017 - Dommel - 1.9.0 - Henk Mollema - net45;net451;netstandard1.3 - true - dommel;crud;dapper;database;orm - https://github.com/henkmollema/Dommel - https://github.com/henkmollema/Dommel/blob/master/LICENSE - git - https://github.com/henkmollema/Dommel - - - - - - - - - 4.4.0 - - - \ No newline at end of file diff --git a/NETCORE/Slickflow/Source/Dommel/DommelMapper.cs b/NETCORE/Slickflow/Source/Dommel/DommelMapper.cs deleted file mode 100644 index e350131d..00000000 --- a/NETCORE/Slickflow/Source/Dommel/DommelMapper.cs +++ /dev/null @@ -1,2143 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Data; -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Dapper; - -namespace Dommel -{ - /// - /// Simple CRUD operations for Dapper. - /// - public static class DommelMapper - { - private static readonly Dictionary _sqlBuilders = new Dictionary - { - { "sqlconnection", new SqlServerSqlBuilder() }, - { "sqlceconnection", new SqlServerCeSqlBuilder() }, - { "sqliteconnection", new SqliteSqlBuilder() }, - { "npgsqlconnection", new PostgresSqlBuilder() }, - { "mysqlconnection", new MySqlSqlBuilder() } - }; - - private static readonly ConcurrentDictionary _getQueryCache = new ConcurrentDictionary(); - private static readonly ConcurrentDictionary _getAllQueryCache = new ConcurrentDictionary(); - private static readonly ConcurrentDictionary _insertQueryCache = new ConcurrentDictionary(); - private static readonly ConcurrentDictionary _updateQueryCache = new ConcurrentDictionary(); - private static readonly ConcurrentDictionary _deleteQueryCache = new ConcurrentDictionary(); - private static readonly ConcurrentDictionary _deleteAllQueryCache = new ConcurrentDictionary(); - - /// - /// Retrieves the entity of type with the specified id. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The entity with the corresponding id. - public static TEntity Get(this IDbConnection connection, object id) where TEntity : class - { - DynamicParameters parameters; - var sql = BuildGetById(typeof(TEntity), id, out parameters); - return connection.QueryFirstOrDefault(sql, parameters); - } - - /// - /// Retrieves the entity of type with the specified id. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The transaction to the connection. - /// The entity with the corresponding id. - public static TEntity Get(this IDbConnection connection, object id, IDbTransaction transaction) where TEntity : class - { - DynamicParameters parameters; - var sql = BuildGetById(typeof(TEntity), id, out parameters); - return connection.QueryFirstOrDefault(sql, parameters, transaction); - } - - /// - /// Retrieves the entity of type with the specified id. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The entity with the corresponding id. - public static Task GetAsync(this IDbConnection connection, object id) where TEntity : class - { - DynamicParameters parameters; - var sql = BuildGetById(typeof(TEntity), id, out parameters); - return connection.QueryFirstOrDefaultAsync(sql, parameters); - } - - private static string BuildGetById(Type type, object id, out DynamicParameters parameters) - { - string sql; - if (!_getQueryCache.TryGetValue(type, out sql)) - { - var tableName = Resolvers.Table(type); - var keyProperty = Resolvers.KeyProperty(type); - var keyColumnName = Resolvers.Column(keyProperty); - - sql = $"select * from {tableName} where {keyColumnName} = @Id"; - _getQueryCache.TryAdd(type, sql); - } - - parameters = new DynamicParameters(); - parameters.Add("Id", id); - - return sql; - } - - /// - /// Retrieves all the entities of type . - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// - /// A value indicating whether the result of the query should be executed directly, - /// or when the query is materialized (using ToList() for example). - /// - /// A collection of entities of type . - public static IEnumerable GetAll(this IDbConnection connection, bool buffered = true) where TEntity : class - { - var sql = BuildGetAllQuery(typeof(TEntity)); - return connection.Query(sql, buffered: buffered); - } - - /// - /// Retrieves all the entities of type . - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// A collection of entities of type . - public static Task> GetAllAsync(this IDbConnection connection) where TEntity : class - { - var sql = BuildGetAllQuery(typeof(TEntity)); - return connection.QueryAsync(sql); - } - - private static string BuildGetAllQuery(Type type) - { - string sql; - if (!_getAllQueryCache.TryGetValue(type, out sql)) - { - var tableName = Resolvers.Table(type); - sql = $"select * from {tableName}"; - _getAllQueryCache.TryAdd(type, sql); - } - - return sql; - } - - /// - /// Retrieves the entity of type with the specified id - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The mapping to perform on the entities in the result set. - /// The entity with the corresponding id joined with the specified types. - public static TReturn Get(this IDbConnection connection, object id, Func map) where TReturn : class - { - return MultiMap(connection, map, id).FirstOrDefault(); - } - - /// - /// Retrieves the entity of type with the specified id - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The mapping to perform on the entities in the result set. - /// The entity with the corresponding id joined with the specified types. - public static async Task GetAsync(this IDbConnection connection, object id, Func map) where TReturn : class - { - return (await MultiMapAsync(connection, map, id)).FirstOrDefault(); - } - - /// - /// Retrieves the entity of type with the specified id - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The mapping to perform on the entities in the result set. - /// The entity with the corresponding id joined with the specified types. - public static TReturn Get(this IDbConnection connection, - object id, - Func map) where TReturn : class - { - return MultiMap(connection, map, id).FirstOrDefault(); - } - - /// - /// Retrieves the entity of type with the specified id - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The mapping to perform on the entities in the result set. - /// The entity with the corresponding id joined with the specified types. - public static async Task GetAsync(this IDbConnection connection, - object id, - Func map) where TReturn : class - { - return (await MultiMapAsync(connection, map, id)).FirstOrDefault(); - } - - /// - /// Retrieves the entity of type with the specified id - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The mapping to perform on the entities in the result set. - /// The entity with the corresponding id joined with the specified types. - public static TReturn Get(this IDbConnection connection, - object id, - Func map) where TReturn : class - { - return MultiMap(connection, map, id).FirstOrDefault(); - } - - /// - /// Retrieves the entity of type with the specified id - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The mapping to perform on the entities in the result set. - /// The entity with the corresponding id joined with the specified types. - public static async Task GetAsync(this IDbConnection connection, - object id, - Func map) where TReturn : class - { - return (await MultiMapAsync(connection, map, id)).FirstOrDefault(); - } - - /// - /// Retrieves the entity of type with the specified id - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The fifth type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The mapping to perform on the entities in the result set. - /// The entity with the corresponding id joined with the specified types. - public static TReturn Get(this IDbConnection connection, - object id, - Func map) where TReturn : class - { - return MultiMap(connection, map, id).FirstOrDefault(); - } - - /// - /// Retrieves the entity of type with the specified id - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The fifth type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The mapping to perform on the entities in the result set. - /// The entity with the corresponding id joined with the specified types. - public static async Task GetAsync(this IDbConnection connection, - object id, - Func map) where TReturn : class - { - return (await MultiMapAsync(connection, map, id)).FirstOrDefault(); - } - - /// - /// Retrieves the entity of type with the specified id - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The fifth type parameter. - /// The sixth type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The mapping to perform on the entities in the result set. - /// The entity with the corresponding id joined with the specified types. - public static TReturn Get(this IDbConnection connection, - object id, - Func map) where TReturn : class - { - return MultiMap(connection, map, id).FirstOrDefault(); - } - - /// - /// Retrieves the entity of type with the specified id - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The fifth type parameter. - /// The sixth type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The mapping to perform on the entities in the result set. - /// The entity with the corresponding id joined with the specified types. - public static async Task GetAsync(this IDbConnection connection, - object id, - Func map) where TReturn : class - { - return (await MultiMapAsync(connection, map, id)).FirstOrDefault(); - } - - /// - /// Retrieves the entity of type with the specified id - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The fifth type parameter. - /// The sixth type parameter. - /// The seventh type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The mapping to perform on the entities in the result set. - /// The entity with the corresponding id joined with the specified types. - public static TReturn Get(this IDbConnection connection, - object id, - Func map) where TReturn : class - { - return MultiMap(connection, map, id).FirstOrDefault(); - } - - /// - /// Retrieves the entity of type with the specified id - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The fifth type parameter. - /// The sixth type parameter. - /// The seventh type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The id of the entity in the database. - /// The mapping to perform on the entities in the result set. - /// The entity with the corresponding id joined with the specified types. - public static async Task GetAsync(this IDbConnection connection, - object id, - Func map) where TReturn : class - { - return (await MultiMapAsync(connection, map, id)).FirstOrDefault(); - } - - /// - /// Retrieves all the entities of type - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The mapping to perform on the entities in the result set. - /// - /// A value indicating whether the result of the query should be executed directly, - /// or when the query is materialized (using ToList() for example). - /// - /// - /// A collection of entities of type - /// joined with the specified type types. - /// - public static IEnumerable GetAll(this IDbConnection connection, Func map, bool buffered = true) - { - return MultiMap(connection, map, buffered: buffered); - } - - /// - /// Retrieves all the entities of type - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The mapping to perform on the entities in the result set. - /// - /// A value indicating whether the result of the query should be executed directly, - /// or when the query is materialized (using ToList() for example). - /// - /// - /// A collection of entities of type - /// joined with the specified type types. - /// - public static Task> GetAllAsync(this IDbConnection connection, Func map, bool buffered = true) - { - return MultiMapAsync(connection, map, buffered: buffered); - } - - /// - /// Retrieves all the entities of type - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The mapping to perform on the entities in the result set. - /// - /// A value indicating whether the result of the query should be executed directly, - /// or when the query is materialized (using ToList() for example). - /// - /// - /// A collection of entities of type - /// joined with the specified type types. - /// - public static IEnumerable GetAll(this IDbConnection connection, Func map, bool buffered = true) - { - return MultiMap(connection, map, buffered: buffered); - } - - /// - /// Retrieves all the entities of type - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The mapping to perform on the entities in the result set. - /// - /// A value indicating whether the result of the query should be executed directly, - /// or when the query is materialized (using ToList() for example). - /// - /// - /// A collection of entities of type - /// joined with the specified type types. - /// - public static Task> GetAllAsync(this IDbConnection connection, Func map, bool buffered = true) - { - return MultiMapAsync(connection, map, buffered: buffered); - } - - /// - /// Retrieves all the entities of type - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The mapping to perform on the entities in the result set. - /// - /// A value indicating whether the result of the query should be executed directly, - /// or when the query is materialized (using ToList() for example). - /// - /// - /// A collection of entities of type - /// joined with the specified type types. - /// - public static IEnumerable GetAll(this IDbConnection connection, Func map, bool buffered = true) - { - return MultiMap(connection, map, buffered: buffered); - } - - /// - /// Retrieves all the entities of type - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The mapping to perform on the entities in the result set. - /// - /// A value indicating whether the result of the query should be executed directly, - /// or when the query is materialized (using ToList() for example). - /// - /// - /// A collection of entities of type - /// joined with the specified type types. - /// - public static Task> GetAllAsync(this IDbConnection connection, Func map, bool buffered = true) - { - return MultiMapAsync(connection, map, buffered: buffered); - } - - /// - /// Retrieves all the entities of type - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The fifth type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The mapping to perform on the entities in the result set. - /// - /// A value indicating whether the result of the query should be executed directly, - /// or when the query is materialized (using ToList() for example). - /// - /// - /// A collection of entities of type - /// joined with the specified type types. - /// - public static IEnumerable GetAll(this IDbConnection connection, Func map, bool buffered = true) - { - return MultiMap(connection, map, buffered: buffered); - } - - /// - /// Retrieves all the entities of type - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The fifth type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The mapping to perform on the entities in the result set. - /// - /// A value indicating whether the result of the query should be executed directly, - /// or when the query is materialized (using ToList() for example). - /// - /// - /// A collection of entities of type - /// joined with the specified type types. - /// - public static Task> GetAllAsync(this IDbConnection connection, Func map, bool buffered = true) - { - return MultiMapAsync(connection, map, buffered: buffered); - } - - /// - /// Retrieves all the entities of type - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The fifth type parameter. - /// The sixth type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The mapping to perform on the entities in the result set. - /// - /// A value indicating whether the result of the query should be executed directly, - /// or when the query is materialized (using ToList() for example). - /// - /// - /// A collection of entities of type - /// joined with the specified type types. - /// - public static IEnumerable GetAll(this IDbConnection connection, Func map, bool buffered = true) - { - return MultiMap(connection, map, buffered: buffered); - } - - /// - /// Retrieves all the entities of type - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The fifth type parameter. - /// The sixth type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The mapping to perform on the entities in the result set. - /// - /// A value indicating whether the result of the query should be executed directly, - /// or when the query is materialized (using ToList() for example). - /// - /// - /// A collection of entities of type - /// joined with the specified type types. - /// - public static Task> GetAllAsync(this IDbConnection connection, Func map, bool buffered = true) - { - return MultiMapAsync(connection, map, buffered: buffered); - } - - /// - /// Retrieves all the entities of type - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The fifth type parameter. - /// The sixth type parameter. - /// The seventh type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The mapping to perform on the entities in the result set. - /// - /// A value indicating whether the result of the query should be executed directly, - /// or when the query is materialized (using ToList() for example). - /// - /// - /// A collection of entities of type - /// joined with the specified type types. - /// - public static IEnumerable GetAll(this IDbConnection connection, Func map, bool buffered = true) - { - return MultiMap(connection, map, buffered: buffered); - } - - /// - /// Retrieves all the entities of type - /// joined with the types specified as type parameters. - /// - /// The first type parameter. This is the source entity. - /// The second type parameter. - /// The third type parameter. - /// The fourth type parameter. - /// The fifth type parameter. - /// The sixth type parameter. - /// The seventh type parameter. - /// The return type parameter. - /// The connection to the database. This can either be open or closed. - /// The mapping to perform on the entities in the result set. - /// - /// A value indicating whether the result of the query should be executed directly, - /// or when the query is materialized (using ToList() for example). - /// - /// - /// A collection of entities of type - /// joined with the specified type types. - /// - public static Task> GetAllAsync(this IDbConnection connection, Func map, bool buffered = true) - { - return MultiMapAsync(connection, map, buffered: buffered); - } - - private static IEnumerable MultiMap(IDbConnection connection, Delegate map, object id = null, bool buffered = true) - { - var resultType = typeof(TReturn); - var - includeTypes = new[] - { - typeof(T1), - typeof(T2), - typeof(T3), - typeof(T4), - typeof(T5), - typeof(T6), - typeof(T7) - } - .Where(t => t != typeof(DontMap)) - .ToArray(); - - DynamicParameters parameters; - var sql = BuildMultiMapQuery(resultType, includeTypes, id, out parameters); - - switch (includeTypes.Length) - { - case 2: - return connection.Query(sql, (Func)map, parameters, buffered: buffered); - case 3: - return connection.Query(sql, (Func)map, parameters, buffered: buffered); - case 4: - return connection.Query(sql, (Func)map, parameters, buffered: buffered); - case 5: - return connection.Query(sql, (Func)map, parameters, buffered: buffered); - case 6: - return connection.Query(sql, (Func)map, parameters, buffered: buffered); - case 7: - return connection.Query(sql, (Func)map, parameters, buffered: buffered); - } - - throw new InvalidOperationException($"Invalid amount of include types: {includeTypes.Length}."); - } - - private static Task> MultiMapAsync(IDbConnection connection, Delegate map, object id = null, bool buffered = true) - { - var resultType = typeof(TReturn); - var - includeTypes = new[] - { - typeof(T1), - typeof(T2), - typeof(T3), - typeof(T4), - typeof(T5), - typeof(T6), - typeof(T7) - } - .Where(t => t != typeof(DontMap)) - .ToArray(); - - DynamicParameters parameters; - var sql = BuildMultiMapQuery(resultType, includeTypes, id, out parameters); - - switch (includeTypes.Length) - { - case 2: - return connection.QueryAsync(sql, (Func)map, parameters, buffered: buffered); - case 3: - return connection.QueryAsync(sql, (Func)map, parameters, buffered: buffered); - case 4: - return connection.QueryAsync(sql, (Func)map, parameters, buffered: buffered); - case 5: - return connection.QueryAsync(sql, (Func)map, parameters, buffered: buffered); - case 6: - return connection.QueryAsync(sql, (Func)map, parameters, buffered: buffered); - case 7: - return connection.QueryAsync(sql, (Func)map, parameters, buffered: buffered); - } - - throw new InvalidOperationException($"Invalid amount of include types: {includeTypes.Length}."); - } - - private static string BuildMultiMapQuery(Type resultType, Type[] includeTypes, object id, out DynamicParameters parameters) - { - var resultTableName = Resolvers.Table(resultType); - var resultTableKeyColumnName = Resolvers.Column(Resolvers.KeyProperty(resultType)); - - var sql = $"select * from {resultTableName}"; - - for (var i = 1; i < includeTypes.Length; i++) - { - // Determine the table to join with. - var sourceType = includeTypes[i - 1]; - var sourceTableName = Resolvers.Table(sourceType); - - // Determine the table name of the joined table. - var includeType = includeTypes[i]; - var foreignKeyTableName = Resolvers.Table(includeType); - - // Determine the foreign key and the relationship type. - ForeignKeyRelation relation; - var foreignKeyProperty = Resolvers.ForeignKeyProperty(sourceType, includeType, out relation); - var foreignKeyPropertyName = Resolvers.Column(foreignKeyProperty); - - // If the foreign key property is nullable, use a left-join. - var joinType = Nullable.GetUnderlyingType(foreignKeyProperty.PropertyType) != null - ? "left" - : "inner"; - - switch (relation) - { - case ForeignKeyRelation.OneToOne: - // Determine the primary key of the foreign key table. - var foreignKeyTableKeyColumName = Resolvers.Column(Resolvers.KeyProperty(includeType)); - - sql += string.Format(" {0} join {1} on {2}.{3} = {1}.{4}", - joinType, - foreignKeyTableName, - sourceTableName, - foreignKeyPropertyName, - foreignKeyTableKeyColumName); - break; - - case ForeignKeyRelation.OneToMany: - // Determine the primary key of the source table. - var sourceKeyColumnName = Resolvers.Column(Resolvers.KeyProperty(sourceType)); - - sql += string.Format(" {0} join {1} on {2}.{3} = {1}.{4}", - joinType, - foreignKeyTableName, - sourceTableName, - sourceKeyColumnName, - foreignKeyPropertyName); - break; - - case ForeignKeyRelation.ManyToMany: - throw new NotImplementedException("Many-to-many relationships are not supported yet."); - - default: - throw new NotImplementedException($"Foreign key relation type '{relation}' is not implemented."); - } - } - - parameters = null; - if (id != null) - { - sql += string.Format(" where {0}.{1} = @{1}", resultTableName, resultTableKeyColumnName); - - parameters = new DynamicParameters(); - parameters.Add("Id", id); - } - - return sql; - } - - private class DontMap - { - } - - /// - /// Selects all the entities matching the specified predicate. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// A predicate to filter the results. - /// - /// A value indicating whether the result of the query should be executed directly, - /// or when the query is materialized (using ToList() for example). - /// - /// - /// A collection of entities of type matching the specified - /// . - /// - public static IEnumerable Select(this IDbConnection connection, Expression> predicate, bool buffered = true) - { - DynamicParameters parameters; - var sql = BuildSelectSql(predicate, out parameters); - return connection.Query(sql, parameters, buffered: buffered); - } - - /// - /// Selects all the entities matching the specified predicate. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// A predicate to filter the results. - /// - /// A collection of entities of type matching the specified - /// . - /// - public static Task> SelectAsync(this IDbConnection connection, Expression> predicate) - { - DynamicParameters parameters; - var sql = BuildSelectSql(predicate, out parameters); - return connection.QueryAsync(sql, parameters); - } - - private static string BuildSelectSql(Expression> predicate, out DynamicParameters parameters) - { - var type = typeof(TEntity); - string sql; - if (!_getAllQueryCache.TryGetValue(type, out sql)) - { - var tableName = Resolvers.Table(type); - sql = $"select * from {tableName}"; - _getAllQueryCache.TryAdd(type, sql); - } - - sql += new SqlExpression() - .Where(predicate) - .ToSql(out parameters); - return sql; - } - - /// - /// Selects the first entity matching the specified predicate, or a default value if no entity matched. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// A predicate to filter the results. - /// - /// A instance of type matching the specified - /// . - /// - public static TEntity FirstOrDefault(this IDbConnection connection, Expression> predicate) - { - DynamicParameters parameters; - var sql = BuildSelectSql(predicate, out parameters); - return connection.QueryFirstOrDefault(sql, parameters); - } - - /// - /// Selects the first entity matching the specified predicate, or a default value if no entity matched. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// A predicate to filter the results. - /// - /// A instance of type matching the specified - /// . - /// - public static Task FirstOrDefaultAsync(this IDbConnection connection, Expression> predicate) - { - DynamicParameters parameters; - var sql = BuildSelectSql(predicate, out parameters); - return connection.QueryFirstOrDefaultAsync(sql, parameters); - } - - /// - /// Represents a typed SQL expression. - /// - /// The type of the entity. - public class SqlExpression - { - private readonly StringBuilder _whereBuilder = new StringBuilder(); - private readonly DynamicParameters _parameters = new DynamicParameters(); - private int _parameterIndex; - - /// - /// Builds a SQL expression for the specified filter expression. - /// - /// The filter expression on the entity. - /// The current instance. - public virtual SqlExpression Where(Expression> expression) - { - if (expression != null) - { - AppendToWhere("and", expression); - } - return this; - } - - private void AppendToWhere(string conditionOperator, Expression expression) - { - var sqlExpression = VisitExpression(expression).ToString(); - AppendToWhere(conditionOperator, sqlExpression); - } - - private void AppendToWhere(string conditionOperator, string sqlExpression) - { - if (_whereBuilder.Length == 0) - { - _whereBuilder.Append(" where "); - } - else - { - _whereBuilder.AppendFormat(" {0} ", conditionOperator); - } - - _whereBuilder.Append(sqlExpression); - } - - /// - /// Visits the expression. - /// - /// The expression to visit. - /// The result of the visit. - protected virtual object VisitExpression(Expression expression) - { - switch (expression.NodeType) - { - case ExpressionType.Lambda: - return VisitLambda(expression as LambdaExpression); - - case ExpressionType.LessThan: - case ExpressionType.LessThanOrEqual: - case ExpressionType.GreaterThan: - case ExpressionType.GreaterThanOrEqual: - case ExpressionType.Equal: - case ExpressionType.NotEqual: - case ExpressionType.And: - case ExpressionType.AndAlso: - case ExpressionType.Or: - case ExpressionType.OrElse: - return VisitBinary((BinaryExpression)expression); - - case ExpressionType.Convert: - case ExpressionType.Not: - return VisitUnary((UnaryExpression)expression); - - case ExpressionType.New: - return VisitNew((NewExpression)expression); - - case ExpressionType.MemberAccess: - return VisitMemberAccess((MemberExpression)expression); - - case ExpressionType.Constant: - return VisitConstantExpression((ConstantExpression)expression); - } - - return expression; - } - - /// - /// Processes a lambda expression. - /// - /// The lambda expression. - /// The result of the processing. - protected virtual object VisitLambda(LambdaExpression epxression) - { - if (epxression.Body.NodeType == ExpressionType.MemberAccess) - { - var member = epxression.Body as MemberExpression; - if (member?.Expression != null) - { - return $"{VisitMemberAccess(member)} = '1'"; - } - } - - return VisitExpression(epxression.Body); - } - - /// - /// Processes a binary expression. - /// - /// The binary expression. - /// The result of the processing. - protected virtual object VisitBinary(BinaryExpression expression) - { - object left, right; - var operand = BindOperant(expression.NodeType); - if (operand == "and" || operand == "or") - { - // Left side. - var member = expression.Left as MemberExpression; - if (member != null && - member.Expression != null && - member.Expression.NodeType == ExpressionType.Parameter) - { - left = $"{VisitMemberAccess(member)} = '1'"; - } - else - { - left = VisitExpression(expression.Left); - } - - // Right side. - member = expression.Right as MemberExpression; - if (member != null && - member.Expression != null && - member.Expression.NodeType == ExpressionType.Parameter) - { - right = $"{VisitMemberAccess(member)} = '1'"; - } - else - { - right = VisitExpression(expression.Right); - } - } - else - { - // It's a single expression. - left = VisitExpression(expression.Left); - right = VisitExpression(expression.Right); - - var paramName = "p" + _parameterIndex++; - _parameters.Add(paramName, value: right); - return $"{left} {operand} @{paramName}"; - } - - return $"{left} {operand} {right}"; - } - - /// - /// Processes a unary expression. - /// - /// The unary expression. - /// The result of the processing. - protected virtual object VisitUnary(UnaryExpression expression) - { - switch (expression.NodeType) - { - case ExpressionType.Not: - var o = VisitExpression(expression.Operand); - if (!(o is string)) - { - return !(bool)o; - } - - var memberExpression = expression.Operand as MemberExpression; - if (memberExpression != null && - Resolvers.Properties(memberExpression.Expression.Type).Any(p => p.Name == (string)o)) - { - o = $"{o} = '1'"; - } - - return $"not ({o})"; - case ExpressionType.Convert: - if (expression.Method != null) - { - return Expression.Lambda(expression).Compile().DynamicInvoke(); - } - break; - } - - return VisitExpression(expression.Operand); - } - - /// - /// Processes a new expression. - /// - /// The new expression. - /// The result of the processing. - protected virtual object VisitNew(NewExpression expression) - { - var member = Expression.Convert(expression, typeof(object)); - var lambda = Expression.Lambda>(member); - var getter = lambda.Compile(); - return getter(); - } - - /// - /// Processes a member access expression. - /// - /// The member access expression. - /// The result of the processing. - protected virtual object VisitMemberAccess(MemberExpression expression) - { - if (expression.Expression != null && expression.Expression.NodeType == ExpressionType.Parameter) - { - return MemberToColumn(expression); - } - - var member = Expression.Convert(expression, typeof(object)); - var lambda = Expression.Lambda>(member); - var getter = lambda.Compile(); - return getter(); - } - - /// - /// Processes a constant expression. - /// - /// The constant expression. - /// The result of the processing. - protected virtual object VisitConstantExpression(ConstantExpression expression) - { - return expression.Value ?? "null"; - } - - /// - /// Proccesses a member expression. - /// - /// The member expression. - /// The result of the processing. - protected virtual string MemberToColumn(MemberExpression expression) - { - return Resolvers.Column((PropertyInfo)expression.Member); - } - - /// - /// Returns the expression operand for the specified expression type. - /// - /// The expression type for node of an expression tree. - /// The expression operand equivalent of the . - protected virtual string BindOperant(ExpressionType expressionType) - { - switch (expressionType) - { - case ExpressionType.Equal: - return "="; - case ExpressionType.NotEqual: - return "<>"; - case ExpressionType.GreaterThan: - return ">"; - case ExpressionType.GreaterThanOrEqual: - return ">="; - case ExpressionType.LessThan: - return "<"; - case ExpressionType.LessThanOrEqual: - return "<="; - case ExpressionType.AndAlso: - return "and"; - case ExpressionType.OrElse: - return "or"; - case ExpressionType.Add: - return "+"; - case ExpressionType.Subtract: - return "-"; - case ExpressionType.Multiply: - return "*"; - case ExpressionType.Divide: - return "/"; - case ExpressionType.Modulo: - return "MOD"; - case ExpressionType.Coalesce: - return "COALESCE"; - default: - return expressionType.ToString(); - } - } - - /// - /// Returns the current SQL query. - /// - /// The current SQL query. - public string ToSql() - { - return _whereBuilder.ToString(); - } - - /// - /// Returns the current SQL query. - /// - /// When this method returns, contains the parameters for the query. - /// The current SQL query. - public string ToSql(out DynamicParameters parameters) - { - parameters = _parameters; - return _whereBuilder.ToString(); - } - - /// - /// Returns the current SQL query. - /// - /// The current SQL query. - public override string ToString() - { - return _whereBuilder.ToString(); - } - } - - /// - /// Inserts the specified entity into the database and returns the id. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// The entity to be inserted. - /// Optional transaction for the command. - /// The id of the inserted entity. - public static object Insert(this IDbConnection connection, TEntity entity, IDbTransaction transaction = null) where TEntity : class - { - var sql = BuildInsertQuery(connection, typeof(TEntity)); - return connection.ExecuteScalar(sql, entity, transaction); - } - - /// - /// Inserts the specified entity into the database and returns the id. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// The entity to be inserted. - /// Optional transaction for the command. - /// The id of the inserted entity. - public static Task InsertAsync(this IDbConnection connection, TEntity entity, IDbTransaction transaction = null) where TEntity : class - { - var sql = BuildInsertQuery(connection, typeof(TEntity)); - return connection.ExecuteScalarAsync(sql, entity, transaction); - } - - private static string BuildInsertQuery(IDbConnection connection, Type type) - { - string sql; - if (!_insertQueryCache.TryGetValue(type, out sql)) - { - var tableName = Resolvers.Table(type); - - bool isIdentity; - var keyProperty = Resolvers.KeyProperty(type, out isIdentity); - - var typeProperties = new List(); - foreach (var typeProperty in Resolvers.Properties(type)) - { - if (typeProperty == keyProperty) - { - if (isIdentity) - { - // Skip key properties marked as an identity column. - continue; - } - } - - if (typeProperty.GetSetMethod() != null) - { - typeProperties.Add(typeProperty); - } - } - - var columnNames = typeProperties.Select(Resolvers.Column).ToArray(); - var paramNames = typeProperties.Select(p => "@" + p.Name).ToArray(); - - var builder = GetBuilder(connection); - sql = builder.BuildInsert(tableName, columnNames, paramNames, keyProperty); - - _insertQueryCache.TryAdd(type, sql); - } - - return sql; - } - - /// - /// Updates the values of the specified entity in the database. - /// The return value indicates whether the operation succeeded. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// The entity in the database. - /// Optional transaction for the command. - /// A value indicating whether the update operation succeeded. - public static bool Update(this IDbConnection connection, TEntity entity, IDbTransaction transaction = null) - { - var sql = BuildUpdateQuery(typeof(TEntity)); - return connection.Execute(sql, entity, transaction) > 0; - } - - /// - /// Updates the values of the specified entity in the database. - /// The return value indicates whether the operation succeeded. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// The entity in the database. - /// Optional transaction for the command. - /// A value indicating whether the update operation succeeded. - public static async Task UpdateAsync(this IDbConnection connection, TEntity entity, IDbTransaction transaction = null) - { - var sql = BuildUpdateQuery(typeof(TEntity)); - return await connection.ExecuteAsync(sql, entity, transaction) > 0; - } - - private static string BuildUpdateQuery(Type type) - { - string sql; - if (!_updateQueryCache.TryGetValue(type, out sql)) - { - var tableName = Resolvers.Table(type); - var keyProperty = Resolvers.KeyProperty(type); - - // Use all properties which are settable. - var typeProperties = Resolvers.Properties(type) - .Where(p => p != keyProperty) - .Where(p => p.GetSetMethod() != null) - .ToArray(); - - var columnNames = typeProperties.Select(p => $"{Resolvers.Column(p)} = @{p.Name}").ToArray(); - - sql = $"update {tableName} set {string.Join(", ", columnNames)} where {Resolvers.Column(keyProperty)} = @{keyProperty.Name}"; - - _updateQueryCache.TryAdd(type, sql); - } - - return sql; - } - - /// - /// Deletes the specified entity from the database. - /// Returns a value indicating whether the operation succeeded. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// The entity to be deleted. - /// Optional transaction for the command. - /// A value indicating whether the delete operation succeeded. - public static bool Delete(this IDbConnection connection, TEntity entity, IDbTransaction transaction = null) - { - var sql = BuildDeleteQuery(typeof(TEntity)); - return connection.Execute(sql, entity, transaction) > 0; - } - - /// - /// Deletes the specified entity from the database. - /// Returns a value indicating whether the operation succeeded. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// The entity to be deleted. - /// Optional transaction for the command. - /// A value indicating whether the delete operation succeeded. - public static async Task DeleteAsync(this IDbConnection connection, TEntity entity, IDbTransaction transaction = null) - { - var sql = BuildDeleteQuery(typeof(TEntity)); - return await connection.ExecuteAsync(sql, entity, transaction) > 0; - } - - private static string BuildDeleteQuery(Type type) - { - string sql; - if (!_deleteQueryCache.TryGetValue(type, out sql)) - { - var tableName = Resolvers.Table(type); - var keyProperty = Resolvers.KeyProperty(type); - var keyColumnName = Resolvers.Column(keyProperty); - - sql = $"delete from {tableName} where {keyColumnName} = @{keyProperty.Name}"; - - _deleteQueryCache.TryAdd(type, sql); - } - - return sql; - } - - /// - /// Deletes all entities of type matching the specified predicate from the database. - /// Returns a value indicating whether the operation succeeded. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// A predicate to filter which entities are deleted. - /// Optional transaction for the command. - /// A value indicating whether the delete operation succeeded. - public static bool DeleteMultiple(this IDbConnection connection, Expression> predicate, IDbTransaction transaction = null) - { - DynamicParameters parameters; - var sql = BuildDeleteMultipleQuery(predicate, out parameters); - return connection.Execute(sql, parameters, transaction) > 0; - } - - /// - /// Deletes all entities of type matching the specified predicate from the database. - /// Returns a value indicating whether the operation succeeded. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// A predicate to filter which entities are deleted. - /// Optional transaction for the command. - /// A value indicating whether the delete operation succeeded. - public static async Task DeleteMultipleAsync(this IDbConnection connection, Expression> predicate, IDbTransaction transaction = null) - { - DynamicParameters parameters; - var sql = BuildDeleteMultipleQuery(predicate, out parameters); - return await connection.ExecuteAsync(sql, parameters, transaction) > 0; - } - - private static string BuildDeleteMultipleQuery(Expression> predicate, out DynamicParameters parameters) - { - var type = typeof(TEntity); - string sql; - if (!_deleteAllQueryCache.TryGetValue(type, out sql)) - { - var tableName = Resolvers.Table(type); - sql = $"delete from {tableName}"; - _deleteAllQueryCache.TryAdd(type, sql); - } - - sql += new SqlExpression() - .Where(predicate) - .ToSql(out parameters); - return sql; - } - - /// - /// Deletes all entities of type from the database. - /// Returns a value indicating whether the operation succeeded. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// Optional transaction for the command. - /// A value indicating whether the delete operation succeeded. - public static bool DeleteAll(this IDbConnection connection, IDbTransaction transaction = null) - { - var sql = BuildDeleteAllQuery(typeof(TEntity)); - return connection.Execute(sql, transaction: transaction) > 0; - } - - /// - /// Deletes all entities of type from the database. - /// Returns a value indicating whether the operation succeeded. - /// - /// The type of the entity. - /// The connection to the database. This can either be open or closed. - /// Optional transaction for the command. - /// A value indicating whether the delete operation succeeded. - public static async Task DeleteAllAsync(this IDbConnection connection, IDbTransaction transaction = null) - { - var sql = BuildDeleteAllQuery(typeof(TEntity)); - return await connection.ExecuteAsync(sql, transaction: transaction) > 0; - } - - private static string BuildDeleteAllQuery(Type type) - { - string sql; - if (!_deleteAllQueryCache.TryGetValue(type, out sql)) - { - var tableName = Resolvers.Table(type); - sql = $"delete from {tableName}"; - _deleteAllQueryCache.TryAdd(type, sql); - } - - return sql; - } - - /// - /// Helper class for retrieving type metadata to build sql queries using configured resolvers. - /// - public static class Resolvers - { - private class KeyPropertyInfo - { - public KeyPropertyInfo(PropertyInfo propertyInfo, bool isIdentity) - { - PropertyInfo = propertyInfo; - IsIdentity = isIdentity; - } - - public PropertyInfo PropertyInfo { get; } - - public bool IsIdentity { get; } - } - - private static readonly ConcurrentDictionary _typeTableNameCache = new ConcurrentDictionary(); - private static readonly ConcurrentDictionary _columnNameCache = new ConcurrentDictionary(); - private static readonly ConcurrentDictionary _typeKeyPropertyCache = new ConcurrentDictionary(); - private static readonly ConcurrentDictionary _typePropertiesCache = new ConcurrentDictionary(); - private static readonly ConcurrentDictionary _typeForeignKeyPropertyCache = new ConcurrentDictionary(); - - /// - /// Gets the key property for the specified type, using the configured . - /// - /// The to get the key property for. - /// The key property for . - public static PropertyInfo KeyProperty(Type type) - { - bool isIdentity; - return KeyProperty(type, out isIdentity); - } - - /// - /// Gets the key property for the specified type, using the configured . - /// - /// The to get the key property for. - /// A value indicating whether the key is an identity. - /// The key property for . - public static PropertyInfo KeyProperty(Type type, out bool isIdentity) - { - KeyPropertyInfo keyProperty; - if (!_typeKeyPropertyCache.TryGetValue(type, out keyProperty)) - { - var propertyInfo = _keyPropertyResolver.ResolveKeyProperty(type, out isIdentity); - keyProperty = new KeyPropertyInfo(propertyInfo, isIdentity); - _typeKeyPropertyCache.TryAdd(type, keyProperty); - } - - isIdentity = keyProperty.IsIdentity; - return keyProperty.PropertyInfo; - } - - /// - /// Gets the foreign key property for the specified source type and including type - /// using the configure d. - /// - /// The source type which should contain the foreign key property. - /// The type of the foreign key relation. - /// The foreign key relationship type. - /// The foreign key property for and . - public static PropertyInfo ForeignKeyProperty(Type sourceType, Type includingType, out ForeignKeyRelation foreignKeyRelation) - { - var key = $"{sourceType.FullName};{includingType.FullName}"; - - ForeignKeyInfo foreignKeyInfo; - if (!_typeForeignKeyPropertyCache.TryGetValue(key, out foreignKeyInfo)) - { - // Resole the property and relation. - var foreignKeyProperty = _foreignKeyPropertyResolver.ResolveForeignKeyProperty(sourceType, includingType, out foreignKeyRelation); - - // Cache the info. - foreignKeyInfo = new ForeignKeyInfo(foreignKeyProperty, foreignKeyRelation); - _typeForeignKeyPropertyCache.TryAdd(key, foreignKeyInfo); - } - - foreignKeyRelation = foreignKeyInfo.Relation; - return foreignKeyInfo.PropertyInfo; - } - - private class ForeignKeyInfo - { - public ForeignKeyInfo(PropertyInfo propertyInfo, ForeignKeyRelation relation) - { - PropertyInfo = propertyInfo; - Relation = relation; - } - - public PropertyInfo PropertyInfo { get; private set; } - - public ForeignKeyRelation Relation { get; private set; } - } - - /// - /// Gets the properties to be mapped for the specified type, using the configured - /// . - /// - /// The to get the properties from. - /// >The collection of to be mapped properties of . - public static IEnumerable Properties(Type type) - { - PropertyInfo[] properties; - if (!_typePropertiesCache.TryGetValue(type, out properties)) - { - properties = _propertyResolver.ResolveProperties(type).ToArray(); - _typePropertiesCache.TryAdd(type, properties); - } - - return properties; - } - - /// - /// Gets the name of the table in the database for the specified type, - /// using the configured . - /// - /// The to get the table name for. - /// The table name in the database for . - public static string Table(Type type) - { - string name; - if (!_typeTableNameCache.TryGetValue(type, out name)) - { - name = _tableNameResolver.ResolveTableName(type); - _typeTableNameCache.TryAdd(type, name); - } - return name; - } - - /// - /// Gets the name of the column in the database for the specified type, - /// using the configured . - /// - /// The to get the column name for. - /// The column name in the database for . - public static string Column(PropertyInfo propertyInfo) - { - var key = $"{propertyInfo.DeclaringType}.{propertyInfo.Name}"; - - string columnName; - if (!_columnNameCache.TryGetValue(key, out columnName)) - { - columnName = _columnNameResolver.ResolveColumnName(propertyInfo); - _columnNameCache.TryAdd(key, columnName); - } - - return columnName; - } - - /// - /// Provides access to default resolver implementations. - /// - public static class Default - { - /// - /// The default column name resolver. - /// - public static readonly IColumnNameResolver ColumnNameResolver = new DefaultColumnNameResolver(); - - /// - /// The default property resolver. - /// - public static readonly IPropertyResolver PropertyResolver = new DefaultPropertyResolver(); - - /// - /// The default key property resolver. - /// - public static readonly IKeyPropertyResolver KeyPropertyResolver = new DefaultKeyPropertyResolver(); - - /// - /// The default table name resolver. - /// - public static readonly ITableNameResolver TableNameResolver = new DefaultTableNameResolver(); - } - } - - #region Property resolving - private static IPropertyResolver _propertyResolver = new DefaultPropertyResolver(); - - /// - /// Defines methods for resolving the properties of entities. - /// Custom implementations can be registerd with . - /// - public interface IPropertyResolver - { - /// - /// Resolves the properties to be mapped for the specified type. - /// - /// The type to resolve the properties to be mapped for. - /// A collection of 's of the . - IEnumerable ResolveProperties(Type type); - } - - /// - /// Sets the implementation for resolving key of entities. - /// - /// An instance of . - public static void SetPropertyResolver(IPropertyResolver propertyResolver) - { - _propertyResolver = propertyResolver; - } - - /// - /// Represents the base class for property resolvers. - /// - public abstract class PropertyResolverBase : IPropertyResolver - { - private static readonly HashSet _primitiveTypes = new HashSet - { - typeof(object), - typeof(string), - typeof(Guid), - typeof(decimal), - typeof(double), - typeof(float), - typeof(DateTime), - typeof(DateTimeOffset), - typeof(TimeSpan), - typeof(byte[]) - }; - - /// - /// Resolves the properties to be mapped for the specified type. - /// - /// The type to resolve the properties to be mapped for. - /// A collection of 's of the . - public abstract IEnumerable ResolveProperties(Type type); - - /// - /// Gets a collection of types that are considered 'primitive' for Dommel but are not for the CLR. - /// Override this if you need your own implementation of this. - /// - protected virtual HashSet PrimitiveTypes => _primitiveTypes; - - /// - /// Filters the complex types from the specified collection of properties. - /// - /// A collection of properties. - /// The properties that are considered 'primitive' of . - protected virtual IEnumerable FilterComplexTypes(IEnumerable properties) - { - foreach (var property in properties) - { - var type = property.PropertyType; - type = Nullable.GetUnderlyingType(type) ?? type; - - if (type.GetTypeInfo().IsPrimitive || type.GetTypeInfo().IsEnum || PrimitiveTypes.Contains(type)) - { - yield return property; - } - } - } - } - - /// - /// Default implemenation of the interface. - /// - public class DefaultPropertyResolver : PropertyResolverBase - { - /// - public override IEnumerable ResolveProperties(Type type) - { - return FilterComplexTypes(type.GetProperties()); - } - } - #endregion - - #region Key property resolving - private static IKeyPropertyResolver _keyPropertyResolver = new DefaultKeyPropertyResolver(); - - /// - /// Sets the implementation for resolving key properties of entities. - /// - /// An instance of . - public static void SetKeyPropertyResolver(IKeyPropertyResolver resolver) - { - _keyPropertyResolver = resolver; - } - - /// - /// Defines methods for resolving the key property of entities. - /// Custom implementations can be registerd with . - /// - public interface IKeyPropertyResolver - { - /// - /// Resolves the key property for the specified type. - /// - /// The type to resolve the key property for. - /// A instance of the key property of . - PropertyInfo ResolveKeyProperty(Type type); - - /// - /// Resolves the key property for the specified type. - /// - /// The type to resolve the key property for. - /// Indicates whether the key property is an identity property. - /// A instance of the key property of . - PropertyInfo ResolveKeyProperty(Type type, out bool isIdentity); - } - - /// - /// Implements the interface by resolving key properties - /// with the [Key] attribute or with the name 'Id'. - /// - public class DefaultKeyPropertyResolver : IKeyPropertyResolver - { - /// - /// Finds the key property by looking for a property with the [Key] attribute or with the name 'Id'. - /// - public virtual PropertyInfo ResolveKeyProperty(Type type) - { - bool isIdentity; - return ResolveKeyProperty(type, out isIdentity); - } - - /// - /// Finds the key property by looking for a property with the [Key] attribute or with the name 'Id'. - /// - public PropertyInfo ResolveKeyProperty(Type type, out bool isIdentity) - { - var allProps = Resolvers.Properties(type).ToList(); - - // Look for properties with the [Key] attribute. - var keyProps = allProps.Where(p => p.GetCustomAttributes(true).Any(a => a is KeyAttribute)).ToList(); - - if (keyProps.Count == 0) - { - // Search for properties named as 'Id' as fallback. - keyProps = allProps.Where(p => p.Name.Equals("Id", StringComparison.OrdinalIgnoreCase)).ToList(); - } - - if (keyProps.Count == 0) - { - throw new Exception($"Could not find the key property for type '{type.FullName}'."); - } - - if (keyProps.Count > 1) - { - throw new Exception($"Multiple key properties were found for type '{type.FullName}'."); - } - - isIdentity = true; - return keyProps[0]; - } - } - #endregion - - #region Foreign key property resolving - /// - /// Describes a foreign key relationship. - /// - public enum ForeignKeyRelation - { - /// - /// Specifies a one-to-one relationship. - /// - OneToOne, - - /// - /// Specifies a one-to-many relationship. - /// - OneToMany, - - /// - /// Specifies a many-to-many relationship. - /// - ManyToMany - } - - private static IForeignKeyPropertyResolver _foreignKeyPropertyResolver = new DefaultForeignKeyPropertyResolver(); - - /// - /// Sets the implementation for resolving foreign key properties. - /// - /// An instance of . - public static void SetForeignKeyPropertyResolver(IForeignKeyPropertyResolver resolver) - { - _foreignKeyPropertyResolver = resolver; - } - - /// - /// Defines methods for resolving foreign key properties. - /// - public interface IForeignKeyPropertyResolver - { - /// - /// Resolves the foreign key property for the specified source type and including type. - /// - /// The source type which should contain the foreign key property. - /// The type of the foreign key relation. - /// The foreign key relationship type. - /// The foreign key property for and . - PropertyInfo ResolveForeignKeyProperty(Type sourceType, Type includingType, out ForeignKeyRelation foreignKeyRelation); - } - - /// - /// Implements the interface. - /// - public class DefaultForeignKeyPropertyResolver : IForeignKeyPropertyResolver - { - /// - /// Resolves the foreign key property for the specified source type and including type - /// by using + Id as property name. - /// - /// The source type which should contain the foreign key property. - /// The type of the foreign key relation. - /// The foreign key relationship type. - /// The foreign key property for and . - public virtual PropertyInfo ResolveForeignKeyProperty(Type sourceType, Type includingType, out ForeignKeyRelation foreignKeyRelation) - { - var oneToOneFk = ResolveOneToOne(sourceType, includingType); - if (oneToOneFk != null) - { - foreignKeyRelation = ForeignKeyRelation.OneToOne; - return oneToOneFk; - } - - var oneToManyFk = ResolveOneToMany(sourceType, includingType); - if (oneToManyFk != null) - { - foreignKeyRelation = ForeignKeyRelation.OneToMany; - return oneToManyFk; - } - - var msg = $"Could not resolve foreign key property. Source type '{sourceType.FullName}'; including type: '{includingType.FullName}'."; - throw new Exception(msg); - } - - private static PropertyInfo ResolveOneToOne(Type sourceType, Type includingType) - { - // Look for the foreign key on the source type. - var foreignKeyName = includingType.Name + "Id"; - var foreignKeyProperty = sourceType.GetProperties().FirstOrDefault(p => p.Name == foreignKeyName); - - return foreignKeyProperty; - } - - private static PropertyInfo ResolveOneToMany(Type sourceType, Type includingType) - { - // Look for the foreign key on the including type. - var foreignKeyName = sourceType.Name + "Id"; - var foreignKeyProperty = includingType.GetProperties().FirstOrDefault(p => p.Name == foreignKeyName); - return foreignKeyProperty; - } - } - #endregion - - #region Table name resolving - private static ITableNameResolver _tableNameResolver = new DefaultTableNameResolver(); - - /// - /// Sets the implementation for resolving table names for entities. - /// - /// An instance of . - public static void SetTableNameResolver(ITableNameResolver resolver) - { - _tableNameResolver = resolver; - } - - /// - /// Defines methods for resolving table names of entities. - /// Custom implementations can be registerd with . - /// - public interface ITableNameResolver - { - /// - /// Resolves the table name for the specified type. - /// - /// The type to resolve the table name for. - /// A string containing the resolved table name for for . - string ResolveTableName(Type type); - } - - /// - /// Implements the interface by resolving table names - /// by making the type name plural and removing the 'I' prefix for interfaces. - /// - public class DefaultTableNameResolver : ITableNameResolver - { - /// - /// Gets or sets the table to use in the database. - /// - public string TableName { get; protected set; } - - /// - /// Resolves the table name by making the type plural (+ 's', Product -> Products) - /// and removing the 'I' prefix for interfaces. - /// - public virtual string ResolveTableName(Type type) - { - var attr = ((System.Attribute[])type.GetTypeInfo().GetCustomAttributes())[0]; - var name = (attr as dynamic).TableName; - if (type.GetTypeInfo().IsInterface && name.StartsWith("I")) - { - name = name.Substring(1); - } - - // todo: add [Table] attribute support. - return name; - } - - /// - /// Creator for dynamic type - /// - /// - public virtual void Table(string tableName) - { - TableName = tableName; - } - } - #endregion - - #region Column name resolving - private static IColumnNameResolver _columnNameResolver = new DefaultColumnNameResolver(); - - /// - /// Sets the implementation for resolving column names. - /// - /// An instance of . - public static void SetColumnNameResolver(IColumnNameResolver resolver) - { - _columnNameResolver = resolver; - } - - /// - /// Defines methods for resolving column names for entities. - /// Custom implementations can be registerd with . - /// - public interface IColumnNameResolver - { - /// - /// Resolves the column name for the specified property. - /// - /// The property of the entity. - /// The column name for the property. - string ResolveColumnName(PropertyInfo propertyInfo); - } - - /// - /// Implements the . - /// - public class DefaultColumnNameResolver : IColumnNameResolver - { - /// - /// Resolves the column name for the property. This is just the name of the property. - /// - public virtual string ResolveColumnName(PropertyInfo propertyInfo) - { - return propertyInfo.Name; - } - } - #endregion - - #region Sql builders - /// - /// Adds a custom implementation of - /// for the specified ADO.NET connection type. - /// - /// - /// The ADO.NET conncetion type to use the with. - /// Example: typeof(SqlConnection). - /// - /// An implementation of the . - public static void AddSqlBuilder(Type connectionType, ISqlBuilder builder) - { - _sqlBuilders[connectionType.Name.ToLower()] = builder; - } - - private static ISqlBuilder GetBuilder(IDbConnection connection) - { - var connectionName = connection.GetType().Name.ToLower(); - ISqlBuilder builder; - return _sqlBuilders.TryGetValue(connectionName, out builder) ? builder : new SqlServerSqlBuilder(); - } - - /// - /// Defines methods for building specialized SQL queries. - /// - public interface ISqlBuilder - { - /// - /// Builds an insert query using the specified table name, column names and parameter names. - /// A query to fetch the new id will be included as well. - /// - /// The name of the table to query. - /// The names of the columns in the table. - /// The names of the parameters in the database command. - /// - /// The key property. This can be used to query a specific column for the new id. This is - /// optional. - /// - /// An insert query including a query to fetch the new id. - string BuildInsert(string tableName, string[] columnNames, string[] paramNames, PropertyInfo keyProperty); - } - - private sealed class SqlServerSqlBuilder : ISqlBuilder - { - public string BuildInsert(string tableName, string[] columnNames, string[] paramNames, PropertyInfo keyProperty) - { - return $"set nocount on insert into {tableName} ({string.Join(", ", columnNames)}) values ({string.Join(", ", paramNames)}) select cast(scope_identity() as int)"; - } - } - - private sealed class SqlServerCeSqlBuilder : ISqlBuilder - { - public string BuildInsert(string tableName, string[] columnNames, string[] paramNames, PropertyInfo keyProperty) - { - return $"insert into {tableName} ({string.Join(", ", columnNames)}) values ({string.Join(", ", paramNames)}) select cast(@@IDENTITY as int)"; - } - } - - private sealed class SqliteSqlBuilder : ISqlBuilder - { - public string BuildInsert(string tableName, string[] columnNames, string[] paramNames, PropertyInfo keyProperty) - { - return $"insert into {tableName} ({string.Join(", ", columnNames)}) values ({string.Join(", ", paramNames)}); select last_insert_rowid() id"; - } - } - - private sealed class MySqlSqlBuilder : ISqlBuilder - { - public string BuildInsert(string tableName, string[] columnNames, string[] paramNames, PropertyInfo keyProperty) - { - return $"insert into {tableName} (`{string.Join("`, `", columnNames)}`) values ({string.Join(", ", paramNames)}); select LAST_INSERT_ID() id"; - } - } - - private sealed class PostgresSqlBuilder : ISqlBuilder - { - public string BuildInsert(string tableName, string[] columnNames, string[] paramNames, PropertyInfo keyProperty) - { - var sql = $"insert into {tableName} ({string.Join(", ", columnNames)}) values ({string.Join(", ", paramNames)})"; - - if (keyProperty != null) - { - var keyColumnName = Resolvers.Column(keyProperty); - - sql += " RETURNING " + keyColumnName; - } - else - { - // todo: what behavior is desired here? - throw new Exception("A key property is required for the PostgresSqlBuilder."); - } - - return sql; - } - } - #endregion - } -} diff --git a/NETCORE/Slickflow/Source/SlickOne.WebUtility/HttpClientHelper.cs b/NETCORE/Slickflow/Source/SlickOne.WebUtility/HttpClientHelper.cs new file mode 100644 index 00000000..3d51c9ed --- /dev/null +++ b/NETCORE/Slickflow/Source/SlickOne.WebUtility/HttpClientHelper.cs @@ -0,0 +1,191 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Security.Cryptography; +using System.Net.Http; +using System.Net.Http.Headers; +using Newtonsoft.Json; + +namespace SlickOne.WebUtility +{ + /// + /// Mime内容格式 + /// + public enum MimeFormat + { + XML = 0, + JSON = 1 + } + + /// + /// HttpClient 帮助类 + /// + public class HttpClientHelper + { + private const string WebApiRequestHeaderAuthorization = "Authorization"; + private const string WebApiRequestHeaderNamePrefix = "BASIC "; + private const string WebApiRequestHeaderNameHashed = "BASIC-HASHED"; + + private static readonly HttpClient HttpClient; + + /// + /// URL 属性 + /// + private string URL + { + get; + set; + } + + /// + /// 构造方法 + /// + static HttpClientHelper() + { + HttpClient = new System.Net.Http.HttpClient(); + HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + } + + /// + /// 创建基本HttpClientHelper类 + /// + /// URL + /// 帮助类 + public static HttpClientHelper CreateHelper(string url) + { + var helper = new HttpClientHelper(); + + if (url != string.Empty) + { + helper.URL = url; + } + return helper; + } + + + /// + /// 返回请求结果 + /// + /// 字符串 + public string Get() + { + var response = HttpClient.GetAsync(URL).Result; + var message = response.Content.ReadAsStringAsync().Result; + + return message; + } + + /// + /// 获取 + /// + /// 类型 + /// 对象 + public T1 Get() + where T1 : class + { + var response = HttpClient.GetAsync(URL).Result; + var message = response.Content.ReadAsStringAsync().Result; + var result = JsonConvert.DeserializeObject(message); + + return result; + } + + /// + /// 提交 + /// + /// 类型1 + /// 类型2 + /// 对象t + /// 对象 + public T2 Post(T1 t) + where T1 : class + where T2 : class + { + string jsonValue = JsonConvert.SerializeObject(t); + StringContent content = new StringContent(jsonValue, Encoding.UTF8, "application/json"); + var response = HttpClient.PostAsync(URL, content).Result; + var message = response.Content.ReadAsStringAsync().Result; + var result = JsonConvert.DeserializeObject(message); + + return result; + } + + /// + /// Post方法 + /// + /// 动态实体 + /// 响应结果 + public ResponseResult Post(dynamic t) + { + string jsonValue = JsonConvert.SerializeObject(t); + StringContent content = new StringContent(jsonValue, Encoding.UTF8, "application/json"); + var response = HttpClient.PostAsync(URL, content).Result; + var message = response.Content.ReadAsStringAsync().Result; + var result = JsonConvert.DeserializeObject(message); + + return result; + } + + /// + /// Post获取分页数据 + /// + /// 类型1 + /// 类型2 + /// 对象t + /// 对象 + public List Query(T1 t) + where T1 : class + where T2 : class + { + string jsonValue = JsonConvert.SerializeObject(t); + StringContent content = new StringContent(jsonValue, Encoding.UTF8, "application/json"); + var resp = HttpClient.PostAsync(URL, content); + var response = resp.Result; + var message = response.Content.ReadAsStringAsync().Result; + var result = JsonConvert.DeserializeObject>>(message); + + return result.Entity; + } + + /// + /// 插入 + /// + /// 类型1 + /// 类型2 + /// 对象t + /// 对象 + public T2 Insert(T1 t) + where T1 : class + where T2 : class + { + string jsonValue = JsonConvert.SerializeObject(t); + StringContent content = new System.Net.Http.StringContent(jsonValue, Encoding.UTF8, "application/json"); + var response = HttpClient.PostAsync(URL, content).Result; + var message = response.Content.ReadAsStringAsync().Result; + var result = JsonConvert.DeserializeObject(message); + + return result; + } + + /// + /// 更新 + /// + /// 类型1 + /// 类型2 + /// 对象t + /// 对象 + public T2 Update(T1 t) + where T1 : class + where T2 : class + { + string jsonValue = JsonConvert.SerializeObject(t); + StringContent content = new System.Net.Http.StringContent(jsonValue, Encoding.UTF8, "application/json"); + var response = HttpClient.PutAsync(URL, content).Result; + var message = response.Content.ReadAsStringAsync().Result; + var result = JsonConvert.DeserializeObject(message); + + return result; + } + } +} diff --git a/NETCORE/Slickflow/Source/Slickflow.BizAppService/Interface/IProductOrderService.cs b/NETCORE/Slickflow/Source/Slickflow.BizAppService/Interface/IProductOrderService.cs index c22466b0..a27652d1 100644 --- a/NETCORE/Slickflow/Source/Slickflow.BizAppService/Interface/IProductOrderService.cs +++ b/NETCORE/Slickflow/Source/Slickflow.BizAppService/Interface/IProductOrderService.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Data; using Slickflow.BizAppService.Entity; namespace Slickflow.BizAppService.Interface @@ -13,7 +14,7 @@ namespace Slickflow.BizAppService.Interface public partial interface IProductOrderService { List GetPaged(ProductOrderQuery query, out int count); - ProductOrderEntity SyncOrder(); + ProductOrderEntity SyncOrder(IDbConnection conn, IDbTransaction trans); WfAppResult Dispatch(ProductOrderEntity entity); WfAppResult Sample(ProductOrderEntity entity); WfAppResult Manufacture(ProductOrderEntity entity); diff --git a/NETCORE/Slickflow/Source/Slickflow.BizAppService/Service/ProductOrderService.cs b/NETCORE/Slickflow/Source/Slickflow.BizAppService/Service/ProductOrderService.cs index 82e0e65e..65688973 100644 --- a/NETCORE/Slickflow/Source/Slickflow.BizAppService/Service/ProductOrderService.cs +++ b/NETCORE/Slickflow/Source/Slickflow.BizAppService/Service/ProductOrderService.cs @@ -1,10 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Dapper; +using System.Data; using DapperExtensions; +using SlickOne.WebUtility; using Slickflow.BizAppService.Common; using Slickflow.BizAppService.Entity; using Slickflow.BizAppService.Interface; @@ -126,7 +125,7 @@ private int GetStatusByRoleCode(string roleCode) /// 同步订单 /// /// - public ProductOrderEntity SyncOrder() + public ProductOrderEntity SyncOrder(IDbConnection conn, IDbTransaction trans) { var entity = new ProductOrderEntity(); var rnd = new Random(); @@ -145,7 +144,7 @@ public ProductOrderEntity SyncOrder() entity.Remark = shoptype[rnd.Next(1, 6)-1]; entity.CreatedTime = System.DateTime.Now; - QuickRepository.Insert(entity); + QuickRepository.Insert(conn, entity, trans); return entity; } @@ -245,8 +244,33 @@ public WfAppResult Sample(ProductOrderEntity entity) short status = GetProductOrderStatusByActivityCode(WfAppRunner.ProcessGUID, WfAppRunner.Version, WfAppRunner.NextActivityPerformers.Keys.ElementAt(0)); UpdateStatus(entity.ID, status, session); + session.Commit(); appResult = WfAppResult.Success(); + + try + { + //调用工厂作业流程节点: + //流程节点:OrderFactoryMessageCaught + //流程ProcessGUID:0f5829c7-17df-43eb-bfe5-1f2870fb2a0e Version:1 + var invokeAppRunner = new WfAppRunner(); + invokeAppRunner.UserID = WfAppRunner.UserID; + invokeAppRunner.UserName = WfAppRunner.UserName; + invokeAppRunner.ProcessGUID = "0f5829c7-17df-43eb-bfe5-1f2870fb2a0e"; + invokeAppRunner.Version = "1"; + invokeAppRunner.AppName = WfAppRunner.AppName; + invokeAppRunner.AppInstanceID = WfAppRunner.AppInstanceID; + invokeAppRunner.AppInstanceCode = WfAppRunner.AppInstanceCode; + invokeAppRunner.DynamicVariables["ActivityCode"] = "OrderFactoryMessageCaught"; + + var httpClient = HttpClientHelper.CreateHelper("http://localhost/sfsweb2/api/wfservice/invokejob"); + var invokeResult = httpClient.Post(invokeAppRunner); + } + catch (System.Exception ex) + { + //记录异常日志 + ; + } } else { diff --git a/NETCORE/Slickflow/Source/Slickflow.BizAppService/Slickflow.BizAppService.csproj b/NETCORE/Slickflow/Source/Slickflow.BizAppService/Slickflow.BizAppService.csproj index 13921ce1..08b32a15 100644 --- a/NETCORE/Slickflow/Source/Slickflow.BizAppService/Slickflow.BizAppService.csproj +++ b/NETCORE/Slickflow/Source/Slickflow.BizAppService/Slickflow.BizAppService.csproj @@ -6,12 +6,7 @@ - - - - - ..\DLL\Dapper.dll - + diff --git a/NETCORE/Slickflow/Source/Slickflow.Data.OracleProvider/OracleWfDataProvider.cs b/NETCORE/Slickflow/Source/Slickflow.Data.OracleProvider/OracleWfDataProvider.cs deleted file mode 100644 index 1045bcd4..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.Data.OracleProvider/OracleWfDataProvider.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Slickflow.Data; - -namespace Slickflow.Data.OracleProvider -{ - /// - /// ORACLE SQL 特定语句 - /// - public class OracleWfDataProvider : IWfDataProvider - { - public string GetSqlTaskPaged(string sql) - { - sql = @"SELECT - * - FROM vwWfActivityInstanceTasks - WHERE rownum <= 100 - AND ProcessState=2 - AND (ActivityType=4 OR WorkItemType=1) - AND ActivityState=@activityState - AND TaskState<>32 - "; - return sql; - } - - public string GetSqlTaskOfMineByAtcitivityInstance(string sql) - { - sql = @"SELECT - * - FROM vwWfActivityInstanceTasks - WHERE rownum = 1 - AND ActivityInstanceID=@activityInstanceID - AND AssignedToUserID=@userID - AND ProcessState=2 - AND (ActivityType=4 OR ActivityType=5 OR ActivityType=6 OR WorkItemType=1) - AND (ActivityState=1 OR ActivityState=2) - ORDER BY TASKID DESC"; - return sql; - } - - public string GetSqlTaskOfMineByAppInstance(string sql) - { - sql = @"SELECT - * - FROM vwWfActivityInstanceTasks - WHERE rownum = 1 - AND AppInstanceID=@appInstanceID - AND ProcessGUID=@processGUID - AND AssignedToUserID=@userID - AND ProcessState=2 - AND (ActivityType=4 OR ActivityType=5 OR ActivityType=6 OR WorkItemType=1) - AND (ActivityState=1 OR ActivityState=2) - ORDER BY TASKID DESC"; - return sql; - } - } -} diff --git a/NETCORE/Slickflow/Source/Slickflow.Data.OracleProvider/Slickflow.Data.OracleProvider.csproj b/NETCORE/Slickflow/Source/Slickflow.Data.OracleProvider/Slickflow.Data.OracleProvider.csproj deleted file mode 100644 index dd6f2e2f..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.Data.OracleProvider/Slickflow.Data.OracleProvider.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - netcoreapp2.1 - - - - - - - diff --git a/NETCORE/Slickflow/Source/Slickflow.Data/DBTypeExtensions.cs b/NETCORE/Slickflow/Source/Slickflow.Data/DBTypeExtensions.cs index ddcef3d1..630c6d35 100644 --- a/NETCORE/Slickflow/Source/Slickflow.Data/DBTypeExtensions.cs +++ b/NETCORE/Slickflow/Source/Slickflow.Data/DBTypeExtensions.cs @@ -3,6 +3,7 @@ using System.Data; using System.Data.SqlClient; //using Oracle.ManagedDataAccess.Client; +//using MySql.Data.MySqlClient; namespace Slickflow.Data { @@ -80,6 +81,8 @@ private static void SetYourDataBaseType() //如果是Oracle数据库,请使用Oracle类型参数 //SetDBType(DBTypeEnum.ORACLE); + + //SetDBType(DBTypeEnum.MYSQL); } /// @@ -102,7 +105,7 @@ internal static IDbConnection CreateConnectionByDBType() } else if (DBTypeExtenstions.DBType == DBTypeEnum.MYSQL) { - //conn = new MySqlConnection(ConnectionString); + ///conn = new MySqlConnection(ConnectionString); } else if (DBTypeExtenstions.DBType == DBTypeEnum.KINGBASE) { diff --git a/NETCORE/Slickflow/Source/Slickflow.Data/IRepository.cs b/NETCORE/Slickflow/Source/Slickflow.Data/IRepository.cs index 7c6d141d..b9d31b6e 100644 --- a/NETCORE/Slickflow/Source/Slickflow.Data/IRepository.cs +++ b/NETCORE/Slickflow/Source/Slickflow.Data/IRepository.cs @@ -50,6 +50,7 @@ public interface IRepository IEnumerable GetByIds(IList ids) where T : class; IEnumerable GetByIds(IDbConnection conn, IList ids, IDbTransaction trans = null, bool buffered = true) where T : class; IEnumerable GetAll() where T : class; + IEnumerable GetAll(IDbConnection conn, IDbTransaction trans) where T : class; IEnumerable Query(string sql, dynamic param = null, bool buffered = true) where T : class; IEnumerable Query(IDbConnection conn, string sql, dynamic param = null, IDbTransaction trans = null, bool buffered = true) where T : class; IEnumerable Query(IDbConnection conn, string sql, dynamic param = null, IDbTransaction trans = null, bool buffered = true); diff --git a/NETCORE/Slickflow/Source/Slickflow.Data/Repository.cs b/NETCORE/Slickflow/Source/Slickflow.Data/Repository.cs index bcbb6627..b820f959 100644 --- a/NETCORE/Slickflow/Source/Slickflow.Data/Repository.cs +++ b/NETCORE/Slickflow/Source/Slickflow.Data/Repository.cs @@ -201,6 +201,19 @@ public IEnumerable GetAll() where T : class } } + /// + /// 获取全部数据集合 + /// + /// + /// + /// + /// + public IEnumerable GetAll(IDbConnection conn, IDbTransaction trans) where T : class + { + var dataList = conn.GetList(null, null, trans); + return dataList; + } + /// /// 查询匹配的一条数据 /// diff --git a/NETCORE/Slickflow/Source/Slickflow.Data/Slickflow.Data.csproj b/NETCORE/Slickflow/Source/Slickflow.Data/Slickflow.Data.csproj index e7f6fc09..feae9846 100644 --- a/NETCORE/Slickflow/Source/Slickflow.Data/Slickflow.Data.csproj +++ b/NETCORE/Slickflow/Source/Slickflow.Data/Slickflow.Data.csproj @@ -5,15 +5,14 @@ + - - ..\DLL\Dapper.dll - + diff --git a/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/Mvc/ActivityController.cs b/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/Mvc/ActivityController.cs index c3aa50ce..f606288d 100644 --- a/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/Mvc/ActivityController.cs +++ b/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/Mvc/ActivityController.cs @@ -16,5 +16,15 @@ public ActionResult Index() { return View(); } + + public ActionResult Pool() + { + return View(); + } + + public ActionResult Lane() + { + return View(); + } } } \ No newline at end of file diff --git a/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/Mvc/ProcessController.cs b/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/Mvc/ProcessController.cs index 4fbb0c66..4e0eb1a9 100644 --- a/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/Mvc/ProcessController.cs +++ b/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/Mvc/ProcessController.cs @@ -17,11 +17,21 @@ public ActionResult List() return View(); } + public ActionResult Create() + { + return View(); + } + public ActionResult Edit() { return View(); } + public ActionResult XmlContent() + { + return View(); + } + public ActionResult Import() { return View(); diff --git a/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/FineUploadController.cs b/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/FineUploadController.cs index 35ecaf06..277e2b45 100644 --- a/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/FineUploadController.cs +++ b/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/FineUploadController.cs @@ -33,6 +33,7 @@ You should have received a copy of the GNU Lesser General Public using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.WebUtilities; using Microsoft.Net.Http.Headers; +using Slickflow.Module.Localize; using Slickflow.Engine.Utility; using Slickflow.Engine.Business.Entity; using Slickflow.Engine.Service; @@ -57,7 +58,7 @@ public async Task Import() if (!MultipartRequestHelper.IsMultipartContentType(Request.ContentType)) { - return Ok(new { success = false, Message = "不支持的媒介类型!" }); + return Ok(new { success = false, Message = "Unsupported media type!" }); } var boundary = MultipartRequestHelper.GetBoundary(MediaTypeHeaderValue.Parse(Request.ContentType), @@ -92,7 +93,7 @@ public async Task Import() // reads the headers for the next section. section = await reader.ReadNextSectionAsync(); } - return Ok(new { success = false, Message = "未知的其它原因!" }); + return Ok(new { success = false, Message = "Unknown other reasons!" }); } /// @@ -131,21 +132,21 @@ private bool CreateNewProcess(string xmlContent, out string message) var wfService = new WorkflowService(); wfService.ImportProcess(processEntity); isUploaded = true; - message = "导入XML文件成功,并生成新的流程记录!"; + message = LocalizeHelper.GetDesignerMessage("fineuploadcontroller.importprocess.success"); } else { - message = "流程名称和GUID数据不完整!"; + message = LocalizeHelper.GetDesignerMessage("fineuploadcontroller.createnewprocess.warning"); } } else { - message = "流程节点为空!"; + message = LocalizeHelper.GetDesignerMessage("fineuploadcontroller.createnewprocess.noxmlnode.warning"); } } else { - message = "流程文件根节点为空!"; + message = LocalizeHelper.GetDesignerMessage("fineuploadcontroller.createnewprocess.norootelement.warning"); } return isUploaded; } diff --git a/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/LanguageController.cs b/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/LanguageController.cs new file mode 100644 index 00000000..1901c652 --- /dev/null +++ b/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/LanguageController.cs @@ -0,0 +1,69 @@ +/* +* Slickflow 工作流引擎遵循LGPL协议,也可联系作者商业授权并获取技术支持; +* 除此之外的使用则视为不正当使用,请您务必避免由此带来的商业版权纠纷。 +* +The Slickflow project. +Copyright (C) 2014 .NET Workflow Engine Library + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, you can access the official +web page about lgpl: https://www.gnu.org/licenses/lgpl.html +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json.Linq; +using Microsoft.AspNetCore.Mvc; +using Slickflow.Data; +using Slickflow.Module.Localize; +using Slickflow.Module.Resource; +using Slickflow.Engine.Common; +using Slickflow.Engine.Business.Entity; +using Slickflow.Engine.Business.Manager; +using Slickflow.Engine.Service; +using Slickflow.Engine.Xpdl.Entity; +using Slickflow.Engine.Utility; + +namespace Slickflow.Designer.Controllers.WebApi +{ + /// + /// 流程定义XML操作控制器 + /// + public class LanguageController : Controller + { + #region 语言设置 + /// + /// 设置本地化语言 + /// + /// 语言类型 + /// + [HttpGet] + public ResponseResult SetLang(string id) + { + var result = ResponseResult.Default(); + try + { + LangTypeEnum lang = EnumHelper.ParseEnum(id); + LocalizeHelper.SetLang(ProjectTypeEnum.Designer, lang); + LocalizeHelper.SetLang(ProjectTypeEnum.Engine, lang); + } + catch (System.Exception ex) + { + result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("languagecontroller.setlang.error", ex.Message)); + } + return result; + } + #endregion + } +} \ No newline at end of file diff --git a/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/MultipartRequestHelper.cs b/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/MultipartRequestHelper.cs index 0abafc41..64ed993d 100644 --- a/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/MultipartRequestHelper.cs +++ b/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/MultipartRequestHelper.cs @@ -13,13 +13,13 @@ public static string GetBoundary(MediaTypeHeaderValue contentType, int lengthLim var boundary = HeaderUtilities.RemoveQuotes(contentType.Boundary); if (string.IsNullOrWhiteSpace(boundary.Value)) { - throw new InvalidDataException("缺失内容类型定义!"); + throw new InvalidDataException("Missing Content type definition!"); } if (boundary.Length > lengthLimit) { throw new InvalidDataException( - $"文件或文本内容{lengthLimit}超长!"); + $"The length of file {lengthLimit} is too long!"); } return boundary.Value; diff --git a/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/Wf2XmlController.cs b/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/Wf2XmlController.cs index e612ef06..246f1af3 100644 --- a/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/Wf2XmlController.cs +++ b/NETCORE/Slickflow/Source/Slickflow.Designer/Controllers/WebApi/Wf2XmlController.cs @@ -21,19 +21,19 @@ You should have received a copy of the GNU Lesser General Public */ using System; -using System.IO; -using System.Configuration; using System.Collections.Generic; using System.Linq; using Newtonsoft.Json.Linq; using Microsoft.AspNetCore.Mvc; -using SlickOne.WebUtility; +using Slickflow.Data; +using Slickflow.Module.Localize; using Slickflow.Module.Resource; using Slickflow.Engine.Common; using Slickflow.Engine.Business.Entity; +using Slickflow.Engine.Business.Manager; using Slickflow.Engine.Service; -using Slickflow.Graph; - +using Slickflow.Engine.Xpdl.Entity; +using Slickflow.Engine.Utility; namespace Slickflow.Designer.Controllers.WebApi { @@ -115,33 +115,34 @@ public ResponseResult CreateProcess([FromBody] ProcessFileEntity var result = ResponseResult.Default(); try { - ProcessEntity entity = null; - //根据模板类型来创建流程 - if (fileEntity.TemplateType == ProcessTemplateType.Blank) + if (string.IsNullOrEmpty(fileEntity.ProcessName.Trim()) + || string.IsNullOrEmpty(fileEntity.ProcessCode.Trim()) + || string.IsNullOrEmpty(fileEntity.Version.Trim())) { - entity = new ProcessEntity - { - ProcessGUID = fileEntity.ProcessGUID, - ProcessName = fileEntity.ProcessName, - ProcessCode = fileEntity.ProcessCode, - Version = fileEntity.Version, - IsUsing = fileEntity.IsUsing, - Description = fileEntity.Description, - }; - var wfService = new WorkflowService(); - var processID = wfService.CreateProcess(entity); - entity.ID = processID; + result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.crateprocess.warning")); + return result; } - else + + ProcessEntity entity = new ProcessEntity { - //模板默认生成XML内容 - entity = ProcessGraphFactory.CreateProcess(fileEntity); - } - result = ResponseResult.Success(entity); + ProcessGUID = fileEntity.ProcessGUID, + ProcessName = fileEntity.ProcessName, + ProcessCode = fileEntity.ProcessCode, + Version = fileEntity.Version, + IsUsing = fileEntity.IsUsing, + Description = fileEntity.Description, + }; + var wfService = new WorkflowService(); + var processID = wfService.CreateProcess(entity); + entity.ID = processID; + + result = ResponseResult.Success(entity, + LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.crateprocess.success") + ); } catch (System.Exception ex) { - result = ResponseResult.Error(string.Format("创建流程记录失败,错误:{0}", ex.Message)); + result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.crateprocess.error", ex.Message)); } return result; } @@ -164,17 +165,46 @@ public ResponseResult UpdateProcess([FromBody] ProcessEntity entity) processEntity.XmlFileName = entity.XmlFileName; processEntity.AppType = entity.AppType; processEntity.Description = entity.Description; + processEntity.IsUsing = entity.IsUsing; if (!string.IsNullOrEmpty(entity.XmlContent)) { processEntity.XmlContent = PaddingContentWithRightSpace(entity.XmlContent); } wfService.UpdateProcess(processEntity); - result = ResponseResult.Success(); + result = ResponseResult.Success(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.updateprocess.success") + ); + } + catch (System.Exception ex) + { + result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.updateprocess.error", ex.Message)); + } + return result; + } + + /// + /// 更新流程数据 + /// + /// 流程实体 + /// + [HttpPost] + public ResponseResult UpgradeProcess([FromBody] ProcessEntity entity) + { + var result = ResponseResult.Default(); + try + { + var wfService = new WorkflowService(); + var process = wfService.GetProcessByID(entity.ID); + int newVersion = 1; + var parsed = int.TryParse(process.Version, out newVersion); + if (parsed == true) newVersion = newVersion + 1; + wfService.UpgradeProcess(process.ProcessGUID, process.Version, newVersion.ToString()); + + result = ResponseResult.Success(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.upgradeprocess.success")); } catch (System.Exception ex) { - result = ResponseResult.Error(string.Format("更新流程记录失败,错误:{0}", ex.Message)); + result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.upgradeprocess.error", ex.Message)); } return result; } @@ -193,17 +223,43 @@ public ResponseResult DeleteProcess([FromBody] ProcessEntity entity) var wfService = new WorkflowService(); wfService.DeleteProcess(entity.ProcessGUID, entity.Version); - result = ResponseResult.Success(); + result = ResponseResult.Success(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.deleteprocess.success") + ); } catch (System.Exception ex) { - result = ResponseResult.Error(string.Format("删除流程记录失败,错误:{0}", ex.Message)); + result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.deleteprocess.error", ex.Message)); } return result; } + #endregion #region 读取流程XML文件数据处理 + /// + /// 根据流程名称获取流程实体 + /// + /// 查询实体 + /// 流程实体 + [HttpPost] + public ResponseResult QueryProcessByName([FromBody] ProcessQuery query) + { + var result = ResponseResult.Default(); + try + { + var wfService = new WorkflowService(); + var entity = wfService.GetProcessByName(query.ProcessName, query.Version); + + result = ResponseResult.Success(entity); + } + catch (System.Exception ex) + { + result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.queryprocess.error", ex.Message) + ); + } + return result; + } + /// /// 读取XML文件 /// @@ -222,8 +278,34 @@ public ResponseResult QueryProcessFile([FromBody] ProcessFile } catch (System.Exception ex) { - result = ResponseResult.Error( - string.Format("获取流程XML文件失败!{0}", ex.Message) + result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.queryprocessfile.error", ex.Message) + ); + } + return result; + } + + /// + /// 检查流程文件是否重复 + /// + /// 查询实体 + /// + [HttpPost] + public ResponseResult CheckProcessFile([FromBody] ProcessEntity query) + { + var result = ResponseResult.Default(); + try + { + var wfService = new WorkflowService(); + var entity = wfService.GetProcessByName(query.ProcessName, query.Version); + if (entity == null) + { + entity = wfService.GetProcessByCode(query.ProcessCode, query.Version); + } + result = ResponseResult.Success(entity); + } + catch (System.Exception ex) + { + result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.queryprocessfile.error", ex.Message) ); } return result; @@ -247,9 +329,7 @@ public ResponseResult QueryProcessFileByID([FromBody] Process } catch (System.Exception ex) { - result = ResponseResult.Error( - string.Format("获取流程XML文件失败!{0}", ex.Message) - ); + result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.queryprocessfile.error", ex.Message)); } return result; } @@ -272,9 +352,7 @@ public ResponseResult GetProcessByVersion([FromBody] ProcessEntit } catch (System.Exception ex) { - result = ResponseResult.Error( - string.Format("获取流程基本信息失败!{0}", ex.Message) - ); + result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.queryprocess.error", ex.Message)); } return result; } @@ -296,9 +374,7 @@ public ResponseResult> GetProcessListSimple() } catch (System.Exception ex) { - result = ResponseResult>.Error( - string.Format("获取流程基本信息失败!{0}", ex.Message) - ); + result = ResponseResult>.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.getprocesslist.error", ex.Message)); } return result; } @@ -315,15 +391,13 @@ public ResponseResult GetProcess([FromBody] ProcessQuery query) try { var wfService = new WorkflowService(); - var entity = wfService.GetProcess(query.ProcessGUID); + var entity = wfService.GetProcessUsing(query.ProcessGUID); result = ResponseResult.Success(entity); } catch (System.Exception ex) { - result = ResponseResult.Error( - string.Format("获取流程基本信息失败!{0}", ex.Message) - ); + result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.queryprocess.error", ex.Message)); } return result; } @@ -343,13 +417,11 @@ public ResponseResult SaveProcessFile([FromBody] ProcessFileEntity entity) entity.XmlContent = PaddingContentWithRightSpace(entity.XmlContent); wfService.SaveProcessFile(entity); - result = ResponseResult.Success(); + result = ResponseResult.Success(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.saveprocessfile.success")); } catch (System.Exception ex) { - result = ResponseResult.Error( - string.Format("保存流程XML文件失败!{0}", ex.Message) - ); + result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.saveprocessfile.error", ex.Message)); } return result; } @@ -371,6 +443,31 @@ private string PaddingContentWithRightSpace(string content) return newContent; } + /// + /// 校验流程有效性 + /// + /// 校验实体 + /// 校验结果对象 + [HttpPost] + public ResponseResult ValidateProcess([FromBody] ProcessValidateEntity entity) + { + var result = ResponseResult.Default(); + try + { + var wfService = new WorkflowService(); + var validateResult = wfService.ValidateProcess(entity); + + result = ResponseResult.Success(validateResult, LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.validateprocess.success")); + } + catch (System.Exception ex) + { + result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.validateprocess.error", ex.Message)); + } + return result; + } + #endregion + + #region 任务数据记录 /// /// 获取待办状态的节点 /// @@ -390,9 +487,7 @@ public ResponseResult> QueryReadyActivityInstance([ } catch (System.Exception ex) { - result = ResponseResult>.Error(string.Format( - "获取待办任务数据失败, 异常信息:{0}", - ex.Message)); + result = ResponseResult>.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.queryreadyactivityinstance.error", ex.Message)); } return result; } @@ -415,9 +510,7 @@ public ResponseResult> QueryCompletedTransitionInstance([F } catch (System.Exception ex) { - result = ResponseResult>.Error(string.Format( - "获取已完成转移数据失败, 异常信息:{0}", - ex.Message)); + result = ResponseResult>.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.querycompletedtransitioninstance.error", ex.Message)); } return result; } @@ -425,8 +518,8 @@ public ResponseResult> QueryCompletedTransitionInstance([F /// /// 获取完成状态的任务 /// - /// - /// + /// 任务查询实体 + /// 任务列表 [HttpPost] public ResponseResult> QueryCompletedTasks([FromBody] TaskQuery query) { @@ -445,9 +538,49 @@ public ResponseResult> QueryCompletedTasks([FromBody] TaskQ } catch (System.Exception ex) { - result = ResponseResult>.Error(string.Format( - "获取已办任务数据失败, 异常信息:{0}", - ex.Message)); + result = ResponseResult>.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.querycompletedtasks.error", ex.Message)); + } + return result; + } + + /// + /// Get Task todo list Top 10 + /// + /// Task List + [HttpGet] + public ResponseResult> GetTaskToDoListTop() + { + var result = ResponseResult>.Default(); + try + { + var tm = new TaskManager(); + var taskList = tm.GetTaskToDoListTop(); + result = ResponseResult>.Success(taskList); + } + catch (System.Exception ex) + { + result = ResponseResult>.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.gettasktodolisttop.error", ex.Message)); + } + return result; + } + + /// + /// Get Task Done List top 10 + /// + /// task list + [HttpGet] + public ResponseResult> GetTaskDoneListTop() + { + var result = ResponseResult>.Default(); + try + { + var tm = new TaskManager(); + var taskList = tm.GetTaskDoneListTop(); + result = ResponseResult>.Success(taskList); + } + catch (System.Exception ex) + { + result = ResponseResult>.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.gettaskdonelisttop.error", ex.Message)); } return result; } @@ -471,9 +604,7 @@ public ResponseResult> GetRoleAll() } catch (System.Exception ex) { - result = ResponseResult>.Error( - string.Format("获取角色数据失败!{0}", ex.Message) - ); + result = ResponseResult>.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.getroleall.error", ex.Message)); } return result; } diff --git a/NETCORE/Slickflow/Source/Slickflow.Designer/Slickflow.Designer.csproj b/NETCORE/Slickflow/Source/Slickflow.Designer/Slickflow.Designer.csproj index 706951e1..a6c3fa38 100644 --- a/NETCORE/Slickflow/Source/Slickflow.Designer/Slickflow.Designer.csproj +++ b/NETCORE/Slickflow/Source/Slickflow.Designer/Slickflow.Designer.csproj @@ -2,6 +2,11 @@ netcoreapp2.1 + 1.7.5.6 + Besley + Hangzhou, Ligong + Slickflow process diagram editor + Slickflow.Designer @@ -697,26 +702,27 @@ + + + + + + - - - - - - ..\DLL\Slickflow.Graph.dll - + + diff --git a/NETCORE/Slickflow/Source/Slickflow.Designer/Views/Activity/Index.cshtml b/NETCORE/Slickflow/Source/Slickflow.Designer/Views/Activity/Index.cshtml index a46bf8da..0bd6bedc 100644 --- a/NETCORE/Slickflow/Source/Slickflow.Designer/Views/Activity/Index.cshtml +++ b/NETCORE/Slickflow/Source/Slickflow.Designer/Views/Activity/Index.cshtml @@ -90,7 +90,7 @@ -
+

@@ -114,6 +114,17 @@

+
+
+

+ + + + @*

*@ + +

+
+
","
"),e.push(o.stringRepeat(" ",i.indent)),s++,l=0,a=i[s]||Number.MAX_VALUE;0!=d.length&&(r+=d.length,l=this.$renderToken(e,l,h,d))}}},this.$renderSimpleLine=function(e,t){var i=0,n=t[0],r=n.value;this.displayIndentGuides&&(r=this.renderIndentGuide(e,r)),r&&(i=this.$renderToken(e,i,n,r));for(var o=1;o"),r.length){var o=this.session.getRowSplitData(t);o&&o.length?this.$renderWrappedLine(e,r,o,i):this.$renderSimpleLine(e,r)}this.showInvisibles&&(n&&(t=n.end.row),e.push("",t==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,"")),i||e.push("
")},this.$getFoldLineTokens=function(e,t){function i(e,t,i){for(var n=0,o=0;o+e[n].value.lengthi-t&&(s=s.substring(0,i-t)),r.push({type:e[n].type,value:s}),o=t+s.length,n+=1}for(;oi?r.push({type:e[n].type,value:s.substring(0,i-o)}):r.push(e[n]),o+=s.length,n+=1}}var n=this.session,r=[],o=n.getTokens(e);return t.walk(function(e,t,s,a,l){null!=e?r.push({type:"fold",value:e}):(l&&(o=n.getTokens(t)),o.length&&i(o,a,s))},t.end.row,this.session.getLine(t.end.row).length),r},this.$useLineGroups=function(){return this.session.getUseWrapMode()},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$measureNode&&this.$measureNode.parentNode.removeChild(this.$measureNode),delete this.$measureNode}}).call(a.prototype),t.Text=a}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(e,t,i){"use strict";var n,r=e("../lib/dom"),o=function(e){this.element=r.createElement("div"),this.element.className="ace_layer ace_cursor-layer",e.appendChild(this.element),void 0===n&&(n=!("opacity"in this.element.style)),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),r.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=(n?this.$updateVisibility:this.$updateOpacity).bind(this)};(function(){this.$updateVisibility=function(e){for(var t=this.cursors,i=t.length;i--;)t[i].style.visibility=e?"":"hidden"},this.$updateOpacity=function(e){for(var t=this.cursors,i=t.length;i--;)t[i].style.opacity=e?"":"0"},this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setBlinking=function(e){e!=this.isBlinking&&(this.isBlinking=e,this.restartTimer())},this.setBlinkInterval=function(e){e!=this.blinkInterval&&(this.blinkInterval=e,this.restartTimer())},this.setSmoothBlinking=function(e){e==this.smoothBlinking||n||(this.smoothBlinking=e,r.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.$updateCursors=this.$updateOpacity.bind(this),this.restartTimer())},this.addCursor=function(){var e=r.createElement("div");return e.className="ace_cursor",this.element.appendChild(e),this.cursors.push(e),e},this.removeCursor=function(){if(this.cursors.length>1){var e=this.cursors.pop();return e.parentNode.removeChild(e),e}},this.hideCursor=function(){this.isVisible=!1,r.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.showCursor=function(){this.isVisible=!0,r.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.restartTimer=function(){var e=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.smoothBlinking&&r.removeCssClass(this.element,"ace_smooth-blinking"),e(!0),this.isBlinking&&this.blinkInterval&&this.isVisible){this.smoothBlinking&&setTimeout(function(){r.addCssClass(this.element,"ace_smooth-blinking")}.bind(this));var t=function(){this.timeoutId=setTimeout(function(){e(!1)},.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval(function(){e(!0),t()},this.blinkInterval),t()}},this.getPixelPosition=function(e,t){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var i=this.session.documentToScreenPosition(e);return{left:this.$padding+(this.session.$bidiHandler.isBidiRow(i.row,e.row)?this.session.$bidiHandler.getPosLeft(i.column):i.column*this.config.characterWidth),top:(i.row-(t?this.config.firstRowScreen:0))*this.config.lineHeight}},this.update=function(e){this.config=e;var t=this.session.$selectionMarkers,i=0,n=0;void 0!==t&&0!==t.length||(t=[{cursor:null}]);for(var i=0,r=t.length;ie.height+e.offset||o.top<0)&&i>1)){var s=(this.cursors[n++]||this.addCursor()).style;this.drawCursor?this.drawCursor(s,o,e,t[i],this.session):(s.left=o.left+"px",s.top=o.top+"px",s.width=e.characterWidth+"px",s.height=e.lineHeight+"px")}}for(;this.cursors.length>n;)this.removeCursor();var a=this.session.getOverwrite();this.$setOverwrite(a),this.$pixelPos=o,this.restartTimer()},this.drawCursor=null,this.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?r.addCssClass(this.element,"ace_overwrite-cursors"):r.removeCssClass(this.element,"ace_overwrite-cursors"))},this.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)}}).call(o.prototype),t.Cursor=o}),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,t,i){"use strict";var n=e("./lib/oop"),r=e("./lib/dom"),o=e("./lib/event"),s=e("./lib/event_emitter").EventEmitter,a=function(e){this.element=r.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+this.classSuffix,this.inner=r.createElement("div"),this.inner.className="ace_scrollbar-inner",this.element.appendChild(this.inner),e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,o.addListener(this.element,"scroll",this.onScroll.bind(this)),o.addListener(this.element,"mousedown",o.preventDefault)};(function(){n.implement(this,s),this.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1}}).call(a.prototype);var l=function(e,t){a.call(this,e),this.scrollTop=0,this.scrollHeight=0,t.$scrollbarWidth=this.width=r.scrollbarWidth(e.ownerDocument),this.inner.style.width=this.element.style.width=(this.width||15)+5+"px",this.$minWidth=0};n.inherits(l,a),function(){this.classSuffix="-v",this.onScroll=function(){if(!this.skipEvent){if(this.scrollTop=this.element.scrollTop,1!=this.coeff){var e=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-e)/(this.coeff-e)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},this.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},this.setHeight=function(e){this.element.style.height=e+"px"},this.setInnerHeight=this.setScrollHeight=function(e){this.scrollHeight=e,e>32768?(this.coeff=32768/e,e=32768):1!=this.coeff&&(this.coeff=1),this.inner.style.height=e+"px"},this.setScrollTop=function(e){this.scrollTop!=e&&(this.skipEvent=!0,this.scrollTop=e,this.element.scrollTop=e*this.coeff)}}.call(l.prototype);var c=function(e,t){a.call(this,e),this.scrollLeft=0,this.height=t.$scrollbarWidth,this.inner.style.height=this.element.style.height=(this.height||15)+5+"px"};n.inherits(c,a),function(){this.classSuffix="-h",this.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},this.getHeight=function(){return this.isVisible?this.height:0},this.setWidth=function(e){this.element.style.width=e+"px"},this.setInnerWidth=function(e){this.inner.style.width=e+"px"},this.setScrollWidth=function(e){this.inner.style.width=e+"px"},this.setScrollLeft=function(e){this.scrollLeft!=e&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=e)}}.call(c.prototype),t.ScrollBar=l,t.ScrollBarV=l,t.ScrollBarH=c,t.VScrollBar=l,t.HScrollBar=c}),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(e,t,i){"use strict";var n=e("./lib/event"),r=function(e,t){this.onRender=e,this.pending=!1,this.changes=0,this.window=t||window};(function(){this.schedule=function(e){if(this.changes=this.changes|e,!this.pending&&this.changes){this.pending=!0;var t=this;n.nextFrame(function(){t.pending=!1;for(var e;e=t.changes;)t.changes=0,t.onRender(e)},this.window)}}}).call(r.prototype),t.RenderLoop=r}),ace.define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/lib/event_emitter"],function(e,t,i){var n=e("../lib/oop"),r=e("../lib/dom"),o=e("../lib/lang"),s=e("../lib/useragent"),a=e("../lib/event_emitter").EventEmitter,l=0,c=t.FontMetrics=function(e){this.el=r.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=r.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=r.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),e.appendChild(this.el),l||this.$testFractionalRect(),this.$measureNode.innerHTML=o.stringRepeat("X",l),this.$characterSize={width:0,height:0},this.checkForSizeChanges()};(function(){n.implement(this,a),this.$characterSize={width:0,height:0},this.$testFractionalRect=function(){var e=r.createElement("div");this.$setMeasureNodeStyles(e.style),e.style.width="0.2px",document.documentElement.appendChild(e);var t=e.getBoundingClientRect().width;l=t>0&&t<1?50:100,e.parentNode.removeChild(e)},this.$setMeasureNodeStyles=function(e,t){e.width=e.height="auto",e.left=e.top="0px",e.visibility="hidden",e.position="absolute",e.whiteSpace="pre",s.isIE<8?e["font-family"]="inherit":e.font="inherit",e.overflow=t?"hidden":"visible"},this.checkForSizeChanges=function(){var e=this.$measureSizes();if(e&&(this.$characterSize.width!==e.width||this.$characterSize.height!==e.height)){this.$measureNode.style.fontWeight="bold";var t=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=e,this.charSizes=Object.create(null),this.allowBoldFonts=t&&t.width===e.width&&t.height===e.height,this._emit("changeCharacterSize",{data:e})}},this.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer)return this.$pollSizeChangesTimer;var e=this;return this.$pollSizeChangesTimer=setInterval(function(){e.checkForSizeChanges()},500)},this.setPolling=function(e){e?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},this.$measureSizes=function(){if(50===l){var e=null;try{e=this.$measureNode.getBoundingClientRect()}catch(t){e={width:0,height:0}}var t={height:e.height,width:e.width/l}}else var t={height:this.$measureNode.clientHeight,width:this.$measureNode.clientWidth/l};return 0===t.width||0===t.height?null:t},this.$measureCharWidth=function(e){return this.$main.innerHTML=o.stringRepeat(e,l),this.$main.getBoundingClientRect().width/l},this.getCharacterWidth=function(e){var t=this.charSizes[e];return void 0===t&&(t=this.charSizes[e]=this.$measureCharWidth(e)/this.$characterSize.width),t},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)}}).call(c.prototype)}),ace.define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/config","ace/lib/useragent","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter"],function(e,t,i){"use strict";var n=e("./lib/oop"),r=e("./lib/dom"),o=e("./config"),s=e("./lib/useragent"),a=e("./layer/gutter").Gutter,l=e("./layer/marker").Marker,c=e("./layer/text").Text,h=e("./layer/cursor").Cursor,d=e("./scrollbar").HScrollBar,u=e("./scrollbar").VScrollBar,p=e("./renderloop").RenderLoop,f=e("./layer/font_metrics").FontMetrics,m=e("./lib/event_emitter").EventEmitter;r.importCssString('.ace_editor {\tposition: relative;\toverflow: hidden;\tfont: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'source-code-pro\', monospace;\tdirection: ltr;\ttext-align: left;\t-webkit-tap-highlight-color: rgba(0, 0, 0, 0);\t}\t.ace_scroller {\tposition: absolute;\toverflow: hidden;\ttop: 0;\tbottom: 0;\tbackground-color: inherit;\t-ms-user-select: none;\t-moz-user-select: none;\t-webkit-user-select: none;\tuser-select: none;\tcursor: text;\t}\t.ace_content {\tposition: absolute;\t-moz-box-sizing: border-box;\t-webkit-box-sizing: border-box;\tbox-sizing: border-box;\tmin-width: 100%;\t}\t.ace_dragging .ace_scroller:before{\tposition: absolute;\ttop: 0;\tleft: 0;\tright: 0;\tbottom: 0;\tcontent: \'\';\tbackground: rgba(250, 250, 250, 0.01);\tz-index: 1000;\t}\t.ace_dragging.ace_dark .ace_scroller:before{\tbackground: rgba(0, 0, 0, 0.01);\t}\t.ace_selecting, .ace_selecting * {\tcursor: text !important;\t}\t.ace_gutter {\tposition: absolute;\toverflow : hidden;\twidth: auto;\ttop: 0;\tbottom: 0;\tleft: 0;\tcursor: default;\tz-index: 4;\t-ms-user-select: none;\t-moz-user-select: none;\t-webkit-user-select: none;\tuser-select: none;\t}\t.ace_gutter-active-line {\tposition: absolute;\tleft: 0;\tright: 0;\t}\t.ace_scroller.ace_scroll-left {\tbox-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\t}\t.ace_gutter-cell {\tpadding-left: 19px;\tpadding-right: 6px;\tbackground-repeat: no-repeat;\t}\t.ace_gutter-cell.ace_error {\tbackground-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");\tbackground-repeat: no-repeat;\tbackground-position: 2px center;\t}\t.ace_gutter-cell.ace_warning {\tbackground-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");\tbackground-position: 2px center;\t}\t.ace_gutter-cell.ace_info {\tbackground-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");\tbackground-position: 2px center;\t}\t.ace_dark .ace_gutter-cell.ace_info {\tbackground-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");\t}\t.ace_scrollbar {\tposition: absolute;\tright: 0;\tbottom: 0;\tz-index: 6;\t}\t.ace_scrollbar-inner {\tposition: absolute;\tcursor: text;\tleft: 0;\ttop: 0;\t}\t.ace_scrollbar-v{\toverflow-x: hidden;\toverflow-y: scroll;\ttop: 0;\t}\t.ace_scrollbar-h {\toverflow-x: scroll;\toverflow-y: hidden;\tleft: 0;\t}\t.ace_print-margin {\tposition: absolute;\theight: 100%;\t}\t.ace_text-input {\tposition: absolute;\tz-index: 0;\twidth: 0.5em;\theight: 1em;\topacity: 0;\tbackground: transparent;\t-moz-appearance: none;\tappearance: none;\tborder: none;\tresize: none;\toutline: none;\toverflow: hidden;\tfont: inherit;\tpadding: 0 1px;\tmargin: 0 -1px;\ttext-indent: -1em;\t-ms-user-select: text;\t-moz-user-select: text;\t-webkit-user-select: text;\tuser-select: text;\twhite-space: pre!important;\t}\t.ace_text-input.ace_composition {\tbackground: inherit;\tcolor: inherit;\tz-index: 1000;\topacity: 1;\ttext-indent: 0;\t}\t.ace_layer {\tz-index: 1;\tposition: absolute;\toverflow: hidden;\tword-wrap: normal;\twhite-space: pre;\theight: 100%;\twidth: 100%;\t-moz-box-sizing: border-box;\t-webkit-box-sizing: border-box;\tbox-sizing: border-box;\tpointer-events: none;\t}\t.ace_gutter-layer {\tposition: relative;\twidth: auto;\ttext-align: right;\tpointer-events: auto;\t}\t.ace_text-layer {\tfont: inherit !important;\t}\t.ace_cjk {\tdisplay: inline-block;\ttext-align: center;\t}\t.ace_cursor-layer {\tz-index: 4;\t}\t.ace_cursor {\tz-index: 4;\tposition: absolute;\t-moz-box-sizing: border-box;\t-webkit-box-sizing: border-box;\tbox-sizing: border-box;\tborder-left: 2px solid;\ttransform: translatez(0);\t}\t.ace_multiselect .ace_cursor {\tborder-left-width: 1px;\t}\t.ace_slim-cursors .ace_cursor {\tborder-left-width: 1px;\t}\t.ace_overwrite-cursors .ace_cursor {\tborder-left-width: 0;\tborder-bottom: 1px solid;\t}\t.ace_hidden-cursors .ace_cursor {\topacity: 0.2;\t}\t.ace_smooth-blinking .ace_cursor {\t-webkit-transition: opacity 0.18s;\ttransition: opacity 0.18s;\t}\t.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {\tposition: absolute;\tz-index: 3;\t}\t.ace_marker-layer .ace_selection {\tposition: absolute;\tz-index: 5;\t}\t.ace_marker-layer .ace_bracket {\tposition: absolute;\tz-index: 6;\t}\t.ace_marker-layer .ace_active-line {\tposition: absolute;\tz-index: 2;\t}\t.ace_marker-layer .ace_selected-word {\tposition: absolute;\tz-index: 4;\t-moz-box-sizing: border-box;\t-webkit-box-sizing: border-box;\tbox-sizing: border-box;\t}\t.ace_line .ace_fold {\t-moz-box-sizing: border-box;\t-webkit-box-sizing: border-box;\tbox-sizing: border-box;\tdisplay: inline-block;\theight: 11px;\tmargin-top: -2px;\tvertical-align: middle;\tbackground-image:\turl("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),\turl("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");\tbackground-repeat: no-repeat, repeat-x;\tbackground-position: center center, top left;\tcolor: transparent;\tborder: 1px solid black;\tborder-radius: 2px;\tcursor: pointer;\tpointer-events: auto;\t}\t.ace_dark .ace_fold {\t}\t.ace_fold:hover{\tbackground-image:\turl("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),\turl("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");\t}\t.ace_tooltip {\tbackground-color: #FFF;\tbackground-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1));\tbackground-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));\tborder: 1px solid gray;\tborder-radius: 1px;\tbox-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\tcolor: black;\tmax-width: 100%;\tpadding: 3px 4px;\tposition: fixed;\tz-index: 999999;\t-moz-box-sizing: border-box;\t-webkit-box-sizing: border-box;\tbox-sizing: border-box;\tcursor: default;\twhite-space: pre;\tword-wrap: break-word;\tline-height: normal;\tfont-style: normal;\tfont-weight: normal;\tletter-spacing: normal;\tpointer-events: none;\t}\t.ace_folding-enabled > .ace_gutter-cell {\tpadding-right: 13px;\t}\t.ace_fold-widget {\t-moz-box-sizing: border-box;\t-webkit-box-sizing: border-box;\tbox-sizing: border-box;\tmargin: 0 -12px 0 1px;\tdisplay: none;\twidth: 11px;\tvertical-align: top;\tbackground-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");\tbackground-repeat: no-repeat;\tbackground-position: center;\tborder-radius: 3px;\tborder: 1px solid transparent;\tcursor: pointer;\t}\t.ace_folding-enabled .ace_fold-widget {\tdisplay: inline-block; \t}\t.ace_fold-widget.ace_end {\tbackground-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");\t}\t.ace_fold-widget.ace_closed {\tbackground-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");\t}\t.ace_fold-widget:hover {\tborder: 1px solid rgba(0, 0, 0, 0.3);\tbackground-color: rgba(255, 255, 255, 0.2);\tbox-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\t}\t.ace_fold-widget:active {\tborder: 1px solid rgba(0, 0, 0, 0.4);\tbackground-color: rgba(0, 0, 0, 0.05);\tbox-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\t}\t.ace_dark .ace_fold-widget {\tbackground-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");\t}\t.ace_dark .ace_fold-widget.ace_end {\tbackground-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");\t}\t.ace_dark .ace_fold-widget.ace_closed {\tbackground-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");\t}\t.ace_dark .ace_fold-widget:hover {\tbox-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\tbackground-color: rgba(255, 255, 255, 0.1);\t}\t.ace_dark .ace_fold-widget:active {\tbox-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\t}\t.ace_fold-widget.ace_invalid {\tbackground-color: #FFB4B4;\tborder-color: #DE5555;\t}\t.ace_fade-fold-widgets .ace_fold-widget {\t-webkit-transition: opacity 0.4s ease 0.05s;\ttransition: opacity 0.4s ease 0.05s;\topacity: 0;\t}\t.ace_fade-fold-widgets:hover .ace_fold-widget {\t-webkit-transition: opacity 0.05s ease 0.05s;\ttransition: opacity 0.05s ease 0.05s;\topacity:1;\t}\t.ace_underline {\ttext-decoration: underline;\t}\t.ace_bold {\tfont-weight: bold;\t}\t.ace_nobold .ace_bold {\tfont-weight: normal;\t}\t.ace_italic {\tfont-style: italic;\t}\t.ace_error-marker {\tbackground-color: rgba(255, 0, 0,0.2);\tposition: absolute;\tz-index: 9;\t}\t.ace_highlight-marker {\tbackground-color: rgba(255, 255, 0,0.2);\tposition: absolute;\tz-index: 8;\t}\t.ace_br1 {border-top-left-radius : 3px;}\t.ace_br2 {border-top-right-radius : 3px;}\t.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}\t.ace_br4 {border-bottom-right-radius: 3px;}\t.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}\t.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}\t.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}\t.ace_br8 {border-bottom-left-radius : 3px;}\t.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}\t.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}\t.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}\t.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\t.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\t.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\t.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\t.ace_text-input-ios {\tposition: absolute !important;\ttop: -100000px !important;\tleft: -100000px !important;\t}\t',"ace_editor.css");var g=function(e,t){var i=this;this.container=e||r.createElement("div"),this.$keepTextAreaAtCursor=!s.isOldIE,r.addCssClass(this.container,"ace_editor"),this.setTheme(t),this.$gutter=r.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden",!0),this.scroller=r.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=r.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new a(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new l(this.content);var n=this.$textLayer=new c(this.content);this.canvas=n.element,this.$markerFront=new l(this.content),this.$cursorLayer=new h(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new u(this.container,this),this.scrollBarH=new d(this.container,this),this.scrollBarV.addEventListener("scroll",function(e){i.$scrollAnimation||i.session.setScrollTop(e.data-i.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){i.$scrollAnimation||i.session.setScrollLeft(e.data-i.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new f(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.addEventListener("changeCharacterSize",function(e){i.updateCharacterSize(),i.onResize(!0,i.gutterWidth,i.$size.width,i.$size.height),i._signal("changeCharacterSize",e)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0,$dirty:!0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1,gutterOffset:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$loop=new p(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),o.resetOptions(this),o._emit("renderer",this)};(function(){this.CHANGE_CURSOR=1,this.CHANGE_MARKER=2,this.CHANGE_GUTTER=4,this.CHANGE_SCROLL=8,this.CHANGE_LINES=16,this.CHANGE_TEXT=32,this.CHANGE_SIZE=64,this.CHANGE_MARKER_BACK=128,this.CHANGE_MARKER_FRONT=256,this.CHANGE_FULL=512,this.CHANGE_H_SCROLL=1024,n.implement(this,m),this.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin()},this.setSession=function(e){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=e,e&&this.scrollMargin.top&&e.getScrollTop()<=0&&e.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(e),this.$markerBack.setSession(e),this.$markerFront.setSession(e),this.$gutterLayer.setSession(e),this.$textLayer.setSession(e),e&&(this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on("changeNewLineMode",this.onChangeNewLineMode))},this.updateLines=function(e,t,i){if(void 0===t&&(t=1/0),this.$changedLines?(this.$changedLines.firstRow>e&&(this.$changedLines.firstRow=e),this.$changedLines.lastRowthis.layerConfig.lastRow||this.$loop.schedule(this.CHANGE_LINES)},this.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},this.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},this.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},this.updateFull=function(e){e?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},this.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},this.$changes=0,this.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},this.onResize=function(e,t,i,n){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=e?1:0;var r=this.container;n||(n=r.clientHeight||r.scrollHeight),i||(i=r.clientWidth||r.scrollWidth);var o=this.$updateCachedSize(e,t,i,n);if(!this.$size.scrollerHeight||!i&&!n)return this.resizing=0;e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(o|this.$changes,!0):this.$loop.schedule(o|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarV.scrollLeft=this.scrollBarV.scrollTop=null}},this.$updateCachedSize=function(e,t,i,n){n-=this.$extraHeight||0;var r=0,o=this.$size,s={width:o.width,height:o.height,scrollerHeight:o.scrollerHeight,scrollerWidth:o.scrollerWidth};return n&&(e||o.height!=n)&&(o.height=n,r|=this.CHANGE_SIZE,o.scrollerHeight=o.height,this.$horizScroll&&(o.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",r|=this.CHANGE_SCROLL),i&&(e||o.width!=i)&&(r|=this.CHANGE_SIZE,o.width=i,null==t&&(t=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=t,this.scrollBarH.element.style.left=this.scroller.style.left=t+"px",o.scrollerWidth=Math.max(0,i-t-this.scrollBarV.getWidth()),this.scrollBarH.element.style.right=this.scroller.style.right=this.scrollBarV.getWidth()+"px",this.scroller.style.bottom=this.scrollBarH.getHeight()+"px",(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)&&(r|=this.CHANGE_FULL)),o.$dirty=!i||!n,r&&this._signal("resize",s),r},this.onGutterResize=function(){var e=this.$showGutter?this.$gutter.offsetWidth:0;e!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,e,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()?this.$loop.schedule(this.CHANGE_FULL):this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):(this.$computeLayerConfig(),this.$loop.schedule(this.CHANGE_MARKER))},this.adjustWrapLimit=function(){var e=this.$size.scrollerWidth-2*this.$padding,t=Math.floor(e/this.characterWidth);return this.session.adjustWrapLimit(t,this.$showPrintMargin&&this.$printMarginColumn)},this.setAnimatedScroll=function(e){this.setOption("animatedScroll",e)},this.getAnimatedScroll=function(){return this.$animatedScroll},this.setShowInvisibles=function(e){this.setOption("showInvisibles",e),this.session.$bidiHandler.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.getOption("showInvisibles")},this.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},this.setDisplayIndentGuides=function(e){this.setOption("displayIndentGuides",e)},this.setShowPrintMargin=function(e){this.setOption("showPrintMargin",e)},this.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},this.setPrintMarginColumn=function(e){this.setOption("printMarginColumn",e)},this.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},this.getShowGutter=function(){return this.getOption("showGutter")},this.setShowGutter=function(e){return this.setOption("showGutter",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.$updateGutterLineHighlight=function(){var e=this.$cursorLayer.$pixelPos,t=this.layerConfig.lineHeight;if(this.session.getUseWrapMode()){var i=this.session.selection.getCursor();i.column=0,e=this.$cursorLayer.getPixelPosition(i,!0),t*=this.session.getRowLength(i.row)}this.$gutterLineHighlight.style.top=e.top-this.layerConfig.offset+"px",this.$gutterLineHighlight.style.height=t+"px"},this.$updatePrintMargin=function(){if(this.$showPrintMargin||this.$printMarginEl){if(!this.$printMarginEl){var e=r.createElement("div");e.className="ace_layer ace_print-margin-layer",this.$printMarginEl=r.createElement("div"),this.$printMarginEl.className="ace_print-margin",e.appendChild(this.$printMarginEl),this.content.insertBefore(e,this.content.firstChild)}var t=this.$printMarginEl.style;t.left=this.characterWidth*this.$printMarginColumn+this.$padding+"px",t.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&-1==this.session.$wrap&&this.adjustWrapLimit()}},this.getContainerElement=function(){return this.container},this.getMouseEventTarget=function(){return this.scroller},this.getTextAreaContainer=function(){return this.container},this.$moveTextAreaToCursor=function(){if(this.$keepTextAreaAtCursor){var e=this.layerConfig,t=this.$cursorLayer.$pixelPos.top,i=this.$cursorLayer.$pixelPos.left;t-=e.offset;var n=this.textarea.style,r=this.lineHeight;if(t<0||t>e.height-r)return void(n.top=n.left="0");var o=this.characterWidth;if(this.$composition){var s=this.textarea.value.replace(/^\x01+/,"");o*=this.session.$getStringScreenWidth(s)[0]+2,r+=2}i-=this.scrollLeft,i>this.$size.scrollerWidth-o&&(i=this.$size.scrollerWidth-o),i+=this.gutterWidth,n.height=r+"px",n.width=o+"px",n.left=Math.min(i,this.$size.scrollerWidth-o)+"px",n.top=Math.min(t,this.$size.height-r)+"px"}},this.getFirstVisibleRow=function(){return this.layerConfig.firstRow},this.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(0===this.layerConfig.offset?0:1)},this.getLastFullyVisibleRow=function(){var e=this.layerConfig,t=e.lastRow;return this.session.documentToScreenRow(t,0)*e.lineHeight-this.session.getScrollTop()>e.height-e.lineHeight?t-1:t},this.getLastVisibleRow=function(){return this.layerConfig.lastRow},this.$padding=null,this.setPadding=function(e){this.$padding=e,this.$textLayer.setPadding(e),this.$cursorLayer.setPadding(e),this.$markerFront.setPadding(e),this.$markerBack.setPadding(e),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},this.setScrollMargin=function(e,t,i,n){var r=this.scrollMargin;r.top=0|e,r.bottom=0|t,r.right=0|n,r.left=0|i,r.v=r.top+r.bottom,r.h=r.left+r.right,r.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-r.top),this.updateFull()},this.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},this.setHScrollBarAlwaysVisible=function(e){this.setOption("hScrollBarAlwaysVisible",e)},this.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},this.setVScrollBarAlwaysVisible=function(e){this.setOption("vScrollBarAlwaysVisible",e)},this.$updateScrollBarV=function(){var e=this.layerConfig.maxHeight,t=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(e-=(t-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>e-t&&(e=this.scrollTop+t,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(e+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},this.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},this.$frozen=!1,this.freeze=function(){this.$frozen=!0},this.unfreeze=function(){this.$frozen=!1},this.$renderChanges=function(e,t){if(this.$changes&&(e|=this.$changes,this.$changes=0),!this.session||!this.container.offsetWidth||this.$frozen||!e&&!t)return void(this.$changes|=e);if(this.$size.$dirty)return this.$changes|=e,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender"),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var i=this.layerConfig;if(e&this.CHANGE_FULL||e&this.CHANGE_SIZE||e&this.CHANGE_TEXT||e&this.CHANGE_LINES||e&this.CHANGE_SCROLL||e&this.CHANGE_H_SCROLL){if(e|=this.$computeLayerConfig(),i.firstRow!=this.layerConfig.firstRow&&i.firstRowScreen==this.layerConfig.firstRowScreen){var n=this.scrollTop+(i.firstRow-this.layerConfig.firstRow)*this.lineHeight;n>0&&(this.scrollTop=n,e|=this.CHANGE_SCROLL,e|=this.$computeLayerConfig())}i=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),this.$gutterLayer.element.style.marginTop=-i.offset+"px",this.content.style.marginTop=-i.offset+"px",this.content.style.width=i.width+2*this.$padding+"px",this.content.style.height=i.minHeight+"px"}return e&this.CHANGE_H_SCROLL&&(this.content.style.marginLeft=-this.scrollLeft+"px",this.scroller.className=this.scrollLeft<=0?"ace_scroller":"ace_scroller ace_scroll-left"),e&this.CHANGE_FULL?(this.$textLayer.update(i),this.$showGutter&&this.$gutterLayer.update(i),this.$markerBack.update(i),this.$markerFront.update(i),this.$cursorLayer.update(i),this.$moveTextAreaToCursor(),this.$highlightGutterLine&&this.$updateGutterLineHighlight(),void this._signal("afterRender")):e&this.CHANGE_SCROLL?(e&this.CHANGE_TEXT||e&this.CHANGE_LINES?this.$textLayer.update(i):this.$textLayer.scrollLines(i),this.$showGutter&&this.$gutterLayer.update(i),this.$markerBack.update(i),this.$markerFront.update(i),this.$cursorLayer.update(i),this.$highlightGutterLine&&this.$updateGutterLineHighlight(),this.$moveTextAreaToCursor(),void this._signal("afterRender")):(e&this.CHANGE_TEXT?(this.$textLayer.update(i),this.$showGutter&&this.$gutterLayer.update(i)):e&this.CHANGE_LINES?(this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(i):(e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER)&&this.$showGutter&&this.$gutterLayer.update(i),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(i),this.$moveTextAreaToCursor(),this.$highlightGutterLine&&this.$updateGutterLineHighlight()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(i),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(i),void this._signal("afterRender"))},this.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,t=this.$maxLines*this.lineHeight,i=Math.min(t,Math.max((this.$minLines||1)*this.lineHeight,e))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(i+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&i>this.$maxPixelHeight&&(i=this.$maxPixelHeight);var n=e>t;if(i!=this.desiredHeight||this.$size.height!=this.desiredHeight||n!=this.$vScroll){n!=this.$vScroll&&(this.$vScroll=n,this.scrollBarV.setVisible(n));var r=this.container.clientWidth;this.container.style.height=i+"px",this.$updateCachedSize(!0,this.$gutterWidth,r,i),this.desiredHeight=i,this._signal("autosize")}},this.$computeLayerConfig=function(){var e=this.session,t=this.$size,i=t.height<=2*this.lineHeight,n=this.session.getScreenLength(),r=n*this.lineHeight,o=this.$getLongestLine(),s=!i&&(this.$hScrollBarAlwaysVisible||t.scrollerWidth-o-2*this.$padding<0),a=this.$horizScroll!==s;a&&(this.$horizScroll=s,this.scrollBarH.setVisible(s));var l=this.$vScroll;this.$maxLines&&this.lineHeight>1&&this.$autosize();var c=this.scrollTop%this.lineHeight,h=t.scrollerHeight+this.lineHeight,d=!this.$maxLines&&this.$scrollPastEnd?(t.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;r+=d;var u=this.scrollMargin;this.session.setScrollTop(Math.max(-u.top,Math.min(this.scrollTop,r-t.scrollerHeight+u.bottom))),this.session.setScrollLeft(Math.max(-u.left,Math.min(this.scrollLeft,o+2*this.$padding-t.scrollerWidth+u.right)));var p=!i&&(this.$vScrollBarAlwaysVisible||t.scrollerHeight-r+d<0||this.scrollTop>u.top),f=l!==p;f&&(this.$vScroll=p,this.scrollBarV.setVisible(p));var m,g,v=Math.ceil(h/this.lineHeight)-1,y=Math.max(0,Math.round((this.scrollTop-c)/this.lineHeight)),w=y+v,b=this.lineHeight;y=e.screenToDocumentRow(y,0);var C=e.getFoldLine(y);C&&(y=C.start.row),m=e.documentToScreenRow(y,0),g=e.getRowLength(y)*b,w=Math.min(e.screenToDocumentRow(w,0),e.getLength()-1),h=t.scrollerHeight+e.getRowLength(w)*b+g,c=this.scrollTop-m*b;var A=0;return this.layerConfig.width!=o&&(A=this.CHANGE_H_SCROLL),(a||f)&&(A=this.$updateCachedSize(!0,this.gutterWidth,t.width,t.height),this._signal("scrollbarVisibilityChanged"),f&&(o=this.$getLongestLine())),this.layerConfig={width:o,padding:this.$padding,firstRow:y,firstRowScreen:m,lastRow:w,lineHeight:b,characterWidth:this.characterWidth,minHeight:h,maxHeight:r,offset:c,gutterOffset:b?Math.max(0,Math.ceil((c+t.height-t.scrollerHeight)/b)):0,height:this.$size.scrollerHeight},A},this.$updateLines=function(){if(this.$changedLines){var e=this.$changedLines.firstRow,t=this.$changedLines.lastRow;this.$changedLines=null;var i=this.layerConfig;if(!(e>i.lastRow+1||to?(t&&l+s>o+this.lineHeight&&(o-=t*this.$size.scrollerHeight),0===o&&(o=-this.scrollMargin.top),this.session.setScrollTop(o)):l+this.$size.scrollerHeight-ar?(r=1-this.scrollMargin.top||(t>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom||(e<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||(e>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right||void 0)))},this.pixelToScreenCoordinates=function(e,t){var i=this.scroller.getBoundingClientRect(),n=e+this.scrollLeft-i.left-this.$padding,r=n/this.characterWidth,o=Math.floor((t+this.scrollTop-i.top)/this.lineHeight),s=Math.round(r);return{row:o,column:s,side:r-s>0?1:-1,offsetX:n}},this.screenToTextCoordinates=function(e,t){var i=this.scroller.getBoundingClientRect(),n=e+this.scrollLeft-i.left-this.$padding,r=Math.round(n/this.characterWidth),o=(t+this.scrollTop-i.top)/this.lineHeight;return this.session.screenToDocumentPosition(o,Math.max(r,0),n)},this.textToScreenCoordinates=function(e,t){var i=this.scroller.getBoundingClientRect(),n=this.session.documentToScreenPosition(e,t),r=this.$padding+(this.session.$bidiHandler.isBidiRow(n.row,e)?this.session.$bidiHandler.getPosLeft(n.column):Math.round(n.column*this.characterWidth)),o=n.row*this.lineHeight;return{pageX:i.left+r-this.scrollLeft,pageY:i.top+o-this.scrollTop}},this.visualizeFocus=function(){r.addCssClass(this.container,"ace_focus")},this.visualizeBlur=function(){r.removeCssClass(this.container,"ace_focus")},this.showComposition=function(e){this.$composition||(this.$composition={keepTextAreaAtCursor:this.$keepTextAreaAtCursor,cssText:this.textarea.style.cssText}),this.$keepTextAreaAtCursor=!0,r.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor()},this.setCompositionText=function(e){this.$moveTextAreaToCursor()},this.hideComposition=function(){this.$composition&&(r.removeCssClass(this.textarea,"ace_composition"),this.$keepTextAreaAtCursor=this.$composition.keepTextAreaAtCursor,this.textarea.style.cssText=this.$composition.cssText,this.$composition=null)},this.setTheme=function(e,t){function i(i){if(n.$themeId!=e)return t&&t();if(!i||!i.cssClass)throw new Error("couldn't load module "+e+" or it didn't call define");r.importCssString(i.cssText,i.cssClass,n.container.ownerDocument),n.theme&&r.removeCssClass(n.container,n.theme.cssClass);var o="padding"in i?i.padding:"padding"in(n.theme||{})?4:n.$padding;n.$padding&&o!=n.$padding&&n.setPadding(o),n.$theme=i.cssClass,n.theme=i,r.addCssClass(n.container,i.cssClass),r.setCssClass(n.container,"ace_dark",i.isDark),n.$size&&(n.$size.width=0,n.$updateSizeAsync()),n._dispatchEvent("themeLoaded",{theme:i}),t&&t()}var n=this;if(this.$themeId=e,n._dispatchEvent("themeChange",{theme:e}),e&&"string"!=typeof e)i(e);else{var s=e||this.$options.theme.initialValue;o.loadModule(["theme",s],i)}},this.getTheme=function(){return this.$themeId},this.setStyle=function(e,t){r.setCssClass(this.container,e,!1!==t)},this.unsetStyle=function(e){r.removeCssClass(this.container,e)},this.setCursorStyle=function(e){this.scroller.style.cursor!=e&&(this.scroller.style.cursor=e)},this.setMouseCursor=function(e){this.scroller.style.cursor=e},this.destroy=function(){this.$textLayer.destroy(),this.$cursorLayer.destroy()}}).call(g.prototype),o.defineOptions(g.prototype,"renderer",{animatedScroll:{initialValue:!1},showInvisibles:{set:function(e){this.$textLayer.setShowInvisibles(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(e){"number"==typeof e&&(this.$printMarginColumn=e),this.$showPrintMargin=!!e,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(e){this.$gutter.style.display=e?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},fadeFoldWidgets:{set:function(e){r.setCssClass(this.$gutter,"ace_fade-fold-widgets",e)},initialValue:!1},showFoldWidgets:{set:function(e){this.$gutterLayer.setShowFoldWidgets(e)},initialValue:!0},showLineNumbers:{set:function(e){this.$gutterLayer.setShowLineNumbers(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(e){this.$textLayer.setDisplayIndentGuides(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightGutterLine:{set:function(e){if(!this.$gutterLineHighlight)return this.$gutterLineHighlight=r.createElement("div"),this.$gutterLineHighlight.className="ace_gutter-active-line",void this.$gutter.appendChild(this.$gutterLineHighlight);this.$gutterLineHighlight.style.display=e?"":"none",this.$cursorLayer.$pixelPos&&this.$updateGutterLineHighlight()},initialValue:!1,value:!0},hScrollBarAlwaysVisible:{set:function(e){this.$hScrollBarAlwaysVisible&&this.$horizScroll||this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(e){this.$vScrollBarAlwaysVisible&&this.$vScroll||this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(e){"number"==typeof e&&(e+="px"),this.container.style.fontSize=e,this.updateFontSize()},initialValue:12},fontFamily:{set:function(e){this.container.style.fontFamily=e,this.updateFontSize()}},maxLines:{set:function(e){this.updateFull()}},minLines:{set:function(e){this.updateFull()}},maxPixelHeight:{set:function(e){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(e){e=+e||0,this.$scrollPastEnd!=e&&(this.$scrollPastEnd=e,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(e){this.$gutterLayer.$fixedWidth=!!e,this.$loop.schedule(this.CHANGE_GUTTER)}},theme:{set:function(e){this.setTheme(e)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0}}),t.VirtualRenderer=g}),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(e,t,i){"use strict";function n(e,t){var i=t.src;s.qualifyURL(e);try{return new Blob([i],{type:"application/javascript"})}catch(e){var n=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,r=new n;return r.append(i),r.getBlob("application/javascript")}}function r(e,t){var i=n(e,t),r=window.URL||window.webkitURL,o=r.createObjectURL(i);return new Worker(o)}var o=e("../lib/oop"),s=e("../lib/net"),a=e("../lib/event_emitter").EventEmitter,l=e("../config"),c=function(t,i,n,o,s){if(this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),e.nameToUrl&&!e.toUrl&&(e.toUrl=e.nameToUrl),l.get("packaged")||!e.toUrl)o=o||l.moduleUrl(i.id,"worker");else{var a=this.$normalizePath;o=o||a(e.toUrl("ace/worker/worker.js",null,"_"));var c={};t.forEach(function(t){c[t]=a(e.toUrl(t,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}this.$worker=r(o,i),s&&this.send("importScripts",s),this.$worker.postMessage({init:!0,tlns:c,module:i.id,classname:n}),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){o.implement(this,a),this.onMessage=function(e){var t=e.data;switch(t.type){case"event":this._signal(t.name,{data:t.data});break;case"call":var i=this.callbacks[t.id];i&&(i(t.data),delete this.callbacks[t.id]);break;case"error":this.reportError(t.data);break;case"log":window.console&&console.log&&console.log.apply(console,t.data)}},this.reportError=function(e){window.console&&console.error&&console.error(e)},this.$normalizePath=function(e){return s.qualifyURL(e)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(e,t){this.$worker.postMessage({command:e,args:t})},this.call=function(e,t,i){if(i){var n=this.callbackId++;this.callbacks[n]=i,t.push(n)}this.send(e,t)},this.emit=function(e,t){try{ -this.$worker.postMessage({event:e,data:{data:t.data}})}catch(e){console.error(e.stack)}},this.attachToDocument=function(e){this.$doc&&this.terminate(),this.$doc=e,this.call("setValue",[e.getValue()]),e.on("change",this.changeListener)},this.changeListener=function(e){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),"insert"==e.action?this.deltaQueue.push(e.start,e.lines):this.deltaQueue.push(e.start,e.end)},this.$sendDeltaQueue=function(){var e=this.deltaQueue;e&&(this.deltaQueue=null,e.length>50&&e.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:e}))}}).call(c.prototype);var h=function(e,t,i){this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.callbackId=1,this.callbacks={},this.messageBuffer=[];var n=null,r=!1,o=Object.create(a),s=this;this.$worker={},this.$worker.terminate=function(){},this.$worker.postMessage=function(e){s.messageBuffer.push(e),n&&(r?setTimeout(c):c())},this.setEmitSync=function(e){r=e};var c=function(){var e=s.messageBuffer.shift();e.command?n[e.command].apply(n,e.args):e.event&&o._signal(e.event,e.data)};o.postMessage=function(e){s.onMessage({data:e})},o.callback=function(e,t){this.postMessage({type:"call",id:t,data:e})},o.emit=function(e,t){this.postMessage({type:"event",name:e,data:t})},l.loadModule(["worker",t],function(e){for(n=new e[i](o);s.messageBuffer.length;)c()})};h.prototype=c.prototype,t.UIWorkerClient=h,t.WorkerClient=c,t.createWorker=r}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(e,t,i){"use strict";var n=e("./range").Range,r=e("./lib/event_emitter").EventEmitter,o=e("./lib/oop"),s=function(e,t,i,n,r,o){var s=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=r,this.othersClass=o,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate),this.$others=n,this.$onCursorChange=function(){setTimeout(function(){s.onCursorChange()})},this.$pos=i;var a=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=a.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)};(function(){o.implement(this,r),this.setup=function(){var e=this,t=this.doc,i=this.session;this.selectionBefore=i.selection.toJSON(),i.selection.inMultiSelectMode&&i.selection.toSingleRange(),this.pos=t.createAnchor(this.$pos.row,this.$pos.column);var r=this.pos;r.$insertRight=!0,r.detach(),r.markerId=i.addMarker(new n(r.row,r.column,r.row,r.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(i){var n=t.createAnchor(i.row,i.column);n.$insertRight=!0,n.detach(),e.others.push(n)}),i.setUndoSelect(!1)},this.showOtherMarkers=function(){if(!this.othersActive){var e=this.session,t=this;this.othersActive=!0,this.others.forEach(function(i){i.markerId=e.addMarker(new n(i.row,i.column,i.row,i.column+t.length),t.othersClass,null,!1)})}},this.hideOtherMarkers=function(){if(this.othersActive){this.othersActive=!1;for(var e=0;e=this.pos.column&&t.start.column<=this.pos.column+this.length+1,o=t.start.column-this.pos.column;if(this.updateAnchors(e),r&&(this.length+=i),r&&!this.session.$fromUndo)if("insert"===e.action)for(var s=this.others.length-1;s>=0;s--){var a=this.others[s],l={row:a.row,column:a.column+o};this.doc.insertMergedLines(l,e.lines)}else if("remove"===e.action)for(var s=this.others.length-1;s>=0;s--){var a=this.others[s],l={row:a.row,column:a.column+o};this.doc.remove(new n(l.row,l.column,l.row,l.column-i))}this.$updating=!1,this.updateMarkers()}},this.updateAnchors=function(e){this.pos.onChange(e);for(var t=this.others.length;t--;)this.others[t].onChange(e);this.updateMarkers()},this.updateMarkers=function(){if(!this.$updating){var e=this,t=this.session,i=function(i,r){t.removeMarker(i.markerId),i.markerId=t.addMarker(new n(i.row,i.column,i.row,i.column+e.length),r,null,!1)};i(this.pos,this.mainClass);for(var r=this.others.length;r--;)i(this.others[r],this.othersClass)}},this.onCursorChange=function(e){if(!this.$updating&&this.session){var t=this.session.selection.getCursor();t.row===this.pos.row&&t.column>=this.pos.column&&t.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",e)):(this.hideOtherMarkers(),this._emit("cursorLeave",e))}},this.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.removeEventListener("change",this.$onUpdate),this.session.selection.removeEventListener("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},this.cancel=function(){if(-1!==this.$undoStackDepth){for(var e=this.session.getUndoManager(),t=(e.$undoStack||e.$undostack).length-this.$undoStackDepth,i=0;i1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),t||this.fromOrientedRange(e)}},this.toSingleRange=function(e){e=e||this.ranges[0];var t=this.rangeList.removeAll();t.length&&this.$onRemoveRange(t),e&&this.fromOrientedRange(e)},this.substractPoint=function(e){var t=this.rangeList.substractPoint(e);if(t)return this.$onRemoveRange(t),t[0]},this.mergeOverlappingRanges=function(){var e=this.rangeList.merge();e.length?this.$onRemoveRange(e):this.ranges[0]&&this.fromOrientedRange(this.ranges[0])},this.$onAddRange=function(e){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(e),this._signal("addRange",{range:e})},this.$onRemoveRange=function(e){if(this.rangeCount=this.rangeList.ranges.length,1==this.rangeCount&&this.inMultiSelectMode){var t=this.rangeList.ranges.pop();e.push(t),this.rangeCount=0}for(var i=e.length;i--;){var n=this.ranges.indexOf(e[i]);this.ranges.splice(n,1)}this._signal("removeRange",{ranges:e}),0===this.rangeCount&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),(t=t||this.ranges[0])&&!t.isEqual(this.getRange())&&this.fromOrientedRange(t)},this.$initRangeList=function(){this.rangeList||(this.rangeList=new a,this.ranges=[],this.rangeCount=0)},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,t=e[e.length-1],i=l.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(i,t.cursor==t.start)}else{var i=this.getRange(),n=this.isBackwards(),r=i.start.row,o=i.end.row;if(r==o){if(n)var s=i.end,a=i.start;else var s=i.start,a=i.end;return this.addRange(l.fromPoints(a,a)),void this.addRange(l.fromPoints(s,s))}var c=[],h=this.getLineRange(r,!0);h.start.column=i.start.column,c.push(h);for(var d=r+1;d1){var e=this.rangeList.ranges,t=e[e.length-1],i=l.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(i,t.cursor==t.start)}else{var n=this.session.documentToScreenPosition(this.selectionLead),r=this.session.documentToScreenPosition(this.selectionAnchor);this.rectangularRangeBlock(n,r).forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,t,i){var n=[],o=e.column0;)v--;if(v>0)for(var y=0;n[y].isEmpty();)y++;for(var w=v;w>=y;w--)n[w].isEmpty()&&n.splice(w,1)}return n}}.call(c.prototype);var v=e("./editor").Editor;(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(e){e.cursor||(e.cursor=e.end);var t=this.getSelectionStyle();return e.marker=this.session.addMarker(e,"ace_selection",t),this.session.$selectionMarkers.push(e),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,e},this.removeSelectionMarker=function(e){if(e.marker){this.session.removeMarker(e.marker);var t=this.session.$selectionMarkers.indexOf(e);-1!=t&&this.session.$selectionMarkers.splice(t,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length}},this.removeSelectionMarkers=function(e){for(var t=this.session.$selectionMarkers,i=e.length;i--;){var n=e[i];if(n.marker){this.session.removeMarker(n.marker);var r=t.indexOf(n);-1!=r&&t.splice(r,1)}}this.session.selectionMarkerCount=t.length},this.$onAddRange=function(e){this.addSelectionMarker(e.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(e){this.removeSelectionMarkers(e.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(e){this.inMultiSelectMode||(this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(p.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onSingleSelect=function(e){this.session.multiSelect.inVirtualMode||(this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(p.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(e){var t=e.command,i=e.editor;if(i.multiSelect){if(t.multiSelectAction)"forEach"==t.multiSelectAction?n=i.forEachSelection(t,e.args):"forEachLine"==t.multiSelectAction?n=i.forEachSelection(t,e.args,!0):"single"==t.multiSelectAction?(i.exitMultiSelectMode(),n=t.exec(i,e.args||{})):n=t.multiSelectAction(i,e.args||{});else{var n=t.exec(i,e.args||{});i.multiSelect.addRange(i.multiSelect.toOrientedRange()),i.multiSelect.mergeOverlappingRanges()}return n}},this.forEachSelection=function(e,t,i){if(!this.inVirtualSelectionMode){var n,r=i&&i.keepOrder,o=1==i||i&&i.$byLines,s=this.session,a=this.selection,l=a.rangeList,h=(r?a:l).ranges;if(!h.length)return e.exec?e.exec(this,t||{}):e(this,t||{});var d=a._eventRegistry;a._eventRegistry={};var u=new c(s);this.inVirtualSelectionMode=!0;for(var p=h.length;p--;){if(o)for(;p>0&&h[p].start.row==h[p-1].end.row;)p--;u.fromOrientedRange(h[p]),u.index=p,this.selection=s.selection=u;var f=e.exec?e.exec(this,t||{}):e(this,t||{});n||void 0===f||(n=f),u.toOrientedRange(h[p])}u.detach(),this.selection=s.selection=a,this.inVirtualSelectionMode=!1,a._eventRegistry=d,a.mergeOverlappingRanges();var m=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),m&&m.from==m.to&&this.renderer.animateScrolling(m.from),n}},this.exitMultiSelectMode=function(){this.inMultiSelectMode&&!this.inVirtualSelectionMode&&this.multiSelect.toSingleRange()},this.getSelectedText=function(){var e="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){for(var t=this.multiSelect.rangeList.ranges,i=[],n=0;no&&(o=i.column),rc?e.insert(n,u.stringRepeat(" ",r-c)):e.remove(new l(n.row,n.column,n.row,n.column-r+c)),t.start.column=t.end.column=o,t.start.row=t.end.row=n.row,t.cursor=t.end}),t.fromOrientedRange(i[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}else{var c=this.selection.getRange(),h=c.start.row,d=c.end.row,p=h==d;if(p){var f,m=this.session.getLength();do{f=this.session.getLine(d)}while(/[=:]/.test(f)&&++d0);h<0&&(h=0),d>=m&&(d=m-1)}var g=this.session.removeFullLines(h,d);g=this.$reAlignText(g,p),this.session.insert({row:h,column:0},g.join("\n")+"\n"),p||(c.start.column=0,c.end.column=g[g.length-1].length),this.selection.setRange(c)}},this.$reAlignText=function(e,t){function i(e){return u.stringRepeat(" ",e)}function n(e){return e[2]?i(s)+e[2]+i(a-e[2].length+l)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function r(e){return e[2]?i(s+a-e[2].length)+e[2]+i(l," ")+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function o(e){return e[2]?i(s)+e[2]+i(l)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}var s,a,l,c=!0,h=!0;return e.map(function(e){var t=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return t?null==s?(s=t[1].length,a=t[2].length,l=t[3].length,t):(s+a+l!=t[1].length+t[2].length+t[3].length&&(h=!1),s!=t[1].length&&(c=!1),s>t[1].length&&(s=t[1].length),at[3].length&&(l=t[3].length),t):[e]}).map(t?n:c?h?r:n:o)}}).call(v.prototype),t.onSessionChange=function(e){var t=e.session;t&&!t.multiSelect&&(t.$selectionMarkers=[],t.selection.$initRangeList(),t.multiSelect=t.selection),this.multiSelect=t&&t.multiSelect;var i=e.oldSession;i&&(i.multiSelect.off("addRange",this.$onAddRange),i.multiSelect.off("removeRange",this.$onRemoveRange),i.multiSelect.off("multiSelect",this.$onMultiSelect),i.multiSelect.off("singleSelect",this.$onSingleSelect),i.multiSelect.lead.off("change",this.$checkMultiselectChange),i.multiSelect.anchor.off("change",this.$checkMultiselectChange)),t&&(t.multiSelect.on("addRange",this.$onAddRange),t.multiSelect.on("removeRange",this.$onRemoveRange),t.multiSelect.on("multiSelect",this.$onMultiSelect),t.multiSelect.on("singleSelect",this.$onSingleSelect),t.multiSelect.lead.on("change",this.$checkMultiselectChange),t.multiSelect.anchor.on("change",this.$checkMultiselectChange)),t&&this.inMultiSelectMode!=t.selection.inMultiSelectMode&&(t.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())},t.MultiSelect=o,e("./config").defineOptions(v.prototype,"editor",{enableMultiselect:{set:function(e){o(this),e?(this.on("changeSession",this.$multiselectOnSessionChange),this.on("mousedown",h)):(this.off("changeSession",this.$multiselectOnSessionChange),this.off("mousedown",h))},value:!0},enableBlockSelect:{set:function(e){this.$blockSelectEnabled=e},value:!0}})}),ace.define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(e,t,i){"use strict";var n=e("../../range").Range,r=t.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,t,i){var n=e.getLine(i);return this.foldingStartMarker.test(n)?"start":"markbeginend"==t&&this.foldingStopMarker&&this.foldingStopMarker.test(n)?"end":""},this.getFoldWidgetRange=function(e,t,i){return null},this.indentationBlock=function(e,t,i){var r=e.getLine(t),o=r.search(/\S/);if(-1!=o){for(var s=i||r.length,a=e.getLength(),l=t,c=t;++tl){var d=e.getLine(c).length;return new n(l,s,c,d)}}},this.openingBracketBlock=function(e,t,i,r,o){var s={row:i,column:r+1},a=e.$findClosingBracket(t,s,o);if(a){var l=e.foldWidgets[a.row];return null==l&&(l=e.getFoldWidget(a.row)),"start"==l&&a.row>s.row&&(a.row--,a.column=e.getLine(a.row).length),n.fromPoints(s,a)}},this.closingBracketBlock=function(e,t,i,r,o){var s={row:i,column:r},a=e.$findOpeningBracket(t,s);if(a)return a.column++,s.column--,n.fromPoints(a,s)}}).call(r.prototype)}),ace.define("ace/theme/textmate",["require","exports","module","ace/lib/dom"],function(e,t,i){"use strict";t.isDark=!1,t.cssClass="ace-tm",t.cssText='.ace-tm .ace_gutter {\tbackground: #f0f0f0;\tcolor: #333;\t}\t.ace-tm .ace_print-margin {\twidth: 1px;\tbackground: #e8e8e8;\t}\t.ace-tm .ace_fold {\tbackground-color: #6B72E6;\t}\t.ace-tm {\tbackground-color: #FFFFFF;\tcolor: black;\t}\t.ace-tm .ace_cursor {\tcolor: black;\t}\t.ace-tm .ace_invisible {\tcolor: rgb(191, 191, 191);\t}\t.ace-tm .ace_storage,\t.ace-tm .ace_keyword {\tcolor: blue;\t}\t.ace-tm .ace_constant {\tcolor: rgb(197, 6, 11);\t}\t.ace-tm .ace_constant.ace_buildin {\tcolor: rgb(88, 72, 246);\t}\t.ace-tm .ace_constant.ace_language {\tcolor: rgb(88, 92, 246);\t}\t.ace-tm .ace_constant.ace_library {\tcolor: rgb(6, 150, 14);\t}\t.ace-tm .ace_invalid {\tbackground-color: rgba(255, 0, 0, 0.1);\tcolor: red;\t}\t.ace-tm .ace_support.ace_function {\tcolor: rgb(60, 76, 114);\t}\t.ace-tm .ace_support.ace_constant {\tcolor: rgb(6, 150, 14);\t}\t.ace-tm .ace_support.ace_type,\t.ace-tm .ace_support.ace_class {\tcolor: rgb(109, 121, 222);\t}\t.ace-tm .ace_keyword.ace_operator {\tcolor: rgb(104, 118, 135);\t}\t.ace-tm .ace_string {\tcolor: rgb(3, 106, 7);\t}\t.ace-tm .ace_comment {\tcolor: rgb(76, 136, 107);\t}\t.ace-tm .ace_comment.ace_doc {\tcolor: rgb(0, 102, 255);\t}\t.ace-tm .ace_comment.ace_doc.ace_tag {\tcolor: rgb(128, 159, 191);\t}\t.ace-tm .ace_constant.ace_numeric {\tcolor: rgb(0, 0, 205);\t}\t.ace-tm .ace_variable {\tcolor: rgb(49, 132, 149);\t}\t.ace-tm .ace_xml-pe {\tcolor: rgb(104, 104, 91);\t}\t.ace-tm .ace_entity.ace_name.ace_function {\tcolor: #0000A2;\t}\t.ace-tm .ace_heading {\tcolor: rgb(12, 7, 255);\t}\t.ace-tm .ace_list {\tcolor:rgb(185, 6, 144);\t}\t.ace-tm .ace_meta.ace_tag {\tcolor:rgb(0, 22, 142);\t}\t.ace-tm .ace_string.ace_regex {\tcolor: rgb(255, 0, 0)\t}\t.ace-tm .ace_marker-layer .ace_selection {\tbackground: rgb(181, 213, 255);\t}\t.ace-tm.ace_multiselect .ace_selection.ace_start {\tbox-shadow: 0 0 3px 0px white;\t}\t.ace-tm .ace_marker-layer .ace_step {\tbackground: rgb(252, 255, 0);\t}\t.ace-tm .ace_marker-layer .ace_stack {\tbackground: rgb(164, 229, 101);\t}\t.ace-tm .ace_marker-layer .ace_bracket {\tmargin: -1px 0 0 -1px;\tborder: 1px solid rgb(192, 192, 192);\t}\t.ace-tm .ace_marker-layer .ace_active-line {\tbackground: rgba(0, 0, 0, 0.07);\t}\t.ace-tm .ace_gutter-active-line {\tbackground-color : #dcdcdc;\t}\t.ace-tm .ace_marker-layer .ace_selected-word {\tbackground: rgb(250, 250, 255);\tborder: 1px solid rgb(200, 200, 250);\t}\t.ace-tm .ace_indent-guide {\tbackground: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;\t}\t',e("../lib/dom").importCssString(t.cssText,t.cssClass)}),ace.define("ace/line_widgets",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/range"],function(e,t,i){"use strict";function n(e){this.session=e,this.session.widgetManager=this,this.session.getRowLength=this.getRowLength,this.session.$getWidgetScreenLength=this.$getWidgetScreenLength,this.updateOnChange=this.updateOnChange.bind(this),this.renderWidgets=this.renderWidgets.bind(this),this.measureWidgets=this.measureWidgets.bind(this),this.session._changedWidgets=[],this.$onChangeEditor=this.$onChangeEditor.bind(this),this.session.on("change",this.updateOnChange),this.session.on("changeFold",this.updateOnFold),this.session.on("changeEditor",this.$onChangeEditor)}var r=(e("./lib/oop"),e("./lib/dom"));e("./range").Range;(function(){this.getRowLength=function(e){var t;return t=this.lineWidgets?this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0:0,this.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1+t:1+t},this.$getWidgetScreenLength=function(){var e=0;return this.lineWidgets.forEach(function(t){t&&t.rowCount&&!t.hidden&&(e+=t.rowCount)}),e},this.$onChangeEditor=function(e){this.attach(e.editor)},this.attach=function(e){e&&e.widgetManager&&e.widgetManager!=this&&e.widgetManager.detach(),this.editor!=e&&(this.detach(),this.editor=e,e&&(e.widgetManager=this,e.renderer.on("beforeRender",this.measureWidgets),e.renderer.on("afterRender",this.renderWidgets)))},this.detach=function(e){var t=this.editor;if(t){this.editor=null,t.widgetManager=null,t.renderer.off("beforeRender",this.measureWidgets),t.renderer.off("afterRender",this.renderWidgets);var i=this.session.lineWidgets;i&&i.forEach(function(e){e&&e.el&&e.el.parentNode&&(e._inDocument=!1,e.el.parentNode.removeChild(e.el))})}},this.updateOnFold=function(e,t){var i=t.lineWidgets;if(i&&e.action){for(var n=e.data,r=n.start.row,o=n.end.row,s="add"==e.action,a=r+1;a0&&!n[r];)r--;this.firstRow=i.firstRow,this.lastRow=i.lastRow,t.$cursorLayer.config=i;for(var s=r;s<=o;s++){var a=n[s];if(a&&a.el)if(a.hidden)a.el.style.top=-100-(a.pixelHeight||0)+"px";else{a._inDocument||(a._inDocument=!0,t.container.appendChild(a.el));var l=t.$cursorLayer.getPixelPosition({row:s,column:0},!0).top;a.coverLine||(l+=i.lineHeight*this.session.getRowLineCount(a.row)),a.el.style.top=l-i.offset+"px";var c=a.coverGutter?0:t.gutterWidth;a.fixedWidth||(c-=t.scrollLeft),a.el.style.left=c+"px",a.fullWidth&&a.screenWidth&&(a.el.style.minWidth=i.width+2*i.padding+"px"),a.fixedWidth?a.el.style.right=t.scrollBar.getWidth()+"px":a.el.style.right=""}}}}}).call(n.prototype),t.LineWidgets=n}),ace.define("ace/ext/error_marker",["require","exports","module","ace/line_widgets","ace/lib/dom","ace/range"],function(e,t,i){"use strict";function n(e,t,i){for(var n=0,r=e.length-1;n<=r;){var o=n+r>>1,s=i(t,e[o]);if(s>0)n=o+1;else{if(!(s<0))return o;r=o-1}}return-(n+1)}function r(e,t,i){var r=e.getAnnotations().sort(a.comparePoints);if(r.length){var o=n(r,{row:t,column:-1},a.comparePoints);o<0&&(o=-o-1),o>=r.length?o=i>0?0:r.length-1:0===o&&i<0&&(o=r.length-1);var s=r[o];if(s&&i){if(s.row===t){do{s=r[o+=i]}while(s&&s.row===t);if(!s)return r.slice()}var l=[];t=s.row;do{l[i<0?"unshift":"push"](s),s=r[o+=i]}while(s&&s.row==t);return l.length&&l}}}var o=e("../line_widgets").LineWidgets,s=e("../lib/dom"),a=e("../range").Range;t.showErrorMarker=function(e,t){var i=e.session;i.widgetManager||(i.widgetManager=new o(i),i.widgetManager.attach(e));var n=e.getCursorPosition(),a=n.row,l=i.widgetManager.getWidgetsAtRow(a).filter(function(e){return"errorMarker"==e.type})[0];l?l.destroy():a-=t;var c,h=r(i,a,t);if(h){var d=h[0];n.column=(d.pos&&"number"!=typeof d.column?d.pos.sc:d.column)||0,n.row=d.row,c=e.renderer.$gutterLayer.$annotations[n.row]}else{if(l)return;c={text:["Looks good!"],className:"ace_ok"}}e.session.unfold(n.row),e.selection.moveToPosition(n);var u={row:n.row,fixedWidth:!0,coverGutter:!0,el:s.createElement("div"),type:"errorMarker"},p=u.el.appendChild(s.createElement("div")),f=u.el.appendChild(s.createElement("div"));f.className="error_widget_arrow "+c.className;var m=e.renderer.$cursorLayer.getPixelPosition(n).left;f.style.left=m+e.renderer.gutterWidth-5+"px",u.el.className="error_widget_wrapper",p.className="error_widget "+c.className,p.innerHTML=c.text.join("
"),p.appendChild(s.createElement("div"));var g=function(e,t,i){if(0===t&&("esc"===i||"return"===i))return u.destroy(),{command:"null"}};u.destroy=function(){e.$mouseHandler.isMousePressed||(e.keyBinding.removeKeyboardHandler(g),i.widgetManager.removeLineWidget(u),e.off("changeSelection",u.destroy),e.off("changeSession",u.destroy),e.off("mouseup",u.destroy),e.off("change",u.destroy))},e.keyBinding.addKeyboardHandler(g),e.on("changeSelection",u.destroy),e.on("changeSession",u.destroy),e.on("mouseup",u.destroy),e.on("change",u.destroy),e.session.widgetManager.addLineWidget(u),u.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:u.el.offsetHeight})},s.importCssString("\t .error_widget_wrapper {\t background: inherit;\t color: inherit;\t border:none\t }\t .error_widget {\t border-top: solid 2px;\t border-bottom: solid 2px;\t margin: 5px 0;\t padding: 10px 40px;\t white-space: pre-wrap;\t }\t .error_widget.ace_error, .error_widget_arrow.ace_error{\t border-color: #ff5a5a\t }\t .error_widget.ace_warning, .error_widget_arrow.ace_warning{\t border-color: #F1D817\t }\t .error_widget.ace_info, .error_widget_arrow.ace_info{\t border-color: #5a5a5a\t }\t .error_widget.ace_ok, .error_widget_arrow.ace_ok{\t border-color: #5aaa5a\t }\t .error_widget_arrow {\t position: absolute;\t border: solid 5px;\t border-top-color: transparent!important;\t border-right-color: transparent!important;\t border-left-color: transparent!important;\t top: -5px;\t }\t","")}),ace.define("ace/ace",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/dom","ace/lib/event","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config"],function(e,t,n){"use strict";e("./lib/fixoldbrowsers");var r=e("./lib/dom"),o=e("./lib/event"),s=e("./editor").Editor,a=e("./edit_session").EditSession,l=e("./undomanager").UndoManager,c=e("./virtual_renderer").VirtualRenderer;e("./worker/worker_client"),e("./keyboard/hash_handler"),e("./placeholder"),e("./multi_select"),e("./mode/folding/fold_mode"),e("./theme/textmate"),e("./ext/error_marker"),t.config=e("./config"),t.acequire=e,t.define=i(53),t.edit=function(e){if("string"==typeof e){var i=e;if(!(e=document.getElementById(i)))throw new Error("ace.edit can't find div #"+i)}if(e&&e.env&&e.env.editor instanceof s)return e.env.editor;var n="";if(e&&/input|textarea/i.test(e.tagName)){var a=e;n=a.value,e=r.createElement("pre"),a.parentNode.replaceChild(e,a)}else e&&(n=r.getInnerText(e),e.innerHTML="");var l=t.createEditSession(n),h=new s(new c(e));h.setSession(l);var d={document:l,editor:h,onResize:h.resize.bind(h,null)};return a&&(d.textarea=a),o.addListener(window,"resize",d.onResize),h.on("destroy",function(){o.removeListener(window,"resize",d.onResize),d.editor.container.env=null}),h.container.env=h.env=d,h},t.createEditSession=function(e,t){var i=new a(e,t);return i.setUndoManager(new l),i},t.EditSession=a,t.UndoManager=l,t.version="1.2.9"}),function(){ace.acequire(["ace/ace"],function(e){e&&(e.config.init(!0),e.define=ace.define),window.ace||(window.ace=e);for(var t in e)e.hasOwnProperty(t)&&(window.ace[t]=e[t])})}(),e.exports=window.ace.acequire("ace/ace")},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t,i){ace.define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,i){"use strict";var n=e("../lib/oop"),r=e("./text_highlight_rules").TextHighlightRules,o=function(){this.$rules={start:[{token:"variable",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'},{token:"string",regex:'"',next:"string"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"text",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"comment",regex:"\\/\\/.*$"},{token:"comment.start",regex:"\\/\\*",next:"comment"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],string:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],comment:[{token:"comment.end",regex:"\\*\\/",next:"start"},{defaultToken:"comment"}]}};n.inherits(o,r),t.JsonHighlightRules=o}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,i){"use strict";var n=e("../range").Range,r=function(){};(function(){this.checkOutdent=function(e,t){return!!/^\s+$/.test(e)&&/^\s*\}/.test(t)},this.autoOutdent=function(e,t){var i=e.getLine(t),r=i.match(/^(\s*\})/);if(!r)return 0;var o=r[1].length,s=e.findMatchingBracket({row:t,column:o});if(!s||s.row==t)return 0;var a=this.$getIndent(e.getLine(s.row));e.replace(new n(t,0,t,o-1),a)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(r.prototype),t.MatchingBraceOutdent=r}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,i){"use strict";var n=e("../../lib/oop"),r=e("../../range").Range,o=e("./fold_mode").FoldMode,s=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};n.inherits(s,o),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,i){var n=e.getLine(i);if(this.singleLineBlockCommentRe.test(n)&&!this.startRegionRe.test(n)&&!this.tripleStarBlockCommentRe.test(n))return"";var r=this._getFoldWidgetBase(e,t,i);return!r&&this.startRegionRe.test(n)?"start":r},this.getFoldWidgetRange=function(e,t,i,n){var r=e.getLine(i);if(this.startRegionRe.test(r))return this.getCommentRegionBlock(e,r,i);var o=r.match(this.foldingStartMarker);if(o){var s=o.index;if(o[1])return this.openingBracketBlock(e,o[1],i,s);var a=e.getCommentFoldRange(i,s+o[0].length,1);return a&&!a.isMultiLine()&&(n?a=this.getSectionRange(e,i):"all"!=t&&(a=null)),a}if("markbegin"!==t){var o=r.match(this.foldingStopMarker);if(o){var s=o.index+o[0].length;return o[1]?this.closingBracketBlock(e,o[1],i,s):e.getCommentFoldRange(i,s,-1)}}},this.getSectionRange=function(e,t){var i=e.getLine(t),n=i.search(/\S/),o=t,s=i.length;t+=1;for(var a=t,l=e.getLength();++tc)break;var h=this.getFoldWidgetRange(e,"all",t);if(h){if(h.start.row<=o)break;if(h.isMultiLine())t=h.end.row;else if(n==c)break}a=t}}return new r(o,s,a,e.getLine(a).length)},this.getCommentRegionBlock=function(e,t,i){for(var n=t.search(/\s*$/),o=e.getLength(),s=i,a=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,l=1;++is)return new r(s,n,h,t.length)}}.call(s.prototype)}),ace.define("ace/mode/json",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle","ace/worker/worker_client"],function(e,t,n){"use strict";var r=e("../lib/oop"),o=e("./text").Mode,s=e("./json_highlight_rules").JsonHighlightRules,a=e("./matching_brace_outdent").MatchingBraceOutdent,l=e("./behaviour/cstyle").CstyleBehaviour,c=e("./folding/cstyle").FoldMode,h=e("../worker/worker_client").WorkerClient,d=function(){this.HighlightRules=s,this.$outdent=new a,this.$behaviour=new l,this.foldingRules=new c};r.inherits(d,o),function(){this.getNextLineIndent=function(e,t,i){var n=this.$getIndent(t);if("start"==e){t.match(/^.*[\{\(\[]\s*$/)&&(n+=i)}return n},this.checkOutdent=function(e,t,i){return this.$outdent.checkOutdent(t,i)},this.autoOutdent=function(e,t,i){this.$outdent.autoOutdent(t,i)},this.createWorker=function(e){var t=new h(["ace"],i(55),"JsonWorker");return t.attachToDocument(e.getDocument()),t.on("annotate",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/json"}.call(d.prototype),t.Mode=d})},function(e,t){e.exports.id="ace/mode/json_worker", -e.exports.src='"no use strict";!function(window){function resolveModuleId(id,paths){for(var testPath=id,tail="";testPath;){var alias=paths[testPath];if("string"==typeof alias)return alias+tail;if(alias)return alias.location.replace(/\\/*$/,"/")+(tail||alias.main||alias.name);if(alias===!1)return"";var i=testPath.lastIndexOf("/");if(-1===i)break;tail=testPath.substr(i)+tail,testPath=testPath.slice(0,i)}return id}if(!(void 0!==window.window&&window.document||window.acequire&&window.define)){window.console||(window.console=function(){var msgs=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:msgs})},window.console.error=window.console.warn=window.console.log=window.console.trace=window.console),window.window=window,window.ace=window,window.onerror=function(message,file,line,col,err){postMessage({type:"error",data:{message:message,data:err.data,file:file,line:line,col:col,stack:err.stack}})},window.normalizeModule=function(parentId,moduleName){if(-1!==moduleName.indexOf("!")){var chunks=moduleName.split("!");return window.normalizeModule(parentId,chunks[0])+"!"+window.normalizeModule(parentId,chunks[1])}if("."==moduleName.charAt(0)){var base=parentId.split("/").slice(0,-1).join("/");for(moduleName=(base?base+"/":"")+moduleName;-1!==moduleName.indexOf(".")&&previous!=moduleName;){var previous=moduleName;moduleName=moduleName.replace(/^\\.\\//,"").replace(/\\/\\.\\//,"/").replace(/[^\\/]+\\/\\.\\.\\//,"")}}return moduleName},window.acequire=function acequire(parentId,id){if(id||(id=parentId,parentId=null),!id.charAt)throw Error("worker.js acequire() accepts only (parentId, id) as arguments");id=window.normalizeModule(parentId,id);var module=window.acequire.modules[id];if(module)return module.initialized||(module.initialized=!0,module.exports=module.factory().exports),module.exports;if(!window.acequire.tlns)return console.log("unable to load "+id);var path=resolveModuleId(id,window.acequire.tlns);return".js"!=path.slice(-3)&&(path+=".js"),window.acequire.id=id,window.acequire.modules[id]={},importScripts(path),window.acequire(parentId,id)},window.acequire.modules={},window.acequire.tlns={},window.define=function(id,deps,factory){if(2==arguments.length?(factory=deps,"string"!=typeof id&&(deps=id,id=window.acequire.id)):1==arguments.length&&(factory=id,deps=[],id=window.acequire.id),"function"!=typeof factory)return window.acequire.modules[id]={exports:factory,initialized:!0},void 0;deps.length||(deps=["require","exports","module"]);var req=function(childId){return window.acequire(id,childId)};window.acequire.modules[id]={exports:{},factory:function(){var module=this,returnExports=factory.apply(this,deps.map(function(dep){switch(dep){case"require":return req;case"exports":return module.exports;case"module":return module;default:return req(dep)}}));return returnExports&&(module.exports=returnExports),module}}},window.define.amd={},acequire.tlns={},window.initBaseUrls=function(topLevelNamespaces){for(var i in topLevelNamespaces)acequire.tlns[i]=topLevelNamespaces[i]},window.initSender=function(){var EventEmitter=window.acequire("ace/lib/event_emitter").EventEmitter,oop=window.acequire("ace/lib/oop"),Sender=function(){};return function(){oop.implement(this,EventEmitter),this.callback=function(data,callbackId){postMessage({type:"call",id:callbackId,data:data})},this.emit=function(name,data){postMessage({type:"event",name:name,data:data})}}.call(Sender.prototype),new Sender};var main=window.main=null,sender=window.sender=null;window.onmessage=function(e){var msg=e.data;if(msg.event&&sender)sender._signal(msg.event,msg.data);else if(msg.command)if(main[msg.command])main[msg.command].apply(main,msg.args);else{if(!window[msg.command])throw Error("Unknown command:"+msg.command);window[msg.command].apply(window,msg.args)}else if(msg.init){window.initBaseUrls(msg.tlns),acequire("ace/lib/es5-shim"),sender=window.sender=window.initSender();var clazz=acequire(msg.module)[msg.classname];main=window.main=new clazz(sender)}}}}(this),ace.define("ace/lib/oop",["require","exports","module"],function(acequire,exports){"use strict";exports.inherits=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},exports.mixin=function(obj,mixin){for(var key in mixin)obj[key]=mixin[key];return obj},exports.implement=function(proto,mixin){exports.mixin(proto,mixin)}}),ace.define("ace/range",["require","exports","module"],function(acequire,exports){"use strict";var comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},Range=function(startRow,startColumn,endRow,endColumn){this.start={row:startRow,column:startColumn},this.end={row:endRow,column:endColumn}};(function(){this.isEqual=function(range){return this.start.row===range.start.row&&this.end.row===range.end.row&&this.start.column===range.start.column&&this.end.column===range.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(row,column){return 0==this.compare(row,column)},this.compareRange=function(range){var cmp,end=range.end,start=range.start;return cmp=this.compare(end.row,end.column),1==cmp?(cmp=this.compare(start.row,start.column),1==cmp?2:0==cmp?1:0):-1==cmp?-2:(cmp=this.compare(start.row,start.column),-1==cmp?-1:1==cmp?42:0)},this.comparePoint=function(p){return this.compare(p.row,p.column)},this.containsRange=function(range){return 0==this.comparePoint(range.start)&&0==this.comparePoint(range.end)},this.intersects=function(range){var cmp=this.compareRange(range);return-1==cmp||0==cmp||1==cmp},this.isEnd=function(row,column){return this.end.row==row&&this.end.column==column},this.isStart=function(row,column){return this.start.row==row&&this.start.column==column},this.setStart=function(row,column){"object"==typeof row?(this.start.column=row.column,this.start.row=row.row):(this.start.row=row,this.start.column=column)},this.setEnd=function(row,column){"object"==typeof row?(this.end.column=row.column,this.end.row=row.row):(this.end.row=row,this.end.column=column)},this.inside=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)||this.isStart(row,column)?!1:!0:!1},this.insideStart=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)?!1:!0:!1},this.insideEnd=function(row,column){return 0==this.compare(row,column)?this.isStart(row,column)?!1:!0:!1},this.compare=function(row,column){return this.isMultiLine()||row!==this.start.row?this.start.row>row?-1:row>this.end.row?1:this.start.row===row?column>=this.start.column?0:-1:this.end.row===row?this.end.column>=column?0:1:0:this.start.column>column?-1:column>this.end.column?1:0},this.compareStart=function(row,column){return this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.compareEnd=function(row,column){return this.end.row==row&&this.end.column==column?1:this.compare(row,column)},this.compareInside=function(row,column){return this.end.row==row&&this.end.column==column?1:this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.clipRows=function(firstRow,lastRow){if(this.end.row>lastRow)var end={row:lastRow+1,column:0};else if(firstRow>this.end.row)var end={row:firstRow,column:0};if(this.start.row>lastRow)var start={row:lastRow+1,column:0};else if(firstRow>this.start.row)var start={row:firstRow,column:0};return Range.fromPoints(start||this.start,end||this.end)},this.extend=function(row,column){var cmp=this.compare(row,column);if(0==cmp)return this;if(-1==cmp)var start={row:row,column:column};else var end={row:row,column:column};return Range.fromPoints(start||this.start,end||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return Range.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new Range(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new Range(this.start.row,0,this.end.row,0)},this.toScreenRange=function(session){var screenPosStart=session.documentToScreenPosition(this.start),screenPosEnd=session.documentToScreenPosition(this.end);return new Range(screenPosStart.row,screenPosStart.column,screenPosEnd.row,screenPosEnd.column)},this.moveBy=function(row,column){this.start.row+=row,this.start.column+=column,this.end.row+=row,this.end.column+=column}}).call(Range.prototype),Range.fromPoints=function(start,end){return new Range(start.row,start.column,end.row,end.column)},Range.comparePoints=comparePoints,Range.comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},exports.Range=Range}),ace.define("ace/apply_delta",["require","exports","module"],function(acequire,exports){"use strict";exports.applyDelta=function(docLines,delta){var row=delta.start.row,startColumn=delta.start.column,line=docLines[row]||"";switch(delta.action){case"insert":var lines=delta.lines;if(1===lines.length)docLines[row]=line.substring(0,startColumn)+delta.lines[0]+line.substring(startColumn);else{var args=[row,1].concat(delta.lines);docLines.splice.apply(docLines,args),docLines[row]=line.substring(0,startColumn)+docLines[row],docLines[row+delta.lines.length-1]+=line.substring(startColumn)}break;case"remove":var endColumn=delta.end.column,endRow=delta.end.row;row===endRow?docLines[row]=line.substring(0,startColumn)+line.substring(endColumn):docLines.splice(row,endRow-row+1,line.substring(0,startColumn)+docLines[endRow].substring(endColumn))}}}),ace.define("ace/lib/event_emitter",["require","exports","module"],function(acequire,exports){"use strict";var EventEmitter={},stopPropagation=function(){this.propagationStopped=!0},preventDefault=function(){this.defaultPrevented=!0};EventEmitter._emit=EventEmitter._dispatchEvent=function(eventName,e){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var listeners=this._eventRegistry[eventName]||[],defaultHandler=this._defaultHandlers[eventName];if(listeners.length||defaultHandler){"object"==typeof e&&e||(e={}),e.type||(e.type=eventName),e.stopPropagation||(e.stopPropagation=stopPropagation),e.preventDefault||(e.preventDefault=preventDefault),listeners=listeners.slice();for(var i=0;listeners.length>i&&(listeners[i](e,this),!e.propagationStopped);i++);return defaultHandler&&!e.defaultPrevented?defaultHandler(e,this):void 0}},EventEmitter._signal=function(eventName,e){var listeners=(this._eventRegistry||{})[eventName];if(listeners){listeners=listeners.slice();for(var i=0;listeners.length>i;i++)listeners[i](e,this)}},EventEmitter.once=function(eventName,callback){var _self=this;callback&&this.addEventListener(eventName,function newCallback(){_self.removeEventListener(eventName,newCallback),callback.apply(null,arguments)})},EventEmitter.setDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers||(handlers=this._defaultHandlers={_disabled_:{}}),handlers[eventName]){var old=handlers[eventName],disabled=handlers._disabled_[eventName];disabled||(handlers._disabled_[eventName]=disabled=[]),disabled.push(old);var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}handlers[eventName]=callback},EventEmitter.removeDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers){var disabled=handlers._disabled_[eventName];if(handlers[eventName]==callback)handlers[eventName],disabled&&this.setDefaultHandler(eventName,disabled.pop());else if(disabled){var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}}},EventEmitter.on=EventEmitter.addEventListener=function(eventName,callback,capturing){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];return listeners||(listeners=this._eventRegistry[eventName]=[]),-1==listeners.indexOf(callback)&&listeners[capturing?"unshift":"push"](callback),callback},EventEmitter.off=EventEmitter.removeListener=EventEmitter.removeEventListener=function(eventName,callback){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];if(listeners){var index=listeners.indexOf(callback);-1!==index&&listeners.splice(index,1)}},EventEmitter.removeAllListeners=function(eventName){this._eventRegistry&&(this._eventRegistry[eventName]=[])},exports.EventEmitter=EventEmitter}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(acequire,exports){"use strict";var oop=acequire("./lib/oop"),EventEmitter=acequire("./lib/event_emitter").EventEmitter,Anchor=exports.Anchor=function(doc,row,column){this.$onChange=this.onChange.bind(this),this.attach(doc),column===void 0?this.setPosition(row.row,row.column):this.setPosition(row,column)};(function(){function $pointsInOrder(point1,point2,equalPointsInOrder){var bColIsAfter=equalPointsInOrder?point1.column<=point2.column:point1.columnthis.row)){var point=$getTransformedPoint(delta,{row:this.row,column:this.column},this.$insertRight);this.setPosition(point.row,point.column,!0)}},this.setPosition=function(row,column,noClip){var pos;if(pos=noClip?{row:row,column:column}:this.$clipPositionToDocument(row,column),this.row!=pos.row||this.column!=pos.column){var old={row:this.row,column:this.column};this.row=pos.row,this.column=pos.column,this._signal("change",{old:old,value:pos})}},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(doc){this.document=doc||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(row,column){var pos={};return row>=this.document.getLength()?(pos.row=Math.max(0,this.document.getLength()-1),pos.column=this.document.getLine(pos.row).length):0>row?(pos.row=0,pos.column=0):(pos.row=row,pos.column=Math.min(this.document.getLine(pos.row).length,Math.max(0,column))),0>column&&(pos.column=0),pos}}).call(Anchor.prototype)}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(acequire,exports){"use strict";var oop=acequire("./lib/oop"),applyDelta=acequire("./apply_delta").applyDelta,EventEmitter=acequire("./lib/event_emitter").EventEmitter,Range=acequire("./range").Range,Anchor=acequire("./anchor").Anchor,Document=function(textOrLines){this.$lines=[""],0===textOrLines.length?this.$lines=[""]:Array.isArray(textOrLines)?this.insertMergedLines({row:0,column:0},textOrLines):this.insert({row:0,column:0},textOrLines)};(function(){oop.implement(this,EventEmitter),this.setValue=function(text){var len=this.getLength()-1;this.remove(new Range(0,0,len,this.getLine(len).length)),this.insert({row:0,column:0},text)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(row,column){return new Anchor(this,row,column)},this.$split=0==="aaa".split(/a/).length?function(text){return text.replace(/\\r\\n|\\r/g,"\\n").split("\\n")}:function(text){return text.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(text){var match=text.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=match?match[1]:"\\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\\r\\n";case"unix":return"\\n";default:return this.$autoNewLine||"\\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(newLineMode){this.$newLineMode!==newLineMode&&(this.$newLineMode=newLineMode,this._signal("changeNewLineMode"))},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(text){return"\\r\\n"==text||"\\r"==text||"\\n"==text},this.getLine=function(row){return this.$lines[row]||""},this.getLines=function(firstRow,lastRow){return this.$lines.slice(firstRow,lastRow+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(range){return this.getLinesForRange(range).join(this.getNewLineCharacter())},this.getLinesForRange=function(range){var lines;if(range.start.row===range.end.row)lines=[this.getLine(range.start.row).substring(range.start.column,range.end.column)];else{lines=this.getLines(range.start.row,range.end.row),lines[0]=(lines[0]||"").substring(range.start.column);var l=lines.length-1;range.end.row-range.start.row==l&&(lines[l]=lines[l].substring(0,range.end.column))}return lines},this.insertLines=function(row,lines){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(row,lines)},this.removeLines=function(firstRow,lastRow){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(firstRow,lastRow)},this.insertNewLine=function(position){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, [\'\', \'\']) instead."),this.insertMergedLines(position,["",""])},this.insert=function(position,text){return 1>=this.getLength()&&this.$detectNewLine(text),this.insertMergedLines(position,this.$split(text))},this.insertInLine=function(position,text){var start=this.clippedPos(position.row,position.column),end=this.pos(position.row,position.column+text.length);return this.applyDelta({start:start,end:end,action:"insert",lines:[text]},!0),this.clonePos(end)},this.clippedPos=function(row,column){var length=this.getLength();void 0===row?row=length:0>row?row=0:row>=length&&(row=length-1,column=void 0);var line=this.getLine(row);return void 0==column&&(column=line.length),column=Math.min(Math.max(column,0),line.length),{row:row,column:column}},this.clonePos=function(pos){return{row:pos.row,column:pos.column}},this.pos=function(row,column){return{row:row,column:column}},this.$clipPosition=function(position){var length=this.getLength();return position.row>=length?(position.row=Math.max(0,length-1),position.column=this.getLine(length-1).length):(position.row=Math.max(0,position.row),position.column=Math.min(Math.max(position.column,0),this.getLine(position.row).length)),position},this.insertFullLines=function(row,lines){row=Math.min(Math.max(row,0),this.getLength());var column=0;this.getLength()>row?(lines=lines.concat([""]),column=0):(lines=[""].concat(lines),row--,column=this.$lines[row].length),this.insertMergedLines({row:row,column:column},lines)},this.insertMergedLines=function(position,lines){var start=this.clippedPos(position.row,position.column),end={row:start.row+lines.length-1,column:(1==lines.length?start.column:0)+lines[lines.length-1].length};return this.applyDelta({start:start,end:end,action:"insert",lines:lines}),this.clonePos(end)},this.remove=function(range){var start=this.clippedPos(range.start.row,range.start.column),end=this.clippedPos(range.end.row,range.end.column);return this.applyDelta({start:start,end:end,action:"remove",lines:this.getLinesForRange({start:start,end:end})}),this.clonePos(start)},this.removeInLine=function(row,startColumn,endColumn){var start=this.clippedPos(row,startColumn),end=this.clippedPos(row,endColumn);return this.applyDelta({start:start,end:end,action:"remove",lines:this.getLinesForRange({start:start,end:end})},!0),this.clonePos(start)},this.removeFullLines=function(firstRow,lastRow){firstRow=Math.min(Math.max(0,firstRow),this.getLength()-1),lastRow=Math.min(Math.max(0,lastRow),this.getLength()-1);var deleteFirstNewLine=lastRow==this.getLength()-1&&firstRow>0,deleteLastNewLine=this.getLength()-1>lastRow,startRow=deleteFirstNewLine?firstRow-1:firstRow,startCol=deleteFirstNewLine?this.getLine(startRow).length:0,endRow=deleteLastNewLine?lastRow+1:lastRow,endCol=deleteLastNewLine?0:this.getLine(endRow).length,range=new Range(startRow,startCol,endRow,endCol),deletedLines=this.$lines.slice(firstRow,lastRow+1);return this.applyDelta({start:range.start,end:range.end,action:"remove",lines:this.getLinesForRange(range)}),deletedLines},this.removeNewLine=function(row){this.getLength()-1>row&&row>=0&&this.applyDelta({start:this.pos(row,this.getLine(row).length),end:this.pos(row+1,0),action:"remove",lines:["",""]})},this.replace=function(range,text){if(range instanceof Range||(range=Range.fromPoints(range.start,range.end)),0===text.length&&range.isEmpty())return range.start;if(text==this.getTextRange(range))return range.end;this.remove(range);var end;return end=text?this.insert(range.start,text):range.start},this.applyDeltas=function(deltas){for(var i=0;deltas.length>i;i++)this.applyDelta(deltas[i])},this.revertDeltas=function(deltas){for(var i=deltas.length-1;i>=0;i--)this.revertDelta(deltas[i])},this.applyDelta=function(delta,doNotValidate){var isInsert="insert"==delta.action;(isInsert?1>=delta.lines.length&&!delta.lines[0]:!Range.comparePoints(delta.start,delta.end))||(isInsert&&delta.lines.length>2e4&&this.$splitAndapplyLargeDelta(delta,2e4),applyDelta(this.$lines,delta,doNotValidate),this._signal("change",delta))},this.$splitAndapplyLargeDelta=function(delta,MAX){for(var lines=delta.lines,l=lines.length,row=delta.start.row,column=delta.start.column,from=0,to=0;;){from=to,to+=MAX-1;var chunk=lines.slice(from,to);if(to>l){delta.lines=chunk,delta.start.row=row+from,delta.start.column=column;break}chunk.push(""),this.applyDelta({start:this.pos(row+from,column),end:this.pos(row+to,column=0),action:delta.action,lines:chunk},!0)}},this.revertDelta=function(delta){this.applyDelta({start:this.clonePos(delta.start),end:this.clonePos(delta.end),action:"insert"==delta.action?"remove":"insert",lines:delta.lines.slice()})},this.indexToPosition=function(index,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,i=startRow||0,l=lines.length;l>i;i++)if(index-=lines[i].length+newlineLength,0>index)return{row:i,column:index+lines[i].length+newlineLength};return{row:l-1,column:lines[l-1].length}},this.positionToIndex=function(pos,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,index=0,row=Math.min(pos.row,lines.length),i=startRow||0;row>i;++i)index+=lines[i].length+newlineLength;return index+pos.column}}).call(Document.prototype),exports.Document=Document}),ace.define("ace/lib/lang",["require","exports","module"],function(acequire,exports){"use strict";exports.last=function(a){return a[a.length-1]},exports.stringReverse=function(string){return string.split("").reverse().join("")},exports.stringRepeat=function(string,count){for(var result="";count>0;)1&count&&(result+=string),(count>>=1)&&(string+=string);return result};var trimBeginRegexp=/^\\s\\s*/,trimEndRegexp=/\\s\\s*$/;exports.stringTrimLeft=function(string){return string.replace(trimBeginRegexp,"")},exports.stringTrimRight=function(string){return string.replace(trimEndRegexp,"")},exports.copyObject=function(obj){var copy={};for(var key in obj)copy[key]=obj[key];return copy},exports.copyArray=function(array){for(var copy=[],i=0,l=array.length;l>i;i++)copy[i]=array[i]&&"object"==typeof array[i]?this.copyObject(array[i]):array[i];return copy},exports.deepCopy=function deepCopy(obj){if("object"!=typeof obj||!obj)return obj;var copy;if(Array.isArray(obj)){copy=[];for(var key=0;obj.length>key;key++)copy[key]=deepCopy(obj[key]);return copy}if("[object Object]"!==Object.prototype.toString.call(obj))return obj;copy={};for(var key in obj)copy[key]=deepCopy(obj[key]);return copy},exports.arrayToMap=function(arr){for(var map={},i=0;arr.length>i;i++)map[arr[i]]=1;return map},exports.createMap=function(props){var map=Object.create(null);for(var i in props)map[i]=props[i];return map},exports.arrayRemove=function(array,value){for(var i=0;array.length>=i;i++)value===array[i]&&array.splice(i,1)},exports.escapeRegExp=function(str){return str.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,"\\\\$1")},exports.escapeHTML=function(str){return str.replace(/&/g,"&").replace(/"/g,""").replace(/\'/g,"'").replace(/i;i+=2){if(Array.isArray(data[i+1]))var d={action:"insert",start:data[i],lines:data[i+1]};else var d={action:"remove",start:data[i],end:data[i+1]};doc.applyDelta(d,!0)}return _self.$timeout?deferredUpdate.schedule(_self.$timeout):(_self.onUpdate(),void 0)})};(function(){this.$timeout=500,this.setTimeout=function(timeout){this.$timeout=timeout},this.setValue=function(value){this.doc.setValue(value),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(callbackId){this.sender.callback(this.doc.getValue(),callbackId)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(Mirror.prototype)}),ace.define("ace/mode/json/json_parse",["require","exports","module"],function(){"use strict";var at,ch,text,value,escapee={\'"\':\'"\',"\\\\":"\\\\","/":"/",b:"\\b",f:"\\f",n:"\\n",r:"\\r",t:"\t"},error=function(m){throw{name:"SyntaxError",message:m,at:at,text:text}},next=function(c){return c&&c!==ch&&error("Expected \'"+c+"\' instead of \'"+ch+"\'"),ch=text.charAt(at),at+=1,ch},number=function(){var number,string="";for("-"===ch&&(string="-",next("-"));ch>="0"&&"9">=ch;)string+=ch,next();if("."===ch)for(string+=".";next()&&ch>="0"&&"9">=ch;)string+=ch;if("e"===ch||"E"===ch)for(string+=ch,next(),("-"===ch||"+"===ch)&&(string+=ch,next());ch>="0"&&"9">=ch;)string+=ch,next();return number=+string,isNaN(number)?(error("Bad number"),void 0):number},string=function(){var hex,i,uffff,string="";if(\'"\'===ch)for(;next();){if(\'"\'===ch)return next(),string;if("\\\\"===ch)if(next(),"u"===ch){for(uffff=0,i=0;4>i&&(hex=parseInt(next(),16),isFinite(hex));i+=1)uffff=16*uffff+hex;string+=String.fromCharCode(uffff)}else{if("string"!=typeof escapee[ch])break;string+=escapee[ch]}else string+=ch}error("Bad string")},white=function(){for(;ch&&" ">=ch;)next()},word=function(){switch(ch){case"t":return next("t"),next("r"),next("u"),next("e"),!0;case"f":return next("f"),next("a"),next("l"),next("s"),next("e"),!1;case"n":return next("n"),next("u"),next("l"),next("l"),null}error("Unexpected \'"+ch+"\'")},array=function(){var array=[];if("["===ch){if(next("["),white(),"]"===ch)return next("]"),array;for(;ch;){if(array.push(value()),white(),"]"===ch)return next("]"),array;next(","),white()}}error("Bad array")},object=function(){var key,object={};if("{"===ch){if(next("{"),white(),"}"===ch)return next("}"),object;for(;ch;){if(key=string(),white(),next(":"),Object.hasOwnProperty.call(object,key)&&error(\'Duplicate key "\'+key+\'"\'),object[key]=value(),white(),"}"===ch)return next("}"),object;next(","),white()}}error("Bad object")};return value=function(){switch(white(),ch){case"{":return object();case"[":return array();case\'"\':return string();case"-":return number();default:return ch>="0"&&"9">=ch?number():word()}},function(source,reviver){var result;return text=source,at=0,ch=" ",result=value(),white(),ch&&error("Syntax error"),"function"==typeof reviver?function walk(holder,key){var k,v,value=holder[key];if(value&&"object"==typeof value)for(k in value)Object.hasOwnProperty.call(value,k)&&(v=walk(value,k),void 0!==v?value[k]=v:delete value[k]);return reviver.call(holder,key,value)}({"":result},""):result}}),ace.define("ace/mode/json_worker",["require","exports","module","ace/lib/oop","ace/worker/mirror","ace/mode/json/json_parse"],function(acequire,exports){"use strict";var oop=acequire("../lib/oop"),Mirror=acequire("../worker/mirror").Mirror,parse=acequire("./json/json_parse"),JsonWorker=exports.JsonWorker=function(sender){Mirror.call(this,sender),this.setTimeout(200)};oop.inherits(JsonWorker,Mirror),function(){this.onUpdate=function(){var value=this.doc.getValue(),errors=[];try{value&&parse(value)}catch(e){var pos=this.doc.indexToPosition(e.at-1);errors.push({row:pos.row,column:pos.column,text:e.message,type:"error"})}this.sender.emit("annotate",errors)}}.call(JsonWorker.prototype)}),ace.define("ace/lib/es5-shim",["require","exports","module"],function(){function Empty(){}function doesDefinePropertyWork(object){try{return Object.defineProperty(object,"sentinel",{}),"sentinel"in object}catch(exception){}}function toInteger(n){return n=+n,n!==n?n=0:0!==n&&n!==1/0&&n!==-(1/0)&&(n=(n>0||-1)*Math.floor(Math.abs(n))),n}Function.prototype.bind||(Function.prototype.bind=function(that){var target=this;if("function"!=typeof target)throw new TypeError("Function.prototype.bind called on incompatible "+target);var args=slice.call(arguments,1),bound=function(){if(this instanceof bound){var result=target.apply(this,args.concat(slice.call(arguments)));return Object(result)===result?result:this}return target.apply(that,args.concat(slice.call(arguments)))};return target.prototype&&(Empty.prototype=target.prototype,bound.prototype=new Empty,Empty.prototype=null),bound});var defineGetter,defineSetter,lookupGetter,lookupSetter,supportsAccessors,call=Function.prototype.call,prototypeOfArray=Array.prototype,prototypeOfObject=Object.prototype,slice=prototypeOfArray.slice,_toString=call.bind(prototypeOfObject.toString),owns=call.bind(prototypeOfObject.hasOwnProperty);if((supportsAccessors=owns(prototypeOfObject,"__defineGetter__"))&&(defineGetter=call.bind(prototypeOfObject.__defineGetter__),defineSetter=call.bind(prototypeOfObject.__defineSetter__),lookupGetter=call.bind(prototypeOfObject.__lookupGetter__),lookupSetter=call.bind(prototypeOfObject.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function makeArray(l){var a=Array(l+2);return a[0]=a[1]=0,a}var lengthBefore,array=[];return array.splice.apply(array,makeArray(20)),array.splice.apply(array,makeArray(26)),lengthBefore=array.length,array.splice(5,0,"XXX"),lengthBefore+1==array.length,lengthBefore+1==array.length?!0:void 0\n}()){var array_splice=Array.prototype.splice;Array.prototype.splice=function(start,deleteCount){return arguments.length?array_splice.apply(this,[void 0===start?0:start,void 0===deleteCount?this.length-start:deleteCount].concat(slice.call(arguments,2))):[]}}else Array.prototype.splice=function(pos,removeCount){var length=this.length;pos>0?pos>length&&(pos=length):void 0==pos?pos=0:0>pos&&(pos=Math.max(length+pos,0)),length>pos+removeCount||(removeCount=length-pos);var removed=this.slice(pos,pos+removeCount),insert=slice.call(arguments,2),add=insert.length;if(pos===length)add&&this.push.apply(this,insert);else{var remove=Math.min(removeCount,length-pos),tailOldPos=pos+remove,tailNewPos=tailOldPos+add-remove,tailCount=length-tailOldPos,lengthAfterRemove=length-remove;if(tailOldPos>tailNewPos)for(var i=0;tailCount>i;++i)this[tailNewPos+i]=this[tailOldPos+i];else if(tailNewPos>tailOldPos)for(i=tailCount;i--;)this[tailNewPos+i]=this[tailOldPos+i];if(add&&pos===lengthAfterRemove)this.length=lengthAfterRemove,this.push.apply(this,insert);else for(this.length=lengthAfterRemove+add,i=0;add>i;++i)this[pos+i]=insert[i]}return removed};Array.isArray||(Array.isArray=function(obj){return"[object Array]"==_toString(obj)});var boxedString=Object("a"),splitString="a"!=boxedString[0]||!(0 in boxedString);if(Array.prototype.forEach||(Array.prototype.forEach=function(fun){var object=toObject(this),self=splitString&&"[object String]"==_toString(this)?this.split(""):object,thisp=arguments[1],i=-1,length=self.length>>>0;if("[object Function]"!=_toString(fun))throw new TypeError;for(;length>++i;)i in self&&fun.call(thisp,self[i],i,object)}),Array.prototype.map||(Array.prototype.map=function(fun){var object=toObject(this),self=splitString&&"[object String]"==_toString(this)?this.split(""):object,length=self.length>>>0,result=Array(length),thisp=arguments[1];if("[object Function]"!=_toString(fun))throw new TypeError(fun+" is not a function");for(var i=0;length>i;i++)i in self&&(result[i]=fun.call(thisp,self[i],i,object));return result}),Array.prototype.filter||(Array.prototype.filter=function(fun){var value,object=toObject(this),self=splitString&&"[object String]"==_toString(this)?this.split(""):object,length=self.length>>>0,result=[],thisp=arguments[1];if("[object Function]"!=_toString(fun))throw new TypeError(fun+" is not a function");for(var i=0;length>i;i++)i in self&&(value=self[i],fun.call(thisp,value,i,object)&&result.push(value));return result}),Array.prototype.every||(Array.prototype.every=function(fun){var object=toObject(this),self=splitString&&"[object String]"==_toString(this)?this.split(""):object,length=self.length>>>0,thisp=arguments[1];if("[object Function]"!=_toString(fun))throw new TypeError(fun+" is not a function");for(var i=0;length>i;i++)if(i in self&&!fun.call(thisp,self[i],i,object))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(fun){var object=toObject(this),self=splitString&&"[object String]"==_toString(this)?this.split(""):object,length=self.length>>>0,thisp=arguments[1];if("[object Function]"!=_toString(fun))throw new TypeError(fun+" is not a function");for(var i=0;length>i;i++)if(i in self&&fun.call(thisp,self[i],i,object))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(fun){var object=toObject(this),self=splitString&&"[object String]"==_toString(this)?this.split(""):object,length=self.length>>>0;if("[object Function]"!=_toString(fun))throw new TypeError(fun+" is not a function");if(!length&&1==arguments.length)throw new TypeError("reduce of empty array with no initial value");var result,i=0;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i++];break}if(++i>=length)throw new TypeError("reduce of empty array with no initial value")}for(;length>i;i++)i in self&&(result=fun.call(void 0,result,self[i],i,object));return result}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(fun){var object=toObject(this),self=splitString&&"[object String]"==_toString(this)?this.split(""):object,length=self.length>>>0;if("[object Function]"!=_toString(fun))throw new TypeError(fun+" is not a function");if(!length&&1==arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var result,i=length-1;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i--];break}if(0>--i)throw new TypeError("reduceRight of empty array with no initial value")}do i in this&&(result=fun.call(void 0,result,self[i],i,object));while(i--);return result}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(sought){var self=splitString&&"[object String]"==_toString(this)?this.split(""):toObject(this),length=self.length>>>0;if(!length)return-1;var i=0;for(arguments.length>1&&(i=toInteger(arguments[1])),i=i>=0?i:Math.max(0,length+i);length>i;i++)if(i in self&&self[i]===sought)return i;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(sought){var self=splitString&&"[object String]"==_toString(this)?this.split(""):toObject(this),length=self.length>>>0;if(!length)return-1;var i=length-1;for(arguments.length>1&&(i=Math.min(i,toInteger(arguments[1]))),i=i>=0?i:length-Math.abs(i);i>=0;i--)if(i in self&&sought===self[i])return i;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(object){return object.__proto__||(object.constructor?object.constructor.prototype:prototypeOfObject)}),!Object.getOwnPropertyDescriptor){var ERR_NON_OBJECT="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(object,property){if("object"!=typeof object&&"function"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT+object);if(owns(object,property)){var descriptor,getter,setter;if(descriptor={enumerable:!0,configurable:!0},supportsAccessors){var prototype=object.__proto__;object.__proto__=prototypeOfObject;var getter=lookupGetter(object,property),setter=lookupSetter(object,property);if(object.__proto__=prototype,getter||setter)return getter&&(descriptor.get=getter),setter&&(descriptor.set=setter),descriptor}return descriptor.value=object[property],descriptor}}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(object){return Object.keys(object)}),!Object.create){var createEmpty;createEmpty=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var empty={};for(var i in empty)empty[i]=null;return empty.constructor=empty.hasOwnProperty=empty.propertyIsEnumerable=empty.isPrototypeOf=empty.toLocaleString=empty.toString=empty.valueOf=empty.__proto__=null,empty},Object.create=function(prototype,properties){var object;if(null===prototype)object=createEmpty();else{if("object"!=typeof prototype)throw new TypeError("typeof prototype["+typeof prototype+"] != \'object\'");var Type=function(){};Type.prototype=prototype,object=new Type,object.__proto__=prototype}return void 0!==properties&&Object.defineProperties(object,properties),object}}if(Object.defineProperty){var definePropertyWorksOnObject=doesDefinePropertyWork({}),definePropertyWorksOnDom="undefined"==typeof document||doesDefinePropertyWork(document.createElement("div"));if(!definePropertyWorksOnObject||!definePropertyWorksOnDom)var definePropertyFallback=Object.defineProperty}if(!Object.defineProperty||definePropertyFallback){var ERR_NON_OBJECT_DESCRIPTOR="Property description must be an object: ",ERR_NON_OBJECT_TARGET="Object.defineProperty called on non-object: ",ERR_ACCESSORS_NOT_SUPPORTED="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(object,property,descriptor){if("object"!=typeof object&&"function"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT_TARGET+object);if("object"!=typeof descriptor&&"function"!=typeof descriptor||null===descriptor)throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR+descriptor);if(definePropertyFallback)try{return definePropertyFallback.call(Object,object,property,descriptor)}catch(exception){}if(owns(descriptor,"value"))if(supportsAccessors&&(lookupGetter(object,property)||lookupSetter(object,property))){var prototype=object.__proto__;object.__proto__=prototypeOfObject,delete object[property],object[property]=descriptor.value,object.__proto__=prototype}else object[property]=descriptor.value;else{if(!supportsAccessors)throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);owns(descriptor,"get")&&defineGetter(object,property,descriptor.get),owns(descriptor,"set")&&defineSetter(object,property,descriptor.set)}return object}}Object.defineProperties||(Object.defineProperties=function(object,properties){for(var property in properties)owns(properties,property)&&Object.defineProperty(object,property,properties[property]);return object}),Object.seal||(Object.seal=function(object){return object}),Object.freeze||(Object.freeze=function(object){return object});try{Object.freeze(function(){})}catch(exception){Object.freeze=function(freezeObject){return function(object){return"function"==typeof object?object:freezeObject(object)}}(Object.freeze)}if(Object.preventExtensions||(Object.preventExtensions=function(object){return object}),Object.isSealed||(Object.isSealed=function(){return!1}),Object.isFrozen||(Object.isFrozen=function(){return!1}),Object.isExtensible||(Object.isExtensible=function(object){if(Object(object)===object)throw new TypeError;for(var name="";owns(object,name);)name+="?";object[name]=!0;var returnValue=owns(object,name);return delete object[name],returnValue}),!Object.keys){var hasDontEnumBug=!0,dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;for(var key in{toString:null})hasDontEnumBug=!1;Object.keys=function(object){if("object"!=typeof object&&"function"!=typeof object||null===object)throw new TypeError("Object.keys called on a non-object");var keys=[];for(var name in object)owns(object,name)&&keys.push(name);if(hasDontEnumBug)for(var i=0,ii=dontEnumsLength;ii>i;i++){var dontEnum=dontEnums[i];owns(object,dontEnum)&&keys.push(dontEnum)}return keys}}Date.now||(Date.now=function(){return(new Date).getTime()});var ws="\t\\n\v\\f\\r   ᠎              \\u2028\\u2029\ufeff";if(!String.prototype.trim||ws.trim()){ws="["+ws+"]";var trimBeginRegexp=RegExp("^"+ws+ws+"*"),trimEndRegexp=RegExp(ws+ws+"*$");String.prototype.trim=function(){return(this+"").replace(trimBeginRegexp,"").replace(trimEndRegexp,"")}}var toObject=function(o){if(null==o)throw new TypeError("can\'t convert "+o+" to object");return Object(o)}});'},function(e,t){ace.define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"],function(e,t,i){"use strict";var n=e("../lib/dom"),r=e("../lib/lang"),o=e("../lib/event"),s=e("../keyboard/hash_handler").HashHandler,a=e("../lib/keys");n.importCssString('\t.ace_search {\tbackground-color: #ddd;\tcolor: #666;\tborder: 1px solid #cbcbcb;\tborder-top: 0 none;\toverflow: hidden;\tmargin: 0;\tpadding: 4px 6px 0 4px;\tposition: absolute;\ttop: 0;\tz-index: 99;\twhite-space: normal;\t}\t.ace_search.left {\tborder-left: 0 none;\tborder-radius: 0px 0px 5px 0px;\tleft: 0;\t}\t.ace_search.right {\tborder-radius: 0px 0px 0px 5px;\tborder-right: 0 none;\tright: 0;\t}\t.ace_search_form, .ace_replace_form {\tmargin: 0 20px 4px 0;\toverflow: hidden;\tline-height: 1.9;\t}\t.ace_replace_form {\tmargin-right: 0;\t}\t.ace_search_form.ace_nomatch {\toutline: 1px solid red;\t}\t.ace_search_field {\tborder-radius: 3px 0 0 3px;\tbackground-color: white;\tcolor: black;\tborder: 1px solid #cbcbcb;\tborder-right: 0 none;\tbox-sizing: border-box!important;\toutline: 0;\tpadding: 0;\tfont-size: inherit;\tmargin: 0;\tline-height: inherit;\tpadding: 0 6px;\tmin-width: 17em;\tvertical-align: top;\t}\t.ace_searchbtn {\tborder: 1px solid #cbcbcb;\tline-height: inherit;\tdisplay: inline-block;\tpadding: 0 6px;\tbackground: #fff;\tborder-right: 0 none;\tborder-left: 1px solid #dcdcdc;\tcursor: pointer;\tmargin: 0;\tposition: relative;\tbox-sizing: content-box!important;\tcolor: #666;\t}\t.ace_searchbtn:last-child {\tborder-radius: 0 3px 3px 0;\tborder-right: 1px solid #cbcbcb;\t}\t.ace_searchbtn:disabled {\tbackground: none;\tcursor: default;\t}\t.ace_searchbtn:hover {\tbackground-color: #eef1f6;\t}\t.ace_searchbtn.prev, .ace_searchbtn.next {\tpadding: 0px 0.7em\t}\t.ace_searchbtn.prev:after, .ace_searchbtn.next:after {\tcontent: "";\tborder: solid 2px #888;\twidth: 0.5em;\theight: 0.5em;\tborder-width: 2px 0 0 2px;\tdisplay:inline-block;\ttransform: rotate(-45deg);\t}\t.ace_searchbtn.next:after {\tborder-width: 0 2px 2px 0 ;\t}\t.ace_searchbtn_close {\tbackground: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\tborder-radius: 50%;\tborder: 0 none;\tcolor: #656565;\tcursor: pointer;\tfont: 16px/16px Arial;\tpadding: 0;\theight: 14px;\twidth: 14px;\ttop: 9px;\tright: 7px;\tposition: absolute;\t}\t.ace_searchbtn_close:hover {\tbackground-color: #656565;\tbackground-position: 50% 100%;\tcolor: white;\t}\t.ace_button {\tmargin-left: 2px;\tcursor: pointer;\t-webkit-user-select: none;\t-moz-user-select: none;\t-o-user-select: none;\t-ms-user-select: none;\tuser-select: none;\toverflow: hidden;\topacity: 0.7;\tborder: 1px solid rgba(100,100,100,0.23);\tpadding: 1px;\tbox-sizing: border-box!important;\tcolor: black;\t}\t.ace_button:hover {\tbackground-color: #eee;\topacity:1;\t}\t.ace_button:active {\tbackground-color: #ddd;\t}\t.ace_button.checked {\tborder-color: #3399ff;\topacity:1;\t}\t.ace_search_options{\tmargin-bottom: 3px;\ttext-align: right;\t-webkit-user-select: none;\t-moz-user-select: none;\t-o-user-select: none;\t-ms-user-select: none;\tuser-select: none;\tclear: both;\t}\t.ace_search_counter {\tfloat: left;\tfont-family: arial;\tpadding: 0 8px;\t}',"ace_searchbox");var l=''.replace(/> +/g,">"),c=function(e,t,i){var r=n.createElement("div");r.innerHTML=l,this.element=r.firstChild,this.setSession=this.setSession.bind(this),this.$init(),this.setEditor(e)};(function(){this.setEditor=function(e){e.searchBox=this,e.renderer.scroller.appendChild(this.element),this.editor=e},this.setSession=function(e){this.searchRange=null,this.$syncOptions(!0)},this.$initElements=function(e){this.searchBox=e.querySelector(".ace_search_form"),this.replaceBox=e.querySelector(".ace_replace_form"),this.searchOption=e.querySelector("[action=searchInSelection]"),this.replaceOption=e.querySelector("[action=toggleReplace]"),this.regExpOption=e.querySelector("[action=toggleRegexpMode]"),this.caseSensitiveOption=e.querySelector("[action=toggleCaseSensitive]"),this.wholeWordOption=e.querySelector("[action=toggleWholeWords]"),this.searchInput=this.searchBox.querySelector(".ace_search_field"),this.replaceInput=this.replaceBox.querySelector(".ace_search_field"),this.searchCounter=e.querySelector(".ace_search_counter")},this.$init=function(){var e=this.element;this.$initElements(e);var t=this;o.addListener(e,"mousedown",function(e){setTimeout(function(){t.activeInput.focus()},0),o.stopPropagation(e)}),o.addListener(e,"click",function(e){var i=e.target||e.srcElement,n=i.getAttribute("action");n&&t[n]?t[n]():t.$searchBarKb.commands[n]&&t.$searchBarKb.commands[n].exec(t),o.stopPropagation(e)}),o.addCommandKeyListener(e,function(e,i,n){var r=a.keyCodeToString(n),s=t.$searchBarKb.findKeyCommand(i,r);s&&s.exec&&(s.exec(t),o.stopEvent(e))}),this.$onChange=r.delayedCall(function(){t.find(!1,!1)}),o.addListener(this.searchInput,"input",function(){t.$onChange.schedule(20)}),o.addListener(this.searchInput,"focus",function(){t.activeInput=t.searchInput,t.searchInput.value&&t.highlight()}),o.addListener(this.replaceInput,"focus",function(){t.activeInput=t.replaceInput,t.searchInput.value&&t.highlight()})},this.$closeSearchBarKb=new s([{bindKey:"Esc",name:"closeSearchBar",exec:function(e){e.searchBox.hide()}}]),this.$searchBarKb=new s,this.$searchBarKb.bindKeys({"Ctrl-f|Command-f":function(e){var t=e.isReplace=!e.isReplace;e.replaceBox.style.display=t?"":"none",e.replaceOption.checked=!1,e.$syncOptions(),e.searchInput.focus()},"Ctrl-H|Command-Option-F":function(e){e.replaceOption.checked=!0,e.$syncOptions(),e.replaceInput.focus()},"Ctrl-G|Command-G":function(e){e.findNext()},"Ctrl-Shift-G|Command-Shift-G":function(e){e.findPrev()},esc:function(e){setTimeout(function(){e.hide()})},Return:function(e){e.activeInput==e.replaceInput&&e.replace(),e.findNext()},"Shift-Return":function(e){e.activeInput==e.replaceInput&&e.replace(),e.findPrev()},"Alt-Return":function(e){e.activeInput==e.replaceInput&&e.replaceAll(),e.findAll()},Tab:function(e){(e.activeInput==e.replaceInput?e.searchInput:e.replaceInput).focus()}}),this.$searchBarKb.addCommands([{name:"toggleRegexpMode",bindKey:{win:"Alt-R|Alt-/",mac:"Ctrl-Alt-R|Ctrl-Alt-/"},exec:function(e){e.regExpOption.checked=!e.regExpOption.checked,e.$syncOptions()}},{name:"toggleCaseSensitive",bindKey:{win:"Alt-C|Alt-I",mac:"Ctrl-Alt-R|Ctrl-Alt-I"},exec:function(e){e.caseSensitiveOption.checked=!e.caseSensitiveOption.checked,e.$syncOptions()}},{name:"toggleWholeWords",bindKey:{win:"Alt-B|Alt-W",mac:"Ctrl-Alt-B|Ctrl-Alt-W"},exec:function(e){e.wholeWordOption.checked=!e.wholeWordOption.checked,e.$syncOptions()}},{name:"toggleReplace",exec:function(e){e.replaceOption.checked=!e.replaceOption.checked,e.$syncOptions()}},{name:"searchInSelection",exec:function(e){e.searchOption.checked=!e.searchRange,e.setSearchRange(e.searchOption.checked&&e.editor.getSelectionRange()),e.$syncOptions()}}]),this.setSearchRange=function(e){this.searchRange=e,e?this.searchRangeMarker=this.editor.session.addMarker(e,"ace_active-line"):this.searchRangeMarker&&(this.editor.session.removeMarker(this.searchRangeMarker),this.searchRangeMarker=null)},this.$syncOptions=function(e){n.setCssClass(this.replaceOption,"checked",this.searchRange),n.setCssClass(this.searchOption,"checked",this.searchOption.checked),this.replaceOption.textContent=this.replaceOption.checked?"-":"+",n.setCssClass(this.regExpOption,"checked",this.regExpOption.checked),n.setCssClass(this.wholeWordOption,"checked",this.wholeWordOption.checked),n.setCssClass(this.caseSensitiveOption,"checked",this.caseSensitiveOption.checked),this.replaceBox.style.display=this.replaceOption.checked?"":"none",this.find(!1,!1,e)},this.highlight=function(e){this.editor.session.highlight(e||this.editor.$search.$options.re),this.editor.renderer.updateBackMarkers()},this.find=function(e,t,i){var r=this.editor.find(this.searchInput.value,{skipCurrent:e,backwards:t,wrap:!0,regExp:this.regExpOption.checked,caseSensitive:this.caseSensitiveOption.checked,wholeWord:this.wholeWordOption.checked,preventScroll:i,range:this.searchRange}),o=!r&&this.searchInput.value;n.setCssClass(this.searchBox,"ace_nomatch",o),this.editor._emit("findSearchBox",{match:!o}),this.highlight(),this.updateCounter()},this.updateCounter=function(){var e=this.editor,t=e.$search.$options.re,i=0,n=0;if(t){var r=this.searchRange?e.session.getTextRange(this.searchRange):e.getValue(),o=e.session.doc.positionToIndex(e.selection.anchor);this.searchRange&&(o-=e.session.doc.positionToIndex(this.searchRange.start));for(var s,a=t.lastIndex=0;(s=t.exec(r))&&(i++,a=s.index,a<=o&&n++,!(i>999))&&(s[0]||(t.lastIndex=a+=1,!(a>=r.length))););}this.searchCounter.textContent=n+" of "+(i>999?"999+":i)},this.findNext=function(){this.find(!0,!1)},this.findPrev=function(){this.find(!0,!0)},this.findAll=function(){var e=this.editor.findAll(this.searchInput.value,{regExp:this.regExpOption.checked,caseSensitive:this.caseSensitiveOption.checked,wholeWord:this.wholeWordOption.checked}),t=!e&&this.searchInput.value;n.setCssClass(this.searchBox,"ace_nomatch",t),this.editor._emit("findSearchBox",{match:!t}),this.highlight(),this.hide()},this.replace=function(){this.editor.getReadOnly()||this.editor.replace(this.replaceInput.value)},this.replaceAndFindNext=function(){this.editor.getReadOnly()||(this.editor.replace(this.replaceInput.value),this.findNext())},this.replaceAll=function(){this.editor.getReadOnly()||this.editor.replaceAll(this.replaceInput.value)},this.hide=function(){this.active=!1,this.setSearchRange(null),this.editor.off("changeSession",this.setSession),this.element.style.display="none",this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb),this.editor.focus()},this.show=function(e,t){this.active=!0,this.editor.on("changeSession",this.setSession),this.element.style.display="",this.replaceOption.checked=t,e&&(this.searchInput.value=e),this.searchInput.focus(),this.searchInput.select(),this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb),this.$syncOptions(!0)},this.isFocused=function(){var e=document.activeElement;return e==this.searchInput||e==this.replaceInput}}).call(c.prototype),t.SearchBox=c,t.Search=function(e,t){(e.searchBox||new c(e)).show(e.session.getTextRange(),t)}}),function(){ace.acequire(["ace/ext/searchbox"],function(){})}()},function(e,t,i){var n;if(window.Picker)n=window.Picker;else try{n=i(58)}catch(e){}e.exports=n},function(e,t,i){!function(t,i){e.exports=i()}(0,function(){"use strict";function e(e){function t(e,t,i,n){function r(e,t,i){return Math.max(t,Math.min(e,i))}var o=e.clientX,s=e.clientY;if(t){var a=t.getBoundingClientRect();if(o-=a.left,s-=a.top,i&&(o-=i[0],s-=i[1]),n&&(o=r(o,0,a.width),s=r(s,0,a.height)),t!==p){(null!==E?E:"circle"===t.nodeName||"ellipse"===t.nodeName)&&(o-=a.width/2,s-=a.height/2)}}return b?[Math.round(o),Math.round(s)]:[o,s]}function i(e){e.preventDefault(),w||e.stopPropagation()}function n(e){var n=void 0;if(n=f?f instanceof Element?f.contains(e.target)?f:null:e.target.closest(f):{}){i(e);var r=f&&A?t(e,n):[0,0],o=t(e,p,r);x={target:n,mouseOffset:r,startPos:o,actuallyDragged:!1},g&&g(n,o)}}function r(e){if(x){i(e);var n=x.startPos,r=t(e,p,x.mouseOffset,!C);x.actuallyDragged=x.actuallyDragged||n[0]!==r[0]||n[1]!==r[1],m(x.target,r,n)}}function o(e,i){if(x){if(v||y){var n=!x.actuallyDragged,r=n?x.startPos:t(e,p,x.mouseOffset,!C);y&&n&&!i&&y(x.target,r),v&&v(x.target,r,x.startPos,i||n&&y)}x=null}}function s(e,t){o(d(e),t)}function a(e,t,i){e.addEventListener(t,i)}function l(e){return void 0!==e.buttons?1===e.buttons:1===e.which}function h(e,t){if(1!==e.touches.length)return void o(e,!0);t(d(e))}function d(e){var t=e.targetTouches[0];return t||(t=e.changedTouches[0]),t.preventDefault=e.preventDefault.bind(e),t.stopPropagation=e.stopPropagation.bind(e),t}var u=Element.prototype;u.matches||(u.matches=u.msMatchesSelector||u.webkitMatchesSelector),u.closest||(u.closest=function(e){var t=this;do{if(t.matches(e))return t;t="svg"===t.tagName?t.parentNode:t.parentElement}while(t);return null}),e=e||{};var p=e.container||document.documentElement,f=e.selector,m=e.callback||console.log,g=e.callbackDragStart,v=e.callbackDragEnd,y=e.callbackClick,w=e.propagateEvents,b=!1!==e.roundCoords,C=!1!==e.dragOutside,A=e.handleOffset||!1!==e.handleOffset,E=null;switch(A){case"center":E=!0;break;case"topleft":case"top-left":E=!1}var x=void 0;a(p,"mousedown",function(e){l(e)?n(e):o(e,!0)}),a(p,"touchstart",function(e){return h(e,n)}),a(c,"mousemove",function(e){x&&(l(e)?r(e):o(e))}),a(c,"touchmove",function(e){return h(e,r)}),a(p,"mouseup",function(e){x&&!l(e)&&o(e)}),a(p,"touchend",function(e){return s(e)}),a(p,"touchcancel",function(e){return s(e,!0)})}function t(e){var t=document.createElement("div");return t.innerHTML=e,t.firstElementChild}function i(e,t,i){e.addEventListener(t,i,!1)}var n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},r=function(){function e(e,t){for(var i=0;i.5?u/(2-a-l):u/(a+l),a){case i:c=(n-r)/u+(n1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e},d=r<.5?r*(1+n):r+n-r*n,u=2*r-d;a=h(u,d,i+1/3),l=h(u,d,i),c=h(u,d,i-1/3)}var p=[255*a,255*l,255*c].map(Math.round);return p[3]=s,p}}]),e}(),c=window -;return document.documentElement.firstElementChild.appendChild(document.createElement("style")).textContent=".picker_wrapper.no_alpha .picker_alpha,.picker_wrapper.no_editor .picker_editor{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:'';display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:'';display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6rem}.layout_default .picker_editor input{width:calc(100% + 2px);height:calc(100% + 2px)}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;cursor:default;font-family:sans-serif;pointer-events:auto}.picker_wrapper button,.picker_wrapper input{margin:-1px}.picker_selector{position:absolute;z-index:1;display:block;transform:translate(-50%, -50%);border:2px solid white;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255,255,255,0) 50%),linear-gradient(0deg, black, rgba(0,0,0,0) 50%),linear-gradient(90deg, gray, rgba(128,128,128,0))}.picker_alpha,.picker_sample{position:relative;background:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2'%3E%3Cpath d='M1,0H0V1H2V2H1' fill='lightgrey'/%3E%3C/svg%3E\") left top/contain white;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{box-sizing:border-box;font-family:monospace;padding:.1em .2em}.picker_sample::before{content:'';position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_done button{box-sizing:border-box;padding:.2em .5em;cursor:pointer}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,0.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:\"\";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;transform:skew(45deg);transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}",function(){function o(e){var t=this;n(this,o),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0},this._openProxy=function(e){return t.openHandler(e)},this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(e)}return r(o,[{key:"setOptions",value:function(e){if(e){var t=this.settings;e instanceof HTMLElement?t.parent=e:(t.parent&&e.parent&&t.parent!==e.parent&&(t.parent.removeEventListener("click",this._openProxy,!1),this._popupInited=!1),function(e,t,i){for(var n in e)i&&i.indexOf(n)>=0||(t[n]=e[n])}(e,t)),e.onChange&&(this.onChange=e.onChange),e.onDone&&(this.onDone=e.onDone),e.onOpen&&(this.onOpen=e.onOpen),e.onClose&&(this.onClose=e.onClose);var n=e.color||e.colour;n&&this._setColor(n),t.parent&&t.popup&&!this._popupInited?(i(t.parent,"click",this._openProxy),this._popupInited=!0):e.parent&&!t.popup&&this.show()}}},{key:"openHandler",value:function(e){this.show()&&(this.settings.parent.style.pointerEvents="none",this.onOpen&&this.onOpen(this.colour))}},{key:"closeHandler",value:function(e){var t=!1;e?"mousedown"===e.type?this.domElement.contains(e.target)||(t=!0):(e.preventDefault(),e.stopPropagation(),t=!0):t=!0,t&&this.hide()&&(this.settings.parent.style.pointerEvents="",this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(e,t){this.closeHandler(),this.setOptions(e),t&&this.openHandler()}},{key:"setColor",value:function(e,t){this._setColor(e,{silent:t})}},{key:"_setColor",value:function(e,t){var i=new l(e);if(!this.settings.alpha){var n=i.hsla;n[3]=1,i.hsla=n}this.colour=this.color=i,this._setHSLA(null,null,null,null,t)}},{key:"setColour",value:function(e,t){this.setColor(e,t)}},{key:"show",value:function(){if(!this.settings.parent)return!1;if(this.domElement){var e=this._toggleDOM(!0);return this._setPosition(),e}var i=this.settings.template||'
',n=t(i);return this.domElement=n,this._domH=n.querySelector(".picker_hue"),this._domSL=n.querySelector(".picker_sl"),this._domA=n.querySelector(".picker_alpha"),this._domEdit=n.querySelector(".picker_editor input"),this._domSample=n.querySelector(".picker_sample"),this._domOkay=n.querySelector(".picker_done button"),n.classList.add("layout_"+this.settings.layout),this.settings.alpha||n.classList.add("no_alpha"),this.settings.editor||n.classList.add("no_editor"),this._ifPopup(function(){return n.classList.add("popup")}),this._setPosition(),this.colour?this._updateUI():this._setColor("#0cf"),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"_bindEvents",value:function(){function t(e,t){function i(i,n){var r=n[0]/e.clientWidth,o=n[1]/e.clientHeight;t(r,o)}return{container:e,dragOutside:!1,callback:i,callbackClick:i,callbackDragStart:i,propagateEvents:!0}}var n=this,r=this;e(t(this._domH,function(e,t){return r._setHSLA(e)})),e(t(this._domSL,function(e,t){return r._setHSLA(null,e,1-t)})),this.settings.alpha&&e(t(this._domA,function(e,t){return r._setHSLA(null,null,null,1-t)})),this.settings.editor&&i(this._domEdit,"input",function(e){var t=this.value;try{new l(this.value),r._setColor(t,{fromEditor:!0})}catch(e){}}),i(window,"mousedown",function(e){return n._ifPopup(function(){return n.closeHandler(e)})}),i(this._domOkay,"click",function(e){n._ifPopup(function(){return n.closeHandler(e)}),n.onDone&&n.onDone(n.colour)})}},{key:"_setPosition",value:function(){var e=this.settings.parent,t=this.domElement;e!==t.parentNode&&e.appendChild(t),this._ifPopup(function(i){"static"===getComputedStyle(e).position&&(e.style.position="relative");var n=!0===i?"popup_right":"popup_"+i;["popup_top","popup_bottom","popup_left","popup_right"].forEach(function(e){e===n?t.classList.add(e):t.classList.remove(e)}),t.classList.add(n)})}},{key:"_setHSLA",value:function(e,t,i,n,r){r=r||{};var o=this.colour,s=o.hsla;[e,t,i,n].forEach(function(e,t){(e||0===e)&&(s[t]=e)}),o.hsla=s,this._updateUI(r),this.onChange&&!r.silent&&this.onChange(o)}},{key:"_updateUI",value:function(e){function t(e,t,i){t.style.left=100*i+"%"}function i(e,t,i){t.style.top=100*i+"%"}if(this.domElement){e=e||{};var n=this.colour,r=n.hsla,o="hsl("+360*r[0]+", 100%, 50%)",s=n.hslString,a=n.hslaString,l=this._domH,c=this._domSL,h=this._domA;t(l,l.firstElementChild,r[0]),this._domSL.style.backgroundColor=this._domH.style.color=o,t(c,c.firstElementChild,r[1]),i(c,c.firstElementChild,1-r[2]),c.style.color=s,i(h,h.firstElementChild,1-r[3]);var d=s,u=d.replace("hsl","hsla").replace(")",", 0)"),p="linear-gradient("+[d,u]+")";if(this._domA.style.backgroundImage=p+", url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2'%3E%3Cpath d='M1,0H0V1H2V2H1' fill='lightgrey'/%3E%3C/svg%3E\")",!e.fromEditor){var f=n.hex;this._domEdit.value=this.settings.alpha?f:f.substr(0,7)}this._domSample.style.color=a}}},{key:"_ifPopup",value:function(e,t){this.settings.parent&&this.settings.popup?e&&e(this.settings.popup):t&&t()}},{key:"_toggleDOM",value:function(e){var t=this.domElement;if(!t)return!1;var i=e?"":"none",n=t.style.display!==i;return n&&(t.style.display=i),n}}]),o}()})},function(e,t,i){"use strict";var n=i(57),r=i(60),o=i(61),s=i(62),a=i(63),l=i(70),c=i(71),h=i(80),d=i(65),u=i(81),p=i(76),f=i(78),m=i(69).translate,g=i(69).setLanguages,v=i(69).setLanguage,y=document.body,w={};w.create=function(e,t){if(!e)throw new Error("No container element provided.");this.container=e,this.dom={},this.highlighter=new r,this.selection=void 0,this.multiselection={nodes:[]},this.validateSchema=null,this.validationSequence=0,this.errorNodes=[],this.node=null,this.focusTarget=null,this._setOptions(t),t.autocomplete&&(this.autocomplete=new u(t.autocomplete)),this.options.history&&"view"!==this.options.mode&&(this.history=new o(this)),this._createFrame(),this._createTable()},w.destroy=function(){this.frame&&this.container&&this.frame.parentNode==this.container&&(this.container.removeChild(this.frame),this.frame=null),this.container=null,this.dom=null,this.clear(),this.node=null,this.focusTarget=null,this.selection=null,this.multiselection=null,this.errorNodes=null,this.validateSchema=null,this._debouncedValidate=null,this.history&&(this.history.destroy(),this.history=null),this.searchBox&&(this.searchBox.destroy(),this.searchBox=null),this.modeSwitcher&&(this.modeSwitcher.destroy(),this.modeSwitcher=null)},w._setOptions=function(e){if(this.options={search:!0,history:!0,mode:"tree",name:void 0,schema:null,schemaRefs:null,autocomplete:null,navigationBar:!0,mainMenuBar:!0,onSelectionChange:null,colorPicker:!0,onColorPicker:function(e,t,i){n?new n({parent:e,color:t,popup:"bottom",onDone:function(e){var t=e.rgba[3],n=1===t?e.hex.substr(0,7):e.hex;i(n)}}).show():console.warn("Cannot open color picker: the `vanilla-picker` library is not included in the bundle. Either use the full bundle or implement your own color picker using `onColorPicker`.")},timestampTag:!0,onEvent:null,enableSort:!0,enableTransform:!0},e)for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);this.setSchema(this.options.schema,this.options.schemaRefs),this._debouncedValidate=d.debounce(this.validate.bind(this),this.DEBOUNCE_INTERVAL),e.onSelectionChange&&this.onSelectionChange(e.onSelectionChange),g(this.options.languages),v(this.options.language)},w.set=function(e){if(e instanceof Function||void 0===e)this.clear();else{this.content.removeChild(this.table);var t={field:this.options.name,value:e},i=new c(this,t);this._setRoot(i),this.validate();this.node.expand(!1),this.content.appendChild(this.table)}this.history&&this.history.clear(),this.searchBox&&this.searchBox.clear()},w.update=function(e){if(!this.node.deepEqual(e)){var t=this.getSelection();if(this.onChangeDisabled=!0,this.node.update(e),this.onChangeDisabled=!1,this.validate(),this.searchBox&&!this.searchBox.isEmpty()&&this.searchBox.forceSearch(),t&&t.start&&t.end){var i=this.node.findNodeByPath(t.start.path),n=this.node.findNodeByPath(t.end.path);i&&n?this.setSelection(t.start,t.end):this.setSelection({},{})}else this.setSelection({},{})}},w.get=function(){if(this.focusTarget){var e=c.getNodeFromTarget(this.focusTarget);e&&e.blur()}return this.node?this.node.getValue():void 0},w.getText=function(){return JSON.stringify(this.get())},w.setText=function(e){try{this.set(d.parse(e))}catch(i){var t=d.sanitize(e);this.set(d.parse(t))}},w.updateText=function(e){try{this.update(d.parse(e))}catch(i){var t=d.sanitize(e);this.update(d.parse(t))}},w.setName=function(e){this.options.name=e,this.node&&this.node.updateField(this.options.name)},w.getName=function(){return this.options.name},w.focus=function(){var e=this.scrollableContent.querySelector("[contenteditable=true]");e?e.focus():this.node.dom.expand?this.node.dom.expand.focus():this.node.dom.menu?this.node.dom.menu.focus():(e=this.frame.querySelector("button"))&&e.focus()},w.clear=function(){this.node&&(this.node.hide(),delete this.node),this.treePath&&this.treePath.reset()},w._setRoot=function(e){this.clear(),this.node=e,this.tbody.appendChild(e.getDom())},w.search=function(e){var t;return this.node?(this.content.removeChild(this.table),t=this.node.search(e),this.content.appendChild(this.table)):t=[],t},w.expandAll=function(){this.node&&(this.content.removeChild(this.table),this.node.expand(),this.content.appendChild(this.table))},w.collapseAll=function(){this.node&&(this.content.removeChild(this.table),this.node.collapse(),this.content.appendChild(this.table))},w._onAction=function(e,t){this.history&&this.history.add(e,t),this._onChange()},w._onChange=function(){if(!this.onChangeDisabled){if(this.selection=this.getDomSelection(),this._debouncedValidate(),this.treePath){var e=this.selection?this.node.findNodeByInternalPath(this.selection.path):this.multiselection?this.multiselection.nodes[0]:void 0;e?this._updateTreePath(e.getNodePath()):this.treePath.reset()}if(this.options.onChange)try{this.options.onChange()}catch(e){console.error("Error in onChange callback: ",e)}if(this.options.onChangeJSON)try{this.options.onChangeJSON(this.get())}catch(e){console.error("Error in onChangeJSON callback: ",e)}if(this.options.onChangeText)try{this.options.onChangeText(this.getText())}catch(e){console.error("Error in onChangeText callback: ",e)}if(this.options.onClassName&&this.node.recursivelyUpdateCssClassesOnNodes(),this.options.onNodeName&&this.node.childs)try{this.node.recursivelyUpdateNodeName()}catch(e){console.error("Error in onNodeName callback: ",e)}}},w.validate=function(){var e=this.node;if(e){var t=e.getValue(),i=e.validate(),n=[];if(this.validateSchema){this.validateSchema(t)||(n=this.validateSchema.errors.map(function(e){return d.improveSchemaError(e)}).map(function(t){return{node:e.findNode(t.dataPath),error:t}}).filter(function(e){return null!=e.node}))}try{this.validationSequence++;var r=this,o=this.validationSequence;this._validateCustom(t).then(function(e){if(o===r.validationSequence){var t=[].concat(i,n,e||[]);r._renderValidationErrors(t)}}).catch(function(e){console.error(e)})}catch(e){console.error(e)}}},w._renderValidationErrors=function(e){this.errorNodes&&this.errorNodes.forEach(function(e){e.setError(null)});var t=e.reduce(function(e,t){return t.node.findParents().filter(function(t){return!e.some(function(e){return e[0]===t})}).map(function(e){return[e,t.node]}).concat(e)},[]);this.errorNodes=t.map(function(e){return{node:e[0],child:e[1],error:{message:"object"===e[0].type?"Contains invalid properties":"Contains invalid items"}}}).concat(e).map(function(e){return e.node.setError(e.error,e.child),e.node})},w._validateCustom=function(e){try{if(this.options.onValidate){var t=this.node,i=this.options.onValidate(e);return(d.isPromise(i)?i:Promise.resolve(i)).then(function(e){return Array.isArray(e)?e.filter(function(e){var t=d.isValidValidationError(e);return t||console.warn('Ignoring a custom validation error with invalid structure. Expected structure: {path: [...], message: "..."}. Actual error:',e),t}).map(function(e){var i;try{i=e&&e.path?t.findNodeByPath(e.path):null}catch(e){}return i||console.warn("Ignoring validation error: node not found. Path:",e.path,"Error:",e),{node:i,error:e}}).filter(function(e){return e&&e.node&&e.error&&e.error.message}):null})}}catch(e){return Promise.reject(e)}return Promise.resolve(null)},w.refresh=function(){this.node&&this.node.updateDom({recurse:!0})},w.startAutoScroll=function(e){var t=this,i=this.scrollableContent,n=d.getAbsoluteTop(i),r=i.clientHeight,o=n+r;e0?this.autoScrollStep=(n+24-e)/3:e>o-24&&r+i.scrollTop0?this.multiselection.nodes.map(function(e){return e.getInternalPath()}):null,scrollTop:this.scrollableContent?this.scrollableContent.scrollTop:0}},w.scrollTo=function(e,t){var i=this.scrollableContent;if(i){var n=this;n.animateTimeout&&(clearTimeout(n.animateTimeout),delete n.animateTimeout),n.animateCallback&&(n.animateCallback(!1),delete n.animateCallback);var r=i.clientHeight,o=i.scrollHeight-r,s=Math.min(Math.max(e-r/4,0),o),a=function(){var e=i.scrollTop,r=s-e;Math.abs(r)>3?(i.scrollTop+=r/3,n.animateCallback=t,n.animateTimeout=setTimeout(a,50)):(t&&t(!0),i.scrollTop=s,delete n.animateTimeout,delete n.animateCallback)};a()}else t&&t(!1)},w._createFrame=function(){function e(e){t._onEvent&&t._onEvent(e)}this.frame=document.createElement("div"),this.frame.className="jsoneditor jsoneditor-mode-"+this.options.mode,this.container.appendChild(this.frame),this.contentOuter=document.createElement("div"),this.contentOuter.className="jsoneditor-outer";var t=this;if(this.frame.onclick=function(t){var i=t.target;e(t),"BUTTON"==i.nodeName&&t.preventDefault()},this.frame.oninput=e,this.frame.onchange=e,this.frame.onkeydown=e,this.frame.onkeyup=e,this.frame.oncut=e,this.frame.onpaste=e,this.frame.onmousedown=e,this.frame.onmouseup=e,this.frame.onmouseover=e,this.frame.onmouseout=e,d.addEventListener(this.frame,"focus",e,!0),d.addEventListener(this.frame,"blur",e,!0),this.frame.onfocusin=e,this.frame.onfocusout=e,this.options.mainMenuBar){d.addClassName(this.contentOuter,"has-main-menu-bar"),this.menu=document.createElement("div"),this.menu.className="jsoneditor-menu",this.frame.appendChild(this.menu);var i=document.createElement("button");i.type="button",i.className="jsoneditor-expand-all",i.title=m("expandAll"),i.onclick=function(){t.expandAll()},this.menu.appendChild(i);var n=document.createElement("button");if(n.type="button",n.title=m("collapseAll"),n.className="jsoneditor-collapse-all",n.onclick=function(){t.collapseAll()},this.menu.appendChild(n),this.options.enableSort){var r=document.createElement("button");r.type="button",r.className="jsoneditor-sort",r.title=m("sortTitleShort"),r.onclick=function(){var e=t.options.modalAnchor||y;p(t.node,e)},this.menu.appendChild(r)}if(this.options.enableTransform){var o=document.createElement("button");o.type="button",o.title=m("transformTitleShort"),o.className="jsoneditor-transform",o.onclick=function(){var e=t.options.modalAnchor||y;f(t.node,e)},this.menu.appendChild(o)}if(this.history){var a=document.createElement("button");a.type="button",a.className="jsoneditor-undo jsoneditor-separator",a.title=m("undo"),a.onclick=function(){t._onUndo()},this.menu.appendChild(a),this.dom.undo=a;var c=document.createElement("button");c.type="button",c.className="jsoneditor-redo",c.title=m("redo"),c.onclick=function(){t._onRedo()},this.menu.appendChild(c),this.dom.redo=c,this.history.onChange=function(){a.disabled=!t.history.canUndo(),c.disabled=!t.history.canRedo()},this.history.onChange()}if(this.options&&this.options.modes&&this.options.modes.length){var u=this;this.modeSwitcher=new h(this.menu,this.options.modes,this.options.mode,function(e){u.setMode(e),u.modeSwitcher.focus()})}this.options.search&&(this.searchBox=new s(this,this.menu))}this.options.navigationBar&&(this.navBar=document.createElement("div"),this.navBar.className="jsoneditor-navigation-bar nav-bar-empty",this.frame.appendChild(this.navBar),this.treePath=new l(this.navBar,this.frame),this.treePath.onSectionSelected(this._onTreePathSectionSelected.bind(this)),this.treePath.onContextMenuItemSelected(this._onTreePathMenuItemSelected.bind(this)))},w._onUndo=function(){this.history&&(this.history.undo(),this._onChange())},w._onRedo=function(){this.history&&(this.history.redo(),this._onChange())},w._onEvent=function(e){if(!c.targetIsColorPicker(e.target)){"keydown"===e.type&&this._onKeyDown(e),"focus"===e.type&&(this.focusTarget=e.target),"mousedown"===e.type&&this._startDragDistance(e),"mousemove"!==e.type&&"mouseup"!==e.type&&"click"!==e.type||this._updateDragDistance(e);var t=c.getNodeFromTarget(e.target);if(t&&this.options&&this.options.navigationBar&&t&&("keydown"===e.type||"mousedown"===e.type)){var i=this;setTimeout(function(){i._updateTreePath(t.getNodePath())})}if(t&&t.selected){if("click"===e.type){if(e.target===t.dom.menu)return void this.showContextMenu(e.target);e.hasMoved||this.deselect()}"mousedown"===e.type&&c.onDragStart(this.multiselection.nodes,e)}else"mousedown"===e.type&&d.hasParentNode(e.target,this.content)&&(this.deselect(),t&&e.target===t.dom.drag?c.onDragStart(t,e):(!t||e.target!==t.dom.field&&e.target!==t.dom.value&&e.target!==t.dom.select)&&this._onMultiSelectStart(e));t&&t.onEvent(e)}},w._updateTreePath=function(e){function t(e){return e.parent?"array"===e.parent.type?e.index:e.field:e.type}if(e&&e.length){d.removeClassName(this.navBar,"nav-bar-empty");var i=[];e.forEach(function(e){var n={name:t(e),node:e,children:[]};e.childs&&e.childs.length&&e.childs.forEach(function(e){n.children.push({name:t(e),node:e})}),i.push(n)}),this.treePath.setPath(i)}else d.addClassName(this.navBar,"nav-bar-empty")},w._onTreePathSectionSelected=function(e){e&&e.node&&(e.node.expandTo(),e.node.focus())},w._onTreePathMenuItemSelected=function(e,t){if(e&&e.children.length){var i=e.children.find(function(e){return e.name===t});i&&i.node&&(this._updateTreePath(i.node.getNodePath()),i.node.expandTo(),i.node.focus())}},w._startDragDistance=function(e){this.dragDistanceEvent={initialTarget:e.target,initialPageX:e.pageX,initialPageY:e.pageY,dragDistance:0,hasMoved:!1}},w._updateDragDistance=function(e){this.dragDistanceEvent||this._startDragDistance(e);var t=e.pageX-this.dragDistanceEvent.initialPageX,i=e.pageY-this.dragDistanceEvent.initialPageY;return this.dragDistanceEvent.dragDistance=Math.sqrt(t*t+i*i),this.dragDistanceEvent.hasMoved=this.dragDistanceEvent.hasMoved||this.dragDistanceEvent.dragDistance>10,e.dragDistance=this.dragDistanceEvent.dragDistance,e.hasMoved=this.dragDistanceEvent.hasMoved,e.dragDistance},w._onMultiSelectStart=function(e){var t=c.getNodeFromTarget(e.target);if("tree"===this.options.mode&&void 0===this.options.onEditable){this.multiselection={start:t||null,end:null,nodes:[]},this._startDragDistance(e);var i=this;this.mousemove||(this.mousemove=d.addEventListener(window,"mousemove",function(e){i._onMultiSelect(e)})),this.mouseup||(this.mouseup=d.addEventListener(window,"mouseup",function(e){i._onMultiSelectEnd(e)})),e.preventDefault()}},w._onMultiSelect=function(e){if(e.preventDefault(),this._updateDragDistance(e),e.hasMoved){var t=c.getNodeFromTarget(e.target);t&&(null==this.multiselection.start&&(this.multiselection.start=t),this.multiselection.end=t),this.deselect();var i=this.multiselection.start,n=this.multiselection.end||this.multiselection.start;if(i&&n){if(this.multiselection.nodes=this._findTopLevelNodes(i,n),this.multiselection.nodes&&this.multiselection.nodes.length){var r=this.multiselection.nodes[0];this.multiselection.start===r||this.multiselection.start.isDescendantOf(r)?this.multiselection.direction="down":this.multiselection.direction="up"}this.select(this.multiselection.nodes)}}},w._onMultiSelectEnd=function(){this.multiselection.nodes[0]&&this.multiselection.nodes[0].dom.menu.focus(),this.multiselection.start=null,this.multiselection.end=null,this.mousemove&&(d.removeEventListener(window,"mousemove",this.mousemove),delete this.mousemove),this.mouseup&&(d.removeEventListener(window,"mouseup",this.mouseup),delete this.mouseup)},w.deselect=function(e){var t=!!this.multiselection.nodes.length;this.multiselection.nodes.forEach(function(e){e.setSelected(!1)}),this.multiselection.nodes=[],e&&(this.multiselection.start=null,this.multiselection.end=null),t&&this._selectionChangedHandler&&this._selectionChangedHandler()},w.select=function(e){if(!Array.isArray(e))return this.select([e]);if(e){this.deselect(),this.multiselection.nodes=e.slice(0);var t=e[0];if(e.forEach(function(e){e.expandPathToNode(),e.setSelected(!0,e===t)}),this._selectionChangedHandler){var i=this.getSelection();this._selectionChangedHandler(i.start,i.end)}}},w._findTopLevelNodes=function(e,t){for(var i=e.getNodePath(),n=t.getNodePath(),r=0;r=0&&(l="value"),e.target.className.indexOf("jsoneditor-field")>=0&&(l="field");var h=c.getNodeFromTarget(e.target);setTimeout(function(e,t){if(t.innerText.length>0){var i=this.options.autocomplete.getOptions(t.innerText,e.getPath(),l,e.editor);null===i?this.autocomplete.hideDropDown():"function"==typeof i.then?i.then(function(e){null===e?this.autocomplete.hideDropDown():e.options?this.autocomplete.show(t,e.startFrom,e.options):this.autocomplete.show(t,0,e)}.bind(this)):i.options?this.autocomplete.show(t,i.startFrom,i.options):this.autocomplete.show(t,0,i)}else this.autocomplete.hideDropDown()}.bind(this,h,e.target),50)}s&&(e.preventDefault(),e.stopPropagation())},w._createTable=function(){this.options.navigationBar&&d.addClassName(this.contentOuter,"has-nav-bar"),this.scrollableContent=document.createElement("div"),this.scrollableContent.className="jsoneditor-tree",this.contentOuter.appendChild(this.scrollableContent),this.content=document.createElement("div"),this.content.className="jsoneditor-tree-inner",this.scrollableContent.appendChild(this.content),this.table=document.createElement("table"),this.table.className="jsoneditor-tree",this.content.appendChild(this.table);var e;this.colgroupContent=document.createElement("colgroup"),"tree"===this.options.mode&&(e=document.createElement("col"),e.width="24px",this.colgroupContent.appendChild(e)),e=document.createElement("col"),e.width="24px",this.colgroupContent.appendChild(e),e=document.createElement("col"),this.colgroupContent.appendChild(e),this.table.appendChild(this.colgroupContent),this.tbody=document.createElement("tbody"),this.table.appendChild(this.tbody),this.frame.appendChild(this.contentOuter)},w.showContextMenu=function(e,t){var i=[],n=this.multiselection.nodes.slice();i.push({text:m("duplicateText"),title:m("duplicateTitle"),className:"jsoneditor-duplicate",click:function(){c.onDuplicate(n)}}),i.push({text:m("remove"),title:m("removeTitle"),className:"jsoneditor-remove",click:function(){c.onRemove(n)}}),this.editor.options.onCreateMenu&&(i=this.editor.options.onCreateMenu(i,{path:node.getPath()})),new a(i,{close:t}).show(e,this.frame)},w.getSelection=function(){var e={start:null,end:null};if(this.multiselection.nodes&&this.multiselection.nodes.length&&this.multiselection.nodes.length){var t=this.multiselection.nodes[0],i=this.multiselection.nodes[this.multiselection.nodes.length-1];"down"===this.multiselection.direction?(e.start=t.serialize(),e.end=i.serialize()):(e.start=i.serialize(),e.end=t.serialize())}return e},w.onSelectionChange=function(e){"function"==typeof e&&(this._selectionChangedHandler=d.debounce(e,this.DEBOUNCE_INTERVAL))},w.setSelection=function(e,t){e&&e.dom&&e.range&&(console.warn("setSelection/getSelection usage for text selection is deprecated and should not be used, see documentation for supported selection options"),this.setDomSelection(e));var i=this._getNodeInstancesByRange(e,t);i.forEach(function(e){e.expandTo()}),this.select(i)},w._getNodeInstancesByRange=function(e,t){var i,n;e&&e.path&&(i=this.node.findNodeByPath(e.path),t&&t.path&&(n=this.node.findNodeByPath(t.path)));var r=[];if(i instanceof c)if(n instanceof c&&n!==i)if(i.parent===n.parent){var e,t;i.getIndex()=0},i.prototype.canRedo=function(){return this.indexthis.results.length-1&&(t=0),this._setActiveResult(t,e)}},i.prototype.previous=function(e){if(void 0!=this.results){var t=this.results.length-1,i=void 0!=this.resultIndex?this.resultIndex-1:t;i<0&&(i=t),this._setActiveResult(i,e)}},i.prototype._setActiveResult=function(e,t){if(this.activeResult){var i=this.activeResult.node;"field"==this.activeResult.elem?delete i.searchFieldActive:delete i.searchValueActive,i.updateDom()}if(!this.results||!this.results[e])return this.resultIndex=void 0,void(this.activeResult=void 0);this.resultIndex=e;var n=this.results[this.resultIndex].node,r=this.results[this.resultIndex].elem;"field"==r?n.searchFieldActive=!0:n.searchValueActive=!0,this.activeResult=this.results[this.resultIndex],n.updateDom(),n.scrollTo(function(){t&&n.focus(r)})},i.prototype._clearDelay=function(){void 0!=this.timeout&&(clearTimeout(this.timeout),delete this.timeout)},i.prototype._onDelayedSearch=function(e){this._clearDelay();var t=this;this.timeout=setTimeout(function(e){t._onSearch()},this.delay)},i.prototype._onSearch=function(e){this._clearDelay();var t=this.dom.search.value,i=t.length>0?t:void 0;if(i!==this.lastText||e){this.lastText=i,this.results=this.editor.search(i);var n=this.results[0]?this.results[0].node.MAX_SEARCH_RESULTS:1/0,r=0;if(this.activeResult)for(var o=0;on?n+"+ results":s+" results"}else this.dom.results.innerHTML=""}},i.prototype._onKeyDown=function(e){var t=e.which;27==t?(this.dom.search.value="",this._onSearch(),e.preventDefault(),e.stopPropagation()):13==t&&(e.ctrlKey?this._onSearch(!0):e.shiftKey?this.previous():this.next(),e.preventDefault(),e.stopPropagation())},i.prototype._onKeyUp=function(e){var t=e.keyCode;27!=t&&13!=t&&this._onDelayedSearch(e)},i.prototype.clear=function(){this.dom.search.value="",this._onSearch()},i.prototype.forceSearch=function(){this._onSearch(!0)},i.prototype.isEmpty=function(){return""===this.dom.search.value},i.prototype.destroy=function(){this.editor=null,this.dom.container.removeChild(this.dom.table),this.dom=null,this.results=null,this.activeResult=null,this._clearDelay()},e.exports=i},function(e,t,i){"use strict";function n(e,t){function i(e,t,r){r.forEach(function(r){if("separator"==r.type){var o=document.createElement("div");o.className="jsoneditor-separator",l=document.createElement("li"),l.appendChild(o),e.appendChild(l)}else{var a={},l=document.createElement("li");e.appendChild(l);var c=document.createElement("button");if(c.type="button",c.className=r.className,a.button=c,r.title&&(c.title=r.title),r.click&&(c.onclick=function(e){e.preventDefault(),n.hide(),r.click()}),l.appendChild(c),r.submenu){var h=document.createElement("div");h.className="jsoneditor-icon",c.appendChild(h);var d=document.createElement("div");d.className="jsoneditor-text"+(r.click?"":" jsoneditor-right-margin"),d.appendChild(document.createTextNode(r.text)),c.appendChild(d);var u;if(r.click){c.className+=" jsoneditor-default";var p=document.createElement("button");p.type="button",a.buttonExpand=p,p.className="jsoneditor-expand",p.innerHTML='
',l.appendChild(p),r.submenuTitle&&(p.title=r.submenuTitle),u=p}else{var f=document.createElement("div");f.className="jsoneditor-expand",c.appendChild(f),u=c}u.onclick=function(e){e.preventDefault(),n._onExpandItem(a),u.focus()};var m=[];a.subItems=m;var g=document.createElement("ul");a.ul=g,g.className="jsoneditor-menu",g.style.height="0",l.appendChild(g),i(g,m,r.submenu)}else c.innerHTML='
'+s(r.text)+"
";t.push(a)}})}this.dom={};var n=this,r=this.dom;this.anchor=void 0,this.items=e,this.eventListeners={},this.selection=void 0,this.onClose=t?t.close:void 0;var o=document.createElement("div");o.className="jsoneditor-contextmenu-root",r.root=o;var a=document.createElement("div");a.className="jsoneditor-contextmenu",r.menu=a,o.appendChild(a);var l=document.createElement("ul");l.className="jsoneditor-menu",a.appendChild(l),r.list=l,r.items=[];var c=document.createElement("button");c.type="button",r.focusButton=c;var h=document.createElement("li");h.style.overflow="hidden",h.style.height="0",h.appendChild(c),l.appendChild(h),i(l,this.dom.items,e),this.maxHeight=0,e.forEach(function(t){var i=24*(e.length+(t.submenu?t.submenu.length:0));n.maxHeight=Math.max(n.maxHeight,i)})}var r=i(64).createAbsoluteAnchor,o=i(65),s=i(69).translate;n.prototype._getVisibleButtons=function(){var e=[],t=this;return this.dom.items.forEach(function(i){e.push(i.button),i.buttonExpand&&e.push(i.buttonExpand),i.subItems&&i==t.expandedItem&&i.subItems.forEach(function(t){e.push(t.button),t.buttonExpand&&e.push(t.buttonExpand)})}),e},n.visibleMenu=void 0,n.prototype.show=function(e,t,i){this.hide();var s=!0,a=e.parentNode,l=e.getBoundingClientRect(),c=a.getBoundingClientRect(),h=t.getBoundingClientRect(),d=this;this.dom.absoluteAnchor=r(e,t,function(){d.hide()}),l.bottom+this.maxHeighth.top&&(s=!1);var u=i?0:l.top-c.top;if(s){var p=e.offsetHeight;this.dom.menu.style.left="0",this.dom.menu.style.top=u+p+"px",this.dom.menu.style.bottom=""}else this.dom.menu.style.left="0",this.dom.menu.style.top="",this.dom.menu.style.bottom="0px";this.dom.absoluteAnchor.appendChild(this.dom.root),this.selection=o.getSelection(),this.anchor=e,setTimeout(function(){d.dom.focusButton.focus()},0),n.visibleMenu&&n.visibleMenu.hide(),n.visibleMenu=this},n.prototype.hide=function(){this.dom.absoluteAnchor&&(this.dom.absoluteAnchor.destroy(),delete this.dom.absoluteAnchor),this.dom.root.parentNode&&(this.dom.root.parentNode.removeChild(this.dom.root),this.onClose&&this.onClose()),n.visibleMenu==this&&(n.visibleMenu=void 0)},n.prototype._onExpandItem=function(e){var t=this,i=e==this.expandedItem,n=this.expandedItem;if(n&&(n.ul.style.height="0",n.ul.style.padding="",setTimeout(function(){t.expandedItem!=n&&(n.ul.style.display="",o.removeClassName(n.ul.parentNode,"jsoneditor-selected"))},300),this.expandedItem=void 0),!i){var r=e.ul;r.style.display="block";r.clientHeight;setTimeout(function(){if(t.expandedItem==e){for(var i=0,n=0;n=" "&&h<=" "||" "===h||" "===h||" "===h?(s.push(" "),a++):"'"===h?o("'"):'"'===h?o('"'):"`"===h?o("´"):"‘"===h?o("’"):"“"===h?o("”"):","===h&&-1!==["]","}"].indexOf(function(){for(var t=a+1;t=0;){var t=s[e];if(!r(t))return t;e--}return""}())?function(){for(var e=["null","true","false"],i="",n=t(),r=/[a-zA-Z_$\d]/;r.test(n);)i+=n,a++,n=t();-1===e.indexOf(i)?s.push('"'+i+'"'):s.push(i)}():(s.push(h),a++)}return s.join("")},t.escapeUnicodeChars=function(e){return e.replace(/[\u007F-\uFFFF]/g,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})},t.validate=function(e){void 0!==n?n.parse(e):JSON.parse(e)},t.extend=function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},t.clear=function(e){for(var t in e)e.hasOwnProperty(t)&&delete e[t];return e},t.type=function(e){return null===e?"null":void 0===e?"undefined":e instanceof Number||"number"==typeof e?"number":e instanceof String||"string"==typeof e?"string":e instanceof Boolean||"boolean"==typeof e?"boolean":e instanceof RegExp||"regexp"==typeof e?"regexp":t.isArray(e)?"array":"object"};var s=/^https?:\/\/\S+$/;t.isUrl=function(e){return("string"==typeof e||e instanceof String)&&s.test(e)},t.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.getAbsoluteLeft=function(e){return e.getBoundingClientRect().left+window.pageXOffset||document.scrollLeft||0},t.getAbsoluteTop=function(e){return e.getBoundingClientRect().top+window.pageYOffset||document.scrollTop||0},t.addClassName=function(e,t){var i=e.className.split(" ");-1==i.indexOf(t)&&(i.push(t),e.className=i.join(" "))},t.removeAllClassNames=function(e){e.className=""},t.removeClassName=function(e,t){var i=e.className.split(" "),n=i.indexOf(t);-1!=n&&(i.splice(n,1),e.className=i.join(" "))},t.stripFormatting=function(e){for(var i=e.childNodes,n=0,r=i.length;n=0;a--){var l=s[a];!0===l.specified&&o.removeAttribute(l.name)}t.stripFormatting(o)}},t.setEndOfContentEditable=function(e){var t,i;document.createRange&&(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1),i=window.getSelection(),i.removeAllRanges(),i.addRange(t))},t.selectContentEditable=function(e){if(e&&"DIV"==e.nodeName){var t,i;window.getSelection&&document.createRange&&(i=document.createRange(),i.selectNodeContents(e),t=window.getSelection(),t.removeAllRanges(),t.addRange(i))}},t.getSelection=function(){if(window.getSelection){var e=window.getSelection();if(e.getRangeAt&&e.rangeCount)return e.getRangeAt(0)}return null},t.setSelection=function(e){if(e&&window.getSelection){var t=window.getSelection();t.removeAllRanges(),t.addRange(e)}},t.getSelectionOffset=function(){var e=t.getSelection();return e&&"startOffset"in e&&"endOffset"in e&&e.startContainer&&e.startContainer==e.endContainer?{startOffset:e.startOffset,endOffset:e.endOffset,container:e.startContainer.parentNode}:null},t.setSelectionOffset=function(e){if(document.createRange&&window.getSelection){if(window.getSelection()){var i=document.createRange();e.container.firstChild||e.container.appendChild(document.createTextNode("")),i.setStart(e.container.firstChild,e.startOffset),i.setEnd(e.container.firstChild,e.endOffset),t.setSelection(i)}}},t.getInnerText=function(e,i){if(void 0==i&&(i={text:"",flush:function(){var e=this.text;return this.text="",e},set:function(e){this.text=e}}),e.nodeValue)return i.flush()+e.nodeValue;if(e.hasChildNodes()){for(var n=e.childNodes,r="",o=0,s=n.length;o0&&"["===e[n]))throw new Error('Invalid JSON path: unexpected character "'+e[n]+'" at index '+n);if(n++,"'"===e[n]||'"'===e[n]){var r=e[n];if(n++,i.push(t(r)),e[n]!==r)throw new Error("Invalid JSON path: closing quote ' expected at index "+n);n++}else{var o=t("]").trim();if(0===o.length)throw new Error("Invalid JSON path: array value expected at index "+n);o="*"===o?o:JSON.parse(o),i.push(o)}if("]"!==e[n])throw new Error("Invalid JSON path: closing bracket ] expected at index "+n);n++}return i},t.stringifyPath=function(e){return e.map(function(e){return"number"==typeof e?"["+e+"]":"string"==typeof e&&e.match(/^[A-Za-z0-9_$]+$/)?"."+e:'["'+e+'"]'}).join("")},t.improveSchemaError=function(e){if("enum"===e.keyword&&Array.isArray(e.schema)){var t=e.schema;if(t){if(t=t.map(function(e){return JSON.stringify(e)}),t.length>5){var i=["("+(t.length-5)+" more...)"];t=t.slice(0,5),t.push(i)}e.message="should be equal to one of: "+t.join(", ")}}return"additionalProperties"===e.keyword&&(e.message="should NOT have additional property: "+e.params.additionalProperty),e},t.isPromise=function(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch},t.isValidValidationError=function(e){return"object"==typeof e&&Array.isArray(e.path)&&"string"==typeof e.message},t.insideRect=function(e,t,i){var n=void 0!==i?i:0;return t.left-n>=e.left&&t.right+n<=e.right&&t.top-n>=e.top&&t.bottom+n<=e.bottom},t.debounce=function(e,t,i){var n;return function(){var r=this,o=arguments,s=function(){n=null,i||e.apply(r,o)},a=i&&!n;clearTimeout(n),n=setTimeout(s,t),a&&e.apply(r,o)}},t.textDiff=function(e,t){for(var i=t.length,n=0,r=e.length,o=t.length;t.charAt(n)===e.charAt(n)&&nn&&r>0;)o--,r--;return{start:n,end:o}},t.getInputSelection=function(e){function t(t){var i=e.value.substring(0,t);return{row:(i.match(/\n/g)||[]).length+1,column:i.length-i.lastIndexOf("\n")}}var i,n,r,o,s,a=0,l=0;return"number"==typeof e.selectionStart&&"number"==typeof e.selectionEnd?(a=e.selectionStart,l=e.selectionEnd):(n=document.selection.createRange())&&n.parentElement()==e&&(o=e.value.length,i=e.value.replace(/\r\n/g,"\n"),r=e.createTextRange(),r.moveToBookmark(n.getBookmark()),s=e.createTextRange(),s.collapse(!1),r.compareEndPoints("StartToEnd",s)>-1?a=l=o:(a=-r.moveStart("character",-o),a+=i.slice(0,a).split("\n").length-1,r.compareEndPoints("EndToEnd",s)>-1?l=o:(l=-r.moveEnd("character",-o),l+=i.slice(0,l).split("\n").length-1))),{startIndex:a,endIndex:l,start:t(a),end:t(l)}},t.getIndexForPosition=function(e,t,i){var n=e.value||"";if(t>0&&i>0){var r=n.split("\n",t);t=Math.min(r.length,t),i=Math.min(r[t-1].length,i-1);var o=1==t?i:i+1;return r.slice(0,t-1).join("\n").length+o}return-1},t.getPositionForPath=function(e,t){var i,n=this,o=[];if(!t||!t.length)return o;try{i=r.parse(e)}catch(e){return o}return t.forEach(function(e){var t=n.parsePath(e),r=t.length?"/"+t.join("/"):"",s=i.pointers[r];s&&o.push({path:e,line:s.key?s.key.line:s.value?s.value.line:0,column:s.key?s.key.column:s.value?s.value.column:0})}),o},t.getColorCSS=function(e){var t=document.createElement("div");return t.style.color=e,t.style.color.split(/\s+/).join("").toLowerCase()||null},t.isValidColor=function(e){return!!t.getColorCSS(e)},t.makeFieldTooltip=function(e,t){if(!e)return"";var i="";return e.title&&(i+=e.title),e.description&&(i.length>0&&(i+="\n"),i+=e.description),e.default&&(i.length>0&&(i+="\n\n"),i+=o("default",void 0,t)+"\n",i+=JSON.stringify(e.default,null,2)),Array.isArray(e.examples)&&e.examples.length>0&&(i.length>0&&(i+="\n\n"),i+=o("examples",void 0,t)+"\n",e.examples.forEach(function(t,n){i+=JSON.stringify(t,null,2),n!==e.examples.length-1&&(i+="\n")})),i}},function(e,t){"undefined"!=typeof Element&&function(){function e(e){e.hasOwnProperty("remove")||Object.defineProperty(e,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){null!=this.parentNode&&this.parentNode.removeChild(this)}})}"undefined"!=typeof Element&&e(Element.prototype),"undefined"!=typeof CharacterData&&e(CharacterData.prototype),"undefined"!=typeof DocumentType&&e(DocumentType.prototype)}(),String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),Array.prototype.find||(Array.prototype.find=function(e){for(var t=0;t2&&C.push("'"+this.terminals_[y]+"'");var E="";E=this.lexer.showPosition?"Parse error on line "+(l+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+C.join(", ")+", got '"+this.terminals_[p]+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==p?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(E,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:u,expected:C})}if(3==h){if(1==p)throw new Error(E||"Parsing halted.");c=this.lexer.yyleng,a=this.lexer.yytext,l=this.lexer.yylineno,u=this.lexer.yylloc,p=t()}for(;;){if(d.toString()in s[m])break;if(0==m)throw new Error(E||"Parsing halted.");!function(e){n.length=n.length-2*e,r.length=r.length-e,o.length=o.length-e}(1),m=n[n.length-1]}f=p,p=d,m=n[n.length-1],g=s[m]&&s[m][d],h=3}if(g[0]instanceof Array&&g.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+p);switch(g[0]){case 1:n.push(p),r.push(this.lexer.yytext),o.push(this.lexer.yylloc),n.push(g[1]),p=null,f?(p=f,f=null):(c=this.lexer.yyleng,a=this.lexer.yytext,l=this.lexer.yylineno,u=this.lexer.yylloc,h>0&&h--);break;case 2:if(w=this.productions_[g[1]][1],A.$=r[r.length-w],A._$={first_line:o[o.length-(w||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(w||1)].first_column,last_column:o[o.length-1].last_column},void 0!==(v=this.performAction.call(A,a,c,l,this.yy,g[1],r,o)))return v;w&&(n=n.slice(0,-1*w*2),r=r.slice(0,-1*w),o=o.slice(0,-1*w)),n.push(this.productions_[g[1]][0]),r.push(A.$),o.push(A._$),b=s[n[n.length-2]][n[n.length-1]],n.push(b);break;case 3:return!0}}return!0}},t=function(){var e={EOF:1,parseError:function(e,t){if(!this.yy.parseError)throw new Error(e);this.yy.parseError(e,t)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.match+=e,this.matched+=e,e.match(/\n/)&&this.yylineno++,this._input=this._input.slice(1),e},unput:function(e){return this._input=e+this._input,this},more:function(){return this._more=!0,this},less:function(e){this._input=this.match.slice(e)+this._input},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,i,n,r;this._more||(this.yytext="",this.match="");for(var o=this._currentRules(),s=0;st[0].length)||(t=i,n=s,this.options.flex));s++);return t?(r=t[0].match(/\n.*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-1:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,o[n],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e||void 0):""===this._input?this.EOF:void this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return void 0!==e?e:this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(e){this.begin(e)}};return e.options={},e.performAction=function(e,t,i,n){switch(i){case 0:break;case 1:return 6;case 2:return t.yytext=t.yytext.substr(1,t.yyleng-2),4;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},e.rules=[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt\/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],e.conditions={INITIAL:{ -rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}},e}();return e.lexer=t,e}();t.parser=n,t.parse=n.parse.bind(n)},function(e,t){"use strict";function i(e){return a.indexOf(typeof e)>=0}function n(e){return'"'+(e=e.replace(l,"\\$&").replace(h,"\\f").replace(c,"\\b").replace(d,"\\n").replace(u,"\\r").replace(p,"\\t"))+'"'}function r(e){return e.replace(f,"~0").replace(m,"~1")}var o={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",'"':'"',"/":"/","\\":"\\"},s="a".charCodeAt();t.parse=function(e){function t(t,r){i();var o;m(t,"value");var s=d();switch(s){case"t":h("rue"),o=!0;break;case"f":h("alse"),o=!1;break;case"n":h("ull"),o=null;break;case'"':o=n();break;case"[":o=l(t);break;case"{":o=c(t);break;default:u(),"-0123456789".indexOf(s)>=0?o=a():y()}return m(t,"valueEnd"),i(),r&&x="a"&&i<="f"?t+=i.charCodeAt()-s+10:i>="0"&&i<="9"?t+=+i:w()}return String.fromCharCode(t)}function f(){for(var t="";e[x]>="0"&&e[x]<="9";)t+=d();if(t.length)return t;b(),y()}function m(e,t){g(e,t,v())}function g(e,t,i){C[e]=C[e]||{},C[e][t]=i}function v(){return{line:A,column:E,pos:x}}function y(){throw new SyntaxError("Unexpected token "+e[x]+" in JSON at position "+x)}function w(){u(),y()}function b(){if(x>=e.length)throw new SyntaxError("Unexpected end of JSON input")}var C={},A=0,E=0,x=0;return{data:t("",!0),pointers:C}},t.stringify=function(e,t,o){function s(e,t,h){switch(c(h,"value"),typeof e){case"number":case"boolean":a(""+e);break;case"string":a(n(e));break;case"object":null===e?a("null"):"function"==typeof e.toJSON?a(n(e.toJSON())):Array.isArray(e)?function(){if(e.length){a("[");for(var n=t+1,r=0;r10?10:o<0?0:Math.floor(o);o=f&&h(f," "),d=f,u=f;break;case"string":o=o.slice(0,10),d=0,u=0;for(var m=0;m0;){var n=t.shift();if("number"==typeof n){if("array"!==i.type)throw new Error("Cannot get child node at index "+n+": node is no array");i=i.childs[n]}else{if("object"!==i.type)throw new Error("Cannot get child node "+n+": node is no object");i=i.childs.filter(function(e){return e.field===n})[0]}}return i},n.prototype.findParents=function(){for(var e=[],t=this.parent;t;)e.unshift(t),t=t.parent;return e},n.prototype.setError=function(e,t){this.error=e,this.errorChild=t,this.dom&&this.dom.tr&&this.updateError()},n.prototype.updateError=function(){var e=this.error,t=this.dom.tdError;if(e&&this.dom&&this.dom.tr){f.addClassName(this.dom.tr,"jsoneditor-validation-error"),t||(t=document.createElement("td"),this.dom.tdError=t,this.dom.tdValue.parentNode.appendChild(t));var i=document.createElement("div");i.className="jsoneditor-popover jsoneditor-right",i.appendChild(document.createTextNode(e.message));var n=document.createElement("button");n.type="button",n.className="jsoneditor-button jsoneditor-schema-error",n.appendChild(i),n.onmouseover=n.onfocus=function(){for(var e=["right","above","below","left"],t=0;t=e.length;a--)this.removeChild(this.childs[a],!1)}else if("object"===this.type){for(this.childs||(this.childs=[]),a=this.childs.length-1;a>=0;a--)e.hasOwnProperty(this.childs[a].field)||this.removeChild(this.childs[a],!1);s=0;for(var c in e)e.hasOwnProperty(c)&&(i=e[c],void 0===i||i instanceof Function||(r=this.findChildByProperty(c),r?(r.setField(c,!0),r.setValue(i)):(r=new n(this.editor,{field:c,value:i}),o=s=e.childs.length;s--)this.removeChild(this.childs[s],!1)}else if("object"===e.type){for(this.childs||(this.childs=[]),o=0;o=e.childs.length;s--)this.removeChild(this.childs[s],!1)}else this.hideChilds(),delete this.append,delete this.showMore,delete this.expanded,delete this.childs,this.value=e.value;Array.isArray(a)!==Array.isArray(this.childs)&&this.recreateDom(),this.updateDom({updateIndexes:!0}),this.previousValue=this.value},n.prototype.recreateDom=function(){if(this.dom&&this.dom.tr&&this.dom.tr.parentNode){var e=this._detachFromDom();this.clearDom(),this._attachToDom(e)}else this.clearDom()},n.prototype.getValue=function(){if("array"==this.type){var e=[];return this.childs.forEach(function(t){e.push(t.getValue())}),e}if("object"==this.type){var t={};return this.childs.forEach(function(e){t[e.getField()]=e.getValue()}),t}return void 0===this.value&&this._getDomValue(),this.value},n.prototype.getInternalValue=function(){return"array"===this.type?{type:this.type,childs:this.childs.map(function(e){return e.getInternalValue()})}:"object"===this.type?{type:this.type,childs:this.childs.map(function(e){return{field:e.getField(),value:e.getInternalValue()}})}:(void 0===this.value&&this._getDomValue(),{type:this.type,value:this.value})},n.prototype.getLevel=function(){return this.parent?this.parent.getLevel()+1:0},n.prototype.getNodePath=function(){var e=this.parent?this.parent.getNodePath():[];return e.push(this),e},n.prototype.clone=function(){var e=new n(this.editor);if(e.type=this.type,e.field=this.field,e.fieldInnerText=this.fieldInnerText,e.fieldEditable=this.fieldEditable,e.previousField=this.previousField,e.value=this.value,e.valueInnerText=this.valueInnerText,e.previousValue=this.previousValue,e.expanded=this.expanded,e.visibleChilds=this.visibleChilds,this.childs){var t=[];this.childs.forEach(function(i){var n=i.clone();n.setParent(e),t.push(n)}),e.childs=t}else e.childs=void 0;return e},n.prototype.expand=function(e){this.childs&&(this.expanded=!0,this.dom.expand&&(this.dom.expand.className="jsoneditor-button jsoneditor-expanded"),this.showChilds(),!1!==e&&this.childs.forEach(function(t){t.expand(e)}))},n.prototype.collapse=function(e){this.childs&&(this.hideChilds(),!1!==e&&this.childs.forEach(function(t){t.collapse(e)}),this.dom.expand&&(this.dom.expand.className="jsoneditor-button jsoneditor-collapsed"),this.expanded=!1)},n.prototype.showChilds=function(){if(this.childs&&this.expanded){var e=this.dom.tr,t=e?e.parentNode:void 0;if(t){var i=this.getAppendDom();if(!i.parentNode){var n=e.nextSibling;n?t.insertBefore(i,n):t.appendChild(i)}for(var r=Math.min(this.childs.length,this.visibleChilds),n=this._getNextTr(),o=0;othis.visibleChilds){var r=this.childs[this.visibleChilds-1];this.insertBefore(e,r)}else this.appendChild(e);else this.insertBefore(e,t);i&&i.removeChild(n)}},n.prototype.insertBefore=function(e,t){if(this._hasChilds()){if(this.visibleChilds++,"object"===this.type&&void 0==e.field&&e.setField(""),t===this.append)e.setParent(this),e.fieldEditable="object"==this.type,this.childs.push(e);else{var i=this.childs.indexOf(t);if(-1==i)throw new Error("Node not found");e.setParent(this),e.fieldEditable="object"==this.type,this.childs.splice(i,0,e)}if(this.expanded){var n=e.getDom(),r=t.getDom(),o=r?r.parentNode:void 0;r&&o&&o.insertBefore(n,r),e.showChilds(),this.showChilds()}this.updateDom({updateIndexes:!0}),e.updateDom({recurse:!0})}},n.prototype.insertAfter=function(e,t){if(this._hasChilds()){var i=this.childs.indexOf(t),n=this.childs[i+1];n?this.insertBefore(e,n):this.appendChild(e)}},n.prototype.search=function(e,t){Array.isArray(t)||(t=[]);var i,n=e?e.toLowerCase():void 0;if(delete this.searchField,delete this.searchValue,void 0!==this.field&&t.length<=this.MAX_SEARCH_RESULTS){i=String(this.field).toLowerCase().indexOf(n),-1!==i&&(this.searchField=!0,t.push({node:this,elem:"field"})),this._updateDomField()}if(this._hasChilds())this.childs&&this.childs.forEach(function(i){i.search(e,t)});else if(void 0!==this.value&&t.length<=this.MAX_SEARCH_RESULTS){var r=String(this.value).toLowerCase();i=r.indexOf(n),-1!==i&&(this.searchValue=!0,t.push({node:this,elem:"value"})),this._updateDomValue()}return t},n.prototype.scrollTo=function(e){this.expandPathToNode(),this.dom.tr&&this.dom.tr.parentNode&&this.editor.scrollTo(this.dom.tr.offsetTop,e)},n.prototype.expandPathToNode=function(){for(var e=this;e&&e.parent;){for(var t="array"===e.parent.type?e.index:e.parent.childs.indexOf(e);e.parent.visibleChilds9466848e5&&!isNaN(new Date(i).valueOf())?(this.dom.date||(this.dom.date=document.createElement("div"),this.dom.date.className="jsoneditor-date",this.dom.value.parentNode.appendChild(this.dom.date)),this.dom.date.innerHTML=new Date(i).toISOString(),this.dom.date.title=new Date(i).toString()):this.dom.date&&(this.dom.date.parentNode.removeChild(this.dom.date),delete this.dom.date),f.stripFormatting(e),this._updateDomDefault()}},n.prototype._deleteDomColor=function(){this.dom.color&&(this.dom.tdColor.parentNode.removeChild(this.dom.tdColor),delete this.dom.tdColor,delete this.dom.color,this.dom.value.style.color="")},n.prototype._updateDomField=function(){var e=this.dom.field;if(e){var t=f.makeFieldTooltip(this.schema,this.editor.options.language);t&&(e.title=t);""==String(this.field)&&"array"!=this.parent.type?f.addClassName(e,"jsoneditor-empty"):f.removeClassName(e,"jsoneditor-empty"),this.searchFieldActive?f.addClassName(e,"jsoneditor-highlight-active"):f.removeClassName(e,"jsoneditor-highlight-active"),this.searchField?f.addClassName(e,"jsoneditor-highlight"):f.removeClassName(e,"jsoneditor-highlight"),f.stripFormatting(e)}},n.prototype._getDomField=function(e){if(this.dom.field&&this.fieldEditable&&(this.fieldInnerText=f.getInnerText(this.dom.field)),void 0!=this.fieldInnerText)try{var t=this._unescapeHTML(this.fieldInnerText);t!==this.field&&(this.field=t,this._debouncedOnChangeField())}catch(t){if(this.field=void 0,!0!==e)throw t}},n.prototype._updateDomDefault=function(){this.schema&&void 0!==this.schema.default&&!this._hasChilds()&&(this.value===this.schema.default?this.dom.select?this.dom.value.removeAttribute("title"):(this.dom.value.title=m("default"),this.dom.value.classList.add("jsoneditor-is-default"),this.dom.value.classList.remove("jsoneditor-is-not-default")):(this.dom.value.removeAttribute("title"),this.dom.value.classList.remove("jsoneditor-is-default"),this.dom.value.classList.add("jsoneditor-is-not-default")))},n.prototype.validate=function(){var e=[];if("object"===this.type){for(var t={},i=[],n=0;n0&&(e=this.childs.filter(function(e){return-1!==i.indexOf(e.field)}).map(function(e){return{node:e,error:{message:m("duplicateKey")+' "'+e.field+'"'}}}))}if(this.childs)for(var n=0;n0&&(e=e.concat(o))}return e},n.prototype.clearDom=function(){this.dom={}},n.prototype.getDom=function(){var e=this.dom;if(e.tr)return e.tr;if(this._updateEditability(),e.tr=document.createElement("tr"),e.tr.node=this,"tree"===this.editor.options.mode){var t=document.createElement("td");if(this.editable.field&&this.parent){var i=document.createElement("button");i.type="button",e.drag=i,i.className="jsoneditor-button jsoneditor-dragarea",i.title=m("drag"),t.appendChild(i)}e.tr.appendChild(t);var n=document.createElement("td"),r=document.createElement("button");r.type="button",e.menu=r,r.className="jsoneditor-button jsoneditor-contextmenu",r.title=m("actionsMenu"),n.appendChild(e.menu),e.tr.appendChild(n)}var o=document.createElement("td");return e.tr.appendChild(o),e.tree=this._createDomTree(),o.appendChild(e.tree),this.updateDom({updateIndexes:!0}),e.tr},n.prototype.isVisible=function(){return this.dom&&this.dom.tr&&this.dom.tr.parentNode||!1},n.onDragStart=function(e,t){if(!Array.isArray(e))return n.onDragStart([e],t);if(0!==e.length){var i=e[0],o=e[e.length-1],s=i.parent,a=n.getNodeFromTarget(t.target),l=i.editor,c=f.getAbsoluteTop(a.dom.tr)-f.getAbsoluteTop(i.dom.tr);l.mousemove||(l.mousemove=f.addEventListener(window,"mousemove",function(t){n.onDrag(e,t)})),l.mouseup||(l.mouseup=f.addEventListener(window,"mouseup",function(t){n.onDragEnd(e,t)})),l.highlighter.lock(),l.drag={oldCursor:document.body.style.cursor,oldSelection:l.getDomSelection(),oldPaths:e.map(r),oldParent:s,oldNextNode:s.childs[o.getIndex()+1]||s.append,oldParentPathRedo:s.getInternalPath(),oldIndexRedo:i.getIndex(),mouseX:t.pageX,offsetY:c,level:i.getLevel()},document.body.style.cursor="move",t.preventDefault()}},n.onDrag=function(e,t){if(!Array.isArray(e))return n.onDrag([e],t);if(0!==e.length){var i,r,o,s,a,l,c,h,d,u,p,m,g,y,w=e[0].editor,b=t.pageY-w.drag.offsetY,C=t.pageX,A=!1,E=e[0];if(i=E.dom.tr,d=f.getAbsoluteTop(i),m=i.offsetHeight,bu+m&&(c=void 0)),c&&(e.forEach(function(e){c.parent.moveBefore(e,c)}),A=!0)}else{var x=e[e.length-1];if(a=x.expanded&&x.append?x.append.getDom():x.dom.tr,s=a?a.nextSibling:void 0){p=f.getAbsoluteTop(s),o=s;do{h=n.getNodeFromTarget(o),o&&(g=o.nextSibling?f.getAbsoluteTop(o.nextSibling):0,y=o?g-p:0,h&&h.parent.childs.length==e.length&&h.parent.childs[e.length-1]==x&&(d+=27),o=o.nextSibling)}while(o&&b>d+y);if(h&&h.parent){var F=C-w.drag.mouseX,S=Math.round(F/24/2),_=w.drag.level+S,k=h.getLevel();for(r=h.dom.tr&&h.dom.tr.previousSibling;k<_&&r;){c=n.getNodeFromTarget(r);if(e.some(function(e){return e===c||c.isDescendantOf(e)}));else{if(!(c instanceof v))break;var D=c.parent.childs;if(D.length==e.length&&D[e.length-1]==x)break;h=n.getNodeFromTarget(r),k=h.getLevel()}r=r.previousSibling}h instanceof v&&!h.isVisible()&&h.parent.showMore.isVisible()&&(h=h._nextNode()),h&&h.dom.tr&&a.nextSibling!=h.dom.tr&&(e.forEach(function(e){h.parent.moveBefore(e,h)}),A=!0)}}}A&&(w.drag.mouseX=C,w.drag.level=E.getLevel()),w.startAutoScroll(b),t.preventDefault()}},n.onDragEnd=function(e,t){if(!Array.isArray(e))return n.onDrag([e],t);if(0!==e.length){var i=e[0],r=i.editor;e[0]&&e[0].dom.menu.focus();var s=r.drag.oldParent.getInternalPath(),a=i.parent.getInternalPath(),l=r.drag.oldParent===i.parent,c=r.drag.oldNextNode.getIndex(),h=i.getIndex(),d=r.drag.oldParentPathRedo,u=r.drag.oldIndexRedo,p=l&&u0)return i[0].enum}return null},n._findSchema=function(e,t,i){var r=e,o=r,s=e.oneOf||e.anyOf||e.allOf;s||(s=[e]);for(var a=0;a0?null:o},n.prototype._updateDomIndexes=function(){var e=this.dom.value,t=this.childs;e&&t&&("array"==this.type?t.forEach(function(e,t){e.index=t;var i=e.dom.field;i&&(i.innerHTML=t)}):"object"==this.type&&t.forEach(function(e){void 0!=e.index&&(delete e.index,void 0==e.field&&(e.field=""))}))},n.prototype._createDomValue=function(){var e;return"array"==this.type?(e=document.createElement("div"),e.innerHTML="[...]"):"object"==this.type?(e=document.createElement("div"),e.innerHTML="{...}"):!this.editable.value&&f.isUrl(this.value)?(e=document.createElement("a"),e.href=this.value,e.innerHTML=this._escapeHTML(this.value)):(e=document.createElement("div"),e.contentEditable=this.editable.value,e.spellcheck=!1,e.innerHTML=this._escapeHTML(this.value)),e},n.prototype._createDomExpandButton=function(){var e=document.createElement("button");return e.type="button",this._hasChilds()?(e.className=this.expanded?"jsoneditor-button jsoneditor-expanded":"jsoneditor-button jsoneditor-collapsed",e.title=m("expandTitle")):(e.className="jsoneditor-button jsoneditor-invisible",e.title=""),e},n.prototype._createDomTree=function(){var e=this.dom,t=document.createElement("table"),i=document.createElement("tbody");t.style.borderCollapse="collapse",t.className="jsoneditor-values",t.appendChild(i);var n=document.createElement("tr");i.appendChild(n);var r=document.createElement("td");r.className="jsoneditor-tree",n.appendChild(r),e.expand=this._createDomExpandButton(),r.appendChild(e.expand),e.tdExpand=r;var o=document.createElement("td");o.className="jsoneditor-tree",n.appendChild(o),e.field=this._createDomField(),o.appendChild(e.field),e.tdField=o;var s=document.createElement("td");s.className="jsoneditor-tree",n.appendChild(s),"object"!=this.type&&"array"!=this.type&&(s.appendChild(document.createTextNode(":")),s.className="jsoneditor-separator"),e.tdSeparator=s;var a=document.createElement("td");return a.className="jsoneditor-tree",n.appendChild(a),e.value=this._createDomValue(),a.appendChild(e.value),e.tdValue=a,t},n.prototype.onEvent=function(e){var t=e.type,i=e.target||e.srcElement,n=this.dom,r=this,o=this._hasChilds();if("function"==typeof this.editor.options.onEvent&&this._onEvent(e),i!=n.drag&&i!=n.menu||("mouseover"==t?this.editor.highlighter.highlight(this):"mouseout"==t&&this.editor.highlighter.unhighlight()),"click"==t&&i==n.menu){var s=r.editor.highlighter;s.highlight(r),s.lock(),f.addClassName(n.menu,"jsoneditor-selected"),this.showContextMenu(n.menu,function(){f.removeClassName(n.menu,"jsoneditor-selected"),s.unlock(),s.unhighlight()})}if("click"==t&&(i==n.expand||("view"===r.editor.options.mode||"form"===r.editor.options.mode)&&"DIV"===i.nodeName)&&o){var a=e.ctrlKey;this._onExpand(a)}"click"!==t||e.target!==r.dom.tdColor&&e.target!==r.dom.color||this._showColorPicker(),"change"==t&&i==n.checkbox&&(this.dom.value.innerHTML=!this.value,this._getDomValue(),this._updateDomDefault()),"change"==t&&i==n.select&&(this.dom.value.innerHTML=n.select.value,this._getDomValue(),this._updateDomValue());var l=n.value;if(i==l)switch(t){case"blur":case"change":this._getDomValue(!0),this._updateDomValue(),this.value&&(l.innerHTML=this._escapeHTML(this.value));break;case"input":this._getDomValue(!0),this._updateDomValue();break;case"keydown":case"mousedown":this.editor.selection=this.editor.getDomSelection();break;case"click":e.ctrlKey&&this.editable.value&&f.isUrl(this.value)&&(e.preventDefault(),window.open(this.value,"_blank"));break;case"keyup":this._getDomValue(!0),this._updateDomValue();break;case"cut":case"paste":setTimeout(function(){r._getDomValue(!0),r._updateDomValue()},1)}var c=n.field;if(i==c)switch(t){case"blur":case"change":this._getDomField(!0),this._updateDomField(),this.field&&(c.innerHTML=this._escapeHTML(this.field));break;case"input":this._getDomField(!0),this._updateSchema(),this._updateDomField(),this._updateDomValue();break;case"keydown":case"mousedown":this.editor.selection=this.editor.getDomSelection();break;case"keyup":this._getDomField(!0),this._updateDomField();break;case"cut":case"paste":setTimeout(function(){r._getDomField(!0),r._updateDomField()},1)}var h=n.tree;if(h&&i==h.parentNode&&"click"==t&&!e.hasMoved){(void 0!=e.offsetX?e.offsetX<24*(this.getLevel()+1):e.pageX0?this.editor.multiselection.nodes:[this],S=F[0],_=F[F.length-1];if(13==y){if(w==this.dom.value)this.editable.value&&!e.ctrlKey||f.isUrl(this.value)&&(window.open(this.value,"_blank"),E=!0);else if(w==this.dom.expand){var k=this._hasChilds();if(k){var D=e.ctrlKey;this._onExpand(D),w.focus(),E=!0}}}else if(68==y)b&&x&&(n.onDuplicate(F),E=!0);else if(69==y)b&&(this._onExpand(C),w.focus(),E=!0);else if(77==y&&x)b&&(this.showContextMenu(w),E=!0);else if(46==y&&x)b&&(n.onRemove(F),E=!0);else if(45==y&&x)b&&!C?(this._onInsertBefore(),E=!0):b&&C&&(this._onInsertAfter(),E=!0);else if(35==y){if(A){var $=this._lastNode();$&&$.focus(n.focusElement||this._getElementName(w)),E=!0}}else if(36==y){if(A){var B=this._firstNode();B&&B.focus(n.focusElement||this._getElementName(w)),E=!0}}else if(37==y){if(A&&!C){var L=this._previousElement(w);L&&this.focus(this._getElementName(L)),E=!0}else if(A&&C&&x){if(_.expanded){var T=_.getAppendDom();r=T?T.nextSibling:void 0}else{var R=_.getDom();r=R.nextSibling}r&&(i=n.getNodeFromTarget(r),s=r.nextSibling,O=n.getNodeFromTarget(s),i&&i instanceof v&&1!=_.parent.childs.length&&O&&O.parent&&(a=this.editor.getDomSelection(),c=S.parent,l=c.childs[_.getIndex()+1]||c.append,h=S.getIndex(),d=O.getIndex(),u=c.getInternalPath(),p=O.parent.getInternalPath(),F.forEach(function(e){O.parent.moveBefore(e,O)}),this.focus(n.focusElement||this._getElementName(w)),this.editor._onAction("moveNodes",{count:F.length,fieldNames:F.map(o),oldParentPath:c.getInternalPath(),newParentPath:S.parent.getInternalPath(),oldIndex:l.getIndex(),newIndex:S.getIndex(),oldIndexRedo:h,newIndexRedo:d,oldParentPathRedo:u,newParentPathRedo:p,oldSelection:a,newSelection:this.editor.getDomSelection()})))}}else if(38==y)A&&!C?(t=this._previousNode(),t&&(this.editor.deselect(!0),t.focus(n.focusElement||this._getElementName(w))),E=!0):!A&&b&&C&&x?(t=this._previousNode(),t&&(g=this.editor.multiselection,g.start=g.start||this,g.end=t,m=this.editor._findTopLevelNodes(g.start,g.end),this.editor.select(m),t.focus("field")),E=!0):A&&C&&x&&(t=S._previousNode(),t&&t.parent&&(a=this.editor.getDomSelection(),c=S.parent,l=c.childs[_.getIndex()+1]||c.append,h=S.getIndex(),d=t.getIndex(),u=c.getInternalPath(),p=t.parent.getInternalPath(),F.forEach(function(e){t.parent.moveBefore(e,t)}),this.focus(n.focusElement||this._getElementName(w)),this.editor._onAction("moveNodes",{count:F.length,fieldNames:F.map(o),oldParentPath:c.getInternalPath(),newParentPath:S.parent.getInternalPath(),oldIndex:l.getIndex(),newIndex:S.getIndex(),oldIndexRedo:h,newIndexRedo:d,oldParentPathRedo:u,newParentPathRedo:p,oldSelection:a,newSelection:this.editor.getDomSelection()})),E=!0);else if(39==y){if(A&&!C){var P=this._nextElement(w);P&&this.focus(this._getElementName(P)),E=!0}else if(A&&C&&x){R=S.getDom();var M=R.previousSibling;M&&(t=n.getNodeFromTarget(M))&&t.parent&&!t.isVisible()&&(a=this.editor.getDomSelection(),c=S.parent,l=c.childs[_.getIndex()+1]||c.append,h=S.getIndex(),d=t.getIndex(),u=c.getInternalPath(),p=t.parent.getInternalPath(),F.forEach(function(e){t.parent.moveBefore(e,t)}),this.focus(n.focusElement||this._getElementName(w)),this.editor._onAction("moveNodes",{count:F.length,fieldNames:F.map(o),oldParentPath:c.getInternalPath(),newParentPath:S.parent.getInternalPath(),oldIndex:l.getIndex(),newIndex:S.getIndex(),oldIndexRedo:h,newIndexRedo:d,oldParentPathRedo:u,newParentPathRedo:p,oldSelection:a,newSelection:this.editor.getDomSelection()}))}}else if(40==y)if(A&&!C)i=this._nextNode(),i&&(this.editor.deselect(!0),i.focus(n.focusElement||this._getElementName(w))),E=!0;else if(!A&&b&&C&&x)i=this._nextNode(),i&&(g=this.editor.multiselection,g.start=g.start||this,g.end=i,m=this.editor._findTopLevelNodes(g.start,g.end),this.editor.select(m),i.focus("field")),E=!0;else if(A&&C&&x){i=_.expanded?_.append?_.append._nextNode():void 0:_._nextNode(),i&&!i.isVisible()&&(i=i.parent.showMore),i&&i instanceof v&&(i=_);var O=i&&(i._nextNode()||i.parent.append);O&&O.parent&&(a=this.editor.getDomSelection(),c=S.parent,l=c.childs[_.getIndex()+1]||c.append,h=S.getIndex(),d=O.getIndex(),u=c.getInternalPath(),p=O.parent.getInternalPath(),F.forEach(function(e){O.parent.moveBefore(e,O)}),this.focus(n.focusElement||this._getElementName(w)),this.editor._onAction("moveNodes",{count:F.length,fieldNames:F.map(o),oldParentPath:c.getInternalPath(),newParentPath:S.parent.getInternalPath(),oldParentPathRedo:u,newParentPathRedo:p,oldIndexRedo:h,newIndexRedo:d,oldIndex:l.getIndex(),newIndex:S.getIndex(),oldSelection:a,newSelection:this.editor.getDomSelection()})),E=!0}E&&(e.preventDefault(),e.stopPropagation())},n.prototype._onExpand=function(e){if(e){var t=this.dom.tr.parentNode,i=t.parentNode,n=i.scrollTop;i.removeChild(t)}this.expanded?this.collapse(e):this.expand(e),e&&(i.appendChild(t),i.scrollTop=n)},n.prototype._showColorPicker=function(){if("function"==typeof this.editor.options.onColorPicker&&this.dom.color){var e=this;e._deleteDomColor(),e.updateDom();var t=l(this.dom.color,this.editor.frame);this.editor.options.onColorPicker(t,this.value,function(t){"string"==typeof t&&t!==e.value&&(e._deleteDomColor(),e.value=t,e.updateDom(),e._debouncedOnChangeValue())})}},n.onRemove=function(e){if(!Array.isArray(e))return n.onRemove([e]);if(e&&e.length>0){var t=e[0],i=t.parent,o=t.editor,s=t.getIndex();o.highlighter.unhighlight();var a=o.getDomSelection();n.blurNodes(e);var l=o.getDomSelection(),c=e.map(r);e.forEach(function(e){e.parent._remove(e)}),o._onAction("removeNodes",{nodes:e,paths:c,parentPath:i.getInternalPath(),index:s,oldSelection:a,newSelection:l})}},n.onDuplicate=function(e){if(!Array.isArray(e))return n.onDuplicate([e]);if(e&&e.length>0){var t=e[e.length-1],i=t.parent,o=t.editor;o.deselect(o.multiselection.nodes);var s=o.getDomSelection(),a=t,l=e.map(function(e){var t=e.clone();return i.insertAfter(t,a),a=t,t});1===e.length?l[0].focus():o.select(l);var c=o.getDomSelection();o._onAction("duplicateNodes",{paths:e.map(r),clonePaths:l.map(r),afterPath:t.getInternalPath(),parentPath:i.getInternalPath(),oldSelection:s,newSelection:c})}},n.prototype._onInsertBefore=function(e,t,i){var r=this.editor.getDomSelection(),o=new n(this.editor,{field:void 0!=e?e:"",value:void 0!=t?t:"",type:i});o.expand(!0);var s=this.getInternalPath();this.parent.insertBefore(o,this),this.editor.highlighter.unhighlight(),o.focus("field");var a=this.editor.getDomSelection();this.editor._onAction("insertBeforeNodes",{nodes:[o],paths:[o.getInternalPath()],beforePath:s,parentPath:this.parent.getInternalPath(),oldSelection:r,newSelection:a})},n.prototype._onInsertAfter=function(e,t,i){var r=this.editor.getDomSelection(),o=new n(this.editor,{field:void 0!=e?e:"",value:void 0!=t?t:"",type:i});o.expand(!0),this.parent.insertAfter(o,this),this.editor.highlighter.unhighlight(),o.focus("field");var s=this.editor.getDomSelection();this.editor._onAction("insertAfterNodes",{nodes:[o],paths:[o.getInternalPath()],afterPath:this.getInternalPath(),parentPath:this.parent.getInternalPath(),oldSelection:r,newSelection:s})},n.prototype._onAppend=function(e,t,i){var r=this.editor.getDomSelection(),o=new n(this.editor,{field:void 0!=e?e:"",value:void 0!=t?t:"",type:i});o.expand(!0),this.parent.appendChild(o),this.editor.highlighter.unhighlight(),o.focus("field");var s=this.editor.getDomSelection();this.editor._onAction("appendNodes",{nodes:[o],paths:[o.getInternalPath()],parentPath:this.parent.getInternalPath(),oldSelection:r,newSelection:s})},n.prototype._onChangeType=function(e){var t=this.type;if(e!=t){var i=this.editor.getDomSelection();this.changeType(e);var n=this.editor.getDomSelection();this.editor._onAction("changeType",{path:this.getInternalPath(),oldType:t,newType:e,oldSelection:i,newSelection:n})}},n.prototype.sort=function(e,t){if(this._hasChilds()){this.hideChilds();var i=this.childs;this.childs=this.childs.concat();var n="desc"===t?-1:1;"object"===this.type?this.childs.sort(function(e,t){return n*a(e.field,t.field)}):this.childs.sort(function(t,i){var r=t.getNestedChild(e),o=i.getNestedChild(e);if(!r)return n;if(!o)return-n;var s=r.value,l=o.value;return"string"!=typeof s&&"string"!=typeof l?s>l?n:s/g,">").replace(/ /g,"  ").replace(/^ /," ").replace(/ $/," "),i=JSON.stringify(t),n=i.substring(1,i.length-1);return!0===this.editor.options.escapeUnicode&&(n=f.escapeUnicodeChars(n)),n},n.prototype._unescapeHTML=function(e){var t='"'+this._escapeJSON(e)+'"';return f.parse(t).replace(/</g,"<").replace(/>/g,">").replace(/ |\u00A0/g," ").replace(/&/g,"&")},n.prototype._escapeJSON=function(e){for(var t="",i=0;i="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e}function a(e){return e>="0"&&e<="9"||"-"===e}function l(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"_"===e}function c(){}function h(){}function d(e){this.runtime=e}function u(e){this._interpreter=e,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[v]}]},avg:{_func:this._functionAvg,_signature:[{types:[E]}]},ceil:{_func:this._functionCeil,_signature:[{types:[v]}]},contains:{_func:this._functionContains,_signature:[{types:[w,b]},{types:[y]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[w]},{types:[w]}]},floor:{_func:this._functionFloor,_signature:[{types:[v]}]},length:{_func:this._functionLength,_signature:[{types:[w,b,C]}]},map:{_func:this._functionMap,_signature:[{types:[A]},{types:[b]}]},max:{_func:this._functionMax,_signature:[{types:[E,x]}]},merge:{_func:this._functionMerge,_signature:[{types:[C],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[b]},{types:[A]}]},sum:{_func:this._functionSum,_signature:[{types:[E]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[w]},{types:[w]}]},min:{_func:this._functionMin,_signature:[{types:[E,x]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[b]},{types:[A]}]},type:{_func:this._functionType,_signature:[{types:[y]}]},keys:{_func:this._functionKeys,_signature:[{types:[C]}]},values:{_func:this._functionValues,_signature:[{types:[C]}]},sort:{_func:this._functionSort,_signature:[{types:[x,E]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[b]},{types:[A]}]},join:{_func:this._functionJoin,_signature:[{types:[w]},{types:[x]}]},reverse:{_func:this._functionReverse,_signature:[{types:[w,b]}]},to_array:{_func:this._functionToArray,_signature:[{types:[y]}]},to_string:{_func:this._functionToString,_signature:[{types:[y]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[y]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[y],variadic:!0}]}}}function p(e){return(new h).parse(e)}function f(e){return(new c).tokenize(e)}function m(e,t){var i=new h,n=new u,r=new d(n);n._interpreter=r;var o=i.parse(t);return r.search(o,e)}var g;g="function"==typeof String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.match(/^\s*(.*)/)[1]};var v=0,y=1,w=2,b=3,C=4,A=6,E=8,x=9,F={".":"Dot","*":"Star",",":"Comma",":":"Colon","{":"Lbrace","}":"Rbrace","]":"Rbracket","(":"Lparen",")":"Rparen","@":"Current"},S={"<":!0,">":!0,"=":!0,"!":!0},_={" ":!0,"\t":!0,"\n":!0};c.prototype={tokenize:function(e){var t=[];this._current=0;for(var i,n,r;this._current"===i?"="===e[this._current]?(this._current++,{type:"GTE",value:">=",start:t}):{type:"GT",value:">",start:t}:"="===i&&"="===e[this._current]?(this._current++,{type:"EQ",value:"==",start:t}):void 0},_consumeLiteral:function(e){this._current++;for(var t,i=this._current,n=e.length;"`"!==e[this._current]&&this._current=0)return!0;if(i.indexOf(e)>=0)return!0;if(!(n.indexOf(e[0])>=0))return!1;try{return JSON.parse(e),!0}catch(e){return!1}}};var k={};k.EOF=0,k.UnquotedIdentifier=0,k.QuotedIdentifier=0,k.Rbracket=0,k.Rparen=0,k.Comma=0,k.Rbrace=0,k.Number=0,k.Current=0,k.Expref=0,k.Pipe=1,k.Or=2,k.And=3,k.EQ=5,k.GT=5,k.LT=5,k.GTE=5,k.LTE=5,k.NE=5,k.Flatten=9,k.Star=20,k.Filter=21,k.Dot=40,k.Not=45,k.Lbrace=50,k.Lbracket=55,k.Lparen=60,h.prototype={parse:function(e){this._loadTokens(e),this.index=0;var t=this.expression(0);if("EOF"!==this._lookahead(0)){var i=this._lookaheadToken(0),n=new Error("Unexpected token type: "+i.type+", value: "+i.value);throw n.name="ParserError",n}return t},_loadTokens:function(e){var t=new c,i=t.tokenize(e);i.push({type:"EOF",value:"",start:e.length}),this.tokens=i},expression:function(e){var t=this._lookaheadToken(0);this._advance();for(var i=this.nud(t),n=this._lookahead(0);e=0?this.expression(e):"Lbracket"===t?(this._match("Lbracket"),this._parseMultiselectList()):"Lbrace"===t?(this._match("Lbrace"),this._parseMultiselectHash()):void 0},_parseProjectionRHS:function(e){var t;if(k[this._lookahead(0)]<10)t={type:"Identity"};else if("Lbracket"===this._lookahead(0))t=this.expression(e);else if("Filter"===this._lookahead(0))t=this.expression(e);else{if("Dot"!==this._lookahead(0)){var i=this._lookaheadToken(0),n=new Error("Sytanx error, unexpected token: "+i.value+"("+i.type+")");throw n.name="ParserError",n}this._match("Dot"),t=this._parseDotRHS(e)}return t},_parseMultiselectList:function(){for(var e=[];"Rbracket"!==this._lookahead(0);){var t=this.expression(0);if(e.push(t),"Comma"===this._lookahead(0)&&(this._match("Comma"),"Rbracket"===this._lookahead(0)))throw new Error("Unexpected token Rbracket")}return this._match("Rbracket"),{type:"MultiSelectList",children:e}},_parseMultiselectHash:function(){for(var e,t,i,n,r=[],o=["UnquotedIdentifier","QuotedIdentifier"];;){if(e=this._lookaheadToken(0),o.indexOf(e.type)<0)throw new Error("Expecting an identifier token, got: "+e.type);if(t=e.value,this._advance(),this._match("Colon"),i=this.expression(0),n={type:"KeyValuePair",name:t,value:i},r.push(n),"Comma"===this._lookahead(0))this._match("Comma");else if("Rbrace"===this._lookahead(0)){this._match("Rbrace");break}}return{type:"MultiSelectHash",children:r}}},d.prototype={search:function(e,t){return this.visit(e,t)},visit:function(e,s){var a,l,c,h,d,u,p,f,m;switch(e.type){case"Field":return null===s?null:i(s)?(u=s[e.name],void 0===u?null:u):null;case"Subexpression":for(c=this.visit(e.children[0],s),m=1;m0)for(m=w;mb;m+=C)c.push(s[m]);return c;case"Projection":var A=this.visit(e.children[0],s);if(!t(A))return null;for(f=[],m=0;md;break;case"GTE":c=h>=d;break;case"LT":c=h=e&&(t=i<0?e-1:e),t}},u.prototype={callFunction:function(e,t){var i=this.functionTable[e];if(void 0===i)throw new Error("Unknown function: "+e+"()");return this._validateArgs(e,t,i._signature),i._func.call(this,t)},_validateArgs:function(e,t,i){var n;if(i[i.length-1].variadic){if(t.length=0;n--)i+=t[n];return i}var r=e[0].slice(0);return r.reverse(),r},_functionAbs:function(e){return Math.abs(e[0])},_functionCeil:function(e){return Math.ceil(e[0])},_functionAvg:function(e){for(var t=0,i=e[0],n=0;n=0},_functionFloor:function(e){return Math.floor(e[0])},_functionLength:function(e){return i(e[0])?Object.keys(e[0]).length:e[0].length},_functionMap:function(e){for(var t=[],i=this._interpreter,n=e[0],r=e[1],o=0;o0){if(this._getTypeName(e[0][0])===v)return Math.max.apply(Math,e[0]);for(var t=e[0],i=t[0],n=1;n0){if(this._getTypeName(e[0][0])===v)return Math.min.apply(Math,e[0]);for(var t=e[0],i=t[0],n=1;na?1:ss&&(s=i,t=r[a]);return t},_functionMinBy:function(e){for(var t,i,n=e[1],r=e[0],o=this.createKeyFunction(n,[v,w]),s=1/0,a=0;am)return 1}for(var g=0,v=Math.max(u.length,p.length);gr)return 1}return 0}},function(e,t,i){"use strict";function n(e){function t(e){this.editor=e,this.dom={}}return t.prototype=new e,t.prototype.getDom=function(){var e=this.dom;if(e.tr)return e.tr;this._updateEditability();var t=document.createElement("tr");if(t.className="jsoneditor-append",t.node=this,e.tr=t,"tree"===this.editor.options.mode){e.tdDrag=document.createElement("td");var i=document.createElement("td");e.tdMenu=i;var n=document.createElement("button");n.type="button",n.className="jsoneditor-button jsoneditor-contextmenu",n.title="Click to open the actions menu (Ctrl+M)",e.menu=n,i.appendChild(e.menu)}var r=document.createElement("td"),o=document.createElement("div");return o.innerHTML="("+s("empty")+")",o.className="jsoneditor-readonly",r.appendChild(o),e.td=r,e.text=o,this.updateDom(),t},t.prototype.getPath=function(){return null},t.prototype.getIndex=function(){return null},t.prototype.updateDom=function(e){var t=this.dom,i=t.td;i&&(i.style.paddingLeft=24*this.getLevel()+26+"px");var n=t.text;n&&(n.innerHTML="("+s("empty")+" "+this.parent.type+")");var r=t.tr;this.isVisible()?t.tr.firstChild||(t.tdDrag&&r.appendChild(t.tdDrag),t.tdMenu&&r.appendChild(t.tdMenu),r.appendChild(i)):t.tr.firstChild&&(t.tdDrag&&r.removeChild(t.tdDrag),t.tdMenu&&r.removeChild(t.tdMenu),r.removeChild(i))},t.prototype.isVisible=function(){return 0==this.parent.childs.length},t.prototype.showContextMenu=function(t,i){var n=this,r=e.TYPE_TITLES,a=[{text:s("auto"),className:"jsoneditor-type-auto",title:r.auto,click:function(){n._onAppend("","","auto")}},{text:s("array"),className:"jsoneditor-type-array",title:r.array,click:function(){n._onAppend("",[])}},{text:s("object"),className:"jsoneditor-type-object",title:r.object,click:function(){n._onAppend("",{})}},{text:s("string"),className:"jsoneditor-type-string",title:r.string,click:function(){n._onAppend("","","string")}}];n.addTemplates(a,!0);var l=[{text:s("appendText"),title:s("appendTitleAuto"),submenuTitle:s("appendSubmenuTitle"),className:"jsoneditor-insert",click:function(){n._onAppend("","","auto")},submenu:a}];this.editor.options.onCreateMenu&&(l=this.editor.options.onCreateMenu(l,{path:n.getPath()})),new o(l,{close:i}).show(t,this.editor.content)},t.prototype.onEvent=function(e){var t=e.type,i=e.target||e.srcElement,n=this.dom;if(i==n.menu&&("mouseover"==t?this.editor.highlighter.highlight(this.parent):"mouseout"==t&&this.editor.highlighter.unhighlight()),"click"==t&&i==n.menu){var o=this.editor.highlighter;o.highlight(this.parent),o.lock(),r.addClassName(n.menu,"jsoneditor-selected"),this.showContextMenu(n.menu,function(){r.removeClassName(n.menu,"jsoneditor-selected"),o.unlock(),o.unhighlight()})}"keydown"==t&&this.onKeyDown(e)},t}var r=i(65),o=i(63),s=i(69).translate;e.exports=n},function(e,t,i){"use strict";function n(e){function t(e,t){this.editor=e,this.parent=t,this.dom={}}return t.prototype=new e,t.prototype.getDom=function(){if(this.dom.tr)return this.dom.tr;if(this._updateEditability(),!this.dom.tr){var e=this,t=this.parent,i=document.createElement("a");i.appendChild(document.createTextNode(r("showMore"))),i.href="#",i.onclick=function(i){return t.visibleChilds=Math.floor(t.visibleChilds/t.getMaxVisibleChilds()+1)*t.getMaxVisibleChilds(),e.updateDom(),t.showChilds(),i.preventDefault(),!1};var n=document.createElement("a");n.appendChild(document.createTextNode(r("showAll"))),n.href="#",n.onclick=function(i){return t.visibleChilds=1/0,e.updateDom(),t.showChilds(),i.preventDefault(),!1};var o=document.createElement("div"),s=document.createTextNode(this._getShowMoreText());o.className="jsoneditor-show-more",o.appendChild(s),o.appendChild(i),o.appendChild(document.createTextNode(". ")),o.appendChild(n),o.appendChild(document.createTextNode(". "));var a=document.createElement("td");a.appendChild(o);var l=document.createElement("tr");"tree"===this.editor.options.mode&&(l.appendChild(document.createElement("td")),l.appendChild(document.createElement("td"))),l.appendChild(a),l.className="jsoneditor-show-more",this.dom.tr=l,this.dom.moreContents=o,this.dom.moreText=s}return this.updateDom(),this.dom.tr},t.prototype.updateDom=function(e){if(this.isVisible()){if(this.dom.tr.node=this.parent.childs[this.parent.visibleChilds],!this.dom.tr.parentNode){var t=this.parent._getNextTr();t&&t.parentNode.insertBefore(this.dom.tr,t)}this.dom.moreText.nodeValue=this._getShowMoreText(),this.dom.moreContents.style.marginLeft=24*(this.getLevel()+1)+"px"}else this.dom.tr&&this.dom.tr.parentNode&&this.dom.tr.parentNode.removeChild(this.dom.tr)},t.prototype._getShowMoreText=function(){return r("showMoreStatus",{visibleChilds:this.parent.visibleChilds,totalChilds:this.parent.childs.length})+" "},t.prototype.isVisible=function(){return this.parent.expanded&&this.parent.childs.length>this.parent.visibleChilds},t.prototype.onEvent=function(e){"keydown"===e.type&&this.onKeyDown(e)},t}var r=i(69).translate;e.exports=n},function(e,t,i){function n(e,t){var i='
'+o("sort")+"
"+o("sortFieldLabel")+'
'+o("sortDirectionLabel")+'
';r({parent:t,content:i,overlayClass:"jsoneditor-modal-overlay",modalClass:"jsoneditor-modal jsoneditor-modal-sort"}).afterCreate(function(t){function i(e){s.value=e,s.className="jsoneditor-button-group jsoneditor-button-group-value-"+s.value}var n=t.modalElem().querySelector("form"),r=t.modalElem().querySelector("#ok"),o=t.modalElem().querySelector("#field"),s=t.modalElem().querySelector("#direction"),a="array"===e.type?e.getChildPaths():["."];a.forEach(function(e){var t=document.createElement("option");t.text=e,t.value=e,o.appendChild(t)}),o.value=e.sortedBy?e.sortedBy.path:a[0],i(e.sortedBy?e.sortedBy.direction:"asc"),s.onclick=function(e){i(e.target.getAttribute("data-value"))},r.onclick=function(i){i.preventDefault(),i.stopPropagation(),t.close();var n=o.value,r="."===n?[]:n.split(".").slice(1);e.sortedBy={path:n,direction:s.value},e.sort(r,s.value)},n&&(n.onsubmit=r.onclick)}).afterClose(function(e){e.destroy()}).show()}var r=i(77),o=i(69).translate;e.exports=n},function(e,t,i){var n,r,o;!function(i,s){"use strict";r=[],n=s,void 0!==(o="function"==typeof n?n.apply(t,r):n)&&(e.exports=o)}(0,function(){"use strict";function e(e){return"object"==typeof Node?e instanceof Node:e&&"object"==typeof e&&"number"==typeof e.nodeType}function t(e){return"string"==typeof e}function i(){var e=[];return{watch:e.push.bind(e),trigger:function(t,i){for(var n=!0,r={detail:i,preventDefault:function(){n=!1}},o=0;o
'+a("transform")+'

Enter a JMESPath query to filter, sort, or transform the JSON data.
To learn JMESPath, go to the interactive tutorial.

'+a("transformWizardLabel")+'
'+a("transformWizardFilter")+'
'+a("transformWizardSortBy")+'
'+a("transformWizardSelectFields")+'
'+a("transformQueryLabel")+'
'+a("transformPreviewLabel")+'
';o({parent:t,content:n,overlayClass:"jsoneditor-modal-overlay",modalClass:"jsoneditor-modal jsoneditor-modal-transform",focus:!1}).afterCreate(function(t){function n(e){return"."===e[0]?"."===e?"@":e.slice(1):e}function o(){if(p.value&&f.value&&m.value){var t=p.value,i=JSON.stringify(e._stringCast(m.value));w.value="[? "+t+" "+f.value+" `"+i+"`]"}else w.value="[*]";if(g.value&&v.value){var n=g.value;"desc"===v.value?w.value+=" | reverse(sort_by(@, &"+n+"))":w.value+=" | sort_by(@, &"+n+")"}if(y.value){for(var r=[],o=0;o1&&(w.value+=".{"+r.map(function(e){var t=e.split(".");return t[t.length-1]+": "+e}).join(", ")+"}")}_()}function a(){try{var e=r.search(i,w.value),t=JSON.stringify(e,null,2).split("\n");t.length>c&&(t=t.slice(0,c).concat(["..."])),b.className="jsoneditor-transform-preview",b.value=t.join("\n"),u.disabled=!1}catch(e){b.className="jsoneditor-transform-preview jsoneditor-error",b.value=e.toString(),u.disabled=!0}}var h=t.modalElem(),d=h.querySelector("#wizard"),u=h.querySelector("#ok"),p=h.querySelector("#filterField"),f=h.querySelector("#filterRelation"),m=h.querySelector("#filterValue"),g=h.querySelector("#sortField"),v=h.querySelector("#sortOrder"),y=h.querySelector("#selectFields"),w=h.querySelector("#query"),b=h.querySelector("#preview");Array.isArray(i)||(d.style.display="none",d.parentNode.style.fontStyle="italic",d.parentNode.appendChild(document.createTextNode("(wizard not available for objects, only for arrays)"))),e.getChildPaths().forEach(function(e){var t=n(e),i=document.createElement("option");i.text=t,i.value=t,p.appendChild(i);var r=document.createElement("option");r.text=t,r.value=t,g.appendChild(r)});var C=e.getChildPaths(!0).filter(function(e){return"."!==e});C.length>0?C.forEach(function(e){var t=n(e),i=document.createElement("option");i.text=t,i.value=t,y.appendChild(i)}):h.querySelector("#selectFieldsPart").style.display="none";var A=new s(p,{defaultSelected:!1,clearable:!0,allowDeselect:!0,placeholder:"field..."}),E=new s(f,{defaultSelected:!1,clearable:!0,allowDeselect:!0,placeholder:"compare..."}),x=new s(g,{defaultSelected:!1,clearable:!0,allowDeselect:!0,placeholder:"field..."}),F=new s(v,{defaultSelected:!1,clearable:!0,allowDeselect:!0,placeholder:"order..."}),S=new s(y,{multiple:!0,clearable:!0,defaultSelected:!1});A.on("selectr.change",o),E.on("selectr.change",o),m.oninput=o,x.on("selectr.change",o),F.on("selectr.change",o),S.on("selectr.change",o),h.querySelector(".pico-modal-contents").onclick=function(e){e.preventDefault()},w.value=Array.isArray(i)?"[*]":"@";var _=l(a,300);w.oninput=_,_(),u.onclick=function(i){i.preventDefault(),i.stopPropagation(),t.close(),e.transform(w.value)},setTimeout(function(){w.select(),w.focus(),w.selectionStart=3,w.selectionEnd=3})}).afterClose(function(e){e.destroy()}).show()}var r=i(72),o=i(77),s=i(79),a=i(69).translate,l=i(65).debounce,c=100;e.exports=n},function(e,t){"use strict";function i(e,t){return e.hasOwnProperty(t)&&(!0===e[t]||e[t].length)}function n(e,t,i){e.parentNode?e.parentNode.parentNode||t.appendChild(e.parentNode):t.appendChild(e),s.removeClass(e,"excluded"),i||(e.innerHTML=e.textContent)}var r={defaultSelected:!0,width:"auto",disabled:!1,searchable:!0,clearable:!1,sortSelected:!1,allowDeselect:!1,closeOnScroll:!1,nativeDropdown:!1,placeholder:"Select an option...",taggable:!1,tagPlaceholder:"Enter a tag..."},o=function(){};o.prototype={on:function(e,t){this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(t)},off:function(e,t){this._events=this._events||{},e in this._events!=!1&&this._events[e].splice(this._events[e].indexOf(t),1)},emit:function(e){if(this._events=this._events||{},e in this._events!=!1)for(var t=0;t-1},truncate:function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}},a=function(){if(this.items.length){var e=document.createDocumentFragment();if(this.config.pagination){var t=this.pages.slice(0,this.pageIndex);s.each(t,function(t,i){s.each(i,function(t,i){n(i,e,this.customOption)},this)},this)}else s.each(this.items,function(t,i){n(i,e,this.customOption)},this);e.childElementCount&&(s.removeClass(this.items[this.navIndex],"active"),this.navIndex=e.querySelector(".selectr-option").idx,s.addClass(this.items[this.navIndex],"active")),this.tree.appendChild(e)}},l=function(e){var t=e.target;this.container.contains(t)||!this.opened&&!s.hasClass(this.container,"notice")||this.close()},c=function(e,t){t=t||e;var i=this.customOption?this.config.renderOption(t):e.textContent,n=s.createElement("li",{class:"selectr-option",html:i,role:"treeitem","aria-selected":!1});return n.idx=e.idx,this.items.push(n),e.defaultSelected&&this.defaultSelected.push(e.idx),e.disabled&&(n.disabled=!0,s.addClass(n,"disabled")),n},h=function(){this.requiresPagination=this.config.pagination&&this.config.pagination>0,i(this.config,"width")&&(s.isInt(this.config.width)?this.width=this.config.width+"px":"auto"===this.config.width?this.width="100%":s.includes(this.config.width,"%")&&(this.width=this.config.width)),this.container=s.createElement("div",{class:"selectr-container"}),this.config.customClass&&s.addClass(this.container,this.config.customClass),this.mobileDevice?s.addClass(this.container,"selectr-mobile"):s.addClass(this.container,"selectr-desktop"),this.el.tabIndex=-1,this.config.nativeDropdown||this.mobileDevice?s.addClass(this.el,"selectr-visible"):s.addClass(this.el,"selectr-hidden"),this.selected=s.createElement("div",{class:"selectr-selected",disabled:this.disabled,tabIndex:1,"aria-expanded":!1}),this.label=s.createElement(this.el.multiple?"ul":"span",{class:"selectr-label"});var e=s.createElement("div",{class:"selectr-options-container"});if(this.tree=s.createElement("ul",{class:"selectr-options",role:"tree","aria-hidden":!0,"aria-expanded":!1}),this.notice=s.createElement("div",{class:"selectr-notice"}),this.el.setAttribute("aria-hidden",!0),this.disabled&&(this.el.disabled=!0),this.el.multiple&&(s.addClass(this.label,"selectr-tags"),s.addClass(this.container,"multiple"),this.tags=[],this.selectedValues=this.getSelectedProperties("value"),this.selectedIndexes=this.getSelectedProperties("idx")),this.selected.appendChild(this.label),this.config.clearable&&(this.selectClear=s.createElement("button",{class:"selectr-clear",type:"button"}),this.container.appendChild(this.selectClear),s.addClass(this.container,"clearable")),this.config.taggable){var t=s.createElement("li",{class:"input-tag"});this.input=s.createElement("input",{class:"selectr-tag-input",placeholder:this.config.tagPlaceholder,tagIndex:0,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",role:"textbox",type:"search"}),t.appendChild(this.input),this.label.appendChild(t),s.addClass(this.container,"taggable"),this.tagSeperators=[","],this.config.tagSeperators&&(this.tagSeperators=this.tagSeperators.concat(this.config.tagSeperators))}this.config.searchable&&(this.input=s.createElement("input",{class:"selectr-input",tagIndex:-1,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",role:"textbox",type:"search"}),this.inputClear=s.createElement("button",{class:"selectr-input-clear",type:"button"}),this.inputContainer=s.createElement("div",{class:"selectr-input-container"}),this.inputContainer.appendChild(this.input),this.inputContainer.appendChild(this.inputClear),e.appendChild(this.inputContainer)),e.appendChild(this.notice),e.appendChild(this.tree),this.items=[],this.options=[],this.el.options.length&&(this.options=[].slice.call(this.el.options));var n=!1,r=0;if(this.el.children.length&&s.each(this.el.children,function(e,t){"OPTGROUP"===t.nodeName?(n=s.createElement("ul",{class:"selectr-optgroup",role:"group",html:"
  • "+t.label+"
  • "}),s.each(t.children,function(e,t){t.idx=r,n.appendChild(c.call(this,t,n)),r++},this)):(t.idx=r,c.call(this,t),r++)},this),this.config.data&&Array.isArray(this.config.data)){this.data=[];var o,a=!1;n=!1,r=0,s.each(this.config.data,function(e,t){i(t,"children")?(a=s.createElement("optgroup",{label:t.text}),n=s.createElement("ul",{class:"selectr-optgroup",role:"group",html:"
  • "+t.text+"
  • "}),s.each(t.children,function(e,t){o=new Option(t.text,t.value,!1,t.hasOwnProperty("selected")&&!0===t.selected),o.disabled=i(t,"disabled"),this.options.push(o),a.appendChild(o),o.idx=r,n.appendChild(c.call(this,o,t)),this.data[r]=t,r++},this)):(o=new Option(t.text,t.value,!1,t.hasOwnProperty("selected")&&!0===t.selected),o.disabled=i(t,"disabled"),this.options.push(o),o.idx=r,c.call(this,o,t),this.data[r]=t,r++)},this)}this.setSelected(!0);var l;this.navIndex=0;for(var h=0;h0)&&this.change(this.navIndex);var t,i=this.items[this.navIndex];switch(e.which){case 38:t=0,this.navIndex>0&&this.navIndex--;break;case 40:t=1,this.navIndexthis.tree.lastElementChild.idx){this.navIndex=this.tree.lastElementChild.idx;break}if(this.navIndexthis.optsRect.top+this.optsRect.height&&(this.tree.scrollTop=this.tree.scrollTop+(n.top+n.height-(this.optsRect.top+this.optsRect.height))),this.navIndex===this.tree.childElementCount-1&&this.requiresPagination&&f.call(this)):0===this.navIndex?this.tree.scrollTop=0:n.top-this.optsRect.top<0&&(this.tree.scrollTop=this.tree.scrollTop+(n.top-this.optsRect.top)),i&&s.removeClass(i,"active"),s.addClass(this.items[this.navIndex],"active")},u=function(e){var t,i=this,n=document.createDocumentFragment(),r=this.options[e.idx],o=this.data?this.data[e.idx]:r,a=this.customSelected?this.config.renderSelection(o):r.textContent,l=s.createElement("li",{class:"selectr-tag",html:a}),c=s.createElement("button",{class:"selectr-tag-remove",type:"button"});if(l.appendChild(c),l.idx=e.idx,l.tag=r.value,this.tags.push(l),this.config.sortSelected){var h=this.tags.slice();t=function(e,t){e.replace(/(\d+)|(\D+)/g,function(e,i,n){t.push([i||1/0,n||""])})},h.sort(function(e,n){var r,o,s=[],a=[];for(!0===i.config.sortSelected?(r=e.tag,o=n.tag):"text"===i.config.sortSelected&&(r=e.textContent,o=n.textContent),t(r,s),t(o,a);s.length&&a.length;){var l=s.shift(),c=a.shift(),h=l[0]-c[0]||l[1].localeCompare(c[1]);if(h)return h}return s.length-a.length}),s.each(h,function(e,t){n.appendChild(t)}),this.label.innerHTML=""}else n.appendChild(l);this.config.taggable?this.label.insertBefore(n,this.input.parentNode):this.label.appendChild(n)},p=function(e){var t=!1;s.each(this.tags,function(i,n){n.idx===e.idx&&(t=n)},this),t&&(this.label.removeChild(t),this.tags.splice(this.tags.indexOf(t),1))},f=function(){var e=this.tree;if(e.scrollTop>=e.scrollHeight-e.offsetHeight&&this.pageIndex"+i[0]+"")},v=function(e,t){if(t=t||{},!e)throw new Error("You must supply either a HTMLSelectElement or a CSS3 selector string.");if(this.el=e,"string"==typeof e&&(this.el=document.querySelector(e)),null===this.el)throw new Error("The element you passed to Selectr can not be found.");if("select"!==this.el.nodeName.toLowerCase())throw new Error("The element you passed to Selectr is not a HTMLSelectElement.");this.render(t)};v.prototype.render=function(e){if(!this.rendered){this.config=s.extend(r,e),this.originalType=this.el.type,this.originalIndex=this.el.tabIndex,this.defaultSelected=[],this.originalOptionCount=this.el.options.length,(this.config.multiple||this.config.taggable)&&(this.el.multiple=!0),this.disabled=i(this.config,"disabled"),this.opened=!1,this.config.taggable&&(this.config.searchable=!1),this.navigating=!1,this.mobileDevice=!1,/Android|webOS|iPhone|iPad|BlackBerry|Windows Phone|Opera Mini|IEMobile|Mobile/i.test(navigator.userAgent)&&(this.mobileDevice=!0),this.customOption=this.config.hasOwnProperty("renderOption")&&"function"==typeof this.config.renderOption,this.customSelected=this.config.hasOwnProperty("renderSelection")&&"function"==typeof this.config.renderSelection,o.mixin(this),h.call(this),this.bindEvents(),this.update(),this.optsRect=s.rect(this.tree),this.rendered=!0,this.el.multiple||(this.el.selectedIndex=this.selectedIndex);var t=this;setTimeout(function(){t.emit("selectr.init")},20)}},v.prototype.getSelected=function(){return this.el.querySelectorAll("option:checked")},v.prototype.getSelectedProperties=function(e){var t=this.getSelected();return[].slice.call(t).map(function(t){return t[e]}).filter(function(e){return null!==e&&void 0!==e})},v.prototype.bindEvents=function(){var e=this;if(this.events={},this.events.dismiss=l.bind(this),this.events.navigate=d.bind(this),this.events.reset=this.reset.bind(this),this.config.nativeDropdown||this.mobileDevice){this.container.addEventListener("touchstart",function(t){t.changedTouches[0].target===e.el&&e.toggle()}),(this.config.nativeDropdown||this.mobileDevice)&&this.container.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation(),t.target===e.el&&e.toggle()});var t=function(e,t){for(var i,n=[],r=e.slice(0),o=0;o-1?r.splice(i,1):n.push(t[o]);return[n,r]};this.el.addEventListener("change",function(i){if(e.el.multiple){var n=e.getSelectedProperties("idx"),r=t(e.selectedIndexes,n);s.each(r[0],function(t,i){e.select(i)},e),s.each(r[1],function(t,i){e.deselect(i)},e)}else e.el.selectedIndex>-1&&e.select(e.el.selectedIndex)})}this.config.nativeDropdown&&this.container.addEventListener("keydown",function(t){"Enter"===t.key&&e.selected===document.activeElement&&(e.toggle(),setTimeout(function(){e.el.focus()},200))}),this.selected.addEventListener("click",function(t){e.disabled||e.toggle(),t.preventDefault(),t.stopPropagation()}),this.label.addEventListener("click",function(t){s.hasClass(t.target,"selectr-tag-remove")&&e.deselect(t.target.parentNode.idx)}),this.selectClear&&this.selectClear.addEventListener("click",this.clear.bind(this)),this.tree.addEventListener("mousedown",function(e){e.preventDefault()}),this.tree.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation();var i=s.closest(t.target,function(e){return e&&s.hasClass(e,"selectr-option")});i&&(s.hasClass(i,"disabled")||(s.hasClass(i,"selected")?(e.el.multiple||!e.el.multiple&&e.config.allowDeselect)&&e.deselect(i.idx):e.select(i.idx),e.opened&&!e.el.multiple&&e.close()))}),this.tree.addEventListener("mouseover",function(t){s.hasClass(t.target,"selectr-option")&&(s.hasClass(t.target,"disabled")||(s.removeClass(e.items[e.navIndex],"active"),s.addClass(t.target,"active"),e.navIndex=[].slice.call(e.items).indexOf(t.target)))}),this.config.searchable&&(this.input.addEventListener("focus",function(t){e.searching=!0}),this.input.addEventListener("blur",function(t){e.searching=!1}),this.input.addEventListener("keyup",function(t){e.search(),e.config.taggable||(this.value.length?s.addClass(this.parentNode,"active"):s.removeClass(this.parentNode,"active"))}),this.inputClear.addEventListener("click",function(t){e.input.value=null,m.call(e),e.tree.childElementCount||a.call(e)})),this.config.taggable&&this.input.addEventListener("keyup",function(t){if(e.search(),e.config.taggable&&this.value.length){var i=this.value.trim();if(13===t.which||s.includes(e.tagSeperators,t.key)){ -s.each(e.tagSeperators,function(e,t){i=i.replace(t,"")});e.add({value:i,text:i,selected:!0},!0)?(e.close(),m.call(e)):(this.value="",e.setMessage("That tag is already in use."))}}}),this.update=s.debounce(function(){e.opened&&e.config.closeOnScroll&&e.close(),e.width&&(e.container.style.width=e.width),e.invert()},50),this.requiresPagination&&(this.paginateItems=s.debounce(function(){f.call(this)},50),this.tree.addEventListener("scroll",this.paginateItems.bind(this))),document.addEventListener("click",this.events.dismiss),window.addEventListener("keydown",this.events.navigate),window.addEventListener("resize",this.update),window.addEventListener("scroll",this.update),this.el.form&&this.el.form.addEventListener("reset",this.events.reset)},v.prototype.setSelected=function(e){if(this.config.data||this.el.multiple||!this.el.options.length||(0===this.el.selectedIndex&&(this.el.options[0].defaultSelected||this.config.defaultSelected||(this.el.selectedIndex=-1)),this.selectedIndex=this.el.selectedIndex,this.selectedIndex>-1&&this.select(this.selectedIndex)),this.config.multiple&&"select-one"===this.originalType&&!this.config.data&&this.el.options[0].selected&&!this.el.options[0].defaultSelected&&(this.el.options[0].selected=!1),s.each(this.options,function(e,t){t.selected&&t.defaultSelected&&this.select(t.idx)},this),this.config.selectedValue&&this.setValue(this.config.selectedValue),this.config.data){!this.el.multiple&&this.config.defaultSelected&&this.el.selectedIndex<0&&this.select(0);var t=0;s.each(this.config.data,function(e,n){i(n,"children")?s.each(n.children,function(e,i){i.hasOwnProperty("selected")&&!0===i.selected&&this.select(t),t++},this):(n.hasOwnProperty("selected")&&!0===n.selected&&this.select(t),t++)},this)}},v.prototype.destroy=function(){this.rendered&&(this.emit("selectr.destroy"),"select-one"===this.originalType&&(this.el.multiple=!1),this.config.data&&(this.el.innerHTML=""),s.removeClass(this.el,"selectr-hidden"),this.el.form&&s.off(this.el.form,"reset",this.events.reset),s.off(document,"click",this.events.dismiss),s.off(document,"keydown",this.events.navigate),s.off(window,"resize",this.update),s.off(window,"scroll",this.update),this.container.parentNode.replaceChild(this.el,this.container),this.rendered=!1)},v.prototype.change=function(e){var t=this.items[e],i=this.options[e];i.disabled||(i.selected&&s.hasClass(t,"selected")?this.deselect(e):this.select(e),this.opened&&!this.el.multiple&&this.close())},v.prototype.select=function(e){var t=this.items[e],i=[].slice.call(this.el.options),n=this.options[e];if(this.el.multiple){if(s.includes(this.selectedIndexes,e))return!1;if(this.config.maxSelections&&this.tags.length===this.config.maxSelections)return this.setMessage("A maximum of "+this.config.maxSelections+" items can be selected.",!0),!1;this.selectedValues.push(n.value),this.selectedIndexes.push(e),u.call(this,t)}else{var r=this.data?this.data[e]:n;this.label.innerHTML=this.customSelected?this.config.renderSelection(r):n.textContent,this.selectedValue=n.value,this.selectedIndex=e,s.each(this.options,function(t,i){var n=this.items[t];t!==e&&(n&&s.removeClass(n,"selected"),i.selected=!1,i.removeAttribute("selected"))},this)}s.includes(i,n)||this.el.add(n),t.setAttribute("aria-selected",!0),s.addClass(t,"selected"),s.addClass(this.container,"has-selected"),n.selected=!0,n.setAttribute("selected",""),this.emit("selectr.change",n),this.emit("selectr.select",n)},v.prototype.deselect=function(e,t){var i=this.items[e],n=this.options[e];if(this.el.multiple){var r=this.selectedIndexes.indexOf(e);this.selectedIndexes.splice(r,1);var o=this.selectedValues.indexOf(n.value);this.selectedValues.splice(o,1),p.call(this,i),this.tags.length||s.removeClass(this.container,"has-selected")}else{if(!t&&!this.config.clearable&&!this.config.allowDeselect)return!1;this.label.innerHTML="",this.selectedValue=null,this.el.selectedIndex=this.selectedIndex=-1,s.removeClass(this.container,"has-selected")}this.items[e].setAttribute("aria-selected",!1),s.removeClass(this.items[e],"selected"),n.selected=!1,n.removeAttribute("selected"),this.emit("selectr.change",null),this.emit("selectr.deselect",n)},v.prototype.setValue=function(e){var t=Array.isArray(e);if(t||(e=e.toString().trim()),!this.el.multiple&&t)return!1;s.each(this.options,function(i,n){(t&&s.includes(e.toString(),n.value)||n.value===e)&&this.change(n.idx)},this)},v.prototype.getValue=function(e,t){var i;if(this.el.multiple)e?this.selectedIndexes.length&&(i={},i.values=[],s.each(this.selectedIndexes,function(e,t){var n=this.options[t];i.values[e]={value:n.value,text:n.textContent}},this)):i=this.selectedValues.slice();else if(e){var n=this.options[this.selectedIndex];i={value:n.value,text:n.textContent}}else i=this.selectedValue;return e&&t&&(i=JSON.stringify(i)),i},v.prototype.add=function(e,t){if(e){if(this.data=this.data||[],this.items=this.items||[],this.options=this.options||[],Array.isArray(e))s.each(e,function(e,i){this.add(i,t)},this);else if("[object Object]"===Object.prototype.toString.call(e)){if(t){var i=!1;if(s.each(this.options,function(t,n){n.value.toLowerCase()===e.value.toLowerCase()&&(i=!0)}),i)return!1}var n=s.createElement("option",e);return this.data.push(e),this.options.push(n),n.idx=this.options.length>0?this.options.length-1:0,c.call(this,n),e.selected&&this.select(n.idx),n}return this.setPlaceholder(),this.config.pagination&&this.paginate(),!0}},v.prototype.remove=function(e){var t=[];if(Array.isArray(e)?s.each(e,function(i,n){s.isInt(n)?t.push(this.getOptionByIndex(n)):"string"==typeof e&&t.push(this.getOptionByValue(n))},this):s.isInt(e)?t.push(this.getOptionByIndex(e)):"string"==typeof e&&t.push(this.getOptionByValue(e)),t.length){var i;s.each(t,function(e,t){i=t.idx,this.el.remove(t),this.options.splice(i,1);var n=this.items[i].parentNode;n&&n.removeChild(this.items[i]),this.items.splice(i,1),s.each(this.options,function(e,t){t.idx=e,this.items[e].idx=e},this)},this),this.setPlaceholder(),this.config.pagination&&this.paginate()}},v.prototype.removeAll=function(){this.clear(!0),s.each(this.el.options,function(e,t){this.el.remove(t)},this),s.truncate(this.tree),this.items=[],this.options=[],this.data=[],this.navIndex=0,this.requiresPagination&&(this.requiresPagination=!1,this.pageIndex=1,this.pages=[]),this.setPlaceholder()},v.prototype.search=function(e){if(!this.navigating){e=e||this.input.value;var t=document.createDocumentFragment();if(this.removeMessage(),s.truncate(this.tree),e.length>1)if(s.each(this.options,function(i,r){var o=this.items[r.idx];s.includes(r.textContent.toLowerCase(),e.toLowerCase())&&!r.disabled?(n(o,t,this.customOption),s.removeClass(o,"excluded"),this.customOption||(o.innerHTML=g(e,r))):s.addClass(o,"excluded")},this),t.childElementCount){var i=this.items[this.navIndex],r=t.firstElementChild;s.removeClass(i,"active"),this.navIndex=r.idx,s.addClass(r,"active")}else this.config.taggable||this.setMessage("no results.");else a.call(this);this.tree.appendChild(t)}},v.prototype.toggle=function(){this.disabled||(this.opened?this.close():this.open())},v.prototype.open=function(){var e=this;return!!this.options.length&&(this.opened||this.emit("selectr.open"),this.opened=!0,this.mobileDevice||this.config.nativeDropdown?(s.addClass(this.container,"native-open"),void(this.config.data&&s.each(this.options,function(e,t){this.el.add(t)},this))):(s.addClass(this.container,"open"),a.call(this),this.invert(),this.tree.scrollTop=0,s.removeClass(this.container,"notice"),this.selected.setAttribute("aria-expanded",!0),this.tree.setAttribute("aria-hidden",!1),this.tree.setAttribute("aria-expanded",!0),void(this.config.searchable&&!this.config.taggable&&setTimeout(function(){e.input.focus(),e.input.tabIndex=0},10))))},v.prototype.close=function(){if(this.opened&&this.emit("selectr.close"),this.opened=!1,this.mobileDevice||this.config.nativeDropdown)return void s.removeClass(this.container,"native-open");var e=s.hasClass(this.container,"notice");this.config.searchable&&!e&&(this.input.blur(),this.input.tabIndex=-1,this.searching=!1),e&&(s.removeClass(this.container,"notice"),this.notice.textContent=""),s.removeClass(this.container,"open"),s.removeClass(this.container,"native-open"),this.selected.setAttribute("aria-expanded",!1),this.tree.setAttribute("aria-hidden",!0),this.tree.setAttribute("aria-expanded",!1),s.truncate(this.tree),m.call(this)},v.prototype.enable=function(){this.disabled=!1,this.el.disabled=!1,this.selected.tabIndex=this.originalIndex,this.el.multiple&&s.each(this.tags,function(e,t){t.lastElementChild.tabIndex=0}),s.removeClass(this.container,"selectr-disabled")},v.prototype.disable=function(e){e||(this.el.disabled=!0),this.selected.tabIndex=-1,this.el.multiple&&s.each(this.tags,function(e,t){t.lastElementChild.tabIndex=-1}),this.disabled=!0,s.addClass(this.container,"selectr-disabled")},v.prototype.reset=function(){this.disabled||(this.clear(),this.setSelected(!0),s.each(this.defaultSelected,function(e,t){this.select(t)},this),this.emit("selectr.reset"))},v.prototype.clear=function(e){if(this.el.multiple){if(this.selectedIndexes.length){var t=this.selectedIndexes.slice();s.each(t,function(e,t){this.deselect(t)},this)}}else this.selectedIndex>-1&&this.deselect(this.selectedIndex,e);this.emit("selectr.clear")},v.prototype.serialise=function(e){var t=[];return s.each(this.options,function(e,i){var n={value:i.value,text:i.textContent};i.selected&&(n.selected=!0),i.disabled&&(n.disabled=!0),t[e]=n}),e?JSON.stringify(t):t},v.prototype.serialize=function(e){return this.serialise(e)},v.prototype.setPlaceholder=function(e){e=e||this.config.placeholder||this.el.getAttribute("placeholder"),this.options.length||(e="No options available"),this.placeEl.innerHTML=e},v.prototype.paginate=function(){if(this.items.length){var e=this;return this.pages=this.items.map(function(t,i){return i%e.config.pagination==0?e.items.slice(i,i+e.config.pagination):null}).filter(function(e){return e}),this.pages}},v.prototype.setMessage=function(e,t){t&&this.close(),s.addClass(this.container,"notice"),this.notice.textContent=e},v.prototype.removeMessage=function(){s.removeClass(this.container,"notice"),this.notice.innerHTML=""},v.prototype.invert=function(){var e=s.rect(this.selected),t=this.tree.parentNode.offsetHeight,i=window.innerHeight;e.top+e.height+t>i?(s.addClass(this.container,"inverted"),this.isInverted=!0):(s.removeClass(this.container,"inverted"),this.isInverted=!1),this.optsRect=s.rect(this.tree)},v.prototype.getOptionByIndex=function(e){return this.options[e]},v.prototype.getOptionByValue=function(e){for(var t=!1,i=0,n=this.options.length;i/g,">"),a.getBoundingClientRect().right}e=e||{},e.confirmKeys=e.confirmKeys||[39,35,9],e.caseSensitive=e.caseSensitive||!1;var n="",r="",o=document.createElement("div");o.style.position="relative",o.style.outline="0",o.style.border="0",o.style.margin="0",o.style.padding="0";var s=document.createElement("div");s.className="autocomplete dropdown",s.style.position="absolute",s.style.visibility="hidden";var a,l,c={onArrowDown:function(){},onArrowUp:function(){},onEnter:function(){},onTab:function(){},startFrom:0,options:[],element:null,elementHint:null,elementStyle:null,wrapper:o,show:function(e,t,i){this.startFrom=t,this.wrapper.remove(),this.elementHint&&(this.elementHint.remove(),this.elementHint=null),""==n&&(n=window.getComputedStyle(e).getPropertyValue("font-size")),""==r&&(r=window.getComputedStyle(e).getPropertyValue("font-family"));e.getBoundingClientRect().right,e.getBoundingClientRect().left;s.style.marginLeft="0",s.style.marginTop=e.getBoundingClientRect().height+"px",this.options=i,this.element!=e&&(this.element=e,this.elementStyle={zIndex:this.element.style.zIndex,position:this.element.style.position,backgroundColor:this.element.style.backgroundColor,borderColor:this.element.style.borderColor}),this.element.style.zIndex=3,this.element.style.position="relative",this.element.style.backgroundColor="transparent",this.element.style.borderColor="transparent",this.elementHint=e.cloneNode(),this.elementHint.className="autocomplete hint",this.elementHint.style.zIndex=2,this.elementHint.style.position="absolute",this.elementHint.onfocus=function(){this.element.focus()}.bind(this),this.element.addEventListener&&(this.element.removeEventListener("keydown",d),this.element.addEventListener("keydown",d,!1),this.element.removeEventListener("blur",u),this.element.addEventListener("blur",u,!1)),o.appendChild(this.elementHint),o.appendChild(s),e.parentElement.appendChild(o),this.repaint(e)},setText:function(e){this.element.innerText=e},getText:function(){return this.element.innerText},hideDropDown:function(){this.wrapper.remove(),this.elementHint&&(this.elementHint.remove(),this.elementHint=null,h.hide(),this.element.style.zIndex=this.elementStyle.zIndex,this.element.style.position=this.elementStyle.position,this.element.style.backgroundColor=this.elementStyle.backgroundColor,this.element.style.borderColor=this.elementStyle.borderColor)},repaint:function(t){var n=t.innerText;n=n.replace("\n","");var r=(this.startFrom,this.options,this.options.length),o=n.substring(this.startFrom);l=n.substring(0,this.startFrom);for(var a=0;a"+o[f].substring(i.length)+"",n.push(m),t.appendChild(m)}0!==n.length&&(1===n.length&&(i.toLowerCase()===n[0].__hint.toLowerCase()&&!e.caseSensitive||i===n[0].__hint&&e.caseSensitive)||n.length<2||(c.highlight(0),u>3*p?(t.style.maxHeight=u+"px",t.style.top="",t.style.bottom="100%"):(t.style.top="100%",t.style.bottom="",t.style.maxHeight=p+"px"),t.style.visibility="visible"))},highlight:function(e){-1!=o&&n[o]&&(n[o].className="item"),n[e].className="item hover",o=e},move:function(e){return"hidden"===t.style.visibility?"":r+e===-1||r+e===n.length?n[r].__hint:(r+=e,c.highlight(r),n[r].__hint)},onmouseselection:function(){}};return c}(s,c),d=function(i){i=i||window.event;var n=i.keyCode;if(null!=this.elementHint&&33!=n&&34!=n){if(27==n)return c.hideDropDown(),c.element.focus(),i.preventDefault(),void i.stopPropagation();var r=this.element.innerText;r=r.replace("\n","");this.startFrom;if(e.confirmKeys.indexOf(n)>=0)return 9==n&&0==this.elementHint.innerText.length&&c.onTab(),void(this.elementHint.innerText.length>0&&this.element.innerText!=this.elementHint.realInnerText&&(this.element.innerText=this.elementHint.realInnerText,c.hideDropDown(),t(this.element),9==n&&(c.element.focus(),i.preventDefault(),i.stopPropagation())));if(13!=n){if(40==n){var o=r.substring(this.startFrom),a=h.move(1);return""==a&&c.onArrowDown(),this.elementHint.innerText=l+o+a.substring(o.length),this.elementHint.realInnerText=l+a,i.preventDefault(),void i.stopPropagation()}if(38==n){var o=r.substring(this.startFrom),a=h.move(-1);return""==a&&c.onArrowUp(),this.elementHint.innerText=l+o+a.substring(o.length),this.elementHint.realInnerText=l+a,i.preventDefault(),void i.stopPropagation()}}else if(0==this.elementHint.innerText.length)c.onEnter();else{var d="hidden"==s.style.visibility;if(h.hide(),d)return c.hideDropDown(),c.element.focus(),void c.onEnter();this.element.innerText=this.elementHint.realInnerText,c.hideDropDown(),t(this.element),i.preventDefault(),i.stopPropagation()}}}.bind(c),u=function(e){c.hideDropDown()}.bind(c);return h.onmouseselection=function(e,i){i.element.innerText=i.elementHint.innerText=l+e,i.hideDropDown(),window.setTimeout(function(){i.element.focus(),t(i.element)},1)},c}e.exports=i},function(e,t,i){"use strict";function n(){try{this.format()}catch(e){}}var r=i(51),o=i(80),s=i(65),a={};a.create=function(e,t){t=t||{},void 0===t.statusBar&&(t.statusBar=!0),t.mainMenuBar=!1!==t.mainMenuBar,this.options=t,t.indentation?this.indentation=Number(t.indentation):this.indentation=2;var n=t.ace?t.ace:r;if(this.mode="code"==t.mode?"code":"text","code"==this.mode&&void 0===n&&(this.mode="text",console.warn("Failed to load Ace editor, falling back to plain text mode. Please use a JSONEditor bundle including Ace, or pass Ace as via the configuration option `ace`.")),this.theme=t.theme||"ace/theme/jsoneditor","ace/theme/jsoneditor"===this.theme&&n)try{i(83)}catch(e){console.error(e)}t.onTextSelectionChange&&this.onTextSelectionChange(t.onTextSelectionChange);var a=this;if(this.container=e,this.dom={},this.aceEditor=void 0,this.textarea=void 0,this.validateSchema=null,this.validationSequence=0,this.annotations=[],this.errorTableVisible=void 0,this._debouncedValidate=s.debounce(this.validate.bind(this),this.DEBOUNCE_INTERVAL),this.width=e.clientWidth,this.height=e.clientHeight,this.frame=document.createElement("div"),this.frame.className="jsoneditor jsoneditor-mode-"+this.options.mode,this.frame.onclick=function(e){e.preventDefault()},this.frame.onkeydown=function(e){a._onKeyDown(e)},this.content=document.createElement("div"),this.content.className="jsoneditor-outer",this.options.mainMenuBar){s.addClassName(this.content,"has-main-menu-bar"),this.menu=document.createElement("div"),this.menu.className="jsoneditor-menu",this.frame.appendChild(this.menu);var l=document.createElement("button");l.type="button",l.className="jsoneditor-format",l.title="Format JSON data, with proper indentation and line feeds (Ctrl+\\)",this.menu.appendChild(l),l.onclick=function(){try{a.format(),a._onChange()}catch(e){a._onError(e)}};var c=document.createElement("button");c.type="button",c.className="jsoneditor-compact",c.title="Compact JSON data, remove all whitespaces (Ctrl+Shift+\\)",this.menu.appendChild(c),c.onclick=function(){try{a.compact(),a._onChange()}catch(e){a._onError(e)}};var h=document.createElement("button");if(h.type="button",h.className="jsoneditor-repair",h.title="Repair JSON: fix quotes and escape characters, remove comments and JSONP notation, turn JavaScript objects into JSON.",this.menu.appendChild(h),h.onclick=function(){try{a.repair(),a._onChange()}catch(e){a._onError(e)}},this.options&&this.options.modes&&this.options.modes.length&&(this.modeSwitcher=new o(this.menu,this.options.modes,this.options.mode,function(e){a.setMode(e),a.modeSwitcher.focus()})),"code"==this.mode){var d=document.createElement("a");d.appendChild(document.createTextNode("powered by ace")),d.href="http://ace.ajax.org",d.target="_blank",d.className="jsoneditor-poweredBy",d.onclick=function(){window.open(d.href,d.target)},this.menu.appendChild(d)}}var u={},p=this.options.onEditable&&typeof("function"===this.options.onEditable)&&!this.options.onEditable(u);if(this.frame.appendChild(this.content),this.container.appendChild(this.frame),"code"==this.mode){this.editorDom=document.createElement("div"),this.editorDom.style.height="100%",this.editorDom.style.width="100%",this.content.appendChild(this.editorDom);var f=n.edit(this.editorDom),m=f.getSession();f.$blockScrolling=1/0,f.setTheme(this.theme),f.setOptions({readOnly:p}),f.setShowPrintMargin(!1),f.setFontSize(13),m.setMode("ace/mode/json"),m.setTabSize(this.indentation),m.setUseSoftTabs(!0),m.setUseWrapMode(!0);var g=m.setAnnotations;m.setAnnotations=function(e){g.call(this,e&&e.length?e:a.annotations)},f.commands.bindKey("Ctrl-L",null),f.commands.bindKey("Command-L",null),this.aceEditor=f,this.hasOwnProperty("editor")||Object.defineProperty(this,"editor",{get:function(){return console.warn('Property "editor" has been renamed to "aceEditor".'),a.aceEditor},set:function(e){console.warn('Property "editor" has been renamed to "aceEditor".'),a.aceEditor=e}}),f.on("change",this._onChange.bind(this)),f.on("changeSelection",this._onSelect.bind(this))}else{var v=document.createElement("textarea");v.className="jsoneditor-text",v.spellcheck=!1,this.content.appendChild(v),this.textarea=v,this.textarea.readOnly=p,null===this.textarea.oninput?this.textarea.oninput=this._onChange.bind(this):this.textarea.onchange=this._onChange.bind(this),v.onselect=this._onSelect.bind(this),v.onmousedown=this._onMouseDown.bind(this),v.onblur=this._onBlur.bind(this)}var y=document.createElement("div");y.className="jsoneditor-validation-errors-container",this.dom.validationErrorsContainer=y,this.frame.appendChild(y);var w=document.createElement("div");if(w.style.display="none",w.className="jsoneditor-additional-errors fadein",w.innerHTML="Scroll for more ▿",this.dom.additionalErrorsIndication=w,y.appendChild(w),t.statusBar){s.addClassName(this.content,"has-status-bar"),this.curserInfoElements={};var b=document.createElement("div");this.dom.statusBar=b,b.className="jsoneditor-statusbar",this.frame.appendChild(b);var C=document.createElement("span");C.className="jsoneditor-curserinfo-label",C.innerText="Ln:";var A=document.createElement("span");A.className="jsoneditor-curserinfo-val",A.innerText="1",b.appendChild(C),b.appendChild(A);var E=document.createElement("span");E.className="jsoneditor-curserinfo-label",E.innerText="Col:";var x=document.createElement("span");x.className="jsoneditor-curserinfo-val",x.innerText="1",b.appendChild(E),b.appendChild(x),this.curserInfoElements.colVal=x,this.curserInfoElements.lnVal=A;var F=document.createElement("span");F.className="jsoneditor-curserinfo-label",F.innerText="characters selected",F.style.display="none";var S=document.createElement("span");S.className="jsoneditor-curserinfo-count",S.innerText="0",S.style.display="none",this.curserInfoElements.countLabel=F,this.curserInfoElements.countVal=S,b.appendChild(S),b.appendChild(F);var _=document.createElement("span");_.className="jsoneditor-validation-error-icon",_.style.display="none";var k=document.createElement("span");k.className="jsoneditor-validation-error-count",k.style.display="none",this.validationErrorIndication={validationErrorIcon:_,validationErrorCount:k},b.appendChild(k),b.appendChild(_),this.parseErrorIndication=document.createElement("span"),this.parseErrorIndication.className="jsoneditor-parse-error-icon",this.parseErrorIndication.style.display="none",b.appendChild(this.parseErrorIndication)}this.setSchema(this.options.schema,this.options.schemaRefs)},a._onChange=function(){if(!this.onChangeDisabled){if(this._debouncedValidate(),this.options.onChange)try{this.options.onChange()}catch(e){console.error("Error in onChange callback: ",e)}if(this.options.onChangeText)try{this.options.onChangeText(this.getText())}catch(e){console.error("Error in onChangeText callback: ",e)}}},a._onSelect=function(){this._updateCursorInfo(),this._emitSelectionChange()},a._onKeyDown=function(e){var t=e.which||e.keyCode,i=!1;220==t&&e.ctrlKey&&(e.shiftKey?(this.compact(),this._onChange()):(this.format(),this._onChange()),i=!0),i&&(e.preventDefault(),e.stopPropagation()),this._updateCursorInfo(),this._emitSelectionChange()},a._onMouseDown=function(){this._updateCursorInfo(),this._emitSelectionChange()},a._onBlur=function(){var e=this;setTimeout(function(){e.isFocused||(e._updateCursorInfo(),e._emitSelectionChange()),e.isFocused=!1})},a._updateCursorInfo=function(){function e(){r.curserInfoElements.countVal.innerText!==n&&(r.curserInfoElements.countVal.innerText=n,r.curserInfoElements.countVal.style.display=n?"inline":"none",r.curserInfoElements.countLabel.style.display=n?"inline":"none"),r.curserInfoElements.lnVal.innerText=t,r.curserInfoElements.colVal.innerText=i}var t,i,n,r=this;if(this.textarea)setTimeout(function(){var o=s.getInputSelection(r.textarea);o.startIndex!==o.endIndex&&(n=o.endIndex-o.startIndex),n&&r.cursorInfo&&r.cursorInfo.line===o.end.row&&r.cursorInfo.column===o.end.column?(t=o.start.row,i=o.start.column):(t=o.end.row,i=o.end.column),r.cursorInfo={line:t,column:i,count:n},r.options.statusBar&&e()},0);else if(this.aceEditor&&this.curserInfoElements){var o=this.aceEditor.getCursorPosition(),a=this.aceEditor.getSelectedText();t=o.row+1,i=o.column+1,n=a.length,r.cursorInfo={line:t,column:i,count:n},this.options.statusBar&&e()}},a._emitSelectionChange=function(){if(this._selectionChangedHandler){var e=this.getTextSelection();this._selectionChangedHandler(e.start,e.end,e.text)}},a._refreshAnnotations=function(){var e=this.aceEditor&&this.aceEditor.getSession();if(e){var t=e.getAnnotations().filter(function(e){return"error"===e.type});e.setAnnotations(t)}},a.destroy=function(){this.aceEditor&&(this.aceEditor.destroy(),this.aceEditor=null),this.frame&&this.container&&this.frame.parentNode==this.container&&this.container.removeChild(this.frame),this.modeSwitcher&&(this.modeSwitcher.destroy(),this.modeSwitcher=null),this.textarea=null,this._debouncedValidate=null},a.compact=function(){var e=this.get(),t=JSON.stringify(e);this.setText(t)},a.format=function(){var e=this.get(),t=JSON.stringify(e,null,this.indentation);this.setText(t)},a.repair=function(){var e=this.getText(),t=s.sanitize(e);this.setText(t)},a.focus=function(){this.textarea&&this.textarea.focus(),this.aceEditor&&this.aceEditor.focus()},a.resize=function(){if(this.aceEditor){this.aceEditor.resize(!1)}},a.set=function(e){this.setText(JSON.stringify(e,null,this.indentation))},a.update=function(e){this.updateText(JSON.stringify(e,null,this.indentation))},a.get=function(){var e,t=this.getText();try{e=s.parse(t)}catch(i){t=s.sanitize(t),e=s.parse(t)}return e},a.getText=function(){return this.textarea?this.textarea.value:this.aceEditor?this.aceEditor.getValue():""},a.setText=function(e){var t;t=!0===this.options.escapeUnicode?s.escapeUnicodeChars(e):e,this.textarea&&(this.textarea.value=t),this.aceEditor&&(this.onChangeDisabled=!0,this.aceEditor.setValue(t,-1),this.onChangeDisabled=!1),this._debouncedValidate()},a.updateText=function(e){this.getText()!==e&&(this.onChangeDisabled=!0,this.setText(e),this.onChangeDisabled=!1)},a.validate=function(){var e,t=!1,i=[],n=[];try{e=this.get(),this.parseErrorIndication&&(this.parseErrorIndication.style.display="none"),t=!0}catch(e){if(this.getText()){this.parseErrorIndication&&(this.parseErrorIndication.style.display="block");var r,o=/\w*line\s*(\d+)\w*/g.exec(e.message);o&&(r=+o[1]),this.parseErrorIndication&&(this.parseErrorIndication.title=isNaN(r)?"parse error - check that the json is valid":"parse error on line "+r),n.push({type:"error",message:e.message.replace(/\n/g,"
    "),line:r})}}if(t){if(this.validateSchema){this.validateSchema(e)||(i=this.validateSchema.errors.map(function(e){return e.type="validation",s.improveSchemaError(e)}))}try{this.validationSequence++;var a=this,l=this.validationSequence;this._validateCustom(e).then(function(e){if(l===a.validationSequence){var t=i.concat(n||[]).concat(e||[]);a._renderErrors(t)}}).catch(function(e){console.error(e)})}catch(e){console.error(e)}}else this._renderErrors(n||[],!0)},a._validateCustom=function(e){if(this.options.onValidate)try{var t=this.options.onValidate(e);return(s.isPromise(t)?t:Promise.resolve(t)).then(function(e){return Array.isArray(e)?e.filter(function(e){var t=s.isValidValidationError(e);return t||console.warn('Ignoring a custom validation error with invalid structure. Expected structure: {path: [...], message: "..."}. Actual error:',e),t}).map(function(e){return{dataPath:s.stringifyPath(e.path),message:e.message}}):null})}catch(e){return Promise.reject(e)}return Promise.resolve(null)},a._renderErrors=function(e,t){var i=this,n=0;this.errorTableVisible=void 0===this.errorTableVisible?!this.aceEditor:this.errorTableVisible,this.dom.validationErrors&&(this.dom.validationErrors.parentNode.removeChild(this.dom.validationErrors),this.dom.validationErrors=null,this.dom.additionalErrorsIndication.style.display="none",this.content.style.marginBottom="",this.content.style.paddingBottom="");var r=this.getText(),o=[];e.reduce(function(e,t){return-1===e.indexOf(t.dataPath)&&e.push(t.dataPath),e},o);var a=s.getPositionForPath(r,o);if(e.length>0)if(this.aceEditor&&(this.annotations=a.map(function(t){var i=e.filter(function(e){return e.dataPath===t.path}),n=i.map(function(e){return e.message}).join("\n");return n?{row:t.line,column:t.column,text:"Schema validation error"+(1!==i.length?"s":"")+": \n"+n,type:"warning",source:"jsoneditor"}:{}}),this._refreshAnnotations()),t?!this.aceEditor:this.errorTableVisible){var l=document.createElement("div");l.innerHTML='
    ';var c=l.getElementsByTagName("tbody")[0];e.forEach(function(e){var t;t="string"==typeof e?'
    '+e+"
    ":""+(e.dataPath||"")+""+e.message+"";var r;if(isNaN(e.line)){if(e.dataPath){var o=a.find(function(t){return t.path===e.dataPath});o&&(r=o.line+1)}}else r=e.line;var s=document.createElement("tr");s.className=isNaN(r)?"":"jump-to-line","error"===e.type?s.className+=" parse-error":(s.className+=" validation-error",++n),s.innerHTML=''+(isNaN(r)?"":"Ln "+r)+""+t,s.onclick=function(){i.isFocused=!0,isNaN(r)||i.setTextSelection({row:r,column:1},{row:r,column:1e3})},c.appendChild(s)}),this.dom.validationErrors=l,this.dom.validationErrorsContainer.appendChild(l),this.dom.additionalErrorsIndication.title=e.length+" errors total",this.dom.validationErrorsContainer.clientHeight0&&0===i.dom.validationErrorsContainer.scrollTop?"block":"none"}):this.dom.validationErrorsContainer.onscroll=void 0;var h=this.dom.validationErrorsContainer.clientHeight+(this.dom.statusBar?this.dom.statusBar.clientHeight:0);this.content.style.marginBottom=-h+"px",this.content.style.paddingBottom=h+"px"}else n=e.reduce(function(e,t){return"validation"===t.type?++e:e},0);else this.aceEditor&&(this.annotations=[],this._refreshAnnotations());if(this.options.statusBar){n=n||this.annotations.length;var d=!!n;this.validationErrorIndication.validationErrorIcon.style.display=d?"inline":"none",this.validationErrorIndication.validationErrorCount.style.display=d?"inline":"none",d&&(this.validationErrorIndication.validationErrorCount.innerText=n,this.validationErrorIndication.validationErrorIcon.title=n+" schema validation error(s) found",this.validationErrorIndication.validationErrorCount.onclick=this.validationErrorIndication.validationErrorIcon.onclick=this._toggleErrorTableVisibility.bind(this))}if(this.aceEditor){this.aceEditor.resize(!1)}},a._toggleErrorTableVisibility=function(){this.errorTableVisible=!this.errorTableVisible,this.validate()},a.getTextSelection=function(){var e={};if(this.textarea){var t=s.getInputSelection(this.textarea);return this.cursorInfo&&this.cursorInfo.line===t.end.row&&this.cursorInfo.column===t.end.column?(e.start=t.end,e.end=t.start):e=t,{start:e.start,end:e.end,text:this.textarea.value.substring(t.startIndex,t.endIndex)}}if(this.aceEditor){var i=this.aceEditor.getSelection(),n=this.aceEditor.getSelectedText(),r=i.getRange(),o=i.getSelectionLead();return o.row===r.end.row&&o.column===r.end.column?e=r:(e.start=r.end,e.end=r.start),{start:{row:e.start.row+1,column:e.start.column+1},end:{row:e.end.row+1,column:e.end.column+1},text:n}}},a.onTextSelectionChange=function(e){"function"==typeof e&&(this._selectionChangedHandler=s.debounce(e,this.DEBOUNCE_INTERVAL))},a.setTextSelection=function(e,t){if(e&&t)if(this.textarea){var i=s.getIndexForPosition(this.textarea,e.row,e.column),n=s.getIndexForPosition(this.textarea,t.row,t.column);if(i>-1&&n>-1){if(this.textarea.setSelectionRange)this.textarea.focus(),this.textarea.setSelectionRange(i,n);else if(this.textarea.createTextRange){var r=this.textarea.createTextRange();r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",i),r.select()}var o=(this.textarea.value.match(/\n/g)||[]).length+1,a=this.textarea.scrollHeight/o,l=e.row*a;this.textarea.scrollTop=l>this.textarea.clientHeight?l-this.textarea.clientHeight/2:0}}else if(this.aceEditor){var r={start:{row:e.row-1,column:e.column-1},end:{row:t.row-1,column:t.column-1}};this.aceEditor.selection.setRange(r),this.aceEditor.scrollToLine(e.row-1,!0)}},e.exports=[{mode:"text",mixin:a,data:"text",load:n},{mode:"code",mixin:a,data:"text",load:n}]},function(e,t){ace.define("ace/theme/jsoneditor",["require","exports","module","ace/lib/dom"],function(e,t,i){t.isDark=!1,t.cssClass="ace-jsoneditor",t.cssText='.ace-jsoneditor .ace_gutter {\tbackground: #ebebeb;\tcolor: #333\t}\t\t.ace-jsoneditor.ace_editor {\tfont-family: "dejavu sans mono", "droid sans mono", consolas, monaco, "lucida console", "courier new", courier, monospace, sans-serif;\tline-height: 1.3;\tbackground-color: #fff;\t}\t.ace-jsoneditor .ace_print-margin {\twidth: 1px;\tbackground: #e8e8e8\t}\t.ace-jsoneditor .ace_scroller {\tbackground-color: #FFFFFF\t}\t.ace-jsoneditor .ace_text-layer {\tcolor: gray\t}\t.ace-jsoneditor .ace_variable {\tcolor: #1a1a1a\t}\t.ace-jsoneditor .ace_cursor {\tborder-left: 2px solid #000000\t}\t.ace-jsoneditor .ace_overwrite-cursors .ace_cursor {\tborder-left: 0px;\tborder-bottom: 1px solid #000000\t}\t.ace-jsoneditor .ace_marker-layer .ace_selection {\tbackground: lightgray\t}\t.ace-jsoneditor.ace_multiselect .ace_selection.ace_start {\tbox-shadow: 0 0 3px 0px #FFFFFF;\tborder-radius: 2px\t}\t.ace-jsoneditor .ace_marker-layer .ace_step {\tbackground: rgb(255, 255, 0)\t}\t.ace-jsoneditor .ace_marker-layer .ace_bracket {\tmargin: -1px 0 0 -1px;\tborder: 1px solid #BFBFBF\t}\t.ace-jsoneditor .ace_marker-layer .ace_active-line {\tbackground: #FFFBD1\t}\t.ace-jsoneditor .ace_gutter-active-line {\tbackground-color : #dcdcdc\t}\t.ace-jsoneditor .ace_marker-layer .ace_selected-word {\tborder: 1px solid lightgray\t}\t.ace-jsoneditor .ace_invisible {\tcolor: #BFBFBF\t}\t.ace-jsoneditor .ace_keyword,\t.ace-jsoneditor .ace_meta,\t.ace-jsoneditor .ace_support.ace_constant.ace_property-value {\tcolor: #AF956F\t}\t.ace-jsoneditor .ace_keyword.ace_operator {\tcolor: #484848\t}\t.ace-jsoneditor .ace_keyword.ace_other.ace_unit {\tcolor: #96DC5F\t}\t.ace-jsoneditor .ace_constant.ace_language {\tcolor: darkorange\t}\t.ace-jsoneditor .ace_constant.ace_numeric {\tcolor: red\t}\t.ace-jsoneditor .ace_constant.ace_character.ace_entity {\tcolor: #BF78CC\t}\t.ace-jsoneditor .ace_invalid {\tcolor: #FFFFFF;\tbackground-color: #FF002A;\t}\t.ace-jsoneditor .ace_fold {\tbackground-color: #AF956F;\tborder-color: #000000\t}\t.ace-jsoneditor .ace_storage,\t.ace-jsoneditor .ace_support.ace_class,\t.ace-jsoneditor .ace_support.ace_function,\t.ace-jsoneditor .ace_support.ace_other,\t.ace-jsoneditor .ace_support.ace_type {\tcolor: #C52727\t}\t.ace-jsoneditor .ace_string {\tcolor: green\t}\t.ace-jsoneditor .ace_comment {\tcolor: #BCC8BA\t}\t.ace-jsoneditor .ace_entity.ace_name.ace_tag,\t.ace-jsoneditor .ace_entity.ace_other.ace_attribute-name {\tcolor: #606060\t}\t.ace-jsoneditor .ace_markup.ace_underline {\ttext-decoration: underline\t}\t.ace-jsoneditor .ace_indent-guide {\tbackground: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y\t}',e("../lib/dom").importCssString(t.cssText,t.cssClass)})}])}); -//# sourceMappingURL=jsoneditor.map \ No newline at end of file diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/later.min.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/later.min.js deleted file mode 100644 index 833735bf..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/later.min.js +++ /dev/null @@ -1 +0,0 @@ -later=function(){"use strict";var e={version:"1.2.0"};return Array.prototype.indexOf||(Array.prototype.indexOf=function(e){if(null==this)throw new TypeError;var t=Object(this),n=t.length>>>0;if(0===n)return-1;var r=0;if(arguments.length>1&&(r=Number(arguments[1]),r!=r?r=0:0!=r&&r!=1/0&&r!=-(1/0)&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=n)return-1;for(var a=r>=0?r:Math.max(n-Math.abs(r),0);n>a;a++)if(a in t&&t[a]===e)return a;return-1}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),e.array={},e.array.sort=function(e,t){e.sort(function(e,t){return+e-+t}),t&&0===e[0]&&e.push(e.shift())},e.array.next=function(e,t,n){for(var r,a=0!==n[0],i=0,u=t.length-1;u>-1;--u){if(r=t[u],r===e)return r;if(!(r>e||0===r&&a&&n[1]>e))break;i=u}return t[i]},e.array.nextInvalid=function(e,t,n){for(var r=n[0],a=n[1],i=t.length,u=0===t[i-1]&&0!==r?a:0,o=e,f=t.indexOf(e),d=o;o===(t[f]||u);)if(o++,o>a&&(o=r),f++,f===i&&(f=0),o===d)return;return o},e.array.prev=function(e,t,n){for(var r,a=t.length,i=0!==n[0],u=a-1,o=0;a>o;o++){if(r=t[o],r===e)return r;if(!(e>r||0===r&&i&&n[1]o&&(o=a),f--,-1===f&&(f=i-1),o===d)return;return o},e.day=e.D={name:"day",range:86400,val:function(t){return t.D||(t.D=e.date.getDate.call(t))},isValid:function(t,n){return e.D.val(t)===(n||e.D.extent(t)[1])},extent:function(t){if(t.DExtent)return t.DExtent;var n=e.M.val(t),r=e.DAYS_IN_MONTH[n-1];return 2===n&&366===e.dy.extent(t)[1]&&(r+=1),t.DExtent=[1,r]},start:function(t){return t.DStart||(t.DStart=e.date.next(e.Y.val(t),e.M.val(t),e.D.val(t)))},end:function(t){return t.DEnd||(t.DEnd=e.date.prev(e.Y.val(t),e.M.val(t),e.D.val(t)))},next:function(t,n){n=n>e.D.extent(t)[1]?1:n;var r=e.date.nextRollover(t,n,e.D,e.M),a=e.D.extent(r)[1];return n=n>a?1:n||a,e.date.next(e.Y.val(r),e.M.val(r),n)},prev:function(t,n){var r=e.date.prevRollover(t,n,e.D,e.M),a=e.D.extent(r)[1];return e.date.prev(e.Y.val(r),e.M.val(r),n>a?a:n||a)}},e.dayOfWeekCount=e.dc={name:"day of week count",range:604800,val:function(t){return t.dc||(t.dc=Math.floor((e.D.val(t)-1)/7)+1)},isValid:function(t,n){return e.dc.val(t)===n||0===n&&e.D.val(t)>e.D.extent(t)[1]-7},extent:function(t){return t.dcExtent||(t.dcExtent=[1,Math.ceil(e.D.extent(t)[1]/7)])},start:function(t){return t.dcStart||(t.dcStart=e.date.next(e.Y.val(t),e.M.val(t),Math.max(1,7*(e.dc.val(t)-1)+1||1)))},end:function(t){return t.dcEnd||(t.dcEnd=e.date.prev(e.Y.val(t),e.M.val(t),Math.min(7*e.dc.val(t),e.D.extent(t)[1])))},next:function(t,n){n=n>e.dc.extent(t)[1]?1:n;var r=e.date.nextRollover(t,n,e.dc,e.M),a=e.dc.extent(r)[1];n=n>a?1:n;var i=e.date.next(e.Y.val(r),e.M.val(r),0===n?e.D.extent(r)[1]-6:1+7*(n-1));return i.getTime()<=t.getTime()?(r=e.M.next(t,e.M.val(t)+1),e.date.next(e.Y.val(r),e.M.val(r),0===n?e.D.extent(r)[1]-6:1+7*(n-1))):i},prev:function(t,n){var r=e.date.prevRollover(t,n,e.dc,e.M),a=e.dc.extent(r)[1];return n=n>a?a:n||a,e.dc.end(e.date.prev(e.Y.val(r),e.M.val(r),1+7*(n-1)))}},e.dayOfWeek=e.dw=e.d={name:"day of week",range:86400,val:function(t){return t.dw||(t.dw=e.date.getDay.call(t)+1)},isValid:function(t,n){return e.dw.val(t)===(n||7)},extent:function(){return[1,7]},start:function(t){return e.D.start(t)},end:function(t){return e.D.end(t)},next:function(t,n){return n=n>7?1:n||7,e.date.next(e.Y.val(t),e.M.val(t),e.D.val(t)+(n-e.dw.val(t))+(n<=e.dw.val(t)?7:0))},prev:function(t,n){return n=n>7?7:n||7,e.date.prev(e.Y.val(t),e.M.val(t),e.D.val(t)+(n-e.dw.val(t))+(n>=e.dw.val(t)?-7:0))}},e.dayOfYear=e.dy={name:"day of year",range:86400,val:function(t){return t.dy||(t.dy=Math.ceil(1+(e.D.start(t).getTime()-e.Y.start(t).getTime())/e.DAY))},isValid:function(t,n){return e.dy.val(t)===(n||e.dy.extent(t)[1])},extent:function(t){var n=e.Y.val(t);return t.dyExtent||(t.dyExtent=[1,n%4?365:366])},start:function(t){return e.D.start(t)},end:function(t){return e.D.end(t)},next:function(t,n){n=n>e.dy.extent(t)[1]?1:n;var r=e.date.nextRollover(t,n,e.dy,e.Y),a=e.dy.extent(r)[1];return n=n>a?1:n||a,e.date.next(e.Y.val(r),e.M.val(r),n)},prev:function(t,n){var r=e.date.prevRollover(t,n,e.dy,e.Y),a=e.dy.extent(r)[1];return n=n>a?a:n||a,e.date.prev(e.Y.val(r),e.M.val(r),n)}},e.hour=e.h={name:"hour",range:3600,val:function(t){return t.h||(t.h=e.date.getHour.call(t))},isValid:function(t,n){return e.h.val(t)===n},extent:function(){return[0,23]},start:function(t){return t.hStart||(t.hStart=e.date.next(e.Y.val(t),e.M.val(t),e.D.val(t),e.h.val(t)))},end:function(t){return t.hEnd||(t.hEnd=e.date.prev(e.Y.val(t),e.M.val(t),e.D.val(t),e.h.val(t)))},next:function(t,n){n=n>23?0:n;var r=e.date.next(e.Y.val(t),e.M.val(t),e.D.val(t)+(n<=e.h.val(t)?1:0),n);return!e.date.isUTC&&r.getTime()<=t.getTime()&&(r=e.date.next(e.Y.val(r),e.M.val(r),e.D.val(r),n+1)),r},prev:function(t,n){return n=n>23?23:n,e.date.prev(e.Y.val(t),e.M.val(t),e.D.val(t)+(n>=e.h.val(t)?-1:0),n)}},e.minute=e.m={name:"minute",range:60,val:function(t){return t.m||(t.m=e.date.getMin.call(t))},isValid:function(t,n){return e.m.val(t)===n},extent:function(e){return[0,59]},start:function(t){return t.mStart||(t.mStart=e.date.next(e.Y.val(t),e.M.val(t),e.D.val(t),e.h.val(t),e.m.val(t)))},end:function(t){return t.mEnd||(t.mEnd=e.date.prev(e.Y.val(t),e.M.val(t),e.D.val(t),e.h.val(t),e.m.val(t)))},next:function(t,n){var r=e.m.val(t),a=e.s.val(t),i=n>59?60-r:r>=n?60-r+n:n-r,u=new Date(t.getTime()+i*e.MIN-a*e.SEC);return!e.date.isUTC&&u.getTime()<=t.getTime()&&(u=new Date(t.getTime()+(i+120)*e.MIN-a*e.SEC)),u},prev:function(t,n){return n=n>59?59:n,e.date.prev(e.Y.val(t),e.M.val(t),e.D.val(t),e.h.val(t)+(n>=e.m.val(t)?-1:0),n)}},e.month=e.M={name:"month",range:2629740,val:function(t){return t.M||(t.M=e.date.getMonth.call(t)+1)},isValid:function(t,n){return e.M.val(t)===(n||12)},extent:function(){return[1,12]},start:function(t){return t.MStart||(t.MStart=e.date.next(e.Y.val(t),e.M.val(t)))},end:function(t){return t.MEnd||(t.MEnd=e.date.prev(e.Y.val(t),e.M.val(t)))},next:function(t,n){return n=n>12?1:n||12,e.date.next(e.Y.val(t)+(n>e.M.val(t)?0:1),n)},prev:function(t,n){return n=n>12?12:n||12,e.date.prev(e.Y.val(t)-(n>=e.M.val(t)?1:0),n)}},e.second=e.s={name:"second",range:1,val:function(t){return t.s||(t.s=e.date.getSec.call(t))},isValid:function(t,n){return e.s.val(t)===n},extent:function(){return[0,59]},start:function(e){return e},end:function(e){return e},next:function(t,n){var r=e.s.val(t),a=n>59?60-r:r>=n?60-r+n:n-r,i=new Date(t.getTime()+a*e.SEC);return!e.date.isUTC&&i.getTime()<=t.getTime()&&(i=new Date(t.getTime()+(a+7200)*e.SEC)),i},prev:function(t,n,r){return n=n>59?59:n,e.date.prev(e.Y.val(t),e.M.val(t),e.D.val(t),e.h.val(t),e.m.val(t)+(n>=e.s.val(t)?-1:0),n)}},e.time=e.t={name:"time",range:1,val:function(t){return t.t||(t.t=3600*e.h.val(t)+60*e.m.val(t)+e.s.val(t))},isValid:function(t,n){return e.t.val(t)===n},extent:function(){return[0,86399]},start:function(e){return e},end:function(e){return e},next:function(t,n){n=n>86399?0:n;var r=e.date.next(e.Y.val(t),e.M.val(t),e.D.val(t)+(n<=e.t.val(t)?1:0),0,0,n);return!e.date.isUTC&&r.getTime()86399?86399:n,e.date.next(e.Y.val(t),e.M.val(t),e.D.val(t)+(n>=e.t.val(t)?-1:0),0,0,n)}},e.weekOfMonth=e.wm={name:"week of month",range:604800,val:function(t){return t.wm||(t.wm=(e.D.val(t)+(e.dw.val(e.M.start(t))-1)+(7-e.dw.val(t)))/7)},isValid:function(t,n){return e.wm.val(t)===(n||e.wm.extent(t)[1])},extent:function(t){return t.wmExtent||(t.wmExtent=[1,(e.D.extent(t)[1]+(e.dw.val(e.M.start(t))-1)+(7-e.dw.val(e.M.end(t))))/7])},start:function(t){return t.wmStart||(t.wmStart=e.date.next(e.Y.val(t),e.M.val(t),Math.max(e.D.val(t)-e.dw.val(t)+1,1)))},end:function(t){return t.wmEnd||(t.wmEnd=e.date.prev(e.Y.val(t),e.M.val(t),Math.min(e.D.val(t)+(7-e.dw.val(t)),e.D.extent(t)[1])))},next:function(t,n){n=n>e.wm.extent(t)[1]?1:n;var r=e.date.nextRollover(t,n,e.wm,e.M),a=e.wm.extent(r)[1];return n=n>a?1:n||a,e.date.next(e.Y.val(r),e.M.val(r),Math.max(1,7*(n-1)-(e.dw.val(r)-2)))},prev:function(t,n){var r=e.date.prevRollover(t,n,e.wm,e.M),a=e.wm.extent(r)[1];return n=n>a?a:n||a,e.wm.end(e.date.next(e.Y.val(r),e.M.val(r),Math.max(1,7*(n-1)-(e.dw.val(r)-2))))}},e.weekOfYear=e.wy={name:"week of year (ISO)",range:604800,val:function(t){if(t.wy)return t.wy;var n=e.dw.next(e.wy.start(t),5),r=e.dw.next(e.Y.prev(n,e.Y.val(n)-1),5);return t.wy=1+Math.ceil((n.getTime()-r.getTime())/e.WEEK)},isValid:function(t,n){return e.wy.val(t)===(n||e.wy.extent(t)[1])},extent:function(t){if(t.wyExtent)return t.wyExtent;var n=e.dw.next(e.wy.start(t),5),r=e.dw.val(e.Y.start(n)),a=e.dw.val(e.Y.end(n));return t.wyExtent=[1,5===r||5===a?53:52]},start:function(t){return t.wyStart||(t.wyStart=e.date.next(e.Y.val(t),e.M.val(t),e.D.val(t)-(e.dw.val(t)>1?e.dw.val(t)-2:6)))},end:function(t){return t.wyEnd||(t.wyEnd=e.date.prev(e.Y.val(t),e.M.val(t),e.D.val(t)+(e.dw.val(t)>1?8-e.dw.val(t):0)))},next:function(t,n){n=n>e.wy.extent(t)[1]?1:n;var r=e.dw.next(e.wy.start(t),5),a=e.date.nextRollover(r,n,e.wy,e.Y);1!==e.wy.val(a)&&(a=e.dw.next(a,2));var i=e.wy.extent(a)[1],u=e.wy.start(a);return n=n>i?1:n||i,e.date.next(e.Y.val(u),e.M.val(u),e.D.val(u)+7*(n-1))},prev:function(t,n){var r=e.dw.next(e.wy.start(t),5),a=e.date.prevRollover(r,n,e.wy,e.Y);1!==e.wy.val(a)&&(a=e.dw.next(a,2));var i=e.wy.extent(a)[1],u=e.wy.end(a);return n=n>i?i:n||i,e.wy.end(e.date.next(e.Y.val(u),e.M.val(u),e.D.val(u)+7*(n-1)))}},e.year=e.Y={name:"year",range:31556900,val:function(t){return t.Y||(t.Y=e.date.getYear.call(t))},isValid:function(t,n){return e.Y.val(t)===n},extent:function(){return[1970,2099]},start:function(t){return t.YStart||(t.YStart=e.date.next(e.Y.val(t)))},end:function(t){return t.YEnd||(t.YEnd=e.date.prev(e.Y.val(t)))},next:function(t,n){return n>e.Y.val(t)&&n<=e.Y.extent()[1]?e.date.next(n):e.NEVER},prev:function(t,n){return n=e.Y.extent()[0]?e.date.prev(n):e.NEVER}},e.fullDate=e.fd={name:"full date",range:1,val:function(e){return e.fd||(e.fd=e.getTime())},isValid:function(t,n){return e.fd.val(t)===n},extent:function(){return[0,3250368e7]},start:function(e){return e},end:function(e){return e},next:function(t,n){return e.fd.val(t)n?new Date(n):e.NEVER}},e.modifier={},e.modifier.after=e.modifier.a=function(e,t){var n=t[0];return{name:"after "+e.name,range:(e.extent(new Date)[1]-n)*e.range,val:e.val,isValid:function(e,t){return this.val(e)>=n},extent:e.extent,start:e.start,end:e.end,next:function(t,r){return r!=n&&(r=e.extent(t)[0]),e.next(t,r)},prev:function(t,r){return r=r===n?e.extent(t)[1]:n-1,e.prev(t,r)}}},e.modifier.before=e.modifier.b=function(e,t){var n=t[t.length-1];return{name:"before "+e.name,range:e.range*(n-1),val:e.val,isValid:function(e,t){return this.val(e)t.getTime()}:function(e,t){return t.getTime()>e.getTime()}}var r,a=[],i=0;for(var u in t){var o=u.split("_"),f=o[0],d=o[1],v=t[u],l=d?e.modifier[d](e[f],v):e[f];a.push({constraint:l,vals:v}),i++}return a.sort(function(e,t){var n=e.constraint.range,r=t.constraint.range;return n>r?-1:r>n?1:0}),r=a[i-1].constraint,{start:function(t,n){for(var u,o=n,f=e.array[t],d=1e3;d--&&!u&&o;){u=!0;for(var v=0;i>v;v++){var l=a[v].constraint,c=l.val(o),s=l.extent(o),m=f(c,a[v].vals,s);if(!l.isValid(o,m)){o=l[t](o,m),u=!1;break}}}return o!==e.NEVER&&(o="next"===t?r.start(o):r.end(o)),o},end:function(t,r){for(var u,o=e.array[t+"Invalid"],f=n(t),d=i-1;d>=0;d--){var v,l=a[d].constraint,c=l.val(r),s=l.extent(r),m=o(c,a[d].vals,s);void 0!==m&&(v=l[t](r,m),!v||u&&!f(u,v)||(u=v))}return u},tick:function(t,n){return new Date("next"===t?r.end(n).getTime()+e.SEC:r.start(n).getTime()-e.SEC)},tickStart:function(e){return r.start(e)}}},e.schedule=function(t){function n(t,n,x,g,p){var D,M,b,Y=s(t),k=n,E=1e3,T=[],O=[],S=[],N="next"===t,R=N?0:1,C=N?1:0;if(x=x?new Date(x):new Date,!x||!x.getTime())throw new Error("Invalid start date.");for(a(t,h,T,x),u(t,w,O,x);E--&&k&&(D=m(T,Y))&&(!g||!Y(D,g));)if(y&&(o(t,w,O,D),M=v(t,O,D)))i(t,h,T,M);else{if(p){var V=l(O,Y);M=c(t,h,T,D,V);var I=N?[new Date(Math.max(x,D)),M?new Date(g?Math.min(M,g):M):void 0]:[M?new Date(g?Math.max(g,M.getTime()+e.SEC):M.getTime()+e.SEC):void 0,new Date(Math.min(x,D.getTime()+e.SEC))];if(b&&I[R].getTime()===b[C].getTime()?(b[C]=I[C],k++):(b=I,S.push(b)),!M)break;i(t,h,T,M)}else S.push(N?new Date(Math.max(x,D)):d(h,T,D,g)),f(t,h,T,D);k--}for(var U=0,A=S.length;A>U;U++){var W=S[U];S[U]="[object Array]"===Object.prototype.toString.call(W)?[r(W[0]),r(W[1])]:r(W)}return 0===S.length?e.NEVER:1===n?S[0]:S}function r(e){return e instanceof Date&&!isNaN(e.valueOf())?new Date(e):void 0}function a(e,t,n,r){for(var a=0,i=t.length;i>a;a++)n[a]=t[a].start(e,r)}function i(e,t,n,r){for(var a=s(e),i=0,u=t.length;u>i;i++)n[i]&&!a(n[i],r)&&(n[i]=t[i].start(e,r))}function u(t,n,r,a){for(var i=(s(t),0),u=n.length;u>i;i++){var o=n[i].start(t,a);o?r[i]=[o,n[i].end(t,o)]:r[i]=e.NEVER}}function o(t,n,r,a){for(var i=s(t),u=0,o=n.length;o>u;u++)if(r[u]&&!i(r[u][0],a)){var f=n[u].start(t,a);f?r[u]=[f,n[u].end(t,f)]:r[u]=e.NEVER}}function f(e,t,n,r){for(var a=0,i=t.length;i>a;a++)n[a]&&n[a].getTime()===r.getTime()&&(n[a]=t[a].start(e,t[a].tick(e,r)))}function d(e,t,n,r){for(var a,i=0,u=t.length;u>i;i++)if(t[i]&&t[i].getTime()===n.getTime()){var o=e[i].tickStart(n);if(r&&r>o)return r;(!a||o>a)&&(a=o)}return a}function v(e,t,n){for(var r,a=s(e),i=0,u=t.length;u>i;i++){var o=t[i];!o||a(o[0],n)||o[1]&&!a(o[1],n)||(!r||a(o[1],r))&&(r=o[1])}return r}function l(e,t){for(var n,r=0,a=e.length;a>r;r++)!e[r]||n&&!t(n,e[r][0])||(n=e[r][0]);return n}function c(e,t,n,r,a){for(var i,u=s(e),o=0,f=t.length;f>o;o++){var d=n[o];if(d&&d.getTime()===r.getTime()){var v=t[o].end(e,d);if(a&&(!v||u(v,a)))return a;(!i||u(v,i))&&(i=v)}}return i}function s(e){return"next"===e?function(e,t){return!t||e.getTime()>t.getTime()}:function(e,t){return!e||t.getTime()>e.getTime()}}function m(e,t){for(var n=e[0],r=1,a=e.length;a>r;r++)e[r]&&t(n,e[r])&&(n=e[r]);return n}if(!t)throw new Error("Missing schedule definition.");if(!t.schedules)throw new Error("Definition must include at least one schedule.");for(var h=[],x=t.schedules.length,w=[],y=t.exceptions?t.exceptions.length:0,g=0;x>g;g++)h.push(e.compile(t.schedules[g]));for(var p=0;y>p;p++)w.push(e.compile(t.exceptions[p]));return{isValid:function(t){return n("next",1,t,t)!==e.NEVER},next:function(e,t,r){return n("next",e||1,t,r)},prev:function(e,t,r){return n("prev",e||1,t,r)},nextRange:function(e,t,r){return n("next",e||1,t,r,!0)},prevRange:function(e,t,r){return n("prev",e||1,t,r,!0)}}},e.setTimeout=function(t,n){function r(){var e=Date.now(),n=i.next(2,e);if(!n[0])return void(a=void 0);var u=n[0].getTime()-e;1e3>u&&(u=n[1]?n[1].getTime()-e:1e3),a=2147483647>u?setTimeout(t,u):setTimeout(r,2147483647)}var a,i=e.schedule(n);return t&&r(),{isDone:function(){return!a},clear:function(){clearTimeout(a)}}},e.setInterval=function(t,n){function r(){i||(t(),a=e.setTimeout(r,n))}if(t){var a=e.setTimeout(r,n),i=a.isDone();return{isDone:function(){return a.isDone()},clear:function(){i=!0,a.clear()}}}},e.date={},e.date.timezone=function(t){e.date.build=t?function(e,t,n,r,a,i){return new Date(e,t,n,r,a,i)}:function(e,t,n,r,a,i){return new Date(Date.UTC(e,t,n,r,a,i))};var n=t?"get":"getUTC",r=Date.prototype;e.date.getYear=r[n+"FullYear"],e.date.getMonth=r[n+"Month"],e.date.getDate=r[n+"Date"],e.date.getDay=r[n+"Day"],e.date.getHour=r[n+"Hours"],e.date.getMin=r[n+"Minutes"],e.date.getSec=r[n+"Seconds"],e.date.isUTC=!t},e.date.UTC=function(){e.date.timezone(!1)},e.date.localTime=function(){e.date.timezone(!0)},e.date.UTC(),e.SEC=1e3,e.MIN=60*e.SEC,e.HOUR=60*e.MIN,e.DAY=24*e.HOUR,e.WEEK=7*e.DAY,e.DAYS_IN_MONTH=[31,28,31,30,31,30,31,31,30,31,30,31],e.NEVER=0,e.date.next=function(t,n,r,a,i,u){return e.date.build(t,void 0!==n?n-1:0,void 0!==r?r:1,a||0,i||0,u||0)},e.date.nextRollover=function(t,n,r,a){var i=r.val(t),u=r.extent(t)[1];return i>=(n||u)||n>u?new Date(a.end(t).getTime()+e.SEC):a.start(t)},e.date.prev=function(t,n,r,a,i,u){var o=arguments.length;return n=2>o?11:n-1,r=3>o?e.D.extent(e.date.next(t,n+1))[1]:r,a=4>o?23:a,i=5>o?59:i,u=6>o?59:u,e.date.build(t,n,r,a,i,u)},e.date.prevRollover=function(e,t,n,r){var a=n.val(e);return t>=a||!t?r.start(r.prev(e,r.val(e)-1)):r.start(e)},e.parse={},e.parse.cron=function(e,t){function n(e,t,n){return isNaN(e)?s[e]||null:Math.min(+e+(t||0),n||9999)}function r(e){var t,n={};for(t in e)"dc"!==t&&"d"!==t&&(n[t]=e[t].slice(0));return n}function a(e,t,n,r,a){var i=n;for(e[t]||(e[t]=[]);r>=i;)e[t].indexOf(i)<0&&e[t].push(i),i+=a||1;e[t].sort(function(e,t){return e-t})}function i(e,t,n,i){(t.d&&!t.dc||t.dc&&t.dc.indexOf(i)<0)&&(e.push(r(t)),t=e[e.length-1]),a(t,"d",n,n),a(t,"dc",i,i)}function u(e,t,n){var r={},i={};1===n?(a(t,"D",1,3),a(t,"d",s.MON,s.FRI),a(r,"D",2,2),a(r,"d",s.TUE,s.FRI),a(i,"D",3,3),a(i,"d",s.TUE,s.FRI)):(a(t,"D",n-1,n+1),a(t,"d",s.MON,s.FRI),a(r,"D",n-1,n-1),a(r,"d",s.MON,s.THU),a(i,"D",n+1,n+1),a(i,"d",s.TUE,s.FRI)),e.exceptions.push(r),e.exceptions.push(i)}function o(e,t,r,i,u,o){var f=e.split("/"),d=+f[1],v=f[0];if("*"!==v&&"0"!==v){var l=v.split("-");i=n(l[0],o,u),u=n(l[1],o,u)||u}a(t,r,i,u,d)}function f(e,t,r,f,d,v){var l,c,s=t.schedules,m=s[s.length-1];"L"===e&&(e=f-1),null!==(l=n(e,v,d))?a(m,r,l,l):null!==(l=n(e.replace("W",""),v,d))?u(t,m,l):null!==(l=n(e.replace("L",""),v,d))?i(s,m,l,f-1):2===(c=e.split("#")).length?(l=n(c[0],v,d),i(s,m,l,n(c[1]))):o(e,m,r,f,d,v)}function d(e){return e.indexOf("#")>-1||e.indexOf("L")>0}function v(e,t){return d(e)&&!d(t)?1:e-t}function l(e){var t,n,r,a,i={schedules:[{}],exceptions:[]},u=e.replace(/(\s)+/g," ").split(" ");for(t in h)if(n=h[t],r=u[n[0]],r&&"*"!==r&&"?"!==r){a=r.split(",").sort(v);var o,d=a.length;for(o=0;d>o;o++)f(a[o],i,t,n[1],n[2],n[3])}return i}function c(e){var t=e.toUpperCase();return m[t]||t}var s={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12,SUN:1,MON:2,TUE:3,WED:4,THU:5,FRI:6,SAT:7},m={"* * * * * *":"0/1 * * * * *","@YEARLY":"0 0 1 1 *","@ANNUALLY":"0 0 1 1 *","@MONTHLY":"0 0 1 * *","@WEEKLY":"0 0 * * 0","@DAILY":"0 0 * * *","@HOURLY":"0 * * * *"},h={s:[0,0,59],m:[1,0,59],h:[2,0,23],D:[3,1,31],M:[4,1,12],Y:[6,1970,2099],d:[5,1,7,1]},x=c(e);return l(t?x:"0 "+x)},e.parse.recur=function(){function t(e,t,l){if(e=u?e+"_"+u:e,n||(s.push({}),n=s[0]),n[e]||(n[e]=[]),r=n[e],i){for(a=[],d=t;l>=d;d+=i)a.push(d);v={n:e,x:i,c:r.length,m:l}}a=o?[t]:f?[l]:a;var c=a.length;for(d=0;c>d;d+=1){var m=a[d];r.indexOf(m)<0&&r.push(m)}a=i=u=o=f=0}var n,r,a,i,u,o,f,d,v,l=[],c=[],s=l;return{schedules:l,exceptions:c,on:function(){return a=arguments[0]instanceof Array?arguments[0]:arguments,this},every:function(e){return i=e||1,this},after:function(e){return u="a",a=[e],this},before:function(e){return u="b",a=[e],this},first:function(){return o=1,this},last:function(){return f=1,this},time:function(){for(var e=0,n=a.length;n>e;e++){var r=a[e].split(":");r.length<3&&r.push(0),a[e]=3600*+r[0]+60*+r[1]+ +r[2]}return t("t"),this},second:function(){return t("s",0,59),this},minute:function(){return t("m",0,59),this},hour:function(){return t("h",0,23),this},dayOfMonth:function(){return t("D",1,f?0:31),this},dayOfWeek:function(){return t("d",1,7),this},onWeekend:function(){return a=[1,7],this.dayOfWeek()},onWeekday:function(){return a=[2,3,4,5,6],this.dayOfWeek()},dayOfWeekCount:function(){return t("dc",1,f?0:5),this},dayOfYear:function(){return t("dy",1,f?0:366),this},weekOfMonth:function(){return t("wm",1,f?0:5),this},weekOfYear:function(){return t("wy",1,f?0:53),this},month:function(){return t("M",1,12),this},year:function(){return t("Y",1970,2450),this},fullDate:function(){for(var e=0,n=a.length;n>e;e++)a[e]=a[e].getTime();return t("fd"),this},customModifier:function(t,n){var r=e.modifier[t];if(!r)throw new Error("Custom modifier "+t+" not recognized!");return u=t,a=arguments[1]instanceof Array?arguments[1]:[arguments[1]],this},customPeriod:function(n){var r=e[n];if(!r)throw new Error("Custom time period "+n+" not recognized!");return t(n,r.extent(new Date)[0],r.extent(new Date)[1]),this},startingOn:function(e){return this.between(e,v.m)},between:function(e,r){return n[v.n]=n[v.n].splice(0,v.c),i=v.x,t(v.n,e,r),this},and:function(){return n=s[s.push({})-1],this},except:function(){return s=c,n=null,this}}},e.parse.text=function(t){function n(e,t,n,r){return{startPos:e,endPos:t,text:n,type:r}}function r(e){var t,r,a,i,u,o,f=e instanceof Array?e:[e],d=/\s+/;for(f.push(d),u=w;!t||t.type===d;){o=-1,r=y.substring(u),t=n(u,u,y.split(d)[0]);var v,l=f.length;for(v=0;l>v;v++)i=f[v],a=i.exec(r),a&&0===a.index&&a[0].length>o&&(o=a[0].length,t=n(u,u+o,r.substring(0,o),i));t.type===d&&(u=t.endPos)}return t}function a(e){var t=r(e);return w=t.endPos,t}function i(e){for(var t=+s(e),n=l(g.through)?+s(e):t,r=[],a=t;n>=a;a++)r.push(a);return r}function u(e){for(var t=i(e);l(g.and);)t=t.concat(i(e));return t}function o(e){var t,n,r,a;l(g.weekend)?e.on(p.sun,p.sat).dayOfWeek():l(g.weekday)?e.on(p.mon,p.tue,p.wed,p.thu,p.fri).dayOfWeek():(t=s(g.rank),e.every(t),n=v(e),l(g.start)?(t=s(g.rank),e.startingOn(t),c(n.type)):l(g.between)&&(r=s(g.rank),l(g.and)&&(a=s(g.rank),e.between(r,a))))}function f(e){l(g.first)?e.first():l(g.last)?e.last():e.on(u(g.rank)),v(e)}function d(e){w=0,y=e,h=-1;for(var t=x();wh;){var n=c([g.every,g.after,g.before,g.onthe,g.on,g.of,g["in"],g.at,g.and,g.except,g.also]);switch(n.type){case g.every:o(t);break;case g.after:void 0!==r(g.time).type?(t.after(s(g.time)),t.time()):(t.after(s(g.rank)),v(t));break;case g.before:void 0!==r(g.time).type?(t.before(s(g.time)),t.time()):(t.before(s(g.rank)),v(t));break;case g.onthe:f(t);break;case g.on:t.on(u(g.dayName)).dayOfWeek();break;case g.of:t.on(u(g.monthName)).month();break;case g["in"]:t.on(u(g.yearIndex)).year();break;case g.at:for(t.on(s(g.time)).time();l(g.and);)t.on(s(g.time)).time();break;case g.and:break;case g.also:t.and();break;case g.except:t.except();break;default:h=w}}return{schedules:t.schedules,exceptions:t.exceptions,error:h}}function v(e){var t=c([g.second,g.minute,g.hour,g.dayOfYear,g.dayOfWeek,g.dayInstance,g.day,g.month,g.year,g.weekOfMonth,g.weekOfYear]);switch(t.type){case g.second:e.second();break;case g.minute:e.minute();break;case g.hour:e.hour();break;case g.dayOfYear:e.dayOfYear();break;case g.dayOfWeek:e.dayOfWeek();break;case g.dayInstance:e.dayOfWeekCount();break;case g.day:e.dayOfMonth();break;case g.weekOfMonth:e.weekOfMonth();break;case g.weekOfYear:e.weekOfYear();break;case g.month:e.month();break;case g.year:e.year();break;default:h=w}return t}function l(e){var t=r(e).type===e;return t&&a(e),t}function c(e){var t=a(e);return t.type?t.text=m(t.text,e):h=w,t}function s(e){return c(e).text}function m(e,t){var n=e;switch(t){case g.time:var r=e.split(/(:|am|pm)/),a="pm"===r[3]&&r[0]<12?parseInt(r[0],10)+12:r[0],i=r[2].trim();n=(1===a.length?"0":"")+a+":"+i;break;case g.rank:n=parseInt(/^\d+/.exec(e)[0],10);break;case g.monthName:case g.dayName:n=p[e.substring(0,3)]}return n}var h,x=e.parse.recur,w=0,y="",g={eof:/^$/,rank:/^((\d+)(st|nd|rd|th)?)\b/,time:/^((([0]?[1-9]|1[0-2]):[0-5]\d(\s)?(am|pm))|(([0]?\d|1\d|2[0-3]):[0-5]\d))\b/,dayName:/^((sun|mon|tue(s)?|wed(nes)?|thu(r(s)?)?|fri|sat(ur)?)(day)?)\b/,monthName:/^(jan(uary)?|feb(ruary)?|ma((r(ch)?)?|y)|apr(il)?|ju(ly|ne)|aug(ust)?|oct(ober)?|(sept|nov|dec)(ember)?)\b/,yearIndex:/^(\d\d\d\d)\b/,every:/^every\b/,after:/^after\b/,before:/^before\b/,second:/^(s|sec(ond)?(s)?)\b/,minute:/^(m|min(ute)?(s)?)\b/,hour:/^(h|hour(s)?)\b/,day:/^(day(s)?( of the month)?)\b/,dayInstance:/^day instance\b/,dayOfWeek:/^day(s)? of the week\b/,dayOfYear:/^day(s)? of the year\b/,weekOfYear:/^week(s)?( of the year)?\b/,weekOfMonth:/^week(s)? of the month\b/,weekday:/^weekday\b/,weekend:/^weekend\b/,month:/^month(s)?\b/,year:/^year(s)?\b/,between:/^between (the)?\b/,start:/^(start(ing)? (at|on( the)?)?)\b/,at:/^(at|@)\b/,and:/^(,|and\b)/,except:/^(except\b)/,also:/(also)\b/,first:/^(first)\b/,last:/^last\b/,"in":/^in\b/,of:/^of\b/,onthe:/^on the\b/,on:/^on\b/,through:/(-|^(to|through)\b)/},p={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12,sun:1,mon:2,tue:3,wed:4,thu:5,fri:6,sat:7,"1st":1,fir:1,"2nd":2,sec:2,"3rd":3,thi:3,"4th":4,"for":4};return d(t.toLowerCase())},e}(); \ No newline at end of file diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/localhelper.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/localhelper.js deleted file mode 100644 index ee281e0e..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/localhelper.js +++ /dev/null @@ -1,99 +0,0 @@ - -//local storage maanger -var lsm; -if (!lsm) lsm = {}; - -(function () { - - lsm.getStorage = function (key) { - localStorage.getItem(key); - } - - lsm.saveStorage = function (key, item) { - if (item !== null) - localStorage.setItem(key, item) - } - - lsm.deleteStorage = function (key) { - localStorage.removeItem(key); - } - - lsm.saveUserIdentity = function (user) { - var item = JSON.stringify(user); - if (item !== null && item !== '') { - localStorage.setItem("slickflowuser", item); - } - } - - lsm.getUserIdentity = function () { - var userStr = localStorage.getItem("slickflowuser"); - if (userStr !== null && userStr !== '') - return JSON.parse(userStr); - else - return null; - } - - lsm.removeUserIdentity = function () { - localStorage.removeItem("slickflowuser"); - } - - lsm.saveUserAuthData = function (authData) { - var item = JSON.stringify(authData); - if (item !== null && item !== '') { - localStorage.setItem("slickflowauth", item); - } - } - - lsm.getUserAuthData = function () { - var authStr = localStorage.getItem("slickflowauth"); - if (authStr !== null && authStr !== '') - return JSON.parse(authStr); - else - return null; - } - - lsm.removeUserAuthData = function () { - localStorage.removeItem("slickflowauth"); - } - - lsm.saveUserRole = function (role) { - var item = JSON.stringify(role); - if (item !== null && item !== '') { - localStorage.setItem("slickflowuserrole", item); - } - } - - lsm.getUserRole = function () { - var roleStr = localStorage.getItem("slickflowuserrole"); - if (roleStr !== null && roleStr !== '') - return JSON.parse(roleStr); - else - return null; - } - - lsm.removeUserRole = function () { - localStorage.removeItem("slickflowuserrole"); - } - - lsm.removeTempStorage = function () { - lsm.removeUserIdentity(); - lsm.removeUserAuthData(); - lsm.removeUserRole(); - } - - lsm.checkUserPermission = function (resourceCode) { - var isPermitted = false; - var resourceList = lsm.getUserAuthData(); - - for (var i = 0; i < resourceList.length; i++) { - if (resourceList[i].ResourceCode == resourceCode) { - isPermitted = true; - break; - } - } - - return isPermitted; - } - -})(lsm); - diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/modernizr-2.6.2.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/modernizr-2.6.2.js deleted file mode 100644 index cbfe1f39..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/modernizr-2.6.2.js +++ /dev/null @@ -1,1416 +0,0 @@ -/* NUGET: BEGIN LICENSE TEXT - * - * Microsoft grants you the right to use these script files for the sole - * purpose of either: (i) interacting through your browser with the Microsoft - * website or online service, subject to the applicable licensing or use - * terms; or (ii) using the files as included with a Microsoft product subject - * to that product's license terms. Microsoft reserves all other rights to the - * files not expressly granted by Microsoft, whether by implication, estoppel - * or otherwise. Insofar as a script file is dual licensed under GPL, - * Microsoft neither took the code under GPL nor distributes it thereunder but - * under the terms set out in this paragraph. All notices and licenses - * below are for informational purposes only. - * - * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton; http://www.modernizr.com/license/ - * - * Includes matchMedia polyfill; Copyright (c) 2010 Filament Group, Inc; http://opensource.org/licenses/MIT - * - * Includes material adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js; Copyright 2009-2012 by contributors; http://opensource.org/licenses/MIT - * - * Includes material from css-support; Copyright (c) 2005-2012 Diego Perini; https://github.com/dperini/css-support/blob/master/LICENSE - * - * NUGET: END LICENSE TEXT */ - -/*! - * Modernizr v2.6.2 - * www.modernizr.com - * - * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton - * Available under the BSD and MIT licenses: www.modernizr.com/license/ - */ - -/* - * Modernizr tests which native CSS3 and HTML5 features are available in - * the current UA and makes the results available to you in two ways: - * as properties on a global Modernizr object, and as classes on the - * element. This information allows you to progressively enhance - * your pages with a granular level of control over the experience. - * - * Modernizr has an optional (not included) conditional resource loader - * called Modernizr.load(), based on Yepnope.js (yepnopejs.com). - * To get a build that includes Modernizr.load(), as well as choosing - * which tests to include, go to www.modernizr.com/download/ - * - * Authors Faruk Ates, Paul Irish, Alex Sexton - * Contributors Ryan Seddon, Ben Alman - */ - -window.Modernizr = (function( window, document, undefined ) { - - var version = '2.6.2', - - Modernizr = {}, - - /*>>cssclasses*/ - // option for enabling the HTML classes to be added - enableClasses = true, - /*>>cssclasses*/ - - docElement = document.documentElement, - - /** - * Create our "modernizr" element that we do most feature tests on. - */ - mod = 'modernizr', - modElem = document.createElement(mod), - mStyle = modElem.style, - - /** - * Create the input element for various Web Forms feature tests. - */ - inputElem /*>>inputelem*/ = document.createElement('input') /*>>inputelem*/ , - - /*>>smile*/ - smile = ':)', - /*>>smile*/ - - toString = {}.toString, - - // TODO :: make the prefixes more granular - /*>>prefixes*/ - // List of property values to set for css tests. See ticket #21 - prefixes = ' -webkit- -moz- -o- -ms- '.split(' '), - /*>>prefixes*/ - - /*>>domprefixes*/ - // Following spec is to expose vendor-specific style properties as: - // elem.style.WebkitBorderRadius - // and the following would be incorrect: - // elem.style.webkitBorderRadius - - // Webkit ghosts their properties in lowercase but Opera & Moz do not. - // Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+ - // erik.eae.net/archives/2008/03/10/21.48.10/ - - // More here: github.com/Modernizr/Modernizr/issues/issue/21 - omPrefixes = 'Webkit Moz O ms', - - cssomPrefixes = omPrefixes.split(' '), - - domPrefixes = omPrefixes.toLowerCase().split(' '), - /*>>domprefixes*/ - - /*>>ns*/ - ns = {'svg': 'http://www.w3.org/2000/svg'}, - /*>>ns*/ - - tests = {}, - inputs = {}, - attrs = {}, - - classes = [], - - slice = classes.slice, - - featureName, // used in testing loop - - - /*>>teststyles*/ - // Inject element with style element and some CSS rules - injectElementWithStyles = function( rule, callback, nodes, testnames ) { - - var style, ret, node, docOverflow, - div = document.createElement('div'), - // After page load injecting a fake body doesn't work so check if body exists - body = document.body, - // IE6 and 7 won't return offsetWidth or offsetHeight unless it's in the body element, so we fake it. - fakeBody = body || document.createElement('body'); - - if ( parseInt(nodes, 10) ) { - // In order not to give false positives we create a node for each test - // This also allows the method to scale for unspecified uses - while ( nodes-- ) { - node = document.createElement('div'); - node.id = testnames ? testnames[nodes] : mod + (nodes + 1); - div.appendChild(node); - } - } - - // '].join(''); - div.id = mod; - // IE6 will false positive on some tests due to the style element inside the test div somehow interfering offsetHeight, so insert it into body or fakebody. - // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270 - (body ? div : fakeBody).innerHTML += style; - fakeBody.appendChild(div); - if ( !body ) { - //avoid crashing IE8, if background image is used - fakeBody.style.background = ''; - //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible - fakeBody.style.overflow = 'hidden'; - docOverflow = docElement.style.overflow; - docElement.style.overflow = 'hidden'; - docElement.appendChild(fakeBody); - } - - ret = callback(div, rule); - // If this is done after page load we don't want to remove the body so check if body exists - if ( !body ) { - fakeBody.parentNode.removeChild(fakeBody); - docElement.style.overflow = docOverflow; - } else { - div.parentNode.removeChild(div); - } - - return !!ret; - - }, - /*>>teststyles*/ - - /*>>mq*/ - // adapted from matchMedia polyfill - // by Scott Jehl and Paul Irish - // gist.github.com/786768 - testMediaQuery = function( mq ) { - - var matchMedia = window.matchMedia || window.msMatchMedia; - if ( matchMedia ) { - return matchMedia(mq).matches; - } - - var bool; - - injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) { - bool = (window.getComputedStyle ? - getComputedStyle(node, null) : - node.currentStyle)['position'] == 'absolute'; - }); - - return bool; - - }, - /*>>mq*/ - - - /*>>hasevent*/ - // - // isEventSupported determines if a given element supports the given event - // kangax.github.com/iseventsupported/ - // - // The following results are known incorrects: - // Modernizr.hasEvent("webkitTransitionEnd", elem) // false negative - // Modernizr.hasEvent("textInput") // in Webkit. github.com/Modernizr/Modernizr/issues/333 - // ... - isEventSupported = (function() { - - var TAGNAMES = { - 'select': 'input', 'change': 'input', - 'submit': 'form', 'reset': 'form', - 'error': 'img', 'load': 'img', 'abort': 'img' - }; - - function isEventSupported( eventName, element ) { - - element = element || document.createElement(TAGNAMES[eventName] || 'div'); - eventName = 'on' + eventName; - - // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those - var isSupported = eventName in element; - - if ( !isSupported ) { - // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element - if ( !element.setAttribute ) { - element = document.createElement('div'); - } - if ( element.setAttribute && element.removeAttribute ) { - element.setAttribute(eventName, ''); - isSupported = is(element[eventName], 'function'); - - // If property was created, "remove it" (by setting value to `undefined`) - if ( !is(element[eventName], 'undefined') ) { - element[eventName] = undefined; - } - element.removeAttribute(eventName); - } - } - - element = null; - return isSupported; - } - return isEventSupported; - })(), - /*>>hasevent*/ - - // TODO :: Add flag for hasownprop ? didn't last time - - // hasOwnProperty shim by kangax needed for Safari 2.0 support - _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp; - - if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) { - hasOwnProp = function (object, property) { - return _hasOwnProperty.call(object, property); - }; - } - else { - hasOwnProp = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */ - return ((property in object) && is(object.constructor.prototype[property], 'undefined')); - }; - } - - // Adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js - // es5.github.com/#x15.3.4.5 - - if (!Function.prototype.bind) { - Function.prototype.bind = function bind(that) { - - var target = this; - - if (typeof target != "function") { - throw new TypeError(); - } - - var args = slice.call(arguments, 1), - bound = function () { - - if (this instanceof bound) { - - var F = function(){}; - F.prototype = target.prototype; - var self = new F(); - - var result = target.apply( - self, - args.concat(slice.call(arguments)) - ); - if (Object(result) === result) { - return result; - } - return self; - - } else { - - return target.apply( - that, - args.concat(slice.call(arguments)) - ); - - } - - }; - - return bound; - }; - } - - /** - * setCss applies given styles to the Modernizr DOM node. - */ - function setCss( str ) { - mStyle.cssText = str; - } - - /** - * setCssAll extrapolates all vendor-specific css strings. - */ - function setCssAll( str1, str2 ) { - return setCss(prefixes.join(str1 + ';') + ( str2 || '' )); - } - - /** - * is returns a boolean for if typeof obj is exactly type. - */ - function is( obj, type ) { - return typeof obj === type; - } - - /** - * contains returns a boolean for if substr is found within str. - */ - function contains( str, substr ) { - return !!~('' + str).indexOf(substr); - } - - /*>>testprop*/ - - // testProps is a generic CSS / DOM property test. - - // In testing support for a given CSS property, it's legit to test: - // `elem.style[styleName] !== undefined` - // If the property is supported it will return an empty string, - // if unsupported it will return undefined. - - // We'll take advantage of this quick test and skip setting a style - // on our modernizr element, but instead just testing undefined vs - // empty string. - - // Because the testing of the CSS property names (with "-", as - // opposed to the camelCase DOM properties) is non-portable and - // non-standard but works in WebKit and IE (but not Gecko or Opera), - // we explicitly reject properties with dashes so that authors - // developing in WebKit or IE first don't end up with - // browser-specific content by accident. - - function testProps( props, prefixed ) { - for ( var i in props ) { - var prop = props[i]; - if ( !contains(prop, "-") && mStyle[prop] !== undefined ) { - return prefixed == 'pfx' ? prop : true; - } - } - return false; - } - /*>>testprop*/ - - // TODO :: add testDOMProps - /** - * testDOMProps is a generic DOM property test; if a browser supports - * a certain property, it won't return undefined for it. - */ - function testDOMProps( props, obj, elem ) { - for ( var i in props ) { - var item = obj[props[i]]; - if ( item !== undefined) { - - // return the property name as a string - if (elem === false) return props[i]; - - // let's bind a function - if (is(item, 'function')){ - // default to autobind unless override - return item.bind(elem || obj); - } - - // return the unbound function or obj or value - return item; - } - } - return false; - } - - /*>>testallprops*/ - /** - * testPropsAll tests a list of DOM properties we want to check against. - * We specify literally ALL possible (known and/or likely) properties on - * the element including the non-vendor prefixed one, for forward- - * compatibility. - */ - function testPropsAll( prop, prefixed, elem ) { - - var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), - props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' '); - - // did they call .prefixed('boxSizing') or are we just testing a prop? - if(is(prefixed, "string") || is(prefixed, "undefined")) { - return testProps(props, prefixed); - - // otherwise, they called .prefixed('requestAnimationFrame', window[, elem]) - } else { - props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' '); - return testDOMProps(props, prefixed, elem); - } - } - /*>>testallprops*/ - - - /** - * Tests - * ----- - */ - - // The *new* flexbox - // dev.w3.org/csswg/css3-flexbox - - tests['flexbox'] = function() { - return testPropsAll('flexWrap'); - }; - - // The *old* flexbox - // www.w3.org/TR/2009/WD-css3-flexbox-20090723/ - - tests['flexboxlegacy'] = function() { - return testPropsAll('boxDirection'); - }; - - // On the S60 and BB Storm, getContext exists, but always returns undefined - // so we actually have to call getContext() to verify - // github.com/Modernizr/Modernizr/issues/issue/97/ - - tests['canvas'] = function() { - var elem = document.createElement('canvas'); - return !!(elem.getContext && elem.getContext('2d')); - }; - - tests['canvastext'] = function() { - return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function')); - }; - - // webk.it/70117 is tracking a legit WebGL feature detect proposal - - // We do a soft detect which may false positive in order to avoid - // an expensive context creation: bugzil.la/732441 - - tests['webgl'] = function() { - return !!window.WebGLRenderingContext; - }; - - /* - * The Modernizr.touch test only indicates if the browser supports - * touch events, which does not necessarily reflect a touchscreen - * device, as evidenced by tablets running Windows 7 or, alas, - * the Palm Pre / WebOS (touch) phones. - * - * Additionally, Chrome (desktop) used to lie about its support on this, - * but that has since been rectified: crbug.com/36415 - * - * We also test for Firefox 4 Multitouch Support. - * - * For more info, see: modernizr.github.com/Modernizr/touch.html - */ - - tests['touch'] = function() { - var bool; - - if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { - bool = true; - } else { - injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) { - bool = node.offsetTop === 9; - }); - } - - return bool; - }; - - - // geolocation is often considered a trivial feature detect... - // Turns out, it's quite tricky to get right: - // - // Using !!navigator.geolocation does two things we don't want. It: - // 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513 - // 2. Disables page caching in WebKit: webk.it/43956 - // - // Meanwhile, in Firefox < 8, an about:config setting could expose - // a false positive that would throw an exception: bugzil.la/688158 - - tests['geolocation'] = function() { - return 'geolocation' in navigator; - }; - - - tests['postmessage'] = function() { - return !!window.postMessage; - }; - - - // Chrome incognito mode used to throw an exception when using openDatabase - // It doesn't anymore. - tests['websqldatabase'] = function() { - return !!window.openDatabase; - }; - - // Vendors had inconsistent prefixing with the experimental Indexed DB: - // - Webkit's implementation is accessible through webkitIndexedDB - // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB - // For speed, we don't test the legacy (and beta-only) indexedDB - tests['indexedDB'] = function() { - return !!testPropsAll("indexedDB", window); - }; - - // documentMode logic from YUI to filter out IE8 Compat Mode - // which false positives. - tests['hashchange'] = function() { - return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7); - }; - - // Per 1.6: - // This used to be Modernizr.historymanagement but the longer - // name has been deprecated in favor of a shorter and property-matching one. - // The old API is still available in 1.6, but as of 2.0 will throw a warning, - // and in the first release thereafter disappear entirely. - tests['history'] = function() { - return !!(window.history && history.pushState); - }; - - tests['draganddrop'] = function() { - var div = document.createElement('div'); - return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div); - }; - - // FF3.6 was EOL'ed on 4/24/12, but the ESR version of FF10 - // will be supported until FF19 (2/12/13), at which time, ESR becomes FF17. - // FF10 still uses prefixes, so check for it until then. - // for more ESR info, see: mozilla.org/en-US/firefox/organizations/faq/ - tests['websockets'] = function() { - return 'WebSocket' in window || 'MozWebSocket' in window; - }; - - - // css-tricks.com/rgba-browser-support/ - tests['rgba'] = function() { - // Set an rgba() color and check the returned value - - setCss('background-color:rgba(150,255,150,.5)'); - - return contains(mStyle.backgroundColor, 'rgba'); - }; - - tests['hsla'] = function() { - // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally, - // except IE9 who retains it as hsla - - setCss('background-color:hsla(120,40%,100%,.5)'); - - return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla'); - }; - - tests['multiplebgs'] = function() { - // Setting multiple images AND a color on the background shorthand property - // and then querying the style.background property value for the number of - // occurrences of "url(" is a reliable method for detecting ACTUAL support for this! - - setCss('background:url(https://),url(https://),red url(https://)'); - - // If the UA supports multiple backgrounds, there should be three occurrences - // of the string "url(" in the return value for elemStyle.background - - return (/(url\s*\(.*?){3}/).test(mStyle.background); - }; - - - - // this will false positive in Opera Mini - // github.com/Modernizr/Modernizr/issues/396 - - tests['backgroundsize'] = function() { - return testPropsAll('backgroundSize'); - }; - - tests['borderimage'] = function() { - return testPropsAll('borderImage'); - }; - - - // Super comprehensive table about all the unique implementations of - // border-radius: muddledramblings.com/table-of-css3-border-radius-compliance - - tests['borderradius'] = function() { - return testPropsAll('borderRadius'); - }; - - // WebOS unfortunately false positives on this test. - tests['boxshadow'] = function() { - return testPropsAll('boxShadow'); - }; - - // FF3.0 will false positive on this test - tests['textshadow'] = function() { - return document.createElement('div').style.textShadow === ''; - }; - - - tests['opacity'] = function() { - // Browsers that actually have CSS Opacity implemented have done so - // according to spec, which means their return values are within the - // range of [0.0,1.0] - including the leading zero. - - setCssAll('opacity:.55'); - - // The non-literal . in this regex is intentional: - // German Chrome returns this value as 0,55 - // github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632 - return (/^0.55$/).test(mStyle.opacity); - }; - - - // Note, Android < 4 will pass this test, but can only animate - // a single property at a time - // daneden.me/2011/12/putting-up-with-androids-bullshit/ - tests['cssanimations'] = function() { - return testPropsAll('animationName'); - }; - - - tests['csscolumns'] = function() { - return testPropsAll('columnCount'); - }; - - - tests['cssgradients'] = function() { - /** - * For CSS Gradients syntax, please see: - * webkit.org/blog/175/introducing-css-gradients/ - * developer.mozilla.org/en/CSS/-moz-linear-gradient - * developer.mozilla.org/en/CSS/-moz-radial-gradient - * dev.w3.org/csswg/css3-images/#gradients- - */ - - var str1 = 'background-image:', - str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));', - str3 = 'linear-gradient(left top,#9f9, white);'; - - setCss( - // legacy webkit syntax (FIXME: remove when syntax not in use anymore) - (str1 + '-webkit- '.split(' ').join(str2 + str1) + - // standard syntax // trailing 'background-image:' - prefixes.join(str3 + str1)).slice(0, -str1.length) - ); - - return contains(mStyle.backgroundImage, 'gradient'); - }; - - - tests['cssreflections'] = function() { - return testPropsAll('boxReflect'); - }; - - - tests['csstransforms'] = function() { - return !!testPropsAll('transform'); - }; - - - tests['csstransforms3d'] = function() { - - var ret = !!testPropsAll('perspective'); - - // Webkit's 3D transforms are passed off to the browser's own graphics renderer. - // It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in - // some conditions. As a result, Webkit typically recognizes the syntax but - // will sometimes throw a false positive, thus we must do a more thorough check: - if ( ret && 'webkitPerspective' in docElement.style ) { - - // Webkit allows this media query to succeed only if the feature is enabled. - // `@media (transform-3d),(-webkit-transform-3d){ ... }` - injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) { - ret = node.offsetLeft === 9 && node.offsetHeight === 3; - }); - } - return ret; - }; - - - tests['csstransitions'] = function() { - return testPropsAll('transition'); - }; - - - /*>>fontface*/ - // @font-face detection routine by Diego Perini - // javascript.nwbox.com/CSSSupport/ - - // false positives: - // WebOS github.com/Modernizr/Modernizr/issues/342 - // WP7 github.com/Modernizr/Modernizr/issues/538 - tests['fontface'] = function() { - var bool; - - injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) { - var style = document.getElementById('smodernizr'), - sheet = style.sheet || style.styleSheet, - cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : ''; - - bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0; - }); - - return bool; - }; - /*>>fontface*/ - - // CSS generated content detection - tests['generatedcontent'] = function() { - var bool; - - injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) { - bool = node.offsetHeight >= 3; - }); - - return bool; - }; - - - - // These tests evaluate support of the video/audio elements, as well as - // testing what types of content they support. - // - // We're using the Boolean constructor here, so that we can extend the value - // e.g. Modernizr.video // true - // Modernizr.video.ogg // 'probably' - // - // Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845 - // thx to NielsLeenheer and zcorpan - - // Note: in some older browsers, "no" was a return value instead of empty string. - // It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2 - // It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5 - - tests['video'] = function() { - var elem = document.createElement('video'), - bool = false; - - // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224 - try { - if ( bool = !!elem.canPlayType ) { - bool = new Boolean(bool); - bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,''); - - // Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546 - bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,''); - - bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,''); - } - - } catch(e) { } - - return bool; - }; - - tests['audio'] = function() { - var elem = document.createElement('audio'), - bool = false; - - try { - if ( bool = !!elem.canPlayType ) { - bool = new Boolean(bool); - bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,''); - bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,''); - - // Mimetypes accepted: - // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements - // bit.ly/iphoneoscodecs - bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,''); - bool.m4a = ( elem.canPlayType('audio/x-m4a;') || - elem.canPlayType('audio/aac;')) .replace(/^no$/,''); - } - } catch(e) { } - - return bool; - }; - - - // In FF4, if disabled, window.localStorage should === null. - - // Normally, we could not test that directly and need to do a - // `('localStorage' in window) && ` test first because otherwise Firefox will - // throw bugzil.la/365772 if cookies are disabled - - // Also in iOS5 Private Browsing mode, attempting to use localStorage.setItem - // will throw the exception: - // QUOTA_EXCEEDED_ERRROR DOM Exception 22. - // Peculiarly, getItem and removeItem calls do not throw. - - // Because we are forced to try/catch this, we'll go aggressive. - - // Just FWIW: IE8 Compat mode supports these features completely: - // www.quirksmode.org/dom/html5.html - // But IE8 doesn't support either with local files - - tests['localstorage'] = function() { - try { - localStorage.setItem(mod, mod); - localStorage.removeItem(mod); - return true; - } catch(e) { - return false; - } - }; - - tests['sessionstorage'] = function() { - try { - sessionStorage.setItem(mod, mod); - sessionStorage.removeItem(mod); - return true; - } catch(e) { - return false; - } - }; - - - tests['webworkers'] = function() { - return !!window.Worker; - }; - - - tests['applicationcache'] = function() { - return !!window.applicationCache; - }; - - - // Thanks to Erik Dahlstrom - tests['svg'] = function() { - return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect; - }; - - // specifically for SVG inline in HTML, not within XHTML - // test page: paulirish.com/demo/inline-svg - tests['inlinesvg'] = function() { - var div = document.createElement('div'); - div.innerHTML = ''; - return (div.firstChild && div.firstChild.namespaceURI) == ns.svg; - }; - - // SVG SMIL animation - tests['smil'] = function() { - return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate'))); - }; - - // This test is only for clip paths in SVG proper, not clip paths on HTML content - // demo: srufaculty.sru.edu/david.dailey/svg/newstuff/clipPath4.svg - - // However read the comments to dig into applying SVG clippaths to HTML content here: - // github.com/Modernizr/Modernizr/issues/213#issuecomment-1149491 - tests['svgclippaths'] = function() { - return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath'))); - }; - - /*>>webforms*/ - // input features and input types go directly onto the ret object, bypassing the tests loop. - // Hold this guy to execute in a moment. - function webforms() { - /*>>input*/ - // Run through HTML5's new input attributes to see if the UA understands any. - // We're using f which is the element created early on - // Mike Taylr has created a comprehensive resource for testing these attributes - // when applied to all input types: - // miketaylr.com/code/input-type-attr.html - // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary - - // Only input placeholder is tested while textarea's placeholder is not. - // Currently Safari 4 and Opera 11 have support only for the input placeholder - // Both tests are available in feature-detects/forms-placeholder.js - Modernizr['input'] = (function( props ) { - for ( var i = 0, len = props.length; i < len; i++ ) { - attrs[ props[i] ] = !!(props[i] in inputElem); - } - if (attrs.list){ - // safari false positive's on datalist: webk.it/74252 - // see also github.com/Modernizr/Modernizr/issues/146 - attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement); - } - return attrs; - })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' ')); - /*>>input*/ - - /*>>inputtypes*/ - // Run through HTML5's new input types to see if the UA understands any. - // This is put behind the tests runloop because it doesn't return a - // true/false like all the other tests; instead, it returns an object - // containing each input type with its corresponding true/false value - - // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/ - Modernizr['inputtypes'] = (function(props) { - - for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) { - - inputElem.setAttribute('type', inputElemType = props[i]); - bool = inputElem.type !== 'text'; - - // We first check to see if the type we give it sticks.. - // If the type does, we feed it a textual value, which shouldn't be valid. - // If the value doesn't stick, we know there's input sanitization which infers a custom UI - if ( bool ) { - - inputElem.value = smile; - inputElem.style.cssText = 'position:absolute;visibility:hidden;'; - - if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) { - - docElement.appendChild(inputElem); - defaultView = document.defaultView; - - // Safari 2-4 allows the smiley as a value, despite making a slider - bool = defaultView.getComputedStyle && - defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' && - // Mobile android web browser has false positive, so must - // check the height to see if the widget is actually there. - (inputElem.offsetHeight !== 0); - - docElement.removeChild(inputElem); - - } else if ( /^(search|tel)$/.test(inputElemType) ){ - // Spec doesn't define any special parsing or detectable UI - // behaviors so we pass these through as true - - // Interestingly, opera fails the earlier test, so it doesn't - // even make it here. - - } else if ( /^(url|email)$/.test(inputElemType) ) { - // Real url and email support comes with prebaked validation. - bool = inputElem.checkValidity && inputElem.checkValidity() === false; - - } else { - // If the upgraded input compontent rejects the :) text, we got a winner - bool = inputElem.value != smile; - } - } - - inputs[ props[i] ] = !!bool; - } - return inputs; - })('search tel url email datetime date month week time datetime-local number range color'.split(' ')); - /*>>inputtypes*/ - } - /*>>webforms*/ - - - // End of test definitions - // ----------------------- - - - - // Run through all tests and detect their support in the current UA. - // todo: hypothetically we could be doing an array of tests and use a basic loop here. - for ( var feature in tests ) { - if ( hasOwnProp(tests, feature) ) { - // run the test, throw the return value into the Modernizr, - // then based on that boolean, define an appropriate className - // and push it into an array of classes we'll join later. - featureName = feature.toLowerCase(); - Modernizr[featureName] = tests[feature](); - - classes.push((Modernizr[featureName] ? '' : 'no-') + featureName); - } - } - - /*>>webforms*/ - // input tests need to run. - Modernizr.input || webforms(); - /*>>webforms*/ - - - /** - * addTest allows the user to define their own feature tests - * the result will be added onto the Modernizr object, - * as well as an appropriate className set on the html element - * - * @param feature - String naming the feature - * @param test - Function returning true if feature is supported, false if not - */ - Modernizr.addTest = function ( feature, test ) { - if ( typeof feature == 'object' ) { - for ( var key in feature ) { - if ( hasOwnProp( feature, key ) ) { - Modernizr.addTest( key, feature[ key ] ); - } - } - } else { - - feature = feature.toLowerCase(); - - if ( Modernizr[feature] !== undefined ) { - // we're going to quit if you're trying to overwrite an existing test - // if we were to allow it, we'd do this: - // var re = new RegExp("\\b(no-)?" + feature + "\\b"); - // docElement.className = docElement.className.replace( re, '' ); - // but, no rly, stuff 'em. - return Modernizr; - } - - test = typeof test == 'function' ? test() : test; - - if (typeof enableClasses !== "undefined" && enableClasses) { - docElement.className += ' ' + (test ? '' : 'no-') + feature; - } - Modernizr[feature] = test; - - } - - return Modernizr; // allow chaining. - }; - - - // Reset modElem.cssText to nothing to reduce memory footprint. - setCss(''); - modElem = inputElem = null; - - /*>>shiv*/ - /*! HTML5 Shiv v3.6.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */ - ;(function(window, document) { - /*jshint evil:true */ - /** Preset options */ - var options = window.html5 || {}; - - /** Used to skip problem elements */ - var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; - - /** Not all elements can be cloned in IE **/ - var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; - - /** Detect whether the browser supports default html5 styles */ - var supportsHtml5Styles; - - /** Name of the expando, to work with multiple documents or to re-shiv one document */ - var expando = '_html5shiv'; - - /** The id for the the documents expando */ - var expanID = 0; - - /** Cached data for each document */ - var expandoData = {}; - - /** Detect whether the browser supports unknown elements */ - var supportsUnknownElements; - - (function() { - try { - var a = document.createElement('a'); - a.innerHTML = ''; - //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles - supportsHtml5Styles = ('hidden' in a); - - supportsUnknownElements = a.childNodes.length == 1 || (function() { - // assign a false positive if unable to shiv - (document.createElement)('a'); - var frag = document.createDocumentFragment(); - return ( - typeof frag.cloneNode == 'undefined' || - typeof frag.createDocumentFragment == 'undefined' || - typeof frag.createElement == 'undefined' - ); - }()); - } catch(e) { - supportsHtml5Styles = true; - supportsUnknownElements = true; - } - - }()); - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a style sheet with the given CSS text and adds it to the document. - * @private - * @param {Document} ownerDocument The document. - * @param {String} cssText The CSS text. - * @returns {StyleSheet} The style element. - */ - function addStyleSheet(ownerDocument, cssText) { - var p = ownerDocument.createElement('p'), - parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; - - p.innerHTML = 'x'; - return parent.insertBefore(p.lastChild, parent.firstChild); - } - - /** - * Returns the value of `html5.elements` as an array. - * @private - * @returns {Array} An array of shived element node names. - */ - function getElements() { - var elements = html5.elements; - return typeof elements == 'string' ? elements.split(' ') : elements; - } - - /** - * Returns the data associated to the given document - * @private - * @param {Document} ownerDocument The document. - * @returns {Object} An object of data. - */ - function getExpandoData(ownerDocument) { - var data = expandoData[ownerDocument[expando]]; - if (!data) { - data = {}; - expanID++; - ownerDocument[expando] = expanID; - expandoData[expanID] = data; - } - return data; - } - - /** - * returns a shived element for the given nodeName and document - * @memberOf html5 - * @param {String} nodeName name of the element - * @param {Document} ownerDocument The context document. - * @returns {Object} The shived element. - */ - function createElement(nodeName, ownerDocument, data){ - if (!ownerDocument) { - ownerDocument = document; - } - if(supportsUnknownElements){ - return ownerDocument.createElement(nodeName); - } - if (!data) { - data = getExpandoData(ownerDocument); - } - var node; - - if (data.cache[nodeName]) { - node = data.cache[nodeName].cloneNode(); - } else if (saveClones.test(nodeName)) { - node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); - } else { - node = data.createElem(nodeName); - } - - // Avoid adding some elements to fragments in IE < 9 because - // * Attributes like `name` or `type` cannot be set/changed once an element - // is inserted into a document/fragment - // * Link elements with `src` attributes that are inaccessible, as with - // a 403 response, will cause the tab/window to crash - // * Script elements appended to fragments will execute when their `src` - // or `text` property is set - return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node; - } - - /** - * returns a shived DocumentFragment for the given document - * @memberOf html5 - * @param {Document} ownerDocument The context document. - * @returns {Object} The shived DocumentFragment. - */ - function createDocumentFragment(ownerDocument, data){ - if (!ownerDocument) { - ownerDocument = document; - } - if(supportsUnknownElements){ - return ownerDocument.createDocumentFragment(); - } - data = data || getExpandoData(ownerDocument); - var clone = data.frag.cloneNode(), - i = 0, - elems = getElements(), - l = elems.length; - for(;i>shiv*/ - - // Assign private properties to the return object with prefix - Modernizr._version = version; - - // expose these for the plugin API. Look in the source for how to join() them against your input - /*>>prefixes*/ - Modernizr._prefixes = prefixes; - /*>>prefixes*/ - /*>>domprefixes*/ - Modernizr._domPrefixes = domPrefixes; - Modernizr._cssomPrefixes = cssomPrefixes; - /*>>domprefixes*/ - - /*>>mq*/ - // Modernizr.mq tests a given media query, live against the current state of the window - // A few important notes: - // * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false - // * A max-width or orientation query will be evaluated against the current state, which may change later. - // * You must specify values. Eg. If you are testing support for the min-width media query use: - // Modernizr.mq('(min-width:0)') - // usage: - // Modernizr.mq('only screen and (max-width:768)') - Modernizr.mq = testMediaQuery; - /*>>mq*/ - - /*>>hasevent*/ - // Modernizr.hasEvent() detects support for a given event, with an optional element to test on - // Modernizr.hasEvent('gesturestart', elem) - Modernizr.hasEvent = isEventSupported; - /*>>hasevent*/ - - /*>>testprop*/ - // Modernizr.testProp() investigates whether a given style property is recognized - // Note that the property names must be provided in the camelCase variant. - // Modernizr.testProp('pointerEvents') - Modernizr.testProp = function(prop){ - return testProps([prop]); - }; - /*>>testprop*/ - - /*>>testallprops*/ - // Modernizr.testAllProps() investigates whether a given style property, - // or any of its vendor-prefixed variants, is recognized - // Note that the property names must be provided in the camelCase variant. - // Modernizr.testAllProps('boxSizing') - Modernizr.testAllProps = testPropsAll; - /*>>testallprops*/ - - - /*>>teststyles*/ - // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards - // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... }) - Modernizr.testStyles = injectElementWithStyles; - /*>>teststyles*/ - - - /*>>prefixed*/ - // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input - // Modernizr.prefixed('boxSizing') // 'MozBoxSizing' - - // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style. - // Return values will also be the camelCase variant, if you need to translate that to hypenated style use: - // - // str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); - - // If you're trying to ascertain which transition end event to bind to, you might do something like... - // - // var transEndEventNames = { - // 'WebkitTransition' : 'webkitTransitionEnd', - // 'MozTransition' : 'transitionend', - // 'OTransition' : 'oTransitionEnd', - // 'msTransition' : 'MSTransitionEnd', - // 'transition' : 'transitionend' - // }, - // transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ]; - - Modernizr.prefixed = function(prop, obj, elem){ - if(!obj) { - return testPropsAll(prop, 'pfx'); - } else { - // Testing DOM property e.g. Modernizr.prefixed('requestAnimationFrame', window) // 'mozRequestAnimationFrame' - return testPropsAll(prop, obj, elem); - } - }; - /*>>prefixed*/ - - - /*>>cssclasses*/ - // Remove "no-js" class from element, if it exists: - docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') + - - // Add the new classes to the element. - (enableClasses ? ' js ' + classes.join(' ') : ''); - /*>>cssclasses*/ - - return Modernizr; - -})(this, this.document); diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/respond.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/respond.js deleted file mode 100644 index 378d773d..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/respond.js +++ /dev/null @@ -1,340 +0,0 @@ -/* NUGET: BEGIN LICENSE TEXT - * - * Microsoft grants you the right to use these script files for the sole - * purpose of either: (i) interacting through your browser with the Microsoft - * website or online service, subject to the applicable licensing or use - * terms; or (ii) using the files as included with a Microsoft product subject - * to that product's license terms. Microsoft reserves all other rights to the - * files not expressly granted by Microsoft, whether by implication, estoppel - * or otherwise. Insofar as a script file is dual licensed under GPL, - * Microsoft neither took the code under GPL nor distributes it thereunder but - * under the terms set out in this paragraph. All notices and licenses - * below are for informational purposes only. - * - * NUGET: END LICENSE TEXT */ -/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ -/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ -window.matchMedia = window.matchMedia || (function(doc, undefined){ - - var bool, - docElem = doc.documentElement, - refNode = docElem.firstElementChild || docElem.firstChild, - // fakeBody required for - fakeBody = doc.createElement('body'), - div = doc.createElement('div'); - - div.id = 'mq-test-1'; - div.style.cssText = "position:absolute;top:-100em"; - fakeBody.style.background = "none"; - fakeBody.appendChild(div); - - return function(q){ - - div.innerHTML = '­'; - - docElem.insertBefore(fakeBody, refNode); - bool = div.offsetWidth == 42; - docElem.removeChild(fakeBody); - - return { matches: bool, media: q }; - }; - -})(document); - - - - -/*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ -(function( win ){ - //exposed namespace - win.respond = {}; - - //define update even in native-mq-supporting browsers, to avoid errors - respond.update = function(){}; - - //expose media query support flag for external use - respond.mediaQueriesSupported = win.matchMedia && win.matchMedia( "only all" ).matches; - - //if media queries are supported, exit here - if( respond.mediaQueriesSupported ){ return; } - - //define vars - var doc = win.document, - docElem = doc.documentElement, - mediastyles = [], - rules = [], - appendedEls = [], - parsedSheets = {}, - resizeThrottle = 30, - head = doc.getElementsByTagName( "head" )[0] || docElem, - base = doc.getElementsByTagName( "base" )[0], - links = head.getElementsByTagName( "link" ), - requestQueue = [], - - //loop stylesheets, send text content to translate - ripCSS = function(){ - var sheets = links, - sl = sheets.length, - i = 0, - //vars for loop: - sheet, href, media, isCSS; - - for( ; i < sl; i++ ){ - sheet = sheets[ i ], - href = sheet.href, - media = sheet.media, - isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; - - //only links plz and prevent re-parsing - if( !!href && isCSS && !parsedSheets[ href ] ){ - // selectivizr exposes css through the rawCssText expando - if (sheet.styleSheet && sheet.styleSheet.rawCssText) { - translate( sheet.styleSheet.rawCssText, href, media ); - parsedSheets[ href ] = true; - } else { - if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) - || href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){ - requestQueue.push( { - href: href, - media: media - } ); - } - } - } - } - makeRequests(); - }, - - //recurse through request queue, get css text - makeRequests = function(){ - if( requestQueue.length ){ - var thisRequest = requestQueue.shift(); - - ajax( thisRequest.href, function( styles ){ - translate( styles, thisRequest.href, thisRequest.media ); - parsedSheets[ thisRequest.href ] = true; - makeRequests(); - } ); - } - }, - - //find media blocks in css text, convert to style blocks - translate = function( styles, href, media ){ - var qs = styles.match( /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi ), - ql = qs && qs.length || 0, - //try to get CSS path - href = href.substring( 0, href.lastIndexOf( "/" )), - repUrls = function( css ){ - return css.replace( /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + href + "$2$3" ); - }, - useMedia = !ql && media, - //vars used in loop - i = 0, - j, fullq, thisq, eachq, eql; - - //if path exists, tack on trailing slash - if( href.length ){ href += "/"; } - - //if no internal queries exist, but media attr does, use that - //note: this currently lacks support for situations where a media attr is specified on a link AND - //its associated stylesheet has internal CSS media queries. - //In those cases, the media attribute will currently be ignored. - if( useMedia ){ - ql = 1; - } - - - for( ; i < ql; i++ ){ - j = 0; - - //media attr - if( useMedia ){ - fullq = media; - rules.push( repUrls( styles ) ); - } - //parse for styles - else{ - fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1; - rules.push( RegExp.$2 && repUrls( RegExp.$2 ) ); - } - - eachq = fullq.split( "," ); - eql = eachq.length; - - for( ; j < eql; j++ ){ - thisq = eachq[ j ]; - mediastyles.push( { - media : thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all", - rules : rules.length - 1, - hasquery: thisq.indexOf("(") > -1, - minw : thisq.match( /\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ), - maxw : thisq.match( /\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ) - } ); - } - } - - applyMedia(); - }, - - lastCall, - - resizeDefer, - - // returns the value of 1em in pixels - getEmValue = function() { - var ret, - div = doc.createElement('div'), - body = doc.body, - fakeUsed = false; - - div.style.cssText = "position:absolute;font-size:1em;width:1em"; - - if( !body ){ - body = fakeUsed = doc.createElement( "body" ); - body.style.background = "none"; - } - - body.appendChild( div ); - - docElem.insertBefore( body, docElem.firstChild ); - - ret = div.offsetWidth; - - if( fakeUsed ){ - docElem.removeChild( body ); - } - else { - body.removeChild( div ); - } - - //also update eminpx before returning - ret = eminpx = parseFloat(ret); - - return ret; - }, - - //cached container for 1em value, populated the first time it's needed - eminpx, - - //enable/disable styles - applyMedia = function( fromResize ){ - var name = "clientWidth", - docElemProp = docElem[ name ], - currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp, - styleBlocks = {}, - lastLink = links[ links.length-1 ], - now = (new Date()).getTime(); - - //throttle resize calls - if( fromResize && lastCall && now - lastCall < resizeThrottle ){ - clearTimeout( resizeDefer ); - resizeDefer = setTimeout( applyMedia, resizeThrottle ); - return; - } - else { - lastCall = now; - } - - for( var i in mediastyles ){ - var thisstyle = mediastyles[ i ], - min = thisstyle.minw, - max = thisstyle.maxw, - minnull = min === null, - maxnull = max === null, - em = "em"; - - if( !!min ){ - min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); - } - if( !!max ){ - max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); - } - - // if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true - if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){ - if( !styleBlocks[ thisstyle.media ] ){ - styleBlocks[ thisstyle.media ] = []; - } - styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] ); - } - } - - //remove any existing respond style element(s) - for( var i in appendedEls ){ - if( appendedEls[ i ] && appendedEls[ i ].parentNode === head ){ - head.removeChild( appendedEls[ i ] ); - } - } - - //inject active styles, grouped by media type - for( var i in styleBlocks ){ - var ss = doc.createElement( "style" ), - css = styleBlocks[ i ].join( "\n" ); - - ss.type = "text/css"; - ss.media = i; - - //originally, ss was appended to a documentFragment and sheets were appended in bulk. - //this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one! - head.insertBefore( ss, lastLink.nextSibling ); - - if ( ss.styleSheet ){ - ss.styleSheet.cssText = css; - } - else { - ss.appendChild( doc.createTextNode( css ) ); - } - - //push to appendedEls to track for later removal - appendedEls.push( ss ); - } - }, - //tweaked Ajax functions from Quirksmode - ajax = function( url, callback ) { - var req = xmlHttp(); - if (!req){ - return; - } - req.open( "GET", url, true ); - req.onreadystatechange = function () { - if ( req.readyState != 4 || req.status != 200 && req.status != 304 ){ - return; - } - callback( req.responseText ); - } - if ( req.readyState == 4 ){ - return; - } - req.send( null ); - }, - //define ajax obj - xmlHttp = (function() { - var xmlhttpmethod = false; - try { - xmlhttpmethod = new XMLHttpRequest(); - } - catch( e ){ - xmlhttpmethod = new ActiveXObject( "Microsoft.XMLHTTP" ); - } - return function(){ - return xmlhttpmethod; - }; - })(); - - //translate CSS - ripCSS(); - - //expose update for re-running respond later on - respond.update = ripCSS; - - //adjust on resize - function callMedia(){ - applyMedia( true ); - } - if( win.addEventListener ){ - win.addEventListener( "resize", callMedia, false ); - } - else if( win.attachEvent ){ - win.attachEvent( "onresize", callMedia ); - } -})(this); diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/respond.min.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/respond.min.js deleted file mode 100644 index a8481370..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/respond.min.js +++ /dev/null @@ -1,20 +0,0 @@ -/* NUGET: BEGIN LICENSE TEXT - * - * Microsoft grants you the right to use these script files for the sole - * purpose of either: (i) interacting through your browser with the Microsoft - * website or online service, subject to the applicable licensing or use - * terms; or (ii) using the files as included with a Microsoft product subject - * to that product's license terms. Microsoft reserves all other rights to the - * files not expressly granted by Microsoft, whether by implication, estoppel - * or otherwise. Insofar as a script file is dual licensed under GPL, - * Microsoft neither took the code under GPL nor distributes it thereunder but - * under the terms set out in this paragraph. All notices and licenses - * below are for informational purposes only. - * - * NUGET: END LICENSE TEXT */ -/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ -/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ -window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='­';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document); - -/*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ -(function(e){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=e.matchMedia&&e.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return}var w=e.document,s=w.documentElement,i=[],k=[],q=[],o={},h=30,f=w.getElementsByTagName("head")[0]||s,g=w.getElementsByTagName("base")[0],b=f.getElementsByTagName("link"),d=[],a=function(){var D=b,y=D.length,B=0,A,z,C,x;for(;B-1,minw:F.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:F.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}j()},l,r,v=function(){var z,A=w.createElement("div"),x=w.body,y=false;A.style.cssText="position:absolute;font-size:1em;width:1em";if(!x){x=y=w.createElement("body");x.style.background="none"}x.appendChild(A);s.insertBefore(x,s.firstChild);z=A.offsetWidth;if(y){s.removeChild(x)}else{x.removeChild(A)}z=p=parseFloat(z);return z},p,j=function(I){var x="clientWidth",B=s[x],H=w.compatMode==="CSS1Compat"&&B||w.body[x]||B,D={},G=b[b.length-1],z=(new Date()).getTime();if(I&&l&&z-l-1?(p||v()):1)}if(!!J){J=parseFloat(J)*(J.indexOf(y)>-1?(p||v()):1)}if(!K.hasquery||(!A||!L)&&(A||H>=C)&&(L||H<=J)){if(!D[K.media]){D[K.media]=[]}D[K.media].push(k[K.rules])}}for(var E in q){if(q[E]&&q[E].parentNode===f){f.removeChild(q[E])}}for(var E in D){var M=w.createElement("style"),F=D[E].join("\n");M.type="text/css";M.media=E;f.insertBefore(M,G.nextSibling);if(M.styleSheet){M.styleSheet.cssText=F}else{M.appendChild(w.createTextNode(F))}q.push(M)}},n=function(x,z){var y=c();if(!y){return}y.open("GET",x,true);y.onreadystatechange=function(){if(y.readyState!=4||y.status!=200&&y.status!=304){return}z(y.responseText)};if(y.readyState==4){return}y.send(null)},c=(function(){var x=false;try{x=new XMLHttpRequest()}catch(y){x=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return x}})();a();respond.update=a;function t(){j(true)}if(e.addEventListener){e.addEventListener("resize",t,false)}else{if(e.attachEvent){e.attachEvent("onresize",t)}}})(this); \ No newline at end of file diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/slick.event.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/slick.event.js deleted file mode 100644 index cc613b20..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/slick.event.js +++ /dev/null @@ -1,66 +0,0 @@ -var slick = (function () { - function slick() { - } - - slick.Event = function () { - var handlers = []; - - this.subscribe = function (fn) { - handlers.push(fn); - } - - this.unsubscribe = function (fn) { - for (var i = handlers.length - 1; i >= 0; i--) { - if (handlers[i] === fn) { - handlers.splice(i, 1); - } - } - } - - this.notify = function (args, e, scope) { - e = e || new EventData(); - scope = scope || this; - - var returnValue; - for (var i = 0; i < handlers.length && !(e.isPropagationStopped() || e.isImmediatePropagationStopped()) ; i++) { - returnValue = handlers[i].call(scope, e, args); - } - - return returnValue; - } - - this.getEventCount = function () { - return handlers.length; - } - } - - slick.EventData = function () { - var isPropagationStopped = false; - var isImmediatePropagationStopped = false; - - this.stopPropagation = function () { - isPropagationStopped = true; - }; - - this.isPropagationStopped = function () { - return isPropagationStopped; - } - - this.stopImmediatePropagation = function () { - isImmediatePropagationStopped = true; - }; - - this.isImmediatePropagationStopped = function () { - return isImmediatePropagationStopped; - }; - } - - slick.trigger = function (event, args, e, sender) { - e = e || new slick.EventData(); - args = args || {}; - args.sender = sender; - return event.notify(args, e, sender); - } - - return slick; -})() \ No newline at end of file diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/vkbeautify.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/vkbeautify.js deleted file mode 100644 index 315971d5..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/vkbeautify.js +++ /dev/null @@ -1,357 +0,0 @@ -/** -* vkBeautify - javascript plugin to pretty-print or minify text in XML, JSON, CSS and SQL formats. -* -* Version - 0.99.00.beta -* Copyright (c) 2012 Vadim Kiryukhin -* vkiryukhin @ gmail.com -* http://www.eslinstructor.net/vkbeautify/ -* -* MIT license: -* http://www.opensource.org/licenses/mit-license.php -* -* Pretty print -* -* vkbeautify.xml(text [,indent_pattern]); -* vkbeautify.json(text [,indent_pattern]); -* vkbeautify.css(text [,indent_pattern]); -* vkbeautify.sql(text [,indent_pattern]); -* -* @text - String; text to beatufy; -* @indent_pattern - Integer | String; -* Integer: number of white spaces; -* String: character string to visualize indentation ( can also be a set of white spaces ) -* Minify -* -* vkbeautify.xmlmin(text [,preserve_comments]); -* vkbeautify.jsonmin(text); -* vkbeautify.cssmin(text [,preserve_comments]); -* vkbeautify.sqlmin(text); -* -* @text - String; text to minify; -* @preserve_comments - Bool; [optional]; -* Set this flag to true to prevent removing comments from @text ( minxml and mincss functions only. ) -* -* Examples: -* vkbeautify.xml(text); // pretty print XML -* vkbeautify.json(text, 4 ); // pretty print JSON -* vkbeautify.css(text, '. . . .'); // pretty print CSS -* vkbeautify.sql(text, '----'); // pretty print SQL -* -* vkbeautify.xmlmin(text, true);// minify XML, preserve comments -* vkbeautify.jsonmin(text);// minify JSON -* vkbeautify.cssmin(text);// minify CSS, remove comments ( default ) -* vkbeautify.sqlmin(text);// minify SQL -* -*/ - -(function() { - -function createShiftArr(step) { - - var space = ' '; - - if ( isNaN(parseInt(step)) ) { // argument is string - space = step; - } else { // argument is integer - switch(step) { - case 1: space = ' '; break; - case 2: space = ' '; break; - case 3: space = ' '; break; - case 4: space = ' '; break; - case 5: space = ' '; break; - case 6: space = ' '; break; - case 7: space = ' '; break; - case 8: space = ' '; break; - case 9: space = ' '; break; - case 10: space = ' '; break; - case 11: space = ' '; break; - case 12: space = ' '; break; - } - } - - var shift = ['\n']; // array of shifts - for(ix=0;ix<100;ix++){ - shift.push(shift[ix]+space); - } - return shift; -} - -function vkbeautify(){ - this.step = '\t'; // 4 spaces - this.shift = createShiftArr(this.step); -}; - -vkbeautify.prototype.xml = function(text,step) { - - var ar = text.replace(/>\s{0,}<") - .replace(/ or -1) { - str += shift[deep]+ar[ix]; - inComment = true; - // end comment or // - if(ar[ix].search(/-->/) > -1 || ar[ix].search(/\]>/) > -1 || ar[ix].search(/!DOCTYPE/) > -1 ) { - inComment = false; - } - } else - // end comment or // - if(ar[ix].search(/-->/) > -1 || ar[ix].search(/\]>/) > -1) { - str += ar[ix]; - inComment = false; - } else - // // - if( /^<\w/.exec(ar[ix-1]) && /^<\/\w/.exec(ar[ix]) && - /^<[\w:\-\.\,]+/.exec(ar[ix-1]) == /^<\/[\w:\-\.\,]+/.exec(ar[ix])[0].replace('/','')) { - str += ar[ix]; - if(!inComment) deep--; - } else - // // - if(ar[ix].search(/<\w/) > -1 && ar[ix].search(/<\//) == -1 && ar[ix].search(/\/>/) == -1 ) { - str = !inComment ? str += shift[deep++]+ar[ix] : str += ar[ix]; - } else - // ... // - if(ar[ix].search(/<\w/) > -1 && ar[ix].search(/<\//) > -1) { - str = !inComment ? str += shift[deep]+ar[ix] : str += ar[ix]; - } else - // // - if(ar[ix].search(/<\//) > -1) { - str = !inComment ? str += shift[--deep]+ar[ix] : str += ar[ix]; - } else - // // - if(ar[ix].search(/\/>/) > -1 ) { - str = !inComment ? str += shift[deep]+ar[ix] : str += ar[ix]; - } else - // // - if(ar[ix].search(/<\?/) > -1) { - str += shift[deep]+ar[ix]; - } else - // xmlns // - if( ar[ix].search(/xmlns\:/) > -1 || ar[ix].search(/xmlns\=/) > -1) { - str += shift[deep]+ar[ix]; - } - - else { - str += ar[ix]; - } - } - - return (str[0] == '\n') ? str.slice(1) : str; -} - -vkbeautify.prototype.json = function(text,step) { - - var step = step ? step : this.step; - - if (typeof JSON === 'undefined' ) return text; - - if ( typeof text === "string" ) return JSON.stringify(JSON.parse(text), null, step); - if ( typeof text === "object" ) return JSON.stringify(text, null, step); - - return text; // text is not string nor object -} - -vkbeautify.prototype.css = function(text, step) { - - var ar = text.replace(/\s{1,}/g,' ') - .replace(/\{/g,"{~::~") - .replace(/\}/g,"~::~}~::~") - .replace(/\;/g,";~::~") - .replace(/\/\*/g,"~::~/*") - .replace(/\*\//g,"*/~::~") - .replace(/~::~\s{0,}~::~/g,"~::~") - .split('~::~'), - len = ar.length, - deep = 0, - str = '', - ix = 0, - shift = step ? createShiftArr(step) : this.shift; - - for(ix=0;ix/g,"") - .replace(/[ \r\n\t]{1,}xmlns/g, ' xmlns'); - return str.replace(/>\s{0,}<"); -} - -vkbeautify.prototype.jsonmin = function(text) { - - if (typeof JSON === 'undefined' ) return text; - - return JSON.stringify(JSON.parse(text), null, 0); - -} - -vkbeautify.prototype.cssmin = function(text, preserveComments) { - - var str = preserveComments ? text - : text.replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\//g,"") ; - - return str.replace(/\s{1,}/g,' ') - .replace(/\{\s{1,}/g,"{") - .replace(/\}\s{1,}/g,"}") - .replace(/\;\s{1,}/g,";") - .replace(/\/\*\s{1,}/g,"/*") - .replace(/\*\/\s{1,}/g,"*/"); -} - -vkbeautify.prototype.sqlmin = function(text) { - return text.replace(/\s{1,}/g," ").replace(/\s{1,}\(/,"(").replace(/\s{1,}\)/,")"); -} - -window.vkbeautify = new vkbeautify(); - -})(); - diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/xmlhelper.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/xmlhelper.js deleted file mode 100644 index 093ebe5a..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/Scripts/xmlhelper.js +++ /dev/null @@ -1,46 +0,0 @@ -var xmlhelper; -if (!xmlhelper) xmlhelper = {}; - -(function () { - xmlhelper.parseXML = function (content) { - var doc = $.parseXML(content); - return $(doc); - } - - xmlhelper.appendChild = function (node, child) { - $(node).append(child); - } - - xmlhelper.removeChild = function (node, child) { - $(node).remove(child); - } - - xmlhelper.getNodeText = function (node) { - return $(node).text(); - } - - xmlhelper.setNodeText = function (node, txtValue) { - $(node).text(txtValue); - } - - xmlhelper.find = function (node, nodeName, txtValue) { - var result = []; - $(node).find(nodeName).each(function (item) { - if (txtValue) { - if (item.text() == txtValue) { - result.push(item); - } - } else { - result.push(item); - } - }); - } - - xmlhelper.setAttr = function (node, attrName, attrValue) { - $(node).attr(attrName).value(attrValue); - } - - xmlhelper.getAttr = function (node, attrName) { - return $(node).attr(attrName); - } -})() \ No newline at end of file diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/kresource.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/kresource.js deleted file mode 100644 index a5d6417e..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/kresource.js +++ /dev/null @@ -1,73 +0,0 @@ -/* -* Slickflow 工作流引擎遵循LGPL协议,也可联系作者商业授权并获取技术支持; -* 除此之外的使用则视为不正当使用,请您务必避免由此带来的商业版权纠纷。 - -The Slickflow Designer project. -Copyright (C) 2014 .NET Workflow Engine Library - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, you can access the official -web page about lgpl: https://www.gnu.org/licenses/lgpl.html -*/ - -var kresource = (function () { - function kresource() { - - } - - kresource.mxCurrentLanguageJSON = null; - kresource.MX_RESOURCE_LOCAL_LANGUAGE = "mx-resource-local-lang"; - - kresource.getLang = function () { - //get user enviroment language - - var localLang = window.localStorage.getItem(kresource.MX_RESOURCE_LOCAL_LANGUAGE); - if (localLang === null || localLang === "") { - var isIE = navigator.userAgent.indexOf('MSIE') >= 0; - var lan = (isIE) ? navigator.userLanguage : navigator.language; - - if (lan.substring(0, 2) !== "zh") - window.localStorage.setItem(kresource.MX_RESOURCE_LOCAL_LANGUAGE, "en"); - else - window.localStorage.setItem(kresource.MX_RESOURCE_LOCAL_LANGUAGE, "zh"); - localLang = window.localStorage.getItem(kresource.MX_RESOURCE_LOCAL_LANGUAGE); - } - return localLang; - } - - kresource.setLang = function (lang) { - mxLanguage = lang; - mxClient.language = lang; - window.localStorage.setItem(kresource.MX_RESOURCE_LOCAL_LANGUAGE, lang); - } - - kresource.localize = function () { - var lang = kresource.getLang(); - jshelper.ajaxGet('Resources/' + lang + ".json", null, - function (json) { - kresource.mxCurrentLanguageJSON = json; - $(".lang").each(function (o) { - var key = $(this).attr("as"); - $(this).text(json[key]); - }); - }); - } - - kresource.getItem = function (key) { - var json = kresource.mxCurrentLanguageJSON; - var text = json[key]; - return text; - } - - return kresource; -})() \ No newline at end of file diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/kvariable.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/kvariable.js deleted file mode 100644 index 1b79993f..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/kvariable.js +++ /dev/null @@ -1,219 +0,0 @@ -/* -* Slickflow 工作流引擎遵循LGPL协议,也可联系作者商业授权并获取技术支持; -* 除此之外的使用则视为不正当使用,请您务必避免由此带来的商业版权纠纷。 - -The Slickflow Designer project. -Copyright (C) 2014 .NET Workflow Engine Library - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, you can access the official -web page about lgpl: https://www.gnu.org/licenses/lgpl.html -*/ - -var kvariable = (function () { - function kvariable() { - } - - kvariable.getVariableList = function () { - $('#loading-indicator').show(); - - var query = { "ProcessInstanceID": processlist.pselectedTaskEntity.ProcessInstanceID }; - jshelper.ajaxPost('api/Wf2Xml/GetProcessVariableList', JSON.stringify(query), function (result) { - if (result.Status === 1) { - var divProcessVariableGrid = document.querySelector('#myProcessVariableGrid'); - $(divProcessVariableGrid).empty(); - - var gridOptions = { - columnDefs: [ - { headerName: 'ID', field: 'ID', width: 50 }, - { headerName: kresource.getItem('appinstanceid'), field: 'AppInstanceID', width: 100 }, - { headerName: kresource.getItem('variabletype'), field: 'VariableType', width: 100 }, - { headerName: kresource.getItem('activityname'), field: 'ActivityName', width: 100 }, - { headerName: kresource.getItem('variablename'), field: 'Name', width: 120 }, - { headerName: kresource.getItem('variablevalue'), field: 'Value', width: 200 }, - { headerName: kresource.getItem('lastupdateddatetime'), field: 'LastUpdatedDateTime', width: 120 }, - ], - rowSelection: 'single', - onSelectionChanged: onSelectionChanged, - onRowDoubleClicked: onRowDoubleClicked - }; - - - new agGrid.Grid(divProcessVariableGrid, gridOptions); - gridOptions.api.setRowData(result.Entity); - - $('#loading-indicator').hide(); - - function onSelectionChanged() { - var selectedRows = gridOptions.api.getSelectedRows(); - selectedRows.forEach(function (selectedRow, index) { - kvariable.pselectedProcessVariableEntity = selectedRow; - $("#txtVariableNameUpdate").val(selectedRow.Name); - $("#txtVariableValueUpdate").val(selectedRow.Value); - }); - } - - function onRowDoubleClicked(e, args) { - kvariable.editProcessVariable(); - } - } - else { - $.msgBox({ - title: "Process / Variable", - content: kresource.getItem("processvariablelistloaderrormsg") + result.Message, - type: "error" - }); - } - }); - } - - kvariable.load = function () { - var entity = kvariable.pselectedProcessVariableEntity; - if (entity !== null) { - $("#txtVariableName").val(entity.Name); - $("#txtVariableValue").val(entity.Value); - $("#ddlVariableType").val(entity.VariableType); - } - } - - kvariable.insert = function () { - kvariable.pselectedProcessVariableEntity = null; - var entity = processlist.pselectedTaskEntity; - if (entity !== null) { - BootstrapDialog.show({ - title: "Process / Variable", - message: $('
    ').load('variable/edit'), - draggable: true - }); - } else { - $.msgBox({ - title: "Process / Variable", - content: kresource.getItem('processvariableopenmsg'), - type: "alert" - }); - return false; - } - } - - kvariable.update = function () { - var entity = processlist.pselectedTaskEntity; - if (entity !== null) { - BootstrapDialog.show({ - title: "Process / Variable", - message: $('
    ').load('variable/edit'), - draggable: true - }); - } else { - $.msgBox({ - title: "Process / Variable", - content: kresource.getItem('processvariableopenmsg'), - type: "alert" - }); - return false; - } - } - - kvariable.save = function () { - var name = $("#txtVariableName").val(); - var value = $("#txtVariableValue").val(); - var variableType = $("#ddlVariableType").val(); - var entity = { - "VariableType": variableType, - "Name": name, - "Value": value - }; - - if (kvariable.pselectedProcessVariableEntity === null) { - entity["TaskID"] = processlist.pselectedTaskEntity.TaskID; - - jshelper.ajaxPost('api/Wf2Xml/InsertProcessVariable', - JSON.stringify(entity), - function (result) { - if (result.Status == 1) { - $.msgBox({ - title: "Process / Variable", - content: kresource.getItem('processvariablesaveokmsg'), - type: "info" - }); - kvariable.getVariableList(); - } else { - $.msgBox({ - title: "Process / Variable", - content: kresource.getItem('processvariablesaveerrormsg') + result.Message, - type: "error", - buttons: [{ value: "Ok" }], - }); - } - }); - } else { - entity["ID"] = kvariable.pselectedProcessVariableEntity.ID; - jshelper.ajaxPost('api/Wf2Xml/UpdateProcessVariable', - JSON.stringify(entity), - function (result) { - if (result.Status == 1) { - $.msgBox({ - title: "Process / Variable", - content: kresource.getItem('processvariablesaveokmsg'), - type: "info" - }); - kvariable.getVariableList(); - } else { - $.msgBox({ - title: "Process / Variable", - content: kresource.getItem('processvariablesaveerrormsg') + result.Message, - type: "error", - buttons: [{ value: "Ok" }], - }); - } - }); - } - } - - kvariable.delete = function () { - $.msgBox({ - title: "Are You Sure", - content: kresource.getItem('processvariabledeletemsg'), - type: "confirm", - buttons: [{ value: "Yes" }, { value: "Cancel" }], - success: function (result) { - if (result == "Yes") { - var entity = kvariable.pselectedProcessVariableEntity; - if (entity !== null) { - jshelper.ajaxPost('api/Wf2Xml/DeleteProcessVariable', - JSON.stringify(entity), - function (result) { - if (result.Status == 1) { - $.msgBox({ - title: "Process / Variable", - content: kresource.getItem('processvariabledeleteokmsg'), - type: "info" - }); - kvariable.getVariableList(); - } else { - $.msgBox({ - title: "Process / Variable", - content: kresource.getItem('processvariabledeleteerrormsg') + result.Message, - type: "error", - buttons: [{ value: "Ok" }], - }); - } - }); - } - return; - } - } - }); - } - - return kvariable; -})(); \ No newline at end of file diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/nextactivitytree.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/nextactivitytree.js deleted file mode 100644 index a834e818..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/nextactivitytree.js +++ /dev/null @@ -1,250 +0,0 @@ -/* -* Slickflow 工作流引擎遵循LGPL协议,也可联系作者商业授权并获取技术支持; -* 除此之外的使用则视为不正当使用,请您务必避免由此带来的商业版权纠纷。 - -The Slickflow Designer project. -Copyright (C) 2014 .NET Workflow Engine Library - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, you can access the official -web page about lgpl: https://www.gnu.org/licenses/lgpl.html -*/ - -var nextactivitytree = (function () { - function nextactivitytree() { - } - - nextactivitytree.mzTree = null; - nextactivitytree.mstepName = ''; - nextactivitytree.mEntity = null; - nextactivitytree.mCommand = ''; - - function getZTreeSetting() { - var setting = { - check: { - enable: true - }, - view: { - //addHoverDom: addHoverDom, - //removeHoverDom: removeHoverDom, - dblClickExpand: false, - showLine: true, - selectedMulti: false - }, - data: { - simpleData: { - enable: true, - idKey: "id", - pIdKey: "pId", - rootPId: "" - } - }, - callback: { - beforeClick: function (treeId, treeNode) { - var zTree = $.fn.zTree.getZTreeObj("nextStepTree"); - if (treeNode.isParent) { - zTree.expandNode(treeNode); - return false; - } else { - return true; - } - } - } - }; - return setting; - } - - nextactivitytree.reload = function () { - var runner = sfconfig.Runner; - runner.Conditions = {}; - - var jsonString = $("#txtConditionVariables").val(); - var kvpair = jsonString.split(','); - - for (var i = 0; i < kvpair.length; i++) { - var pair = kvpair[i].split(':'); - var key = pair[0].trim(); - var value = pair[1].trim(); - runner.Conditions[key] = value; - } - - //加载步骤列表 - $("#nextStepTree").empty(); - nextactivitytree.showNextActivityTree(runner, nextactivitytree.mCommand); - } - - nextactivitytree.showNextActivityTree = function (runner, command) { - nextactivitytree.mCommand = command; - - //获取下一步 - processapi.next(runner, function (result) { - if (result.Status === 1) { - //弹窗步骤人员办理弹窗 - var zNodes = [{ id: 0, pId: -1, name: kresource.getItem("nextstepinfo"), type: "root", open: true }]; - var index = 0; - var parent = 0; - var steps = result.Entity; - - //添加步骤节点 - for (var i = 0; i < steps.length; i++) { - var nextStep = steps[i]; - index = index + 1; - var stepNode = { - id: index, - pId: 0, - name: nextStep.ActivityName, - activityGUID: nextStep.ActivityGUID, - activityName: nextStep.ActivityName, - type: "activity", - open: false - } - zNodes.push(stepNode); - - //添加用户节点 - if (nextStep.Users != null) { - parent = index; - var userNode = null; - $.each(nextStep.Users, function (i, o) { - index = index + 1; - userNode = { - id: index, - pId: parent, - name: o.UserName, - uid: o.UserID, - type: "user" - }; - zNodes.push(userNode); - }); - } - } - - var t = $("#nextStepTree"); - nextactivitytree.mzTree = $.fn.zTree.init(t, getZTreeSetting(), zNodes); - } else { - $.msgBox({ - title: "Process / Next", - content: kresource.getItem("nextsteptreeshowerrormsg") + result.Message, - type: "warn" - }); - } - }); - } - - nextactivitytree.sure = function () { - //取得下一步节点信息 - var selectedNodes = nextactivitytree.mzTree.getCheckedNodes(); - if (selectedNodes.length <= 0) { - $.msgBox({ - title: "Process / Next", - content: kresource.getItem("nextstepinfowarnmsg"), - type: "alert" - }); - return false; - } - - var wfAppRunner = sfconfig.Runner; - wfAppRunner.NextActivityPerformers = {}; - - //多步可选 - var activityGUID = ""; - $.each(selectedNodes, function (i, o) { - if (o.type === "activity" && o.pId === 0) { - activityGUID = o.activityGUID; - wfAppRunner.NextActivityPerformers[activityGUID] = getPerformerList(o); - } - }); - - //加载控制变量 - var includeControlParameters = $("#chkControlParameters").is(':checked'); - if (includeControlParameters === true) { - wfAppRunner.ControlParameterSheet = {}; - - var jsonString = $("#txtControlParameters").val(); - var kvpair = jsonString.split(','); - - for (var i = 0; i < kvpair.length; i++) { - var pair = kvpair[i].split(':'); - var key = pair[0].trim(); - var value = pair[1].trim(); - wfAppRunner.ControlParameterSheet[key] = value; - } - } - - if (nextactivitytree.mCommand === sfconfig.Command.RUN) { - //流程流转到下一步 - processapi.run(wfAppRunner, function (result) { - if (result.Status == 1) { - $.msgBox({ - title: "Process / Run", - content: kresource.getItem("processrunokmsg"), - type: "info" - }); - $("#modelNextStepForm").modal("hide"); - - //刷新任务列表 - refreshTaskList(); - } else { - $.msgBox({ - title: "Process / Run", - content: kresource.getItem("processrunerrormsg") + result.Message, - type: "warn" - }); - } - }); - } else if (nextactivitytree.mCommand === sfconfig.Command.REVISE) { - //流程流转到下一步 - processapi.revise(wfAppRunner, function (result) { - if (result.Status == 1) { - $.msgBox({ - title: "Process / Revise", - content: kresource.getItem("processreviseokmsg"), - type: "info" - }); - $("#modelNextStepForm").modal("hide"); - - //刷新任务列表 - refreshTaskList(); - } else { - $.msgBox({ - title: "Process / Revise", - content: kresource.getItem("processreviseerrormsg") + result.Message, - type: "warn" - }); - } - }); - } - } - - function refreshTaskList() { - processlist.getTaskList(); - processlist.getDoneList(); - nextactivitytree.ControlParameterSheet = null; - } - - var getPerformerList = function (node) { - var user = null; - var userlist = []; - var parent = node.id; - - if (node.children) { - $.each(node.children, function (i, o) { - if (o.type === "user" && o.pId === parent && o.checked === true) { - user = { UserID: o.uid, UserName: o.name }; - userlist.push(user); - } - }) - } - return userlist; - } - return nextactivitytree; -})(); diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/prevactivitytree.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/prevactivitytree.js deleted file mode 100644 index 2bfec536..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/prevactivitytree.js +++ /dev/null @@ -1,218 +0,0 @@ -/* -* Slickflow 工作流引擎遵循LGPL协议,也可联系作者商业授权并获取技术支持; -* 除此之外的使用则视为不正当使用,请您务必避免由此带来的商业版权纠纷。 - -The Slickflow Designer project. -Copyright (C) 2014 .NET Workflow Engine Library - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, you can access the official -web page about lgpl: https://www.gnu.org/licenses/lgpl.html -*/ - -var prevactivitytree = (function () { - function prevactivitytree() { - } - - prevactivitytree.mzTree = null; - prevactivitytree.mstepName = ''; - prevactivitytree.mEntity = null; - - function getZTreeSetting() { - var setting = { - check: { - enable: true - }, - view: { - //addHoverDom: addHoverDom, - //removeHoverDom: removeHoverDom, - dblClickExpand: false, - showLine: true, - selectedMulti: false - }, - data: { - simpleData: { - enable: true, - idKey: "id", - pIdKey: "pId", - rootPId: "" - } - }, - callback: { - beforeClick: function (treeId, treeNode) { - var zTree = $.fn.zTree.getZTreeObj("prevStepTree"); - if (treeNode.isParent) { - zTree.expandNode(treeNode); - return false; - } else { - return true; - } - } - } - }; - return setting; - } - - prevactivitytree.reload = function () { - var runner = sfconfig.Runner; - - //加载步骤列表 - $("#prevStepTree").empty(); - prevactivitytree.showPrevActivityTree(runner); - } - - prevactivitytree.showPrevActivityTree = function (runner) { - //获取下一步 - processapi.prev(runner, function (result) { - if (result.Status === 1) { - //弹窗步骤人员办理弹窗 - var zNodes = [{ id: 0, pId: -1, name: kresource.getItem("previousstepinfo"), type: "root", open: true }]; - var index = 0; - var parent = 0; - var stepInfo = result.Entity; - var steps = stepInfo.PreviousActivityRoleUserTree; - var hasGatewayPassed = stepInfo.HasGatewayPassed; - - if (hasGatewayPassed === true) { - $("#divSendBackOptions").show(); - } else { - $("#divSendBackOptions").hide(); - } - - //添加步骤节点 - for (var i = 0; i < steps.length; i++) { - var prevStep = steps[i]; - index = index + 1; - var stepNode = { - id: index, - pId: 0, - name: prevStep.ActivityName, - activityGUID: prevStep.ActivityGUID, - activityName: prevStep.ActivityName, - type: "activity", - open: false - } - zNodes.push(stepNode); - - //添加用户节点 - if (prevStep.Users != null) { - parent = index; - var userNode = null; - $.each(prevStep.Users, function (i, o) { - index = index + 1; - userNode = { - id: index, - pId: parent, - name: o.UserName, - uid: o.UserID, - type: "user" - }; - zNodes.push(userNode); - }); - } - } - - var t = $("#prevStepTree"); - prevactivitytree.mzTree = $.fn.zTree.init(t, getZTreeSetting(), zNodes); - } else { - $.msgBox({ - title: "Process / Prev", - content: kresource.getItem("prevsteptreeshowerrormsg") + result.Message, - type: "warn" - }); - } - }); - } - - prevactivitytree.sure = function () { - //取得下一步节点信息 - var selectedNodes = prevactivitytree.mzTree.getCheckedNodes(); - if (selectedNodes.length <= 0) { - $.msgBox({ - title: "Process / Prev", - content: kresource.getItem("previousstepinfowarnmsg"), - type: "alert" - }); - return false; - } - - var wfAppRunner = sfconfig.Runner; - wfAppRunner.NextActivityPerformers = {}; - - //多步可选 - var activityGUID = ""; - $.each(selectedNodes, function (i, o) { - if (o.type === "activity" && o.pId === 0) { - activityGUID = o.activityGUID; - if (wfAppRunner.NextActivityPerformers[activityGUID]) { - //重复的步骤,需要整合在一个节点下面 - //并行会签会追加在同一ActivityGUID下 - //会签加签节点GUID和名称相同,但是有不同的两条节点活动实例记录,不能使用Dictionary数据结构,需要合并在同一个节点记录下。 - appendPerformer(wfAppRunner.NextActivityPerformers[activityGUID], getPerformerList(o)); - } else { - wfAppRunner.NextActivityPerformers[activityGUID] = getPerformerList(o); - } - } - }); - - //退回参数 - var isCancellingBrotherNodes = $("#chkCancelBrothersNode").prop('checked'); - wfAppRunner.ControlParameterSheet = {}; - wfAppRunner.ControlParameterSheet["IsCancellingBrothersNode"] = isCancellingBrotherNodes === true? 1: 0; - - //流程退回到上一步 - processapi.sendback(wfAppRunner, function (result) { - if (result.Status == 1) { - $.msgBox({ - title: "Process / Prev", - content: kresource.getItem("processsendbackokmsg"), - type: "info" - }); - $("#modelPrevStepForm").modal("hide"); - - //刷新任务列表 - processlist.getTaskList(); - processlist.getDoneList(); - } else { - $.msgBox({ - title: "Process / Prev", - content: kresource.getItem("processsendbackerrormsg") + result.Message, - type: "warn" - }); - } - }); - } - - var appendPerformer = function (originalUserList, userList) { - $.each(userList, function (i, u) { - originalUserList.push(u); - }); - } - - var getPerformerList = function (node) { - var user = null; - var userlist = []; - var parent = node.id; - - if (node.children) { - $.each(node.children, function (i, o) { - if (o.type === "user" && o.pId === parent && o.checked === true) { - user = { UserID: o.uid, UserName: o.name }; - userlist.push(user); - } - }) - } - return userlist; - } - return prevactivitytree; -})(); diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/processlist.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/processlist.js deleted file mode 100644 index ac65c99d..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/processlist.js +++ /dev/null @@ -1,683 +0,0 @@ -/* -* Slickflow 工作流引擎遵循LGPL协议,也可联系作者商业授权并获取技术支持; -* 除此之外的使用则视为不正当使用,请您务必避免由此带来的商业版权纠纷。 - -The Slickflow Designer project. -Copyright (C) 2014 .NET Workflow Engine Library - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, you can access the official -web page about lgpl: https://www.gnu.org/licenses/lgpl.html -*/ - -var processlist = (function () { - function processlist() { - } - - processlist.pselectedProcessEntity = null; - processlist.pselectedTaskEntity = null; - - //#region Process DataGrid - processlist.getProcessList = function () { - $('#loading-indicator').show(); - - jshelper.ajaxPost('api/Wf2Xml/GetProcessListSimple', null, function (result) { - if (result.Status === 1) { - var divProcessGrid = document.querySelector('#myProcessGrid'); - $(divProcessGrid).empty(); - - var gridOptions = { - columnDefs: [ - { headerName: 'ID', field: 'ID', width: 50 }, - { headerName: kresource.getItem('processguid'), field: 'ProcessGUID', width: 120 }, - { headerName: kresource.getItem('processname'), field: 'ProcessName', width: 200 }, - { headerName: kresource.getItem('version'), field: 'Version', width: 40 }, - { headerName: kresource.getItem('status'), field: 'IsUsing', width: 40, cellRenderer: onIsUsingCellRenderer }, - ], - rowSelection: 'single', - onSelectionChanged: onSelectionChanged, - onRowDoubleClicked: onRowDoubleClicked - }; - - function onIsUsingCellRenderer(params) { - return params.value == 1 ? kresource.getItem('active') : kresource.getItem('unactive'); - } - - function onStartTypeCellRenderer(params) { - var startType = ''; - if (params.value == 1) - startType = kresource.getItem('timer'); - else if (params.value == 2) - startType = kresource.getItem('email'); - return startType; - } - - new agGrid.Grid(divProcessGrid, gridOptions); - gridOptions.api.setRowData(result.Entity); - - $('#loading-indicator').hide(); - - function onSelectionChanged() { - var selectedRows = gridOptions.api.getSelectedRows(); - var selectedProcessID = 0; - selectedRows.forEach(function (selectedRow, index) { - processlist.pselectedProcessEntity = selectedRow; - processlist.getTaskList(); - processlist.getDoneList(); - }); - } - - function onRowDoubleClicked(e, args) { - processlist.editProcess(); - } - } - else { - $.msgBox({ - title: "Designer / Process", - content: kresource.getItem("processlistloaderrormsg") + result.Message, - type: "error" - }); - } - }); - } - - processlist.getTaskList = function () { - $('#loading-indicator').show(); - - var taskQuery = {}; - taskQuery.ProcessGUID = processlist.pselectedProcessEntity.ProcessGUID; - taskQuery.Version = processlist.pselectedProcessEntity.Version; - taskQuery.AppName = sfconfig.Runner.AppName; - taskQuery.AppInstanceID = sfconfig.Runner.AppInstanceID; - - jshelper.ajaxPost('api/Wf2Xml/GetTaskList', JSON.stringify(taskQuery), function (result) { - if (result.Status === 1) { - var divTaskGrid = document.querySelector('#myTaskGrid'); - $(divTaskGrid).empty(); - - var gridOptions = { - columnDefs: [ - { headerName: 'ID', field: 'TaskID', width: 50 }, - { headerName: kresource.getItem('activityname'), field: 'ActivityName', width: 160 }, - { headerName: kresource.getItem('assigneduserid'), field: 'AssignedToUserID', width: 100 }, - { headerName: kresource.getItem('assignedusername'), field: 'AssignedToUserName', width: 100 }, - { headerName: kresource.getItem('createddatetime'), field: 'CreatedDateTime', width: 200 }, - ], - rowSelection: 'single', - onSelectionChanged: onSelectionChanged, - }; - - new agGrid.Grid(divTaskGrid, gridOptions); - gridOptions.api.setRowData(result.Entity); - - $('#loading-indicator').hide(); - - function onSelectionChanged() { - var selectedRows = gridOptions.api.getSelectedRows(); - selectedRows.forEach(function (selectedRow, index) { - processlist.pselectedTaskEntity = selectedRow; - }); - } - } else { - $.msgBox({ - title: "Test / Task", - content: kresource.getItem("tasklistloaderrormsg") + result.Message, - type: "error" - }); - } - - }); - }; - - processlist.getDoneList = function () { - $('#loading-indicator').show(); - - var taskQuery = {}; - taskQuery.ProcessGUID = processlist.pselectedProcessEntity.ProcessGUID; - taskQuery.Version = processlist.pselectedProcessEntity.Version; - taskQuery.AppName = sfconfig.Runner.AppName; - taskQuery.AppInstanceID = sfconfig.Runner.AppInstanceID; - - jshelper.ajaxPost('api/Wf2Xml/GetDoneList', JSON.stringify(taskQuery), function (result) { - if (result.Status === 1) { - var divTaskGrid = document.querySelector('#myDoneGrid'); - $(divTaskGrid).empty(); - - var gridOptions = { - columnDefs: [ - { headerName: 'ID', field: 'TaskID', width: 50 }, - { headerName: kresource.getItem('activityname'), field: 'ActivityName', width: 160 }, - { headerName: kresource.getItem('endedbyuserid'), field: 'EndedByUserID', width: 100 }, - { headerName: kresource.getItem('endedbyusername'), field: 'EndedByUserName', width: 100 }, - { headerName: kresource.getItem('endeddatetime'), field: 'EndedDateTime', width: 200 }, - ], - rowSelection: 'single', - onSelectionChanged: onSelectionChanged, - }; - - new agGrid.Grid(divTaskGrid, gridOptions); - gridOptions.api.setRowData(result.Entity); - - $('#loading-indicator').hide(); - - function onSelectionChanged() { - var selectedRows = gridOptions.api.getSelectedRows(); - selectedRows.forEach(function (selectedRow, index) { - processlist.pselectedTaskDoneEntity = selectedRow; - }); - } - } else { - $.msgBox({ - title: "Test / Task", - content: kresource.getItem("tasklistloaderrormsg") + result.Message, - type: "error" - }); - } - }); - } - - processlist.start = function () { - var processEntity = processlist.pselectedProcessEntity; - if (processEntity != null) { - sfconfig.initRunner(); - sfconfig.Runner["ProcessGUID"] = processEntity.ProcessGUID; - sfconfig.Runner["Version"] = processEntity.Version; - - processapi.start(sfconfig.Runner, function (result) { - if (result.Status === 1) { - $.msgBox({ - title: "Process / Start", - content: kresource.getItem('processstartedokmsg'), - type: "info" - }); - processlist.getTaskList(); - processlist.getDoneList(); - } else { - $.msgBox({ - title: "Process / Start", - content: kresource.getItem('processstartederrormsg') + result.Message, - type: "warn" - }); - } - }) - } else { - $.msgBox({ - title: "Process / Start", - content: kresource.getItem('processselectedwarnmsg'), - type: "warn" - }); - } - } - - processlist.run = function () { - var processEntity = processlist.pselectedProcessEntity; - - if (processEntity != null) { - sfconfig.initRunner(); - sfconfig.Runner["ProcessGUID"] = processEntity.ProcessGUID; - sfconfig.Runner["Version"] = processEntity.Version; - - var taskEntity = processlist.pselectedTaskEntity; - if (taskEntity != null) { - sfconfig.Runner["UserID"] = taskEntity.AssignedToUserID; - sfconfig.Runner["UserName"] = taskEntity.AssignedToUserName; - sfconfig.Runner["TaskID"] = taskEntity.TaskID; - - $('#modelNextStepForm').modal('show'); - nextactivitytree.showNextActivityTree(sfconfig.Runner, sfconfig.Command.RUN); - } else { - $.msgBox({ - title: "Process / Run", - content: kresource.getItem('tasklectedwarnmsg'), - type: "warn" - }); - } - } else { - $.msgBox({ - title: "Process / Run", - content: kresource.getItem('processselectedwarnmsg'), - type: "warn" - }); - } - } - - processlist.revise = function () { - var processEntity = processlist.pselectedProcessEntity; - - if (processEntity != null) { - sfconfig.initRunner(); - sfconfig.Runner["ProcessGUID"] = processEntity.ProcessGUID; - sfconfig.Runner["Version"] = processEntity.Version; - - var taskEntity = processlist.pselectedTaskEntity; - if (taskEntity != null) { - sfconfig.Runner["UserID"] = taskEntity.AssignedToUserID; - sfconfig.Runner["UserName"] = taskEntity.AssignedToUserName; - sfconfig.Runner["TaskID"] = taskEntity.TaskID; - - $('#modelNextStepForm').modal('show'); - nextactivitytree.showNextActivityTree(sfconfig.Runner, sfconfig.Command.REVISE); - } else { - $.msgBox({ - title: "Process / Revise", - content: kresource.getItem('tasklectedwarnmsg'), - type: "warn" - }); - } - } else { - $.msgBox({ - title: "Process / Revise", - content: kresource.getItem('processselectedwarnmsg'), - type: "warn" - }); - } - } - - processlist.withdraw = function () { - var processEntity = processlist.pselectedProcessEntity; - if (processEntity != null) { - sfconfig.initRunner(); - sfconfig.Runner["ProcessGUID"] = processEntity.ProcessGUID; - sfconfig.Runner["Version"] = processEntity.Version; - - var taskEntity = processlist.pselectedTaskDoneEntity; - if (taskEntity != null) { - sfconfig.Runner["UserID"] = taskEntity.EndedByUserID; - sfconfig.Runner["UserName"] = taskEntity.EndedByUserName; - sfconfig.Runner["TaskID"] = taskEntity.TaskID; - - $.msgBox({ - title: "Are You Sure", - content: kresource.getItem('processwithdrawconfirmmsg'), - type: "confirm", - buttons: [{ value: "Yes" }, { value: "Cancel" }], - success: function (result) { - processapi.withdraw(sfconfig.Runner, function (result) { - if (result.Status === 1) { - $.msgBox({ - title: "Process / Reject", - content: kresource.getItem('processwithdrawnokmsg'), - type: "info" - }); - processlist.getTaskList(); - processlist.getDoneList(); - } else { - $.msgBox({ - title: "Process / Reject", - content: kresource.getItem("processwithdrawnerrormsg") + result.Message, - type: "warn" - }); - } - }) - } - }); - } else { - $.msgBox({ - title: "Process / Widthdraw", - content: kresource.getItem('tasklectedwarnmsg'), - type: "warn" - }); - } - } else { - $.msgBox({ - title: "Process / Widthdraw", - content: kresource.getItem('processselectedwarnmsg'), - type: "warn" - }); - } - } - - processlist.sendback = function () { - var processEntity = processlist.pselectedProcessEntity; - if (processEntity != null) { - sfconfig.initRunner(); - sfconfig.Runner["ProcessGUID"] = processEntity.ProcessGUID; - sfconfig.Runner["Version"] = processEntity.Version; - - var taskEntity = processlist.pselectedTaskEntity; - if (taskEntity != null) { - sfconfig.Runner["UserID"] = taskEntity.AssignedToUserID; - sfconfig.Runner["UserName"] = taskEntity.AssignedToUserName; - sfconfig.Runner["TaskID"] = taskEntity.TaskID; - - $('#modelPrevStepForm').modal('show'); - prevactivitytree.showPrevActivityTree(sfconfig.Runner); - } else { - $.msgBox({ - title: "Process / Sendback", - content: kresource.getItem('tasklectedwarnmsg'), - type: "warn" - }); - } - } else { - $.msgBox({ - title: "Process / Sendback", - content: kresource.getItem('processselectedwarnmsg'), - type: "warn" - }); - } - } - - processlist.resend = function () { - var processEntity = processlist.pselectedProcessEntity; - if (processEntity != null) { - sfconfig.initRunner(); - sfconfig.Runner["ProcessGUID"] = processEntity.ProcessGUID; - sfconfig.Runner["Version"] = processEntity.Version; - - var taskEntity = processlist.pselectedTaskEntity; - if (taskEntity != null) { - sfconfig.Runner["UserID"] = taskEntity.AssignedToUserID; - sfconfig.Runner["UserName"] = taskEntity.AssignedToUserName; - sfconfig.Runner["TaskID"] = taskEntity.TaskID; - - processapi.resend(sfconfig.Runner, function (result) { - if (result.Status === 1) { - $.msgBox({ - title: "Process / Resend", - content: kresource.getItem('processresentokmsg'), - type: "info" - }); - processlist.getTaskList(); - processlist.getDoneList(); - } else { - $.msgBox({ - title: "Process / Resend", - content: kresource.getItem("processresenterrormsg") + result.Message, - type: "warn" - }); - } - }) - } else { - $.msgBox({ - title: "Process / Resend", - content: kresource.getItem('tasklectedwarnmsg'), - type: "warn" - }); - } - } else { - $.msgBox({ - title: "Process / Resend", - content: kresource.getItem('processselectedwarnmsg'), - type: "warn" - }); - } - } - - processlist.reject = function () { - var processEntity = processlist.pselectedProcessEntity; - if (processEntity != null) { - sfconfig.initRunner(); - sfconfig.Runner["ProcessGUID"] = processEntity.ProcessGUID; - sfconfig.Runner["Version"] = processEntity.Version; - - var taskEntity = processlist.pselectedTaskEntity; - if (taskEntity != null) { - sfconfig.Runner["UserID"] = taskEntity.AssignedToUserID; - sfconfig.Runner["UserName"] = taskEntity.AssignedToUserName; - sfconfig.Runner["TaskID"] = taskEntity.TaskID; - - $.msgBox({ - title: "Are You Sure", - content: kresource.getItem('processrejectwarnmsg'), - type: "confirm", - buttons: [{ value: "Yes" }, { value: "Cancel" }], - success: function (result) { - processapi.reject(sfconfig.Runner, function (result) { - if (result.Status === 1) { - $.msgBox({ - title: "Process / Reject", - content: kresource.getItem('processrejectedokmsg'), - type: "info" - }); - processlist.getTaskList(); - processlist.getDoneList(); - } else { - $.msgBox({ - title: "Process / Reject", - content: kresource.getItem("processrejectederrormsg") + result.Message, - type: "warn" - }); - } - }) - } - }); - } else { - $.msgBox({ - title: "Process / Reject", - content: kresource.getItem('tasklectedwarnmsg'), - type: "warn" - }); - } - } else { - $.msgBox({ - title: "Process / Reject", - content: kresource.getItem('processselectedwarnmsg'), - type: "warn" - }); - } - } - - processlist.close = function () { - var processEntity = processlist.pselectedProcessEntity; - if (processEntity != null) { - sfconfig.initRunner(); - sfconfig.Runner["ProcessGUID"] = processEntity.ProcessGUID; - sfconfig.Runner["Version"] = processEntity.Version; - - var taskEntity = processlist.pselectedTaskEntity; - if (taskEntity != null) { - sfconfig.Runner["UserID"] = taskEntity.AssignedToUserID; - sfconfig.Runner["UserName"] = taskEntity.AssignedToUserName; - sfconfig.Runner["TaskID"] = taskEntity.TaskID; - - $.msgBox({ - title: "Are You Sure", - content: kresource.getItem('processclosewarnmsg'), - type: "confirm", - buttons: [{ value: "Yes" }, { value: "Cancel" }], - success: function (result) { - processapi.close(sfconfig.Runner, function (result) { - if (result.Status === 1) { - $.msgBox({ - title: "Process / Close", - content: kresource.getItem('processclosedokmsg'), - type: "info" - }); - processlist.getTaskList(); - processlist.getDoneList(); - } else { - $.msgBox({ - title: "Process / Close", - content: kresource.getItem('processclosederrormsg') + result.Message, - type: "warn" - }); - } - }) - } - }); - } else { - $.msgBox({ - title: "Process / Close", - content: kresource.getItem('tasklectedwarnmsg'), - type: "warn" - }); - } - } else { - $.msgBox({ - title: "Process / Close", - content: kresource.getItem('processselectedwarnmsg'), - type: "warn" - }); - } - } - - processlist.deleteInstance = function () { - var instanceQuery = {}; - instanceQuery.ProcessGUID = processlist.pselectedProcessEntity.ProcessGUID; - instanceQuery.Version = processlist.pselectedProcessEntity.Version; - instanceQuery.AppName = sfconfig.Runner.AppName; - instanceQuery.AppInstanceID = sfconfig.Runner.AppInstanceID; - - $.msgBox({ - title: "Are You Sure", - content: kresource.getItem('processinstanceclearwarnmsg'), - type: "confirm", - buttons: [{ value: "Yes" }, { value: "Cancel" }], - success: function (result) { - if (result == "Yes") { - processapi.deleteInstance(instanceQuery, function (result) { - if (result.Status === 1) { - $.msgBox({ - title: "ProcessInstance / Delete", - content: kresource.getItem("processinstanceclearokmsg"), - type: "info" - }); - processlist.getTaskList(); - processlist.getDoneList(); - } else { - $.msgBox({ - title: "ProcessInstance / Delete", - content: kresource.getItem("processinstanceclearerrormsg") + result.Message, - type: "error" - }); - } - }); - } - } - }); - }; - - return processlist; -})() - -//process api -var processapi = (function () { - function processapi() { - } - - processapi.queryProcessFile = function (query, callback) { - jshelper.ajaxPost('api/Wf2Xml/QueryProcessFile', - JSON.stringify(query), - function (result) { - callback(result); - } - ); - } - - processapi.start = function (query, callback) { - jshelper.ajaxPost('api/Wf2Xml/StartProcess', - JSON.stringify(query), - function (result) { - callback(result); - }); - } - - //processapi.next = function (query, callback) { - // jshelper.ajaxPost('api/Wf2Xml/GextNextActivityUserTree', - // JSON.stringify(query), - // function (result) { - // callback(result); - // }); - //} - - processapi.next = function (query, callback) { - jshelper.ajaxPost('api/Wf2Xml/GetNextStepInfo', - JSON.stringify(query), - function (result) { - callback(result); - }); - } - - processapi.run = function (query, callback) { - jshelper.ajaxPost('api/Wf2Xml/RunProcess', - JSON.stringify(query), - function (result) { - callback(result); - }); - } - - processapi.revise = function (query, callback) { - jshelper.ajaxPost('api/Wf2Xml/ReviseProcess', - JSON.stringify(query), - function (result) { - callback(result); - }); - } - - //processapi.prev = function (query, callback) { - // jshelper.ajaxPost('api/Wf2Xml/GetPrevActivityUserTree', - // JSON.stringify(query), - // function (result) { - // callback(result); - // }); - //} - - processapi.prev = function (query, callback) { - jshelper.ajaxPost('api/Wf2Xml/GetPreviousStepInfo', - JSON.stringify(query), - function (result) { - callback(result); - }); - } - - processapi.sendback = function (query, callback) { - jshelper.ajaxPost('api/Wf2Xml/SendBackProcess', - JSON.stringify(query), - function (result) { - callback(result); - }); - } - - processapi.withdraw = function (query, callback) { - jshelper.ajaxPost('api/Wf2Xml/WithdrawProcess', - JSON.stringify(query), - function (result) { - callback(result); - }); - } - - processapi.resend = function (query, callback) { - jshelper.ajaxPost('api/Wf2Xml/ResendProcess', - JSON.stringify(query), - function (result) { - callback(result); - }); - } - - processapi.reject = function (query, callback) { - jshelper.ajaxPost('api/Wf2Xml/RejectProcess', - JSON.stringify(query), - function (result) { - callback(result); - }); - } - - processapi.close = function (query, callback) { - jshelper.ajaxPost('api/Wf2Xml/CloseProcess', - JSON.stringify(query), - function (result) { - callback(result); - }); - } - - processapi.deleteInstance = function (query, callback) { - jshelper.ajaxPost('api/Wf2Xml/DeleteInstance', - JSON.stringify(query), - function (result) { - callback(result); - }); - } - - return processapi; -})() \ No newline at end of file diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/sfconfig.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/sfconfig.js deleted file mode 100644 index d527312e..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/sfconfig.js +++ /dev/null @@ -1,42 +0,0 @@ -/* -* Slickflow 工作流引擎遵循LGPL协议,也可联系作者商业授权并获取技术支持; -* 除此之外的使用则视为不正当使用,请您务必避免由此带来的商业版权纠纷。 - -The Slickflow Designer project. -Copyright (C) 2014 .NET Workflow Engine Library - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, you can access the official -web page about lgpl: https://www.gnu.org/licenses/lgpl.html -*/ - -var sfconfig = (function () { - function sfconfig() { - } - - sfconfig.initRunner = function () { - sfconfig.Runner = {}; - sfconfig.Runner["AppName"] = "Order-Books"; - sfconfig.Runner["AppInstanceID"] = "123"; - sfconfig.Runner["AppInstanceCode"] = "123-code"; - sfconfig.Runner["UserID"] = "01"; - sfconfig.Runner["UserName"] = "Zero"; - } - - sfconfig.Command = { - RUN: "RUN", - REVISE: "REVISE" - }; - - return sfconfig; -})(); \ No newline at end of file diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/sfmain.js b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/sfmain.js deleted file mode 100644 index ddaa9401..00000000 --- a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/ViewJS/sfmain.js +++ /dev/null @@ -1,136 +0,0 @@ -/* -* Slickflow 工作流引擎遵循LGPL协议,也可联系作者商业授权并获取技术支持; -* 除此之外的使用则视为不正当使用,请您务必避免由此带来的商业版权纠纷。 - -The Slickflow Designer project. -Copyright (C) 2014 .NET Workflow Engine Library - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, you can access the official -web page about lgpl: https://www.gnu.org/licenses/lgpl.html -*/ - -var sfmain = (function () { - function sfmain() { - } - - //process list - sfmain.load = function () { - sfconfig.initRunner(); - processlist.getProcessList(); - } - - //startup - sfmain.start = function () { - processlist.start(); - } - - //run - sfmain.run = function () { - processlist.run(); - } - - //revise - sfmain.revise = function () { - processlist.revise(); - } - - //withdraw - sfmain.withdraw = function () { - processlist.withdraw(); - } - - //sendback - sfmain.sendback = function () { - processlist.sendback(); - } - - //resend - sfmain.resend = function () { - $.msgBox({ - title: "Are You Sure", - content: kresource.getItem("processresendconfirmmsg"), - type: "confirm", - buttons: [{ value: "Yes" }, { value: "Cancel" }], - success: function (result) { - if (result == "Yes") { - processlist.resend(); - } - } - }); - } - - //reject - sfmain.reject = function () { - processlist.reject(); - } - - //close - sfmain.close = function () { - processlist.close(); - } - - //todo - sfmain.task = function () { - processlist.getTaskList(); - } - - //done - sfmain.done = function () { - processlist.getDoneList(); - } - - //flowchart - sfmain.graph = function () { - var entity = processlist.pselectedProcessEntity; - - if (entity !== null) { - var appInstanceID = sfconfig.Runner.AppInstanceID; - var processGUID = entity.ProcessGUID; - - window.open('/sfd2c/Diagram?AppInstanceID=' + appInstanceID - + '&ProcessGUID=' + processGUID + '&Mode=' + 'READONLY'); - } else { - $.msgBox({ - title: "Process / KGraph", - content: kresource.getItem('processselectedwarnmsg'), - type: "alert" - }); - return false; - } - } - - //clear - sfmain.deleteInstance = function () { - processlist.deleteInstance(); - } - - sfmain.loadVariable = function () { - if (processlist.pselectedTaskEntity !== null) { - var taskID = processlist.pselectedTaskEntity.ID; - BootstrapDialog.show({ - title: "Process / Variable", - message: $('
    ').load('variable/list/' + taskID), - draggable: true - }); - } - else { - $.msgBox({ - title: "Process / Variable", - content: kresource.getItem('processvariableopenmsg'), - type: "alert" - }); - } - } - return sfmain; -})(); \ No newline at end of file diff --git a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/favicon.ico b/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/favicon.ico deleted file mode 100644 index a3a79998..00000000 Binary files a/NETCORE/Slickflow/Source/Slickflow.WebTest/wwwroot/favicon.ico and /dev/null differ diff --git a/NETCORE/Slickflow/Source/Slickflow.sln b/NETCORE/Slickflow/Source/Slickflow.sln index a8227137..770dc0b2 100644 --- a/NETCORE/Slickflow/Source/Slickflow.sln +++ b/NETCORE/Slickflow/Source/Slickflow.sln @@ -1,8 +1,10 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26730.16 +VisualStudioVersion = 15.0.28307.779 MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Slickflow.Engine", "Slickflow.Engine\Slickflow.Engine.csproj", "{59101DC2-F7A3-4F0D-91DB-650C3BA2D1A7}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{1B362C32-D778-4079-ADAA-E9AF1366829D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Basic", "Basic", "{1D1E9E18-9B16-40C7-AA01-1CF759D016EF}" @@ -23,17 +25,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Slickflow.Designer", "Slick EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Slickflow.Data", "Slickflow.Data\Slickflow.Data.csproj", "{87A163CD-97E3-4ED5-BDCB-6C1038E6841E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Slickflow.OrderDemo", "Slickflow.MvcDemo\Slickflow.OrderDemo.csproj", "{F4EEE842-B858-4B51-B89F-28284BD877A4}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Designer", "Designer", "{9351AEE3-F408-4302-9739-64203C98FF11}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Slickflow.BizAppService", "Slickflow.BizAppService\Slickflow.BizAppService.csproj", "{FF35A70E-692D-4CDB-96FD-06B559500ED7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Slickflow.Module.Localize", "Slickflow.Module.Localize\Slickflow.Module.Localize.csproj", "{1FF76220-ABB3-40CE-A015-E10191DD28D9}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Slickflow.WebTest", "Slickflow.WebTest\Slickflow.WebTest.csproj", "{08F3B49F-DE10-49F5-A162-7CA6F9DA4381}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Slickflow.MvcDemo", "Slickflow.MvcDemo\Slickflow.MvcDemo.csproj", "{4A8FDE0A-4BA1-4E64-9E2D-F73587B9385E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Slickflow.Engine", "Slickflow.Engine\Slickflow.Engine.csproj", "{20E54CB4-0FBE-42D8-89D4-9C53C2E0BA44}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Slickflow.BizAppService", "Slickflow.BizAppService\Slickflow.BizAppService.csproj", "{8A60BD59-5598-41FE-8BB3-F9120A0F8F39}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Slickflow.Graph", "..\..\..\..\SlickGraph\Slickflow.Graph\Slickflow.Graph.csproj", "{9CA35F9A-67EB-4EAE-A516-72D5CD1D2F23}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper", "Dapper\Dapper.csproj", "{D62C13A1-82B7-45C7-B40C-53F779058002}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -41,6 +41,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {59101DC2-F7A3-4F0D-91DB-650C3BA2D1A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {59101DC2-F7A3-4F0D-91DB-650C3BA2D1A7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {59101DC2-F7A3-4F0D-91DB-650C3BA2D1A7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {59101DC2-F7A3-4F0D-91DB-650C3BA2D1A7}.Release|Any CPU.Build.0 = Release|Any CPU {F325BFE7-C655-4CA1-8D1A-67B337FC9BD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F325BFE7-C655-4CA1-8D1A-67B337FC9BD7}.Debug|Any CPU.Build.0 = Debug|Any CPU {F325BFE7-C655-4CA1-8D1A-67B337FC9BD7}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -65,42 +69,38 @@ Global {87A163CD-97E3-4ED5-BDCB-6C1038E6841E}.Debug|Any CPU.Build.0 = Debug|Any CPU {87A163CD-97E3-4ED5-BDCB-6C1038E6841E}.Release|Any CPU.ActiveCfg = Release|Any CPU {87A163CD-97E3-4ED5-BDCB-6C1038E6841E}.Release|Any CPU.Build.0 = Release|Any CPU - {F4EEE842-B858-4B51-B89F-28284BD877A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F4EEE842-B858-4B51-B89F-28284BD877A4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F4EEE842-B858-4B51-B89F-28284BD877A4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F4EEE842-B858-4B51-B89F-28284BD877A4}.Release|Any CPU.Build.0 = Release|Any CPU - {FF35A70E-692D-4CDB-96FD-06B559500ED7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FF35A70E-692D-4CDB-96FD-06B559500ED7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FF35A70E-692D-4CDB-96FD-06B559500ED7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FF35A70E-692D-4CDB-96FD-06B559500ED7}.Release|Any CPU.Build.0 = Release|Any CPU - {08F3B49F-DE10-49F5-A162-7CA6F9DA4381}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {08F3B49F-DE10-49F5-A162-7CA6F9DA4381}.Debug|Any CPU.Build.0 = Debug|Any CPU - {08F3B49F-DE10-49F5-A162-7CA6F9DA4381}.Release|Any CPU.ActiveCfg = Release|Any CPU - {08F3B49F-DE10-49F5-A162-7CA6F9DA4381}.Release|Any CPU.Build.0 = Release|Any CPU - {20E54CB4-0FBE-42D8-89D4-9C53C2E0BA44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {20E54CB4-0FBE-42D8-89D4-9C53C2E0BA44}.Debug|Any CPU.Build.0 = Debug|Any CPU - {20E54CB4-0FBE-42D8-89D4-9C53C2E0BA44}.Release|Any CPU.ActiveCfg = Release|Any CPU - {20E54CB4-0FBE-42D8-89D4-9C53C2E0BA44}.Release|Any CPU.Build.0 = Release|Any CPU - {9CA35F9A-67EB-4EAE-A516-72D5CD1D2F23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9CA35F9A-67EB-4EAE-A516-72D5CD1D2F23}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9CA35F9A-67EB-4EAE-A516-72D5CD1D2F23}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9CA35F9A-67EB-4EAE-A516-72D5CD1D2F23}.Release|Any CPU.Build.0 = Release|Any CPU + {1FF76220-ABB3-40CE-A015-E10191DD28D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1FF76220-ABB3-40CE-A015-E10191DD28D9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1FF76220-ABB3-40CE-A015-E10191DD28D9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1FF76220-ABB3-40CE-A015-E10191DD28D9}.Release|Any CPU.Build.0 = Release|Any CPU + {4A8FDE0A-4BA1-4E64-9E2D-F73587B9385E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A8FDE0A-4BA1-4E64-9E2D-F73587B9385E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A8FDE0A-4BA1-4E64-9E2D-F73587B9385E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A8FDE0A-4BA1-4E64-9E2D-F73587B9385E}.Release|Any CPU.Build.0 = Release|Any CPU + {8A60BD59-5598-41FE-8BB3-F9120A0F8F39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8A60BD59-5598-41FE-8BB3-F9120A0F8F39}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8A60BD59-5598-41FE-8BB3-F9120A0F8F39}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8A60BD59-5598-41FE-8BB3-F9120A0F8F39}.Release|Any CPU.Build.0 = Release|Any CPU + {D62C13A1-82B7-45C7-B40C-53F779058002}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D62C13A1-82B7-45C7-B40C-53F779058002}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D62C13A1-82B7-45C7-B40C-53F779058002}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D62C13A1-82B7-45C7-B40C-53F779058002}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution + {59101DC2-F7A3-4F0D-91DB-650C3BA2D1A7} = {1B362C32-D778-4079-ADAA-E9AF1366829D} {F325BFE7-C655-4CA1-8D1A-67B337FC9BD7} = {1B362C32-D778-4079-ADAA-E9AF1366829D} {FC6FF6D6-4E76-4ED8-A522-AEDDADB5F30B} = {D2D47324-482A-4EA7-A37E-FF8FDFFA6FCF} {69F5E50C-30FB-4BF5-B8A9-00EC5DBC9FD2} = {1D1E9E18-9B16-40C7-AA01-1CF759D016EF} {D5EEF569-9AE7-414B-93F0-548498B10D13} = {3E538BD6-2283-46AC-93DC-9F4019E3A04B} {30356CC2-0371-4522-9FC4-C004B45A4FAE} = {9351AEE3-F408-4302-9739-64203C98FF11} {87A163CD-97E3-4ED5-BDCB-6C1038E6841E} = {1B362C32-D778-4079-ADAA-E9AF1366829D} - {F4EEE842-B858-4B51-B89F-28284BD877A4} = {3E538BD6-2283-46AC-93DC-9F4019E3A04B} - {FF35A70E-692D-4CDB-96FD-06B559500ED7} = {D2D47324-482A-4EA7-A37E-FF8FDFFA6FCF} - {08F3B49F-DE10-49F5-A162-7CA6F9DA4381} = {3E538BD6-2283-46AC-93DC-9F4019E3A04B} - {20E54CB4-0FBE-42D8-89D4-9C53C2E0BA44} = {1B362C32-D778-4079-ADAA-E9AF1366829D} - {9CA35F9A-67EB-4EAE-A516-72D5CD1D2F23} = {9351AEE3-F408-4302-9739-64203C98FF11} + {1FF76220-ABB3-40CE-A015-E10191DD28D9} = {D2D47324-482A-4EA7-A37E-FF8FDFFA6FCF} + {4A8FDE0A-4BA1-4E64-9E2D-F73587B9385E} = {3E538BD6-2283-46AC-93DC-9F4019E3A04B} + {8A60BD59-5598-41FE-8BB3-F9120A0F8F39} = {3E538BD6-2283-46AC-93DC-9F4019E3A04B} + {D62C13A1-82B7-45C7-B40C-53F779058002} = {1D1E9E18-9B16-40C7-AA01-1CF759D016EF} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0AA9B361-0AF3-4C2F-8AE4-2EEA4AC2FABE}