diff options
114 files changed, 5129 insertions, 3326 deletions
diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 00c6584a9..a01e989c2 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -22,8 +22,8 @@ }, { "ImportPath": "github.com/ethereum/ethash", - "Comment": "v17-23-g2561e13", - "Rev": "2561e1322a7e8e3d4a2cc903c44b1e96340bcb27" + "Comment": "v17-63-gbca024b", + "Rev": "bca024b0b30d83ec6798a5d4fa8c5fc6f937009a" }, { "ImportPath": "github.com/ethereum/serpent-go", diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/.gitignore b/Godeps/_workspace/src/github.com/ethereum/ethash/.gitignore index 6bb36ed15..3162bd828 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/.gitignore +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/.gitignore @@ -2,4 +2,9 @@ .DS_Store */**/*un~ .vagrant/ -cpp-build/ +*.pyc +build/ +pyethash.egg-info/ +*.so +*~ +*.swp diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/.travis.yml b/Godeps/_workspace/src/github.com/ethereum/ethash/.travis.yml new file mode 100644 index 000000000..4b929eb69 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/.travis.yml @@ -0,0 +1,6 @@ +before_install: + - sudo apt-get update -qq + - sudo apt-get install -qq wget cmake gcc bash libboost-test-dev nodejs python-pip python-dev + - sudo pip install virtualenv -q + +script: "./test/test.sh" diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/CMakeLists.txt b/Godeps/_workspace/src/github.com/ethereum/ethash/CMakeLists.txt index ac189457f..c93395bf8 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/CMakeLists.txt +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.2) +cmake_minimum_required(VERSION 2.8.7) project(ethash) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") @@ -8,7 +8,8 @@ if (WIN32 AND WANT_CRYPTOPP) add_subdirectory(cryptopp) endif() -add_subdirectory(libethash) -add_subdirectory(libethash-cl EXCLUDE_FROM_ALL) -add_subdirectory(benchmark EXCLUDE_FROM_ALL) -add_subdirectory(test EXCLUDE_FROM_ALL) +add_subdirectory(src/libethash) +# bin2h.cmake doesn't work +#add_subdirectory(src/libethash-cl EXCLUDE_FROM_ALL) +add_subdirectory(src/benchmark EXCLUDE_FROM_ALL) +add_subdirectory(test/c EXCLUDE_FROM_ALL) diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/Makefile b/Godeps/_workspace/src/github.com/ethereum/ethash/Makefile new file mode 100644 index 000000000..e2630581e --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/Makefile @@ -0,0 +1,3 @@ +.PHONY: clean +clean: + rm -rf *.so pyethash.egg-info/ build/ test/python/python-virtual-env/ test/c/build/ pyethash/*.{so,pyc} diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/README.md b/Godeps/_workspace/src/github.com/ethereum/ethash/README.md new file mode 100644 index 000000000..8b9e015cf --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/README.md @@ -0,0 +1,7 @@ +[![Build Status](https://travis-ci.org/ethereum/ethash.svg?branch=master)](https://travis-ci.org/ethereum/ethash) + + +# Ethash + +For details on this project, please see the Ethereum wiki: +https://github.com/ethereum/wiki/wiki/Ethash diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/Vagrantfile b/Godeps/_workspace/src/github.com/ethereum/ethash/Vagrantfile new file mode 100644 index 000000000..03891653f --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/Vagrantfile @@ -0,0 +1,7 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + config.vm.box = "Ubuntu 12.04" + config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box" +end diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/CMakeParseArguments.cmake b/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/CMakeParseArguments.cmake new file mode 100644 index 000000000..8553f38f5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/CMakeParseArguments.cmake @@ -0,0 +1,161 @@ +#.rst: +# CMakeParseArguments +# ------------------- +# +# +# +# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> +# <multi_value_keywords> args...) +# +# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions +# for parsing the arguments given to that macro or function. It +# processes the arguments and defines a set of variables which hold the +# values of the respective options. +# +# The <options> argument contains all options for the respective macro, +# i.e. keywords which can be used when calling the macro without any +# value following, like e.g. the OPTIONAL keyword of the install() +# command. +# +# The <one_value_keywords> argument contains all keywords for this macro +# which are followed by one value, like e.g. DESTINATION keyword of the +# install() command. +# +# The <multi_value_keywords> argument contains all keywords for this +# macro which can be followed by more than one value, like e.g. the +# TARGETS or FILES keywords of the install() command. +# +# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the +# keywords listed in <options>, <one_value_keywords> and +# <multi_value_keywords> a variable composed of the given <prefix> +# followed by "_" and the name of the respective keyword. These +# variables will then hold the respective value from the argument list. +# For the <options> keywords this will be TRUE or FALSE. +# +# All remaining arguments are collected in a variable +# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see +# whether your macro was called with unrecognized parameters. +# +# As an example here a my_install() macro, which takes similar arguments +# as the real install() command: +# +# :: +# +# function(MY_INSTALL) +# set(options OPTIONAL FAST) +# set(oneValueArgs DESTINATION RENAME) +# set(multiValueArgs TARGETS CONFIGURATIONS) +# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" +# "${multiValueArgs}" ${ARGN} ) +# ... +# +# +# +# Assume my_install() has been called like this: +# +# :: +# +# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) +# +# +# +# After the cmake_parse_arguments() call the macro will have set the +# following variables: +# +# :: +# +# MY_INSTALL_OPTIONAL = TRUE +# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() +# MY_INSTALL_DESTINATION = "bin" +# MY_INSTALL_RENAME = "" (was not used) +# MY_INSTALL_TARGETS = "foo;bar" +# MY_INSTALL_CONFIGURATIONS = "" (was not used) +# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" +# +# +# +# You can then continue and process these variables. +# +# Keywords terminate lists of values, e.g. if directly after a +# one_value_keyword another recognized keyword follows, this is +# interpreted as the beginning of the new option. E.g. +# my_install(TARGETS foo DESTINATION OPTIONAL) would result in +# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION +# would be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. + +#============================================================================= +# Copyright 2010 Alexander Neundorf <neundorf@kde.org> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) + return() +endif() +set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) + + +function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) + # first set all result variables to empty/FALSE + foreach(arg_name ${_singleArgNames} ${_multiArgNames}) + set(${prefix}_${arg_name}) + endforeach() + + foreach(option ${_optionNames}) + set(${prefix}_${option} FALSE) + endforeach() + + set(${prefix}_UNPARSED_ARGUMENTS) + + set(insideValues FALSE) + set(currentArgName) + + # now iterate over all arguments and fill the result variables + foreach(currentArg ${ARGN}) + list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword + + if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) + if(insideValues) + if("${insideValues}" STREQUAL "SINGLE") + set(${prefix}_${currentArgName} ${currentArg}) + set(insideValues FALSE) + elseif("${insideValues}" STREQUAL "MULTI") + list(APPEND ${prefix}_${currentArgName} ${currentArg}) + endif() + else() + list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) + endif() + else() + if(NOT ${optionIndex} EQUAL -1) + set(${prefix}_${currentArg} TRUE) + set(insideValues FALSE) + elseif(NOT ${singleArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "SINGLE") + elseif(NOT ${multiArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "MULTI") + endif() + endif() + + endforeach() + + # propagate the result variables to the caller: + foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) + set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) + endforeach() + set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) + +endfunction() diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindOpenCL.cmake b/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindOpenCL.cmake index cc567c95e..4d3ed842c 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindOpenCL.cmake +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindOpenCL.cmake @@ -1,91 +1,136 @@ +#.rst: +# FindOpenCL +# ---------- # -# This file taken from FindOpenCL project @ http://gitorious.com/findopencl +# Try to find OpenCL # -# - Try to find OpenCL -# This module tries to find an OpenCL implementation on your system. It supports -# AMD / ATI, Apple and NVIDIA implementations, but shoudl work, too. +# Once done this will define:: # -# Once done this will define -# OPENCL_FOUND - system has OpenCL -# OPENCL_INCLUDE_DIRS - the OpenCL include directory -# OPENCL_LIBRARIES - link these to use OpenCL +# OpenCL_FOUND - True if OpenCL was found +# OpenCL_INCLUDE_DIRS - include directories for OpenCL +# OpenCL_LIBRARIES - link against this library to use OpenCL +# OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2) +# OpenCL_VERSION_MAJOR - The major version of the OpenCL implementation +# OpenCL_VERSION_MINOR - The minor version of the OpenCL implementation +# +# The module will also define two cache variables:: +# +# OpenCL_INCLUDE_DIR - the OpenCL include directory +# OpenCL_LIBRARY - the path to the OpenCL library # -# WIN32 should work, but is untested - -FIND_PACKAGE( PackageHandleStandardArgs ) - -SET (OPENCL_VERSION_STRING "0.1.0") -SET (OPENCL_VERSION_MAJOR 0) -SET (OPENCL_VERSION_MINOR 1) -SET (OPENCL_VERSION_PATCH 0) - -IF (APPLE) - - FIND_LIBRARY(OPENCL_LIBRARIES OpenCL DOC "OpenCL lib for OSX") - FIND_PATH(OPENCL_INCLUDE_DIRS OpenCL/cl.h DOC "Include for OpenCL on OSX") - FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS OpenCL/cl.hpp DOC "Include for OpenCL CPP bindings on OSX") - -ELSE (APPLE) - - IF (WIN32) - - FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h) - FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp) - - # The AMD SDK currently installs both x86 and x86_64 libraries - # This is only a hack to find out architecture - IF( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64" ) - SET(OPENCL_LIB_DIR "$ENV{ATISTREAMSDKROOT}/lib/x86_64") - SET(OPENCL_LIB_DIR "$ENV{ATIINTERNALSTREAMSDKROOT}/lib/x86_64") - ELSE (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") - SET(OPENCL_LIB_DIR "$ENV{ATISTREAMSDKROOT}/lib/x86") - SET(OPENCL_LIB_DIR "$ENV{ATIINTERNALSTREAMSDKROOT}/lib/x86") - ENDIF( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64" ) - - # find out if the user asked for a 64-bit build, and use the corresponding - # 64 or 32 bit NVIDIA library paths to the search: - STRING(REGEX MATCH "Win64" ISWIN64 ${CMAKE_GENERATOR}) - IF("${ISWIN64}" STREQUAL "Win64") - FIND_LIBRARY(OPENCL_LIBRARIES OpenCL.lib ${OPENCL_LIB_DIR} $ENV{CUDA_LIB_PATH} $ENV{CUDA_PATH}/lib/x64) - ELSE("${ISWIN64}" STREQUAL "Win64") - FIND_LIBRARY(OPENCL_LIBRARIES OpenCL.lib ${OPENCL_LIB_DIR} $ENV{CUDA_LIB_PATH} $ENV{CUDA_PATH}/lib/Win32) - ENDIF("${ISWIN64}" STREQUAL "Win64") - - GET_FILENAME_COMPONENT(_OPENCL_INC_CAND ${OPENCL_LIB_DIR}/../../include ABSOLUTE) - - # On Win32 search relative to the library - FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h PATHS "${_OPENCL_INC_CAND}" $ENV{CUDA_INC_PATH} $ENV{CUDA_PATH}/include) - FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS "${_OPENCL_INC_CAND}" $ENV{CUDA_INC_PATH} $ENV{CUDA_PATH}/include) - - ELSE (WIN32) - - # Unix style platforms - FIND_LIBRARY(OPENCL_LIBRARIES OpenCL - ENV LD_LIBRARY_PATH - ) - - GET_FILENAME_COMPONENT(OPENCL_LIB_DIR ${OPENCL_LIBRARIES} PATH) - GET_FILENAME_COMPONENT(_OPENCL_INC_CAND ${OPENCL_LIB_DIR}/../../include ABSOLUTE) - - # The AMD SDK currently does not place its headers - # in /usr/include, therefore also search relative - # to the library - FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h PATHS ${_OPENCL_INC_CAND} "/usr/local/cuda/include") - FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS ${_OPENCL_INC_CAND} "/usr/local/cuda/include") - - ENDIF (WIN32) - -ENDIF (APPLE) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS( OpenCL DEFAULT_MSG OPENCL_LIBRARIES OPENCL_INCLUDE_DIRS ) - -IF( _OPENCL_CPP_INCLUDE_DIRS ) - SET( OPENCL_HAS_CPP_BINDINGS TRUE ) - LIST( APPEND OPENCL_INCLUDE_DIRS ${_OPENCL_CPP_INCLUDE_DIRS} ) - # This is often the same, so clean up - LIST( REMOVE_DUPLICATES OPENCL_INCLUDE_DIRS ) -ENDIF( _OPENCL_CPP_INCLUDE_DIRS ) -MARK_AS_ADVANCED( - OPENCL_INCLUDE_DIRS -)
\ No newline at end of file +#============================================================================= +# Copyright 2014 Matthaeus G. Chajdas +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +function(_FIND_OPENCL_VERSION) + include(CheckSymbolExists) + include(CMakePushCheckState) + set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY}) + + CMAKE_PUSH_CHECK_STATE() + foreach(VERSION "2_0" "1_2" "1_1" "1_0") + set(CMAKE_REQUIRED_INCLUDES "${OpenCL_INCLUDE_DIR}") + + if(APPLE) + CHECK_SYMBOL_EXISTS( + CL_VERSION_${VERSION} + "${OpenCL_INCLUDE_DIR}/OpenCL/cl.h" + OPENCL_VERSION_${VERSION}) + else() + CHECK_SYMBOL_EXISTS( + CL_VERSION_${VERSION} + "${OpenCL_INCLUDE_DIR}/CL/cl.h" + OPENCL_VERSION_${VERSION}) + endif() + + if(OPENCL_VERSION_${VERSION}) + string(REPLACE "_" "." VERSION "${VERSION}") + set(OpenCL_VERSION_STRING ${VERSION} PARENT_SCOPE) + string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}") + list(GET version_components 0 major_version) + list(GET version_components 1 minor_version) + set(OpenCL_VERSION_MAJOR ${major_version} PARENT_SCOPE) + set(OpenCL_VERSION_MINOR ${minor_version} PARENT_SCOPE) + break() + endif() + endforeach() + CMAKE_POP_CHECK_STATE() +endfunction() + +find_path(OpenCL_INCLUDE_DIR + NAMES + CL/cl.h OpenCL/cl.h + PATHS + ENV "PROGRAMFILES(X86)" + ENV AMDAPPSDKROOT + ENV INTELOCLSDKROOT + ENV NVSDKCOMPUTE_ROOT + ENV CUDA_PATH + ENV ATISTREAMSDKROOT + PATH_SUFFIXES + include + OpenCL/common/inc + "AMD APP/include") + +_FIND_OPENCL_VERSION() + +if(WIN32) + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + find_library(OpenCL_LIBRARY + NAMES OpenCL + PATHS + ENV "PROGRAMFILES(X86)" + ENV AMDAPPSDKROOT + ENV INTELOCLSDKROOT + ENV CUDA_PATH + ENV NVSDKCOMPUTE_ROOT + ENV ATISTREAMSDKROOT + PATH_SUFFIXES + "AMD APP/lib/x86" + lib/x86 + lib/Win32 + OpenCL/common/lib/Win32) + elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + find_library(OpenCL_LIBRARY + NAMES OpenCL + PATHS + ENV "PROGRAMFILES(X86)" + ENV AMDAPPSDKROOT + ENV INTELOCLSDKROOT + ENV CUDA_PATH + ENV NVSDKCOMPUTE_ROOT + ENV ATISTREAMSDKROOT + PATH_SUFFIXES + "AMD APP/lib/x86_64" + lib/x86_64 + lib/x64 + OpenCL/common/lib/x64) + endif() +else() + find_library(OpenCL_LIBRARY + NAMES OpenCL) +endif() + +set(OpenCL_LIBRARIES ${OpenCL_LIBRARY}) +set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR}) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args( + OpenCL + FOUND_VAR OpenCL_FOUND + REQUIRED_VARS OpenCL_LIBRARY OpenCL_INCLUDE_DIR + VERSION_VAR OpenCL_VERSION_STRING) + +mark_as_advanced( + OpenCL_INCLUDE_DIR + OpenCL_LIBRARY) diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindPackageHandleStandardArgs.cmake b/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindPackageHandleStandardArgs.cmake new file mode 100644 index 000000000..6bcf1e788 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindPackageHandleStandardArgs.cmake @@ -0,0 +1,382 @@ +#.rst: +# FindPackageHandleStandardArgs +# ----------------------------- +# +# +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> ... ) +# +# This function is intended to be used in FindXXX.cmake modules files. +# It handles the REQUIRED, QUIET and version-related arguments to +# find_package(). It also sets the <packagename>_FOUND variable. The +# package is considered found if all variables <var1>... listed contain +# valid results, e.g. valid filepaths. +# +# There are two modes of this function. The first argument in both +# modes is the name of the Find-module where it is called (in original +# casing). +# +# The first simple mode looks like this: +# +# :: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> +# (DEFAULT_MSG|"Custom failure message") <var1>...<varN> ) +# +# If the variables <var1> to <varN> are all valid, then +# <UPPERCASED_NAME>_FOUND will be set to TRUE. If DEFAULT_MSG is given +# as second argument, then the function will generate itself useful +# success and error messages. You can also supply a custom error +# message for the failure case. This is not recommended. +# +# The second mode is more powerful and also supports version checking: +# +# :: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME +# [FOUND_VAR <resultVar>] +# [REQUIRED_VARS <var1>...<varN>] +# [VERSION_VAR <versionvar>] +# [HANDLE_COMPONENTS] +# [CONFIG_MODE] +# [FAIL_MESSAGE "Custom failure message"] ) +# +# In this mode, the name of the result-variable can be set either to +# either <UPPERCASED_NAME>_FOUND or <OriginalCase_Name>_FOUND using the +# FOUND_VAR option. Other names for the result-variable are not +# allowed. So for a Find-module named FindFooBar.cmake, the two +# possible names are FooBar_FOUND and FOOBAR_FOUND. It is recommended +# to use the original case version. If the FOUND_VAR option is not +# used, the default is <UPPERCASED_NAME>_FOUND. +# +# As in the simple mode, if <var1> through <varN> are all valid, +# <packagename>_FOUND will be set to TRUE. After REQUIRED_VARS the +# variables which are required for this package are listed. Following +# VERSION_VAR the name of the variable can be specified which holds the +# version of the package which has been found. If this is done, this +# version will be checked against the (potentially) specified required +# version used in the find_package() call. The EXACT keyword is also +# handled. The default messages include information about the required +# version and the version which has been actually found, both if the +# version is ok or not. If the package supports components, use the +# HANDLE_COMPONENTS option to enable handling them. In this case, +# find_package_handle_standard_args() will report which components have +# been found and which are missing, and the <packagename>_FOUND variable +# will be set to FALSE if any of the required components (i.e. not the +# ones listed after OPTIONAL_COMPONENTS) are missing. Use the option +# CONFIG_MODE if your FindXXX.cmake module is a wrapper for a +# find_package(... NO_MODULE) call. In this case VERSION_VAR will be +# set to <NAME>_VERSION and the macro will automatically check whether +# the Config module was found. Via FAIL_MESSAGE a custom failure +# message can be specified, if this is not used, the default message +# will be displayed. +# +# Example for mode 1: +# +# :: +# +# find_package_handle_standard_args(LibXml2 DEFAULT_MSG +# LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) +# +# +# +# LibXml2 is considered to be found, if both LIBXML2_LIBRARY and +# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to +# TRUE. If it is not found and REQUIRED was used, it fails with +# FATAL_ERROR, independent whether QUIET was used or not. If it is +# found, success will be reported, including the content of <var1>. On +# repeated Cmake runs, the same message won't be printed again. +# +# Example for mode 2: +# +# :: +# +# find_package_handle_standard_args(LibXslt +# FOUND_VAR LibXslt_FOUND +# REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS +# VERSION_VAR LibXslt_VERSION_STRING) +# +# In this case, LibXslt is considered to be found if the variable(s) +# listed after REQUIRED_VAR are all valid, i.e. LibXslt_LIBRARIES and +# LibXslt_INCLUDE_DIRS in this case. The result will then be stored in +# LibXslt_FOUND . Also the version of LibXslt will be checked by using +# the version contained in LibXslt_VERSION_STRING. Since no +# FAIL_MESSAGE is given, the default messages will be printed. +# +# Another example for mode 2: +# +# :: +# +# find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) +# find_package_handle_standard_args(Automoc4 CONFIG_MODE) +# +# In this case, FindAutmoc4.cmake wraps a call to find_package(Automoc4 +# NO_MODULE) and adds an additional search directory for automoc4. Here +# the result will be stored in AUTOMOC4_FOUND. The following +# FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper +# success/error message. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) + +# internal helper macro +macro(_FPHSA_FAILURE_MESSAGE _msg) + if (${_NAME}_FIND_REQUIRED) + message(FATAL_ERROR "${_msg}") + else () + if (NOT ${_NAME}_FIND_QUIETLY) + message(STATUS "${_msg}") + endif () + endif () +endmacro() + + +# internal helper macro to generate the failure message when used in CONFIG_MODE: +macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + # <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: + if(${_NAME}_CONFIG) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") + else() + # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. + # List them all in the error message: + if(${_NAME}_CONSIDERED_CONFIGS) + set(configsText "") + list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) + math(EXPR configsCount "${configsCount} - 1") + foreach(currentConfigIndex RANGE ${configsCount}) + list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) + list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) + set(configsText "${configsText} ${filename} (version ${version})\n") + endforeach() + if (${_NAME}_NOT_FOUND_MESSAGE) + set(configsText "${configsText} Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n") + endif() + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") + + else() + # Simple case: No Config-file was found at all: + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") + endif() + endif() +endmacro() + + +function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) + +# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in +# new extended or in the "old" mode: + set(options CONFIG_MODE HANDLE_COMPONENTS) + set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR) + set(multiValueArgs REQUIRED_VARS) + set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) + list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) + + if(${INDEX} EQUAL -1) + set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) + set(FPHSA_REQUIRED_VARS ${ARGN}) + set(FPHSA_VERSION_VAR) + else() + + CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) + + if(FPHSA_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT FPHSA_FAIL_MESSAGE) + set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") + endif() + endif() + +# now that we collected all arguments, process them + + if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG") + set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") + endif() + + # In config-mode, we rely on the variable <package>_CONFIG, which is set by find_package() + # when it successfully found the config-file, including version checking: + if(FPHSA_CONFIG_MODE) + list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) + list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) + set(FPHSA_VERSION_VAR ${_NAME}_VERSION) + endif() + + if(NOT FPHSA_REQUIRED_VARS) + message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") + endif() + + list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) + + string(TOUPPER ${_NAME} _NAME_UPPER) + string(TOLOWER ${_NAME} _NAME_LOWER) + + if(FPHSA_FOUND_VAR) + if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$") + set(_FOUND_VAR ${FPHSA_FOUND_VAR}) + else() + message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") + endif() + else() + set(_FOUND_VAR ${_NAME_UPPER}_FOUND) + endif() + + # collect all variables which were not found, so they can be printed, so the + # user knows better what went wrong (#6375) + set(MISSING_VARS "") + set(DETAILS "") + # check if all passed variables are valid + unset(${_FOUND_VAR}) + foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) + if(NOT ${_CURRENT_VAR}) + set(${_FOUND_VAR} FALSE) + set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") + else() + set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") + endif() + endforeach() + if(NOT "${${_FOUND_VAR}}" STREQUAL "FALSE") + set(${_FOUND_VAR} TRUE) + endif() + + # component handling + unset(FOUND_COMPONENTS_MSG) + unset(MISSING_COMPONENTS_MSG) + + if(FPHSA_HANDLE_COMPONENTS) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(${_NAME}_${comp}_FOUND) + + if(NOT DEFINED FOUND_COMPONENTS_MSG) + set(FOUND_COMPONENTS_MSG "found components: ") + endif() + set(FOUND_COMPONENTS_MSG "${FOUND_COMPONENTS_MSG} ${comp}") + + else() + + if(NOT DEFINED MISSING_COMPONENTS_MSG) + set(MISSING_COMPONENTS_MSG "missing components: ") + endif() + set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}") + + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_FOUND_VAR} FALSE) + set(MISSING_VARS "${MISSING_VARS} ${comp}") + endif() + + endif() + endforeach() + set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") + set(DETAILS "${DETAILS}[c${COMPONENT_MSG}]") + endif() + + # version handling: + set(VERSION_MSG "") + set(VERSION_OK TRUE) + set(VERSION ${${FPHSA_VERSION_VAR}}) + + # check with DEFINED here as the requested or found version may be "0" + if (DEFINED ${_NAME}_FIND_VERSION) + if(DEFINED ${FPHSA_VERSION_VAR}) + + if(${_NAME}_FIND_VERSION_EXACT) # exact version required + # count the dots in the version string + string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${VERSION}") + # add one dot because there is one dot more than there are components + string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS) + if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT) + # Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT + # is at most 4 here. Therefore a simple lookup table is used. + if (${_NAME}_FIND_VERSION_COUNT EQUAL 1) + set(_VERSION_REGEX "[^.]*") + elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2) + set(_VERSION_REGEX "[^.]*\\.[^.]*") + elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3) + set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*") + else () + set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*") + endif () + string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${VERSION}") + unset(_VERSION_REGEX) + if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD) + set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable exact version \"${VERSION}\")") + endif () + unset(_VERSION_HEAD) + else () + if (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable exact version \"${VERSION}\")") + endif () + endif () + unset(_VERSION_DOTS) + + else() # minimum version specified: + if ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable version \"${VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")") + endif () + endif() + + else() + + # if the package was not found, but a version was given, add that to the output: + if(${_NAME}_FIND_VERSION_EXACT) + set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") + else() + set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") + endif() + + endif() + else () + if(VERSION) + set(VERSION_MSG "(found version \"${VERSION}\")") + endif() + endif () + + if(VERSION_OK) + set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]") + else() + set(${_FOUND_VAR} FALSE) + endif() + + + # print the result: + if (${_FOUND_VAR}) + FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") + else () + + if(FPHSA_CONFIG_MODE) + _FPHSA_HANDLE_FAILURE_CONFIG_MODE() + else() + if(NOT VERSION_OK) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") + else() + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") + endif() + endif() + + endif () + + set(${_FOUND_VAR} ${${_FOUND_VAR}} PARENT_SCOPE) + +endfunction() diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindPackageMessage.cmake b/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindPackageMessage.cmake new file mode 100644 index 000000000..a0349d3db --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindPackageMessage.cmake @@ -0,0 +1,57 @@ +#.rst: +# FindPackageMessage +# ------------------ +# +# +# +# FIND_PACKAGE_MESSAGE(<name> "message for user" "find result details") +# +# This macro is intended to be used in FindXXX.cmake modules files. It +# will print a message once for each unique find result. This is useful +# for telling the user where a package was found. The first argument +# specifies the name (XXX) of the package. The second argument +# specifies the message to display. The third argument lists details +# about the find result so that if they change the message will be +# displayed again. The macro also obeys the QUIET argument to the +# find_package command. +# +# Example: +# +# :: +# +# if(X11_FOUND) +# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" +# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") +# else() +# ... +# endif() + +#============================================================================= +# Copyright 2008-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +function(FIND_PACKAGE_MESSAGE pkg msg details) + # Avoid printing a message repeatedly for the same find result. + if(NOT ${pkg}_FIND_QUIETLY) + string(REPLACE "\n" "" details "${details}") + set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) + if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") + # The message has not yet been printed. + message(STATUS "${msg}") + + # Save the find details in the cache to avoid printing the same + # message again. + set("${DETAILS_VAR}" "${details}" + CACHE INTERNAL "Details about finding ${pkg}") + endif() + endif() +endfunction() diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go b/Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go index 32d3f0264..e50a3a834 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go @@ -2,32 +2,39 @@ package ethash /* #cgo CFLAGS: -std=gnu99 -Wall -#include "libethash/ethash.h" -#include "libethash/util.c" -#include "libethash/internal.c" -#include "libethash/sha3.c" +#include "src/libethash/util.c" +#include "src/libethash/internal.c" +#include "src/libethash/sha3.c" */ import "C" import ( "bytes" "encoding/binary" + "fmt" + "io/ioutil" "log" "math/big" "math/rand" + "os" + "path" "sync" "time" "unsafe" + "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/pow" ) +var tt256 = new(big.Int).Exp(big.NewInt(2), big.NewInt(256), big.NewInt(0)) + var powlogger = logger.NewLogger("POW") type DAG struct { SeedBlockNum uint64 dag unsafe.Pointer // full GB of memory for dag + file bool } type ParamsAndCache struct { @@ -59,16 +66,28 @@ func parseNonce(nonce []byte) (uint64, error) { const epochLength uint64 = 30000 -func getSeedBlockNum(blockNum uint64) uint64 { +func GetSeedBlockNum(blockNum uint64) uint64 { + var seedBlockNum uint64 = 0 + if blockNum > epochLength { + seedBlockNum = ((blockNum - 1) / epochLength) * epochLength + } + return seedBlockNum +} + +/* +XXX THIS DOESN'T WORK!! NEEDS FIXING +blockEpoch will underflow and wrap around causing massive issues +func GetSeedBlockNum(blockNum uint64) uint64 { var seedBlockNum uint64 = 0 - if blockNum >= 2*epochLength { - seedBlockNum = ((blockNum / epochLength) - 1) * epochLength + if blockNum > epochLength { + seedBlockNum = ((blockNum - 1) / epochLength) * epochLength } return seedBlockNum } +*/ func makeParamsAndCache(chainManager pow.ChainManager, blockNum uint64) *ParamsAndCache { - seedBlockNum := getSeedBlockNum(blockNum) + seedBlockNum := GetSeedBlockNum(blockNum) paramsAndCache := &ParamsAndCache{ params: new(C.ethash_params), cache: new(C.ethash_cache), @@ -76,19 +95,19 @@ func makeParamsAndCache(chainManager pow.ChainManager, blockNum uint64) *ParamsA } C.ethash_params_init(paramsAndCache.params, C.uint32_t(seedBlockNum)) paramsAndCache.cache.mem = C.malloc(paramsAndCache.params.cache_size) - seedHash := chainManager.GetBlockByNumber(seedBlockNum).Header().Hash() - log.Println("Params", paramsAndCache.params) + seedHash := chainManager.GetBlockByNumber(seedBlockNum).SeedHash() log.Println("Making Cache") start := time.Now() - C.ethash_mkcache(paramsAndCache.cache, paramsAndCache.params, (*C.uint8_t)((unsafe.Pointer)(&seedHash[0]))) + C.ethash_mkcache(paramsAndCache.cache, paramsAndCache.params, (*C.uint8_t)(unsafe.Pointer(&seedHash[0]))) log.Println("Took:", time.Since(start)) + return paramsAndCache } func (pow *Ethash) updateCache() { pow.cacheMutex.Lock() - seedNum := getSeedBlockNum(pow.chainManager.CurrentBlock().NumberU64()) + seedNum := GetSeedBlockNum(pow.chainManager.CurrentBlock().NumberU64()) if pow.paramsAndCache.SeedBlockNum != seedNum { pow.paramsAndCache = makeParamsAndCache(pow.chainManager, pow.chainManager.CurrentBlock().NumberU64()) } @@ -104,17 +123,66 @@ func makeDAG(p *ParamsAndCache) *DAG { return d } -func (pow *Ethash) updateDAG() { +func (pow *Ethash) writeDagToDisk(dag *DAG, seedNum uint64) *os.File { + data := C.GoBytes(unsafe.Pointer(dag.dag), C.int(pow.paramsAndCache.params.full_size)) + file, err := os.Create("/tmp/dag") + if err != nil { + panic(err) + } + + num := make([]byte, 8) + binary.BigEndian.PutUint64(num, seedNum) + + file.Write(num) + file.Write(data) + + return file +} + +func (pow *Ethash) UpdateDAG() { pow.cacheMutex.Lock() pow.dagMutex.Lock() - seedNum := getSeedBlockNum(pow.chainManager.CurrentBlock().NumberU64()) + seedNum := GetSeedBlockNum(pow.chainManager.CurrentBlock().NumberU64()) if pow.dag == nil || pow.dag.SeedBlockNum != seedNum { + if pow.dag != nil && pow.dag.dag != nil { + C.free(pow.dag.dag) + pow.dag.dag = nil + } + + path := path.Join("/", "tmp", "dag") pow.dag = nil - log.Println("Making Dag") + log.Println("Generating dag") start := time.Now() - pow.dag = makeDAG(pow.paramsAndCache) + + file, err := os.Open(path) + if err != nil { + log.Printf("No dag found in '%s'. Generating new dago(takes a while)...", path) + pow.dag = makeDAG(pow.paramsAndCache) + file = pow.writeDagToDisk(pow.dag, seedNum) + } else { + data, err := ioutil.ReadAll(file) + if err != nil { + panic(err) + } + + num := binary.BigEndian.Uint64(data[0:8]) + if num < seedNum { + log.Printf("Old found. Generating new dag (takes a while)...") + pow.dag = makeDAG(pow.paramsAndCache) + file = pow.writeDagToDisk(pow.dag, seedNum) + } else { + data = data[8:] + pow.dag = &DAG{ + dag: unsafe.Pointer(&data[0]), + file: true, + SeedBlockNum: pow.paramsAndCache.SeedBlockNum, + } + } + } log.Println("Took:", time.Since(start)) + + file.Close() } pow.dagMutex.Unlock() @@ -123,11 +191,10 @@ func (pow *Ethash) updateDAG() { func New(chainManager pow.ChainManager) *Ethash { return &Ethash{ - turbo: false, + turbo: true, paramsAndCache: makeParamsAndCache(chainManager, chainManager.CurrentBlock().NumberU64()), chainManager: chainManager, dag: nil, - ret: new(C.ethash_return_value), cacheMutex: new(sync.Mutex), dagMutex: new(sync.Mutex), } @@ -142,73 +209,70 @@ func (pow *Ethash) CacheSize() uint64 { } func (pow *Ethash) GetSeedHash(blockNum uint64) []byte { - return pow.chainManager.GetBlockByNumber(getSeedBlockNum(blockNum)).Header().Hash() + seednum := GetSeedBlockNum(blockNum) + return pow.chainManager.GetBlockByNumber(seednum).SeedHash() } func (pow *Ethash) Stop() { pow.cacheMutex.Lock() pow.dagMutex.Lock() + defer pow.dagMutex.Unlock() + defer pow.cacheMutex.Unlock() + if pow.paramsAndCache.cache != nil { C.free(pow.paramsAndCache.cache.mem) } - if pow.dag != nil { + if pow.dag.dag != nil && !pow.dag.file { C.free(pow.dag.dag) } - pow.dagMutex.Unlock() - pow.cacheMutex.Unlock() + pow.dag.dag = nil } -func (pow *Ethash) Search(block pow.Block, stop <-chan struct{}) ([]byte, []byte, []byte) { - pow.updateDAG() +func (pow *Ethash) Search(block pow.Block, stop <-chan struct{}) (uint64, []byte, []byte) { + //pow.UpdateDAG() // Not very elegant, multiple mining instances are not supported - pow.dagMutex.Lock() - pow.cacheMutex.Lock() - defer pow.cacheMutex.Unlock() - defer pow.dagMutex.Unlock() + //pow.dagMutex.Lock() + //pow.cacheMutex.Lock() + //defer pow.cacheMutex.Unlock() + //defer pow.dagMutex.Unlock() r := rand.New(rand.NewSource(time.Now().UnixNano())) miningHash := block.HashNoNonce() diff := block.Difficulty() - log.Println("difficulty", diff) + i := int64(0) + starti := i start := time.Now().UnixNano() - t := time.Now() nonce := uint64(r.Int63()) + cMiningHash := (*C.uint8_t)(unsafe.Pointer(&miningHash[0])) + target := new(big.Int).Div(tt256, diff) + var ret C.ethash_return_value for { select { case <-stop: powlogger.Infoln("Breaking from mining") pow.HashRate = 0 - pow.dagMutex.Unlock() - return nil, nil, nil + return 0, nil, nil default: i++ - if time.Since(t) > (1 * time.Second) { - elapsed := time.Now().UnixNano() - start - hashes := ((float64(1e9) / float64(elapsed)) * float64(i)) / 1000 - pow.HashRate = int64(hashes) - powlogger.Infoln("Hashing @", pow.HashRate, "khash") + elapsed := time.Now().UnixNano() - start + hashes := ((float64(1e9) / float64(elapsed)) * float64(i-starti)) / 1000 + pow.HashRate = int64(hashes) - t = time.Now() - } + C.ethash_full(&ret, pow.dag.dag, pow.paramsAndCache.params, cMiningHash, C.uint64_t(nonce)) + result := ethutil.Bytes2Big(C.GoBytes(unsafe.Pointer(&ret.result[0]), C.int(32))) + + if result.Cmp(target) <= 0 { + mixDigest := C.GoBytes(unsafe.Pointer(&ret.mix_hash[0]), C.int(32)) + + return nonce, mixDigest, pow.GetSeedHash(block.NumberU64()) - cMiningHash := (*C.uint8_t)(unsafe.Pointer(&miningHash)) - cnonce := C.uint64_t(nonce) - log.Printf("seed hash, nonce: %x %x\n", miningHash, nonce) - // pow.hash is the output/return of ethash_full - C.ethash_full(pow.ret, pow.dag.dag, pow.paramsAndCache.params, cMiningHash, cnonce) - res := C.ethash_check_difficulty((*C.uint8_t)(&pow.ret.result[0]), (*C.uint8_t)(unsafe.Pointer(&diff.Bytes()[0]))) - if res == 1 { - mixDigest := C.GoBytes(unsafe.Pointer(&pow.ret.mix_hash[0]), 32) - // We don't really nead 32 bytes here - buf := make([]byte, 32) - binary.PutUvarint(buf, nonce) - return buf, mixDigest, pow.GetSeedHash(block.NumberU64()) } + nonce += 1 } @@ -216,43 +280,32 @@ func (pow *Ethash) Search(block pow.Block, stop <-chan struct{}) ([]byte, []byte time.Sleep(20 * time.Microsecond) } } + } func (pow *Ethash) Verify(block pow.Block) bool { // Make sure the SeedHash is set correctly if bytes.Compare(block.SeedHash(), pow.GetSeedHash(block.NumberU64())) != 0 { - log.Println("Block had wrong SeedHash") - log.Println("Expected: ", pow.GetSeedHash(block.NumberU64())) - log.Println("Actual: ", block.SeedHash()) return false } - nonceInt, err := parseNonce(block.Nonce()) - if err != nil { - log.Println("nonce to int err:", err) - return false - } - return pow.verify(block.HashNoNonce(), block.MixDigest(), block.Difficulty(), block.NumberU64(), nonceInt) + return pow.verify(block.HashNoNonce(), block.MixDigest(), block.Difficulty(), block.NumberU64(), block.Nonce()) } func (pow *Ethash) verify(hash []byte, mixDigest []byte, difficulty *big.Int, blockNum uint64, nonce uint64) bool { + fmt.Printf("%x\n%d\n%x\n%x\n", hash, nonce, mixDigest, difficulty.Bytes()) // First check: make sure header, mixDigest, nonce are correct without hitting the DAG // This is to prevent DOS attacks - chash := (*C.uint8_t)(unsafe.Pointer(&hash)) + chash := (*C.uint8_t)(unsafe.Pointer(&hash[0])) cnonce := C.uint64_t(nonce) - cmixDigest := (*C.uint8_t)(unsafe.Pointer(&mixDigest)) - cdifficulty := (*C.uint8_t)(unsafe.Pointer(&difficulty.Bytes()[0])) - if C.ethash_quick_check_difficulty(chash, cnonce, cmixDigest, cdifficulty) != 1 { - log.Println("Failed to pass quick check. Are you sure that the mix digest is correct?") - return false - } + target := new(big.Int).Div(tt256, difficulty) var pAc *ParamsAndCache // If its an old block (doesn't use the current cache) // get the cache for it but don't update (so we don't need the mutex) // Otherwise, it's the current block or a future. // If current, updateCache will do nothing. - if getSeedBlockNum(blockNum) < pow.paramsAndCache.SeedBlockNum { + if GetSeedBlockNum(blockNum) < pow.paramsAndCache.SeedBlockNum { pAc = makeParamsAndCache(pow.chainManager, blockNum) } else { pow.updateCache() @@ -261,9 +314,12 @@ func (pow *Ethash) verify(hash []byte, mixDigest []byte, difficulty *big.Int, bl pAc = pow.paramsAndCache } - C.ethash_light(pow.ret, pAc.cache, pAc.params, chash, cnonce) - res := C.ethash_check_difficulty((*C.uint8_t)(unsafe.Pointer(&pow.ret.result[0])), cdifficulty) - return res == 1 + ret := new(C.ethash_return_value) + + C.ethash_light(ret, pAc.cache, pAc.params, chash, cnonce) + + result := ethutil.Bytes2Big(C.GoBytes(unsafe.Pointer(&ret.result[0]), C.int(32))) + return result.Cmp(target) <= 0 } func (pow *Ethash) GetHashrate() int64 { @@ -275,22 +331,23 @@ func (pow *Ethash) Turbo(on bool) { } func (pow *Ethash) FullHash(nonce uint64, miningHash []byte) []byte { - pow.updateDAG() + pow.UpdateDAG() pow.dagMutex.Lock() defer pow.dagMutex.Unlock() - cMiningHash := (*C.uint8_t)(unsafe.Pointer(&miningHash)) + cMiningHash := (*C.uint8_t)(unsafe.Pointer(&miningHash[0])) cnonce := C.uint64_t(nonce) - log.Println("seed hash, nonce:", miningHash, nonce) + ret := new(C.ethash_return_value) // pow.hash is the output/return of ethash_full - C.ethash_full(pow.ret, pow.dag.dag, pow.paramsAndCache.params, cMiningHash, cnonce) - ghash_full := C.GoBytes(unsafe.Pointer(&pow.ret.result[0]), 32) + C.ethash_full(ret, pow.dag.dag, pow.paramsAndCache.params, cMiningHash, cnonce) + ghash_full := C.GoBytes(unsafe.Pointer(&ret.result), 32) return ghash_full } func (pow *Ethash) LightHash(nonce uint64, miningHash []byte) []byte { - cMiningHash := (*C.uint8_t)(unsafe.Pointer(&miningHash)) + cMiningHash := (*C.uint8_t)(unsafe.Pointer(&miningHash[0])) cnonce := C.uint64_t(nonce) - C.ethash_light(pow.ret, pow.paramsAndCache.cache, pow.paramsAndCache.params, cMiningHash, cnonce) - ghash_light := C.GoBytes(unsafe.Pointer(&pow.ret.result[0]), 32) + ret := new(C.ethash_return_value) + C.ethash_light(ret, pow.paramsAndCache.cache, pow.paramsAndCache.params, cMiningHash, cnonce) + ghash_light := C.GoBytes(unsafe.Pointer(&ret.result), 32) return ghash_light } diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/js/LICENSE b/Godeps/_workspace/src/github.com/ethereum/ethash/js/LICENSE new file mode 100644 index 000000000..070be633d --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/js/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Tim Hughes + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/js/ethash.js b/Godeps/_workspace/src/github.com/ethereum/ethash/js/ethash.js new file mode 100644 index 000000000..bec1284f6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/js/ethash.js @@ -0,0 +1,190 @@ +// ethash.js +// Tim Hughes <tim@twistedfury.com> +// Revision 19 + +/*jslint node: true, shadow:true */ +"use strict"; + +var Keccak = require('./keccak'); +var util = require('./util'); + +// 32-bit unsigned modulo +function mod32(x, n) +{ + return (x>>>0) % (n>>>0); +} + +function fnv(x, y) +{ + // js integer multiply by 0x01000193 will lose precision + return ((x*0x01000000 | 0) + (x*0x193 | 0)) ^ y; +} + +function computeCache(params, seedWords) +{ + var cache = new Uint32Array(params.cacheSize >> 2); + var cacheNodeCount = params.cacheSize >> 6; + + // Initialize cache + var keccak = new Keccak(); + keccak.digestWords(cache, 0, 16, seedWords, 0, seedWords.length); + for (var n = 1; n < cacheNodeCount; ++n) + { + keccak.digestWords(cache, n<<4, 16, cache, (n-1)<<4, 16); + } + + var tmp = new Uint32Array(16); + + // Do randmemohash passes + for (var r = 0; r < params.cacheRounds; ++r) + { + for (var n = 0; n < cacheNodeCount; ++n) + { + var p0 = mod32(n + cacheNodeCount - 1, cacheNodeCount) << 4; + var p1 = mod32(cache[n<<4|0], cacheNodeCount) << 4; + + for (var w = 0; w < 16; w=(w+1)|0) + { + tmp[w] = cache[p0 | w] ^ cache[p1 | w]; + } + + keccak.digestWords(cache, n<<4, 16, tmp, 0, tmp.length); + } + } + return cache; +} + +function computeDagNode(o_node, params, cache, keccak, nodeIndex) +{ + var cacheNodeCount = params.cacheSize >> 6; + var dagParents = params.dagParents; + + var c = (nodeIndex % cacheNodeCount) << 4; + var mix = o_node; + for (var w = 0; w < 16; ++w) + { + mix[w] = cache[c|w]; + } + mix[0] ^= nodeIndex; + keccak.digestWords(mix, 0, 16, mix, 0, 16); + + for (var p = 0; p < dagParents; ++p) + { + // compute cache node (word) index + c = mod32(fnv(nodeIndex ^ p, mix[p&15]), cacheNodeCount) << 4; + + for (var w = 0; w < 16; ++w) + { + mix[w] = fnv(mix[w], cache[c|w]); + } + } + + keccak.digestWords(mix, 0, 16, mix, 0, 16); +} + +function computeHashInner(mix, params, cache, keccak, tempNode) +{ + var mixParents = params.mixParents|0; + var mixWordCount = params.mixSize >> 2; + var mixNodeCount = mixWordCount >> 4; + var dagPageCount = (params.dagSize / params.mixSize) >> 0; + + // grab initial first word + var s0 = mix[0]; + + // initialise mix from initial 64 bytes + for (var w = 16; w < mixWordCount; ++w) + { + mix[w] = mix[w & 15]; + } + + for (var a = 0; a < mixParents; ++a) + { + var p = mod32(fnv(s0 ^ a, mix[a & (mixWordCount-1)]), dagPageCount); + var d = (p * mixNodeCount)|0; + + for (var n = 0, w = 0; n < mixNodeCount; ++n, w += 16) + { + computeDagNode(tempNode, params, cache, keccak, (d + n)|0); + + for (var v = 0; v < 16; ++v) + { + mix[w|v] = fnv(mix[w|v], tempNode[v]); + } + } + } +} + +function convertSeed(seed) +{ + // todo, reconcile with spec, byte ordering? + // todo, big-endian conversion + var newSeed = util.toWords(seed); + if (newSeed === null) + throw Error("Invalid seed '" + seed + "'"); + return newSeed; +} + +exports.defaultParams = function() +{ + return { + cacheSize: 1048384, + cacheRounds: 3, + dagSize: 1073739904, + dagParents: 256, + mixSize: 128, + mixParents: 64, + }; +}; + +exports.Ethash = function(params, seed) +{ + // precompute cache and related values + seed = convertSeed(seed); + var cache = computeCache(params, seed); + + // preallocate buffers/etc + var initBuf = new ArrayBuffer(96); + var initBytes = new Uint8Array(initBuf); + var initWords = new Uint32Array(initBuf); + var mixWords = new Uint32Array(params.mixSize / 4); + var tempNode = new Uint32Array(16); + var keccak = new Keccak(); + + var retWords = new Uint32Array(8); + var retBytes = new Uint8Array(retWords.buffer); // supposedly read-only + + this.hash = function(header, nonce) + { + // compute initial hash + initBytes.set(header, 0); + initBytes.set(nonce, 32); + keccak.digestWords(initWords, 0, 16, initWords, 0, 8 + nonce.length/4); + + // compute mix + for (var i = 0; i != 16; ++i) + { + mixWords[i] = initWords[i]; + } + computeHashInner(mixWords, params, cache, keccak, tempNode); + + // compress mix and append to initWords + for (var i = 0; i != mixWords.length; i += 4) + { + initWords[16 + i/4] = fnv(fnv(fnv(mixWords[i], mixWords[i+1]), mixWords[i+2]), mixWords[i+3]); + } + + // final Keccak hashes + keccak.digestWords(retWords, 0, 8, initWords, 0, 24); // Keccak-256(s + cmix) + return retBytes; + }; + + this.cacheDigest = function() + { + return keccak.digest(32, new Uint8Array(cache.buffer)); + }; +}; + + + + diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/js/keccak.js b/Godeps/_workspace/src/github.com/ethereum/ethash/js/keccak.js new file mode 100644 index 000000000..84ddde645 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/js/keccak.js @@ -0,0 +1,404 @@ +// keccak.js +// Tim Hughes <tim@twistedfury.com> +// derived from Markku-Juhani O. Saarinen's C code (http://keccak.noekeon.org/readable_code.html) + +/*jslint node: true, shadow:true */ +"use strict"; + +var Keccak_f1600_RC = new Uint32Array([ + 0x00000001, 0x00000000, + 0x00008082, 0x00000000, + 0x0000808a, 0x80000000, + 0x80008000, 0x80000000, + 0x0000808b, 0x00000000, + 0x80000001, 0x00000000, + 0x80008081, 0x80000000, + 0x00008009, 0x80000000, + 0x0000008a, 0x00000000, + 0x00000088, 0x00000000, + 0x80008009, 0x00000000, + 0x8000000a, 0x00000000, + 0x8000808b, 0x00000000, + 0x0000008b, 0x80000000, + 0x00008089, 0x80000000, + 0x00008003, 0x80000000, + 0x00008002, 0x80000000, + 0x00000080, 0x80000000, + 0x0000800a, 0x00000000, + 0x8000000a, 0x80000000, + 0x80008081, 0x80000000, + 0x00008080, 0x80000000, + 0x80000001, 0x00000000, + 0x80008008, 0x80000000 +]); + +function keccak_f1600(outState, outOffset, outSize, inState) +{ + // todo, handle big endian loads + var a00l = inState[0]|0; + var a00h = inState[1]|0; + var a01l = inState[2]|0; + var a01h = inState[3]|0; + var a02l = inState[4]|0; + var a02h = inState[5]|0; + var a03l = inState[6]|0; + var a03h = inState[7]|0; + var a04l = inState[8]|0; + var a04h = inState[9]|0; + var a05l = inState[10]|0; + var a05h = inState[11]|0; + var a06l = inState[12]|0; + var a06h = inState[13]|0; + var a07l = inState[14]|0; + var a07h = inState[15]|0; + var a08l = inState[16]|0; + var a08h = inState[17]|0; + var a09l = inState[18]|0; + var a09h = inState[19]|0; + var a10l = inState[20]|0; + var a10h = inState[21]|0; + var a11l = inState[22]|0; + var a11h = inState[23]|0; + var a12l = inState[24]|0; + var a12h = inState[25]|0; + var a13l = inState[26]|0; + var a13h = inState[27]|0; + var a14l = inState[28]|0; + var a14h = inState[29]|0; + var a15l = inState[30]|0; + var a15h = inState[31]|0; + var a16l = inState[32]|0; + var a16h = inState[33]|0; + var a17l = inState[34]|0; + var a17h = inState[35]|0; + var a18l = inState[36]|0; + var a18h = inState[37]|0; + var a19l = inState[38]|0; + var a19h = inState[39]|0; + var a20l = inState[40]|0; + var a20h = inState[41]|0; + var a21l = inState[42]|0; + var a21h = inState[43]|0; + var a22l = inState[44]|0; + var a22h = inState[45]|0; + var a23l = inState[46]|0; + var a23h = inState[47]|0; + var a24l = inState[48]|0; + var a24h = inState[49]|0; + var b00l, b00h, b01l, b01h, b02l, b02h, b03l, b03h, b04l, b04h; + var b05l, b05h, b06l, b06h, b07l, b07h, b08l, b08h, b09l, b09h; + var b10l, b10h, b11l, b11h, b12l, b12h, b13l, b13h, b14l, b14h; + var b15l, b15h, b16l, b16h, b17l, b17h, b18l, b18h, b19l, b19h; + var b20l, b20h, b21l, b21h, b22l, b22h, b23l, b23h, b24l, b24h; + var tl, nl; + var th, nh; + + for (var r = 0; r < 48; r = (r+2)|0) + { + // Theta + b00l = a00l ^ a05l ^ a10l ^ a15l ^ a20l; + b00h = a00h ^ a05h ^ a10h ^ a15h ^ a20h; + b01l = a01l ^ a06l ^ a11l ^ a16l ^ a21l; + b01h = a01h ^ a06h ^ a11h ^ a16h ^ a21h; + b02l = a02l ^ a07l ^ a12l ^ a17l ^ a22l; + b02h = a02h ^ a07h ^ a12h ^ a17h ^ a22h; + b03l = a03l ^ a08l ^ a13l ^ a18l ^ a23l; + b03h = a03h ^ a08h ^ a13h ^ a18h ^ a23h; + b04l = a04l ^ a09l ^ a14l ^ a19l ^ a24l; + b04h = a04h ^ a09h ^ a14h ^ a19h ^ a24h; + tl = b04l ^ (b01l << 1 | b01h >>> 31); + th = b04h ^ (b01h << 1 | b01l >>> 31); + a00l ^= tl; + a00h ^= th; + a05l ^= tl; + a05h ^= th; + a10l ^= tl; + a10h ^= th; + a15l ^= tl; + a15h ^= th; + a20l ^= tl; + a20h ^= th; + tl = b00l ^ (b02l << 1 | b02h >>> 31); + th = b00h ^ (b02h << 1 | b02l >>> 31); + a01l ^= tl; + a01h ^= th; + a06l ^= tl; + a06h ^= th; + a11l ^= tl; + a11h ^= th; + a16l ^= tl; + a16h ^= th; + a21l ^= tl; + a21h ^= th; + tl = b01l ^ (b03l << 1 | b03h >>> 31); + th = b01h ^ (b03h << 1 | b03l >>> 31); + a02l ^= tl; + a02h ^= th; + a07l ^= tl; + a07h ^= th; + a12l ^= tl; + a12h ^= th; + a17l ^= tl; + a17h ^= th; + a22l ^= tl; + a22h ^= th; + tl = b02l ^ (b04l << 1 | b04h >>> 31); + th = b02h ^ (b04h << 1 | b04l >>> 31); + a03l ^= tl; + a03h ^= th; + a08l ^= tl; + a08h ^= th; + a13l ^= tl; + a13h ^= th; + a18l ^= tl; + a18h ^= th; + a23l ^= tl; + a23h ^= th; + tl = b03l ^ (b00l << 1 | b00h >>> 31); + th = b03h ^ (b00h << 1 | b00l >>> 31); + a04l ^= tl; + a04h ^= th; + a09l ^= tl; + a09h ^= th; + a14l ^= tl; + a14h ^= th; + a19l ^= tl; + a19h ^= th; + a24l ^= tl; + a24h ^= th; + + // Rho Pi + b00l = a00l; + b00h = a00h; + b10l = a01l << 1 | a01h >>> 31; + b10h = a01h << 1 | a01l >>> 31; + b07l = a10l << 3 | a10h >>> 29; + b07h = a10h << 3 | a10l >>> 29; + b11l = a07l << 6 | a07h >>> 26; + b11h = a07h << 6 | a07l >>> 26; + b17l = a11l << 10 | a11h >>> 22; + b17h = a11h << 10 | a11l >>> 22; + b18l = a17l << 15 | a17h >>> 17; + b18h = a17h << 15 | a17l >>> 17; + b03l = a18l << 21 | a18h >>> 11; + b03h = a18h << 21 | a18l >>> 11; + b05l = a03l << 28 | a03h >>> 4; + b05h = a03h << 28 | a03l >>> 4; + b16l = a05h << 4 | a05l >>> 28; + b16h = a05l << 4 | a05h >>> 28; + b08l = a16h << 13 | a16l >>> 19; + b08h = a16l << 13 | a16h >>> 19; + b21l = a08h << 23 | a08l >>> 9; + b21h = a08l << 23 | a08h >>> 9; + b24l = a21l << 2 | a21h >>> 30; + b24h = a21h << 2 | a21l >>> 30; + b04l = a24l << 14 | a24h >>> 18; + b04h = a24h << 14 | a24l >>> 18; + b15l = a04l << 27 | a04h >>> 5; + b15h = a04h << 27 | a04l >>> 5; + b23l = a15h << 9 | a15l >>> 23; + b23h = a15l << 9 | a15h >>> 23; + b19l = a23h << 24 | a23l >>> 8; + b19h = a23l << 24 | a23h >>> 8; + b13l = a19l << 8 | a19h >>> 24; + b13h = a19h << 8 | a19l >>> 24; + b12l = a13l << 25 | a13h >>> 7; + b12h = a13h << 25 | a13l >>> 7; + b02l = a12h << 11 | a12l >>> 21; + b02h = a12l << 11 | a12h >>> 21; + b20l = a02h << 30 | a02l >>> 2; + b20h = a02l << 30 | a02h >>> 2; + b14l = a20l << 18 | a20h >>> 14; + b14h = a20h << 18 | a20l >>> 14; + b22l = a14h << 7 | a14l >>> 25; + b22h = a14l << 7 | a14h >>> 25; + b09l = a22h << 29 | a22l >>> 3; + b09h = a22l << 29 | a22h >>> 3; + b06l = a09l << 20 | a09h >>> 12; + b06h = a09h << 20 | a09l >>> 12; + b01l = a06h << 12 | a06l >>> 20; + b01h = a06l << 12 | a06h >>> 20; + + // Chi + a00l = b00l ^ ~b01l & b02l; + a00h = b00h ^ ~b01h & b02h; + a01l = b01l ^ ~b02l & b03l; + a01h = b01h ^ ~b02h & b03h; + a02l = b02l ^ ~b03l & b04l; + a02h = b02h ^ ~b03h & b04h; + a03l = b03l ^ ~b04l & b00l; + a03h = b03h ^ ~b04h & b00h; + a04l = b04l ^ ~b00l & b01l; + a04h = b04h ^ ~b00h & b01h; + a05l = b05l ^ ~b06l & b07l; + a05h = b05h ^ ~b06h & b07h; + a06l = b06l ^ ~b07l & b08l; + a06h = b06h ^ ~b07h & b08h; + a07l = b07l ^ ~b08l & b09l; + a07h = b07h ^ ~b08h & b09h; + a08l = b08l ^ ~b09l & b05l; + a08h = b08h ^ ~b09h & b05h; + a09l = b09l ^ ~b05l & b06l; + a09h = b09h ^ ~b05h & b06h; + a10l = b10l ^ ~b11l & b12l; + a10h = b10h ^ ~b11h & b12h; + a11l = b11l ^ ~b12l & b13l; + a11h = b11h ^ ~b12h & b13h; + a12l = b12l ^ ~b13l & b14l; + a12h = b12h ^ ~b13h & b14h; + a13l = b13l ^ ~b14l & b10l; + a13h = b13h ^ ~b14h & b10h; + a14l = b14l ^ ~b10l & b11l; + a14h = b14h ^ ~b10h & b11h; + a15l = b15l ^ ~b16l & b17l; + a15h = b15h ^ ~b16h & b17h; + a16l = b16l ^ ~b17l & b18l; + a16h = b16h ^ ~b17h & b18h; + a17l = b17l ^ ~b18l & b19l; + a17h = b17h ^ ~b18h & b19h; + a18l = b18l ^ ~b19l & b15l; + a18h = b18h ^ ~b19h & b15h; + a19l = b19l ^ ~b15l & b16l; + a19h = b19h ^ ~b15h & b16h; + a20l = b20l ^ ~b21l & b22l; + a20h = b20h ^ ~b21h & b22h; + a21l = b21l ^ ~b22l & b23l; + a21h = b21h ^ ~b22h & b23h; + a22l = b22l ^ ~b23l & b24l; + a22h = b22h ^ ~b23h & b24h; + a23l = b23l ^ ~b24l & b20l; + a23h = b23h ^ ~b24h & b20h; + a24l = b24l ^ ~b20l & b21l; + a24h = b24h ^ ~b20h & b21h; + + // Iota + a00l ^= Keccak_f1600_RC[r|0]; + a00h ^= Keccak_f1600_RC[r|1]; + } + + // todo, handle big-endian stores + outState[outOffset|0] = a00l; + outState[outOffset|1] = a00h; + outState[outOffset|2] = a01l; + outState[outOffset|3] = a01h; + outState[outOffset|4] = a02l; + outState[outOffset|5] = a02h; + outState[outOffset|6] = a03l; + outState[outOffset|7] = a03h; + if (outSize == 8) + return; + outState[outOffset|8] = a04l; + outState[outOffset|9] = a04h; + outState[outOffset|10] = a05l; + outState[outOffset|11] = a05h; + outState[outOffset|12] = a06l; + outState[outOffset|13] = a06h; + outState[outOffset|14] = a07l; + outState[outOffset|15] = a07h; + if (outSize == 16) + return; + outState[outOffset|16] = a08l; + outState[outOffset|17] = a08h; + outState[outOffset|18] = a09l; + outState[outOffset|19] = a09h; + outState[outOffset|20] = a10l; + outState[outOffset|21] = a10h; + outState[outOffset|22] = a11l; + outState[outOffset|23] = a11h; + outState[outOffset|24] = a12l; + outState[outOffset|25] = a12h; + outState[outOffset|26] = a13l; + outState[outOffset|27] = a13h; + outState[outOffset|28] = a14l; + outState[outOffset|29] = a14h; + outState[outOffset|30] = a15l; + outState[outOffset|31] = a15h; + outState[outOffset|32] = a16l; + outState[outOffset|33] = a16h; + outState[outOffset|34] = a17l; + outState[outOffset|35] = a17h; + outState[outOffset|36] = a18l; + outState[outOffset|37] = a18h; + outState[outOffset|38] = a19l; + outState[outOffset|39] = a19h; + outState[outOffset|40] = a20l; + outState[outOffset|41] = a20h; + outState[outOffset|42] = a21l; + outState[outOffset|43] = a21h; + outState[outOffset|44] = a22l; + outState[outOffset|45] = a22h; + outState[outOffset|46] = a23l; + outState[outOffset|47] = a23h; + outState[outOffset|48] = a24l; + outState[outOffset|49] = a24h; +} + +var Keccak = function() +{ + var stateBuf = new ArrayBuffer(200); + var stateBytes = new Uint8Array(stateBuf); + var stateWords = new Uint32Array(stateBuf); + + this.digest = function(oSize, iBytes) + { + for (var i = 0; i < 50; ++i) + { + stateWords[i] = 0; + } + + var r = 200 - oSize*2; + var iLength = iBytes.length; + var iOffset = 0; + for ( ; ;) + { + var len = iLength < r ? iLength : r; + for (i = 0; i < len; ++i, ++iOffset) + { + stateBytes[i] ^= iBytes[iOffset]; + } + + if (iLength < r) + break; + iLength -= len; + + keccak_f1600(stateWords, 0, 50, stateWords); + } + + stateBytes[iLength] ^= 1; + stateBytes[r-1] ^= 0x80; + keccak_f1600(stateWords, 0, 50, stateWords); + return stateBytes.subarray(0, oSize); + }; + + this.digestWords = function(oWords, oOffset, oLength, iWords, iOffset, iLength) + { + for (var i = 0; i < 50; ++i) + { + stateWords[i] = 0; + } + + var r = 50 - oLength*2; + for (; ; ) + { + var len = iLength < r ? iLength : r; + for (i = 0; i < len; ++i, ++iOffset) + { + stateWords[i] ^= iWords[iOffset]; + } + + if (iLength < r) + break; + iLength -= len; + + keccak_f1600(stateWords, 0, 50, stateWords); + } + + stateBytes[iLength<<2] ^= 1; + stateBytes[(r<<2) - 1] ^= 0x80; + keccak_f1600(oWords, oOffset, oLength, stateWords); + }; +}; + +module.exports = Keccak; + + diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/js/makekeccak.js b/Godeps/_workspace/src/github.com/ethereum/ethash/js/makekeccak.js new file mode 100644 index 000000000..c4db2b80a --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/js/makekeccak.js @@ -0,0 +1,201 @@ +#!/usr/bin/env node +// makekeccak.js +// Tim Hughes <tim@twistedfury.com> + +/*jslint node: true, shadow:true */ +"use strict"; + +var Keccak_f1600_Rho = [ + 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, + 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44 +]; + +var Keccak_f1600_Pi= [ + 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, + 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1 +]; + +var Keccak_f1600_RC = [ + 0x00000001, 0x00000000, + 0x00008082, 0x00000000, + 0x0000808a, 0x80000000, + 0x80008000, 0x80000000, + 0x0000808b, 0x00000000, + 0x80000001, 0x00000000, + 0x80008081, 0x80000000, + 0x00008009, 0x80000000, + 0x0000008a, 0x00000000, + 0x00000088, 0x00000000, + 0x80008009, 0x00000000, + 0x8000000a, 0x00000000, + 0x8000808b, 0x00000000, + 0x0000008b, 0x80000000, + 0x00008089, 0x80000000, + 0x00008003, 0x80000000, + 0x00008002, 0x80000000, + 0x00000080, 0x80000000, + 0x0000800a, 0x00000000, + 0x8000000a, 0x80000000, + 0x80008081, 0x80000000, + 0x00008080, 0x80000000, + 0x80000001, 0x00000000, + 0x80008008, 0x80000000, +]; + +function makeRotLow(lo, hi, n) +{ + if (n === 0 || n === 32) throw Error("unsupported"); + if ((n & 0x20) !== 0) + { + n &= ~0x20; + var t = hi; + hi = lo; + lo = t; + } + var hir = hi + " >>> " + (32 - n); + var los = lo + " << " + n; + return los + " | " + hir; +} + +function makeRotHigh(lo, hi, n) +{ + if (n === 0 || n === 32) throw Error("unsupported"); + if ((n & 0x20) !== 0) + { + n &= ~0x20; + var t = hi; + hi = lo; + lo = t; + } + var his = hi + " << " + n; + var lor = lo + " >>> " + (32 - n); + return his + " | " + lor; +} + +function makeKeccak_f1600() +{ + var format = function(n) + { + return n < 10 ? "0"+n : ""+n; + }; + + var a = function(n, w) + { + return "a" + format(n) + (w !== 0?'h':'l'); + }; + + var b = function(n, w) + { + return "b" + format(n) + (w !== 0?'h':'l'); + }; + + var str = ""; + str += "function keccak_f1600(outState, outOffset, outSize, inState)\n"; + str += "{\n"; + + for (var i = 0; i < 25; ++i) + { + for (var w = 0; w <= 1; ++w) + { + str += "\tvar " + a(i,w) + " = inState["+(i<<1|w)+"]|0;\n"; + } + } + + for (var j = 0; j < 5; ++j) + { + str += "\tvar "; + for (var i = 0; i < 5; ++i) + { + if (i !== 0) + str += ", "; + str += b(j*5+i,0) + ", " + b(j*5+i,1); + } + str += ";\n"; + } + + str += "\tvar tl, th;\n"; + str += "\n"; + str += "\tfor (var r = 0; r < 48; r = (r+2)|0)\n"; + str += "\t{\n"; + + + // Theta + str += "\t\t// Theta\n"; + for (var i = 0; i < 5; ++i) + { + for (var w = 0; w <= 1; ++w) + { + str += "\t\t" + b(i,w) + " = " + a(i,w) + " ^ " + a(i+5,w) + " ^ " + a(i+10,w) + " ^ " + a(i+15,w) + " ^ " + a(i+20,w) + ";\n"; + } + } + + for (var i = 0; i < 5; ++i) + { + var i4 = (i + 4) % 5; + var i1 = (i + 1) % 5; + str += "\t\ttl = " + b(i4,0) + " ^ (" + b(i1,0) + " << 1 | " + b(i1,1) + " >>> 31);\n"; + str += "\t\tth = " + b(i4,1) + " ^ (" + b(i1,1) + " << 1 | " + b(i1,0) + " >>> 31);\n"; + + for (var j = 0; j < 25; j = (j+5)|0) + { + str += "\t\t" + a((j+i),0) + " ^= tl;\n"; + str += "\t\t" + a((j+i),1) + " ^= th;\n"; + } + } + + + // Rho Pi + str += "\n\t\t// Rho Pi\n"; + for (var w = 0; w <= 1; ++w) + { + str += "\t\t" + b(0,w) + " = " + a(0,w) + ";\n"; + } + var opi = 1; + for (var i = 0; i < 24; ++i) + { + var pi = Keccak_f1600_Pi[i]; + str += "\t\t" + b(pi,0) + " = " + makeRotLow(a(opi,0), a(opi,1), Keccak_f1600_Rho[i]) + ";\n"; + str += "\t\t" + b(pi,1) + " = " + makeRotHigh(a(opi,0), a(opi,1), Keccak_f1600_Rho[i]) + ";\n"; + opi = pi; + } + + // Chi + str += "\n\t\t// Chi\n"; + for (var j = 0; j < 25; j += 5) + { + for (var i = 0; i < 5; ++i) + { + for (var w = 0; w <= 1; ++w) + { + str += "\t\t" + a(j+i,w) + " = " + b(j+i,w) + " ^ ~" + b(j+(i+1)%5,w) + " & " + b(j+(i+2)%5,w) + ";\n"; + } + } + } + + // Iota + str += "\n\t\t// Iota\n"; + for (var w = 0; w <= 1; ++w) + { + str += "\t\t" + a(0,w) + " ^= Keccak_f1600_RC[r|" + w + "];\n"; + } + + + str += "\t}\n"; + + for (var i = 0; i < 25; ++i) + { + if (i == 4 || i == 8) + { + str += "\tif (outSize == " + i*2 + ")\n\t\treturn;\n"; + } + for (var w = 0; w <= 1; ++w) + { + str += "\toutState[outOffset|"+(i<<1|w)+"] = " + a(i,w) + ";\n"; + } + } + str += "}\n"; + + return str; +} + +console.log(makeKeccak_f1600()); diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/js/test.js b/Godeps/_workspace/src/github.com/ethereum/ethash/js/test.js new file mode 100644 index 000000000..7ebb733ff --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/js/test.js @@ -0,0 +1,53 @@ +// test.js +// Tim Hughes <tim@twistedfury.com> + +/*jslint node: true, shadow:true */ +"use strict"; + +var ethash = require('./ethash'); +var util = require('./util'); +var Keccak = require('./keccak'); + +// sanity check hash functions +var src = util.stringToBytes(""); +if (util.bytesToHexString(new Keccak().digest(32, src)) != "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470") throw Error("Keccak-256 failed"); +if (util.bytesToHexString(new Keccak().digest(64, src)) != "0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e") throw Error("Keccak-512 failed"); + +src = new Uint32Array(src.buffer); +var dst = new Uint32Array(8); +new Keccak().digestWords(dst, 0, dst.length, src, 0, src.length); +if (util.wordsToHexString(dst) != "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470") throw Error("Keccak-256 Fast failed"); + +var dst = new Uint32Array(16); +new Keccak().digestWords(dst, 0, dst.length, src, 0, src.length); +if (util.wordsToHexString(dst) != "0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e") throw Error("Keccak-512 Fast failed"); + + +// init params +var ethashParams = ethash.defaultParams(); +//ethashParams.cacheRounds = 0; + +// create hasher +var seed = util.hexStringToBytes("9410b944535a83d9adf6bbdcc80e051f30676173c16ca0d32d6f1263fc246466") +var startTime = new Date().getTime(); +var hasher = new ethash.Ethash(ethashParams, seed); +console.log('Ethash startup took: '+(new Date().getTime() - startTime) + "ms"); +console.log('Ethash cache hash: ' + util.bytesToHexString(hasher.cacheDigest())); + +var testHexString = "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"; +if (testHexString != util.bytesToHexString(util.hexStringToBytes(testHexString))) + throw Error("bytesToHexString or hexStringToBytes broken"); + + +var header = util.hexStringToBytes("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"); +var nonce = util.hexStringToBytes("0000000000000000"); +var hash; + +startTime = new Date().getTime(); +var trials = 10; +for (var i = 0; i < trials; ++i) +{ + hash = hasher.hash(header, nonce); +} +console.log("Light client hashes averaged: " + (new Date().getTime() - startTime)/trials + "ms"); +console.log("Hash = " + util.bytesToHexString(hash)); diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/js/util.js b/Godeps/_workspace/src/github.com/ethereum/ethash/js/util.js new file mode 100644 index 000000000..79743cd91 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/js/util.js @@ -0,0 +1,100 @@ +// util.js +// Tim Hughes <tim@twistedfury.com> + +/*jslint node: true, shadow:true */ +"use strict"; + +function nibbleToChar(nibble) +{ + return String.fromCharCode((nibble < 10 ? 48 : 87) + nibble); +} + +function charToNibble(chr) +{ + if (chr >= 48 && chr <= 57) + { + return chr - 48; + } + if (chr >= 65 && chr <= 70) + { + return chr - 65 + 10; + } + if (chr >= 97 && chr <= 102) + { + return chr - 97 + 10; + } + return 0; +} + +function stringToBytes(str) +{ + var bytes = new Uint8Array(str.length); + for (var i = 0; i != str.length; ++i) + { + bytes[i] = str.charCodeAt(i); + } + return bytes; +} + +function hexStringToBytes(str) +{ + var bytes = new Uint8Array(str.length>>>1); + for (var i = 0; i != bytes.length; ++i) + { + bytes[i] = charToNibble(str.charCodeAt(i<<1 | 0)) << 4; + bytes[i] |= charToNibble(str.charCodeAt(i<<1 | 1)); + } + return bytes; +} + +function bytesToHexString(bytes) +{ + var str = ""; + for (var i = 0; i != bytes.length; ++i) + { + str += nibbleToChar(bytes[i] >>> 4); + str += nibbleToChar(bytes[i] & 0xf); + } + return str; +} + +function wordsToHexString(words) +{ + return bytesToHexString(new Uint8Array(words.buffer)); +} + +function uint32ToHexString(num) +{ + var buf = new Uint8Array(4); + buf[0] = (num >> 24) & 0xff; + buf[1] = (num >> 16) & 0xff; + buf[2] = (num >> 8) & 0xff; + buf[3] = (num >> 0) & 0xff; + return bytesToHexString(buf); +} + +function toWords(input) +{ + if (input instanceof Uint32Array) + { + return input; + } + else if (input instanceof Uint8Array) + { + var tmp = new Uint8Array((input.length + 3) & ~3); + tmp.set(input); + return new Uint32Array(tmp.buffer); + } + else if (typeof input === typeof "") + { + return toWords(stringToBytes(input)); + } + return null; +} + +exports.stringToBytes = stringToBytes; +exports.hexStringToBytes = hexStringToBytes; +exports.bytesToHexString = bytesToHexString; +exports.wordsToHexString = wordsToHexString; +exports.uint32ToHexString = uint32ToHexString; +exports.toWords = toWords;
\ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cl/CMakeLists.txt b/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cl/CMakeLists.txt deleted file mode 100644 index 19d2fecbf..000000000 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cl/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -set(LIBRARY ethash-cl) -set(CMAKE_BUILD_TYPE Release) - -if (NOT OPENCL_FOUND) - find_package(OpenCL) -endif() -if (OPENCL_FOUND) - include_directories(${OPENCL_INCLUDE_DIRS}) - include_directories(..) - add_library(${LIBRARY} ethash_cl_miner.cpp ethash_cl_miner.h) - TARGET_LINK_LIBRARIES(${LIBRARY} ${OPENCL_LIBRARIES} ethash) -endif()
\ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cuda/CMakeLists.txt b/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cuda/CMakeLists.txt deleted file mode 100644 index b30ed3e2d..000000000 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cuda/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -find_package(CUDA) - -# Pass options to NVCC - - -if (CUDA_FOUND) -set(CUDA_NVCC_FLAGS " -gencode;arch=compute_30,code=sm_30; - -gencode;arch=compute_20,code=sm_20; - -gencode;arch=compute_11,code=sm_11; - -gencode;arch=compute_12,code=sm_12; - -gencode;arch=compute_13,code=sm_13;") -cuda_add_executable( - ethash-cuda - libethash.cu) -endif()
\ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cuda/cuPrintf.cu b/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cuda/cuPrintf.cu deleted file mode 100644 index f06653f2d..000000000 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cuda/cuPrintf.cu +++ /dev/null @@ -1,879 +0,0 @@ -/* - Copyright 2009 NVIDIA Corporation. All rights reserved. - - NOTICE TO LICENSEE: - - This source code and/or documentation ("Licensed Deliverables") are subject - to NVIDIA intellectual property rights under U.S. and international Copyright - laws. - - These Licensed Deliverables contained herein is PROPRIETARY and CONFIDENTIAL - to NVIDIA and is being provided under the terms and conditions of a form of - NVIDIA software license agreement by and between NVIDIA and Licensee ("License - Agreement") or electronically accepted by Licensee. Notwithstanding any terms - or conditions to the contrary in the License Agreement, reproduction or - disclosure of the Licensed Deliverables to any third party without the express - written consent of NVIDIA is prohibited. - - NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE LICENSE AGREEMENT, - NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THESE LICENSED - DELIVERABLES FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED - WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE - LICENSED DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, - NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. NOTWITHSTANDING ANY - TERMS OR CONDITIONS TO THE CONTRARY IN THE LICENSE AGREEMENT, IN NO EVENT SHALL - NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, - OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THESE LICENSED DELIVERABLES. - - U.S. Government End Users. These Licensed Deliverables are a "commercial item" - as that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of - "commercial computer software" and "commercial computer software documentation" - as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the - U.S. Government only as a commercial end item. Consistent with 48 C.F.R.12.212 - and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all U.S. Government - End Users acquire the Licensed Deliverables with only those rights set forth - herein. - - Any use of the Licensed Deliverables in individual and commercial software must - include, in the user documentation and internal comments to the code, the above - Disclaimer and U.S. Government End Users Notice. - */ - -/* - * cuPrintf.cu - * - * This is a printf command callable from within a kernel. It is set - * up so that output is sent to a memory buffer, which is emptied from - * the host side - but only after a cudaThreadSynchronize() on the host. - * - * Currently, there is a limitation of around 200 characters of output - * and no more than 10 arguments to a single cuPrintf() call. Issue - * multiple calls if longer format strings are required. - * - * It requires minimal setup, and is *NOT* optimised for performance. - * For example, writes are not coalesced - this is because there is an - * assumption that people will not want to printf from every single one - * of thousands of threads, but only from individual threads at a time. - * - * Using this is simple - it requires one host-side call to initialise - * everything, and then kernels can call cuPrintf at will. Sample code - * is the easiest way to demonstrate: - * - #include "cuPrintf.cu" - - __global__ void testKernel(int val) - { - cuPrintf("Value is: %d\n", val); - } - - int main() - { - cudaPrintfInit(); - testKernel<<< 2, 3 >>>(10); - cudaPrintfDisplay(stdout, true); - cudaPrintfEnd(); - return 0; - } - * - * See the header file, "cuPrintf.cuh" for more info, especially - * arguments to cudaPrintfInit() and cudaPrintfDisplay(); - */ - -#ifndef CUPRINTF_CU -#define CUPRINTF_CU - -#include "cuPrintf.cuh" -#if __CUDA_ARCH__ > 100 // Atomics only used with > sm_10 architecture -#include <sm_11_atomic_functions.h> -#endif - -// This is the smallest amount of memory, per-thread, which is allowed. -// It is also the largest amount of space a single printf() can take up -const static int CUPRINTF_MAX_LEN = 256; - -// This structure is used internally to track block/thread output restrictions. -typedef struct __align__(8) { - int threadid; // CUPRINTF_UNRESTRICTED for unrestricted - int blockid; // CUPRINTF_UNRESTRICTED for unrestricted -} cuPrintfRestriction; - -// The main storage is in a global print buffer, which has a known -// start/end/length. These are atomically updated so it works as a -// circular buffer. -// Since the only control primitive that can be used is atomicAdd(), -// we cannot wrap the pointer as such. The actual address must be -// calculated from printfBufferPtr by mod-ing with printfBufferLength. -// For sm_10 architecture, we must subdivide the buffer per-thread -// since we do not even have an atomic primitive. -__constant__ static char *globalPrintfBuffer = NULL; // Start of circular buffer (set up by host) -__constant__ static int printfBufferLength = 0; // Size of circular buffer (set up by host) -__device__ static cuPrintfRestriction restrictRules; // Output restrictions -__device__ volatile static char *printfBufferPtr = NULL; // Current atomically-incremented non-wrapped offset - -// This is the header preceeding all printf entries. -// NOTE: It *must* be size-aligned to the maximum entity size (size_t) -typedef struct __align__(8) { - unsigned short magic; // Magic number says we're valid - unsigned short fmtoffset; // Offset of fmt string into buffer - unsigned short blockid; // Block ID of author - unsigned short threadid; // Thread ID of author -} cuPrintfHeader; - -// Special header for sm_10 architecture -#define CUPRINTF_SM10_MAGIC 0xC810 // Not a valid ascii character -typedef struct __align__(16) { - unsigned short magic; // sm_10 specific magic number - unsigned short unused; - unsigned int thread_index; // thread ID for this buffer - unsigned int thread_buf_len; // per-thread buffer length - unsigned int offset; // most recent printf's offset -} cuPrintfHeaderSM10; - - -// Because we can't write an element which is not aligned to its bit-size, -// we have to align all sizes and variables on maximum-size boundaries. -// That means sizeof(double) in this case, but we'll use (long long) for -// better arch<1.3 support -#define CUPRINTF_ALIGN_SIZE sizeof(long long) - -// All our headers are prefixed with a magic number so we know they're ready -#define CUPRINTF_SM11_MAGIC (unsigned short)0xC811 // Not a valid ascii character - - -// -// getNextPrintfBufPtr -// -// Grabs a block of space in the general circular buffer, using an -// atomic function to ensure that it's ours. We handle wrapping -// around the circular buffer and return a pointer to a place which -// can be written to. -// -// Important notes: -// 1. We always grab CUPRINTF_MAX_LEN bytes -// 2. Because of 1, we never worry about wrapping around the end -// 3. Because of 1, printfBufferLength *must* be a factor of CUPRINTF_MAX_LEN -// -// This returns a pointer to the place where we own. -// -__device__ static char *getNextPrintfBufPtr() -{ - // Initialisation check - if(!printfBufferPtr) - return NULL; - - // Thread/block restriction check - if((restrictRules.blockid != CUPRINTF_UNRESTRICTED) && (restrictRules.blockid != (blockIdx.x + gridDim.x*blockIdx.y))) - return NULL; - if((restrictRules.threadid != CUPRINTF_UNRESTRICTED) && (restrictRules.threadid != (threadIdx.x + blockDim.x*threadIdx.y + blockDim.x*blockDim.y*threadIdx.z))) - return NULL; - - // Conditional section, dependent on architecture -#if __CUDA_ARCH__ == 100 - // For sm_10 architectures, we have no atomic add - this means we must split the - // entire available buffer into per-thread blocks. Inefficient, but what can you do. - int thread_count = (gridDim.x * gridDim.y) * (blockDim.x * blockDim.y * blockDim.z); - int thread_index = threadIdx.x + blockDim.x*threadIdx.y + blockDim.x*blockDim.y*threadIdx.z + - (blockIdx.x + gridDim.x*blockIdx.y) * (blockDim.x * blockDim.y * blockDim.z); - - // Find our own block of data and go to it. Make sure the per-thread length - // is a precise multiple of CUPRINTF_MAX_LEN, otherwise we risk size and - // alignment issues! We must round down, of course. - unsigned int thread_buf_len = printfBufferLength / thread_count; - thread_buf_len &= ~(CUPRINTF_MAX_LEN-1); - - // We *must* have a thread buffer length able to fit at least two printfs (one header, one real) - if(thread_buf_len < (CUPRINTF_MAX_LEN * 2)) - return NULL; - - // Now address our section of the buffer. The first item is a header. - char *myPrintfBuffer = globalPrintfBuffer + (thread_buf_len * thread_index); - cuPrintfHeaderSM10 hdr = *(cuPrintfHeaderSM10 *)(void *)myPrintfBuffer; - if(hdr.magic != CUPRINTF_SM10_MAGIC) - { - // If our header is not set up, initialise it - hdr.magic = CUPRINTF_SM10_MAGIC; - hdr.thread_index = thread_index; - hdr.thread_buf_len = thread_buf_len; - hdr.offset = 0; // Note we start at 0! We pre-increment below. - *(cuPrintfHeaderSM10 *)(void *)myPrintfBuffer = hdr; // Write back the header - - // For initial setup purposes, we might need to init thread0's header too - // (so that cudaPrintfDisplay() below will work). This is only run once. - cuPrintfHeaderSM10 *tophdr = (cuPrintfHeaderSM10 *)(void *)globalPrintfBuffer; - tophdr->thread_buf_len = thread_buf_len; - } - - // Adjust the offset by the right amount, and wrap it if need be - unsigned int offset = hdr.offset + CUPRINTF_MAX_LEN; - if(offset >= hdr.thread_buf_len) - offset = CUPRINTF_MAX_LEN; - - // Write back the new offset for next time and return a pointer to it - ((cuPrintfHeaderSM10 *)(void *)myPrintfBuffer)->offset = offset; - return myPrintfBuffer + offset; -#else - // Much easier with an atomic operation! - size_t offset = atomicAdd((unsigned int *)&printfBufferPtr, CUPRINTF_MAX_LEN) - (size_t)globalPrintfBuffer; - offset %= printfBufferLength; - return globalPrintfBuffer + offset; -#endif -} - - -// -// writePrintfHeader -// -// Inserts the header for containing our UID, fmt position and -// block/thread number. We generate it dynamically to avoid -// issues arising from requiring pre-initialisation. -// -__device__ static void writePrintfHeader(char *ptr, char *fmtptr) -{ - if(ptr) - { - cuPrintfHeader header; - header.magic = CUPRINTF_SM11_MAGIC; - header.fmtoffset = (unsigned short)(fmtptr - ptr); - header.blockid = blockIdx.x + gridDim.x*blockIdx.y; - header.threadid = threadIdx.x + blockDim.x*threadIdx.y + blockDim.x*blockDim.y*threadIdx.z; - *(cuPrintfHeader *)(void *)ptr = header; - } -} - - -// -// cuPrintfStrncpy -// -// This special strncpy outputs an aligned length value, followed by the -// string. It then zero-pads the rest of the string until a 64-aligned -// boundary. The length *includes* the padding. A pointer to the byte -// just after the \0 is returned. -// -// This function could overflow CUPRINTF_MAX_LEN characters in our buffer. -// To avoid it, we must count as we output and truncate where necessary. -// -__device__ static char *cuPrintfStrncpy(char *dest, const char *src, int n, char *end) -{ - // Initialisation and overflow check - if(!dest || !src || (dest >= end)) - return NULL; - - // Prepare to write the length specifier. We're guaranteed to have - // at least "CUPRINTF_ALIGN_SIZE" bytes left because we only write out in - // chunks that size, and CUPRINTF_MAX_LEN is aligned with CUPRINTF_ALIGN_SIZE. - int *lenptr = (int *)(void *)dest; - int len = 0; - dest += CUPRINTF_ALIGN_SIZE; - - // Now copy the string - while(n--) - { - if(dest >= end) // Overflow check - break; - - len++; - *dest++ = *src; - if(*src++ == '\0') - break; - } - - // Now write out the padding bytes, and we have our length. - while((dest < end) && (((long)dest & (CUPRINTF_ALIGN_SIZE-1)) != 0)) - { - len++; - *dest++ = 0; - } - *lenptr = len; - return (dest < end) ? dest : NULL; // Overflow means return NULL -} - - -// -// copyArg -// -// This copies a length specifier and then the argument out to the -// data buffer. Templates let the compiler figure all this out at -// compile-time, making life much simpler from the programming -// point of view. I'm assuimg all (const char *) is a string, and -// everything else is the variable it points at. I'd love to see -// a better way of doing it, but aside from parsing the format -// string I can't think of one. -// -// The length of the data type is inserted at the beginning (so that -// the display can distinguish between float and double), and the -// pointer to the end of the entry is returned. -// -__device__ static char *copyArg(char *ptr, const char *arg, char *end) -{ - // Initialisation check - if(!ptr || !arg) - return NULL; - - // strncpy does all our work. We just terminate. - if((ptr = cuPrintfStrncpy(ptr, arg, CUPRINTF_MAX_LEN, end)) != NULL) - *ptr = 0; - - return ptr; -} - -template <typename T> -__device__ static char *copyArg(char *ptr, T &arg, char *end) -{ - // Initisalisation and overflow check. Alignment rules mean that - // we're at least CUPRINTF_ALIGN_SIZE away from "end", so we only need - // to check that one offset. - if(!ptr || ((ptr+CUPRINTF_ALIGN_SIZE) >= end)) - return NULL; - - // Write the length and argument - *(int *)(void *)ptr = sizeof(arg); - ptr += CUPRINTF_ALIGN_SIZE; - *(T *)(void *)ptr = arg; - ptr += CUPRINTF_ALIGN_SIZE; - *ptr = 0; - - return ptr; -} - - -// -// cuPrintf -// -// Templated printf functions to handle multiple arguments. -// Note we return the total amount of data copied, not the number -// of characters output. But then again, who ever looks at the -// return from printf() anyway? -// -// The format is to grab a block of circular buffer space, the -// start of which will hold a header and a pointer to the format -// string. We then write in all the arguments, and finally the -// format string itself. This is to make it easy to prevent -// overflow of our buffer (we support up to 10 arguments, each of -// which can be 12 bytes in length - that means that only the -// format string (or a %s) can actually overflow; so the overflow -// check need only be in the strcpy function. -// -// The header is written at the very last because that's what -// makes it look like we're done. -// -// Errors, which are basically lack-of-initialisation, are ignored -// in the called functions because NULL pointers are passed around -// - -// All printf variants basically do the same thing, setting up the -// buffer, writing all arguments, then finalising the header. For -// clarity, we'll pack the code into some big macros. -#define CUPRINTF_PREAMBLE \ - char *start, *end, *bufptr, *fmtstart; \ - if((start = getNextPrintfBufPtr()) == NULL) return 0; \ - end = start + CUPRINTF_MAX_LEN; \ - bufptr = start + sizeof(cuPrintfHeader); - -// Posting an argument is easy -#define CUPRINTF_ARG(argname) \ - bufptr = copyArg(bufptr, argname, end); - -// After args are done, record start-of-fmt and write the fmt and header -#define CUPRINTF_POSTAMBLE \ - fmtstart = bufptr; \ - end = cuPrintfStrncpy(bufptr, fmt, CUPRINTF_MAX_LEN, end); \ - writePrintfHeader(start, end ? fmtstart : NULL); \ - return end ? (int)(end - start) : 0; - -__device__ int cuPrintf(const char *fmt) -{ - CUPRINTF_PREAMBLE; - - CUPRINTF_POSTAMBLE; -} -template <typename T1> __device__ int cuPrintf(const char *fmt, T1 arg1) -{ - CUPRINTF_PREAMBLE; - - CUPRINTF_ARG(arg1); - - CUPRINTF_POSTAMBLE; -} -template <typename T1, typename T2> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2) -{ - CUPRINTF_PREAMBLE; - - CUPRINTF_ARG(arg1); - CUPRINTF_ARG(arg2); - - CUPRINTF_POSTAMBLE; -} -template <typename T1, typename T2, typename T3> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3) -{ - CUPRINTF_PREAMBLE; - - CUPRINTF_ARG(arg1); - CUPRINTF_ARG(arg2); - CUPRINTF_ARG(arg3); - - CUPRINTF_POSTAMBLE; -} -template <typename T1, typename T2, typename T3, typename T4> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4) -{ - CUPRINTF_PREAMBLE; - - CUPRINTF_ARG(arg1); - CUPRINTF_ARG(arg2); - CUPRINTF_ARG(arg3); - CUPRINTF_ARG(arg4); - - CUPRINTF_POSTAMBLE; -} -template <typename T1, typename T2, typename T3, typename T4, typename T5> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) -{ - CUPRINTF_PREAMBLE; - - CUPRINTF_ARG(arg1); - CUPRINTF_ARG(arg2); - CUPRINTF_ARG(arg3); - CUPRINTF_ARG(arg4); - CUPRINTF_ARG(arg5); - - CUPRINTF_POSTAMBLE; -} -template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) -{ - CUPRINTF_PREAMBLE; - - CUPRINTF_ARG(arg1); - CUPRINTF_ARG(arg2); - CUPRINTF_ARG(arg3); - CUPRINTF_ARG(arg4); - CUPRINTF_ARG(arg5); - CUPRINTF_ARG(arg6); - CUPRINTF_POSTAMBLE; -} -template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) -{ - CUPRINTF_PREAMBLE; - - CUPRINTF_ARG(arg1); - CUPRINTF_ARG(arg2); - CUPRINTF_ARG(arg3); - CUPRINTF_ARG(arg4); - CUPRINTF_ARG(arg5); - CUPRINTF_ARG(arg6); - CUPRINTF_ARG(arg7); - - CUPRINTF_POSTAMBLE; -} -template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) -{ - CUPRINTF_PREAMBLE; - - CUPRINTF_ARG(arg1); - CUPRINTF_ARG(arg2); - CUPRINTF_ARG(arg3); - CUPRINTF_ARG(arg4); - CUPRINTF_ARG(arg5); - CUPRINTF_ARG(arg6); - CUPRINTF_ARG(arg7); - CUPRINTF_ARG(arg8); - - CUPRINTF_POSTAMBLE; -} -template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) -{ - CUPRINTF_PREAMBLE; - - CUPRINTF_ARG(arg1); - CUPRINTF_ARG(arg2); - CUPRINTF_ARG(arg3); - CUPRINTF_ARG(arg4); - CUPRINTF_ARG(arg5); - CUPRINTF_ARG(arg6); - CUPRINTF_ARG(arg7); - CUPRINTF_ARG(arg8); - CUPRINTF_ARG(arg9); - - CUPRINTF_POSTAMBLE; -} -template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10) -{ - CUPRINTF_PREAMBLE; - - CUPRINTF_ARG(arg1); - CUPRINTF_ARG(arg2); - CUPRINTF_ARG(arg3); - CUPRINTF_ARG(arg4); - CUPRINTF_ARG(arg5); - CUPRINTF_ARG(arg6); - CUPRINTF_ARG(arg7); - CUPRINTF_ARG(arg8); - CUPRINTF_ARG(arg9); - CUPRINTF_ARG(arg10); - - CUPRINTF_POSTAMBLE; -} -#undef CUPRINTF_PREAMBLE -#undef CUPRINTF_ARG -#undef CUPRINTF_POSTAMBLE - - -// -// cuPrintfRestrict -// -// Called to restrict output to a given thread/block. -// We store the info in "restrictRules", which is set up at -// init time by the host. It's not the cleanest way to do this -// because it means restrictions will last between -// invocations, but given the output-pointer continuity, -// I feel this is reasonable. -// -__device__ void cuPrintfRestrict(int threadid, int blockid) -{ - int thread_count = blockDim.x * blockDim.y * blockDim.z; - if(((threadid < thread_count) && (threadid >= 0)) || (threadid == CUPRINTF_UNRESTRICTED)) - restrictRules.threadid = threadid; - - int block_count = gridDim.x * gridDim.y; - if(((blockid < block_count) && (blockid >= 0)) || (blockid == CUPRINTF_UNRESTRICTED)) - restrictRules.blockid = blockid; -} - - -/////////////////////////////////////////////////////////////////////////////// -// HOST SIDE - -#include <stdio.h> -static FILE *printf_fp; - -static char *printfbuf_start=NULL; -static char *printfbuf_device=NULL; -static int printfbuf_len=0; - - -// -// outputPrintfData -// -// Our own internal function, which takes a pointer to a data buffer -// and passes it through libc's printf for output. -// -// We receive the formate string and a pointer to where the data is -// held. We then run through and print it out. -// -// Returns 0 on failure, 1 on success -// -static int outputPrintfData(char *fmt, char *data) -{ - // Format string is prefixed by a length that we don't need - fmt += CUPRINTF_ALIGN_SIZE; - - // Now run through it, printing everything we can. We must - // run to every % character, extract only that, and use printf - // to format it. - char *p = strchr(fmt, '%'); - while(p != NULL) - { - // Print up to the % character - *p = '\0'; - fputs(fmt, printf_fp); - *p = '%'; // Put back the % - - // Now handle the format specifier - char *format = p++; // Points to the '%' - p += strcspn(p, "%cdiouxXeEfgGaAnps"); - if(*p == '\0') // If no format specifier, print the whole thing - { - fmt = format; - break; - } - - // Cut out the format bit and use printf to print it. It's prefixed - // by its length. - int arglen = *(int *)data; - if(arglen > CUPRINTF_MAX_LEN) - { - fputs("Corrupt printf buffer data - aborting\n", printf_fp); - return 0; - } - - data += CUPRINTF_ALIGN_SIZE; - - char specifier = *p++; - char c = *p; // Store for later - *p = '\0'; - switch(specifier) - { - // These all take integer arguments - case 'c': - case 'd': - case 'i': - case 'o': - case 'u': - case 'x': - case 'X': - case 'p': - fprintf(printf_fp, format, *((int *)data)); - break; - - // These all take double arguments - case 'e': - case 'E': - case 'f': - case 'g': - case 'G': - case 'a': - case 'A': - if(arglen == 4) // Float vs. Double thing - fprintf(printf_fp, format, *((float *)data)); - else - fprintf(printf_fp, format, *((double *)data)); - break; - - // Strings are handled in a special way - case 's': - fprintf(printf_fp, format, (char *)data); - break; - - // % is special - case '%': - fprintf(printf_fp, "%%"); - break; - - // Everything else is just printed out as-is - default: - fprintf(printf_fp, format); - break; - } - data += CUPRINTF_ALIGN_SIZE; // Move on to next argument - *p = c; // Restore what we removed - fmt = p; // Adjust fmt string to be past the specifier - p = strchr(fmt, '%'); // and get the next specifier - } - - // Print out the last of the string - fputs(fmt, printf_fp); - return 1; -} - - -// -// doPrintfDisplay -// -// This runs through the blocks of CUPRINTF_MAX_LEN-sized data, calling the -// print function above to display them. We've got this separate from -// cudaPrintfDisplay() below so we can handle the SM_10 architecture -// partitioning. -// -static int doPrintfDisplay(int headings, int clear, char *bufstart, char *bufend, char *bufptr, char *endptr) -{ - // Grab, piece-by-piece, each output element until we catch - // up with the circular buffer end pointer - int printf_count=0; - char printfbuf_local[CUPRINTF_MAX_LEN+1]; - printfbuf_local[CUPRINTF_MAX_LEN] = '\0'; - - while(bufptr != endptr) - { - // Wrap ourselves at the end-of-buffer - if(bufptr == bufend) - bufptr = bufstart; - - // Adjust our start pointer to within the circular buffer and copy a block. - cudaMemcpy(printfbuf_local, bufptr, CUPRINTF_MAX_LEN, cudaMemcpyDeviceToHost); - - // If the magic number isn't valid, then this write hasn't gone through - // yet and we'll wait until it does (or we're past the end for non-async printfs). - cuPrintfHeader *hdr = (cuPrintfHeader *)printfbuf_local; - if((hdr->magic != CUPRINTF_SM11_MAGIC) || (hdr->fmtoffset >= CUPRINTF_MAX_LEN)) - { - //fprintf(printf_fp, "Bad magic number in printf header\n"); - break; - } - - // Extract all the info and get this printf done - if(headings) - fprintf(printf_fp, "[%d, %d]: ", hdr->blockid, hdr->threadid); - if(hdr->fmtoffset == 0) - fprintf(printf_fp, "printf buffer overflow\n"); - else if(!outputPrintfData(printfbuf_local+hdr->fmtoffset, printfbuf_local+sizeof(cuPrintfHeader))) - break; - printf_count++; - - // Clear if asked - if(clear) - cudaMemset(bufptr, 0, CUPRINTF_MAX_LEN); - - // Now advance our start location, because we're done, and keep copying - bufptr += CUPRINTF_MAX_LEN; - } - - return printf_count; -} - - -// -// cudaPrintfInit -// -// Takes a buffer length to allocate, creates the memory on the device and -// returns a pointer to it for when a kernel is called. It's up to the caller -// to free it. -// -extern "C" cudaError_t cudaPrintfInit(size_t bufferLen) -{ - // Fix up bufferlen to be a multiple of CUPRINTF_MAX_LEN - bufferLen = (bufferLen < CUPRINTF_MAX_LEN) ? CUPRINTF_MAX_LEN : bufferLen; - if((bufferLen % CUPRINTF_MAX_LEN) > 0) - bufferLen += (CUPRINTF_MAX_LEN - (bufferLen % CUPRINTF_MAX_LEN)); - printfbuf_len = (int)bufferLen; - - // Allocate a print buffer on the device and zero it - if(cudaMalloc((void **)&printfbuf_device, printfbuf_len) != cudaSuccess) - return cudaErrorInitializationError; - cudaMemset(printfbuf_device, 0, printfbuf_len); - printfbuf_start = printfbuf_device; // Where we start reading from - - // No restrictions to begin with - cuPrintfRestriction restrict; - restrict.threadid = restrict.blockid = CUPRINTF_UNRESTRICTED; - cudaMemcpyToSymbol(restrictRules, &restrict, sizeof(restrict)); - - // Initialise the buffer and the respective lengths/pointers. - cudaMemcpyToSymbol(globalPrintfBuffer, &printfbuf_device, sizeof(char *)); - cudaMemcpyToSymbol(printfBufferPtr, &printfbuf_device, sizeof(char *)); - cudaMemcpyToSymbol(printfBufferLength, &printfbuf_len, sizeof(printfbuf_len)); - - return cudaSuccess; -} - - -// -// cudaPrintfEnd -// -// Frees up the memory which we allocated -// -extern "C" void cudaPrintfEnd() -{ - if(!printfbuf_start || !printfbuf_device) - return; - - cudaFree(printfbuf_device); - printfbuf_start = printfbuf_device = NULL; -} - - -// -// cudaPrintfDisplay -// -// Each call to this function dumps the entire current contents -// of the printf buffer to the pre-specified FILE pointer. The -// circular "start" pointer is advanced so that subsequent calls -// dumps only new stuff. -// -// In the case of async memory access (via streams), call this -// repeatedly to keep trying to empty the buffer. If it's a sync -// access, then the whole buffer should empty in one go. -// -// Arguments: -// outputFP - File descriptor to output to (NULL => stdout) -// showThreadID - If true, prints [block,thread] before each line -// -extern "C" cudaError_t cudaPrintfDisplay(void *outputFP, bool showThreadID) -{ - printf_fp = (FILE *)((outputFP == NULL) ? stdout : outputFP); - - // For now, we force "synchronous" mode which means we're not concurrent - // with kernel execution. This also means we don't need clearOnPrint. - // If you're patching it for async operation, here's where you want it. - bool sync_printfs = true; - bool clearOnPrint = false; - - // Initialisation check - if(!printfbuf_start || !printfbuf_device || !printf_fp) - return cudaErrorMissingConfiguration; - - // To determine which architecture we're using, we read the - // first short from the buffer - it'll be the magic number - // relating to the version. - unsigned short magic; - cudaMemcpy(&magic, printfbuf_device, sizeof(unsigned short), cudaMemcpyDeviceToHost); - - // For SM_10 architecture, we've split our buffer into one-per-thread. - // That means we must do each thread block separately. It'll require - // extra reading. We also, for now, don't support async printfs because - // that requires tracking one start pointer per thread. - if(magic == CUPRINTF_SM10_MAGIC) - { - sync_printfs = true; - clearOnPrint = false; - int blocklen = 0; - char *blockptr = printfbuf_device; - while(blockptr < (printfbuf_device + printfbuf_len)) - { - cuPrintfHeaderSM10 hdr; - cudaMemcpy(&hdr, blockptr, sizeof(hdr), cudaMemcpyDeviceToHost); - - // We get our block-size-step from the very first header - if(hdr.thread_buf_len != 0) - blocklen = hdr.thread_buf_len; - - // No magic number means no printfs from this thread - if(hdr.magic != CUPRINTF_SM10_MAGIC) - { - if(blocklen == 0) - { - fprintf(printf_fp, "No printf headers found at all!\n"); - break; // No valid headers! - } - blockptr += blocklen; - continue; - } - - // "offset" is non-zero then we can print the block contents - if(hdr.offset > 0) - { - // For synchronous printfs, we must print from endptr->bufend, then from start->end - if(sync_printfs) - doPrintfDisplay(showThreadID, clearOnPrint, blockptr+CUPRINTF_MAX_LEN, blockptr+hdr.thread_buf_len, blockptr+hdr.offset+CUPRINTF_MAX_LEN, blockptr+hdr.thread_buf_len); - doPrintfDisplay(showThreadID, clearOnPrint, blockptr+CUPRINTF_MAX_LEN, blockptr+hdr.thread_buf_len, blockptr+CUPRINTF_MAX_LEN, blockptr+hdr.offset+CUPRINTF_MAX_LEN); - } - - // Move on to the next block and loop again - blockptr += hdr.thread_buf_len; - } - } - // For SM_11 and up, everything is a single buffer and it's simple - else if(magic == CUPRINTF_SM11_MAGIC) - { - // Grab the current "end of circular buffer" pointer. - char *printfbuf_end = NULL; - cudaMemcpyFromSymbol(&printfbuf_end, printfBufferPtr, sizeof(char *)); - - // Adjust our starting and ending pointers to within the block - char *bufptr = ((printfbuf_start - printfbuf_device) % printfbuf_len) + printfbuf_device; - char *endptr = ((printfbuf_end - printfbuf_device) % printfbuf_len) + printfbuf_device; - - // For synchronous (i.e. after-kernel-exit) printf display, we have to handle circular - // buffer wrap carefully because we could miss those past "end". - if(sync_printfs) - doPrintfDisplay(showThreadID, clearOnPrint, printfbuf_device, printfbuf_device+printfbuf_len, endptr, printfbuf_device+printfbuf_len); - doPrintfDisplay(showThreadID, clearOnPrint, printfbuf_device, printfbuf_device+printfbuf_len, bufptr, endptr); - - printfbuf_start = printfbuf_end; - } - else - ;//printf("Bad magic number in cuPrintf buffer header\n"); - - // If we were synchronous, then we must ensure that the memory is cleared on exit - // otherwise another kernel launch with a different grid size could conflict. - if(sync_printfs) - cudaMemset(printfbuf_device, 0, printfbuf_len); - - return cudaSuccess; -} - -// Cleanup -#undef CUPRINTF_MAX_LEN -#undef CUPRINTF_ALIGN_SIZE -#undef CUPRINTF_SM10_MAGIC -#undef CUPRINTF_SM11_MAGIC - -#endif diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cuda/cuPrintf.cuh b/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cuda/cuPrintf.cuh deleted file mode 100644 index cf3fe4868..000000000 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cuda/cuPrintf.cuh +++ /dev/null @@ -1,162 +0,0 @@ -/* - Copyright 2009 NVIDIA Corporation. All rights reserved. - - NOTICE TO LICENSEE: - - This source code and/or documentation ("Licensed Deliverables") are subject - to NVIDIA intellectual property rights under U.S. and international Copyright - laws. - - These Licensed Deliverables contained herein is PROPRIETARY and CONFIDENTIAL - to NVIDIA and is being provided under the terms and conditions of a form of - NVIDIA software license agreement by and between NVIDIA and Licensee ("License - Agreement") or electronically accepted by Licensee. Notwithstanding any terms - or conditions to the contrary in the License Agreement, reproduction or - disclosure of the Licensed Deliverables to any third party without the express - written consent of NVIDIA is prohibited. - - NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE LICENSE AGREEMENT, - NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THESE LICENSED - DELIVERABLES FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED - WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE - LICENSED DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, - NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. NOTWITHSTANDING ANY - TERMS OR CONDITIONS TO THE CONTRARY IN THE LICENSE AGREEMENT, IN NO EVENT SHALL - NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, - OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THESE LICENSED DELIVERABLES. - - U.S. Government End Users. These Licensed Deliverables are a "commercial item" - as that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of - "commercial computer software" and "commercial computer software documentation" - as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the - U.S. Government only as a commercial end item. Consistent with 48 C.F.R.12.212 - and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all U.S. Government - End Users acquire the Licensed Deliverables with only those rights set forth - herein. - - Any use of the Licensed Deliverables in individual and commercial software must - include, in the user documentation and internal comments to the code, the above - Disclaimer and U.S. Government End Users Notice. - */ - -#ifndef CUPRINTF_H -#define CUPRINTF_H - -/* - * This is the header file supporting cuPrintf.cu and defining both - * the host and device-side interfaces. See that file for some more - * explanation and sample use code. See also below for details of the - * host-side interfaces. - * - * Quick sample code: - * - #include "cuPrintf.cu" - - __global__ void testKernel(int val) - { - cuPrintf("Value is: %d\n", val); - } - - int main() - { - cudaPrintfInit(); - testKernel<<< 2, 3 >>>(10); - cudaPrintfDisplay(stdout, true); - cudaPrintfEnd(); - return 0; - } - */ - -/////////////////////////////////////////////////////////////////////////////// -// DEVICE SIDE -// External function definitions for device-side code - -// Abuse of templates to simulate varargs -__device__ int cuPrintf(const char *fmt); -template <typename T1> __device__ int cuPrintf(const char *fmt, T1 arg1); -template <typename T1, typename T2> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2); -template <typename T1, typename T2, typename T3> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3); -template <typename T1, typename T2, typename T3, typename T4> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4); -template <typename T1, typename T2, typename T3, typename T4, typename T5> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5); -template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6); -template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7); -template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8); -template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9); -template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> __device__ int cuPrintf(const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10); - - -// -// cuPrintfRestrict -// -// Called to restrict output to a given thread/block. Pass -// the constant CUPRINTF_UNRESTRICTED to unrestrict output -// for thread/block IDs. Note you can therefore allow -// "all printfs from block 3" or "printfs from thread 2 -// on all blocks", or "printfs only from block 1, thread 5". -// -// Arguments: -// threadid - Thread ID to allow printfs from -// blockid - Block ID to allow printfs from -// -// NOTE: Restrictions last between invocations of -// kernels unless cudaPrintfInit() is called again. -// -#define CUPRINTF_UNRESTRICTED -1 -__device__ void cuPrintfRestrict(int threadid, int blockid); - - - -/////////////////////////////////////////////////////////////////////////////// -// HOST SIDE -// External function definitions for host-side code - -// -// cudaPrintfInit -// -// Call this once to initialise the printf system. If the output -// file or buffer size needs to be changed, call cudaPrintfEnd() -// before re-calling cudaPrintfInit(). -// -// The default size for the buffer is 1 megabyte. For CUDA -// architecture 1.1 and above, the buffer is filled linearly and -// is completely used; however for architecture 1.0, the buffer -// is divided into as many segments are there are threads, even -// if some threads do not call cuPrintf(). -// -// Arguments: -// bufferLen - Length, in bytes, of total space to reserve -// (in device global memory) for output. -// -// Returns: -// cudaSuccess if all is well. -// -extern "C" cudaError_t cudaPrintfInit(size_t bufferLen=1048576); // 1-meg - that's enough for 4096 printfs by all threads put together - -// -// cudaPrintfEnd -// -// Cleans up all memories allocated by cudaPrintfInit(). -// Call this at exit, or before calling cudaPrintfInit() again. -// -extern "C" void cudaPrintfEnd(); - -// -// cudaPrintfDisplay -// -// Dumps the contents of the output buffer to the specified -// file pointer. If the output pointer is not specified, -// the default "stdout" is used. -// -// Arguments: -// outputFP - A file pointer to an output stream. -// showThreadID - If "true", output strings are prefixed -// by "[blockid, threadid] " at output. -// -// Returns: -// cudaSuccess if all is well. -// -extern "C" cudaError_t cudaPrintfDisplay(void *outputFP=NULL, bool showThreadID=false); - -#endif // CUPRINTF_H diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cuda/libethash.cu b/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cuda/libethash.cu deleted file mode 100644 index 3e53c8853..000000000 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cuda/libethash.cu +++ /dev/null @@ -1,27 +0,0 @@ -#include "cuPrintf.cu" -#include <stdio.h> - -__global__ void device_greetings(void) -{ - cuPrintf("Hello, world from the device!\n"); -} - -int main(void) -{ - // greet from the host - printf("Hello, world from the host!\n"); - - // initialize cuPrintf - cudaPrintfInit(); - - // launch a kernel with a single thread to greet from the device - device_greetings<<<1,1>>>(); - - // display the device's greeting - cudaPrintfDisplay(); - - // clean up after cuPrintf - cudaPrintfEnd(); - - return 0; -} diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/data_sizes.h b/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/data_sizes.h deleted file mode 100644 index 40417cb71..000000000 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/data_sizes.h +++ /dev/null @@ -1,248 +0,0 @@ -/* - This file is part of cpp-ethereum. - - cpp-ethereum is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software FoundationUUU,either version 3 of the LicenseUUU,or - (at your option) any later version. - - cpp-ethereum is distributed in the hope that it will be usefulU, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with cpp-ethereum. If notUUU,see <http://www.gnu.org/licenses/>. -*/ - -/** @file nth_prime.h -* @author Matthew Wampler-Doty <negacthulhu@gmail.com> -* @date 2015 -*/ - -// TODO: Update this after ~7 years - -#pragma once - -#include <stdint.h> -//#include <Security/Security.h> -#include "compiler.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -// 500 Epochs worth of tabulated DAG sizes (~3.5 Years) - -// Generated with the following Mathematica Code: -// GetDataSizes[n_] := Module[{ -// DAGSizeBytesInit = 2^30, -// MixBytes = 128, -// DAGGrowth = 113000000, -// j = 0}, -// Reap[ -// While[j < n, -// Module[{i = -// Floor[(DAGSizeBytesInit + DAGGrowth * j) / MixBytes]}, -// While[! PrimeQ[i], i--]; -// Sow[i*MixBytes]; j++]]]][[2]][[1]] - -static const size_t dag_sizes[] = { - 1073739904U, 1186739584U, 1299741568U, 1412741248U, 1525741696U, - 1638736768U, 1751741312U, 1864740736U, 1977740672U, 2090740864U, - 2203740544U, 2316741248U, 2429739392U, 2542740352U, 2655741824U, - 2768739712U, 2881740416U, 2994741632U, 3107740544U, 3220741504U, - 3333738112U, 3446741632U, 3559741312U, 3672740224U, 3785740928U, - 3898738304U, 4011741824U, 4124739712U, 4237735808U, 4350740864U, - 4463741824U, 4576741504U, 4689741184U, 4802739328U, 4915741568U, - 5028740224U, 5141740672U, 5254738304U, 5367741824U, 5480737664U, - 5593738112U, 5706741632U, 5819740544U, 5932734592U, 6045739904U, - 6158740096U, 6271740032U, 6384731776U, 6497732992U, 6610740352U, - 6723741056U, 6836741504U, 6949740416U, 7062740096U, 7175741824U, - 7288740224U, 7401741184U, 7514741632U, 7627741568U, 7740739712U, - 7853739136U, 7966740352U, 8079741568U, 8192739712U, 8305738624U, - 8418740864U, 8531740288U, 8644740736U, 8757735808U, 8870738816U, - 8983739264U, 9096740992U, 9209740928U, 9322739584U, 9435741824U, - 9548741504U, 9661739392U, 9774738304U, 9887741312U, 10000738688U, - 10113739136U, 10226741632U, 10339739776U, 10452741248U, 10565740928U, - 10678736512U, 10791734656U, 10904741248U, 11017738112U, 11130741632U, - 11243741312U, 11356739456U, 11469740416U, 11582734976U, 11695739008U, - 11808741248U, 11921734784U, 12034739072U, 12147741568U, 12260737408U, - 12373741696U, 12486738304U, 12599740544U, 12712740224U, 12825741184U, - 12938736256U, 13051741312U, 13164737408U, 13277738368U, 13390738048U, - 13503741824U, 13616741504U, 13729737088U, 13842740096U, 13955741312U, - 14068741504U, 14181740416U, 14294741632U, 14407739776U, 14520740224U, - 14633740928U, 14746736512U, 14859741824U, 14972740736U, 15085740928U, - 15198738304U, 15311732096U, 15424740736U, 15537739904U, 15650741632U, - 15763741568U, 15876737152U, 15989741696U, 16102740608U, 16215741056U, - 16328741248U, 16441740416U, 16554737792U, 16667740288U, 16780740992U, - 16893738112U, 17006741632U, 17119739008U, 17232735616U, 17345739392U, - 17458740352U, 17571736192U, 17684739712U, 17797739392U, 17910740096U, - 18023741312U, 18136740736U, 18249738112U, 18362738816U, 18475735424U, - 18588740224U, 18701738368U, 18814736768U, 18927737216U, 19040739968U, - 19153739648U, 19266736768U, 19379737984U, 19492739456U, 19605738368U, - 19718740352U, 19831741312U, 19944736384U, 20057741696U, 20170741376U, - 20283741824U, 20396737408U, 20509741696U, 20622741376U, 20735739008U, - 20848741504U, 20961740672U, 21074739328U, 21187740032U, 21300739456U, - 21413741696U, 21526740608U, 21639741824U, 21752737408U, 21865741696U, - 21978741376U, 22091741824U, 22204738432U, 22317740672U, 22430740096U, - 22543736704U, 22656741248U, 22769739904U, 22882739584U, 22995740288U, - 23108740736U, 23221740928U, 23334741376U, 23447737216U, 23560740992U, - 23673741184U, 23786740864U, 23899737728U, 24012741248U, 24125734784U, - 24238736512U, 24351741824U, 24464740736U, 24577737088U, 24690741632U, - 24803739776U, 24916740736U, 25029740416U, 25142740864U, 25255741568U, - 25368741248U, 25481740672U, 25594741376U, 25707741568U, 25820741504U, - 25933730432U, 26046739072U, 26159741824U, 26272741504U, 26385740672U, - 26498740096U, 26611741568U, 26724740992U, 26837739904U, 26950735232U, - 27063738496U, 27176741248U, 27289741184U, 27402740864U, 27515740544U, - 27628737152U, 27741740672U, 27854741632U, 27967740544U, 28080739712U, - 28193738368U, 28306741376U, 28419737728U, 28532739968U, 28645739648U, - 28758740096U, 28871741312U, 28984739456U, 29097740416U, 29210740864U, - 29323741312U, 29436740224U, 29549741696U, 29662738304U, 29775741568U, - 29888741504U, 30001740928U, 30114737024U, 30227735168U, 30340737664U, - 30453738368U, 30566737024U, 30679733632U, 30792740224U, 30905740928U, - 31018740352U, 31131740032U, 31244738944U, 31357737344U, 31470741376U, - 31583740544U, 31696740224U, 31809738112U, 31922739328U, 32035737472U, - 32148740992U, 32261741696U, 32374740352U, 32487741824U, 32600740736U, - 32713739648U, 32826740608U, 32939729792U, 33052740992U, 33165740672U, - 33278739584U, 33391741312U, 33504739712U, 33617740928U, 33730740608U, - 33843738496U, 33956739968U, 34069741696U, 34182739328U, 34295741824U, - 34408739968U, 34521740672U, 34634736512U, 34747741568U, 34860741248U, - 34973739392U, 35086738304U, 35199741056U, 35312736896U, 35425741184U, - 35538741376U, 35651740288U, 35764737152U, 35877741184U, 35990739584U, - 36103740544U, 36216740992U, 36329739392U, 36442737536U, 36555741568U, - 36668740736U, 36781741184U, 36894737024U, 37007741312U, 37120739456U, - 37233741184U, 37346736256U, 37459736192U, 37572734336U, 37685739904U, - 37798740352U, 37911737728U, 38024741504U, 38137739648U, 38250740608U, - 38363741824U, 38476740992U, 38589741184U, 38702740096U, 38815741312U, - 38928741248U, 39041738368U, 39154739584U, 39267741824U, 39380739712U, - 39493735808U, 39606741632U, 39719741312U, 39832741504U, 39945739648U, - 40058740352U, 40171740032U, 40284740992U, 40397740672U, 40510740352U, - 40623740288U, 40736738176U, 40849737856U, 40962741376U, 41075739776U, - 41188737664U, 41301735808U, 41414738048U, 41527741312U, 41640740992U, - 41753739904U, 41866739072U, 41979738496U, 42092740736U, 42205739648U, - 42318740608U, 42431741312U, 42544738688U, 42657741184U, 42770738048U, - 42883741568U, 42996741248U, 43109740928U, 43222736512U, 43335741056U, - 43448730496U, 43561740416U, 43674741632U, 43787740544U, 43900741504U, - 44013739648U, 44126740864U, 44239740544U, 44352741248U, 44465738368U, - 44578735232U, 44691739264U, 44804741504U, 44917741696U, 45030741376U, - 45143741824U, 45256740992U, 45369739136U, 45482740096U, 45595739776U, - 45708739712U, 45821740672U, 45934741376U, 46047741056U, 46160741248U, - 46273737088U, 46386740864U, 46499739008U, 46612739968U, 46725735296U, - 46838740864U, 46951741568U, 47064737152U, 47177741696U, 47290741376U, - 47403738752U, 47516741248U, 47629739648U, 47742741632U, 47855737984U, - 47968740224U, 48081738368U, 48194741632U, 48307739264U, 48420739712U, - 48533739136U, 48646738304U, 48759741824U, 48872741504U, 48985739392U, - 49098741376U, 49211741056U, 49324740992U, 49437738368U, 49550740864U, - 49663735424U, 49776737408U, 49889740672U, 50002738816U, 50115738752U, - 50228739712U, 50341741696U, 50454736768U, 50567738752U, 50680739968U, - 50793736832U, 50906734976U, 51019741568U, 51132739456U, 51245741696U, - 51358741376U, 51471741056U, 51584738944U, 51697734272U, 51810739072U, - 51923736448U, 52036740736U, 52149741184U, 52262737024U, 52375738496U, - 52488740992U, 52601739136U, 52714740352U, 52827736448U, 52940738176U, - 53053741696U, 53166740864U, 53279741824U, 53392741504U, 53505739136U, - 53618739584U, 53731741312U, 53844741248U, 53957741696U, 54070741376U, - 54183740288U, 54296741504U, 54409741696U, 54522739072U, 54635737472U, - 54748741504U, 54861736064U, 54974740096U, 55087741568U, 55200733568U, - 55313741696U, 55426734464U, 55539741056U, 55652741504U, 55765741184U, - 55878741376U, 55991730304U, 56104740992U, 56217740672U, 56330731648U, - 56443737472U, 56556724352U, 56669740672U, 56782739072U, 56895740032U, - 57008741248U, 57121741696U, 57234740096U, 57347741312U, 57460741504U -}; - -// 500 Epochs worth of tabulated DAG sizes (~3.5 Years) - -// Generated with the following Mathematica Code: -// GetCacheSizes[n_] := Module[{ -// DAGSizeBytesInit = 2^30, -// MixBytes = 128, -// DAGGrowth = 113000000, -// HashBytes = 64, -// DAGParents = 1024, -// j = 0}, -// Reap[ -// While[j < n, -// Module[{i = Floor[(DAGSizeBytesInit + DAGGrowth * j) / (DAGParents * HashBytes)]}, -// While[! PrimeQ[i], i--]; -// Sow[i*HashBytes]; j++]]]][[2]][[1]] - -const size_t cache_sizes[] = { - 1048384U, 1158208U, 1268416U, 1377856U, 1489856U, 1599296U, 1710656U, - 1820608U, 1930816U, 2041024U, 2151872U, 2261696U, 2371904U, 2482624U, - 2593216U, 2703296U, 2814016U, 2924224U, 3034816U, 3144896U, 3255488U, - 3365312U, 3475904U, 3586624U, 3696064U, 3806272U, 3917504U, 4027456U, - 4138304U, 4248512U, 4359104U, 4469312U, 4579264U, 4689728U, 4797376U, - 4909888U, 5020096U, 5131328U, 5241664U, 5351744U, 5461312U, 5572544U, - 5683264U, 5793472U, 5903552U, 6014144U, 6121664U, 6235072U, 6344896U, - 6454592U, 6565952U, 6675904U, 6786112U, 6896704U, 7006784U, 7117888U, - 7228096U, 7338304U, 7448768U, 7557952U, 7669184U, 7779776U, 7889216U, - 8000192U, 8110912U, 8220736U, 8331712U, 8441536U, 8552384U, 8662592U, - 8772928U, 8883136U, 8993728U, 9103168U, 9214528U, 9323968U, 9434816U, - 9545152U, 9655616U, 9766336U, 9876544U, 9986624U, 10097344U, 10207424U, - 10316864U, 10427968U, 10538432U, 10649152U, 10758976U, 10869568U, 10979776U, - 11089472U, 11200832U, 11309632U, 11420608U, 11531584U, 11641792U, 11751104U, - 11862976U, 11973184U, 12083264U, 12193856U, 12304064U, 12414656U, 12524608U, - 12635072U, 12745792U, 12855616U, 12965824U, 13076416U, 13187008U, 13297216U, - 13407808U, 13518016U, 13627072U, 13738688U, 13848256U, 13959488U, 14069696U, - 14180288U, 14290624U, 14399552U, 14511424U, 14621504U, 14732096U, 14841664U, - 14951744U, 15062336U, 15172672U, 15283264U, 15393088U, 15504448U, 15614272U, - 15723712U, 15834944U, 15945152U, 16055744U, 16165696U, 16277056U, 16387136U, - 16494784U, 16607936U, 16718272U, 16828736U, 16938176U, 17048384U, 17159872U, - 17266624U, 17380544U, 17490496U, 17600192U, 17711296U, 17821376U, 17931968U, - 18041152U, 18152896U, 18261952U, 18373568U, 18483392U, 18594112U, 18703936U, - 18814912U, 18924992U, 19034944U, 19145408U, 19256128U, 19366208U, 19477184U, - 19587136U, 19696576U, 19808192U, 19916992U, 20028352U, 20137664U, 20249024U, - 20358848U, 20470336U, 20580544U, 20689472U, 20801344U, 20911424U, 21020096U, - 21130688U, 21242176U, 21352384U, 21462208U, 21573824U, 21683392U, 21794624U, - 21904448U, 22013632U, 22125248U, 22235968U, 22344512U, 22456768U, 22566848U, - 22677056U, 22786496U, 22897984U, 23008064U, 23118272U, 23228992U, 23338816U, - 23449408U, 23560256U, 23670464U, 23780672U, 23891264U, 24001216U, 24110656U, - 24221888U, 24332608U, 24442688U, 24552512U, 24662464U, 24773696U, 24884032U, - 24994496U, 25105216U, 25215296U, 25324864U, 25435712U, 25546432U, 25655744U, - 25767232U, 25876672U, 25986368U, 26098112U, 26207936U, 26318912U, 26428736U, - 26539712U, 26650048U, 26760256U, 26869184U, 26979776U, 27091136U, 27201728U, - 27311552U, 27422272U, 27532352U, 27642304U, 27752896U, 27863744U, 27973952U, - 28082752U, 28194752U, 28305344U, 28415168U, 28524992U, 28636352U, 28746304U, - 28857152U, 28967104U, 29077184U, 29187904U, 29298496U, 29408576U, 29518912U, - 29628992U, 29739968U, 29850176U, 29960512U, 30070336U, 30180544U, 30290752U, - 30398912U, 30512192U, 30622784U, 30732992U, 30842176U, 30953536U, 31063744U, - 31174336U, 31284544U, 31395136U, 31504448U, 31615552U, 31725632U, 31835072U, - 31946176U, 32057024U, 32167232U, 32277568U, 32387008U, 32497984U, 32608832U, - 32719168U, 32829376U, 32939584U, 33050048U, 33160768U, 33271232U, 33381184U, - 33491648U, 33601856U, 33712576U, 33822016U, 33932992U, 34042816U, 34153024U, - 34263104U, 34373824U, 34485056U, 34594624U, 34704832U, 34816064U, 34926272U, - 35036224U, 35146816U, 35255104U, 35367104U, 35478208U, 35588416U, 35698496U, - 35808832U, 35918656U, 36029888U, 36139456U, 36250688U, 36360512U, 36471104U, - 36581696U, 36691136U, 36802112U, 36912448U, 37022912U, 37132864U, 37242944U, - 37354048U, 37464512U, 37574848U, 37684928U, 37794752U, 37904704U, 38015552U, - 38125888U, 38236864U, 38345792U, 38457152U, 38567744U, 38678336U, 38787776U, - 38897216U, 39009088U, 39117632U, 39230144U, 39340352U, 39450304U, 39560384U, - 39671488U, 39781312U, 39891392U, 40002112U, 40112704U, 40223168U, 40332608U, - 40443968U, 40553792U, 40664768U, 40774208U, 40884416U, 40993984U, 41105984U, - 41215424U, 41326528U, 41436992U, 41546048U, 41655872U, 41768128U, 41878336U, - 41988928U, 42098752U, 42209344U, 42319168U, 42429248U, 42540352U, 42649792U, - 42761024U, 42871616U, 42981824U, 43092032U, 43201856U, 43312832U, 43423552U, - 43533632U, 43643584U, 43753792U, 43864384U, 43974976U, 44084032U, 44195392U, - 44306368U, 44415296U, 44526016U, 44637248U, 44746816U, 44858048U, 44967872U, - 45078848U, 45188288U, 45299264U, 45409216U, 45518272U, 45630272U, 45740224U, - 45850432U, 45960896U, 46069696U, 46182208U, 46292416U, 46402624U, 46512064U, - 46623296U, 46733888U, 46843712U, 46953664U, 47065024U, 47175104U, 47285696U, - 47395904U, 47506496U, 47615296U, 47726912U, 47837632U, 47947712U, 48055232U, - 48168128U, 48277952U, 48387392U, 48499648U, 48609472U, 48720064U, 48830272U, - 48940096U, 49050944U, 49160896U, 49271744U, 49381568U, 49492288U, 49602752U, - 49712576U, 49822016U, 49934272U, 50042816U, 50154304U, 50264128U, 50374336U, - 50484416U, 50596288U, 50706752U, 50816704U, 50927168U, 51035456U, 51146944U, - 51258176U, 51366976U, 51477824U, 51589568U, 51699776U, 51809728U, 51920576U, - 52030016U, 52140736U, 52251328U, 52361152U, 52470592U, 52582592U, 52691776U, - 52803136U, 52912576U, 53020736U, 53132224U, 53242688U, 53354816U, 53465536U, - 53575232U, 53685568U, 53796544U, 53906752U, 54016832U, 54126656U, 54236992U, - 54347456U, 54457408U, 54569024U, 54679232U, 54789184U, 54899776U, 55008832U, - 55119296U, 55231168U, 55341248U, 55451584U, 55562048U, 55672256U, 55782208U, - 55893184U, 56002112U, 56113216U -}; - -#ifdef __cplusplus -} -#endif
\ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/node-ethash/binding.gyp b/Godeps/_workspace/src/github.com/ethereum/ethash/node-ethash/binding.gyp deleted file mode 100644 index 642c33cb3..000000000 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/node-ethash/binding.gyp +++ /dev/null @@ -1,29 +0,0 @@ -{ - "targets": - [{ - "target_name": "ethash", - "sources": [ - './ethash.cc', - '../libethash/ethash.h', - '../libethash/util.c', - '../libethash/util.h', - '../libethash/blum_blum_shub.h', - '../libethash/blum_blum_shub.c', - '../libethash/sha3.h', - '../libethash/sha3.c', - '../libethash/internal.h', - '../libethash/internal.c' - ], - "include_dirs": [ - "../", - "<!(node -e \"require('nan')\")" - ], - "cflags": [ - "-Wall", - "-Wno-maybe-uninitialized", - "-Wno-uninitialized", - "-Wno-unused-function", - "-Wextra" - ] - }] -} diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/node-ethash/ethash.cc b/Godeps/_workspace/src/github.com/ethereum/ethash/node-ethash/ethash.cc deleted file mode 100644 index 6ab9730be..000000000 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/node-ethash/ethash.cc +++ /dev/null @@ -1,587 +0,0 @@ -#include <nan.h> -#include <iostream> -#include <node.h> -#include <stdint.h> -#include <stdlib.h> -#include "../libethash/ethash.h" - -using namespace v8; - -class EthashValidator : public NanAsyncWorker { - public: - // Constructor - EthashValidator(NanCallback *callback, const unsigned blocknumber, const unsigned char * seed) - : NanAsyncWorker(callback), blocknumber(blocknumber), seed(seed) {} - // Destructor - ~EthashValidator() { - free(this->cache); - free(this->params); - } - - // Executed inside the worker-thread. - // It is not safe to access V8, or V8 data structures - // here, so everything we need for input and output - // should go on `this`. - void Execute () { - - /* this->result = secp256k1_ecdsa_sign(this->msg, this->sig , &this->sig_len, this->pk, NULL, NULL); */ - } - - // Executed when the async work is complete - // this function will be run inside the main event loop - // so it is safe to use V8 again - void HandleOKCallback () { - NanScope(); - Handle<Value> argv[] = { - NanNew<Number>(this->result) - }; - callback->Call(2, argv); - } - - protected: - const unsigned blocknumber; - const unsigned char * seed; - ethash_params * params; - ethash_cache * cache; - bool result; - bool ready = 0; -}; - -/* class CompactSignWorker : public SignWorker { */ -/* public: */ -/* CompactSignWorker(NanCallback *callback, const unsigned char *msg, const unsigned char *pk ) */ -/* : SignWorker(callback, msg, pk){} */ - -/* void Execute () { */ -/* this->result = secp256k1_ecdsa_sign_compact(this->msg, this->sig , this->pk, NULL, NULL, &this->sig_len); */ -/* } */ - -/* void HandleOKCallback () { */ -/* NanScope(); */ -/* Handle<Value> argv[] = { */ -/* NanNew<Number>(this->result), */ -/* NanNewBufferHandle((char *)this->sig, 64), */ -/* NanNew<Number>(this->sig_len) */ -/* }; */ -/* callback->Call(3, argv); */ -/* } */ -/* }; */ - -/* class RecoverWorker : public NanAsyncWorker { */ -/* public: */ -/* // Constructor */ -/* RecoverWorker(NanCallback *callback, const unsigned char *msg, const unsigned char *sig, int compressed, int rec_id) */ -/* : NanAsyncWorker(callback), msg(msg), sig(sig), compressed(compressed), rec_id(rec_id) {} */ -/* // Destructor */ -/* ~RecoverWorker() {} */ - -/* void Execute () { */ -/* if(this->compressed == 1){ */ -/* this->pubkey = new unsigned char[33]; */ -/* }else{ */ -/* this->pubkey = new unsigned char[65]; */ -/* } */ - -/* this->result = secp256k1_ecdsa_recover_compact(this->msg, this->sig, this->pubkey, &this->pubkey_len, this->compressed, this->rec_id); */ -/* } */ - -/* void HandleOKCallback () { */ -/* NanScope(); */ -/* Handle<Value> argv[] = { */ -/* NanNew<Number>(this->result), */ -/* NanNewBufferHandle((char *)this->pubkey, this->pubkey_len) */ -/* }; */ -/* callback->Call(2, argv); */ -/* } */ - -/* protected: */ -/* const unsigned char * msg; */ -/* const unsigned char * sig; */ -/* int compressed; */ -/* int rec_id; */ -/* int result; */ -/* unsigned char * pubkey; */ -/* int pubkey_len; */ -/* }; */ - -/* class VerifyWorker : public NanAsyncWorker { */ -/* public: */ -/* // Constructor */ -/* VerifyWorker(NanCallback *callback, const unsigned char *msg, const unsigned char *sig, int sig_len, const unsigned char *pub_key, int pub_key_len) */ -/* : NanAsyncWorker(callback), msg(msg), sig(sig), sig_len(sig_len), pub_key(pub_key), pub_key_len(pub_key_len) {} */ -/* // Destructor */ -/* ~VerifyWorker() {} */ - -/* void Execute () { */ -/* this->result = secp256k1_ecdsa_verify(this->msg, this->sig, this->sig_len, this->pub_key, this->pub_key_len); */ -/* } */ - -/* void HandleOKCallback () { */ -/* NanScope(); */ -/* Handle<Value> argv[] = { */ -/* NanNew<Number>(this->result), */ -/* }; */ -/* callback->Call(1, argv); */ -/* } */ - -/* protected: */ -/* int result; */ -/* const unsigned char * msg; */ -/* const unsigned char * sig; */ -/* int sig_len; */ -/* const unsigned char * pub_key; */ -/* int pub_key_len; */ -/* }; */ - -/* NAN_METHOD(Verify){ */ -/* NanScope(); */ - -/* Local<Object> pub_buf = args[0].As<Object>(); */ -/* const unsigned char *pub_data = (unsigned char *) node::Buffer::Data(pub_buf); */ -/* int pub_len = node::Buffer::Length(args[0]); */ - -/* Local<Object> msg_buf = args[1].As<Object>(); */ -/* const unsigned char *msg_data = (unsigned char *) node::Buffer::Data(msg_buf); */ - -/* Local<Object> sig_buf = args[2].As<Object>(); */ -/* const unsigned char *sig_data = (unsigned char *) node::Buffer::Data(sig_buf); */ -/* int sig_len = node::Buffer::Length(args[2]); */ - -/* int result = secp256k1_ecdsa_verify(msg_data, sig_data, sig_len, pub_data, pub_len ); */ - -/* NanReturnValue(NanNew<Number>(result)); */ -/* } */ - -/* NAN_METHOD(Verify_Async){ */ -/* NanScope(); */ - -/* Local<Object> pub_buf = args[0].As<Object>(); */ -/* const unsigned char *pub_data = (unsigned char *) node::Buffer::Data(pub_buf); */ -/* int pub_len = node::Buffer::Length(args[0]); */ - -/* Local<Object> msg_buf = args[1].As<Object>(); */ -/* const unsigned char *msg_data = (unsigned char *) node::Buffer::Data(msg_buf); */ - -/* Local<Object> sig_buf = args[2].As<Object>(); */ -/* const unsigned char *sig_data = (unsigned char *) node::Buffer::Data(sig_buf); */ -/* int sig_len = node::Buffer::Length(args[2]); */ - -/* Local<Function> callback = args[3].As<Function>(); */ -/* NanCallback* nanCallback = new NanCallback(callback); */ - -/* VerifyWorker* worker = new VerifyWorker(nanCallback, msg_data, sig_data, sig_len, pub_data, pub_len); */ -/* NanAsyncQueueWorker(worker); */ - -/* NanReturnUndefined(); */ -/* } */ - -/* NAN_METHOD(Sign){ */ -/* NanScope(); */ - -/* //the first argument should be the private key as a buffer */ -/* Local<Object> pk_buf = args[0].As<Object>(); */ -/* const unsigned char *pk_data = (unsigned char *) node::Buffer::Data(pk_buf); */ -/* int sec_len = node::Buffer::Length(args[0]); */ -/* //the second argument is the message that we are signing */ -/* Local<Object> msg_buf = args[1].As<Object>(); */ -/* const unsigned char *msg_data = (unsigned char *) node::Buffer::Data(msg_buf); */ - -/* unsigned char sig[72]; */ -/* int sig_len = 72; */ -/* int msg_len = node::Buffer::Length(args[1]); */ - -/* if(sec_len != 32){ */ -/* return NanThrowError("the secret key needs tobe 32 bytes"); */ -/* } */ - -/* if(msg_len == 0){ */ -/* return NanThrowError("messgae cannot be null"); */ -/* } */ - -/* int result = secp256k1_ecdsa_sign(msg_data, sig , &sig_len, pk_data, NULL, NULL); */ - -/* if(result == 1){ */ -/* NanReturnValue(NanNewBufferHandle((char *)sig, sig_len)); */ -/* }else{ */ -/* return NanThrowError("nonce invalid, try another one"); */ -/* } */ -/* } */ - -/* NAN_METHOD(Sign_Async){ */ - -/* NanScope(); */ -/* //the first argument should be the private key as a buffer */ -/* Local<Object> sec_buf = args[0].As<Object>(); */ -/* const unsigned char *sec_data = (unsigned char *) node::Buffer::Data(sec_buf); */ -/* int sec_len = node::Buffer::Length(args[0]); */ -/* //the second argument is the message that we are signing */ -/* Local<Object> msg_buf = args[1].As<Object>(); */ -/* const unsigned char *msg_data = (unsigned char *) node::Buffer::Data(msg_buf); */ - -/* Local<Function> callback = args[2].As<Function>(); */ -/* NanCallback* nanCallback = new NanCallback(callback); */ - -/* int msg_len = node::Buffer::Length(args[1]); */ - -/* if(sec_len != 32){ */ -/* return NanThrowError("the secret key needs tobe 32 bytes"); */ -/* } */ - -/* if(msg_len == 0){ */ -/* return NanThrowError("messgae cannot be null"); */ -/* } */ - -/* SignWorker* worker = new SignWorker(nanCallback, msg_data, sec_data); */ -/* NanAsyncQueueWorker(worker); */ - -/* NanReturnUndefined(); */ -/* } */ - -/* NAN_METHOD(Sign_Compact){ */ - -/* NanScope(); */ - -/* Local<Object> seckey_buf = args[0].As<Object>(); */ -/* const unsigned char *seckey_data = (unsigned char *) node::Buffer::Data(seckey_buf); */ -/* int sec_len = node::Buffer::Length(args[0]); */ - -/* Local<Object> msg_buf = args[1].As<Object>(); */ -/* const unsigned char *msg_data = (unsigned char *) node::Buffer::Data(msg_buf); */ -/* int msg_len = node::Buffer::Length(args[1]); */ - -/* if(sec_len != 32){ */ -/* return NanThrowError("the secret key needs tobe 32 bytes"); */ -/* } */ - -/* if(msg_len == 0){ */ -/* return NanThrowError("messgae cannot be null"); */ -/* } */ - -/* unsigned char sig[64]; */ -/* int rec_id; */ - -/* //TODO: change the nonce */ -/* int valid_nonce = secp256k1_ecdsa_sign_compact(msg_data, sig, seckey_data, NULL, NULL, &rec_id ); */ - -/* Local<Array> array = NanNew<Array>(3); */ -/* array->Set(0, NanNew<Integer>(valid_nonce)); */ -/* array->Set(1, NanNew<Integer>(rec_id)); */ -/* array->Set(2, NanNewBufferHandle((char *)sig, 64)); */ - -/* NanReturnValue(array); */ -/* } */ - -/* NAN_METHOD(Sign_Compact_Async){ */ -/* NanScope(); */ -/* //the first argument should be the private key as a buffer */ -/* Local<Object> sec_buf = args[0].As<Object>(); */ -/* const unsigned char *sec_data = (unsigned char *) node::Buffer::Data(sec_buf); */ -/* int sec_len = node::Buffer::Length(args[0]); */ - -/* //the second argument is the message that we are signing */ -/* Local<Object> msg_buf = args[1].As<Object>(); */ -/* const unsigned char *msg_data = (unsigned char *) node::Buffer::Data(msg_buf); */ - - -/* Local<Function> callback = args[2].As<Function>(); */ -/* NanCallback* nanCallback = new NanCallback(callback); */ - -/* int msg_len = node::Buffer::Length(args[1]); */ - -/* if(sec_len != 32){ */ -/* return NanThrowError("the secret key needs tobe 32 bytes"); */ -/* } */ - -/* if(msg_len == 0){ */ -/* return NanThrowError("messgae cannot be null"); */ -/* } */ - -/* CompactSignWorker* worker = new CompactSignWorker(nanCallback, msg_data, sec_data); */ -/* NanAsyncQueueWorker(worker); */ - -/* NanReturnUndefined(); */ -/* } */ - -/* NAN_METHOD(Recover_Compact){ */ - -/* NanScope(); */ - -/* Local<Object> msg_buf = args[0].As<Object>(); */ -/* const unsigned char *msg = (unsigned char *) node::Buffer::Data(msg_buf); */ -/* int msg_len = node::Buffer::Length(args[0]); */ - -/* Local<Object> sig_buf = args[1].As<Object>(); */ -/* const unsigned char *sig = (unsigned char *) node::Buffer::Data(sig_buf); */ - -/* Local<Number> compressed = args[2].As<Number>(); */ -/* int int_compressed = compressed->IntegerValue(); */ - -/* Local<Number> rec_id = args[3].As<Number>(); */ -/* int int_rec_id = rec_id->IntegerValue(); */ - -/* if(msg_len == 0){ */ -/* return NanThrowError("messgae cannot be null"); */ -/* } */ - -/* unsigned char pubKey[65]; */ - -/* int pubKeyLen; */ - -/* int result = secp256k1_ecdsa_recover_compact(msg, sig, pubKey, &pubKeyLen, int_compressed, int_rec_id); */ -/* if(result == 1){ */ -/* NanReturnValue(NanNewBufferHandle((char *)pubKey, pubKeyLen)); */ -/* }else{ */ - -/* NanReturnValue(NanFalse()); */ -/* } */ -/* } */ - -/* NAN_METHOD(Recover_Compact_Async){ */ - -/* NanScope(); */ - -/* //the message */ -/* Local<Object> msg_buf = args[0].As<Object>(); */ -/* const unsigned char *msg = (unsigned char *) node::Buffer::Data(msg_buf); */ -/* int msg_len = node::Buffer::Length(args[0]); */ - -/* //the signature length */ -/* Local<Object> sig_buf = args[1].As<Object>(); */ -/* const unsigned char *sig = (unsigned char *) node::Buffer::Data(sig_buf); */ -/* //todo sig len needs tobe 64 */ -/* int sig_len = node::Buffer::Length(args[1]); */ - -/* //to compress or not? */ -/* Local<Number> compressed = args[2].As<Number>(); */ -/* int int_compressed = compressed->IntegerValue(); */ - -/* //the rec_id */ -/* Local<Number> rec_id = args[3].As<Number>(); */ -/* int int_rec_id = rec_id->IntegerValue(); */ - -/* //the callback */ -/* Local<Function> callback = args[4].As<Function>(); */ -/* NanCallback* nanCallback = new NanCallback(callback); */ - -/* if(sig_len != 64){ */ -/* return NanThrowError("the signature needs to be 64 bytes"); */ -/* } */ - -/* if(msg_len == 0){ */ -/* return NanThrowError("messgae cannot be null"); */ -/* } */ - -/* RecoverWorker* worker = new RecoverWorker(nanCallback, msg, sig, int_compressed, int_rec_id); */ -/* NanAsyncQueueWorker(worker); */ - -/* NanReturnUndefined(); */ -/* } */ - -/* NAN_METHOD(Seckey_Verify){ */ -/* NanScope(); */ - -/* const unsigned char *data = (const unsigned char*) node::Buffer::Data(args[0]); */ -/* int result = secp256k1_ec_seckey_verify(data); */ -/* NanReturnValue(NanNew<Number>(result)); */ -/* } */ - -/* NAN_METHOD(Pubkey_Verify){ */ - -/* NanScope(); */ - -/* Local<Object> pub_buf = args[0].As<Object>(); */ -/* const unsigned char *pub_key = (unsigned char *) node::Buffer::Data(pub_buf); */ -/* int pub_key_len = node::Buffer::Length(args[0]); */ - -/* int result = secp256k1_ec_pubkey_verify(pub_key, pub_key_len); */ - -/* NanReturnValue(NanNew<Number>(result)); */ -/* } */ - -/* NAN_METHOD(Pubkey_Create){ */ -/* NanScope(); */ - -/* Handle<Object> pk_buf = args[0].As<Object>(); */ -/* const unsigned char *pk_data = (unsigned char *) node::Buffer::Data(pk_buf); */ -/* int pk_len = node::Buffer::Length(args[0]); */ - -/* Local<Number> l_compact = args[1].As<Number>(); */ -/* int compact = l_compact->IntegerValue(); */ -/* int pubKeyLen; */ - -/* if(pk_len != 32){ */ -/* return NanThrowError("the secert key need to be 32 bytes"); */ -/* } */ - -/* unsigned char *pubKey; */ -/* if(compact == 1){ */ -/* pubKey = new unsigned char[33]; */ -/* }else{ */ -/* pubKey = new unsigned char[65]; */ -/* } */ - -/* int results = secp256k1_ec_pubkey_create(pubKey,&pubKeyLen, pk_data, compact ); */ -/* if(results == 0){ */ -/* return NanThrowError("secret was invalid, try again."); */ -/* }else{ */ -/* NanReturnValue(NanNewBufferHandle((char *)pubKey, pubKeyLen)); */ -/* } */ -/* } */ - -/* NAN_METHOD(Pubkey_Decompress){ */ -/* NanScope(); */ - -/* //the first argument should be the private key as a buffer */ -/* Local<Object> pk_buf = args[0].As<Object>(); */ -/* unsigned char *pk_data = (unsigned char *) node::Buffer::Data(pk_buf); */ - -/* int pk_len = node::Buffer::Length(args[0]); */ - -/* int results = secp256k1_ec_pubkey_decompress(pk_data, &pk_len); */ - -/* if(results == 0){ */ -/* return NanThrowError("invalid public key"); */ -/* }else{ */ -/* NanReturnValue(NanNewBufferHandle((char *)pk_data, pk_len)); */ -/* } */ -/* } */ - - -/* NAN_METHOD(Privkey_Import){ */ -/* NanScope(); */ - -/* //the first argument should be the private key as a buffer */ -/* Handle<Object> pk_buf = args[0].As<Object>(); */ -/* const unsigned char *pk_data = (unsigned char *) node::Buffer::Data(pk_buf); */ - -/* int pk_len = node::Buffer::Length(args[0]); */ - -/* unsigned char sec_key[32]; */ -/* int results = secp256k1_ec_privkey_import(sec_key, pk_data, pk_len); */ - -/* if(results == 0){ */ -/* return NanThrowError("invalid private key"); */ -/* }else{ */ -/* NanReturnValue(NanNewBufferHandle((char *)sec_key, 32)); */ -/* } */ -/* } */ - -/* NAN_METHOD(Privkey_Export){ */ -/* NanScope(); */ - -/* //the first argument should be the private key as a buffer */ -/* Handle<Object> sk_buf = args[0].As<Object>(); */ -/* const unsigned char *sk_data = (unsigned char *) node::Buffer::Data(sk_buf); */ - -/* Local<Number> l_compressed = args[1].As<Number>(); */ -/* int compressed = l_compressed->IntegerValue(); */ - -/* unsigned char *privKey; */ -/* int pk_len; */ -/* int results = secp256k1_ec_privkey_export(sk_data, privKey, &pk_len, compressed); */ -/* if(results == 0){ */ -/* return NanThrowError("invalid private key"); */ -/* }else{ */ -/* NanReturnValue(NanNewBufferHandle((char *)privKey, pk_len)); */ -/* } */ -/* } */ - -/* NAN_METHOD(Privkey_Tweak_Add){ */ -/* NanScope(); */ - -/* //the first argument should be the private key as a buffer */ -/* Handle<Object> sk_buf = args[0].As<Object>(); */ -/* unsigned char *sk = (unsigned char *) node::Buffer::Data(sk_buf); */ - -/* Handle<Object> tweak_buf = args[1].As<Object>(); */ -/* const unsigned char *tweak= (unsigned char *) node::Buffer::Data(tweak_buf); */ - -/* int results = secp256k1_ec_privkey_tweak_add(sk, tweak); */ -/* if(results == 0){ */ -/* return NanThrowError("invalid key"); */ -/* }else{ */ -/* NanReturnValue(NanNewBufferHandle((char *)sk, 32)); */ -/* } */ -/* } */ - -/* NAN_METHOD(Privkey_Tweak_Mul){ */ -/* NanScope(); */ - -/* //the first argument should be the private key as a buffer */ -/* Handle<Object> sk_buf = args[0].As<Object>(); */ -/* unsigned char *sk = (unsigned char *) node::Buffer::Data(sk_buf); */ - -/* Handle<Object> tweak_buf = args[1].As<Object>(); */ -/* const unsigned char *tweak= (unsigned char *) node::Buffer::Data(tweak_buf); */ - -/* int results = secp256k1_ec_privkey_tweak_mul(sk, tweak); */ -/* if(results == 0){ */ -/* return NanThrowError("invalid key"); */ -/* }else{ */ -/* NanReturnValue(NanNewBufferHandle((char *)sk, 32)); */ -/* } */ -/* } */ - -/* NAN_METHOD(Pubkey_Tweak_Add){ */ -/* NanScope(); */ - -/* //the first argument should be the private key as a buffer */ -/* Handle<Object> pk_buf = args[0].As<Object>(); */ -/* unsigned char *pk = (unsigned char *) node::Buffer::Data(pk_buf); */ -/* int pk_len = node::Buffer::Length(args[0]); */ - -/* Handle<Object> tweak_buf = args[1].As<Object>(); */ -/* const unsigned char *tweak= (unsigned char *) node::Buffer::Data(tweak_buf); */ - -/* int results = secp256k1_ec_pubkey_tweak_add(pk, pk_len, tweak); */ -/* if(results == 0){ */ -/* return NanThrowError("invalid key"); */ -/* }else{ */ -/* NanReturnValue(NanNewBufferHandle((char *)pk, pk_len)); */ -/* } */ -/* } */ - -/* NAN_METHOD(Pubkey_Tweak_Mul){ */ -/* NanScope(); */ - -/* //the first argument should be the private key as a buffer */ -/* Handle<Object> pk_buf = args[0].As<Object>(); */ -/* unsigned char *pk = (unsigned char *) node::Buffer::Data(pk_buf); */ -/* int pk_len = node::Buffer::Length(args[0]); */ - -/* Handle<Object> tweak_buf = args[1].As<Object>(); */ -/* const unsigned char *tweak= (unsigned char *) node::Buffer::Data(tweak_buf); */ - -/* int results = secp256k1_ec_pubkey_tweak_mul(pk, pk_len, tweak); */ -/* if(results == 0){ */ -/* return NanThrowError("invalid key"); */ -/* }else{ */ -/* NanReturnValue(NanNewBufferHandle((char *)pk, pk_len)); */ -/* } */ -/* } */ - -void Init(Handle<Object> exports) { - - /* secp256k1_start(SECP256K1_START_SIGN | SECP256K1_START_VERIFY); */ - /* exports->Set(NanNew("seckeyVerify"), NanNew<FunctionTemplate>(Seckey_Verify)->GetFunction()); */ - /* exports->Set(NanNew("sign"), NanNew<FunctionTemplate>(Sign)->GetFunction()); */ - /* exports->Set(NanNew("signAsync"), NanNew<FunctionTemplate>(Sign_Async)->GetFunction()); */ - /* exports->Set(NanNew("signCompact"), NanNew<FunctionTemplate>(Sign_Compact)->GetFunction()); */ - /* exports->Set(NanNew("signCompactAsync"), NanNew<FunctionTemplate>(Sign_Compact_Async)->GetFunction()); */ - /* exports->Set(NanNew("recoverCompact"), NanNew<FunctionTemplate>(Recover_Compact)->GetFunction()); */ - /* exports->Set(NanNew("recoverCompactAsync"), NanNew<FunctionTemplate>(Recover_Compact_Async)->GetFunction()); */ - /* exports->Set(NanNew("verify"), NanNew<FunctionTemplate>(Verify)->GetFunction()); */ - /* exports->Set(NanNew("verifyAsync"), NanNew<FunctionTemplate>(Verify_Async)->GetFunction()); */ - /* exports->Set(NanNew("secKeyVerify"), NanNew<FunctionTemplate>(Seckey_Verify)->GetFunction()); */ - /* exports->Set(NanNew("pubKeyVerify"), NanNew<FunctionTemplate>(Pubkey_Verify)->GetFunction()); */ - /* exports->Set(NanNew("pubKeyCreate"), NanNew<FunctionTemplate>(Pubkey_Create)->GetFunction()); */ - /* exports->Set(NanNew("pubKeyDecompress"), NanNew<FunctionTemplate>(Pubkey_Decompress)->GetFunction()); */ - /* exports->Set(NanNew("privKeyExport"), NanNew<FunctionTemplate>(Privkey_Export)->GetFunction()); */ - /* exports->Set(NanNew("privKeyImport"), NanNew<FunctionTemplate>(Privkey_Import)->GetFunction()); */ - /* exports->Set(NanNew("privKeyTweakAdd"), NanNew<FunctionTemplate>(Privkey_Tweak_Add)->GetFunction()); */ - /* exports->Set(NanNew("privKeyTweakMul"), NanNew<FunctionTemplate>(Privkey_Tweak_Mul)->GetFunction()); */ - /* exports->Set(NanNew("pubKeyTweakAdd"), NanNew<FunctionTemplate>(Privkey_Tweak_Add)->GetFunction()); */ - /* exports->Set(NanNew("pubKeyTweakMul"), NanNew<FunctionTemplate>(Privkey_Tweak_Mul)->GetFunction()); */ -} - -NODE_MODULE(secp256k1, Init) diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/node-ethash/package.json b/Godeps/_workspace/src/github.com/ethereum/ethash/node-ethash/package.json deleted file mode 100644 index 690ea3263..000000000 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/node-ethash/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "node-ethash", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "install": "node-gyp rebuild" - }, - "author": "", - "license": "ISC", - "gypfile": true -} diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/node-ethash/readme.md b/Godeps/_workspace/src/github.com/ethereum/ethash/node-ethash/readme.md deleted file mode 100644 index bb46cdd6e..000000000 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/node-ethash/readme.md +++ /dev/null @@ -1,12 +0,0 @@ -# To Develop -`npm install -g node-gyp` -`npm install .` - - -# To rebuild -`node-gyp rebuild` - - -# notes - -nan is good https://github.com/rvagg/nan diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/pyethash/.gitignore b/Godeps/_workspace/src/github.com/ethereum/ethash/pyethash/.gitignore new file mode 100644 index 000000000..e1374b866 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/pyethash/.gitignore @@ -0,0 +1,2 @@ +pyethash.egg-info/ +*.so diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/pyethash/__init__.py b/Godeps/_workspace/src/github.com/ethereum/ethash/pyethash/__init__.py new file mode 100644 index 000000000..fca037dba --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/pyethash/__init__.py @@ -0,0 +1,3 @@ +import pyethash.core +core = pyethash.core +EPOCH_LENGTH = 30000 diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/setup.py b/Godeps/_workspace/src/github.com/ethereum/ethash/setup.py new file mode 100644 index 000000000..4e27aad6c --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/setup.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +from distutils.core import setup, Extension + +pyethash_core = Extension('pyethash.core', + sources = [ + 'src/python/core.c', + 'src/libethash/util.c', + 'src/libethash/internal.c', + 'src/libethash/sha3.c' + ], + extra_compile_args = ["-std=gnu99"]) + +setup ( + name = 'pyethash', + author = "Matthew Wampler-Doty", + author_email = "matthew.wampler.doty@gmail.com", + license = 'GPL', + version = '1.0', + description = 'Python wrappers for ethash, the ethereum proof of work hashing function', + ext_modules = [pyethash_core], + ) diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/benchmark/CMakeLists.txt b/Godeps/_workspace/src/github.com/ethereum/ethash/src/benchmark/CMakeLists.txt index e6ba85790..e6ba85790 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/benchmark/CMakeLists.txt +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/benchmark/CMakeLists.txt diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/benchmark/benchmark.cpp b/Godeps/_workspace/src/github.com/ethereum/ethash/src/benchmark/benchmark.cpp index 4c8f700c5..4c8f700c5 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/benchmark/benchmark.cpp +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/benchmark/benchmark.cpp diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/CMakeLists.txt b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/CMakeLists.txt new file mode 100644 index 000000000..fe563aae4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/CMakeLists.txt @@ -0,0 +1,15 @@ +set(LIBRARY ethash-cl) +set(CMAKE_BUILD_TYPE Release) + +include(bin2h.cmake) +bin2h(SOURCE_FILE ethash_cl_miner_kernel.cl VARIABLE_NAME ethash_cl_miner_kernel HEADER_FILE ${CMAKE_CURRENT_BINARY_DIR}/ethash_cl_miner_kernel.h) + +if (NOT OpenCL_FOUND) + find_package(OpenCL) +endif() +if (OpenCL_FOUND) + include_directories(${OpenCL_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}) + include_directories(..) + add_library(${LIBRARY} ethash_cl_miner.cpp ethash_cl_miner.h) + TARGET_LINK_LIBRARIES(${LIBRARY} ${OpenCL_LIBRARIES} ethash) +endif() diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/bin2h.cmake b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/bin2h.cmake new file mode 100644 index 000000000..e224c1a67 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/bin2h.cmake @@ -0,0 +1,87 @@ +# https://gist.github.com/sivachandran/3a0de157dccef822a230 +include(CMakeParseArguments) + +# Function to wrap a given string into multiple lines at the given column position. +# Parameters: +# VARIABLE - The name of the CMake variable holding the string. +# AT_COLUMN - The column position at which string will be wrapped. +function(WRAP_STRING) + set(oneValueArgs VARIABLE AT_COLUMN) + cmake_parse_arguments(WRAP_STRING "${options}" "${oneValueArgs}" "" ${ARGN}) + + string(LENGTH ${${WRAP_STRING_VARIABLE}} stringLength) + math(EXPR offset "0") + + while(stringLength GREATER 0) + + if(stringLength GREATER ${WRAP_STRING_AT_COLUMN}) + math(EXPR length "${WRAP_STRING_AT_COLUMN}") + else() + math(EXPR length "${stringLength}") + endif() + + string(SUBSTRING ${${WRAP_STRING_VARIABLE}} ${offset} ${length} line) + set(lines "${lines}\n${line}") + + math(EXPR stringLength "${stringLength} - ${length}") + math(EXPR offset "${offset} + ${length}") + endwhile() + + set(${WRAP_STRING_VARIABLE} "${lines}" PARENT_SCOPE) +endfunction() + +# Function to embed contents of a file as byte array in C/C++ header file(.h). The header file +# will contain a byte array and integer variable holding the size of the array. +# Parameters +# SOURCE_FILE - The path of source file whose contents will be embedded in the header file. +# VARIABLE_NAME - The name of the variable for the byte array. The string "_SIZE" will be append +# to this name and will be used a variable name for size variable. +# HEADER_FILE - The path of header file. +# APPEND - If specified appends to the header file instead of overwriting it +# NULL_TERMINATE - If specified a null byte(zero) will be append to the byte array. This will be +# useful if the source file is a text file and we want to use the file contents +# as string. But the size variable holds size of the byte array without this +# null byte. +# Usage: +# bin2h(SOURCE_FILE "Logo.png" HEADER_FILE "Logo.h" VARIABLE_NAME "LOGO_PNG") +function(BIN2H) + set(options APPEND NULL_TERMINATE) + set(oneValueArgs SOURCE_FILE VARIABLE_NAME HEADER_FILE) + cmake_parse_arguments(BIN2H "${options}" "${oneValueArgs}" "" ${ARGN}) + + # reads source file contents as hex string + file(READ ${BIN2H_SOURCE_FILE} hexString HEX) + string(LENGTH ${hexString} hexStringLength) + + # appends null byte if asked + if(BIN2H_NULL_TERMINATE) + set(hexString "${hexString}00") + endif() + + # wraps the hex string into multiple lines at column 32(i.e. 16 bytes per line) + wrap_string(VARIABLE hexString AT_COLUMN 32) + math(EXPR arraySize "${hexStringLength} / 2") + + # adds '0x' prefix and comma suffix before and after every byte respectively + string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1, " arrayValues ${hexString}) + # removes trailing comma + string(REGEX REPLACE ", $" "" arrayValues ${arrayValues}) + + # converts the variable name into proper C identifier + # TODO: fix for legacy cmake + IF (${CMAKE_VERSION} GREATER 2.8.10) + string(MAKE_C_IDENTIFIER "${BIN2H_VARIABLE_NAME}" BIN2H_VARIABLE_NAME) + ENDIF() + string(TOUPPER "${BIN2H_VARIABLE_NAME}" BIN2H_VARIABLE_NAME) + + # declares byte array and the length variables + set(arrayDefinition "const unsigned char ${BIN2H_VARIABLE_NAME}[] = { ${arrayValues} };") + set(arraySizeDefinition "const size_t ${BIN2H_VARIABLE_NAME}_SIZE = ${arraySize};") + + set(declarations "${arrayDefinition}\n\n${arraySizeDefinition}\n\n") + if(BIN2H_APPEND) + file(APPEND ${BIN2H_HEADER_FILE} "${declarations}") + else() + file(WRITE ${BIN2H_HEADER_FILE} "${declarations}") + endif() +endfunction() diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cl/cl.hpp b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/cl.hpp index 38fac1962..38fac1962 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cl/cl.hpp +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/cl.hpp diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/ethash_cl_miner.cpp b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/ethash_cl_miner.cpp new file mode 100644 index 000000000..c0dbea21d --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/ethash_cl_miner.cpp @@ -0,0 +1,289 @@ +/* + This file is part of c-ethash. + + c-ethash is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + c-ethash 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>. +*/ +/** @file ethash_cl_miner.cpp +* @author Tim Hughes <tim@twistedfury.com> +* @date 2015 +*/ + + +#define _CRT_SECURE_NO_WARNINGS + +#include <assert.h> +#include <queue> +#include "ethash_cl_miner.h" +#include "ethash_cl_miner_kernel.h" +#include <libethash/util.h> + +#undef min +#undef max + +#define HASH_BYTES 32 + +static void add_definition(std::string& source, char const* id, unsigned value) +{ + char buf[256]; + sprintf(buf, "#define %s %uu\n", id, value); + source.insert(source.begin(), buf, buf + strlen(buf)); +} + +ethash_cl_miner::ethash_cl_miner() +{ +} + +bool ethash_cl_miner::init(ethash_params const& params, const uint8_t seed[32], unsigned workgroup_size) +{ + // store params + m_params = params; + + // get all platforms + std::vector<cl::Platform> platforms; + cl::Platform::get(&platforms); + if (platforms.empty()) + { + debugf("No OpenCL platforms found.\n"); + return false; + } + + // use default platform + debugf("Using platform: %s\n", platforms[0].getInfo<CL_PLATFORM_NAME>().c_str()); + + // get GPU device of the default platform + std::vector<cl::Device> devices; + platforms[0].getDevices(CL_DEVICE_TYPE_ALL, &devices); + if (devices.empty()) + { + debugf("No OpenCL devices found.\n"); + return false; + } + + // use default device + cl::Device& device = devices[0]; + debugf("Using device: %s\n", device.getInfo<CL_DEVICE_NAME>().c_str()); + + // create context + m_context = cl::Context({device}); + m_queue = cl::CommandQueue(m_context, device); + + // use requested workgroup size, but we require multiple of 8 + m_workgroup_size = ((workgroup_size + 7) / 8) * 8; + + // patch source code + std::string code(ETHASH_CL_MINER_KERNEL, ETHASH_CL_MINER_KERNEL + ETHASH_CL_MINER_KERNEL_SIZE); + add_definition(code, "GROUP_SIZE", m_workgroup_size); + add_definition(code, "DAG_SIZE", (unsigned)(params.full_size / MIX_BYTES)); + add_definition(code, "ACCESSES", ACCESSES); + add_definition(code, "MAX_OUTPUTS", c_max_search_results); + //debugf("%s", code.c_str()); + + // create miner OpenCL program + cl::Program::Sources sources; + sources.push_back({code.c_str(), code.size()}); + + cl::Program program(m_context, sources); + try + { + program.build({device}); + } + catch (cl::Error err) + { + debugf("%s\n", program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(device).c_str()); + return false; + } + m_hash_kernel = cl::Kernel(program, "ethash_hash"); + m_search_kernel = cl::Kernel(program, "ethash_search"); + + // create buffer for dag + m_dag = cl::Buffer(m_context, CL_MEM_READ_ONLY, params.full_size); + + // create buffer for header + m_header = cl::Buffer(m_context, CL_MEM_READ_ONLY, 32); + + // compute dag on CPU + { + void* cache_mem = malloc(params.cache_size + 63); + ethash_cache cache; + cache.mem = (void*)(((uintptr_t)cache_mem + 63) & ~63); + ethash_mkcache(&cache, ¶ms, seed); + + // if this throws then it's because we probably need to subdivide the dag uploads for compatibility + void* dag_ptr = m_queue.enqueueMapBuffer(m_dag, true, CL_MAP_WRITE_INVALIDATE_REGION, 0, params.full_size); + ethash_compute_full_data(dag_ptr, ¶ms, &cache); + m_queue.enqueueUnmapMemObject(m_dag, dag_ptr); + + free(cache_mem); + } + + // create mining buffers + for (unsigned i = 0; i != c_num_buffers; ++i) + { + m_hash_buf[i] = cl::Buffer(m_context, CL_MEM_WRITE_ONLY | CL_MEM_HOST_READ_ONLY, 32*c_hash_batch_size); + m_search_buf[i] = cl::Buffer(m_context, CL_MEM_WRITE_ONLY, (c_max_search_results + 1) * sizeof(uint32_t)); + } + return true; +} + +void ethash_cl_miner::hash(uint8_t* ret, uint8_t const* header, uint64_t nonce, unsigned count) +{ + struct pending_batch + { + unsigned base; + unsigned count; + unsigned buf; + }; + std::queue<pending_batch> pending; + + // update header constant buffer + m_queue.enqueueWriteBuffer(m_header, true, 0, 32, header); + + /* + __kernel void ethash_combined_hash( + __global hash32_t* g_hashes, + __constant hash32_t const* g_header, + __global hash128_t const* g_dag, + ulong start_nonce, + uint isolate + ) + */ + m_hash_kernel.setArg(1, m_header); + m_hash_kernel.setArg(2, m_dag); + m_hash_kernel.setArg(3, nonce); + m_hash_kernel.setArg(4, ~0u); // have to pass this to stop the compile unrolling the loop + + unsigned buf = 0; + for (unsigned i = 0; i < count || !pending.empty(); ) + { + // how many this batch + if (i < count) + { + unsigned const this_count = std::min(count - i, c_hash_batch_size); + unsigned const batch_count = std::max(this_count, m_workgroup_size); + + // supply output hash buffer to kernel + m_hash_kernel.setArg(0, m_hash_buf[buf]); + + // execute it! + clock_t start_time = clock(); + m_queue.enqueueNDRangeKernel( + m_hash_kernel, + cl::NullRange, + cl::NDRange(batch_count), + cl::NDRange(m_workgroup_size) + ); + m_queue.flush(); + + pending.push({i, this_count, buf}); + i += this_count; + buf = (buf + 1) % c_num_buffers; + } + + // read results + if (i == count || pending.size() == c_num_buffers) + { + pending_batch const& batch = pending.front(); + + // could use pinned host pointer instead, but this path isn't that important. + uint8_t* hashes = (uint8_t*)m_queue.enqueueMapBuffer(m_hash_buf[batch.buf], true, CL_MAP_READ, 0, batch.count * HASH_BYTES); + memcpy(ret + batch.base*HASH_BYTES, hashes, batch.count*HASH_BYTES); + m_queue.enqueueUnmapMemObject(m_hash_buf[batch.buf], hashes); + + pending.pop(); + } + } +} + + +void ethash_cl_miner::search(uint8_t const* header, uint64_t target, search_hook& hook) +{ + struct pending_batch + { + uint64_t start_nonce; + unsigned buf; + }; + std::queue<pending_batch> pending; + + static uint32_t const c_zero = 0; + + // update header constant buffer + m_queue.enqueueWriteBuffer(m_header, false, 0, 32, header); + for (unsigned i = 0; i != c_num_buffers; ++i) + { + m_queue.enqueueWriteBuffer(m_search_buf[i], false, 0, 4, &c_zero); + } + cl::Event pre_return_event; + m_queue.enqueueBarrierWithWaitList(NULL, &pre_return_event); + + /* + __kernel void ethash_combined_search( + __global hash32_t* g_hashes, // 0 + __constant hash32_t const* g_header, // 1 + __global hash128_t const* g_dag, // 2 + ulong start_nonce, // 3 + ulong target, // 4 + uint isolate // 5 + ) + */ + m_search_kernel.setArg(1, m_header); + m_search_kernel.setArg(2, m_dag); + + // pass these to stop the compiler unrolling the loops + m_search_kernel.setArg(4, target); + m_search_kernel.setArg(5, ~0u); + + + unsigned buf = 0; + for (uint64_t start_nonce = 0; ; start_nonce += c_search_batch_size) + { + // supply output buffer to kernel + m_search_kernel.setArg(0, m_search_buf[buf]); + m_search_kernel.setArg(3, start_nonce); + + // execute it! + m_queue.enqueueNDRangeKernel(m_search_kernel, cl::NullRange, c_search_batch_size, m_workgroup_size); + + pending.push({start_nonce, buf}); + buf = (buf + 1) % c_num_buffers; + + // read results + if (pending.size() == c_num_buffers) + { + pending_batch const& batch = pending.front(); + + // could use pinned host pointer instead + uint32_t* results = (uint32_t*)m_queue.enqueueMapBuffer(m_search_buf[batch.buf], true, CL_MAP_READ, 0, (1+c_max_search_results) * sizeof(uint32_t)); + unsigned num_found = std::min(results[0], c_max_search_results); + + uint64_t nonces[c_max_search_results]; + for (unsigned i = 0; i != num_found; ++i) + { + nonces[i] = batch.start_nonce + results[i+1]; + } + + m_queue.enqueueUnmapMemObject(m_search_buf[batch.buf], results); + + bool exit = num_found && hook.found(nonces, num_found); + exit |= hook.searched(batch.start_nonce, c_search_batch_size); // always report searched before exit + if (exit) + break; + + pending.pop(); + } + } + + // not safe to return until this is ready + pre_return_event.wait(); +} + diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cl/ethash_cl_miner.h b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/ethash_cl_miner.h index f37100d91..f37100d91 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cl/ethash_cl_miner.h +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/ethash_cl_miner.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cl/ethash_cl_miner.cpp b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/ethash_cl_miner_kernel.cl index 11b29333c..ee21a331e 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash-cl/ethash_cl_miner.cpp +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/ethash_cl_miner_kernel.cl @@ -1,39 +1,3 @@ -/* - This file is part of c-ethash. - - c-ethash is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - c-ethash 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>. -*/ -/** @file ethash_cl_miner.cpp -* @author Tim Hughes <tim@twistedfury.com> -* @date 2015 -*/ - - -#define _CRT_SECURE_NO_WARNINGS - -#include <assert.h> -#include <queue> -#include "ethash_cl_miner.h" -#include <libethash/util.h> - -#undef min -#undef max - -#define HASH_BYTES 32 - -static char const ethash_inner_code[] = R"( - // author Tim Hughes <tim@twistedfury.com> // Tested on Radeon HD 7850 // Hashrate: 15940347 hashes/s @@ -495,260 +459,3 @@ __kernel void ethash_search( g_output[slot] = gid; } } - -)"; - -static void add_definition(std::string& source, char const* id, unsigned value) -{ - char buf[256]; - sprintf(buf, "#define %s %uu\n", id, value); - source.insert(source.begin(), buf, buf + strlen(buf)); -} - -ethash_cl_miner::ethash_cl_miner() -{ -} - -bool ethash_cl_miner::init(ethash_params const& params, const uint8_t seed[32], unsigned workgroup_size) -{ - // store params - m_params = params; - - // get all platforms - std::vector<cl::Platform> platforms; - cl::Platform::get(&platforms); - if (platforms.empty()) - { - debugf("No OpenCL platforms found.\n"); - return false; - } - - // use default platform - debugf("Using platform: %s\n", platforms[0].getInfo<CL_PLATFORM_NAME>().c_str()); - - // get GPU device of the default platform - std::vector<cl::Device> devices; - platforms[0].getDevices(CL_DEVICE_TYPE_ALL, &devices); - if (devices.empty()) - { - debugf("No OpenCL devices found.\n"); - return false; - } - - // use default device - cl::Device& device = devices[0]; - debugf("Using device: %s\n", device.getInfo<CL_DEVICE_NAME>().c_str()); - - // create context - m_context = cl::Context({device}); - m_queue = cl::CommandQueue(m_context, device); - - // use requested workgroup size, but we require multiple of 8 - m_workgroup_size = ((workgroup_size + 7) / 8) * 8; - - // patch source code - std::string code = ethash_inner_code; - add_definition(code, "GROUP_SIZE", m_workgroup_size); - add_definition(code, "DAG_SIZE", (unsigned)(params.full_size / MIX_BYTES)); - add_definition(code, "ACCESSES", ACCESSES); - add_definition(code, "MAX_OUTPUTS", c_max_search_results); - //debugf("%s", code.c_str()); - - // create miner OpenCL program - cl::Program::Sources sources; - sources.push_back({code.c_str(), code.size()}); - - cl::Program program(m_context, sources); - try - { - program.build({device}); - } - catch (cl::Error err) - { - debugf("%s\n", program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(device).c_str()); - return false; - } - m_hash_kernel = cl::Kernel(program, "ethash_hash"); - m_search_kernel = cl::Kernel(program, "ethash_search"); - - // create buffer for dag - m_dag = cl::Buffer(m_context, CL_MEM_READ_ONLY, params.full_size); - - // create buffer for header - m_header = cl::Buffer(m_context, CL_MEM_READ_ONLY, 32); - - // compute dag on CPU - { - void* cache_mem = malloc(params.cache_size + 63); - ethash_cache cache; - cache.mem = (void*)(((uintptr_t)cache_mem + 63) & ~63); - ethash_mkcache(&cache, ¶ms, seed); - - // if this throws then it's because we probably need to subdivide the dag uploads for compatibility - void* dag_ptr = m_queue.enqueueMapBuffer(m_dag, true, CL_MAP_WRITE_INVALIDATE_REGION, 0, params.full_size); - ethash_compute_full_data(dag_ptr, ¶ms, &cache); - m_queue.enqueueUnmapMemObject(m_dag, dag_ptr); - - free(cache_mem); - } - - // create mining buffers - for (unsigned i = 0; i != c_num_buffers; ++i) - { - m_hash_buf[i] = cl::Buffer(m_context, CL_MEM_WRITE_ONLY | CL_MEM_HOST_READ_ONLY, 32*c_hash_batch_size); - m_search_buf[i] = cl::Buffer(m_context, CL_MEM_WRITE_ONLY, (c_max_search_results + 1) * sizeof(uint32_t)); - } - return true; -} - -void ethash_cl_miner::hash(uint8_t* ret, uint8_t const* header, uint64_t nonce, unsigned count) -{ - struct pending_batch - { - unsigned base; - unsigned count; - unsigned buf; - }; - std::queue<pending_batch> pending; - - // update header constant buffer - m_queue.enqueueWriteBuffer(m_header, true, 0, 32, header); - - /* - __kernel void ethash_combined_hash( - __global hash32_t* g_hashes, - __constant hash32_t const* g_header, - __global hash128_t const* g_dag, - ulong start_nonce, - uint isolate - ) - */ - m_hash_kernel.setArg(1, m_header); - m_hash_kernel.setArg(2, m_dag); - m_hash_kernel.setArg(3, nonce); - m_hash_kernel.setArg(4, ~0u); // have to pass this to stop the compile unrolling the loop - - unsigned buf = 0; - for (unsigned i = 0; i < count || !pending.empty(); ) - { - // how many this batch - if (i < count) - { - unsigned const this_count = std::min(count - i, c_hash_batch_size); - unsigned const batch_count = std::max(this_count, m_workgroup_size); - - // supply output hash buffer to kernel - m_hash_kernel.setArg(0, m_hash_buf[buf]); - - // execute it! - clock_t start_time = clock(); - m_queue.enqueueNDRangeKernel( - m_hash_kernel, - cl::NullRange, - cl::NDRange(batch_count), - cl::NDRange(m_workgroup_size) - ); - m_queue.flush(); - - pending.push({i, this_count, buf}); - i += this_count; - buf = (buf + 1) % c_num_buffers; - } - - // read results - if (i == count || pending.size() == c_num_buffers) - { - pending_batch const& batch = pending.front(); - - // could use pinned host pointer instead, but this path isn't that important. - uint8_t* hashes = (uint8_t*)m_queue.enqueueMapBuffer(m_hash_buf[batch.buf], true, CL_MAP_READ, 0, batch.count * HASH_BYTES); - memcpy(ret + batch.base*HASH_BYTES, hashes, batch.count*HASH_BYTES); - m_queue.enqueueUnmapMemObject(m_hash_buf[batch.buf], hashes); - - pending.pop(); - } - } -} - - -void ethash_cl_miner::search(uint8_t const* header, uint64_t target, search_hook& hook) -{ - struct pending_batch - { - uint64_t start_nonce; - unsigned buf; - }; - std::queue<pending_batch> pending; - - static uint32_t const c_zero = 0; - - // update header constant buffer - m_queue.enqueueWriteBuffer(m_header, false, 0, 32, header); - for (unsigned i = 0; i != c_num_buffers; ++i) - { - m_queue.enqueueWriteBuffer(m_search_buf[i], false, 0, 4, &c_zero); - } - cl::Event pre_return_event; - m_queue.enqueueBarrierWithWaitList(NULL, &pre_return_event); - - /* - __kernel void ethash_combined_search( - __global hash32_t* g_hashes, // 0 - __constant hash32_t const* g_header, // 1 - __global hash128_t const* g_dag, // 2 - ulong start_nonce, // 3 - ulong target, // 4 - uint isolate // 5 - ) - */ - m_search_kernel.setArg(1, m_header); - m_search_kernel.setArg(2, m_dag); - - // pass these to stop the compiler unrolling the loops - m_search_kernel.setArg(4, target); - m_search_kernel.setArg(5, ~0u); - - - unsigned buf = 0; - for (uint64_t start_nonce = 0; ; start_nonce += c_search_batch_size) - { - // supply output buffer to kernel - m_search_kernel.setArg(0, m_search_buf[buf]); - m_search_kernel.setArg(3, start_nonce); - - // execute it! - m_queue.enqueueNDRangeKernel(m_search_kernel, cl::NullRange, c_search_batch_size, m_workgroup_size); - - pending.push({start_nonce, buf}); - buf = (buf + 1) % c_num_buffers; - - // read results - if (pending.size() == c_num_buffers) - { - pending_batch const& batch = pending.front(); - - // could use pinned host pointer instead - uint32_t* results = (uint32_t*)m_queue.enqueueMapBuffer(m_search_buf[batch.buf], true, CL_MAP_READ, 0, (1+c_max_search_results) * sizeof(uint32_t)); - unsigned num_found = std::min(results[0], c_max_search_results); - - uint64_t nonces[c_max_search_results]; - for (unsigned i = 0; i != num_found; ++i) - { - nonces[i] = batch.start_nonce + results[i+1]; - } - - m_queue.enqueueUnmapMemObject(m_search_buf[batch.buf], results); - - bool exit = num_found && hook.found(nonces, num_found); - exit |= hook.searched(batch.start_nonce, c_search_batch_size); // always report searched before exit - if (exit) - break; - - pending.pop(); - } - } - - // not safe to return until this is ready - pre_return_event.wait(); -} - diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/CMakeLists.txt b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/CMakeLists.txt index bef63ef0a..7bc147af7 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/CMakeLists.txt +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/CMakeLists.txt @@ -1,4 +1,10 @@ set(LIBRARY ethash) + +if (CPPETHEREUM) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") +#else () +endif () + set(CMAKE_BUILD_TYPE Release) if (NOT MSVC) @@ -30,4 +36,4 @@ add_library(${LIBRARY} ${FILES}) if (CRYPTOPP_FOUND) TARGET_LINK_LIBRARIES(${LIBRARY} ${CRYPTOPP_LIBRARIES}) -endif()
\ No newline at end of file +endif() diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/compiler.h b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/compiler.h index 9695871cd..9695871cd 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/compiler.h +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/compiler.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/data_sizes.h b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/data_sizes.h new file mode 100644 index 000000000..a10d4c42c --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/data_sizes.h @@ -0,0 +1,779 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software FoundationUUU,either version 3 of the LicenseUUU,or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be usefulU, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If notUUU,see <http://www.gnu.org/licenses/>. +*/ + +/** @file data_sizes.h +* @author Matthew Wampler-Doty <negacthulhu@gmail.com> +* @date 2015 +*/ + +// TODO: Update this after ~3.5 years + +#pragma once + +#include <stdint.h> +#include "compiler.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +// 2048 Epochs worth of tabulated DAG sizes + +// Generated with the following Mathematica Code: + +// GetDataSizes[n_] := Module[{ +// DataSetSizeBytesInit = 2^30, +// MixBytes = 128, +// DataSetGrowth = 2^23, +// j = 0}, +// Reap[ +// While[j < n, +// Module[{i = +// Floor[(DataSetSizeBytesInit + DataSetGrowth * j) / MixBytes]}, +// While[! PrimeQ[i], i--]; +// Sow[i*MixBytes]; j++]]]][[2]][[1]] + +static const size_t dag_sizes[] = { + 1073739904U, 1082130304U, 1090514816U, 1098906752U, 1107293056U, + 1115684224U, 1124070016U, 1132461952U, 1140849536U, 1149232768U, + 1157627776U, 1166013824U, 1174404736U, 1182786944U, 1191180416U, + 1199568512U, 1207958912U, 1216345216U, 1224732032U, 1233124736U, + 1241513344U, 1249902464U, 1258290304U, 1266673792U, 1275067264U, + 1283453312U, 1291844992U, 1300234112U, 1308619904U, 1317010048U, + 1325397376U, 1333787776U, 1342176128U, 1350561664U, 1358954368U, + 1367339392U, 1375731584U, 1384118144U, 1392507008U, 1400897408U, + 1409284736U, 1417673344U, 1426062464U, 1434451072U, 1442839168U, + 1451229056U, 1459615616U, 1468006016U, 1476394112U, 1484782976U, + 1493171584U, 1501559168U, 1509948032U, 1518337664U, 1526726528U, + 1535114624U, 1543503488U, 1551892096U, 1560278656U, 1568669056U, + 1577056384U, 1585446272U, 1593831296U, 1602219392U, 1610610304U, + 1619000192U, 1627386752U, 1635773824U, 1644164224U, 1652555648U, + 1660943488U, 1669332608U, 1677721216U, 1686109312U, 1694497664U, + 1702886272U, 1711274624U, 1719661184U, 1728047744U, 1736434816U, + 1744829056U, 1753218944U, 1761606272U, 1769995904U, 1778382464U, + 1786772864U, 1795157888U, 1803550592U, 1811937664U, 1820327552U, + 1828711552U, 1837102976U, 1845488768U, 1853879936U, 1862269312U, + 1870656896U, 1879048064U, 1887431552U, 1895825024U, 1904212096U, + 1912601216U, 1920988544U, 1929379456U, 1937765504U, 1946156672U, + 1954543232U, 1962932096U, 1971321728U, 1979707264U, 1988093056U, + 1996487552U, 2004874624U, 2013262208U, 2021653888U, 2030039936U, + 2038430848U, 2046819968U, 2055208576U, 2063596672U, 2071981952U, + 2080373632U, 2088762752U, 2097149056U, 2105539712U, 2113928576U, + 2122315136U, 2130700672U, 2139092608U, 2147483264U, 2155872128U, + 2164257664U, 2172642176U, 2181035392U, 2189426048U, 2197814912U, + 2206203008U, 2214587264U, 2222979712U, 2231367808U, 2239758208U, + 2248145024U, 2256527744U, 2264922752U, 2273312128U, 2281701248U, + 2290086272U, 2298476672U, 2306867072U, 2315251072U, 2323639168U, + 2332032128U, 2340420224U, 2348808064U, 2357196416U, 2365580416U, + 2373966976U, 2382363008U, 2390748544U, 2399139968U, 2407530368U, + 2415918976U, 2424307328U, 2432695424U, 2441084288U, 2449472384U, + 2457861248U, 2466247808U, 2474637184U, 2483026816U, 2491414144U, + 2499803776U, 2508191872U, 2516582272U, 2524970368U, 2533359232U, + 2541743488U, 2550134144U, 2558525056U, 2566913408U, 2575301504U, + 2583686528U, 2592073856U, 2600467328U, 2608856192U, 2617240448U, + 2625631616U, 2634022016U, 2642407552U, 2650796416U, 2659188352U, + 2667574912U, 2675965312U, 2684352896U, 2692738688U, 2701130624U, + 2709518464U, 2717907328U, 2726293376U, 2734685056U, 2743073152U, + 2751462016U, 2759851648U, 2768232832U, 2776625536U, 2785017728U, + 2793401984U, 2801794432U, 2810182016U, 2818571648U, 2826959488U, + 2835349376U, 2843734144U, 2852121472U, 2860514432U, 2868900992U, + 2877286784U, 2885676928U, 2894069632U, 2902451584U, 2910843008U, + 2919234688U, 2927622784U, 2936011648U, 2944400768U, 2952789376U, + 2961177728U, 2969565568U, 2977951616U, 2986338944U, 2994731392U, + 3003120256U, 3011508352U, 3019895936U, 3028287104U, 3036675968U, + 3045063808U, 3053452928U, 3061837696U, 3070228352U, 3078615424U, + 3087003776U, 3095394944U, 3103782272U, 3112173184U, 3120562048U, + 3128944768U, 3137339264U, 3145725056U, 3154109312U, 3162505088U, + 3170893184U, 3179280256U, 3187669376U, 3196056704U, 3204445568U, + 3212836736U, 3221224064U, 3229612928U, 3238002304U, 3246391168U, + 3254778496U, 3263165824U, 3271556224U, 3279944576U, 3288332416U, + 3296719232U, 3305110912U, 3313500032U, 3321887104U, 3330273152U, + 3338658944U, 3347053184U, 3355440512U, 3363827072U, 3372220288U, + 3380608384U, 3388997504U, 3397384576U, 3405774208U, 3414163072U, + 3422551936U, 3430937984U, 3439328384U, 3447714176U, 3456104576U, + 3464493952U, 3472883584U, 3481268864U, 3489655168U, 3498048896U, + 3506434432U, 3514826368U, 3523213952U, 3531603584U, 3539987072U, + 3548380288U, 3556763264U, 3565157248U, 3573545344U, 3581934464U, + 3590324096U, 3598712704U, 3607098752U, 3615488384U, 3623877248U, + 3632265856U, 3640646528U, 3649043584U, 3657430144U, 3665821568U, + 3674207872U, 3682597504U, 3690984832U, 3699367808U, 3707764352U, + 3716152448U, 3724541056U, 3732925568U, 3741318016U, 3749706368U, + 3758091136U, 3766481536U, 3774872704U, 3783260032U, 3791650432U, + 3800036224U, 3808427648U, 3816815488U, 3825204608U, 3833592704U, + 3841981568U, 3850370432U, 3858755968U, 3867147904U, 3875536256U, + 3883920512U, 3892313728U, 3900702592U, 3909087872U, 3917478784U, + 3925868416U, 3934256512U, 3942645376U, 3951032192U, 3959422336U, + 3967809152U, 3976200064U, 3984588416U, 3992974976U, 4001363584U, + 4009751168U, 4018141312U, 4026530432U, 4034911616U, 4043308928U, + 4051695488U, 4060084352U, 4068472448U, 4076862848U, 4085249408U, + 4093640576U, 4102028416U, 4110413696U, 4118805632U, 4127194496U, + 4135583104U, 4143971968U, 4152360832U, 4160746112U, 4169135744U, + 4177525888U, 4185912704U, 4194303616U, 4202691968U, 4211076736U, + 4219463552U, 4227855488U, 4236246656U, 4244633728U, 4253022848U, + 4261412224U, 4269799808U, 4278184832U, 4286578048U, 4294962304U, + 4303349632U, 4311743104U, 4320130432U, 4328521088U, 4336909184U, + 4345295488U, 4353687424U, 4362073472U, 4370458496U, 4378852736U, + 4387238528U, 4395630208U, 4404019072U, 4412407424U, 4420790656U, + 4429182848U, 4437571456U, 4445962112U, 4454344064U, 4462738048U, + 4471119232U, 4479516544U, 4487904128U, 4496289664U, 4504682368U, + 4513068416U, 4521459584U, 4529846144U, 4538232704U, 4546619776U, + 4555010176U, 4563402112U, 4571790208U, 4580174464U, 4588567936U, + 4596957056U, 4605344896U, 4613734016U, 4622119808U, 4630511488U, + 4638898816U, 4647287936U, 4655675264U, 4664065664U, 4672451968U, + 4680842624U, 4689231488U, 4697620352U, 4706007424U, 4714397056U, + 4722786176U, 4731173248U, 4739562368U, 4747951744U, 4756340608U, + 4764727936U, 4773114496U, 4781504384U, 4789894784U, 4798283648U, + 4806667648U, 4815059584U, 4823449472U, 4831835776U, 4840226176U, + 4848612224U, 4857003392U, 4865391488U, 4873780096U, 4882169728U, + 4890557312U, 4898946944U, 4907333248U, 4915722368U, 4924110976U, + 4932499328U, 4940889728U, 4949276032U, 4957666432U, 4966054784U, + 4974438016U, 4982831488U, 4991221376U, 4999607168U, 5007998848U, + 5016386432U, 5024763776U, 5033164672U, 5041544576U, 5049941888U, + 5058329728U, 5066717056U, 5075107456U, 5083494272U, 5091883904U, + 5100273536U, 5108662144U, 5117048192U, 5125436032U, 5133827456U, + 5142215296U, 5150605184U, 5158993024U, 5167382144U, 5175769472U, + 5184157568U, 5192543872U, 5200936064U, 5209324928U, 5217711232U, + 5226102656U, 5234490496U, 5242877312U, 5251263872U, 5259654016U, + 5268040832U, 5276434304U, 5284819328U, 5293209728U, 5301598592U, + 5309986688U, 5318374784U, 5326764416U, 5335151488U, 5343542144U, + 5351929472U, 5360319872U, 5368706944U, 5377096576U, 5385484928U, + 5393871232U, 5402263424U, 5410650496U, 5419040384U, 5427426944U, + 5435816576U, 5444205952U, 5452594816U, 5460981376U, 5469367936U, + 5477760896U, 5486148736U, 5494536832U, 5502925952U, 5511315328U, + 5519703424U, 5528089984U, 5536481152U, 5544869504U, 5553256064U, + 5561645696U, 5570032768U, 5578423936U, 5586811264U, 5595193216U, + 5603585408U, 5611972736U, 5620366208U, 5628750464U, 5637143936U, + 5645528192U, 5653921408U, 5662310272U, 5670694784U, 5679082624U, + 5687474048U, 5695864448U, 5704251008U, 5712641408U, 5721030272U, + 5729416832U, 5737806208U, 5746194304U, 5754583936U, 5762969984U, + 5771358592U, 5779748224U, 5788137856U, 5796527488U, 5804911232U, + 5813300608U, 5821692544U, 5830082176U, 5838468992U, 5846855552U, + 5855247488U, 5863636096U, 5872024448U, 5880411008U, 5888799872U, + 5897186432U, 5905576832U, 5913966976U, 5922352768U, 5930744704U, + 5939132288U, 5947522432U, 5955911296U, 5964299392U, 5972688256U, + 5981074304U, 5989465472U, 5997851008U, 6006241408U, 6014627968U, + 6023015552U, 6031408256U, 6039796096U, 6048185216U, 6056574848U, + 6064963456U, 6073351808U, 6081736064U, 6090128768U, 6098517632U, + 6106906496U, 6115289216U, 6123680896U, 6132070016U, 6140459648U, + 6148849024U, 6157237376U, 6165624704U, 6174009728U, 6182403712U, + 6190792064U, 6199176064U, 6207569792U, 6215952256U, 6224345216U, + 6232732544U, 6241124224U, 6249510272U, 6257899136U, 6266287744U, + 6274676864U, 6283065728U, 6291454336U, 6299843456U, 6308232064U, + 6316620928U, 6325006208U, 6333395584U, 6341784704U, 6350174848U, + 6358562176U, 6366951296U, 6375337856U, 6383729536U, 6392119168U, + 6400504192U, 6408895616U, 6417283456U, 6425673344U, 6434059136U, + 6442444672U, 6450837376U, 6459223424U, 6467613056U, 6476004224U, + 6484393088U, 6492781952U, 6501170048U, 6509555072U, 6517947008U, + 6526336384U, 6534725504U, 6543112832U, 6551500672U, 6559888768U, + 6568278656U, 6576662912U, 6585055616U, 6593443456U, 6601834112U, + 6610219648U, 6618610304U, 6626999168U, 6635385472U, 6643777408U, + 6652164224U, 6660552832U, 6668941952U, 6677330048U, 6685719424U, + 6694107776U, 6702493568U, 6710882176U, 6719274112U, 6727662976U, + 6736052096U, 6744437632U, 6752825984U, 6761213824U, 6769604224U, + 6777993856U, 6786383488U, 6794770816U, 6803158144U, 6811549312U, + 6819937664U, 6828326528U, 6836706176U, 6845101696U, 6853491328U, + 6861880448U, 6870269312U, 6878655104U, 6887046272U, 6895433344U, + 6903822208U, 6912212864U, 6920596864U, 6928988288U, 6937377152U, + 6945764992U, 6954149248U, 6962544256U, 6970928768U, 6979317376U, + 6987709312U, 6996093824U, 7004487296U, 7012875392U, 7021258624U, + 7029652352U, 7038038912U, 7046427776U, 7054818944U, 7063207808U, + 7071595136U, 7079980928U, 7088372608U, 7096759424U, 7105149824U, + 7113536896U, 7121928064U, 7130315392U, 7138699648U, 7147092352U, + 7155479168U, 7163865728U, 7172249984U, 7180648064U, 7189036672U, + 7197424768U, 7205810816U, 7214196608U, 7222589824U, 7230975104U, + 7239367552U, 7247755904U, 7256145536U, 7264533376U, 7272921472U, + 7281308032U, 7289694848U, 7298088832U, 7306471808U, 7314864512U, + 7323253888U, 7331643008U, 7340029568U, 7348419712U, 7356808832U, + 7365196672U, 7373585792U, 7381973888U, 7390362752U, 7398750592U, + 7407138944U, 7415528576U, 7423915648U, 7432302208U, 7440690304U, + 7449080192U, 7457472128U, 7465860992U, 7474249088U, 7482635648U, + 7491023744U, 7499412608U, 7507803008U, 7516192384U, 7524579968U, + 7532967296U, 7541358464U, 7549745792U, 7558134656U, 7566524032U, + 7574912896U, 7583300992U, 7591690112U, 7600075136U, 7608466816U, + 7616854912U, 7625244544U, 7633629824U, 7642020992U, 7650410368U, + 7658794112U, 7667187328U, 7675574912U, 7683961984U, 7692349568U, + 7700739712U, 7709130368U, 7717519232U, 7725905536U, 7734295424U, + 7742683264U, 7751069056U, 7759457408U, 7767849088U, 7776238208U, + 7784626816U, 7793014912U, 7801405312U, 7809792128U, 7818179968U, + 7826571136U, 7834957184U, 7843347328U, 7851732352U, 7860124544U, + 7868512384U, 7876902016U, 7885287808U, 7893679744U, 7902067072U, + 7910455936U, 7918844288U, 7927230848U, 7935622784U, 7944009344U, + 7952400256U, 7960786048U, 7969176704U, 7977565312U, 7985953408U, + 7994339968U, 8002730368U, 8011119488U, 8019508096U, 8027896192U, + 8036285056U, 8044674688U, 8053062272U, 8061448832U, 8069838464U, + 8078227328U, 8086616704U, 8095006592U, 8103393664U, 8111783552U, + 8120171392U, 8128560256U, 8136949376U, 8145336704U, 8153726848U, + 8162114944U, 8170503296U, 8178891904U, 8187280768U, 8195669632U, + 8204058496U, 8212444544U, 8220834176U, 8229222272U, 8237612672U, + 8246000768U, 8254389376U, 8262775168U, 8271167104U, 8279553664U, + 8287944064U, 8296333184U, 8304715136U, 8313108352U, 8321497984U, + 8329885568U, 8338274432U, 8346663296U, 8355052928U, 8363441536U, + 8371828352U, 8380217984U, 8388606592U, 8396996224U, 8405384576U, + 8413772672U, 8422161536U, 8430549376U, 8438939008U, 8447326592U, + 8455715456U, 8464104832U, 8472492928U, 8480882048U, 8489270656U, + 8497659776U, 8506045312U, 8514434944U, 8522823808U, 8531208832U, + 8539602304U, 8547990656U, 8556378752U, 8564768384U, 8573154176U, + 8581542784U, 8589933952U, 8598322816U, 8606705024U, 8615099264U, + 8623487872U, 8631876992U, 8640264064U, 8648653952U, 8657040256U, + 8665430656U, 8673820544U, 8682209152U, 8690592128U, 8698977152U, + 8707374464U, 8715763328U, 8724151424U, 8732540032U, 8740928384U, + 8749315712U, 8757704576U, 8766089344U, 8774480768U, 8782871936U, + 8791260032U, 8799645824U, 8808034432U, 8816426368U, 8824812928U, + 8833199488U, 8841591424U, 8849976448U, 8858366336U, 8866757248U, + 8875147136U, 8883532928U, 8891923328U, 8900306816U, 8908700288U, + 8917088384U, 8925478784U, 8933867392U, 8942250368U, 8950644608U, + 8959032704U, 8967420544U, 8975809664U, 8984197504U, 8992584064U, + 9000976256U, 9009362048U, 9017752448U, 9026141312U, 9034530688U, + 9042917504U, 9051307904U, 9059694208U, 9068084864U, 9076471424U, + 9084861824U, 9093250688U, 9101638528U, 9110027648U, 9118416512U, + 9126803584U, 9135188096U, 9143581312U, 9151969664U, 9160356224U, + 9168747136U, 9177134464U, 9185525632U, 9193910144U, 9202302848U, + 9210690688U, 9219079552U, 9227465344U, 9235854464U, 9244244864U, + 9252633472U, 9261021824U, 9269411456U, 9277799296U, 9286188928U, + 9294574208U, 9302965888U, 9311351936U, 9319740032U, 9328131968U, + 9336516736U, 9344907392U, 9353296768U, 9361685888U, 9370074752U, + 9378463616U, 9386849408U, 9395239808U, 9403629184U, 9412016512U, + 9420405376U, 9428795008U, 9437181568U, 9445570688U, 9453960832U, + 9462346624U, 9470738048U, 9479121536U, 9487515008U, 9495903616U, + 9504289664U, 9512678528U, 9521067904U, 9529456256U, 9537843584U, + 9546233728U, 9554621312U, 9563011456U, 9571398784U, 9579788672U, + 9588178304U, 9596567168U, 9604954496U, 9613343104U, 9621732992U, + 9630121856U, 9638508416U, 9646898816U, 9655283584U, 9663675776U, + 9672061312U, 9680449664U, 9688840064U, 9697230464U, 9705617536U, + 9714003584U, 9722393984U, 9730772608U, 9739172224U, 9747561088U, + 9755945344U, 9764338816U, 9772726144U, 9781116544U, 9789503872U, + 9797892992U, 9806282624U, 9814670464U, 9823056512U, 9831439232U, + 9839833984U, 9848224384U, 9856613504U, 9865000576U, 9873391232U, + 9881772416U, 9890162816U, 9898556288U, 9906940544U, 9915333248U, + 9923721088U, 9932108672U, 9940496512U, 9948888448U, 9957276544U, + 9965666176U, 9974048384U, 9982441088U, 9990830464U, 9999219584U, + 10007602816U, 10015996544U, 10024385152U, 10032774016U, 10041163648U, + 10049548928U, 10057940096U, 10066329472U, 10074717824U, 10083105152U, + 10091495296U, 10099878784U, 10108272256U, 10116660608U, 10125049216U, + 10133437312U, 10141825664U, 10150213504U, 10158601088U, 10166991232U, + 10175378816U, 10183766144U, 10192157312U, 10200545408U, 10208935552U, + 10217322112U, 10225712768U, 10234099328U, 10242489472U, 10250876032U, + 10259264896U, 10267656064U, 10276042624U, 10284429184U, 10292820352U, + 10301209472U, 10309598848U, 10317987712U, 10326375296U, 10334763392U, + 10343153536U, 10351541632U, 10359930752U, 10368318592U, 10376707456U, + 10385096576U, 10393484672U, 10401867136U, 10410262144U, 10418647424U, + 10427039104U, 10435425664U, 10443810176U, 10452203648U, 10460589952U, + 10468982144U, 10477369472U, 10485759104U, 10494147712U, 10502533504U, + 10510923392U, 10519313536U, 10527702656U, 10536091264U, 10544478592U, + 10552867712U, 10561255808U, 10569642368U, 10578032768U, 10586423168U, + 10594805632U, 10603200128U, 10611588992U, 10619976064U, 10628361344U, + 10636754048U, 10645143424U, 10653531776U, 10661920384U, 10670307968U, + 10678696832U, 10687086464U, 10695475072U, 10703863168U, 10712246144U, + 10720639616U, 10729026688U, 10737414784U, 10745806208U, 10754190976U, + 10762581376U, 10770971264U, 10779356288U, 10787747456U, 10796135552U, + 10804525184U, 10812915584U, 10821301888U, 10829692288U, 10838078336U, + 10846469248U, 10854858368U, 10863247232U, 10871631488U, 10880023424U, + 10888412032U, 10896799616U, 10905188992U, 10913574016U, 10921964672U, + 10930352768U, 10938742912U, 10947132544U, 10955518592U, 10963909504U, + 10972298368U, 10980687488U, 10989074816U, 10997462912U, 11005851776U, + 11014241152U, 11022627712U, 11031017344U, 11039403904U, 11047793024U, + 11056184704U, 11064570752U, 11072960896U, 11081343872U, 11089737856U, + 11098128256U, 11106514816U, 11114904448U, 11123293568U, 11131680128U, + 11140065152U, 11148458368U, 11156845696U, 11165236864U, 11173624192U, + 11182013824U, 11190402688U, 11198790784U, 11207179136U, 11215568768U, + 11223957376U, 11232345728U, 11240734592U, 11249122688U, 11257511296U, + 11265899648U, 11274285952U, 11282675584U, 11291065472U, 11299452544U, + 11307842432U, 11316231296U, 11324616832U, 11333009024U, 11341395584U, + 11349782656U, 11358172288U, 11366560384U, 11374950016U, 11383339648U, + 11391721856U, 11400117376U, 11408504192U, 11416893568U, 11425283456U, + 11433671552U, 11442061184U, 11450444672U, 11458837888U, 11467226752U, + 11475611776U, 11484003968U, 11492392064U, 11500780672U, 11509169024U, + 11517550976U, 11525944448U, 11534335616U, 11542724224U, 11551111808U, + 11559500672U, 11567890304U, 11576277376U, 11584667008U, 11593056128U, + 11601443456U, 11609830016U, 11618221952U, 11626607488U, 11634995072U, + 11643387776U, 11651775104U, 11660161664U, 11668552576U, 11676940928U, + 11685330304U, 11693718656U, 11702106496U, 11710496128U, 11718882688U, + 11727273088U, 11735660416U, 11744050048U, 11752437376U, 11760824704U, + 11769216128U, 11777604736U, 11785991296U, 11794381952U, 11802770048U, + 11811157888U, 11819548544U, 11827932544U, 11836324736U, 11844713344U, + 11853100928U, 11861486464U, 11869879936U, 11878268032U, 11886656896U, + 11895044992U, 11903433088U, 11911822976U, 11920210816U, 11928600448U, + 11936987264U, 11945375872U, 11953761152U, 11962151296U, 11970543488U, + 11978928512U, 11987320448U, 11995708288U, 12004095104U, 12012486272U, + 12020875136U, 12029255552U, 12037652096U, 12046039168U, 12054429568U, + 12062813824U, 12071206528U, 12079594624U, 12087983744U, 12096371072U, + 12104759936U, 12113147264U, 12121534592U, 12129924992U, 12138314624U, + 12146703232U, 12155091584U, 12163481216U, 12171864704U, 12180255872U, + 12188643968U, 12197034112U, 12205424512U, 12213811328U, 12222199424U, + 12230590336U, 12238977664U, 12247365248U, 12255755392U, 12264143488U, + 12272531584U, 12280920448U, 12289309568U, 12297694592U, 12306086528U, + 12314475392U, 12322865024U, 12331253632U, 12339640448U, 12348029312U, + 12356418944U, 12364805248U, 12373196672U, 12381580928U, 12389969024U, + 12398357632U, 12406750592U, 12415138432U, 12423527552U, 12431916416U, + 12440304512U, 12448692352U, 12457081216U, 12465467776U, 12473859968U, + 12482245504U, 12490636672U, 12499025536U, 12507411584U, 12515801728U, + 12524190592U, 12532577152U, 12540966272U, 12549354368U, 12557743232U, + 12566129536U, 12574523264U, 12582911872U, 12591299456U, 12599688064U, + 12608074624U, 12616463488U, 12624845696U, 12633239936U, 12641631616U, + 12650019968U, 12658407296U, 12666795136U, 12675183232U, 12683574656U, + 12691960192U, 12700350592U, 12708740224U, 12717128576U, 12725515904U, + 12733906816U, 12742295168U, 12750680192U, 12759071872U, 12767460736U, + 12775848832U, 12784236928U, 12792626816U, 12801014656U, 12809404288U, + 12817789312U, 12826181504U, 12834568832U, 12842954624U, 12851345792U, + 12859732352U, 12868122496U, 12876512128U, 12884901248U, 12893289088U, + 12901672832U, 12910067584U, 12918455168U, 12926842496U, 12935232896U, + 12943620736U, 12952009856U, 12960396928U, 12968786816U, 12977176192U, + 12985563776U, 12993951104U, 13002341504U, 13010730368U, 13019115392U, + 13027506304U, 13035895168U, 13044272512U, 13052673152U, 13061062528U, + 13069446272U, 13077838976U, 13086227072U, 13094613632U, 13103000192U, + 13111393664U, 13119782528U, 13128157568U, 13136559232U, 13144945024U, + 13153329536U, 13161724288U, 13170111872U, 13178502784U, 13186884736U, + 13195279744U, 13203667072U, 13212057472U, 13220445824U, 13228832128U, + 13237221248U, 13245610624U, 13254000512U, 13262388352U, 13270777472U, + 13279166336U, 13287553408U, 13295943296U, 13304331904U, 13312719488U, + 13321108096U, 13329494656U, 13337885824U, 13346274944U, 13354663808U, + 13363051136U, 13371439232U, 13379825024U, 13388210816U, 13396605056U, + 13404995456U, 13413380224U, 13421771392U, 13430159744U, 13438546048U, + 13446937216U, 13455326848U, 13463708288U, 13472103808U, 13480492672U, + 13488875648U, 13497269888U, 13505657728U, 13514045312U, 13522435712U, + 13530824576U, 13539210112U, 13547599232U, 13555989376U, 13564379008U, + 13572766336U, 13581154432U, 13589544832U, 13597932928U, 13606320512U, + 13614710656U, 13623097472U, 13631477632U, 13639874944U, 13648264064U, + 13656652928U, 13665041792U, 13673430656U, 13681818496U, 13690207616U, + 13698595712U, 13706982272U, 13715373184U, 13723762048U, 13732150144U, + 13740536704U, 13748926592U, 13757316224U, 13765700992U, 13774090112U, + 13782477952U, 13790869376U, 13799259008U, 13807647872U, 13816036736U, + 13824425344U, 13832814208U, 13841202304U, 13849591424U, 13857978752U, + 13866368896U, 13874754688U, 13883145344U, 13891533184U, 13899919232U, + 13908311168U, 13916692096U, 13925085056U, 13933473152U, 13941866368U, + 13950253696U, 13958643584U, 13967032192U, 13975417216U, 13983807616U, + 13992197504U, 14000582272U, 14008973696U, 14017363072U, 14025752192U, + 14034137984U, 14042528384U, 14050918016U, 14059301504U, 14067691648U, + 14076083584U, 14084470144U, 14092852352U, 14101249664U, 14109635968U, + 14118024832U, 14126407552U, 14134804352U, 14143188608U, 14151577984U, + 14159968384U, 14168357248U, 14176741504U, 14185127296U, 14193521024U, + 14201911424U, 14210301824U, 14218685056U, 14227067264U, 14235467392U, + 14243855488U, 14252243072U, 14260630144U, 14269021568U, 14277409408U, + 14285799296U, 14294187904U, 14302571392U, 14310961792U, 14319353728U, + 14327738752U, 14336130944U, 14344518784U, 14352906368U, 14361296512U, + 14369685376U, 14378071424U, 14386462592U, 14394848128U, 14403230848U, + 14411627392U, 14420013952U, 14428402304U, 14436793472U, 14445181568U, + 14453569664U, 14461959808U, 14470347904U, 14478737024U, 14487122816U, + 14495511424U, 14503901824U, 14512291712U, 14520677504U, 14529064832U, + 14537456768U, 14545845632U, 14554234496U, 14562618496U, 14571011456U, + 14579398784U, 14587789184U, 14596172672U, 14604564608U, 14612953984U, + 14621341312U, 14629724288U, 14638120832U, 14646503296U, 14654897536U, + 14663284864U, 14671675264U, 14680061056U, 14688447616U, 14696835968U, + 14705228416U, 14713616768U, 14722003328U, 14730392192U, 14738784128U, + 14747172736U, 14755561088U, 14763947648U, 14772336512U, 14780725376U, + 14789110144U, 14797499776U, 14805892736U, 14814276992U, 14822670208U, + 14831056256U, 14839444352U, 14847836032U, 14856222848U, 14864612992U, + 14872997504U, 14881388672U, 14889775744U, 14898165376U, 14906553472U, + 14914944896U, 14923329664U, 14931721856U, 14940109696U, 14948497024U, + 14956887424U, 14965276544U, 14973663616U, 14982053248U, 14990439808U, + 14998830976U, 15007216768U, 15015605888U, 15023995264U, 15032385152U, + 15040768384U, 15049154944U, 15057549184U, 15065939072U, 15074328448U, + 15082715008U, 15091104128U, 15099493504U, 15107879296U, 15116269184U, + 15124659584U, 15133042304U, 15141431936U, 15149824384U, 15158214272U, + 15166602368U, 15174991232U, 15183378304U, 15191760512U, 15200154496U, + 15208542592U, 15216931712U, 15225323392U, 15233708416U, 15242098048U, + 15250489216U, 15258875264U, 15267265408U, 15275654528U, 15284043136U, + 15292431488U, 15300819584U, 15309208192U, 15317596544U, 15325986176U, + 15334374784U, 15342763648U, 15351151744U, 15359540608U, 15367929728U, + 15376318336U, 15384706432U, 15393092992U, 15401481856U, 15409869952U, + 15418258816U, 15426649984U, 15435037568U, 15443425664U, 15451815296U, + 15460203392U, 15468589184U, 15476979328U, 15485369216U, 15493755776U, + 15502146944U, 15510534272U, 15518924416U, 15527311232U, 15535699072U, + 15544089472U, 15552478336U, 15560866688U, 15569254528U, 15577642624U, + 15586031488U, 15594419072U, 15602809472U, 15611199104U, 15619586432U, + 15627975296U, 15636364928U, 15644753792U, 15653141888U, 15661529216U, + 15669918848U, 15678305152U, 15686696576U, 15695083136U, 15703474048U, + 15711861632U, 15720251264U, 15728636288U, 15737027456U, 15745417088U, + 15753804928U, 15762194048U, 15770582656U, 15778971008U, 15787358336U, + 15795747712U, 15804132224U, 15812523392U, 15820909696U, 15829300096U, + 15837691264U, 15846071936U, 15854466944U, 15862855808U, 15871244672U, + 15879634816U, 15888020608U, 15896409728U, 15904799104U, 15913185152U, + 15921577088U, 15929966464U, 15938354816U, 15946743424U, 15955129472U, + 15963519872U, 15971907968U, 15980296064U, 15988684928U, 15997073024U, + 16005460864U, 16013851264U, 16022241152U, 16030629248U, 16039012736U, + 16047406976U, 16055794816U, 16064181376U, 16072571264U, 16080957824U, + 16089346688U, 16097737856U, 16106125184U, 16114514816U, 16122904192U, + 16131292544U, 16139678848U, 16148066944U, 16156453504U, 16164839552U, + 16173236096U, 16181623424U, 16190012032U, 16198401152U, 16206790528U, + 16215177344U, 16223567744U, 16231956352U, 16240344704U, 16248731008U, + 16257117824U, 16265504384U, 16273898624U, 16282281856U, 16290668672U, + 16299064192U, 16307449216U, 16315842176U, 16324230016U, 16332613504U, + 16341006464U, 16349394304U, 16357783168U, 16366172288U, 16374561664U, + 16382951296U, 16391337856U, 16399726208U, 16408116352U, 16416505472U, + 16424892032U, 16433282176U, 16441668224U, 16450058624U, 16458448768U, + 16466836864U, 16475224448U, 16483613056U, 16492001408U, 16500391808U, + 16508779648U, 16517166976U, 16525555328U, 16533944192U, 16542330752U, + 16550719616U, 16559110528U, 16567497088U, 16575888512U, 16584274816U, + 16592665472U, 16601051008U, 16609442944U, 16617832064U, 16626218624U, + 16634607488U, 16642996096U, 16651385728U, 16659773824U, 16668163712U, + 16676552576U, 16684938112U, 16693328768U, 16701718144U, 16710095488U, + 16718492288U, 16726883968U, 16735272832U, 16743661184U, 16752049792U, + 16760436608U, 16768827008U, 16777214336U, 16785599104U, 16793992832U, + 16802381696U, 16810768768U, 16819151744U, 16827542656U, 16835934848U, + 16844323712U, 16852711552U, 16861101952U, 16869489536U, 16877876864U, + 16886265728U, 16894653056U, 16903044736U, 16911431296U, 16919821696U, + 16928207488U, 16936592768U, 16944987776U, 16953375616U, 16961763968U, + 16970152832U, 16978540928U, 16986929536U, 16995319168U, 17003704448U, + 17012096896U, 17020481152U, 17028870784U, 17037262208U, 17045649536U, + 17054039936U, 17062426496U, 17070814336U, 17079205504U, 17087592064U, + 17095978112U, 17104369024U, 17112759424U, 17121147776U, 17129536384U, + 17137926016U, 17146314368U, 17154700928U, 17163089792U, 17171480192U, + 17179864192U, 17188256896U, 17196644992U, 17205033856U, 17213423488U, + 17221811072U, 17230198912U, 17238588032U, 17246976896U, 17255360384U, + 17263754624U, 17272143232U, 17280530048U, 17288918912U, 17297309312U, + 17305696384U, 17314085504U, 17322475136U, 17330863744U, 17339252096U, + 17347640192U, 17356026496U, 17364413824U, 17372796544U, 17381190016U, + 17389583488U, 17397972608U, 17406360704U, 17414748544U, 17423135872U, + 17431527296U, 17439915904U, 17448303232U, 17456691584U, 17465081728U, + 17473468288U, 17481857408U, 17490247552U, 17498635904U, 17507022464U, + 17515409024U, 17523801728U, 17532189824U, 17540577664U, 17548966016U, + 17557353344U, 17565741184U, 17574131584U, 17582519168U, 17590907008U, + 17599296128U, 17607687808U, 17616076672U, 17624455808U, 17632852352U, + 17641238656U, 17649630848U, 17658018944U, 17666403968U, 17674794112U, + 17683178368U, 17691573376U, 17699962496U, 17708350592U, 17716739968U, + 17725126528U, 17733517184U, 17741898112U, 17750293888U, 17758673024U, + 17767070336U, 17775458432U, 17783848832U, 17792236928U, 17800625536U, + 17809012352U, 17817402752U, 17825785984U, 17834178944U, 17842563968U, + 17850955648U, 17859344512U, 17867732864U, 17876119424U, 17884511872U, + 17892900224U, 17901287296U, 17909677696U, 17918058112U, 17926451072U, + 17934843776U, 17943230848U, 17951609216U, 17960008576U, 17968397696U, + 17976784256U, 17985175424U, 17993564032U, 18001952128U, 18010339712U, + 18018728576U, 18027116672U, 18035503232U, 18043894144U, 18052283264U, + 18060672128U, 18069056384U, 18077449856U, 18085837184U, 18094225792U, + 18102613376U, 18111004544U, 18119388544U, 18127781248U, 18136170368U, + 18144558976U, 18152947328U, 18161336192U, 18169724288U, 18178108544U, + 18186498944U, 18194886784U, 18203275648U, 18211666048U, 18220048768U, + 18228444544U, 18236833408U, 18245220736U +}; + + +// Generated with the following Mathematica Code: + +// GetCacheSizes[n_] := Module[{ +// DataSetSizeBytesInit = 2^30, +// MixBytes = 128, +// DataSetGrowth = 2^23, +// HashBytes = 64, +// CacheMultiplier = 1024, +// j = 0}, +// Reap[ +// While[j < n, +// Module[{i = Floor[(DataSetSizeBytesInit + DataSetGrowth * j) / (CacheMultiplier * HashBytes)]}, +// While[! PrimeQ[i], i--]; +// Sow[i*HashBytes]; j++]]]][[2]][[1]] + +const size_t cache_sizes[] = { + 1048384U, 1055552U, 1064512U, 1072832U, 1080896U, 1089344U, 1096768U, + 1104448U, 1113664U, 1121216U, 1130176U, 1138624U, 1146304U, 1155008U, + 1162816U, 1171264U, 1179328U, 1187392U, 1195456U, 1203392U, 1210816U, + 1220416U, 1227712U, 1236416U, 1244608U, 1253312U, 1261376U, 1268416U, + 1277632U, 1285696U, 1294016U, 1302208U, 1310656U, 1318336U, 1326784U, + 1334848U, 1342912U, 1350848U, 1359808U, 1366208U, 1376192U, 1383488U, + 1392448U, 1400384U, 1408832U, 1416512U, 1425344U, 1433408U, 1440704U, + 1449664U, 1458112U, 1466048U, 1474496U, 1482688U, 1490752U, 1498688U, + 1507136U, 1515328U, 1523264U, 1531456U, 1539904U, 1547584U, 1556288U, + 1564352U, 1572544U, 1580608U, 1588544U, 1596992U, 1605568U, 1612096U, + 1621952U, 1630144U, 1637696U, 1645888U, 1654336U, 1662784U, 1671104U, + 1679168U, 1686848U, 1695296U, 1702208U, 1711168U, 1720256U, 1727552U, + 1736128U, 1744576U, 1751488U, 1760576U, 1769408U, 1777472U, 1785664U, + 1793984U, 1801664U, 1810112U, 1818304U, 1826624U, 1834816U, 1842752U, + 1851328U, 1858112U, 1867456U, 1875904U, 1883968U, 1892288U, 1899712U, + 1908416U, 1916608U, 1924544U, 1932992U, 1940672U, 1948736U, 1956928U, + 1965632U, 1973824U, 1982144U, 1989824U, 1998784U, 2006848U, 2014784U, + 2022848U, 2031424U, 2038976U, 2047424U, 2055616U, 2064064U, 2072384U, + 2080448U, 2088512U, 2095936U, 2104768U, 2113472U, 2121664U, 2127808U, + 2137792U, 2146112U, 2153408U, 2162624U, 2170304U, 2178496U, 2186944U, + 2195392U, 2203456U, 2211136U, 2219968U, 2227648U, 2236096U, 2244416U, + 2250944U, 2260928U, 2268736U, 2276672U, 2283328U, 2293696U, 2301632U, + 2309312U, 2317888U, 2325952U, 2334656U, 2342848U, 2350144U, 2358848U, + 2366656U, 2375488U, 2383552U, 2391616U, 2400064U, 2407616U, 2415808U, + 2424256U, 2432704U, 2439616U, 2448704U, 2457152U, 2464064U, 2473792U, + 2482112U, 2489792U, 2497472U, 2506432U, 2514752U, 2522816U, 2531264U, + 2539456U, 2547136U, 2555456U, 2564032U, 2572096U, 2578496U, 2587712U, + 2595776U, 2604736U, 2613056U, 2620736U, 2629184U, 2637632U, 2645824U, + 2653888U, 2662208U, 2670016U, 2678464U, 2686912U, 2694464U, 2703296U, + 2710976U, 2719424U, 2727104U, 2736064U, 2743232U, 2752192U, 2760512U, + 2768704U, 2777024U, 2785088U, 2792512U, 2800576U, 2809024U, 2817856U, + 2826176U, 2833984U, 2840896U, 2850752U, 2858048U, 2867008U, 2875328U, + 2883392U, 2891584U, 2899648U, 2908096U, 2915648U, 2924224U, 2932672U, + 2940736U, 2948672U, 2956736U, 2964928U, 2973248U, 2981824U, 2988992U, + 2997184U, 3005248U, 3013952U, 3022144U, 3030592U, 3037376U, 3046976U, + 3055552U, 3063616U, 3070784U, 3079744U, 3087808U, 3096512U, 3103808U, + 3111872U, 3121088U, 3128896U, 3137216U, 3144896U, 3153856U, 3161152U, + 3169984U, 3178432U, 3186496U, 3194816U, 3203008U, 3210176U, 3218624U, + 3227072U, 3235264U, 3243712U, 3250496U, 3259456U, 3268544U, 3276736U, + 3283648U, 3292736U, 3301184U, 3308224U, 3317696U, 3324736U, 3333184U, + 3342272U, 3348544U, 3357248U, 3365312U, 3374912U, 3383104U, 3390784U, + 3399488U, 3407296U, 3414976U, 3424192U, 3432256U, 3440576U, 3448768U, + 3456832U, 3464896U, 3473216U, 3480128U, 3489344U, 3497408U, 3505856U, + 3514048U, 3521344U, 3530432U, 3538624U, 3546304U, 3555008U, 3563072U, + 3571648U, 3579712U, 3587392U, 3595456U, 3603904U, 3612352U, 3620416U, + 3628864U, 3636928U, 3645248U, 3652928U, 3660992U, 3669184U, 3677888U, + 3685952U, 3694528U, 3702592U, 3710528U, 3719104U, 3727168U, 3735488U, + 3742784U, 3751232U, 3759424U, 3765184U, 3775808U, 3783872U, 3792832U, + 3800768U, 3808832U, 3816256U, 3825344U, 3832768U, 3841856U, 3849536U, + 3857344U, 3866432U, 3874496U, 3882304U, 3890752U, 3899072U, 3907264U, + 3914816U, 3923008U, 3930688U, 3939904U, 3947968U, 3956416U, 3964736U, + 3972544U, 3981248U, 3988928U, 3997376U, 4005824U, 4012864U, 4020928U, + 4030144U, 4038592U, 4045504U, 4054592U, 4063168U, 4071104U, 4079552U, + 4087232U, 4095808U, 4103872U, 4111168U, 4120384U, 4127936U, 4136512U, + 4144832U, 4153024U, 4160704U, 4169408U, 4177216U, 4186048U, 4193344U, + 4202048U, 4210496U, 4217536U, 4227008U, 4235072U, 4243264U, 4251584U, + 4259392U, 4267712U, 4275776U, 4284352U, 4291904U, 4300096U, 4307648U, + 4316992U, 4325056U, 4333376U, 4341056U, 4349888U, 4357568U, 4366016U, + 4374464U, 4382528U, 4390208U, 4398656U, 4407232U, 4413632U, 4423616U, + 4431808U, 4439744U, 4447936U, 4455872U, 4463296U, 4472128U, 4480576U, + 4489024U, 4497344U, 4505152U, 4512448U, 4520896U, 4530112U, 4537664U, + 4546496U, 4554688U, 4562752U, 4570816U, 4579264U, 4586944U, 4595648U, + 4603712U, 4611392U, 4619072U, 4628032U, 4635584U, 4643776U, 4652864U, + 4660672U, 4669376U, 4677056U, 4684096U, 4693184U, 4702144U, 4710208U, + 4718528U, 4726336U, 4734272U, 4742464U, 4750784U, 4759232U, 4767296U, + 4775872U, 4783808U, 4791872U, 4797376U, 4808512U, 4816192U, 4825024U, + 4832704U, 4841024U, 4849472U, 4856512U, 4865984U, 4874176U, 4882112U, + 4889792U, 4898752U, 4906688U, 4913984U, 4922816U, 4931008U, 4938944U, + 4946624U, 4955584U, 4964032U, 4972096U, 4980032U, 4988864U, 4997056U, + 5004992U, 5012288U, 5020096U, 5029312U, 5037632U, 5045696U, 5052224U, + 5062592U, 5070784U, 5078848U, 5086784U, 5095232U, 5100736U, 5111488U, + 5119936U, 5127104U, 5136064U, 5143616U, 5151424U, 5160256U, 5168704U, + 5175232U, 5185472U, 5192384U, 5199296U, 5209664U, 5218112U, 5225536U, + 5233472U, 5242816U, 5250496U, 5258944U, 5267264U, 5274944U, 5283776U, + 5290048U, 5300032U, 5308096U, 5316544U, 5323328U, 5331904U, 5340736U, + 5349056U, 5356864U, 5365312U, 5372096U, 5381696U, 5390272U, 5398336U, + 5405888U, 5413696U, 5422784U, 5430976U, 5439424U, 5446976U, 5455808U, + 5463616U, 5471168U, 5480128U, 5488064U, 5494592U, 5504704U, 5513152U, + 5521216U, 5529536U, 5536576U, 5544256U, 5554112U, 5559616U, 5570368U, + 5577664U, 5586752U, 5594944U, 5603008U, 5611456U, 5619392U, 5627584U, + 5634368U, 5643328U, 5651264U, 5659328U, 5667008U, 5675584U, 5684416U, + 5692864U, 5701568U, 5709632U, 5717056U, 5725376U, 5734336U, 5740096U, + 5750336U, 5758912U, 5766848U, 5775296U, 5782976U, 5790784U, 5799616U, + 5807936U, 5815232U, 5823808U, 5832256U, 5840192U, 5848768U, 5856832U, + 5864896U, 5873344U, 5879872U, 5888576U, 5897792U, 5905216U, 5914432U, + 5920448U, 5930944U, 5938624U, 5947328U, 5955392U, 5963456U, 5971648U, + 5979328U, 5988032U, 5995712U, 6003904U, 6012736U, 6021056U, 6029248U, + 6037184U, 6045632U, 6053312U, 6061376U, 6070208U, 6077504U, 6086464U, + 6094784U, 6101696U, 6110912U, 6118592U, 6127168U, 6135616U, 6143296U, + 6150208U, 6158912U, 6168128U, 6175808U, 6182464U, 6192832U, 6201152U, + 6209344U, 6217664U, 6224576U, 6233408U, 6241472U, 6249664U, 6258496U, + 6266816U, 6275008U, 6281152U, 6291136U, 6299456U, 6306752U, 6314816U, + 6323776U, 6332096U, 6339392U, 6348224U, 6356288U, 6364096U, 6373184U, + 6381376U, 6389696U, 6397504U, 6404416U, 6413632U, 6421952U, 6430016U, + 6437824U, 6446912U, 6454592U, 6463168U, 6471616U, 6478144U, 6487232U, + 6496192U, 6504128U, 6511936U, 6520256U, 6528832U, 6536896U, 6544576U, + 6553408U, 6561472U, 6569792U, 6577216U, 6586304U, 6592448U, 6601024U, + 6610624U, 6619072U, 6627136U, 6634816U, 6643264U, 6650816U, 6659776U, + 6667712U, 6675904U, 6682688U, 6691904U, 6700864U, 6709184U, 6717376U, + 6724544U, 6733504U, 6741824U, 6749888U, 6756032U, 6766528U, 6773056U, + 6782912U, 6790976U, 6798016U, 6807488U, 6815168U, 6823744U, 6832064U, + 6840128U, 6847552U, 6855872U, 6864064U, 6872128U, 6880576U, 6889408U, + 6897472U, 6905792U, 6913472U, 6920896U, 6930368U, 6938432U, 6946624U, + 6953536U, 6963136U, 6971072U, 6979136U, 6986944U, 6995392U, 7003712U, + 7012288U, 7019072U, 7028416U, 7036352U, 7044416U, 7051712U, 7060672U, + 7069376U, 7077568U, 7085504U, 7092544U, 7102016U, 7110592U, 7118656U, + 7126208U, 7135168U, 7143104U, 7150912U, 7159744U, 7167808U, 7175744U, + 7184192U, 7191232U, 7200448U, 7207744U, 7216576U, 7224128U, 7233472U, + 7241536U, 7249856U, 7256512U, 7264832U, 7274048U, 7282112U, 7290176U, + 7298752U, 7306688U, 7315136U, 7322816U, 7331392U, 7339456U, 7347776U, + 7356224U, 7364288U, 7371712U, 7380928U, 7387456U, 7396544U, 7404352U, + 7413568U, 7421632U, 7429696U, 7436864U, 7446464U, 7454144U, 7461952U, + 7470784U, 7478336U, 7487296U, 7495616U, 7503424U, 7511872U, 7520192U, + 7527616U, 7536448U, 7544512U, 7551424U, 7560128U, 7568576U, 7577536U, + 7583552U, 7592512U, 7600448U, 7610048U, 7618496U, 7626176U, 7634752U, + 7642816U, 7651264U, 7659328U, 7667008U, 7675456U, 7683136U, 7691584U, + 7700416U, 7707584U, 7716416U, 7724224U, 7733056U, 7740608U, 7749184U, + 7756096U, 7765952U, 7774016U, 7781824U, 7790528U, 7798592U, 7805888U, + 7814336U, 7822784U, 7831232U, 7839296U, 7847104U, 7855552U, 7863616U, + 7872448U, 7880128U, 7888576U, 7896256U, 7905088U, 7912768U, 7920448U, + 7928768U, 7937344U, 7945792U, 7953728U, 7959488U, 7970752U, 7978816U, + 7987136U, 7994816U, 8003392U, 8011712U, 8019904U, 8027456U, 8035264U, + 8044352U, 8052544U, 8060224U, 8069056U, 8076736U, 8084672U, 8093504U, + 8101312U, 8110016U, 8117696U, 8125888U, 8134592U, 8142016U, 8149952U, + 8159168U, 8166976U, 8175296U, 8183488U, 8191808U, 8199616U, 8207296U, + 8216128U, 8224576U, 8232256U, 8241088U, 8248256U, 8257472U, 8264128U, + 8273728U, 8281792U, 8290112U, 8297152U, 8305216U, 8314816U, 8322752U, + 8330944U, 8339392U, 8347072U, 8355392U, 8363968U, 8371904U, 8379328U, + 8388544U, 8394944U, 8404544U, 8412736U, 8421184U, 8429504U, 8437696U, + 8445376U, 8452544U, 8460736U, 8470208U, 8478016U, 8486848U, 8494144U, + 8503232U, 8511296U, 8519488U, 8527424U, 8534464U, 8543936U, 8552384U, + 8558912U, 8568128U, 8575936U, 8584256U, 8593216U, 8601536U, 8608832U, + 8616896U, 8625728U, 8634176U, 8641856U, 8649664U, 8658112U, 8666176U, + 8674112U, 8682944U, 8691136U, 8699456U, 8707648U, 8716096U, 8724416U, + 8732608U, 8740672U, 8748352U, 8756032U, 8764864U, 8773568U, 8781376U, + 8789824U, 8796992U, 8806208U, 8814272U, 8822336U, 8830912U, 8838848U, + 8847296U, 8854336U, 8863552U, 8871488U, 8879296U, 8887616U, 8894528U, + 8904512U, 8911424U, 8920768U, 8928704U, 8936128U, 8944576U, 8953664U, + 8960576U, 8970176U, 8977984U, 8986304U, 8994112U, 9002432U, 9011008U, + 9018176U, 9026624U, 9035584U, 9043904U, 9052096U, 9059264U, 9068096U, + 9075904U, 9084224U, 9092288U, 9100352U, 9108928U, 9116992U, 9125824U, + 9133504U, 9141824U, 9150272U, 9157952U, 9164608U, 9174848U, 9182912U, + 9190976U, 9199552U, 9205312U, 9215936U, 9222592U, 9232192U, 9240512U, + 9248704U, 9256256U, 9264832U, 9272896U, 9281344U, 9288896U, 9297088U, + 9305536U, 9313984U, 9322304U, 9329728U, 9337792U, 9346112U, 9355072U, + 9363136U, 9371072U, 9378752U, 9387712U, 9395648U, 9404224U, 9411008U, + 9420608U, 9428416U, 9436864U, 9445312U, 9453376U, 9460928U, 9468736U, + 9477824U, 9485248U, 9493696U, 9502144U, 9509056U, 9518528U, 9527104U, + 9535424U, 9543616U, 9551296U, 9559744U, 9568192U, 9576256U, 9584576U, + 9591872U, 9600704U, 9608384U, 9615808U, 9624512U, 9633472U, 9641536U, + 9649856U, 9658048U, 9665728U, 9674432U, 9682496U, 9691072U, 9699136U, + 9707072U, 9715136U, 9722176U, 9732032U, 9740096U, 9747904U, 9756352U, + 9764288U, 9771584U, 9780544U, 9789376U, 9796928U, 9804224U, 9813952U, + 9822016U, 9829696U, 9838016U, 9845824U, 9852992U, 9863104U, 9870656U, + 9878464U, 9887552U, 9895744U, 9903808U, 9912128U, 9920192U, 9927616U, + 9936064U, 9944768U, 9952576U, 9960128U, 9969472U, 9977152U, 9985216U, + 9994048U, 10001216U, 10007744U, 10018496U, 10026944U, 10035136U, 10042432U, + 10051264U, 10059584U, 10067648U, 10075712U, 10083904U, 10091456U, 10100672U, + 10108864U, 10116928U, 10124864U, 10133056U, 10140736U, 10149824U, 10156736U, + 10165952U, 10173376U, 10182208U, 10190528U, 10198336U, 10206272U, 10213696U, + 10223296U, 10231744U, 10238656U, 10247488U, 10256192U, 10263872U, 10272448U, + 10280896U, 10288448U, 10296512U, 10305088U, 10313536U, 10321088U, 10330048U, + 10337984U, 10346176U, 10354112U, 10362304U, 10369088U, 10377152U, 10386752U, + 10394816U, 10403648U, 10411712U, 10418624U, 10427968U, 10436032U, 10444736U, + 10452928U, 10459712U, 10468672U, 10476608U, 10484416U, 10491328U, 10501952U, + 10509376U, 10517824U, 10526528U, 10534336U, 10542656U, 10549696U, 10559168U, + 10566592U, 10575808U, 10583488U, 10590656U, 10599488U, 10607936U, 10616768U, + 10624832U, 10630336U, 10640576U, 10649536U, 10655168U, 10665152U, 10674112U, + 10682176U, 10690496U, 10698176U, 10705216U, 10715072U, 10722752U, 10731328U, + 10739264U, 10746688U, 10754752U, 10761664U, 10770752U, 10779712U, 10787776U, + 10796608U, 10803392U, 10812352U, 10821056U, 10828736U, 10837952U, 10846144U, + 10853824U, 10861376U, 10869952U, 10877248U, 10887104U, 10895296U, 10903232U, + 10910912U, 10918976U, 10927936U, 10935872U, 10944448U, 10952384U, 10960832U, + 10968512U, 10977088U, 10985024U, 10992832U, 11000896U, 11009984U, 11018048U, + 11026112U, 11034304U, 11042624U, 11050432U, 11058368U, 11064512U, 11075392U, + 11083712U, 11091776U, 11099584U, 11107904U, 11115968U, 11124416U, 11131712U, + 11141056U, 11148608U, 11157184U, 11165248U, 11173312U, 11180992U, 11189056U, + 11197376U, 11206592U, 11214656U, 11222336U, 11230784U, 11238464U, 11246528U, + 11254976U, 11263552U, 11271872U, 11279552U, 11288512U, 11296576U, 11304256U, + 11312192U, 11320768U, 11329216U, 11336384U, 11345216U, 11352512U, 11362112U, + 11369408U, 11378624U, 11386688U, 11394496U, 11402816U, 11411264U, 11418688U, + 11427776U, 11435584U, 11444032U, 11452096U, 11459648U, 11467072U, 11476928U, + 11484992U, 11493184U, 11500352U, 11509312U, 11517248U, 11524928U, 11534144U, + 11542208U, 11550272U, 11556416U, 11566784U, 11574208U, 11581376U, 11589568U, + 11599552U, 11607104U, 11616064U, 11623616U, 11632576U, 11639872U, 11648704U, + 11657024U, 11664704U, 11672896U, 11681216U, 11689792U, 11697856U, 11705536U, + 11714368U, 11722688U, 11730496U, 11737408U, 11745728U, 11754304U, 11763008U, + 11770816U, 11779648U, 11788096U, 11795776U, 11804608U, 11812544U, 11820992U, + 11829184U, 11837248U, 11844928U, 11852096U, 11860928U, 11869888U, 11878336U, + 11886272U, 11894336U, 11902144U, 11910848U, 11919296U, 11925952U, 11934784U, + 11943616U, 11951552U, 11960128U, 11968192U, 11976512U, 11983168U, 11992768U, + 12000832U, 12008896U, 12016832U, 12025408U, 12033856U, 12042176U, 12049984U, + 12058048U, 12066112U, 12073792U, 12082624U, 12091328U, 12098752U, 12106816U, + 12115904U, 12124096U, 12131776U, 12140224U, 12148672U, 12156736U, 12164032U, + 12173248U, 12181184U, 12186176U, 12197824U, 12205888U, 12213952U, 12218944U, + 12230336U, 12238784U, 12246592U, 12254272U, 12262336U, 12269888U, 12279104U, + 12287936U, 12295744U, 12304064U, 12312512U, 12319936U, 12328768U, 12337088U, + 12344896U, 12352832U, 12361408U, 12368704U, 12377152U, 12384832U, 12394432U, + 12402496U, 12409024U, 12417728U, 12426688U, 12433216U, 12443584U, 12450752U, + 12459968U, 12468032U, 12475712U, 12484544U, 12492608U, 12500416U, 12508352U, + 12517184U, 12525376U, 12532288U, 12541888U, 12549568U, 12556864U, 12565568U, + 12574528U, 12582208U, 12590528U, 12598592U, 12607424U, 12615488U, 12623552U, + 12631744U, 12638656U, 12647744U, 12656576U, 12664768U, 12672832U, 12680896U, + 12688576U, 12697408U, 12704192U, 12713408U, 12721216U, 12729664U, 12738496U, + 12745792U, 12754496U, 12762688U, 12769472U, 12779456U, 12787648U, 12795712U, + 12804032U, 12812224U, 12819008U, 12828352U, 12836672U, 12844736U, 12851648U, + 12859456U, 12868672U, 12877504U, 12885568U, 12892864U, 12902336U, 12909376U, + 12918208U, 12926656U, 12934976U, 12942784U, 12951104U, 12959552U, 12967744U, + 12976064U, 12984256U, 12991936U, 12999488U, 13007936U, 13016768U, 13021504U, + 13033024U, 13041472U, 13049408U, 13057472U, 13065664U, 13072064U, 13081408U, + 13089344U, 13098688U, 13107008U, 13115072U, 13122752U, 13130944U, 13139648U, + 13147712U, 13155776U, 13162432U, 13172672U, 13180864U, 13188928U, 13196992U, + 13203392U, 13213504U, 13219264U, 13228736U, 13236928U, 13244992U, 13253056U, + 13262528U, 13269952U, 13278784U, 13285952U, 13295552U, 13303616U, 13311808U, + 13319744U, 13328192U, 13336256U, 13344704U, 13352384U, 13360576U, 13369024U, + 13377344U, 13385408U, 13393216U, 13401664U, 13410112U, 13418176U, 13426496U, + 13434688U, 13442368U, 13451072U, 13459136U, 13466944U, 13475648U, 13482944U, + 13491904U, 13500352U, 13508288U, 13516736U, 13524416U, 13532224U, 13541312U, + 13549504U, 13556288U, 13564736U, 13573184U, 13581376U, 13587008U, 13598656U, + 13605952U, 13612864U, 13622464U, 13631168U, 13639616U, 13647808U, 13655104U, + 13663424U, 13671872U, 13680064U, 13688768U, 13696576U, 13705024U, 13712576U, + 13721536U, 13729216U, 13737664U, 13746112U, 13753024U, 13759552U, 13770304U, + 13777856U, 13786688U, 13793984U, 13802176U, 13811264U, 13819328U, 13827904U, + 13835456U, 13844416U, 13851584U, 13860544U, 13868992U, 13877056U, 13884608U, + 13893184U, 13901248U, 13909696U, 13917632U, 13925056U, 13934528U, 13942336U, + 13950784U, 13959104U, 13966912U, 13975232U, 13982656U, 13991872U, 13999936U, + 14007872U, 14016064U, 14024512U, 14032064U, 14040896U, 14049088U, 14057408U, + 14065088U, 14072896U, 14081344U, 14089664U, 14097856U, 14106304U, 14114752U, + 14122688U, 14130752U, 14138816U, 14147008U, 14155072U, 14163904U, 14170432U, + 14180288U, 14187328U, 14196032U, 14204864U, 14212672U, 14220736U, 14229056U, + 14237504U, 14245568U, 14253632U, 14261824U, 14269888U, 14278592U, 14286656U, + 14293696U, 14302784U, 14309696U, 14317504U, 14326336U, 14335936U, 14343232U, + 14352064U, 14359232U, 14368064U, 14376512U, 14384576U, 14393024U, 14401472U, + 14409536U, 14416832U, 14424512U, 14433856U, 14440768U, 14449984U, 14458816U, + 14465728U, 14474816U, 14482112U, 14491328U, 14499392U, 14506816U, 14516032U, + 14524352U, 14531392U, 14540224U, 14547392U, 14556992U, 14565184U, 14573248U, + 14580928U, 14588864U, 14596928U, 14606272U, 14613824U, 14622656U, 14630464U, + 14638912U, 14646976U, 14655296U, 14661952U, 14671808U, 14679872U, 14687936U, + 14696384U, 14704576U, 14710336U, 14720192U, 14729152U, 14736448U, 14745152U, + 14752448U, 14761792U, 14769856U, 14777024U, 14785984U, 14792384U, 14802752U, + 14810816U, 14819264U, 14827328U, 14835136U, 14843072U, 14851264U, 14860096U, + 14867648U, 14876096U, 14884544U, 14892736U, 14900672U, 14907968U, 14917312U, + 14924864U, 14933824U, 14939968U, 14950336U, 14957632U, 14966464U, 14974912U, + 14982592U, 14991296U, 14999104U, 15006272U, 15015232U, 15023936U, 15031616U, + 15040448U, 15047488U, 15055552U, 15063616U, 15073216U, 15079744U, 15088064U, + 15097664U, 15105344U, 15113792U, 15122368U, 15130048U, 15137728U, 15146176U, + 15154112U, 15162688U, 15171392U, 15179456U, 15187264U, 15194176U, 15204032U, + 15212224U, 15220544U, 15227456U, 15237056U, 15245248U, 15253184U, 15261632U, + 15269824U, 15277376U, 15285824U, 15293888U, 15301568U, 15310784U, 15318848U, + 15325504U, 15335104U, 15343168U, 15350848U, 15359936U, 15367232U, 15373376U, + 15384256U, 15392576U, 15400384U, 15408832U, 15417152U, 15424832U, 15433024U, + 15441344U, 15449152U, 15457088U, 15466432U, 15474112U, 15482816U, 15488576U, + 15499072U, 15505856U, 15514816U, 15523264U, 15531584U, 15540032U, 15547328U, + 15553984U, 15564608U, 15571904U, 15579968U, 15589312U, 15597376U, 15605696U, + 15612992U, 15621824U, 15630016U, 15638464U, 15646144U, 15654592U, 15662912U, + 15671104U, 15677248U, 15686848U, 15693376U, 15701696U, 15712064U, 15720256U, + 15728576U, 15736384U, 15744704U, 15752512U, 15761344U, 15769024U, 15777728U, + 15785152U, 15793984U, 15802048U, 15809984U, 15817024U, 15825856U, 15834944U, + 15843008U, 15849664U, 15859136U, 15866432U, 15876032U, 15884096U, 15892288U, + 15900608U, 15908416U, 15916864U, 15924928U, 15930176U, 15941056U, 15949504U, + 15957824U, 15965632U, 15973952U, 15982528U, 15990592U, 15998272U, 16006976U, + 16012736U, 16023104U, 16031296U, 16039616U, 16048064U, 16055744U, 16064192U, + 16071488U, 16080832U, 16088768U, 16097216U, 16104896U, 16112704U, 16121792U, + 16129856U, 16138048U, 16146112U, 16154176U, 16162624U, 16170688U, 16177856U, + 16186816U, 16195136U, 16202176U, 16211648U, 16220096U, 16228288U, 16235584U, + 16244672U, 16252864U, 16260544U, 16269248U, 16277056U, 16285504U, 16291648U, + 16301632U, 16309312U, 16318144U, 16326208U, 16333888U, 16342336U, 16351168U, + 16359232U, 16367552U, 16375616U, 16383296U, 16391744U, 16398016U, 16407616U, + 16415936U, 16424896U, 16432448U, 16440896U, 16449088U, 16457024U, 16465472U, + 16474048U, 16481216U, 16490048U, 16498624U, 16505792U, 16513984U, 16523072U, + 16531136U, 16538944U, 16547264U, 16555328U, 16563776U, 16570816U, 16578112U, + 16587712U, 16596544U, 16604992U, 16613312U, 16620608U, 16629568U, 16637888U, + 16645696U, 16653632U, 16661696U, 16669888U, 16677568U, 16686272U, 16695232U, + 16703168U, 16710464U, 16719424U, 16726592U, 16733888U, 16744384U, 16752448U, + 16760768U, 16768448U, 16776896U, 16785344U, 16793536U, 16801216U, 16809664U, + 16818112U, 16826176U, 16833472U, 16842688U, 16850752U, 16859072U, 16866368U, + 16875328U, 16883392U, 16891712U, 16899776U, 16907456U, 16915264U, 16924352U, + 16931776U, 16940608U, 16949056U, 16957376U, 16965056U, 16973248U, 16981696U, + 16990144U, 16997056U, 17005888U, 17014208U, 17021504U, 17031104U, 17039296U, + 17046976U, 17055424U, 17062592U, 17070016U, 17079488U, 17087936U, 17096512U, + 17104576U, 17113024U, 17121088U, 17129408U, 17136832U, 17145664U, 17152832U, + 17161792U, 17170112U, 17177792U, 17186368U, 17194304U, 17202496U, 17211328U, + 17218624U, 17227712U, 17233984U, 17243584U, 17251904U, 17259712U, 17266624U, + 17276608U, 17284672U, 17292224U, 17301056U, 17309632U, 17317568U, 17326016U, + 17333824U, 17342272U, 17350208U, 17358784U, 17366848U, 17374912U, 17382592U, + 17390656U, 17399488U, 17406784U, 17413952U, 17423936U, 17432512U, 17440448U, + 17447744U, 17456704U, 17464768U, 17472064U, 17481536U, 17489344U, 17495488U, + 17505728U, 17513792U, 17522368U, 17530816U, 17538112U, 17546944U, 17555264U, + 17563072U, 17569856U, 17579456U, 17587904U, 17596352U, 17603776U, 17611712U, + 17620672U, 17628992U, 17637184U, 17645504U, 17653568U, 17661632U, 17669824U, + 17677376U, 17686208U, 17693888U, 17702336U, 17710144U, 17718208U, 17726528U, + 17734336U, 17743808U, 17751872U, 17759936U, 17766592U, 17776448U, 17784512U, + 17791936U, 17801152U, 17809216U, 17817152U +}; + +#ifdef __cplusplus +} +#endif
\ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/endian.h b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/endian.h index 9ca842e47..9ca842e47 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/endian.h +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/endian.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/ethash.h b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/ethash.h index 62edd0082..82421b868 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/ethash.h +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/ethash.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>. */ + /** @file ethash.h * @date 2015 */ @@ -25,9 +26,10 @@ #include <stddef.h> #include "compiler.h" -#define REVISION 18 -#define DAGSIZE_BYTES_INIT 1073741824U -#define DAG_GROWTH 113000000U +#define REVISION 20 +#define DAGSIZE_BYTES_INIT 1073741824U // 2**30 +#define DAG_GROWTH 8388608U // 2**23 +#define CACHE_MULTIPLIER 1024 #define EPOCH_LENGTH 30000U #define MIX_BYTES 128 #define DAG_PARENTS 256 @@ -48,8 +50,8 @@ typedef struct ethash_return_value { uint8_t mix_hash[32]; } ethash_return_value; -size_t const ethash_get_datasize(const uint32_t block_number); -size_t const ethash_get_cachesize(const uint32_t block_number); +size_t ethash_get_datasize(const uint32_t block_number); +size_t ethash_get_cachesize(const uint32_t block_number); // initialize the parameters static inline void ethash_params_init(ethash_params *params, const uint32_t block_number) { @@ -58,7 +60,7 @@ static inline void ethash_params_init(ethash_params *params, const uint32_t bloc } typedef struct ethash_cache { - void *mem; + void *mem; } ethash_cache; void ethash_mkcache(ethash_cache *cache, ethash_params const *params, const uint8_t seed[32]); @@ -66,6 +68,11 @@ void ethash_compute_full_data(void *mem, ethash_params const *params, ethash_cac void ethash_full(ethash_return_value *ret, void const *full_mem, ethash_params const *params, const uint8_t header_hash[32], const uint64_t nonce); void ethash_light(ethash_return_value *ret, ethash_cache const *cache, ethash_params const *params, const uint8_t header_hash[32], const uint64_t nonce); +static inline void ethash_prep_light(void *cache, ethash_params const *params, const uint8_t seed[32]) { ethash_cache c; c.mem = cache; ethash_mkcache(&c, params, seed); } +static inline void ethash_compute_light(ethash_return_value *ret, void const *cache, ethash_params const *params, const uint8_t header_hash[32], const uint64_t nonce) { ethash_cache c; c.mem = (void*)cache; ethash_light(ret, &c, params, header_hash, nonce); } +static inline void ethash_prep_full(void *full, ethash_params const *params, void const *cache) { ethash_cache c; c.mem = (void*)cache; ethash_compute_full_data(full, params, &c); } +static inline void ethash_compute_full(ethash_return_value *ret, void const *full, ethash_params const *params, const uint8_t header_hash[32], const uint64_t nonce) { ethash_full(ret, full, params, header_hash, nonce); } + static inline int ethash_check_difficulty( const uint8_t hash[32], const uint8_t difficulty[32]) { diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/fnv.h b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/fnv.h index edabeaae2..edabeaae2 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/fnv.h +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/fnv.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/internal.c b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.c index cc48717d0..a2b82d375 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/internal.c +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.c @@ -31,18 +31,18 @@ #ifdef WITH_CRYPTOPP -#include "SHA3_cryptopp.h" +#include "sha3_cryptopp.h" #else #include "sha3.h" #endif // WITH_CRYPTOPP -size_t const ethash_get_datasize(const uint32_t block_number) { +size_t ethash_get_datasize(const uint32_t block_number) { assert(block_number / EPOCH_LENGTH < 500); return dag_sizes[block_number / EPOCH_LENGTH]; } -size_t const ethash_get_cachesize(const uint32_t block_number) { +size_t ethash_get_cachesize(const uint32_t block_number) { assert(block_number / EPOCH_LENGTH < 500); return cache_sizes[block_number / EPOCH_LENGTH]; } @@ -283,6 +283,7 @@ int ethash_quick_check_difficulty( const uint64_t nonce, const uint8_t mix_hash[32], const uint8_t difficulty[32]) { + uint8_t return_hash[32]; ethash_quick_hash(return_hash, header_hash, nonce, mix_hash); return ethash_check_difficulty(return_hash, difficulty); diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/internal.h b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.h index bcbacdaa4..bcbacdaa4 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/internal.h +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/sha3.c b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3.c index 0c28230b8..0c28230b8 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/sha3.c +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/sha3.h b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3.h index 36a0a5301..36a0a5301 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/sha3.h +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/sha3_cryptopp.cpp b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.cpp index 9454ce04a..9454ce04a 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/sha3_cryptopp.cpp +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.cpp diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/sha3_cryptopp.h b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.h index f910960e1..f910960e1 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/sha3_cryptopp.h +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/util.c b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util.c index fbf268b7d..fbf268b7d 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/util.c +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/util.h b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util.h index 2f59076f6..2f59076f6 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/libethash/util.h +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/python/core.c b/Godeps/_workspace/src/github.com/ethereum/ethash/src/python/core.c new file mode 100644 index 000000000..f7d8be156 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/python/core.c @@ -0,0 +1,64 @@ +#include <Python.h> +#include <alloca.h> +#include <stdint.h> +#include "../libethash/ethash.h" + +static PyObject* +get_cache_size(PyObject* self, PyObject* args) +{ + unsigned long block_number; + if (!PyArg_ParseTuple(args, "k", &block_number)) + return 0; + return Py_BuildValue("i", ethash_get_cachesize(block_number)); +} + +static PyObject* +get_full_size(PyObject* self, PyObject* args) +{ + unsigned long block_number; + if (!PyArg_ParseTuple(args, "k", &block_number)) + return 0; + return Py_BuildValue("i", ethash_get_datasize(block_number)); +} + + +static PyObject* +mkcache(PyObject* self, PyObject* args) +{ + char * seed; + unsigned long cache_size; + int seed_len; + + if (!PyArg_ParseTuple(args, "ks#", &cache_size, &seed, &seed_len)) + return 0; + + if (seed_len != 32) + { + PyErr_SetString(PyExc_ValueError, + "Seed must be 32 bytes long"); + return 0; + } + + printf("cache size: %lu\n", cache_size); + ethash_params params; + params.cache_size = (size_t) cache_size; + ethash_cache cache; + cache.mem = alloca(cache_size); + ethash_mkcache(&cache, ¶ms, (uint8_t *) seed); + return PyString_FromStringAndSize(cache.mem, cache_size); +} + + +static PyMethodDef CoreMethods[] = +{ + {"get_cache_size", get_cache_size, METH_VARARGS, "Get the cache size for a given block number"}, + {"get_full_size", get_full_size, METH_VARARGS, "Get the full size for a given block number"}, + {"mkcache", mkcache, METH_VARARGS, "Makes the cache for given parameters and seed hash"}, + {NULL, NULL, 0, NULL} +}; + +PyMODINIT_FUNC +initcore(void) +{ + (void) Py_InitModule("core", CoreMethods); +} diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/CMakeLists.txt b/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/CMakeLists.txt index 431af6a99..02e2aab91 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/test/CMakeLists.txt +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/CMakeLists.txt @@ -4,7 +4,7 @@ ENDIF() IF( Boost_FOUND ) include_directories( ${Boost_INCLUDE_DIR} ) - include_directories(..) + include_directories(../../src) link_directories ( ${Boost_LIBRARY_DIRS} ) file(GLOB HEADERS "*.h") diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/test.cpp b/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.cpp index bec44e138..336713cb7 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/test/test.cpp +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.cpp @@ -13,7 +13,6 @@ #define BOOST_TEST_MAIN #include <boost/test/unit_test.hpp> -#include <libethash/ethash.h> #include <iostream> std::string bytesToHexString(const uint8_t *str, const size_t s) { @@ -90,24 +89,6 @@ BOOST_AUTO_TEST_CASE(ethash_params_init_genesis_calcifide_check) { << "actual: " << params.cache_size << "\n"); } -BOOST_AUTO_TEST_CASE(ethash_params_init_check) { - ethash_params params; - ethash_params_init(¶ms, 1971000); - const uint64_t nine_month_size = (uint64_t) 8*DAGSIZE_BYTES_INIT; - BOOST_REQUIRE_MESSAGE(params.full_size < nine_month_size, - "\nfull size: " << params.full_size << "\n" - << "should be less than or equal to: " << nine_month_size << "\n"); - BOOST_REQUIRE_MESSAGE(params.full_size + DAGSIZE_BYTES_INIT / 4 > nine_month_size, - "\nfull size + DAGSIZE_BYTES_INIT / 4: " << params.full_size + DAGSIZE_BYTES_INIT / 4 << "\n" - << "should be greater than or equal to: " << nine_month_size << "\n"); - BOOST_REQUIRE_MESSAGE(params.cache_size < nine_month_size / 1024, - "\nactual cache size: " << params.cache_size << "\n" - << "expected: " << nine_month_size / 1024 << "\n"); - BOOST_REQUIRE_MESSAGE(params.cache_size + DAGSIZE_BYTES_INIT / 4 / 1024 > nine_month_size / 1024 , - "\ncache size + DAGSIZE_BYTES_INIT / 4 / 1024: " << params.cache_size + DAGSIZE_BYTES_INIT / 4 / 1024 << "\n" - << "actual: " << nine_month_size / 32 << "\n"); -} - BOOST_AUTO_TEST_CASE(light_and_full_client_checks) { ethash_params params; uint8_t seed[32], hash[32]; diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.sh b/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.sh new file mode 100644 index 000000000..6d02d30f8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Strict mode +set -e + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" +done +TEST_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +rm -rf $TEST_DIR/build +mkdir -p $TEST_DIR/build +cd $TEST_DIR/build ; +cmake ../../.. > /dev/null +make Test +./test/c/Test diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/go/ethash_test.go b/Godeps/_workspace/src/github.com/ethereum/ethash/test/go/ethash_test.go deleted file mode 100644 index d734954e1..000000000 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/test/go/ethash_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package ethashTest - -import ( - "bytes" - "crypto/rand" - "log" - "math/big" - "testing" - - "github.com/ethereum/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/ethdb" -) - -func TestEthash(t *testing.T) { - seedHash := make([]byte, 32) - _, err := rand.Read(seedHash) - if err != nil { - panic(err) - } - - db, err := ethdb.NewMemDatabase() - if err != nil { - panic(err) - } - - blockProcessor, err := core.NewCanonical(5, db) - if err != nil { - panic(err) - } - - log.Println("Block Number: ", blockProcessor.ChainManager().CurrentBlock().Number()) - - e := ethash.New(blockProcessor.ChainManager()) - - miningHash := make([]byte, 32) - if _, err := rand.Read(miningHash); err != nil { - panic(err) - } - diff := big.NewInt(10000) - log.Println("difficulty", diff) - - nonce := uint64(0) - - ghash_full := e.FullHash(nonce, miningHash) - log.Printf("ethash full (on nonce): %x %x\n", ghash_full, nonce) - - ghash_light := e.LightHash(nonce, miningHash) - log.Printf("ethash light (on nonce): %x %x\n", ghash_light, nonce) - - if bytes.Compare(ghash_full, ghash_light) != 0 { - t.Errorf("full: %x, light: %x", ghash_full, ghash_light) - } -} diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/.gitignore b/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/.gitignore new file mode 100644 index 000000000..c304fd615 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/.gitignore @@ -0,0 +1 @@ +python-virtual-env/ diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/requirements.txt b/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/requirements.txt new file mode 100644 index 000000000..1f38dc3c7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/requirements.txt @@ -0,0 +1,2 @@ +pyethereum==0.7.522 +nose==1.3.4 diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test.sh b/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test.sh new file mode 100644 index 000000000..4a547d157 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Strict mode +set -e + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" +done +TEST_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +[ -d $TEST_DIR/python-virtual-env ] || virtualenv --system-site-packages $TEST_DIR/python-virtual-env +source $TEST_DIR/python-virtual-env/bin/activate +pip install -r $TEST_DIR/requirements.txt > /dev/null +pip install -e $TEST_DIR/../.. > /dev/null +cd $TEST_DIR +nosetests --with-doctest -v diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test_pyethash.py b/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test_pyethash.py new file mode 100644 index 000000000..ca9321e92 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test_pyethash.py @@ -0,0 +1,45 @@ +import pyethash +from random import randint + +def test_get_cache_size_not_None(): + for _ in range(100): + block_num = randint(0,12456789) + out = pyethash.core.get_cache_size(block_num) + assert out != None + +def test_get_full_size_not_None(): + for _ in range(100): + block_num = randint(0,12456789) + out = pyethash.core.get_full_size(block_num) + assert out != None + +def test_get_cache_size_based_on_EPOCH(): + for _ in range(100): + block_num = randint(0,12456789) + out1 = pyethash.core.get_cache_size(block_num) + out2 = pyethash.core.get_cache_size((block_num // pyethash.EPOCH_LENGTH) * pyethash.EPOCH_LENGTH) + assert out1 == out2 + +def test_get_full_size_based_on_EPOCH(): + for _ in range(100): + block_num = randint(0,12456789) + out1 = pyethash.core.get_full_size(block_num) + out2 = pyethash.core.get_full_size((block_num // pyethash.EPOCH_LENGTH) * pyethash.EPOCH_LENGTH) + assert out1 == out2 + +#def test_get_params_based_on_EPOCH(): +# block_num = 123456 +# out1 = pyethash.core.get_params(block_num) +# out2 = pyethash.core.get_params((block_num // pyethash.EPOCH_LENGTH) * pyethash.EPOCH_LENGTH) +# assert out1["DAG Size"] == out2["DAG Size"] +# assert out1["Cache Size"] == out2["Cache Size"] +# +#def test_get_params_returns_different_values_based_on_different_block_input(): +# out1 = pyethash.core.get_params(123456) +# out2 = pyethash.core.get_params(12345) +# assert out1["DAG Size"] != out2["DAG Size"] +# assert out1["Cache Size"] != out2["Cache Size"] +# +#def test_get_cache_smoke_test(): +# params = pyethash.core.get_params(123456) +# assert pyethash.core.mkcache(params, "~~~~") != None diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/test.sh b/Godeps/_workspace/src/github.com/ethereum/ethash/test/test.sh new file mode 100644 index 000000000..eb38f6dfc --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/test.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Strict mode +set -e + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" +done +TEST_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +echo -e "\n################# Testing JS ##################" +# TODO: Use mocha and real testing tools instead of rolling our own +cd $TEST_DIR/../js +node test.js + +echo -e "\n################# Testing C ##################" +$TEST_DIR/c/test.sh + +echo -e "\n################# Testing Python ##################" +$TEST_DIR/python/test.sh + +#echo "################# Testing Go ##################" +#$TEST_DIR/go/test.sh diff --git a/cmd/blocktest/flags.go b/cmd/blocktest/flags.go new file mode 100644 index 000000000..c811e5b85 --- /dev/null +++ b/cmd/blocktest/flags.go @@ -0,0 +1,41 @@ +/* + This file is part of go-ethereum + + go-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + go-ethereum 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. +*/ +/** + * @authors + * Gustav Simonsson <gustav.simonsson@gmail.com> + */ +package main + +import ( + "flag" + "fmt" + "os" +) + +var ( + TestFile string +) + +func Init() { + flag.Usage = func() { + fmt.Fprintf(os.Stderr, "%s <testfile>\n", os.Args[0]) + flag.PrintDefaults() + } + flag.Parse() + + TestFile = flag.Arg(0) +} diff --git a/cmd/blocktest/main.go b/cmd/blocktest/main.go new file mode 100644 index 000000000..4a05b8bee --- /dev/null +++ b/cmd/blocktest/main.go @@ -0,0 +1,320 @@ +/* + This file is part of go-ethereum + + go-ethereum 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 3 of the License, or + (at your option) any later version. + + go-ethereum 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 General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. +*/ +/** + * @authors + * Gustav Simonsson <gustav.simonsson@gmail.com> + * @date 2015 + * + */ + +package main + +import ( + "bytes" + "crypto/ecdsa" + "encoding/hex" + "encoding/json" + "fmt" + "io/ioutil" + "log" + "math/big" + "path" + "runtime" + "strconv" + "strings" + "time" + + "github.com/ethereum/go-ethereum/cmd/utils" + types "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/eth" + "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/p2p/nat" + "github.com/ethereum/go-ethereum/rlp" +) + +const ( + ClientIdentifier = "Ethereum(G)" + Version = "0.8.6" +) + +type Account struct { + Balance string + Code string + Nonce string + Storage map[string]string +} + +type BlockHeader struct { + Bloom string + Coinbase string + Difficulty string + ExtraData string + GasLimit string + GasUsed string + MixHash string + Nonce string + Number string + ParentHash string + ReceiptTrie string + SeedHash string + StateRoot string + Timestamp string + TransactionsTrie string + UncleHash string +} +type Tx struct { + Data string + GasLimit string + GasPrice string + Nonce string + R string + S string + To string + V string + Value string +} + +type Block struct { + BlockHeader BlockHeader + Rlp string + Transactions []Tx + UncleHeaders []string +} + +type Test struct { + Blocks []Block + GenesisBlockHeader BlockHeader + Pre map[string]Account +} + +var ( + Identifier string + KeyRing string + DiffTool bool + DiffType string + KeyStore string + StartRpc bool + StartWebSockets bool + RpcListenAddress string + RpcPort int + WsPort int + OutboundPort string + ShowGenesis bool + AddPeer string + MaxPeer int + GenAddr bool + BootNodes string + NodeKey *ecdsa.PrivateKey + NAT nat.Interface + SecretFile string + ExportDir string + NonInteractive bool + Datadir string + LogFile string + ConfigFile string + DebugFile string + LogLevel int + LogFormat string + Dump bool + DumpHash string + DumpNumber int + VmType int + ImportChain string + SHH bool + Dial bool + PrintVersion bool + MinerThreads int +) + +// flags specific to cli client +var ( + StartMining bool + StartJsConsole bool + InputFile string +) + +func main() { + init_vars() + + Init() + + if len(TestFile) < 1 { + log.Fatal("Please specify test file") + } + blocks, err := loadBlocksFromTestFile(TestFile) + if err != nil { + panic(err) + } + + runtime.GOMAXPROCS(runtime.NumCPU()) + + defer func() { + logger.Flush() + }() + + utils.HandleInterrupt() + + utils.InitConfig(VmType, ConfigFile, Datadir, "ethblocktest") + + ethereum, err := eth.New(ð.Config{ + Name: p2p.MakeName(ClientIdentifier, Version), + KeyStore: KeyStore, + DataDir: Datadir, + LogFile: LogFile, + LogLevel: LogLevel, + LogFormat: LogFormat, + MaxPeers: MaxPeer, + Port: OutboundPort, + NAT: NAT, + KeyRing: KeyRing, + Shh: true, + Dial: Dial, + BootNodes: BootNodes, + NodeKey: NodeKey, + MinerThreads: MinerThreads, + }) + + utils.StartRpc(ethereum, RpcListenAddress, RpcPort) + utils.StartEthereum(ethereum) + + ethereum.ChainManager().ResetWithGenesisBlock(blocks[0]) + + // fmt.Println("HURR: ", hex.EncodeToString(ethutil.Encode(blocks[0].RlpData()))) + + go ethereum.ChainManager().InsertChain(types.Blocks{blocks[1]}) + fmt.Println("OK! ") + ethereum.WaitForShutdown() +} + +func loadBlocksFromTestFile(filePath string) (blocks types.Blocks, err error) { + fileContent, err := ioutil.ReadFile(filePath) + if err != nil { + return + } + bt := *new(map[string]Test) + err = json.Unmarshal(fileContent, &bt) + if err != nil { + return + } + + // TODO: support multiple blocks; loop over all blocks + gbh := new(types.Header) + + // Let's use slighlty different namings for the same things, because that's awesome. + gbh.ParentHash, err = hex_decode(bt["SimpleTx"].GenesisBlockHeader.ParentHash) + gbh.UncleHash, err = hex_decode(bt["SimpleTx"].GenesisBlockHeader.UncleHash) + gbh.Coinbase, err = hex_decode(bt["SimpleTx"].GenesisBlockHeader.Coinbase) + gbh.Root, err = hex_decode(bt["SimpleTx"].GenesisBlockHeader.StateRoot) + gbh.TxHash, err = hex_decode(bt["SimpleTx"].GenesisBlockHeader.TransactionsTrie) + gbh.ReceiptHash, err = hex_decode(bt["SimpleTx"].GenesisBlockHeader.ReceiptTrie) + gbh.Bloom, err = hex_decode(bt["SimpleTx"].GenesisBlockHeader.Bloom) + + gbh.MixDigest, err = hex_decode(bt["SimpleTx"].GenesisBlockHeader.MixHash) + gbh.SeedHash, err = hex_decode(bt["SimpleTx"].GenesisBlockHeader.SeedHash) + + d, _ := new(big.Int).SetString(bt["SimpleTx"].GenesisBlockHeader.Difficulty, 10) + gbh.Difficulty = d + + n, _ := new(big.Int).SetString(bt["SimpleTx"].GenesisBlockHeader.Number, 10) + gbh.Number = n + + gl, _ := new(big.Int).SetString(bt["SimpleTx"].GenesisBlockHeader.GasLimit, 10) + gbh.GasLimit = gl + + gu, _ := new(big.Int).SetString(bt["SimpleTx"].GenesisBlockHeader.GasUsed, 10) + gbh.GasUsed = gu + + ts, _ := new(big.Int).SetString(bt["SimpleTx"].GenesisBlockHeader.Timestamp, 0) + gbh.Time = ts.Uint64() + + extra, err := hex_decode(bt["SimpleTx"].GenesisBlockHeader.ExtraData) + gbh.Extra = string(extra) // TODO: change ExtraData to byte array + + nonce, _ := hex_decode(bt["SimpleTx"].GenesisBlockHeader.Nonce) + gbh.Nonce = nonce + + if err != nil { + return + } + + gb := types.NewBlockWithHeader(gbh) + gb.Reward = new(big.Int) + + testBlock := new(types.Block) + + rlpBytes, err := hex_decode(bt["SimpleTx"].Blocks[0].Rlp) + err = rlp.Decode(bytes.NewReader(rlpBytes), &testBlock) + if err != nil { + return + } + + blocks = types.Blocks{ + gb, + testBlock, + } + + return +} + +func init_vars() { + VmType = 0 + Identifier = "" + KeyRing = "" + KeyStore = "db" + RpcListenAddress = "127.0.0.1" + RpcPort = 8545 + WsPort = 40404 + StartRpc = true + StartWebSockets = false + NonInteractive = false + GenAddr = false + SecretFile = "" + ExportDir = "" + LogFile = "" + + timeStr := strconv.FormatInt(time.Now().UnixNano(), 10) + + Datadir = path.Join(ethutil.DefaultDataDir(), timeStr) + ConfigFile = path.Join(ethutil.DefaultDataDir(), timeStr, "conf.ini") + + DebugFile = "" + LogLevel = 5 + LogFormat = "std" + DiffTool = false + DiffType = "all" + ShowGenesis = false + ImportChain = "" + Dump = false + DumpHash = "" + DumpNumber = -1 + StartMining = false + StartJsConsole = false + PrintVersion = false + MinerThreads = runtime.NumCPU() + + Dial = false + OutboundPort = "30303" + BootNodes = "" + MaxPeer = 1 + +} + +func hex_decode(s string) (res []byte, err error) { + return hex.DecodeString(strings.TrimPrefix(s, "0x")) +} diff --git a/cmd/mist/assets/ext/mist.js b/cmd/mist/assets/ext/mist.js index 2fc38cdfa..849e0804e 100644 --- a/cmd/mist/assets/ext/mist.js +++ b/cmd/mist/assets/ext/mist.js @@ -17,7 +17,6 @@ // this function is included locally, but you can also include separately via a header definition -console.log("loaded?"); document.onkeydown = function(evt) { // This functions keeps track of keyboard inputs in order to allow copy, paste and other features diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index a909916b7..f9ee6939d 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -46,7 +46,14 @@ ApplicationWindow { walletWeb.view.url = "http://ethereum-dapp-wallet.meteor.com/"; walletWeb.menuItem.title = "Wallet"; - addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: false}); + addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "legacy", active: false}); + addPlugin("./views/network.qml", {noAdd: true, close: false, section: "ethereum", active: false}); + + /* var whisperTab = addPlugin("./views/browser.qml", {noAdd: true, close: true, section: "ethereum", active: false}); + whisperTab.view.url = "http://ethereum-dapp-whisper-client.meteor.com/"; + whisperTab.menuItem.title = "Whisper Chat"; +*/ + addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/whisper.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/chain.qml", {noAdd: true, close: false, section: "legacy"}); @@ -530,6 +537,8 @@ ApplicationWindow { Text { id: secondary + //only shows secondary title if there's no badge + visible: (badgeContent == "icon" || badgeContent == "number" )? false : true font.family: sourceSansPro.name font.weight: Font.Light anchors { @@ -691,18 +700,23 @@ ApplicationWindow { } Rectangle { - height: 55 + height: 19 color: "transparent" Text { text: "ETHEREUM" font.family: sourceSansPro.name - font.weight: Font.DemiBold - anchors { - left: parent.left - top: parent.verticalCenter - leftMargin: 16 - } - color: "#AAA0A0" + font.weight: Font.Regular + // anchors.top: 20 + // anchors.left: 16 + anchors { + leftMargin: 12 + topMargin: 4 + fill: parent + } + // anchors.leftMargin: 16 + // anchors.topMargin: 16 + // anchors.verticalCenterOffset: 50 + color: "#AAA0A0" } } @@ -717,17 +731,16 @@ ApplicationWindow { } Rectangle { - height: 55 - color: "transparent" + height: 19 + color: "#00ff00" + visible: (menuApps.children.length > 0) + Text { text: "APPS" font.family: sourceSansPro.name - font.weight: Font.DemiBold - anchors { - left: parent.left - top: parent.verticalCenter - leftMargin: 16 - } + font.weight: Font.Regular + anchors.fill: parent + anchors.leftMargin: 16 color: "#AAA0A0" } } @@ -735,6 +748,8 @@ ApplicationWindow { ColumnLayout { id: menuApps spacing: 3 + + anchors { left: parent.left right: parent.right @@ -744,6 +759,7 @@ ApplicationWindow { Rectangle { height: 55 color: "transparent" + visible: true Text { text: "DEBUG" font.family: sourceSansPro.name @@ -760,6 +776,7 @@ ApplicationWindow { ColumnLayout { id: menuLegacy + visible: true spacing: 3 anchors { left: parent.left diff --git a/cmd/mist/assets/qml/views/miner.qml b/cmd/mist/assets/qml/views/miner.qml index e239c7d7b..4025ff485 100644 --- a/cmd/mist/assets/qml/views/miner.qml +++ b/cmd/mist/assets/qml/views/miner.qml @@ -19,20 +19,9 @@ Rectangle { id: lastBlockLabel objectName: "lastBlockLabel" text: "---" - onTextChanged: { - //menuItem.secondaryTitle = text - } - } - - Label { - objectName: "miningLabel" - visible: false - font.pixelSize: 10 - anchors.right: lastBlockLabel.left - anchors.rightMargin: 5 - onTextChanged: { - menuItem.secondaryTitle = text - } + onTextChanged: { + //menuItem.secondaryTitle = text + } } ColumnLayout { diff --git a/cmd/mist/assets/qml/views/network-health/205f39107b64acf34cb35d7edb57f47893187a12.js b/cmd/mist/assets/qml/views/network-health/205f39107b64acf34cb35d7edb57f47893187a12.js new file mode 100644 index 000000000..a1f645ca5 --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/205f39107b64acf34cb35d7edb57f47893187a12.js @@ -0,0 +1,176 @@ +!function(){var n,t;(function(){t={}}).call(this),function(){(function(){var n=this,r=n._,e={},u=Array.prototype,i=Object.prototype,a=Function.prototype,o=u.push,c=u.slice,l=u.concat,f=i.toString,s=i.hasOwnProperty,p=u.forEach,v=u.map,h=u.reduce,d=u.reduceRight,g=u.filter,m=u.every,y=u.some,b=u.indexOf,_=u.lastIndexOf,w=Array.isArray,x=Object.keys,j=a.bind,A=function(n){return n instanceof A?n:this instanceof A?void(this._wrapped=n):new A(n)};"undefined"!=typeof t?("undefined"!=typeof module&&module.exports&&(t=module.exports=A),t._=A):n._=A,A.VERSION="1.5.2";var k=function(n){return"[object Arguments]"===f.call(n)};k(arguments)||(k=function(n){return!(!n||!s.call(n,"callee")||"function"!=typeof n.callee)});var O=function(n){return n.length===+n.length&&(k(n)||n.constructor!==Object)},E=A.each=A.forEach=function(n,t,r){if(null!=n)if(p&&n.forEach===p)n.forEach(t,r);else if(O(n)){for(var u=0,i=n.length;i>u;u++)if(t.call(r,n[u],u,n)===e)return}else for(var a=A.keys(n),u=0,i=a.length;i>u;u++)if(t.call(r,n[a[u]],a[u],n)===e)return};A.map=A.collect=function(n,t,r){var e=[];return null==n?e:v&&n.map===v?n.map(t,r):(E(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var F="Reduce of empty array with no initial value";A.reduce=A.foldl=A.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=A.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(E(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(F);return r},A.reduceRight=A.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),d&&n.reduceRight===d)return e&&(t=A.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(!O(n)){var a=A.keys(n);i=a.length}if(E(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(F);return r},A.find=A.detect=function(n,t,r){var e;return M(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},A.filter=A.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(E(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},A.reject=function(n,t,r){return A.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},A.every=A.all=function(n,t,r){t||(t=A.identity);var u=!0;return null==n?u:m&&n.every===m?n.every(t,r):(E(n,function(n,i,a){return(u=u&&t.call(r,n,i,a))?void 0:e}),!!u)};var M=A.some=A.any=function(n,t,r){t||(t=A.identity);var u=!1;return null==n?u:y&&n.some===y?n.some(t,r):(E(n,function(n,i,a){return u||(u=t.call(r,n,i,a))?e:void 0}),!!u)};A.contains=A.include=function(n,t){return null==n?!1:b&&n.indexOf===b?-1!=n.indexOf(t):M(n,function(n){return n===t})},A.invoke=function(n,t){var r=c.call(arguments,2),e=A.isFunction(t);return A.map(n,function(n){return(e?t:n[t]).apply(n,r)})},A.pluck=function(n,t){return A.map(n,function(n){return n[t]})},A.where=function(n,t,r){return A.isEmpty(t)?r?void 0:[]:A[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},A.findWhere=function(n,t){return A.where(n,t,!0)},A.max=function(n,t,r){if(!t&&A.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);if(!t&&A.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return E(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>e.computed&&(e={value:n,computed:a})}),e.value},A.min=function(n,t,r){if(!t&&A.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);if(!t&&A.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return E(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a<e.computed&&(e={value:n,computed:a})}),e.value},A.shuffle=function(n){var t,r=0,e=[];return E(n,function(n){t=A.random(r++),e[r-1]=e[t],e[t]=n}),e},A.sample=function(n,t,r){return arguments.length<2||r?n[A.random(n.length-1)]:A.shuffle(n).slice(0,Math.max(0,t))};var R=function(n){return A.isFunction(n)?n:function(t){return t[n]}};A.sortBy=function(n,t,r){var e=R(t);return A.pluck(A.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||void 0===r)return 1;if(e>r||void 0===e)return-1}return n.index-t.index}),"value")};var S=function(n){return function(t,r,e){var u={},i=null==r?A.identity:R(r);return E(t,function(r,a){var o=i.call(e,r,a,t);n(u,o,r)}),u}};A.groupBy=S(function(n,t,r){(A.has(n,t)?n[t]:n[t]=[]).push(r)}),A.indexBy=S(function(n,t,r){n[t]=r}),A.countBy=S(function(n,t){A.has(n,t)?n[t]++:n[t]=1}),A.sortedIndex=function(n,t,r,e){r=null==r?A.identity:R(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])<u?i=o+1:a=o}return i},A.toArray=function(n){return n?A.isArray(n)?c.call(n):O(n)?A.map(n,A.identity):A.values(n):[]},A.size=function(n){return null==n?0:O(n)?n.length:A.keys(n).length},A.first=A.head=A.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:c.call(n,0,t)},A.initial=function(n,t,r){return c.call(n,0,n.length-(null==t||r?1:t))},A.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:c.call(n,Math.max(n.length-t,0))},A.rest=A.tail=A.drop=function(n,t,r){return c.call(n,null==t||r?1:t)},A.compact=function(n){return A.filter(n,A.identity)};var I=function(n,t,r){return t&&A.every(n,A.isArray)?l.apply(r,n):(E(n,function(n){A.isArray(n)||A.isArguments(n)?t?o.apply(r,n):I(n,t,r):r.push(n)}),r)};A.flatten=function(n,t){return I(n,t,[])},A.without=function(n){return A.difference(n,c.call(arguments,1))},A.uniq=A.unique=function(n,t,r,e){A.isFunction(t)&&(e=r,r=t,t=!1);var u=r?A.map(n,r,e):n,i=[],a=[];return E(u,function(r,e){(t?e&&a[a.length-1]===r:A.contains(a,r))||(a.push(r),i.push(n[e]))}),i},A.union=function(){return A.uniq(A.flatten(arguments,!0))},A.intersection=function(n){var t=c.call(arguments,1);return A.filter(A.uniq(n),function(n){return A.every(t,function(t){return A.indexOf(t,n)>=0})})},A.difference=function(n){var t=l.apply(u,c.call(arguments,1));return A.filter(n,function(n){return!A.contains(t,n)})},A.zip=function(){for(var n=A.max(A.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=A.pluck(arguments,""+r);return t},A.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},A.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=A.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(b&&n.indexOf===b)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},A.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(_&&n.lastIndexOf===_)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},A.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var T=function(){};A.bind=function(n,t){var r,e;if(j&&n.bind===j)return j.apply(n,c.call(arguments,1));if(!A.isFunction(n))throw new TypeError;return r=c.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(c.call(arguments)));T.prototype=n.prototype;var u=new T;T.prototype=null;var i=n.apply(u,r.concat(c.call(arguments)));return Object(i)===i?i:u}},A.partial=function(n){var t=c.call(arguments,1);return function(){return n.apply(this,t.concat(c.call(arguments)))}},A.bindAll=function(n){var t=c.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return E(t,function(t){n[t]=A.bind(n[t],n)}),n},A.memoize=function(n,t){var r={};return t||(t=A.identity),function(){var e=t.apply(this,arguments);return A.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},A.delay=function(n,t){var r=c.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},A.defer=function(n){return A.delay.apply(A,[n,1].concat(c.call(arguments,1)))},A.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var c=function(){o=r.leading===!1?0:new Date,a=null,i=n.apply(e,u)};return function(){var l=new Date;o||r.leading!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u)):a||r.trailing===!1||(a=setTimeout(c,f)),i}},A.debounce=function(n,t,r){var e,u,i,a,o;return function(){i=this,u=arguments,a=new Date;var c=function(){var l=new Date-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u)))},l=r&&!e;return e||(e=setTimeout(c,t)),l&&(o=n.apply(i,u)),o}},A.once=function(n){var t=!1,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},A.wrap=function(n,t){return function(){var r=[n];return o.apply(r,arguments),t.apply(this,r)}},A.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},A.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},A.keys=x||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)A.has(n,r)&&t.push(r);return t},A.values=function(n){for(var t=A.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},A.pairs=function(n){for(var t=A.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},A.invert=function(n){for(var t={},r=A.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},A.functions=A.methods=function(n){var t=[];for(var r in n)A.isFunction(n[r])&&t.push(r);return t.sort()},A.extend=function(n){return E(c.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},A.pick=function(n){var t={},r=l.apply(u,c.call(arguments,1));return E(r,function(r){r in n&&(t[r]=n[r])}),t},A.omit=function(n){var t={},r=l.apply(u,c.call(arguments,1));for(var e in n)A.contains(r,e)||(t[e]=n[e]);return t},A.defaults=function(n){return E(c.call(arguments,1),function(t){if(t)for(var r in t)void 0===n[r]&&(n[r]=t[r])}),n},A.clone=function(n){return A.isObject(n)?A.isArray(n)?n.slice():A.extend({},n):n},A.tap=function(n,t){return t(n),n};var N=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof A&&(n=n._wrapped),t instanceof A&&(t=t._wrapped);var u=f.call(n);if(u!=f.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(A.isFunction(a)&&a instanceof a&&A.isFunction(o)&&o instanceof o))return!1;r.push(n),e.push(t);var c=0,l=!0;if("[object Array]"==u){if(c=n.length,l=c==t.length)for(;c--&&(l=N(n[c],t[c],r,e)););}else{for(var s in n)if(A.has(n,s)&&(c++,!(l=A.has(t,s)&&N(n[s],t[s],r,e))))break;if(l){for(s in t)if(A.has(t,s)&&!c--)break;l=!c}}return r.pop(),e.pop(),l};A.isEqual=function(n,t){return N(n,t,[],[])},A.isEmpty=function(n){if(null==n)return!0;if(A.isArray(n)||A.isString(n))return 0===n.length;for(var t in n)if(A.has(n,t))return!1;return!0},A.isElement=function(n){return!(!n||1!==n.nodeType)},A.isArray=w||function(n){return"[object Array]"==f.call(n)},A.isObject=function(n){return n===Object(n)},E(["Arguments","Function","String","Number","Date","RegExp"],function(n){A["is"+n]=function(t){return f.call(t)=="[object "+n+"]"}}),A.isArguments(arguments)||(A.isArguments=function(n){return!(!n||!A.has(n,"callee"))}),"function"!=typeof/./&&(A.isFunction=function(n){return"function"==typeof n}),A.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},A.isNaN=function(n){return A.isNumber(n)&&n!=+n},A.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==f.call(n)},A.isNull=function(n){return null===n},A.isUndefined=function(n){return void 0===n},A.has=function(n,t){return s.call(n,t)},A.noConflict=function(){return n._=r,this},A.identity=function(n){return n},A.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},A.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var q={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};q.unescape=A.invert(q.escape);var B={escape:new RegExp("["+A.keys(q.escape).join("")+"]","g"),unescape:new RegExp("("+A.keys(q.unescape).join("|")+")","g")};A.each(["escape","unescape"],function(n){A[n]=function(t){return null==t?"":(""+t).replace(B[n],function(t){return q[n][t]})}}),A.result=function(n,t){if(null==n)return void 0;var r=n[t];return A.isFunction(r)?r.call(n):r},A.mixin=function(n){E(A.functions(n),function(t){var r=A[t]=n[t];A.prototype[t]=function(){var n=[this._wrapped];return o.apply(n,arguments),U.call(this,r.apply(A,n))}})};var D=0;A.uniqueId=function(n){var t=++D+"";return n?n+t:t},A.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var P=/(.)^/,z={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},C=/\\|'|\r|\n|\t|\u2028|\u2029/g;A.template=function(n,t,r){var e;r=A.defaults({},r,A.templateSettings);var u=new RegExp([(r.escape||P).source,(r.interpolate||P).source,(r.evaluate||P).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(C,function(n){return"\\"+z[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,A);var c=function(n){return e.call(this,n,A)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},A.chain=function(n){return A(n).chain()};var U=function(n){return this._chain?A(n).chain():n};A.mixin(A),E(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=u[n];A.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],U.call(this,r)}}),E(["concat","join","slice"],function(n){var t=u[n];A.prototype[n]=function(){return U.call(this,t.apply(this._wrapped,arguments))}}),A.extend(A.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)}.call(this),function(){n=t._}.call(this),"undefined"==typeof Package&&(Package={}),Package.underscore={_:n}}(); + +!function(){var t=Package.underscore._,e;(function(){e={isClient:!0,isServer:!1},"object"==typeof __meteor_runtime_config__&&__meteor_runtime_config__.PUBLIC_SETTINGS&&(e.settings={"public":__meteor_runtime_config__.PUBLIC_SETTINGS})}).call(this),function(){function n(t){return t?e._debug("Exception in callback of async function",t.stack?t.stack:t):void 0}if(e.isServer)var r=Npm.require("fibers/future");"object"==typeof __meteor_runtime_config__&&__meteor_runtime_config__.meteorRelease&&(e.release=__meteor_runtime_config__.meteorRelease),t.extend(e,{_get:function(t){for(var e=1;e<arguments.length;e++){if(!(arguments[e]in t))return void 0;t=t[arguments[e]]}return t},_ensure:function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];n in t||(t[n]={}),t=t[n]}return t},_delete:function(t){for(var e=[t],n=!0,r=1;r<arguments.length-1;r++){var o=arguments[r];if(!(o in t)){n=!1;break}if(t=t[o],"object"!=typeof t)break;e.push(t)}for(var r=e.length-1;r>=0;r--){var o=arguments[r+1];if(n)n=!1;else for(var i in e[r][o])return;delete e[r][o]}},wrapAsync:function(o,i){return function(){for(var a=i||this,u=t.toArray(arguments),s,c=u.length-1;c>=0;--c){var l=u[c],f=typeof l;if("undefined"!==f){"function"===f&&(s=l);break}}if(!s){if(e.isClient)s=n;else{var _=new r;s=_.resolver()}++c}u[c]=e.bindEnvironment(s);var p=o.apply(a,u);return _?_.wait():p}},_inherits:function(e,n){for(var r in n)t.has(n,r)&&(e[r]=n[r]);var o=function(){this.constructor=e};return o.prototype=n.prototype,e.prototype=new o,e.__super__=n.prototype,e}});var o=!1;e._wrapAsync=function(t,n){return o||(e._debug("Meteor._wrapAsync has been renamed to Meteor.wrapAsync"),o=!0),e.wrapAsync.apply(e,arguments)}}.call(this),function(){"use strict";function t(){if(o.setImmediate){var t=function(t){o.setImmediate(t)};return t.implementation="setImmediate",t}return null}function n(){function t(t,e){return"string"==typeof t&&t.substring(0,e.length)===e}function e(e){if(e.source===o&&t(e.data,u)){var n=e.data.substring(u.length);try{a[n]&&a[n]()}finally{delete a[n]}}}if(!o.postMessage||o.importScripts)return null;var n=!0,r=o.onmessage;if(o.onmessage=function(){n=!1},o.postMessage("","*"),o.onmessage=r,!n)return null;var i=0,a={},u="Meteor._setImmediate."+Math.random()+".";o.addEventListener?o.addEventListener("message",e,!1):o.attachEvent("onmessage",e);var s=function(t){++i,a[i]=t,o.postMessage(u+i,"*")};return s.implementation="postMessage",s}function r(){var t=function(t){o.setTimeout(t,0)};return t.implementation="setTimeout",t}var o=this;e._setImmediate=t()||n()||r()}.call(this),function(){var n=function(t){if(Package.ddp){var e=Package.ddp.DDP._CurrentInvocation;if(e.get()&&e.get().isSimulation)throw new Error("Can't set timers inside simulations");return function(){e.withValue(null,t)}}return t},r=function(t,r){return e.bindEnvironment(n(r),t)};t.extend(e,{setTimeout:function(t,e){return setTimeout(r("setTimeout callback",t),e)},setInterval:function(t,e){return setInterval(r("setInterval callback",t),e)},clearInterval:function(t){return clearInterval(t)},clearTimeout:function(t){return clearTimeout(t)},defer:function(t){e._setImmediate(r("defer callback",t))}})}.call(this),function(){e.makeErrorType=function(t,n){var r=function(){var e=this;if(Error.captureStackTrace)Error.captureStackTrace(e,r);else{var o=new Error;o.__proto__=r.prototype,o instanceof r&&(e=o)}return n.apply(e,arguments),e.errorType=t,e};return e._inherits(r,Error),r},e.Error=e.makeErrorType("Meteor.Error",function(t,e,n){var r=this;r.error=t,r.reason=e,r.details=n,r.message=r.reason?r.reason+" ["+r.error+"]":"["+r.error+"]"}),e.Error.prototype.clone=function(){var t=this;return new e.Error(t.error,t.reason,t.details)}}.call(this),function(){e._noYieldsAllowed=function(t){return t()},e._SynchronousQueue=function(){var t=this;t._tasks=[],t._running=!1,t._runTimeout=null},t.extend(e._SynchronousQueue.prototype,{runTask:function(n){var r=this;if(!r.safeToRunTask())throw new Error("Could not synchronously run a task from a running task");r._tasks.push(n);var o=r._tasks;r._tasks=[],r._running=!0,r._runTimeout&&(clearTimeout(r._runTimeout),r._runTimeout=null);try{for(;!t.isEmpty(o);){var i=o.shift();try{i()}catch(a){if(t.isEmpty(o))throw a;e._debug("Exception in queued task: "+a.stack)}}}finally{r._running=!1}},queueTask:function(e){var n=this;n._tasks.push(e),n._runTimeout||(n._runTimeout=setTimeout(t.bind(n.flush,n),0))},flush:function(){var t=this;t.runTask(function(){})},drain:function(){var e=this;if(e.safeToRunTask())for(;!t.isEmpty(e._tasks);)e.flush()},safeToRunTask:function(){var t=this;return!t._running}})}.call(this),function(){var t=[],n=!e.isCordova&&("loaded"===document.readyState||"complete"==document.readyState),r=1,o=function(){if(r--,!(r>0)){n=!0;var o=function(){if(e.isCordova&&(!cordova.plugins||!cordova.plugins.CordovaUpdate))return void e.setTimeout(o,20);for(;t.length;)t.shift()()};o()}};document.addEventListener?(document.addEventListener("DOMContentLoaded",o,!1),e.isCordova&&(r++,document.addEventListener("deviceready",o,!1)),window.addEventListener("load",o,!1)):(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&o()}),window.attachEvent("load",o)),e.startup=function(r){var o=!document.addEventListener&&document.documentElement.doScroll;if(o&&window===top){try{o("left")}catch(i){return void setTimeout(function(){e.startup(r)},50)}r()}else n?r():t.push(r)}}.call(this),function(){var t=0;e._debug=function(){if(t)return void t--;if("undefined"!=typeof console&&"undefined"!=typeof console.log)if(0==arguments.length)console.log("");else if("function"==typeof console.log.apply){for(var e=!0,n=0;n<arguments.length;n++)"string"!=typeof arguments[n]&&(e=!1);e?console.log.apply(console,[Array.prototype.join.call(arguments," ")]):console.log.apply(console,arguments)}else if("function"==typeof Function.prototype.bind){var r=Function.prototype.bind.call(console.log,console);r.apply(console,arguments)}else Function.prototype.call.call(console.log,console,Array.prototype.slice.call(arguments))},e._suppress_log=function(e){t+=e}}.call(this),function(){var n=0,r=[];e.EnvironmentVariable=function(){this.slot=n++},t.extend(e.EnvironmentVariable.prototype,{get:function(){return r[this.slot]},getOrNullIfOutsideFiber:function(){return this.get()},withValue:function(t,e){var n=r[this.slot];try{r[this.slot]=t;var o=e()}finally{r[this.slot]=n}return o}}),e.bindEnvironment=function(n,o,i){var a=t.clone(r);if(!o||"string"==typeof o){var u=o||"callback of async function";o=function(t){e._debug("Exception in "+u+":",t&&t.stack||t)}}return function(){var e=r;try{r=a;var u=n.apply(i,t.toArray(arguments))}catch(s){o(s)}finally{r=e}return u}},e._nodeCodeMustBeInFiber=function(){}}.call(this),function(){e.absoluteUrl=function(n,r){r||"object"!=typeof n||(r=n,n=void 0),r=t.extend({},e.absoluteUrl.defaultOptions,r||{});var o=r.rootUrl;if(!o)throw new Error("Must pass options.rootUrl or set ROOT_URL in the server environment");return/^http[s]?:\/\//i.test(o)||(o="http://"+o),/\/$/.test(o)||(o+="/"),n&&(o+=n),r.secure&&/^http:/.test(o)&&!/http:\/\/localhost[:\/]/.test(o)&&!/http:\/\/127\.0\.0\.1[:\/]/.test(o)&&(o=o.replace(/^http:/,"https:")),r.replaceLocalhost&&(o=o.replace(/^http:\/\/localhost([:\/].*)/,"http://127.0.0.1$1")),o},e.absoluteUrl.defaultOptions={},"object"==typeof __meteor_runtime_config__&&__meteor_runtime_config__.ROOT_URL&&(e.absoluteUrl.defaultOptions.rootUrl=__meteor_runtime_config__.ROOT_URL),e._relativeToSiteRootUrl=function(t){return"object"==typeof __meteor_runtime_config__&&"/"===t.substr(0,1)&&(t=(__meteor_runtime_config__.ROOT_URL_PATH_PREFIX||"")+t),t}}.call(this),"undefined"==typeof Package&&(Package={}),Package.meteor={Meteor:e}}(); + +!function(){var Meteor=Package.meteor.Meteor,JSON;(function(){window.JSON&&(JSON=window.JSON)}).call(this),function(){"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(t){return 10>t?"0"+t:t}function quote(t){return escapable.lastIndex=0,escapable.test(t)?'"'+t.replace(escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var n,r,o,f,u=gap,i,a=e[t];switch(a&&"object"==typeof a&&"function"==typeof a.toJSON&&(a=a.toJSON(t)),"function"==typeof rep&&(a=rep.call(e,t,a)),typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a)return"null";if(gap+=indent,i=[],"[object Array]"===Object.prototype.toString.apply(a)){for(f=a.length,n=0;f>n;n+=1)i[n]=str(n,a)||"null";return o=0===i.length?"[]":gap?"[\n"+gap+i.join(",\n"+gap)+"\n"+u+"]":"["+i.join(",")+"]",gap=u,o}if(rep&&"object"==typeof rep)for(f=rep.length,n=0;f>n;n+=1)"string"==typeof rep[n]&&(r=rep[n],o=str(r,a),o&&i.push(quote(r)+(gap?": ":":")+o));else for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(o=str(r,a),o&&i.push(quote(r)+(gap?": ":":")+o));return o=0===i.length?"{}":gap?"{\n"+gap+i.join(",\n"+gap)+"\n"+u+"}":"{"+i.join(",")+"}",gap=u,o}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(t){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(t){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(t,e,n){var r;if(gap="",indent="","number"==typeof n)for(r=0;n>r;r+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=e,e&&"function"!=typeof e&&("object"!=typeof e||"number"!=typeof e.length))throw new Error("JSON.stringify");return str("",{"":t})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(t,e){var n,r,o=t[e];if(o&&"object"==typeof o)for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(r=walk(o,n),void 0!==r?o[n]=r:delete o[n]);return reviver.call(t,e,o)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()}.call(this),"undefined"==typeof Package&&(Package={}),Package.json={JSON:JSON}}(); + +!function(){var n=Package.meteor.Meteor,r;(function(){for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={},a=0;a<n.length;a++)e[n.charAt(a)]=a;r={},r.encode=function(n){if("string"==typeof n){var e=n;n=r.newBinary(e.length);for(var a=0;a<e.length;a++){var l=e.charCodeAt(a);if(l>255)throw new Error("Not ascii. Base64.encode can only take ascii strings.");n[a]=l}}for(var u=[],i=null,o=null,c=null,s=null,a=0;a<n.length;a++)switch(a%3){case 0:i=n[a]>>2&63,o=(3&n[a])<<4;break;case 1:o|=n[a]>>4&15,c=(15&n[a])<<2;break;case 2:c|=n[a]>>6&3,s=63&n[a],u.push(t(i)),u.push(t(o)),u.push(t(c)),u.push(t(s)),i=null,o=null,c=null,s=null}return null!=i&&(u.push(t(i)),u.push(t(o)),u.push(null==c?"=":t(c)),null==s&&u.push("=")),u.join("")};var t=function(r){return n.charAt(r)},l=function(n){return"="===n?-1:e[n]};r.newBinary=function(n){if("undefined"==typeof Uint8Array||"undefined"==typeof ArrayBuffer){for(var r=[],e=0;n>e;e++)r.push(0);return r.$Uint8ArrayPolyfill=!0,r}return new Uint8Array(new ArrayBuffer(n))},r.decode=function(n){var e=Math.floor(3*n.length/4);"="==n.charAt(n.length-1)&&(e--,"="==n.charAt(n.length-2)&&e--);for(var a=r.newBinary(e),t=null,u=null,i=null,o=0,c=0;c<n.length;c++){var s=n.charAt(c),f=l(s);switch(c%4){case 0:if(0>f)throw new Error("invalid base64 string");t=f<<2;break;case 1:if(0>f)throw new Error("invalid base64 string");t|=f>>4,a[o++]=t,u=(15&f)<<4;break;case 2:f>=0&&(u|=f>>2,a[o++]=u,i=(3&f)<<6);break;case 3:f>=0&&(a[o++]=i|f)}}return a}}).call(this),"undefined"==typeof Package&&(Package={}),Package.base64={Base64:r}}(); + +!function(){var n=Package.meteor.Meteor,e=Package.json.JSON,t=Package.underscore._,r=Package.base64.Base64,u,a;(function(){u={},a={};var i={};u.addType=function(n,e){if(t.has(i,n))throw new Error("Type "+n+" already present");i[n]=e};var o=function(n){return t.isNaN(n)||1/0===n||n===-1/0},f=[{matchJSONValue:function(n){return t.has(n,"$date")&&1===t.size(n)},matchObject:function(n){return n instanceof Date},toJSONValue:function(n){return{$date:n.getTime()}},fromJSONValue:function(n){return new Date(n.$date)}},{matchJSONValue:function(n){return t.has(n,"$InfNaN")&&1===t.size(n)},matchObject:o,toJSONValue:function(n){var e;return e=t.isNaN(n)?0:1/0===n?1:-1,{$InfNaN:e}},fromJSONValue:function(n){return n.$InfNaN/0}},{matchJSONValue:function(n){return t.has(n,"$binary")&&1===t.size(n)},matchObject:function(n){return"undefined"!=typeof Uint8Array&&n instanceof Uint8Array||n&&t.has(n,"$Uint8ArrayPolyfill")},toJSONValue:function(n){return{$binary:r.encode(n)}},fromJSONValue:function(n){return r.decode(n.$binary)}},{matchJSONValue:function(n){return t.has(n,"$escape")&&1===t.size(n)},matchObject:function(n){return t.isEmpty(n)||t.size(n)>2?!1:t.any(f,function(e){return e.matchJSONValue(n)})},toJSONValue:function(n){var e={};return t.each(n,function(n,t){e[t]=u.toJSONValue(n)}),{$escape:e}},fromJSONValue:function(n){var e={};return t.each(n.$escape,function(n,t){e[t]=u.fromJSONValue(n)}),e}},{matchJSONValue:function(n){return t.has(n,"$type")&&t.has(n,"$value")&&2===t.size(n)},matchObject:function(n){return u._isCustomType(n)},toJSONValue:function(e){var t=n._noYieldsAllowed(function(){return e.toJSONValue()});return{$type:e.typeName(),$value:t}},fromJSONValue:function(e){var r=e.$type;if(!t.has(i,r))throw new Error("Custom EJSON type "+r+" is not defined");var u=i[r];return n._noYieldsAllowed(function(){return u(e.$value)})}}];u._isCustomType=function(n){return n&&"function"==typeof n.toJSONValue&&"function"==typeof n.typeName&&t.has(i,n.typeName())};var c=u._adjustTypesToJSONValue=function(n){if(null===n)return null;var e=l(n);return void 0!==e?e:"object"!=typeof n?n:(t.each(n,function(e,t){if("object"==typeof e||void 0===e||o(e)){var r=l(e);return r?void(n[t]=r):void c(e)}}),n)},l=function(n){for(var e=0;e<f.length;e++){var t=f[e];if(t.matchObject(n))return t.toJSONValue(n)}return void 0};u.toJSONValue=function(n){var e=l(n);return void 0!==e?e:("object"==typeof n&&(n=u.clone(n),c(n)),n)};var s=u._adjustTypesFromJSONValue=function(n){if(null===n)return null;var e=y(n);return e!==n?e:"object"!=typeof n?n:(t.each(n,function(e,t){if("object"==typeof e){var r=y(e);if(e!==r)return void(n[t]=r);s(e)}}),n)},y=function(n){if("object"==typeof n&&null!==n&&t.size(n)<=2&&t.all(n,function(n,e){return"string"==typeof e&&"$"===e.substr(0,1)}))for(var e=0;e<f.length;e++){var r=f[e];if(r.matchJSONValue(n))return r.fromJSONValue(n)}return n};u.fromJSONValue=function(n){var e=y(n);return e===n&&"object"==typeof n?(n=u.clone(n),s(n),n):e},u.stringify=function(n,t){var r=u.toJSONValue(n);return t&&(t.canonical||t.indent)?u._canonicalStringify(r,t):e.stringify(r)},u.parse=function(n){if("string"!=typeof n)throw new Error("EJSON.parse argument should be a string");return u.fromJSONValue(e.parse(n))},u.isBinary=function(n){return!!("undefined"!=typeof Uint8Array&&n instanceof Uint8Array||n&&n.$Uint8ArrayPolyfill)},u.equals=function(n,e,r){var a,i=!(!r||!r.keyOrderSensitive);if(n===e)return!0;if(t.isNaN(n)&&t.isNaN(e))return!0;if(!n||!e)return!1;if("object"!=typeof n||"object"!=typeof e)return!1;if(n instanceof Date&&e instanceof Date)return n.valueOf()===e.valueOf();if(u.isBinary(n)&&u.isBinary(e)){if(n.length!==e.length)return!1;for(a=0;a<n.length;a++)if(n[a]!==e[a])return!1;return!0}if("function"==typeof n.equals)return n.equals(e,r);if("function"==typeof e.equals)return e.equals(n,r);if(n instanceof Array){if(!(e instanceof Array))return!1;if(n.length!==e.length)return!1;for(a=0;a<n.length;a++)if(!u.equals(n[a],e[a],r))return!1;return!0}switch(u._isCustomType(n)+u._isCustomType(e)){case 1:return!1;case 2:return u.equals(u.toJSONValue(n),u.toJSONValue(e))}var o;if(i){var f=[];return t.each(e,function(n,e){f.push(e)}),a=0,o=t.all(n,function(n,t){return a>=f.length?!1:t!==f[a]?!1:u.equals(n,e[f[a]],r)?(a++,!0):!1}),o&&a===f.length}return a=0,o=t.all(n,function(n,i){return t.has(e,i)&&u.equals(n,e[i],r)?(a++,!0):!1}),o&&t.size(e)===a},u.clone=function(n){var e;if("object"!=typeof n)return n;if(null===n)return null;if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp)return n;if(u.isBinary(n)){e=u.newBinary(n.length);for(var r=0;r<n.length;r++)e[r]=n[r];return e}if(t.isArray(n)||t.isArguments(n)){for(e=[],r=0;r<n.length;r++)e[r]=u.clone(n[r]);return e}return"function"==typeof n.clone?n.clone():u._isCustomType(n)?u.fromJSONValue(u.clone(u.toJSONValue(n)),!0):(e={},t.each(n,function(n,t){e[t]=u.clone(n)}),e)},u.newBinary=r.newBinary}).call(this),function(){function n(n){return e.stringify(n)}var r=function(e,u,a,i,o){var f,c,l,s,y=i,h,N=u[e];switch(typeof N){case"string":return n(N);case"number":return isFinite(N)?String(N):"null";case"boolean":return String(N);case"object":if(!N)return"null";if(y=i+a,h=[],t.isArray(N)||t.isArguments(N)){for(s=N.length,f=0;s>f;f+=1)h[f]=r(f,N,a,y,o)||"null";return l=0===h.length?"[]":y?"[\n"+y+h.join(",\n"+y)+"\n"+i+"]":"["+h.join(",")+"]"}var p=t.keys(N);return o&&(p=p.sort()),t.each(p,function(e){l=r(e,N,a,y,o),l&&h.push(n(e)+(y?": ":":")+l)}),l=0===h.length?"{}":y?"{\n"+y+h.join(",\n"+y)+"\n"+i+"}":"{"+h.join(",")+"}"}};u._canonicalStringify=function(n,e){if(e=t.extend({indent:"",canonical:!1},e),e.indent===!0)e.indent=" ";else if("number"==typeof e.indent){for(var u="",a=0;a<e.indent;a++)u+=" ";e.indent=u}return r("",{"":n},e.indent,"",e.canonical)}}.call(this),"undefined"==typeof Package&&(Package={}),Package.ejson={EJSON:u,EJSONTest:a}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.underscore._,r=Package.ejson.EJSON,n;(function(){n=function(){return n.info.apply(this,arguments)};var i=0,o=[],a=0;n._intercept=function(e){i+=e},n._suppress=function(e){a+=e},n._intercepted=function(){var e=o;return o=[],i=0,e},n.outputFormat="json";var s={debug:"green",warn:"magenta",error:"red"},l="blue",c=["time","timeInexact","level","file","line","program","originApp","satellite","stderr"],u=c.concat(["app","message"]),g=function(t){var r=n.format(t),i=t.level;"undefined"!=typeof console&&console[i]?console[i](r):e._debug(r)};n._getCallerDetails=function(){var e=function(){var e=new Error,t=e.stack;return t},t=e();if(!t)return{};for(var r=t.split("\n"),n,i=1;i<r.length;++i){if(n=r[i],n.match(/^\s*at eval \(eval/))return{file:"eval"};if(!n.match(/packages\/(?:local-test:)?logging(?:\/|\.js)/))break}var o={},a=/(?:[@(]| at )([^(]+?):([0-9:]+)(?:\)|$)/.exec(n);return a?(o.line=a[2].split(":")[0],o.file=a[1].split("/").slice(-1)[0].split("?")[0],o):o},t.each(["debug","info","warn","error"],function(s){n[s]=function(l){if(a)return void a--;var u=!1;i&&(i--,u=!0);var f=!t.isObject(l)||t.isRegExp(l)||t.isDate(l)?{message:new String(l).toString()}:l;if(t.each(c,function(e){if(f[e])throw new Error("Can't set '"+e+"' in log message")}),t.has(f,"message")&&!t.isString(f.message))throw new Error("The 'message' field in log objects must be a string");if(f.omitCallerDetails||(f=t.extend(n._getCallerDetails(),f)),f.time=new Date,f.level=s,"debug"!==s)if(u)o.push(r.stringify(f));else if(e.isServer)if("colored-text"===n.outputFormat)console.log(n.format(f,{color:!0}));else{if("json"!==n.outputFormat)throw new Error("Unknown logging output format: "+n.outputFormat);console.log(r.stringify(f))}else g(f)}}),n.parse=function(e){var t=null;if(e&&"{"===e.charAt(0))try{t=r.parse(e)}catch(n){}return t&&t.time&&t.time instanceof Date?t:null},n.format=function(n,i){n=r.clone(n),i=i||{};var o=n.time;if(!(o instanceof Date))throw new Error("'time' must be a Date object");var a=n.timeInexact,c=n.level||"info",g=n.file,f=n.line,m=n.app||"",p=n.originApp,v=n.message||"",h=n.program||"",d=n.satellite,w=n.stderr||"";t.each(u,function(e){delete n[e]}),t.isEmpty(n)||(v&&(v+=" "),v+=r.stringify(n));var b=function(e){return 10>e?"0"+e:e.toString()},D=function(e){return 100>e?"0"+b(e):e.toString()},j=o.getFullYear().toString()+b(o.getMonth()+1)+b(o.getDate()),S=b(o.getHours())+":"+b(o.getMinutes())+":"+b(o.getSeconds())+"."+D(o.getMilliseconds()),k="("+-((new Date).getTimezoneOffset()/60)+")",E="";m&&(E+=m),p&&p!==m&&(E+=" via "+p),E&&(E="["+E+"] ");var x=[];h&&x.push(h),g&&x.push(g),f&&x.push(f);var y=t.isEmpty(x)?"":"("+x.join(":")+") ";d&&(y+=["[",d,"]"].join(""));var _=w?"(STDERR) ":"",C=[c.charAt(0).toUpperCase(),j,"-",S,k,a?"? ":" ",E,y,_].join(""),F=function(t,r){return i.color&&e.isServer&&r?Npm.require("cli-color")[r](t):t};return F(C,i.metaColor||l)+F(v,s[c])},n.objFromText=function(e,r){var n={message:e,level:"info",time:new Date,timeInexact:!0};return t.extend(n,r)}}).call(this),"undefined"==typeof Package&&(Package={}),Package.logging={Log:n}}(); + +!function(){var a=Package.meteor.Meteor,e=Package.underscore._,t=Package.logging.Log,o=Package.json.JSON,n;(function(){n={};var t="Meteor_Reload",r={},i,l=null;try{l=window.sessionStorage,l?(l.setItem("__dummy__","1"),l.removeItem("__dummy__")):l=null}catch(g){l=null}n._getData=function(){return l&&l.getItem(t)},l&&(i=n._getData(),l.removeItem(t)),i||(i="{}");var c={};try{c=o.parse(i),"object"!=typeof c&&(a._debug("Got bad data on reload. Ignoring."),c={})}catch(d){a._debug("Got invalid JSON on reload. Ignoring.")}c.reload&&"object"==typeof c.data&&(r=c.data);var u=[];n._onMigrate=function(a,e){e||(e=a,a=void 0),u.push({name:a,callback:e})},n._migrationData=function(a){return r[a]};var s=function(a,t){a=a||function(){},t=t||{};for(var o={},n=e.clone(u),r=!0;n.length;){var i=n.shift(),l=i.callback(a,t);l[0]||(r=!1),l.length>1&&i.name&&(o[i.name]=l[1])}return r||t.immediateMigration?o:null};n._migrate=function(e,n){var r=s(e,n);if(null===r)return!1;try{var i=o.stringify({data:r,reload:!0})}catch(g){throw a._debug("Couldn't serialize data for migration",r),g}if(l)try{l.setItem(t,i)}catch(g){a._debug("Couldn't save data for migration to sessionStorage",g)}else a._debug("Browser does not support sessionStorage. Not saving migration state.");return!0},n._withFreshProvidersForTest=function(a){var t=e.clone(u);u=[];try{a()}finally{u=t}};var f=!1;n._reload=function(a){if(a=a||{},!f){f=!0;var t=function(){e.defer(function(){n._migrate(t,a)&&window.location.reload()})};t()}}}).call(this),function(){a._reload={onMigrate:n._onMigrate,migrationData:n._migrationData,reload:n._reload}}.call(this),"undefined"==typeof Package&&(Package={}),Package.reload={Reload:n}}(); + +!function(){var t=Package.meteor.Meteor,n,e;(function(){n={},n.active=!1,n.currentComputation=null;var e=function(t){n.currentComputation=t,n.active=!!t},o=function(){return"undefined"!=typeof t?t._debug:"undefined"!=typeof console&&console.log?function(){console.log.apply(console,arguments)}:function(){}},r=function(t,n){if(p)throw n;var e;if(n.stack&&n.message){var r=n.stack.indexOf(n.message);e=r>=0&&10>=r?n.stack:n.message+("\n"===n.stack.charAt(0)?"":"\n")+n.stack}else e=n.stack||n.message;o()("Exception from Tracker "+t+" function:",e)},a=function(n){return"undefined"==typeof t||t.isClient?n:function(){var e=arguments;t._noYieldsAllowed(function(){n.apply(null,e)})}},i=1,u=[],c=!1,s=!1,f=!1,p=!1,d=[],l=function(){c||(setTimeout(n.flush,0),c=!0)},v=!1;n.Computation=function(t,n){if(!v)throw new Error("Tracker.Computation constructor is private; use Tracker.autorun");v=!1;var e=this;e.stopped=!1,e.invalidated=!1,e.firstRun=!0,e._id=i++,e._onInvalidateCallbacks=[],e._parent=n,e._func=t,e._recomputing=!1;var o=!0;try{e._compute(),o=!1}finally{e.firstRun=!1,o&&e.stop()}},n.Computation.prototype.onInvalidate=function(t){var e=this;if("function"!=typeof t)throw new Error("onInvalidate requires a function");e.invalidated?n.nonreactive(function(){a(t)(e)}):e._onInvalidateCallbacks.push(t)},n.Computation.prototype.invalidate=function(){var t=this;if(!t.invalidated){t._recomputing||t.stopped||(l(),u.push(this)),t.invalidated=!0;for(var e=0,o;o=t._onInvalidateCallbacks[e];e++)n.nonreactive(function(){a(o)(t)});t._onInvalidateCallbacks=[]}},n.Computation.prototype.stop=function(){this.stopped||(this.stopped=!0,this.invalidate())},n.Computation.prototype._compute=function(){var t=this;t.invalidated=!1;var o=n.currentComputation;e(t);var r=f;f=!0;try{a(t._func)(t)}finally{e(o),f=r}},n.Computation.prototype._recompute=function(){var t=this;t._recomputing=!0;try{for(;t.invalidated&&!t.stopped;)try{t._compute()}catch(n){r("recompute",n)}}finally{t._recomputing=!1}},n.Dependency=function(){this._dependentsById={}},n.Dependency.prototype.depend=function(t){if(!t){if(!n.active)return!1;t=n.currentComputation}var e=this,o=t._id;return o in e._dependentsById?!1:(e._dependentsById[o]=t,t.onInvalidate(function(){delete e._dependentsById[o]}),!0)},n.Dependency.prototype.changed=function(){var t=this;for(var n in t._dependentsById)t._dependentsById[n].invalidate()},n.Dependency.prototype.hasDependents=function(){var t=this;for(var n in t._dependentsById)return!0;return!1},n.flush=function(t){if(s)throw new Error("Can't call Tracker.flush while flushing");if(f)throw new Error("Can't flush inside Tracker.autorun");s=!0,c=!0,p=!(!t||!t._throwFirstError);var e=!1;try{for(;u.length||d.length;){for(;u.length;){var o=u.shift();o._recompute()}if(d.length){var a=d.shift();try{a()}catch(i){r("afterFlush",i)}}}e=!0}finally{e||(s=!1,n.flush({_throwFirstError:!1})),c=!1,s=!1}},n.autorun=function(t){if("function"!=typeof t)throw new Error("Tracker.autorun requires a function argument");v=!0;var e=new n.Computation(t,n.currentComputation);return n.active&&n.onInvalidate(function(){e.stop()}),e},n.nonreactive=function(t){var o=n.currentComputation;e(null);try{return t()}finally{e(o)}},n.onInvalidate=function(t){if(!n.active)throw new Error("Tracker.onInvalidate requires a currentComputation");n.currentComputation.onInvalidate(t)},n.afterFlush=function(t){d.push(t),l()}}).call(this),function(){t.flush=n.flush,t.autorun=n.autorun,t.autosubscribe=n.autorun,n.depend=function(t){return t.depend()},e=n}.call(this),"undefined"==typeof Package&&(Package={}),Package.tracker={Tracker:n,Deps:e}}(); + +!function(){var e=Package.meteor.Meteor,n=Package.underscore._,t;(function(){if(e.isServer)var n=Npm.require("crypto");var r=function(){function e(){var e=4022871197,n=function(n){n=n.toString();for(var t=0;t<n.length;t++){e+=n.charCodeAt(t);var r=.02519603282416938*e;e=r>>>0,r-=e,r*=e,e=r>>>0,r-=e,e+=4294967296*r}return 2.3283064365386963e-10*(e>>>0)};return n.version="Mash 0.9",n}return function(n){var t=0,r=0,o=0,i=1;0==n.length&&(n=[+new Date]);var a=e();t=a(" "),r=a(" "),o=a(" ");for(var u=0;u<n.length;u++)t-=a(n[u]),0>t&&(t+=1),r-=a(n[u]),0>r&&(r+=1),o-=a(n[u]),0>o&&(o+=1);a=null;var d=function(){var e=2091639*t+2.3283064365386963e-10*i;return t=r,r=o,o=e-(i=0|e)};return d.uint32=function(){return 4294967296*d()},d.fract53=function(){return d()+1.1102230246251565e-16*(2097152*d()|0)},d.version="Alea 0.9",d.args=n,d}(Array.prototype.slice.call(arguments))},o="23456789ABCDEFGHJKLMNPQRSTWXYZabcdefghijkmnopqrstuvwxyz",i="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_",a=function(e){var n=this;void 0!==e&&(n.alea=r.apply(null,e))};a.prototype.fraction=function(){var e=this;if(e.alea)return e.alea();if(n){var t=parseInt(e.hexString(8),16);return 2.3283064365386963e-10*t}if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){var r=new Uint32Array(1);return window.crypto.getRandomValues(r),2.3283064365386963e-10*r[0]}throw new Error("No random generator available")},a.prototype.hexString=function(e){var t=this;if(n&&!t.alea){var r=Math.ceil(e/2),o;try{o=n.randomBytes(r)}catch(i){o=n.pseudoRandomBytes(r)}var a=o.toString("hex");return a.substring(0,e)}for(var u=[],d=0;e>d;++d)u.push(t.choice("0123456789abcdef"));return u.join("")},a.prototype._randomString=function(e,n){for(var t=this,r=[],o=0;e>o;o++)r[o]=t.choice(n);return r.join("")},a.prototype.id=function(e){var n=this;return void 0===e&&(e=17),n._randomString(e,o)},a.prototype.secret=function(e){var n=this;return void 0===e&&(e=43),n._randomString(e,i)},a.prototype.choice=function(e){var n=Math.floor(this.fraction()*e.length);return"string"==typeof e?e.substr(n,1):e[n]};var u="undefined"!=typeof window&&window.innerHeight||"undefined"!=typeof document&&document.documentElement&&document.documentElement.clientHeight||"undefined"!=typeof document&&document.body&&document.body.clientHeight||1,d="undefined"!=typeof window&&window.innerWidth||"undefined"!=typeof document&&document.documentElement&&document.documentElement.clientWidth||"undefined"!=typeof document&&document.body&&document.body.clientWidth||1,c="undefined"!=typeof navigator&&navigator.userAgent||"";t=n||"undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues?new a:new a([new Date,u,d,c,Math.random()]),t.createWithSeeds=function(){if(0===arguments.length)throw new Error("No seeds were provided");return new a(arguments)}}).call(this),function(){e.uuid=function(){for(var e="0123456789abcdef",n=[],r=0;36>r;r++)n[r]=t.choice(e);n[14]="4",n[19]=e.substr(3&parseInt(n[19],16)|8,1),n[8]=n[13]=n[18]=n[23]="-";var o=n.join("");return o}}.call(this),"undefined"==typeof Package&&(Package={}),Package.random={Random:t}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.underscore._,r=Package.random.Random,i;(function(){i=function(e){var r=this;t.extend(r,t.defaults(t.clone(e||{}),{baseTimeout:1e3,exponent:2.2,maxTimeout:3e5,minTimeout:10,minCount:2,fuzz:.5})),r.retryTimer=null},t.extend(i.prototype,{clear:function(){var e=this;e.retryTimer&&clearTimeout(e.retryTimer),e.retryTimer=null},_timeout:function(e){var t=this;if(e<t.minCount)return t.minTimeout;var i=Math.min(t.maxTimeout,t.baseTimeout*Math.pow(t.exponent,e));return i*=r.fraction()*t.fuzz+(1-t.fuzz/2)},retryLater:function(t,r){var i=this,n=i._timeout(t);return i.retryTimer&&clearTimeout(i.retryTimer),i.retryTimer=e.setTimeout(r,n),n}})}).call(this),"undefined"==typeof Package&&(Package={}),Package.retry={Retry:i}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.underscore._,r=Package.ejson.EJSON,n,i;(function(){var o=new e.EnvironmentVariable;n=function(e,t){var r=o.getOrNullIfOutsideFiber();r&&r.checking(e);try{l(e,t)}catch(n){throw n instanceof i.Error&&n.path&&(n.message+=" in field "+n.path),n}},i={Optional:function(e){return new a(e)},OneOf:function(){return new c(t.toArray(arguments))},Any:["__any__"],Where:function(e){return new f(e)},ObjectIncluding:function(e){return new s(e)},ObjectWithValues:function(e){return new h(e)},Integer:["__integer__"],Error:e.makeErrorType("Match.Error",function(t){this.message="Match error: "+t,this.path="",this.sanitizedError=new e.Error(400,"Match failed")}),test:function(e,t){try{return l(e,t),!0}catch(r){if(r instanceof i.Error)return!1;throw r}},_failIfArgumentsAreNotAllChecked:function(e,t,r,n){var i=new p(r,n),a=o.withValue(i,function(){return e.apply(t,r)});return i.throwUnlessAllArgumentsHaveBeenChecked(),a}};var a=function(e){this.pattern=e},c=function(e){if(t.isEmpty(e))throw new Error("Must provide at least one choice to Match.OneOf");this.choices=e},f=function(e){this.condition=e},s=function(e){this.pattern=e},h=function(e){this.pattern=e},u=[[String,"string"],[Number,"number"],[Boolean,"boolean"],[void 0,"undefined"]],l=function(e,n){if(n!==i.Any){for(var o=0;o<u.length;++o)if(n===u[o][0]){if(typeof e===u[o][1])return;throw new i.Error("Expected "+u[o][1]+", got "+typeof e)}if(null===n){if(null===e)return;throw new i.Error("Expected null, got "+r.stringify(e))}if("string"==typeof n||"number"==typeof n){if(e===n)return;throw new i.Error("Expected "+n+", got "+r.stringify(e))}if(n===i.Integer){if("number"==typeof e&&(0|e)===e)return;throw new i.Error("Expected Integer, got "+(e instanceof Object?r.stringify(e):e))}if(n===Object&&(n=i.ObjectIncluding({})),n instanceof Array){if(1!==n.length)throw Error("Bad pattern: arrays must have one type element"+r.stringify(n));if(!t.isArray(e)&&!t.isArguments(e))throw new i.Error("Expected array, got "+r.stringify(e));return void t.each(e,function(e,t){try{l(e,n[0])}catch(r){throw r instanceof i.Error&&(r.path=w(t,r.path)),r}})}if(n instanceof f){if(n.condition(e))return;throw new i.Error("Failed Match.Where validation")}if(n instanceof a&&(n=i.OneOf(void 0,n.pattern)),n instanceof c){for(var o=0;o<n.choices.length;++o)try{return void l(e,n.choices[o])}catch(p){if(!(p instanceof i.Error))throw p}throw new i.Error("Failed Match.OneOf or Match.Optional validation")}if(n instanceof Function){if(e instanceof n)return;throw new i.Error("Expected "+(n.name||"particular constructor"))}var g=!1,d;if(n instanceof s&&(g=!0,n=n.pattern),n instanceof h&&(g=!0,d=[n.pattern],n={}),"object"!=typeof n)throw Error("Bad pattern: unknown pattern type");if("object"!=typeof e)throw new i.Error("Expected object, got "+typeof e);if(null===e)throw new i.Error("Expected object, got null");if(e.constructor!==Object)throw new i.Error("Expected plain object");var y={},E={};t.each(n,function(e,t){e instanceof a?E[t]=e.pattern:y[t]=e}),t.each(e,function(e,r){try{if(t.has(y,r))l(e,y[r]),delete y[r];else if(t.has(E,r))l(e,E[r]);else{if(!g)throw new i.Error("Unknown key");d&&l(e,d[0])}}catch(n){throw n instanceof i.Error&&(n.path=w(r,n.path)),n}}),t.each(y,function(e,t){throw new i.Error("Missing key '"+t+"'")})}},p=function(e,r){var n=this;n.args=t.clone(e),n.args.reverse(),n.description=r};t.extend(p.prototype,{checking:function(e){var r=this;r._checkingOneValue(e)||(t.isArray(e)||t.isArguments(e))&&t.each(e,t.bind(r._checkingOneValue,r))},_checkingOneValue:function(e){for(var r=this,n=0;n<r.args.length;++n)if(e===r.args[n]||t.isNaN(e)&&t.isNaN(r.args[n]))return r.args.splice(n,1),!0;return!1},throwUnlessAllArgumentsHaveBeenChecked:function(){var e=this;if(!t.isEmpty(e.args))throw new Error("Did not check() all arguments during "+e.description)}});var g=["do","if","in","for","let","new","try","var","case","else","enum","eval","false","null","this","true","void","with","break","catch","class","const","super","throw","while","yield","delete","export","import","public","return","static","switch","typeof","default","extends","finally","package","private","continue","debugger","function","arguments","interface","protected","implements","instanceof"],w=function(e,r){return"number"==typeof e||e.match(/^[0-9]+$/)?e="["+e+"]":(!e.match(/^[a-z_$][0-9a-z_$]*$/i)||t.contains(g,e))&&(e=JSON.stringify([e])),r&&"["!==r[0]?e+"."+r:e+r}}).call(this),"undefined"==typeof Package&&(Package={}),Package.check={check:n,Match:i}}(); + +!function(){var i=Package.meteor.Meteor,t=Package.underscore._,a=Package.json.JSON,n=Package.ejson.EJSON,e;(function(){e=function(i,t){var n=this;n._map={},n._idStringify=i||a.stringify,n._idParse=t||a.parse},t.extend(e.prototype,{get:function(i){var t=this,a=t._idStringify(i);return t._map[a]},set:function(i,t){var a=this,n=a._idStringify(i);a._map[n]=t},remove:function(i){var t=this,a=t._idStringify(i);delete t._map[a]},has:function(i){var a=this,n=a._idStringify(i);return t.has(a._map,n)},empty:function(){var i=this;return t.isEmpty(i._map)},clear:function(){var i=this;i._map={}},forEach:function(i){for(var a=this,n=t.keys(a._map),e=0;e<n.length;e++){var r=i.call(null,a._map[n[e]],a._idParse(n[e]));if(r===!1)return}},size:function(){var i=this;return t.size(i._map)},setDefault:function(i,a){var n=this,e=n._idStringify(i);return t.has(n._map,e)?n._map[e]:(n._map[e]=a,a)},clone:function(){var i=this,t=new e(i._idStringify,i._idParse);return i.forEach(function(i,a){t.set(a,n.clone(i))}),t}})}).call(this),"undefined"==typeof Package&&(Package={}),Package["id-map"]={IdMap:e}}(); + +!function(){var t=Package.meteor.Meteor,e=Package.underscore._,r;(function(){var t=function(t,e,r,n){return{key:t,value:e,next:r,prev:n}};r=function(){var t=this;t._dict={},t._first=null,t._last=null,t._size=0;var r=e.toArray(arguments);t._stringify=function(t){return t},"function"==typeof r[0]&&(t._stringify=r.shift()),e.each(r,function(e){t.putBefore(e[0],e[1],null)})},e.extend(r.prototype,{_k:function(t){return" "+this._stringify(t)},empty:function(){var t=this;return!t._first},size:function(){var t=this;return t._size},_linkEltIn:function(t){var e=this;t.next?(t.prev=t.next.prev,t.next.prev=t,t.prev&&(t.prev.next=t)):(t.prev=e._last,e._last&&(e._last.next=t),e._last=t),(null===e._first||e._first===t.next)&&(e._first=t)},_linkEltOut:function(t){var e=this;t.next&&(t.next.prev=t.prev),t.prev&&(t.prev.next=t.next),t===e._last&&(e._last=t.prev),t===e._first&&(e._first=t.next)},putBefore:function(e,r,n){var i=this;if(i._dict[i._k(e)])throw new Error("Item "+e+" already present in OrderedDict");var o=n?t(e,r,i._dict[i._k(n)]):t(e,r,null);if(void 0===o.next)throw new Error("could not find item to put this one before");i._linkEltIn(o),i._dict[i._k(e)]=o,i._size++},append:function(t,e){var r=this;r.putBefore(t,e,null)},remove:function(t){var e=this,r=e._dict[e._k(t)];if(void 0===r)throw new Error("Item "+t+" not present in OrderedDict");return e._linkEltOut(r),e._size--,delete e._dict[e._k(t)],r.value},get:function(t){var e=this;return e.has(t)?e._dict[e._k(t)].value:void 0},has:function(t){var r=this;return e.has(r._dict,r._k(t))},forEach:function(t){for(var e=this,n=0,i=e._first;null!==i;){var o=t(i.value,i.key,n);if(o===r.BREAK)return;i=i.next,n++}},first:function(){var t=this;return t.empty()?void 0:t._first.key},firstValue:function(){var t=this;return t.empty()?void 0:t._first.value},last:function(){var t=this;return t.empty()?void 0:t._last.key},lastValue:function(){var t=this;return t.empty()?void 0:t._last.value},prev:function(t){var e=this;if(e.has(t)){var r=e._dict[e._k(t)];if(r.prev)return r.prev.key}return null},next:function(t){var e=this;if(e.has(t)){var r=e._dict[e._k(t)];if(r.next)return r.next.key}return null},moveBefore:function(t,e){var r=this,n=r._dict[r._k(t)],i=e?r._dict[r._k(e)]:null;if(void 0===n)throw new Error("Item to move is not present");if(void 0===i)throw new Error("Could not find element to move this one before");i!==n.next&&(r._linkEltOut(n),n.next=i,r._linkEltIn(n))},indexOf:function(t){var e=this,n=null;return e.forEach(function(i,o,u){return e._k(o)===e._k(t)?(n=u,r.BREAK):void 0}),n},_checkRep:function(){var t=this;e.each(t._dict,function(t,e){if(e.next===e)throw new Error("Next is a loop");if(e.prev===e)throw new Error("Prev is a loop")})}}),r.BREAK={"break":!0}}).call(this),"undefined"==typeof Package&&(Package={}),Package["ordered-dict"]={OrderedDict:r}}(); + +!function(){var t=Package.meteor.Meteor,n,o;(function(){o={exports:{}}}).call(this),function(){!function(){function t(t){for(var n=[],o=[],a=0;a<t[0].length;a++)n.push(t[0][a][1]),o.push(t[0][a][0]);return n=n.sort(function(t,n){return t-n}),o=o.sort(function(t,n){return t-n}),[[n[0],o[0]],[n[n.length-1],o[o.length-1]]]}function n(t,n,o){for(var a=[[0,0]],r=0;r<o.length;r++){for(var e=0;e<o[r].length;e++)a.push(o[r][e]);a.push([0,0])}for(var i=!1,r=0,e=a.length-1;r<a.length;e=r++)a[r][0]>n!=a[e][0]>n&&t<(a[e][1]-a[r][1])*(n-a[r][0])/(a[e][0]-a[r][0])+a[r][1]&&(i=!i);return i}var a={};"undefined"!=typeof o&&o.exports&&(o.exports=a),a.lineStringsIntersect=function(t,n){for(var o=[],a=0;a<=t.coordinates.length-2;++a)for(var r=0;r<=n.coordinates.length-2;++r){var e={x:t.coordinates[a][1],y:t.coordinates[a][0]},i={x:t.coordinates[a+1][1],y:t.coordinates[a+1][0]},s={x:n.coordinates[r][1],y:n.coordinates[r][0]},c={x:n.coordinates[r+1][1],y:n.coordinates[r+1][0]},u=(c.x-s.x)*(e.y-s.y)-(c.y-s.y)*(e.x-s.x),h=(i.x-e.x)*(e.y-s.y)-(i.y-e.y)*(e.x-s.x),d=(c.y-s.y)*(i.x-e.x)-(c.x-s.x)*(i.y-e.y);if(0!=d){var l=u/d,y=h/d;l>=0&&1>=l&&y>=0&&1>=y&&o.push({type:"Point",coordinates:[e.x+l*(i.x-e.x),e.y+l*(i.y-e.y)]})}}return 0==o.length&&(o=!1),o},a.pointInBoundingBox=function(t,n){return!(t.coordinates[1]<n[0][0]||t.coordinates[1]>n[1][0]||t.coordinates[0]<n[0][1]||t.coordinates[0]>n[1][1])},a.pointInPolygon=function(o,r){for(var e="Polygon"==r.type?[r.coordinates]:r.coordinates,i=!1,s=0;s<e.length;s++)a.pointInBoundingBox(o,t(e[s]))&&(i=!0);if(!i)return!1;for(var c=!1,s=0;s<e.length;s++)n(o.coordinates[1],o.coordinates[0],e[s])&&(c=!0);return c},a.numberToRadius=function(t){return t*Math.PI/180},a.numberToDegree=function(t){return 180*t/Math.PI},a.drawCircle=function(t,n,o){for(var r=[n.coordinates[1],n.coordinates[0]],e=t/1e3/6371,i=[a.numberToRadius(r[0]),a.numberToRadius(r[1])],o=o||15,s=[[r[0],r[1]]],c=0;o>c;c++){var u=2*Math.PI*c/o,h=Math.asin(Math.sin(i[0])*Math.cos(e)+Math.cos(i[0])*Math.sin(e)*Math.cos(u)),d=i[1]+Math.atan2(Math.sin(u)*Math.sin(e)*Math.cos(i[0]),Math.cos(e)-Math.sin(i[0])*Math.sin(h));s[c]=[],s[c][1]=a.numberToDegree(h),s[c][0]=a.numberToDegree(d)}return{type:"Polygon",coordinates:[s]}},a.rectangleCentroid=function(t){var n=t.coordinates[0],o=n[0][0],a=n[0][1],r=n[2][0],e=n[2][1],i=r-o,s=e-a;return{type:"Point",coordinates:[o+i/2,a+s/2]}},a.pointDistance=function(t,n){var o=t.coordinates[0],r=t.coordinates[1],e=n.coordinates[0],i=n.coordinates[1],s=a.numberToRadius(i-r),c=a.numberToRadius(e-o),u=Math.pow(Math.sin(s/2),2)+Math.cos(a.numberToRadius(r))*Math.cos(a.numberToRadius(i))*Math.pow(Math.sin(c/2),2),h=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u));return 6371*h*1e3},a.geometryWithinRadius=function(t,n,o){if("Point"==t.type)return a.pointDistance(t,n)<=o;if("LineString"==t.type||"Polygon"==t.type){var r={},e;e="Polygon"==t.type?t.coordinates[0]:t.coordinates;for(var i in e)if(r.coordinates=e[i],a.pointDistance(r,n)>o)return!1}return!0},a.area=function(t){for(var n=0,o=t.coordinates[0],a=o.length-1,r,e,i=0;i<o.length;a=i++){var r={x:o[i][1],y:o[i][0]},e={x:o[a][1],y:o[a][0]};n+=r.x*e.y,n-=r.y*e.x}return n/=2},a.centroid=function(t){for(var n,o=0,r=0,e=t.coordinates[0],i=e.length-1,s,c,u=0;u<e.length;i=u++){var s={x:e[u][1],y:e[u][0]},c={x:e[i][1],y:e[i][0]};n=s.x*c.y-c.x*s.y,o+=(s.x+c.x)*n,r+=(s.y+c.y)*n}return n=6*a.area(t),{type:"Point",coordinates:[r/n,o/n]}},a.simplify=function(t,n){n=n||20,t=t.map(function(t){return{lng:t.coordinates[0],lat:t.coordinates[1]}});var o,a,r,e,i,s,c,u,h,d,l,y,M,f,g,x,p,v,P,b=Math.PI/180*.5,m=new Array,T=new Array,I=new Array;if(t.length<3)return t;for(o=t.length,d=360*n/(2*Math.PI*6378137),d*=d,r=0,T[0]=0,I[0]=o-1,a=1;a>0;)if(e=T[a-1],i=I[a-1],a--,i-e>1){for(l=t[i].lng()-t[e].lng(),y=t[i].lat()-t[e].lat(),Math.abs(l)>180&&(l=360-Math.abs(l)),l*=Math.cos(b*(t[i].lat()+t[e].lat())),M=l*l+y*y,s=e+1,c=e,h=-1;i>s;s++)f=t[s].lng()-t[e].lng(),g=t[s].lat()-t[e].lat(),Math.abs(f)>180&&(f=360-Math.abs(f)),f*=Math.cos(b*(t[s].lat()+t[e].lat())),x=f*f+g*g,p=t[s].lng()-t[i].lng(),v=t[s].lat()-t[i].lat(),Math.abs(p)>180&&(p=360-Math.abs(p)),p*=Math.cos(b*(t[s].lat()+t[i].lat())),P=p*p+v*v,u=x>=M+P?P:P>=M+x?x:(f*y-g*l)*(f*y-g*l)/M,u>h&&(c=s,h=u);d>h?(m[r]=e,r++):(a++,T[a-1]=c,I[a-1]=i,a++,T[a-1]=e,I[a-1]=c)}else m[r]=e,r++;m[r]=o-1,r++;for(var R=new Array,s=0;r>s;s++)R.push(t[m[s]]);return R.map(function(t){return{type:"Point",coordinates:[t.lng,t.lat]}})},a.destinationPoint=function(t,n,o){o/=6371,n=a.numberToRadius(n);var r=a.numberToRadius(t.coordinates[0]),e=a.numberToRadius(t.coordinates[1]),i=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(n)),s=e+Math.atan2(Math.sin(n)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(i));return s=(s+3*Math.PI)%(2*Math.PI)-Math.PI,{type:"Point",coordinates:[a.numberToDegree(i),a.numberToDegree(s)]}}}()}.call(this),function(){n=o.exports}.call(this),"undefined"==typeof Package&&(Package={}),Package["geojson-utils"]={GeoJSON:n}}(); + +!function(){var e=Package.meteor.Meteor,r=Package.underscore._,t=Package.json.JSON,n=Package.ejson.EJSON,o=Package["id-map"].IdMap,i=Package["ordered-dict"].OrderedDict,a=Package.tracker.Tracker,s=Package.tracker.Deps,c=Package.random.Random,u=Package["geojson-utils"].GeoJSON,d,f,l,h,p,v,_,m,y,g,w,b,$,I,E,O;(function(){d=function(r){var t=this;t.name=r,t._docs=new d._IdMap,t._observeQueue=new e._SynchronousQueue,t.next_qid=1,t.queries={},t._savedOriginals=null,t.paused=!1},f={},l={},d._applyChanges=function(e,t){r.each(t,function(r,t){void 0===r?delete e[t]:e[t]=r})},h=function(e){var r=new Error(e);return r.name="MinimongoError",r},d.prototype.find=function(e,r){return 0===arguments.length&&(e={}),new d.Cursor(this,e,r)},d.Cursor=function(e,r,t){var n=this;t||(t={}),n.collection=e,n.sorter=null,d._selectorIsId(r)?(n._selectorId=r,n.matcher=new f.Matcher(r,n)):(n._selectorId=void 0,n.matcher=new f.Matcher(r,n),(n.matcher.hasGeoQuery()||t.sort)&&(n.sorter=new f.Sorter(t.sort||[],{matcher:n.matcher}))),n.skip=t.skip,n.limit=t.limit,n.fields=t.fields,n.fields&&(n.projectionFn=d._compileProjection(n.fields)),n._transform=d.wrapTransform(t.transform),"undefined"!=typeof a&&(n.reactive=void 0===t.reactive?!0:t.reactive)},d.Cursor.prototype.rewind=function(){},d.prototype.findOne=function(e,r){return 0===arguments.length&&(e={}),r=r||{},r.limit=1,this.find(e,r).fetch()[0]},d.Cursor.prototype.forEach=function(e,t){var o=this,i=o._getRawObjects({ordered:!0});o.reactive&&o._depend({addedBefore:!0,removed:!0,changed:!0,movedBefore:!0}),r.each(i,function(r,i){r=o.projectionFn?o.projectionFn(r):n.clone(r),o._transform&&(r=o._transform(r)),e.call(t,r,i,o)})},d.Cursor.prototype.getTransform=function(){return this._transform},d.Cursor.prototype.map=function(e,r){var t=this,n=[];return t.forEach(function(o,i){n.push(e.call(r,o,i,t))}),n},d.Cursor.prototype.fetch=function(){var e=this,r=[];return e.forEach(function(e){r.push(e)}),r},d.Cursor.prototype.count=function(){var e=this;return e.reactive&&e._depend({added:!0,removed:!0},!0),e._getRawObjects({ordered:!0}).length},d.Cursor.prototype._publishCursor=function(e){var r=this;if(!r.collection.name)throw new Error("Can't publish a cursor from a collection without a name.");var t=r.collection.name;return Mongo.Collection._publishCursor(r,e,t)},d.Cursor.prototype._getCollectionName=function(){var e=this;return e.collection.name},d._observeChangesCallbacksAreOrdered=function(e){if(e.added&&e.addedBefore)throw new Error("Please specify only one of added() and addedBefore()");return!(!e.addedBefore&&!e.movedBefore)},d._observeCallbacksAreOrdered=function(e){if(e.addedAt&&e.added)throw new Error("Please specify only one of added() and addedAt()");if(e.changedAt&&e.changed)throw new Error("Please specify only one of changed() and changedAt()");if(e.removed&&e.removedAt)throw new Error("Please specify only one of removed() and removedAt()");return!!(e.addedAt||e.movedTo||e.changedAt||e.removedAt)},d.ObserveHandle=function(){},r.extend(d.Cursor.prototype,{observe:function(e){var r=this;return d._observeFromObserveChanges(r,e)},observeChanges:function(e){var t=this,o=d._observeChangesCallbacksAreOrdered(e);if(!e._allow_unordered&&!o&&(t.skip||t.limit))throw new Error("must use ordered observe (ie, 'addedBefore' instead of 'added') with skip or limit");if(t.fields&&(0===t.fields._id||t.fields._id===!1))throw Error("You may not observe a cursor with {fields: {_id: 0}}");var i={matcher:t.matcher,sorter:o&&t.sorter,distances:t.matcher.hasGeoQuery()&&o&&new d._IdMap,resultsSnapshot:null,ordered:o,cursor:t,projectionFn:t.projectionFn},s;t.reactive&&(s=t.collection.next_qid++,t.collection.queries[s]=i),i.results=t._getRawObjects({ordered:o,distances:i.distances}),t.collection.paused&&(i.resultsSnapshot=o?[]:new d._IdMap);var c=function(e,n,o){return e?function(){var i=this,a=arguments;t.collection.paused||void 0!==n&&t.projectionFn&&(a[n]=t.projectionFn(a[n]),o&&r.isEmpty(a[n]))||t.collection._observeQueue.queueTask(function(){e.apply(i,a)})}:function(){}};if(i.added=c(e.added,1),i.changed=c(e.changed,1,!0),i.removed=c(e.removed),o&&(i.addedBefore=c(e.addedBefore,1),i.movedBefore=c(e.movedBefore)),!e._suppress_initial&&!t.collection.paused){var u=o?r.bind(r.each,null,i.results):r.bind(i.results.forEach,i.results);u(function(e){var r=n.clone(e);delete r._id,o&&i.addedBefore(e._id,r,null),i.added(e._id,r)})}var f=new d.ObserveHandle;return r.extend(f,{collection:t.collection,stop:function(){t.reactive&&delete t.collection.queries[s]}}),t.reactive&&a.active&&a.onInvalidate(function(){f.stop()}),t.collection._observeQueue.drain(),f}}),d.Cursor.prototype._getRawObjects=function(e){var r=this;e=e||{};var t=e.ordered?[]:new d._IdMap;if(void 0!==r._selectorId){if(r.skip)return t;var n=r.collection._docs.get(r._selectorId);return n&&(e.ordered?t.push(n):t.set(r._selectorId,n)),t}var o;if(r.matcher.hasGeoQuery()&&e.ordered&&(e.distances?(o=e.distances,o.clear()):o=new d._IdMap),r.collection._docs.forEach(function(n,i){var a=r.matcher.documentMatches(n);return a.result&&(e.ordered?(t.push(n),o&&void 0!==a.distance&&o.set(i,a.distance)):t.set(i,n)),!r.limit||r.skip||r.sorter||t.length!==r.limit?!0:!1}),!e.ordered)return t;if(r.sorter){var i=r.sorter.getComparator({distances:o});t.sort(i)}var a=r.skip||0,s=r.limit?r.limit+a:t.length;return t.slice(a,s)},d.Cursor.prototype._depend=function(e,t){var n=this;if(a.active){var o=new a.Dependency;o.depend();var i=r.bind(o.changed,o),s={_suppress_initial:!0,_allow_unordered:t};r.each(["added","changed","removed","addedBefore","movedBefore"],function(r){e[r]&&(s[r]=i)}),n.observeChanges(s)}},d.prototype.insert=function(t,o){var i=this;t=n.clone(t),r.has(t,"_id")||(t._id=d._useOID?new d._ObjectID:c.id());var a=t._id;if(i._docs.has(a))throw h("Duplicate _id '"+a+"'");i._saveOriginal(a,void 0),i._docs.set(a,t);var s=[];for(var u in i.queries){var f=i.queries[u],l=f.matcher.documentMatches(t);l.result&&(f.distances&&void 0!==l.distance&&f.distances.set(a,l.distance),f.cursor.skip||f.cursor.limit?s.push(u):d._insertInResults(f,t))}return r.each(s,function(e){i.queries[e]&&d._recomputeResults(i.queries[e])}),i._observeQueue.drain(),o&&e.defer(function(){o(null,a)}),a},d.prototype._eachPossiblyMatchingDoc=function(e,r){var t=this,n=d._idsMatchedBySelector(e);if(n)for(var o=0;o<n.length;++o){var i=n[o],a=t._docs.get(i);if(a){var s=r(a,i);if(s===!1)break}}else t._docs.forEach(r)},d.prototype.remove=function(t,o){var i=this;if(i.paused&&!i._savedOriginals&&n.equals(t,{})){var a=i._docs.size();return i._docs.clear(),r.each(i.queries,function(e){e.ordered?e.results=[]:e.results.clear()}),o&&e.defer(function(){o(null,a)}),a}var s=new f.Matcher(t,i),c=[];i._eachPossiblyMatchingDoc(t,function(e,r){s.documentMatches(e).result&&c.push(r)});for(var u=[],l=[],h=0;h<c.length;h++){var p=c[h],v=i._docs.get(p);r.each(i.queries,function(e,r){e.matcher.documentMatches(v).result&&(e.cursor.skip||e.cursor.limit?u.push(r):l.push({qid:r,doc:v}))}),i._saveOriginal(p,v),i._docs.remove(p)}return r.each(l,function(e){var r=i.queries[e.qid];r&&(r.distances&&r.distances.remove(e.doc._id),d._removeFromResults(r,e.doc))}),r.each(u,function(e){var r=i.queries[e];r&&d._recomputeResults(r)}),i._observeQueue.drain(),a=c.length,o&&e.defer(function(){o(null,a)}),a},d.prototype.update=function(t,o,i,a){var s=this;!a&&i instanceof Function&&(a=i,i=null),i||(i={});var c=new f.Matcher(t,s),u={};r.each(s.queries,function(e,r){!e.cursor.skip&&!e.cursor.limit||e.paused||(u[r]=n.clone(e.results))});var l={},h=0;s._eachPossiblyMatchingDoc(t,function(e,r){var t=c.documentMatches(e);return t.result&&(s._saveOriginal(r,e),s._modifyAndNotify(e,o,l,t.arrayIndices),++h,!i.multi)?!1:!0}),r.each(l,function(e,r){var t=s.queries[r];t&&d._recomputeResults(t,u[r])}),s._observeQueue.drain();var p;if(0===h&&i.upsert){var v=d._removeDollarOperators(t);d._modify(v,o,{isInsert:!0}),!v._id&&i.insertedId&&(v._id=i.insertedId),p=s.insert(v),h=1}var _;return i._returnObject?(_={numberAffected:h},void 0!==p&&(_.insertedId=p)):_=h,a&&e.defer(function(){a(null,_)}),_},d.prototype.upsert=function(e,t,n,o){var i=this;return o||"function"!=typeof n||(o=n,n={}),i.update(e,t,r.extend({},n,{upsert:!0,_returnObject:!0}),o)},d.prototype._modifyAndNotify=function(e,r,t,o){var i=this,a={};for(var s in i.queries){var c=i.queries[s];a[s]=c.ordered?c.matcher.documentMatches(e).result:c.results.has(e._id)}var u=n.clone(e);d._modify(e,r,{arrayIndices:o});for(s in i.queries){c=i.queries[s];var f=a[s],l=c.matcher.documentMatches(e),h=l.result;h&&c.distances&&void 0!==l.distance&&c.distances.set(e._id,l.distance),c.cursor.skip||c.cursor.limit?(f||h)&&(t[s]=!0):f&&!h?d._removeFromResults(c,e):!f&&h?d._insertInResults(c,e):f&&h&&d._updateInResults(c,e,u)}},d._insertInResults=function(e,r){var t=n.clone(r);if(delete t._id,e.ordered){if(e.sorter){var o=d._insertInSortedList(e.sorter.getComparator({distances:e.distances}),e.results,r),i=e.results[o+1];i=i?i._id:null,e.addedBefore(r._id,t,i)}else e.addedBefore(r._id,t,null),e.results.push(r);e.added(r._id,t)}else e.added(r._id,t),e.results.set(r._id,r)},d._removeFromResults=function(e,r){if(e.ordered){var t=d._findInOrderedResults(e,r);e.removed(r._id),e.results.splice(t,1)}else{var n=r._id;e.removed(r._id),e.results.remove(n)}},d._updateInResults=function(e,t,o){if(!n.equals(t._id,o._id))throw new Error("Can't change a doc's _id while updating");var i=d._makeChangedFields(t,o);if(!e.ordered)return void(r.isEmpty(i)||(e.changed(t._id,i),e.results.set(t._id,t)));var a=d._findInOrderedResults(e,t);if(r.isEmpty(i)||e.changed(t._id,i),e.sorter){e.results.splice(a,1);var s=d._insertInSortedList(e.sorter.getComparator({distances:e.distances}),e.results,t);if(a!==s){var c=e.results[s+1];c=c?c._id:null,e.movedBefore&&e.movedBefore(t._id,c)}}},d._recomputeResults=function(e,r){r||(r=e.results),e.distances&&e.distances.clear(),e.results=e.cursor._getRawObjects({ordered:e.ordered,distances:e.distances}),e.paused||d._diffQueryChanges(e.ordered,r,e.results,e)},d._findInOrderedResults=function(e,r){if(!e.ordered)throw new Error("Can't call _findInOrderedResults on unordered query");for(var t=0;t<e.results.length;t++)if(e.results[t]===r)return t;throw Error("object missing from query")},d._binarySearch=function(e,r,t){for(var n=0,o=r.length;o>0;){var i=Math.floor(o/2);e(t,r[n+i])>=0?(n+=i+1,o-=i+1):o=i}return n},d._insertInSortedList=function(e,r,t){if(0===r.length)return r.push(t),0;var n=d._binarySearch(e,r,t);return r.splice(n,0,t),n},d.prototype.saveOriginals=function(){var e=this;if(e._savedOriginals)throw new Error("Called saveOriginals twice without retrieveOriginals");e._savedOriginals=new d._IdMap},d.prototype.retrieveOriginals=function(){var e=this;if(!e._savedOriginals)throw new Error("Called retrieveOriginals without saveOriginals");var r=e._savedOriginals;return e._savedOriginals=null,r},d.prototype._saveOriginal=function(e,r){var t=this;t._savedOriginals&&(t._savedOriginals.has(e)||t._savedOriginals.set(e,n.clone(r)))},d.prototype.pauseObservers=function(){if(!this.paused){this.paused=!0;for(var e in this.queries){var r=this.queries[e];r.resultsSnapshot=n.clone(r.results)}}},d.prototype.resumeObservers=function(){var e=this;if(this.paused){this.paused=!1;for(var r in this.queries){var t=e.queries[r];d._diffQueryChanges(t.ordered,t.resultsSnapshot,t.results,t),t.resultsSnapshot=null}e._observeQueue.drain()}},d._idStringify=function(e){if(e instanceof d._ObjectID)return e.valueOf();if("string"==typeof e)return""===e?e:"-"===e.substr(0,1)||"~"===e.substr(0,1)||d._looksLikeObjectID(e)||"{"===e.substr(0,1)?"-"+e:e;if(void 0===e)return"-";if("object"==typeof e&&null!==e)throw new Error("Meteor does not currently support objects other than ObjectID as ids");return"~"+t.stringify(e)},d._idParse=function(e){return""===e?e:"-"===e?void 0:"-"===e.substr(0,1)?e.substr(1):"~"===e.substr(0,1)?t.parse(e.substr(1)):d._looksLikeObjectID(e)?new d._ObjectID(e):e},d._makeChangedFields=function(e,r){var t={};return d._diffObjects(r,e,{leftOnly:function(e,r){t[e]=void 0},rightOnly:function(e,r){t[e]=r},both:function(e,r,o){n.equals(r,o)||(t[e]=o)}}),t}}).call(this),function(){d.wrapTransform=function(e){return e?function(t){if(!r.has(t,"_id"))throw new Error("can only transform documents with _id");var o=t._id,i=a.nonreactive(function(){return e(t)});if(!v(i))throw new Error("transform must return object");if(r.has(i,"_id")){if(!n.equals(i._id,o))throw new Error("transformed document can't have different _id")}else i._id=o;return i}:null}}.call(this),function(){p=function(e){return r.isArray(e)&&!n.isBinary(e)},v=d._isPlainObject=function(e){return e&&3===d._f._type(e)},_=function(e){return p(e)||v(e)},m=function(e,n){if(!v(e))return!1;var o=void 0;return r.each(e,function(r,i){var a="$"===i.substr(0,1);if(void 0===o)o=a;else if(o!==a){if(!n)throw new Error("Inconsistent operator: "+t.stringify(e));o=!1}}),!!o},y=function(e){return/^[0-9]+$/.test(e)}}.call(this),function(){f.Matcher=function(e){var r=this;r._paths={},r._hasGeoQuery=!1,r._hasWhere=!1,r._isSimple=!0,r._matchingDocument=void 0,r._selector=null,r._docMatcher=r._compileSelector(e)},r.extend(f.Matcher.prototype,{documentMatches:function(e){if(!e||"object"!=typeof e)throw Error("documentMatches needs a document");return this._docMatcher(e)},hasGeoQuery:function(){return this._hasGeoQuery},hasWhere:function(){return this._hasWhere},isSimple:function(){return this._isSimple},_compileSelector:function(r){var t=this;if(r instanceof Function)return t._isSimple=!1,t._selector=r,t._recordPathUsed(""),function(e){return{result:!!r.call(e)}};if(d._selectorIsId(r))return t._selector={_id:r},t._recordPathUsed("_id"),function(e){return{result:n.equals(e._id,r)}};if(!r||"_id"in r&&!r._id)return t._isSimple=!1,k;if("boolean"==typeof r||p(r)||n.isBinary(r))throw new Error("Invalid selector: "+r);return t._selector=n.clone(r),e(r,t,{isRoot:!0})},_recordPathUsed:function(e){this._paths[e]=!0},_getPaths:function(){return r.keys(this._paths)}});var e=function(e,n,o){o=o||{};var i=[];return r.each(e,function(e,a){if("$"===a.substr(0,1)){if(!r.has(s,a))throw new Error("Unrecognized logical operator: "+a);n._isSimple=!1,i.push(s[a](e,n,o.inElemMatch))}else{o.inElemMatch||n._recordPathUsed(a);var c=$(a),u=t(e,n,o.isRoot);i.push(function(e){var r=c(e);return u(r)})}}),A(i)},t=function(e,r,t){return e instanceof RegExp?(r._isSimple=!1,o(g(e))):m(e)?i(e,r,t):o(w(e))},o=function(e,t){return t=t||{},function(n){var o=n;t.dontExpandLeafArrays||(o=I(n,t.dontIncludeLeafArrays));var i={};return i.result=r.any(o,function(r){var t=e(r.value);return"number"==typeof t&&(r.arrayIndices||(r.arrayIndices=[t]),t=!0),t&&r.arrayIndices&&(i.arrayIndices=r.arrayIndices),t}),i}};g=function(e){return function(t){return t instanceof RegExp?r.isEqual(t,e):"string"!=typeof t?!1:(e.lastIndex=0,e.test(t))}},w=function(e){if(m(e))throw Error("Can't create equalityValueSelector for operator object");return null==e?function(e){return null==e}:function(r){return d._f._equal(e,r)}};var i=function(e,t,n){var i=[];return r.each(e,function(a,s){var c=r.contains(["$lt","$lte","$gt","$gte"],s)&&r.isNumber(a),u="$ne"===s&&!r.isObject(a),d=r.contains(["$in","$nin"],s)&&r.isArray(a)&&!r.any(a,r.isObject);if("$eq"===s||c||d||u||(t._isSimple=!1),r.has(h,s))i.push(h[s](a,e,t,n));else{if(!r.has(b,s))throw new Error("Unrecognized operator: "+s);var f=b[s];i.push(o(f.compileElementSelector(a,e,t),f))}}),M(i)},a=function(t,n,o){if(!p(t)||r.isEmpty(t))throw Error("$and/$or/$nor must be nonempty array");return r.map(t,function(r){if(!v(r))throw Error("$or/$and/$nor entries need to be full objects");return e(r,n,{inElemMatch:o})})},s={$and:function(e,r,t){var n=a(e,r,t);return A(n)},$or:function(e,t,n){var o=a(e,t,n);return 1===o.length?o[0]:function(e){var t=r.any(o,function(r){return r(e).result});return{result:t}}},$nor:function(e,t,n){var o=a(e,t,n);return function(e){var t=r.all(o,function(r){return!r(e).result});return{result:t}}},$where:function(e,r){return r._recordPathUsed(""),r._hasWhere=!0,e instanceof Function||(e=Function("obj","return "+e)),function(r){return{result:e.call(r,r)}}},$comment:function(){return function(){return{result:!0}}}},c=function(e){return function(r){var t=e(r);return{result:!t.result}}},h={$not:function(e,r,n){return c(t(e,n))},$ne:function(e){return c(o(w(e)))},$nin:function(e){return c(o(b.$in.compileElementSelector(e)))},$exists:function(e){var r=o(function(e){return void 0!==e});return e?r:c(r)},$options:function(e,t){if(!r.has(t,"$regex"))throw Error("$options needs a $regex");return j},$maxDistance:function(e,r){if(!r.$near)throw Error("$maxDistance needs a $near");return j},$all:function(e,n,o){if(!p(e))throw Error("$all requires array");if(r.isEmpty(e))return k;var i=[];return r.each(e,function(e){if(m(e))throw Error("no $ expressions in $all");i.push(t(e,o))}),M(i)},$near:function(e,t,n,o){if(!o)throw Error("$near can't be inside another $ operator");n._hasGeoQuery=!0;var i,a,s;if(v(e)&&r.has(e,"$geometry"))i=e.$maxDistance,a=e.$geometry,s=function(e){return e&&e.type?"Point"===e.type?u.pointDistance(a,e):u.geometryWithinRadius(e,a,i)?0:i+1:null};else{if(i=t.$maxDistance,!p(e)&&!v(e))throw Error("$near argument must be coordinate pair or GeoJSON");a=O(e),s=function(e){return p(e)||v(e)?E(a,e):null}}return function(e){e=I(e);var t={result:!1};return r.each(e,function(e){var r=s(e.value);null===r||r>i||void 0!==t.distance&&t.distance<=r||(t.result=!0,t.distance=r,e.arrayIndices?t.arrayIndices=e.arrayIndices:delete t.arrayIndices)}),t}}},E=function(e,t){e=O(e),t=O(t);var n=e[0]-t[0],o=e[1]-t[1];return r.isNaN(n)||r.isNaN(o)?null:Math.sqrt(n*n+o*o)},O=function(e){return r.map(e,r.identity)},C=function(e){return{compileElementSelector:function(r){if(p(r))return function(){return!1};void 0===r&&(r=null);var t=d._f._type(r);return function(n){return void 0===n&&(n=null),d._f._type(n)!==t?!1:e(d._f._cmp(n,r))}}}};b={$lt:C(function(e){return 0>e}),$gt:C(function(e){return e>0}),$lte:C(function(e){return 0>=e}),$gte:C(function(e){return e>=0}),$mod:{compileElementSelector:function(e){if(!p(e)||2!==e.length||"number"!=typeof e[0]||"number"!=typeof e[1])throw Error("argument to $mod must be an array of two numbers");var r=e[0],t=e[1];return function(e){return"number"==typeof e&&e%r===t}}},$in:{compileElementSelector:function(e){if(!p(e))throw Error("$in needs an array");var t=[];return r.each(e,function(e){if(e instanceof RegExp)t.push(g(e));else{if(m(e))throw Error("cannot nest $ under $in");t.push(w(e))}}),function(e){return void 0===e&&(e=null),r.any(t,function(r){return r(e)})}}},$size:{dontExpandLeafArrays:!0,compileElementSelector:function(e){if("string"==typeof e)e=0;else if("number"!=typeof e)throw Error("$size needs a number");return function(r){return p(r)&&r.length===e}}},$type:{dontIncludeLeafArrays:!0,compileElementSelector:function(e){if("number"!=typeof e)throw Error("$type needs a number");return function(r){return void 0!==r&&d._f._type(r)===e}}},$regex:{compileElementSelector:function(e,r){if(!("string"==typeof e||e instanceof RegExp))throw Error("$regex has to be a string or RegExp");var t;if(void 0!==r.$options){if(/[^gim]/.test(r.$options))throw new Error("Only the i, m, and g regexp options are supported");var n=e instanceof RegExp?e.source:e;t=new RegExp(n,r.$options)}else t=e instanceof RegExp?e:new RegExp(e);return g(t)}},$elemMatch:{dontExpandLeafArrays:!0,compileElementSelector:function(r,n,o){if(!v(r))throw Error("$elemMatch need an object");var i,a;return m(r,!0)?(i=t(r,o),a=!1):(i=e(r,o,{inElemMatch:!0}),a=!0),function(e){if(!p(e))return!1;for(var r=0;r<e.length;++r){var t=e[r],n;if(a){if(!v(t)&&!p(t))return!1;n=t}else n=[{value:t,dontIterate:!0}];if(i(n).result)return r}return!1}}}},$=function(e,t){t=t||{};var n=e.split("."),o=n.length?n[0]:"",i=y(o),a=n.length>=2&&y(n[1]),s;n.length>1&&(s=$(n.slice(1).join(".")));var c=function(e){return e.dontIterate||delete e.dontIterate,e.arrayIndices&&!e.arrayIndices.length&&delete e.arrayIndices,e};return function(e,n){if(n||(n=[]),p(e)){if(!(i&&o<e.length))return[];n=n.concat(+o,"x")}var u=e[o];if(!s)return[c({value:u,dontIterate:p(e)&&p(u),arrayIndices:n})];if(!_(u))return p(e)?[]:[c({value:void 0,arrayIndices:n})];var d=[],f=function(e){Array.prototype.push.apply(d,e)};return f(s(u,n)),!p(u)||a&&t.forSort||r.each(u,function(e,r){v(e)&&f(s(e,n.concat(r)))}),d}},l.makeLookupFunction=$,I=function(e,t){var n=[];return r.each(e,function(e){var o=p(e.value);t&&o&&!e.dontIterate||n.push({value:e.value,arrayIndices:e.arrayIndices}),o&&!e.dontIterate&&r.each(e.value,function(r,t){n.push({value:r,arrayIndices:(e.arrayIndices||[]).concat(t)})})}),n};var k=function(e){return{result:!1}},j=function(e){return{result:!0}},S=function(e){return 0===e.length?j:1===e.length?e[0]:function(t){var n={};return n.result=r.all(e,function(e){var r=e(t);return r.result&&void 0!==r.distance&&void 0===n.distance&&(n.distance=r.distance),r.result&&r.arrayIndices&&(n.arrayIndices=r.arrayIndices),r.result}),n.result||(delete n.distance,delete n.arrayIndices),n}},A=S,M=S;d._f={_type:function(e){return"number"==typeof e?1:"string"==typeof e?2:"boolean"==typeof e?8:p(e)?4:null===e?10:e instanceof RegExp?11:"function"==typeof e?13:e instanceof Date?9:n.isBinary(e)?5:e instanceof d._ObjectID?7:3},_equal:function(e,r){return n.equals(e,r,{keyOrderSensitive:!0})},_typeorder:function(e){return[-1,1,2,3,4,5,-1,6,7,8,0,9,-1,100,2,100,1,8,1][e]},_cmp:function(e,r){if(void 0===e)return void 0===r?0:-1;if(void 0===r)return 1;var t=d._f._type(e),n=d._f._type(r),o=d._f._typeorder(t),i=d._f._typeorder(n);if(o!==i)return i>o?-1:1;if(t!==n)throw Error("Missing type coercion logic in _cmp");if(7===t&&(t=n=2,e=e.toHexString(),r=r.toHexString()),9===t&&(t=n=1,e=e.getTime(),r=r.getTime()),1===t)return e-r;if(2===n)return r>e?-1:e===r?0:1;if(3===t){var a=function(e){var r=[];for(var t in e)r.push(t),r.push(e[t]);return r};return d._f._cmp(a(e),a(r))}if(4===t)for(var s=0;;s++){if(s===e.length)return s===r.length?0:-1;if(s===r.length)return 1;var c=d._f._cmp(e[s],r[s]);if(0!==c)return c}if(5===t){if(e.length!==r.length)return e.length-r.length;for(s=0;s<e.length;s++){if(e[s]<r[s])return-1;if(e[s]>r[s])return 1}return 0}if(8===t)return e?r?0:1:r?-1:0;if(10===t)return 0;if(11===t)throw Error("Sorting not supported on regular expression");if(13===t)throw Error("Sorting not supported on Javascript code");throw Error("Unknown type to sort")}},d._removeDollarOperators=function(e){var r={};for(var t in e)"$"!==t.substr(0,1)&&(r[t]=e[t]);return r}}.call(this),function(){f.Sorter=function(n,o){var i=this;o=o||{},i._sortSpecParts=[];var a=function(e,r){if(!e)throw Error("sort keys must be non-empty");if("$"===e.charAt(0))throw Error("unsupported sort key: "+e);i._sortSpecParts.push({path:e,lookup:$(e,{forSort:!0}),ascending:r})};if(n instanceof Array)for(var s=0;s<n.length;s++)"string"==typeof n[s]?a(n[s],!0):a(n[s][0],"desc"!==n[s][1]);else{if("object"!=typeof n)throw Error("Bad sort specification: "+t.stringify(n));r.each(n,function(e,r){a(r,e>=0)})}if(i.affectedByModifier){var c={};r.each(i._sortSpecParts,function(e){c[e.path]=1}),i._selectorForAffectedByModifier=new f.Matcher(c)}i._keyComparator=e(r.map(i._sortSpecParts,function(e,r){return i._keyFieldComparator(r)})),i._keyFilter=null,o.matcher&&i._useWithMatcher(o.matcher)},r.extend(f.Sorter.prototype,{getComparator:function(r){var t=this;if(!r||!r.distances)return t._getBaseComparator();var n=r.distances;return e([t._getBaseComparator(),function(e,r){if(!n.has(e._id))throw Error("Missing distance for "+e._id);if(!n.has(r._id))throw Error("Missing distance for "+r._id);return n.get(e._id)-n.get(r._id)}])},_getPaths:function(){var e=this;return r.pluck(e._sortSpecParts,"path")},_getMinKeyFromDoc:function(e){var r=this,t=null;if(r._generateKeysFromDoc(e,function(e){return r._keyCompatibleWithSelector(e)?null===t?void(t=e):void(r._compareKeys(e,t)<0&&(t=e)):void 0}),null===t)throw Error("sort selector found no keys in doc?");return t},_keyCompatibleWithSelector:function(e){var r=this;return!r._keyFilter||r._keyFilter(e)},_generateKeysFromDoc:function(e,t){var n=this;if(0===n._sortSpecParts.length)throw new Error("can't generate keys without a spec");var o=[],i=function(e){return e.join(",")+","},a=null;if(r.each(n._sortSpecParts,function(t,n){var s=I(t.lookup(e),!0);s.length||(s=[{value:null}]);var c=!1;if(o[n]={},r.each(s,function(e){if(!e.arrayIndices){if(s.length>1)throw Error("multiple branches but no array used?");return void(o[n][""]=e.value)}c=!0;var t=i(e.arrayIndices);if(r.has(o[n],t))throw Error("duplicate path: "+t);if(o[n][t]=e.value,a&&!r.has(a,t))throw Error("cannot index parallel arrays")}),a){if(!r.has(o[n],"")&&r.size(a)!==r.size(o[n]))throw Error("cannot index parallel arrays!")}else c&&(a={},r.each(o[n],function(e,r){a[r]=!0}))}),!a){var s=r.map(o,function(e){if(!r.has(e,""))throw Error("no value in sole key case?");return e[""]});return void t(s)}r.each(a,function(e,n){var i=r.map(o,function(e){if(r.has(e,""))return e[""];if(!r.has(e,n))throw Error("missing path?");return e[n]});t(i)})},_compareKeys:function(e,r){var t=this;if(e.length!==t._sortSpecParts.length||r.length!==t._sortSpecParts.length)throw Error("Key has wrong length");return t._keyComparator(e,r)},_keyFieldComparator:function(e){var r=this,t=!r._sortSpecParts[e].ascending;return function(r,n){var o=d._f._cmp(r[e],n[e]);return t&&(o=-o),o}},_getBaseComparator:function(){var e=this;return e._sortSpecParts.length?function(r,t){var n=e._getMinKeyFromDoc(r),o=e._getMinKeyFromDoc(t);return e._compareKeys(n,o)}:function(e,r){return 0}},_useWithMatcher:function(e){var t=this;if(t._keyFilter)throw Error("called _useWithMatcher twice?");if(!r.isEmpty(t._sortSpecParts)){var n=e._selector;if(!(n instanceof Function)){var o={};r.each(t._sortSpecParts,function(e,r){o[e.path]=[]}),r.each(n,function(e,t){var n=o[t];if(n){if(e instanceof RegExp){if(e.ignoreCase||e.multiline)return;return void n.push(g(e))}return m(e)?void r.each(e,function(t,o){r.contains(["$lt","$lte","$gt","$gte"],o)&&n.push(b[o].compileElementSelector(t)),"$regex"!==o||e.$options||n.push(b.$regex.compileElementSelector(t,e))}):void n.push(w(e))}}),r.isEmpty(o[t._sortSpecParts[0].path])||(t._keyFilter=function(e){return r.all(t._sortSpecParts,function(t,n){return r.all(o[t.path],function(r){return r(e[n])})})})}}}});var e=function(e){return function(r,t){for(var n=0;n<e.length;++n){var o=e[n](r,t);if(0!==o)return o}return 0}}}.call(this),function(){d._compileProjection=function(e){d._checkSupportedProjection(e);var t=r.isUndefined(e._id)?!0:e._id,o=E(e),i=function(e,t){if(r.isArray(e))return r.map(e,function(e){return i(e,t)});var a=o.including?{}:n.clone(e);return r.each(t,function(t,s){r.has(e,s)&&(r.isObject(t)?r.isObject(e[s])&&(a[s]=i(e[s],t)):o.including?a[s]=n.clone(e[s]):delete a[s])}),a};return function(e){var n=i(e,o.tree);return t&&r.has(e,"_id")&&(n._id=e._id),!t&&r.has(n,"_id")&&delete n._id,n}},E=function(e){var t=r.keys(e).sort();t.length>0&&(1!==t.length||"_id"!==t[0])&&(t=r.reject(t,function(e){return"_id"===e}));var n=null;r.each(t,function(r){var t=!!e[r];if(null===n&&(n=t),n!==t)throw h("You cannot currently mix including and excluding fields.")});var o=O(t,function(e){return n},function(e,r,t){var n=t,o=r;throw h("both "+n+" and "+o+" found in fields option, using both of them may trigger unexpected behavior. Did you mean to use only one of them?")});return{tree:o,including:n}},O=function(e,t,n,o){return o=o||{},r.each(e,function(e){var i=o,a=e.split("."),s=r.all(a.slice(0,-1),function(t,o){if(r.has(i,t)){if(!r.isObject(i[t])&&(i[t]=n(i[t],a.slice(0,o+1).join("."),e),!r.isObject(i[t])))return!1}else i[t]={};return i=i[t],!0});if(s){var c=r.last(a);i[c]=r.has(i,c)?n(i[c],e,e):t(e)}}),o},d._checkSupportedProjection=function(e){if(!r.isObject(e)||r.isArray(e))throw h("fields option must be an object");r.each(e,function(e,t){if(r.contains(t.split("."),"$"))throw h("Minimongo doesn't support $ operator in projections yet.");if(-1===r.indexOf([1,0,!0,!1],e))throw h("Projection values should be one of 1, 0, true, or false")})}}.call(this),function(){d._modify=function(t,a,s){if(s=s||{},!v(a))throw h("Modifier must be an object");var c=m(a),u;if(c)u=n.clone(t),r.each(a,function(t,n){var a=i[n];if(s.isInsert&&"$setOnInsert"===n&&(a=i.$set),!a)throw h("Invalid modifier specified "+n);r.each(t,function(t,i){if(i.length&&"."===i[i.length-1])throw h("Invalid mod field name, may not end in a period");if("_id"===i)throw h("Mod on _id not allowed");var c=i.split("."),d=r.has(o,n),f="$rename"===n,l=e(u,c,{noCreate:o[n],forbidArray:"$rename"===n,arrayIndices:s.arrayIndices}),p=c.pop();a(l,p,t,i,u)})});else{if(a._id&&!n.equals(t._id,a._id))throw h("Cannot change the _id of a document");for(var d in a)if(/\./.test(d))throw h("When replacing document, field name may not contain '.'");u=a}r.each(r.keys(t),function(e){("_id"!==e||s.isInsert)&&delete t[e]}),r.each(u,function(e,r){t[r]=e})};var e=function(e,r,n){n=n||{};for(var o=!1,i=0;i<r.length;i++){var a=i===r.length-1,s=r[i],c=_(e);if(!c){if(n.noCreate)return void 0;var u=h("cannot use the part '"+s+"' to traverse "+e);throw u.setPropertyError=!0,u}if(e instanceof Array){if(n.forbidArray)return null;if("$"===s){if(o)throw h("Too many positional (i.e. '$') elements");if(!n.arrayIndices||!n.arrayIndices.length)throw h("The positional operator did not find the match needed from the query");s=n.arrayIndices[0],o=!0}else{if(!y(s)){if(n.noCreate)return void 0;throw h("can't append to array using string field name ["+s+"]")}s=parseInt(s)}if(a&&(r[i]=s),n.noCreate&&s>=e.length)return void 0;for(;e.length<s;)e.push(null);if(!a)if(e.length===s)e.push({});else if("object"!=typeof e[s])throw h("can't modify field '"+r[i+1]+"' of list value "+t.stringify(e[s]))}else{if(s.length&&"$"===s.substr(0,1))throw h("can't set field named "+s);if(!(s in e)){if(n.noCreate)return void 0;a||(e[s]={})}}if(a)return e;e=e[s]}},o={$unset:!0,$pop:!0,$rename:!0,$pull:!0,$pullAll:!0},i={$inc:function(e,r,t){if("number"!=typeof t)throw h("Modifier $inc allowed for numbers only");if(r in e){if("number"!=typeof e[r])throw h("Cannot apply $inc modifier to non-number");e[r]+=t}else e[r]=t},$set:function(e,t,o){if(!r.isObject(e)){var i=h("Cannot set property on non-object field");throw i.setPropertyError=!0,i}if(null===e){var i=h("Cannot set property on null");throw i.setPropertyError=!0,i}e[t]=n.clone(o)},$setOnInsert:function(e,r,t){},$unset:function(e,r,t){void 0!==e&&(e instanceof Array?r in e&&(e[r]=null):delete e[r])},$push:function(e,r,t){if(void 0===e[r]&&(e[r]=[]),!(e[r]instanceof Array))throw h("Cannot apply $push modifier to non-array");if(!t||!t.$each)return void e[r].push(n.clone(t));var o=t.$each;if(!(o instanceof Array))throw h("$each must be an array");var i=void 0;if("$slice"in t){if("number"!=typeof t.$slice)throw h("$slice must be a numeric value");if(t.$slice>0)throw h("$slice in $push must be zero or negative");i=t.$slice}var a=void 0;if(t.$sort){if(void 0===i)throw h("$sort requires $slice to be present");a=new f.Sorter(t.$sort).getComparator();for(var s=0;s<o.length;s++)if(3!==d._f._type(o[s]))throw h("$push like modifiers using $sort require all elements to be objects")}for(var c=0;c<o.length;c++)e[r].push(n.clone(o[c]));a&&e[r].sort(a),void 0!==i&&(e[r]=0===i?[]:e[r].slice(i))},$pushAll:function(e,r,t){if(!("object"==typeof t&&t instanceof Array))throw h("Modifier $pushAll/pullAll allowed for arrays only");var n=e[r];if(void 0===n)e[r]=t;else{if(!(n instanceof Array))throw h("Cannot apply $pushAll modifier to non-array");for(var o=0;o<t.length;o++)n.push(t[o])}},$addToSet:function(e,t,o){var i=!1;if("object"==typeof o)for(var a in o){"$each"===a&&(i=!0);break}var s=i?o.$each:[o],c=e[t];if(void 0===c)e[t]=s;else{if(!(c instanceof Array))throw h("Cannot apply $addToSet modifier to non-array");r.each(s,function(e){for(var r=0;r<c.length;r++)if(d._f._equal(e,c[r]))return; +c.push(n.clone(e))})}},$pop:function(e,r,t){if(void 0!==e){var n=e[r];if(void 0!==n){if(!(n instanceof Array))throw h("Cannot apply $pop modifier to non-array");"number"==typeof t&&0>t?n.splice(0,1):n.pop()}}},$pull:function(e,r,t){if(void 0!==e){var n=e[r];if(void 0!==n){if(!(n instanceof Array))throw h("Cannot apply $pull/pullAll modifier to non-array");var o=[];if("object"!=typeof t||t instanceof Array)for(var i=0;i<n.length;i++)d._f._equal(n[i],t)||o.push(n[i]);else for(var a=new f.Matcher(t),i=0;i<n.length;i++)a.documentMatches(n[i]).result||o.push(n[i]);e[r]=o}}},$pullAll:function(e,r,t){if(!("object"==typeof t&&t instanceof Array))throw h("Modifier $pushAll/pullAll allowed for arrays only");if(void 0!==e){var n=e[r];if(void 0!==n){if(!(n instanceof Array))throw h("Cannot apply $pull/pullAll modifier to non-array");for(var o=[],i=0;i<n.length;i++){for(var a=!1,s=0;s<t.length;s++)if(d._f._equal(n[i],t[s])){a=!0;break}a||o.push(n[i])}e[r]=o}}},$rename:function(r,t,n,o,i){if(o===n)throw h("$rename source must differ from target");if(null===r)throw h("$rename source field invalid");if("string"!=typeof n)throw h("$rename target must be a string");if(void 0!==r){var a=r[t];delete r[t];var s=n.split("."),c=e(i,s,{forbidArray:!0});if(null===c)throw h("$rename target field invalid");var u=s.pop();c[u]=a}},$bit:function(e,r,t){throw h("$bit is not supported")}}}.call(this),function(){d._diffQueryChanges=function(e,r,t,n){e?d._diffQueryOrderedChanges(r,t,n):d._diffQueryUnorderedChanges(r,t,n)},d._diffQueryUnorderedChanges=function(e,r,t){if(t.movedBefore)throw new Error("_diffQueryUnordered called with a movedBefore observer!");r.forEach(function(r,o){var i=e.get(o);if(i)t.changed&&!n.equals(i,r)&&t.changed(o,d._makeChangedFields(r,i));else if(t.added){var a=n.clone(r);delete a._id,t.added(r._id,a)}}),t.removed&&e.forEach(function(e,n){r.has(n)||t.removed(n)})},d._diffQueryOrderedChanges=function(t,o,i){var a={};r.each(o,function(r){a[r._id]&&e._debug("Duplicate _id in new_results"),a[r._id]=!0});var s={};r.each(t,function(r,t){r._id in s&&e._debug("Duplicate _id in old_results"),s[r._id]=t});for(var c=[],u=0,f=o.length,l=new Array(f),h=new Array(f),p=function(e){return s[o[e]._id]},v=0;f>v;v++)if(void 0!==s[o[v]._id]){for(var _=u;_>0&&!(p(l[_-1])<p(v));)_--;h[v]=0===_?-1:l[_-1],l[_]=v,_+1>u&&(u=_+1)}for(var m=0===u?-1:l[u-1];m>=0;)c.push(m),m=h[m];c.reverse(),c.push(o.length),r.each(t,function(e){a[e._id]||i.removed&&i.removed(e._id)});var y=0;r.each(c,function(e){for(var a=o[e]?o[e]._id:null,c,u,f,l=y;e>l;l++)u=o[l],r.has(s,u._id)?(c=t[s[u._id]],f=d._makeChangedFields(u,c),r.isEmpty(f)||i.changed&&i.changed(u._id,f),i.movedBefore&&i.movedBefore(u._id,a)):(f=n.clone(u),delete f._id,i.addedBefore&&i.addedBefore(u._id,f,a),i.added&&i.added(u._id,f));a&&(u=o[e],c=t[s[u._id]],f=d._makeChangedFields(u,c),r.isEmpty(f)||i.changed&&i.changed(u._id,f)),y=e+1})},d._diffObjects=function(e,t,n){r.each(e,function(e,o){r.has(t,o)?n.both&&n.both(o,e,t[o]):n.leftOnly&&n.leftOnly(o,e)}),n.rightOnly&&r.each(t,function(t,o){r.has(e,o)||n.rightOnly(o,t)})}}.call(this),function(){d._IdMap=function(){var e=this;o.call(e,d._idStringify,d._idParse)},e._inherits(d._IdMap,o)}.call(this),function(){d._CachingChangeObserver=function(e){var t=this;e=e||{};var o=e.callbacks&&d._observeChangesCallbacksAreOrdered(e.callbacks);if(r.has(e,"ordered")){if(t.ordered=e.ordered,e.callbacks&&e.ordered!==o)throw Error("ordered option doesn't match callbacks")}else{if(!e.callbacks)throw Error("must provide ordered or callbacks");t.ordered=o}var a=e.callbacks||{};t.ordered?(t.docs=new i(d._idStringify),t.applyChange={addedBefore:function(e,r,o){var i=n.clone(r);i._id=e,a.addedBefore&&a.addedBefore.call(t,e,r,o),a.added&&a.added.call(t,e,r),t.docs.putBefore(e,i,o||null)},movedBefore:function(e,r){var n=t.docs.get(e);a.movedBefore&&a.movedBefore.call(t,e,r),t.docs.moveBefore(e,r||null)}}):(t.docs=new d._IdMap,t.applyChange={added:function(e,r){var o=n.clone(r);a.added&&a.added.call(t,e,r),o._id=e,t.docs.set(e,o)}}),t.applyChange.changed=function(e,r){var o=t.docs.get(e);if(!o)throw new Error("Unknown id for changed: "+e);a.changed&&a.changed.call(t,e,n.clone(r)),d._applyChanges(o,r)},t.applyChange.removed=function(e){a.removed&&a.removed.call(t,e),t.docs.remove(e)}},d._observeFromObserveChanges=function(e,t){var o=e.getTransform()||function(e){return e},i=!!t._suppress_initial,a;if(d._observeCallbacksAreOrdered(t)){var s=!t._no_indices;a={addedBefore:function(e,n,a){var c=this;if(!i&&(t.addedAt||t.added)){var u=o(r.extend(n,{_id:e}));if(t.addedAt){var d=s?a?c.docs.indexOf(a):c.docs.size():-1;t.addedAt(u,d,a)}else t.added(u)}},changed:function(e,r){var i=this;if(t.changedAt||t.changed){var a=n.clone(i.docs.get(e));if(!a)throw new Error("Unknown id for changed: "+e);var c=o(n.clone(a));if(d._applyChanges(a,r),a=o(a),t.changedAt){var u=s?i.docs.indexOf(e):-1;t.changedAt(a,c,u)}else t.changed(a,c)}},movedBefore:function(e,r){var i=this;if(t.movedTo){var a=s?i.docs.indexOf(e):-1,c=s?r?i.docs.indexOf(r):i.docs.size():-1;c>a&&--c,t.movedTo(o(n.clone(i.docs.get(e))),a,c,r||null)}},removed:function(e){var r=this;if(t.removedAt||t.removed){var n=o(r.docs.get(e));if(t.removedAt){var i=s?r.docs.indexOf(e):-1;t.removedAt(n,i)}else t.removed(n)}}}}else a={added:function(e,n){if(!i&&t.added){var a=r.extend(n,{_id:e});t.added(o(a))}},changed:function(e,r){var i=this;if(t.changed){var a=i.docs.get(e),s=n.clone(a);d._applyChanges(s,r),t.changed(o(s),o(n.clone(a)))}},removed:function(e){var r=this;t.removed&&t.removed(o(r.docs.get(e)))}};var c=new d._CachingChangeObserver({callbacks:a}),u=e.observeChanges(c.applyChange);return i=!1,u}}.call(this),function(){d._looksLikeObjectID=function(e){return 24===e.length&&e.match(/^[0-9a-f]*$/)},d._ObjectID=function(e){var r=this;if(e){if(e=e.toLowerCase(),!d._looksLikeObjectID(e))throw new Error("Invalid hexadecimal string for creating an ObjectID");r._str=e}else r._str=c.hexString(24)},d._ObjectID.prototype.toString=function(){var e=this;return'ObjectID("'+e._str+'")'},d._ObjectID.prototype.equals=function(e){var r=this;return e instanceof d._ObjectID&&r.valueOf()===e.valueOf()},d._ObjectID.prototype.clone=function(){var e=this;return new d._ObjectID(e._str)},d._ObjectID.prototype.typeName=function(){return"oid"},d._ObjectID.prototype.getTimestamp=function(){var e=this;return parseInt(e._str.substr(0,8),16)},d._ObjectID.prototype.valueOf=d._ObjectID.prototype.toJSONValue=d._ObjectID.prototype.toHexString=function(){return this._str},d._selectorIsId=function(e){return"string"==typeof e||"number"==typeof e||e instanceof d._ObjectID},d._selectorIsIdPerhapsAsObject=function(e){return d._selectorIsId(e)||e&&"object"==typeof e&&e._id&&d._selectorIsId(e._id)&&1===r.size(e)},d._idsMatchedBySelector=function(e){if(d._selectorIsId(e))return[e];if(!e)return null;if(r.has(e,"_id"))return d._selectorIsId(e._id)?[e._id]:e._id&&e._id.$in&&r.isArray(e._id.$in)&&!r.isEmpty(e._id.$in)&&r.all(e._id.$in,d._selectorIsId)?e._id.$in:null;if(e.$and&&r.isArray(e.$and))for(var t=0;t<e.$and.length;++t){var n=d._idsMatchedBySelector(e.$and[t]);if(n)return n}return null},n.addType("oid",function(e){return new d._ObjectID(e)})}.call(this),"undefined"==typeof Package&&(Package={}),Package.minimongo={LocalCollection:d,Minimongo:f,MinimongoTest:l}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.check.check,n=Package.check.Match,r=Package.random.Random,o=Package.ejson.EJSON,i=Package.json.JSON,a=Package.underscore._,s=Package.tracker.Tracker,u=Package.tracker.Deps,c=Package.logging.Log,l=Package.retry.Retry,d=Package.minimongo.LocalCollection,f=Package.minimongo.Minimongo,_,p,h,v,m,g,b,y,w,k,S,C,T;(function(){_={},p={}}).call(this),function(){h=function(){var e=document,t=window,n={},r=function(){};r.prototype.addEventListener=function(e,t){this._listeners||(this._listeners={}),e in this._listeners||(this._listeners[e]=[]);var r=this._listeners[e];-1===n.arrIndexOf(r,t)&&r.push(t)},r.prototype.removeEventListener=function(e,t){if(this._listeners&&e in this._listeners){var r=this._listeners[e],o=n.arrIndexOf(r,t);return-1!==o?void(r.length>1?this._listeners[e]=r.slice(0,o).concat(r.slice(o+1)):delete this._listeners[e]):void 0}},r.prototype.dispatchEvent=function(e){var t=e.type,n=Array.prototype.slice.call(arguments,0);if(this["on"+t]&&this["on"+t].apply(this,n),this._listeners&&t in this._listeners)for(var r=0;r<this._listeners[t].length;r++)this._listeners[t][r].apply(this,n)};var o=function(e,t){if(this.type=e,"undefined"!=typeof t)for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n])};o.prototype.toString=function(){var e=[];for(var t in this)if(this.hasOwnProperty(t)){var n=this[t];"function"==typeof n&&(n="[function]"),e.push(t+"="+n)}return"SimpleEvent("+e.join(", ")+")"};var a=function(e){var t=this;t._events=e||[],t._listeners={}};a.prototype.emit=function(e){var t=this;if(t._verifyType(e),!t._nuked){var n=Array.prototype.slice.call(arguments,1);if(t["on"+e]&&t["on"+e].apply(t,n),e in t._listeners)for(var r=0;r<t._listeners[e].length;r++)t._listeners[e][r].apply(t,n)}},a.prototype.on=function(e,t){var n=this;n._verifyType(e),n._nuked||(e in n._listeners||(n._listeners[e]=[]),n._listeners[e].push(t))},a.prototype._verifyType=function(e){var t=this;-1===n.arrIndexOf(t._events,e)&&n.log("Event "+i.stringify(e)+" not listed "+i.stringify(t._events)+" in "+t)},a.prototype.nuke=function(){var e=this;e._nuked=!0;for(var t=0;t<e._events.length;t++)delete e[e._events[t]];e._listeners={}};var s="abcdefghijklmnopqrstuvwxyz0123456789_";n.random_string=function(e,t){t=t||s.length;var n,r=[];for(n=0;e>n;n++)r.push(s.substr(Math.floor(Math.random()*t),1));return r.join("")},n.random_number=function(e){return Math.floor(Math.random()*e)},n.random_number_string=function(e){var t=(""+(e-1)).length,r=Array(t+1).join("0");return(r+n.random_number(e)).slice(-t)},n.getOrigin=function(e){e+="/";var t=e.split("/").slice(0,3);return t.join("/")},n.isSameOriginUrl=function(e,n){return n||(n=t.location.href),e.split("/").slice(0,3).join("/")===n.split("/").slice(0,3).join("/")},n.isSameOriginScheme=function(e,n){return n||(n=t.location.href),e.split(":")[0]===n.split(":")[0]},n.getParentDomain=function(e){if(/^[0-9.]*$/.test(e))return e;if(/^\[/.test(e))return e;if(!/[.]/.test(e))return e;var t=e.split(".").slice(1);return t.join(".")},n.objectExtend=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e};var u="_jp";n.polluteGlobalNamespace=function(){u in t||(t[u]={})},n.closeFrame=function(e,t){return"c"+i.stringify([e,t])},n.userSetCode=function(e){return 1e3===e||e>=3e3&&4999>=e},n.countRTO=function(e){var t;return t=e>100?3*e:e+200},n.log=function(){t.console&&console.log&&console.log.apply&&console.log.apply(console,arguments)},n.bind=function(e,t){return e.bind?e.bind(t):function(){return e.apply(t,arguments)}},n.flatUrl=function(e){return-1===e.indexOf("?")&&-1===e.indexOf("#")},n.amendUrl=function(t,r){var o;if(void 0===r)o=e.location;else{var i=/^([a-z0-9.+-]+:)/i.exec(r);if(i){var a=i[0].toLowerCase(),s=r.substring(a.length),u=/[a-z0-9\.-]+(:[0-9]+)?/.exec(s);if(u)var c=u[0]}if(!a||!c)throw new Error("relativeTo must be an absolute url");o={protocol:a,host:c}}if(!t)throw new Error("Wrong url for SockJS");if(!n.flatUrl(t))throw new Error("Only basic urls are supported in SockJS");0===t.indexOf("//")&&(t=o.protocol+t),0===t.indexOf("/")&&(t=o.protocol+"//"+o.host+t),t=t.replace(/[/]+$/,"");var l=t.split("/");return("http:"===l[0]&&/:80$/.test(l[2])||"https:"===l[0]&&/:443$/.test(l[2]))&&(l[2]=l[2].replace(/:(80|443)$/,"")),t=l.join("/")},n.arrIndexOf=function(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1},n.arrSkip=function(e,t){var r=n.arrIndexOf(e,t);if(-1===r)return e.slice();var o=e.slice(0,r);return o.concat(e.slice(r+1))},n.isArray=Array.isArray||function(e){return{}.toString.call(e).indexOf("Array")>=0},n.delay=function(e,t){return"function"==typeof e&&(t=e,e=0),setTimeout(t,e)};var c=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,l={"\x00":"\\u0000","":"\\u0001","":"\\u0002","":"\\u0003","":"\\u0004","":"\\u0005","":"\\u0006","":"\\u0007","\b":"\\b"," ":"\\t","\n":"\\n","":"\\u000b","\f":"\\f","\r":"\\r","":"\\u000e","":"\\u000f","":"\\u0010","":"\\u0011","":"\\u0012","":"\\u0013","":"\\u0014","":"\\u0015","":"\\u0016","":"\\u0017","":"\\u0018","":"\\u0019","":"\\u001a","":"\\u001b","":"\\u001c","":"\\u001d","":"\\u001e","":"\\u001f",'"':'\\"',"\\":"\\\\","":"\\u007f","":"\\u0080","":"\\u0081","":"\\u0082","":"\\u0083","":"\\u0084","
":"\\u0085","":"\\u0086","":"\\u0087","":"\\u0088","":"\\u0089","":"\\u008a","":"\\u008b","":"\\u008c","":"\\u008d","":"\\u008e","":"\\u008f","":"\\u0090","":"\\u0091","":"\\u0092","":"\\u0093","":"\\u0094","":"\\u0095","":"\\u0096","":"\\u0097","":"\\u0098","":"\\u0099","":"\\u009a","":"\\u009b","":"\\u009c","":"\\u009d","":"\\u009e","":"\\u009f","":"\\u00ad","":"\\u0600","":"\\u0601","":"\\u0602","":"\\u0603","":"\\u0604","":"\\u070f","឴":"\\u17b4","឵":"\\u17b5","":"\\u200c","":"\\u200d","":"\\u200e","":"\\u200f","\u2028":"\\u2028","\u2029":"\\u2029","":"\\u202a","":"\\u202b","":"\\u202c","":"\\u202d","":"\\u202e"," ":"\\u202f","":"\\u2060","":"\\u2061","":"\\u2062","":"\\u2063","":"\\u2064","":"\\u2065","":"\\u2066","":"\\u2067","":"\\u2068","":"\\u2069","":"\\u206a","":"\\u206b","":"\\u206c","":"\\u206d","":"\\u206e","":"\\u206f","":"\\ufeff","":"\\ufff0","":"\\ufff1","":"\\ufff2","":"\\ufff3","":"\\ufff4","":"\\ufff5","":"\\ufff6","":"\\ufff7","":"\\ufff8","":"\\ufff9","":"\\ufffa","":"\\ufffb","":"\\ufffc","�":"\\ufffd","":"\\ufffe","":"\\uffff"},d=/[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g,f,_=i&&i.stringify||function(e){return c.lastIndex=0,c.test(e)&&(e=e.replace(c,function(e){return l[e]})),'"'+e+'"'},p=function(e){var t,n={},r=[];for(t=0;65536>t;t++)r.push(String.fromCharCode(t));return e.lastIndex=0,r.join("").replace(e,function(e){return n[e]="\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4),""}),e.lastIndex=0,n};n.quote=function(e){var t=_(e);return d.lastIndex=0,d.test(t)?(f||(f=p(d)),t.replace(d,function(e){return f[e]})):t};var h=["websocket","xdr-streaming","xhr-streaming","iframe-eventsource","iframe-htmlfile","xdr-polling","xhr-polling","iframe-xhr-polling","jsonp-polling"];n.probeProtocols=function(){for(var e={},t=0;t<h.length;t++){var n=h[t];e[n]=T[n]&&T[n].enabled()}return e},n.detectProtocols=function(e,t,n){var r={},o=[];t||(t=h);for(var i=0;i<t.length;i++){var a=t[i];r[a]=e[a]}var s=function(e){var t=e.shift();r[t]?o.push(t):e.length>0&&s(e)};return n.websocket!==!1&&s(["websocket"]),r["xhr-streaming"]&&!n.null_origin?o.push("xhr-streaming"):!r["xdr-streaming"]||n.cookie_needed||n.null_origin?s(["iframe-eventsource","iframe-htmlfile"]):o.push("xdr-streaming"),r["xhr-polling"]&&!n.null_origin?o.push("xhr-polling"):!r["xdr-polling"]||n.cookie_needed||n.null_origin?s(["iframe-xhr-polling","jsonp-polling"]):o.push("xdr-polling"),o};var v="_sockjs_global";n.createHook=function(){var e="a"+n.random_string(8);if(!(v in t)){var r={};t[v]=function(e){return e in r||(r[e]={id:e,del:function(){delete r[e]}}),r[e]}}return t[v](e)},n.attachMessage=function(e){n.attachEvent("message",e)},n.attachEvent=function(n,r){"undefined"!=typeof t.addEventListener?t.addEventListener(n,r,!1):(e.attachEvent("on"+n,r),t.attachEvent("on"+n,r))},n.detachMessage=function(e){n.detachEvent("message",e)},n.detachEvent=function(n,r){"undefined"!=typeof t.addEventListener?t.removeEventListener(n,r,!1):(e.detachEvent("on"+n,r),t.detachEvent("on"+n,r))};var m={},g=!1,b=function(){for(var e in m)m[e](),delete m[e]},y=function(){g||(g=!0,b())};n.attachEvent("unload",y),n.unload_add=function(e){var t=n.random_string(8);return m[t]=e,g&&n.delay(b),t},n.unload_del=function(e){e in m&&delete m[e]},n.createIframe=function(t,r){var o=e.createElement("iframe"),i,a,s=function(){clearTimeout(i);try{o.onload=null}catch(e){}o.onerror=null},u=function(){o&&(s(),setTimeout(function(){o&&o.parentNode.removeChild(o),o=null},0),n.unload_del(a))},c=function(e){o&&(u(),r(e))},l=function(e,t){try{o&&o.contentWindow&&o.contentWindow.postMessage(e,t)}catch(n){}};return o.src=t,o.style.display="none",o.style.position="absolute",o.onerror=function(){c("onerror")},o.onload=function(){clearTimeout(i),i=setTimeout(function(){c("onload timeout")},2e3)},e.body.appendChild(o),i=setTimeout(function(){c("timeout")},15e3),a=n.unload_add(u),{post:l,cleanup:u,loaded:s}},n.createHtmlfile=function(e,r){var o=new ActiveXObject("htmlfile"),i,a,s,c=function(){clearTimeout(i)},l=function(){o&&(c(),n.unload_del(a),s.parentNode.removeChild(s),s=o=null,CollectGarbage())},d=function(e){o&&(l(),r(e))},f=function(e,t){try{s&&s.contentWindow&&s.contentWindow.postMessage(e,t)}catch(n){}};o.open(),o.write('<html><script>document.domain="'+document.domain+'";</script></html>'),o.close(),o.parentWindow[u]=t[u];var _=o.createElement("div");return o.body.appendChild(_),s=o.createElement("iframe"),_.appendChild(s),s.src=e,i=setTimeout(function(){d("timeout")},15e3),a=n.unload_add(l),{post:f,cleanup:l,loaded:c}};var w=function(){};w.prototype=new a(["chunk","finish"]),w.prototype._start=function(e,r,o,i){var a=this;try{a.xhr=new XMLHttpRequest}catch(s){}if(!a.xhr)try{a.xhr=new t.ActiveXObject("Microsoft.XMLHTTP")}catch(s){}(t.ActiveXObject||t.XDomainRequest)&&(r+=(-1===r.indexOf("?")?"?":"&")+"t="+ +new Date),a.unload_ref=n.unload_add(function(){a._cleanup(!0)});try{a.xhr.open(e,r,!0)}catch(u){return a.emit("finish",0,""),void a._cleanup()}if(i&&i.no_credentials||(a.xhr.withCredentials="true"),i&&i.headers)for(var c in i.headers)a.xhr.setRequestHeader(c,i.headers[c]);a.xhr.onreadystatechange=function(){if(a.xhr){var e=a.xhr;switch(e.readyState){case 3:try{var t=e.status,n=e.responseText}catch(e){}1223===t&&(t=204),n&&n.length>0&&a.emit("chunk",t,n);break;case 4:var t=e.status;1223===t&&(t=204),a.emit("finish",t,e.responseText),a._cleanup(!1)}}},a.xhr.send(o)},w.prototype._cleanup=function(e){var t=this;if(t.xhr){if(n.unload_del(t.unload_ref),t.xhr.onreadystatechange=function(){},e)try{t.xhr.abort()}catch(r){}t.unload_ref=t.xhr=null}},w.prototype.close=function(){var e=this;e.nuke(),e._cleanup(!0)};var k=n.XHRCorsObject=function(){var e=this,t=arguments;n.delay(function(){e._start.apply(e,t)})};k.prototype=new w;var S=n.XHRLocalObject=function(e,t,r){var o=this;n.delay(function(){o._start(e,t,r,{no_credentials:!0})})};S.prototype=new w;var C=n.XDRObject=function(e,t,r){var o=this;n.delay(function(){o._start(e,t,r)})};C.prototype=new a(["chunk","finish"]),C.prototype._start=function(e,t,r){var o=this,i=new XDomainRequest;t+=(-1===t.indexOf("?")?"?":"&")+"t="+ +new Date;var a=i.ontimeout=i.onerror=function(){o.emit("finish",0,""),o._cleanup(!1)};i.onprogress=function(){o.emit("chunk",200,i.responseText)},i.onload=function(){o.emit("finish",200,i.responseText),o._cleanup(!1)},o.xdr=i,o.unload_ref=n.unload_add(function(){o._cleanup(!0)});try{o.xdr.open(e,t),o.xdr.send(r)}catch(s){a()}},C.prototype._cleanup=function(e){var t=this;if(t.xdr){if(n.unload_del(t.unload_ref),t.xdr.ontimeout=t.xdr.onerror=t.xdr.onprogress=t.xdr.onload=null,e)try{t.xdr.abort()}catch(r){}t.unload_ref=t.xdr=null}},C.prototype.close=function(){var e=this;e.nuke(),e._cleanup(!0)},n.isXHRCorsCapable=function(){return t.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest?1:t.XDomainRequest&&e.domain?2:B.enabled()?3:4};var T=function(e,t,r){if(!(this instanceof T))return new T(e,t,r);var o=this,i;o._options={devel:!1,debug:!1,protocols_whitelist:[],info:void 0,rtt:void 0},r&&n.objectExtend(o._options,r),o._base_url=n.amendUrl(e),o._server=o._options.server||n.random_number_string(1e3),o._options.protocols_whitelist&&o._options.protocols_whitelist.length?i=o._options.protocols_whitelist:(i="string"==typeof t&&t.length>0?[t]:n.isArray(t)?t:null,i&&o._debug('Deprecated API: Use "protocols_whitelist" option instead of supplying protocol list as a second parameter to SockJS constructor.')),o._protocols=[],o.protocol=null,o.readyState=T.CONNECTING,o._ir=q(o._base_url),o._ir.onfinish=function(e,t){o._ir=null,e?(o._options.info&&(e=n.objectExtend(e,o._options.info)),o._options.rtt&&(t=o._options.rtt),o._applyInfo(e,t,i),o._didClose()):o._didClose(1002,"Can't connect to server",!0)}};T.prototype=new r,T.version="0.3.4",T.CONNECTING=0,T.OPEN=1,T.CLOSING=2,T.CLOSED=3,T.prototype._debug=function(){this._options.debug&&n.log.apply(n,arguments)},T.prototype._dispatchOpen=function(){var e=this;e.readyState===T.CONNECTING?(e._transport_tref&&(clearTimeout(e._transport_tref),e._transport_tref=null),e.readyState=T.OPEN,e.dispatchEvent(new o("open"))):e._didClose(1006,"Server lost session")},T.prototype._dispatchMessage=function(e){var t=this;t.readyState===T.OPEN&&t.dispatchEvent(new o("message",{data:e}))},T.prototype._dispatchHeartbeat=function(e){var t=this;t.readyState===T.OPEN&&t.dispatchEvent(new o("heartbeat",{}))},T.prototype._didClose=function(e,t,r){var i=this;if(i.readyState!==T.CONNECTING&&i.readyState!==T.OPEN&&i.readyState!==T.CLOSING)throw new Error("INVALID_STATE_ERR");i._ir&&(i._ir.nuke(),i._ir=null),i._transport&&(i._transport.doCleanup(),i._transport=null);var a=new o("close",{code:e,reason:t,wasClean:n.userSetCode(e)});if(!n.userSetCode(e)&&i.readyState===T.CONNECTING&&!r){if(i._try_next_protocol(a))return;a=new o("close",{code:2e3,reason:"All transports failed",wasClean:!1,last_event:a})}i.readyState=T.CLOSED,n.delay(function(){i.dispatchEvent(a)})},T.prototype._didMessage=function(e){var t=this,n=e.slice(0,1);switch(n){case"o":t._dispatchOpen();break;case"a":for(var r=i.parse(e.slice(1)||"[]"),o=0;o<r.length;o++)t._dispatchMessage(r[o]);break;case"m":var r=i.parse(e.slice(1)||"null");t._dispatchMessage(r);break;case"c":var r=i.parse(e.slice(1)||"[]");t._didClose(r[0],r[1]);break;case"h":t._dispatchHeartbeat()}},T.prototype._try_next_protocol=function(t){var r=this;for(r.protocol&&(r._debug("Closed transport:",r.protocol,""+t),r.protocol=null),r._transport_tref&&(clearTimeout(r._transport_tref),r._transport_tref=null);;){var o=r.protocol=r._protocols.shift();if(!o)return!1;if(T[o]&&T[o].need_body===!0&&(!e.body||"undefined"!=typeof e.readyState&&"complete"!==e.readyState))return r._protocols.unshift(o),r.protocol="waiting-for-load",n.attachEvent("load",function(){r._try_next_protocol()}),!0;if(T[o]&&T[o].enabled(r._options)){var i=T[o].roundTrips||1,a=(r._options.rto||0)*i||5e3;r._transport_tref=n.delay(a,function(){r.readyState===T.CONNECTING&&r._didClose(2007,"Transport timeouted")});var s=n.random_string(8),u=r._base_url+"/"+r._server+"/"+s;return r._debug("Opening transport:",o," url:"+u," RTO:"+r._options.rto),r._transport=new T[o](r,u,r._base_url),!0}r._debug("Skipping transport:",o)}},T.prototype.close=function(e,t){var r=this;if(e&&!n.userSetCode(e))throw new Error("INVALID_ACCESS_ERR");return r.readyState!==T.CONNECTING&&r.readyState!==T.OPEN?!1:(r.readyState=T.CLOSING,r._didClose(e||1e3,t||"Normal closure"),!0)},T.prototype.send=function(e){var t=this;if(t.readyState===T.CONNECTING)throw new Error("INVALID_STATE_ERR");return t.readyState===T.OPEN&&t._transport.doSend(n.quote(""+e)),!0},T.prototype._applyInfo=function(t,r,o){var i=this;i._options.info=t,i._options.rtt=r,i._options.rto=n.countRTO(r),i._options.info.null_origin=!e.domain,t.base_url&&(i._base_url=n.amendUrl(t.base_url,i._base_url));var a=n.probeProtocols();i._protocols=n.detectProtocols(a,o,t),n.isSameOriginScheme(i._base_url)||2!==n.isXHRCorsCapable()||(i._protocols=["jsonp-polling"])};var E=T.websocket=function(e,r){var o=this,i=r+"/websocket";i="https"===i.slice(0,5)?"wss"+i.slice(5):"ws"+i.slice(4),o.ri=e,o.url=i;var a=t.WebSocket||t.MozWebSocket;o.ws=new a(o.url),o.ws.onmessage=function(e){o.ri._didMessage(e.data)},o.unload_ref=n.unload_add(function(){o.ws.close()}),o.ws.onclose=function(){o.ri._didMessage(n.closeFrame(1006,"WebSocket connection broken"))}};E.prototype.doSend=function(e){this.ws.send("["+e+"]")},E.prototype.doCleanup=function(){var e=this,t=e.ws;t&&(t.onmessage=t.onclose=null,t.close(),n.unload_del(e.unload_ref),e.unload_ref=e.ri=e.ws=null)},E.enabled=function(){return!(!t.WebSocket&&!t.MozWebSocket)},E.roundTrips=2;var O=function(){};O.prototype.send_constructor=function(e){var t=this;t.send_buffer=[],t.sender=e},O.prototype.doSend=function(e){var t=this;t.send_buffer.push(e),t.send_stop||t.send_schedule()},O.prototype.send_schedule_wait=function(){var e=this,t;e.send_stop=function(){e.send_stop=null,clearTimeout(t)},t=n.delay(25,function(){e.send_stop=null,e.send_schedule()})},O.prototype.send_schedule=function(){var e=this;if(e.send_buffer.length>0){var t="["+e.send_buffer.join(",")+"]";e.send_stop=e.sender(e.trans_url,t,function(t,n){e.send_stop=null,t===!1?e.ri._didClose(1006,"Sending error "+n):e.send_schedule_wait()}),e.send_buffer=[]}},O.prototype.send_destructor=function(){var e=this;e._send_stop&&e._send_stop(),e._send_stop=null};var x=function(t,r,o){var i=this;if(!("_send_form"in i)){var a=i._send_form=e.createElement("form"),s=i._send_area=e.createElement("textarea");s.name="d",a.style.display="none",a.style.position="absolute",a.method="POST",a.enctype="application/x-www-form-urlencoded",a.acceptCharset="UTF-8",a.appendChild(s),e.body.appendChild(a)}var a=i._send_form,s=i._send_area,u="a"+n.random_string(8);a.target=u,a.action=t+"/jsonp_send?i="+u;var c;try{c=e.createElement('<iframe name="'+u+'">')}catch(l){c=e.createElement("iframe"),c.name=u}c.id=u,a.appendChild(c),c.style.display="none";try{s.value=r}catch(d){n.log("Your browser is seriously broken. Go home! "+d.message)}a.submit();var f=function(e){c.onerror&&(c.onreadystatechange=c.onerror=c.onload=null,n.delay(500,function(){c.parentNode.removeChild(c),c=null}),s.value="",o(!0))};return c.onerror=c.onload=f,c.onreadystatechange=function(e){"complete"==c.readyState&&f()},f},I=function(e){return function(t,n,r){var o=new e("POST",t+"/xhr_send",n);return o.onfinish=function(e,t){r(200===e||204===e,"http status "+e)},function(e){r(!1,e)}}},M=function(t,r){var o,i=e.createElement("script"),a,s=function(e){a&&(a.parentNode.removeChild(a),a=null),i&&(clearTimeout(o),i.parentNode.removeChild(i),i.onreadystatechange=i.onerror=i.onload=i.onclick=null,i=null,r(e),r=null)},u=!1,c=null;if(i.id="a"+n.random_string(8),i.src=t,i.type="text/javascript",i.charset="UTF-8",i.onerror=function(e){c||(c=setTimeout(function(){u||s(n.closeFrame(1006,"JSONP script loaded abnormally (onerror)"))},1e3))},i.onload=function(e){s(n.closeFrame(1006,"JSONP script loaded abnormally (onload)"))},i.onreadystatechange=function(e){if(/loaded|closed/.test(i.readyState)){if(i&&i.htmlFor&&i.onclick){u=!0;try{i.onclick()}catch(t){}}i&&s(n.closeFrame(1006,"JSONP script loaded abnormally (onreadystatechange)"))}},"undefined"==typeof i.async&&e.attachEvent)if(/opera/i.test(navigator.userAgent))a=e.createElement("script"),a.text="try{var a = document.getElementById('"+i.id+"'); if(a)a.onerror();}catch(x){};",i.async=a.async=!1;else{try{i.htmlFor=i.id,i.event="onclick"}catch(l){}i.async=!0}"undefined"!=typeof i.async&&(i.async=!0),o=setTimeout(function(){s(n.closeFrame(1006,"JSONP script loaded abnormally (timeout)"))},35e3);var d=e.getElementsByTagName("head")[0];return d.insertBefore(i,d.firstChild),a&&d.insertBefore(a,d.firstChild),s},D=T["jsonp-polling"]=function(e,t){n.polluteGlobalNamespace();var r=this;r.ri=e,r.trans_url=t,r.send_constructor(x),r._schedule_recv()};D.prototype=new O,D.prototype._schedule_recv=function(){var e=this,t=function(t){e._recv_stop=null,t&&(e._is_closing||e.ri._didMessage(t)),e._is_closing||e._schedule_recv()};e._recv_stop=R(e.trans_url+"/jsonp",M,t)},D.enabled=function(){return!0},D.need_body=!0,D.prototype.doCleanup=function(){var e=this;e._is_closing=!0,e._recv_stop&&e._recv_stop(),e.ri=e._recv_stop=null,e.send_destructor()};var R=function(e,r,o){var i="a"+n.random_string(6),a=e+"?c="+escape(u+"."+i),s=0,c=function(e){switch(s){case 0:delete t[u][i],o(e);break;case 1:o(e),s=2;break;case 2:delete t[u][i]}},l=r(a,c);t[u][i]=l;var d=function(){t[u][i]&&(s=1,t[u][i](n.closeFrame(1e3,"JSONP user aborted read")))};return d},P=function(){};P.prototype=new O,P.prototype.run=function(e,t,n,r,o){var i=this;i.ri=e,i.trans_url=t,i.send_constructor(I(o)),i.poll=new Z(e,r,t+n,o)},P.prototype.doCleanup=function(){var e=this;e.poll&&(e.poll.abort(),e.poll=null)};var N=T["xhr-streaming"]=function(e,t){this.run(e,t,"/xhr_streaming",ot,n.XHRCorsObject)};N.prototype=new P,N.enabled=function(){return t.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest&&!/opera/i.test(navigator.userAgent)},N.roundTrips=2,N.need_body=!0;var j=T["xdr-streaming"]=function(e,t){this.run(e,t,"/xhr_streaming",ot,n.XDRObject)};j.prototype=new P,j.enabled=function(){return!!t.XDomainRequest},j.roundTrips=2;var U=T["xhr-polling"]=function(e,t){this.run(e,t,"/xhr",ot,n.XHRCorsObject)};U.prototype=new P,U.enabled=N.enabled,U.roundTrips=2;var A=T["xdr-polling"]=function(e,t){this.run(e,t,"/xhr",ot,n.XDRObject)};A.prototype=new P,A.enabled=j.enabled,A.roundTrips=2;var B=function(){};B.prototype.i_constructor=function(e,t,r){var o=this;o.ri=e,o.origin=n.getOrigin(r),o.base_url=r,o.trans_url=t;var i=r+"/iframe.html";o.ri._options.devel&&(i+="?t="+ +new Date),o.window_id=n.random_string(8),i+="#"+o.window_id,o.iframeObj=n.createIframe(i,function(e){o.ri._didClose(1006,"Unable to load an iframe ("+e+")")}),o.onmessage_cb=n.bind(o.onmessage,o),n.attachMessage(o.onmessage_cb)},B.prototype.doCleanup=function(){var e=this;if(e.iframeObj){n.detachMessage(e.onmessage_cb);try{e.iframeObj.iframe.contentWindow&&e.postMessage("c")}catch(t){}e.iframeObj.cleanup(),e.iframeObj=null,e.onmessage_cb=e.iframeObj=null}},B.prototype.onmessage=function(e){var t=this;if(e.origin===t.origin){var n=e.data.slice(0,8),r=e.data.slice(8,9),o=e.data.slice(9);if(n===t.window_id)switch(r){case"s":t.iframeObj.loaded(),t.postMessage("s",i.stringify([T.version,t.protocol,t.trans_url,t.base_url]));break;case"t":t.ri._didMessage(o)}}},B.prototype.postMessage=function(e,t){var n=this;n.iframeObj.post(n.window_id+e+(t||""),n.origin)},B.prototype.doSend=function(e){this.postMessage("m",e)},B.enabled=function(){var e=navigator&&navigator.userAgent&&-1!==navigator.userAgent.indexOf("Konqueror");return("function"==typeof t.postMessage||"object"==typeof t.postMessage)&&!e};var H,L=function(e,r){parent!==t?parent.postMessage(H+e+(r||""),"*"):n.log("Can't postMessage, no parent window.",e,r)},F=function(){};F.prototype._didClose=function(e,t){L("t",n.closeFrame(e,t))},F.prototype._didMessage=function(e){L("t",e)},F.prototype._doSend=function(e){this._transport.doSend(e)},F.prototype._doCleanup=function(){this._transport.doCleanup()},n.parent_origin=void 0,T.bootstrap_iframe=function(){var r;H=e.location.hash.slice(1);var o=function(e){if(e.source===parent&&("undefined"==typeof n.parent_origin&&(n.parent_origin=e.origin),e.origin===n.parent_origin)){var o=e.data.slice(0,8),a=e.data.slice(8,9),s=e.data.slice(9);if(o===H)switch(a){case"s":var u=i.parse(s),c=u[0],l=u[1],d=u[2],f=u[3];if(c!==T.version&&n.log('Incompatibile SockJS! Main site uses: "'+c+'", the iframe: "'+T.version+'".'),!n.flatUrl(d)||!n.flatUrl(f))return void n.log("Only basic urls are supported in SockJS");if(!n.isSameOriginUrl(d)||!n.isSameOriginUrl(f))return void n.log("Can't connect to different domain from within an iframe. ("+i.stringify([t.location.href,d,f])+")");r=new F,r._transport=new F[l](r,d,f);break;case"m":r._doSend(s);break;case"c":r&&r._doCleanup(),r=null}}};n.attachMessage(o),L("s")};var X=function(e,t){var r=this;n.delay(function(){r.doXhr(e,t)})};X.prototype=new a(["finish"]),X.prototype.doXhr=function(e,t){var r=this,o=(new Date).getTime(),a=new t("GET",e+"/info?cb="+n.random_string(10)),s=n.delay(8e3,function(){a.ontimeout()});a.onfinish=function(e,t){if(clearTimeout(s),s=null,200===e){var n=(new Date).getTime()-o,a=i.parse(t);"object"!=typeof a&&(a={}),r.emit("finish",a,n)}else r.emit("finish")},a.ontimeout=function(){a.close(),r.emit("finish")}};var V=function(t){var r=this,o=function(){var e=new B;e.protocol="w-iframe-info-receiver";var n=function(t){if("string"==typeof t&&"m"===t.substr(0,1)){var n=i.parse(t.substr(1)),o=n[0],a=n[1];r.emit("finish",o,a)}else r.emit("finish");e.doCleanup(),e=null},o={_options:{},_didClose:n,_didMessage:n};e.i_constructor(o,t,t)};e.body?o():n.attachEvent("load",o)};V.prototype=new a(["finish"]);var W=function(){var e=this;n.delay(function(){e.emit("finish",{},2e3)})};W.prototype=new a(["finish"]);var q=function(e){if(n.isSameOriginUrl(e))return new X(e,n.XHRLocalObject);switch(n.isXHRCorsCapable()){case 1:return new X(e,n.XHRLocalObject);case 2:return n.isSameOriginScheme(e)?new X(e,n.XDRObject):new W;case 3:return new V(e);default:return new W}},G=F["w-iframe-info-receiver"]=function(e,t,r){var o=new X(r,n.XHRLocalObject);o.onfinish=function(t,n){e._didMessage("m"+i.stringify([t,n])),e._didClose()}};G.prototype.doCleanup=function(){};var J=T["iframe-eventsource"]=function(){var e=this;e.protocol="w-iframe-eventsource",e.i_constructor.apply(e,arguments)};J.prototype=new B,J.enabled=function(){return"EventSource"in t&&B.enabled()},J.need_body=!0,J.roundTrips=3;var Q=F["w-iframe-eventsource"]=function(e,t){this.run(e,t,"/eventsource",et,n.XHRLocalObject)};Q.prototype=new P;var z=T["iframe-xhr-polling"]=function(){var e=this;e.protocol="w-iframe-xhr-polling",e.i_constructor.apply(e,arguments)};z.prototype=new B,z.enabled=function(){return t.XMLHttpRequest&&B.enabled()},z.need_body=!0,z.roundTrips=3;var $=F["w-iframe-xhr-polling"]=function(e,t){this.run(e,t,"/xhr",ot,n.XHRLocalObject)};$.prototype=new P;var Y=T["iframe-htmlfile"]=function(){var e=this;e.protocol="w-iframe-htmlfile",e.i_constructor.apply(e,arguments)};Y.prototype=new B,Y.enabled=function(){return B.enabled()},Y.need_body=!0,Y.roundTrips=3;var K=F["w-iframe-htmlfile"]=function(e,t){this.run(e,t,"/htmlfile",rt,n.XHRLocalObject)};K.prototype=new P;var Z=function(e,t,n,r){var o=this;o.ri=e,o.Receiver=t,o.recv_url=n,o.AjaxObject=r,o._scheduleRecv()};Z.prototype._scheduleRecv=function(){var e=this,t=e.poll=new e.Receiver(e.recv_url,e.AjaxObject),n=0;t.onmessage=function(t){n+=1,e.ri._didMessage(t.data)},t.onclose=function(n){e.poll=t=t.onmessage=t.onclose=null,e.poll_is_closing||("permanent"===n.reason?e.ri._didClose(1006,"Polling error ("+n.reason+")"):e._scheduleRecv())}},Z.prototype.abort=function(){var e=this;e.poll_is_closing=!0,e.poll&&e.poll.abort()};var et=function(e){var t=this,r=new EventSource(e);r.onmessage=function(e){t.dispatchEvent(new o("message",{data:unescape(e.data)}))},t.es_close=r.onerror=function(e,i){var a=i?"user":2!==r.readyState?"network":"permanent";t.es_close=r.onmessage=r.onerror=null,r.close(),r=null,n.delay(200,function(){t.dispatchEvent(new o("close",{reason:a}))})}};et.prototype=new r,et.prototype.abort=function(){var e=this;e.es_close&&e.es_close({},!0)};var tt,nt=function(){if(void 0===tt)if("ActiveXObject"in t)try{tt=!!new ActiveXObject("htmlfile")}catch(e){}else tt=!1;return tt},rt=function(e){var r=this;n.polluteGlobalNamespace(),r.id="a"+n.random_string(6,26),e+=(-1===e.indexOf("?")?"?":"&")+"c="+escape(u+"."+r.id);var i=nt()?n.createHtmlfile:n.createIframe,a;t[u][r.id]={start:function(){a.loaded()},message:function(e){r.dispatchEvent(new o("message",{data:e}))},stop:function(){r.iframe_close({},"network")}},r.iframe_close=function(e,n){a.cleanup(),r.iframe_close=a=null,delete t[u][r.id],r.dispatchEvent(new o("close",{reason:n}))},a=i(e,function(e){r.iframe_close({},"permanent")})};rt.prototype=new r,rt.prototype.abort=function(){var e=this;e.iframe_close&&e.iframe_close({},"user")};var ot=function(e,t){var n=this,r=0;n.xo=new t("POST",e,null),n.xo.onchunk=function(e,t){if(200===e)for(;;){var i=t.slice(r),a=i.indexOf("\n");if(-1===a)break;r+=a+1;var s=i.slice(0,a);n.dispatchEvent(new o("message",{data:s}))}},n.xo.onfinish=function(e,t){n.xo.onchunk(e,t),n.xo=null;var r=200===e?"network":"permanent";n.dispatchEvent(new o("close",{reason:r}))}};return ot.prototype=new r,ot.prototype.abort=function(){var e=this;e.xo&&(e.xo.close(),e.dispatchEvent(new o("close",{reason:"user"})),e.xo=null)},T.getUtils=function(){return n},T.getIframeTransport=function(){return B},T}(),"_sockjs_onload"in window&&setTimeout(_sockjs_onload,1),"function"==typeof define&&define.amd&&define("sockjs",[],function(){return h})}.call(this),function(){p.ClientStream=function(e,t){var n=this;n.options=a.extend({retry:!0},t),n._initCommon(n.options),n.HEARTBEAT_TIMEOUT=1e5,n.rawUrl=e,n.socket=null,n.heartbeatTimer=null,"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("online",a.bind(n._online,n),!1),n._launchConnection()},a.extend(p.ClientStream.prototype,{send:function(e){var t=this;t.currentStatus.connected&&t.socket.send(e)},_changeUrl:function(e){var t=this;t.rawUrl=e},_connected:function(){var e=this;e.connectionTimer&&(clearTimeout(e.connectionTimer),e.connectionTimer=null),e.currentStatus.connected||(e.currentStatus.status="connected",e.currentStatus.connected=!0,e.currentStatus.retryCount=0,e.statusChanged(),a.each(e.eventCallbacks.reset,function(e){e()}))},_cleanup:function(e){var t=this;t._clearConnectionAndHeartbeatTimers(),t.socket&&(t.socket.onmessage=t.socket.onclose=t.socket.onerror=t.socket.onheartbeat=function(){},t.socket.close(),t.socket=null),a.each(t.eventCallbacks.disconnect,function(t){t(e)})},_clearConnectionAndHeartbeatTimers:function(){var e=this;e.connectionTimer&&(clearTimeout(e.connectionTimer),e.connectionTimer=null),e.heartbeatTimer&&(clearTimeout(e.heartbeatTimer),e.heartbeatTimer=null)},_heartbeat_timeout:function(){var t=this;e._debug("Connection timeout. No sockjs heartbeat received."),t._lostConnection(new _.ConnectionError("Heartbeat timed out"))},_heartbeat_received:function(){var e=this;e._forcedToDisconnect||(e.heartbeatTimer&&clearTimeout(e.heartbeatTimer),e.heartbeatTimer=setTimeout(a.bind(e._heartbeat_timeout,e),e.HEARTBEAT_TIMEOUT))},_sockjsProtocolsWhitelist:function(){var e=["xdr-polling","xhr-polling","iframe-xhr-polling","jsonp-polling"],t=navigator&&/iPhone|iPad|iPod/.test(navigator.userAgent)&&/OS 4_|OS 5_/.test(navigator.userAgent); +return t||(e=["websocket"].concat(e)),e},_launchConnection:function(){var t=this;t._cleanup();var n=a.extend({protocols_whitelist:t._sockjsProtocolsWhitelist()},t.options._sockjsOptions);t.socket=new h(v(t.rawUrl),void 0,n),t.socket.onopen=function(e){t._connected()},t.socket.onmessage=function(e){t._heartbeat_received(),t.currentStatus.connected&&a.each(t.eventCallbacks.message,function(t){t(e.data)})},t.socket.onclose=function(){t._lostConnection()},t.socket.onerror=function(){e._debug("stream error",a.toArray(arguments),(new Date).toDateString())},t.socket.onheartbeat=function(){t._heartbeat_received()},t.connectionTimer&&clearTimeout(t.connectionTimer),t.connectionTimer=setTimeout(function(){t._lostConnection(new _.ConnectionError("DDP connection timed out"))},t.CONNECT_TIMEOUT)}})}.call(this),function(){var t=function(e,t){return e.length>=t.length&&e.substring(0,t.length)===t},n=function(e,t){return e.length>=t.length&&e.substring(e.length-t.length)===t},o=function(o,i,a){i||(i="http");var s=o.match(/^ddp(i?)\+sockjs:\/\//),u=o.match(/^http(s?):\/\//),c;if(s){var l=o.substr(s[0].length);c="i"===s[1]?i:i+"s";var d=l.indexOf("/"),f=-1===d?l:l.substr(0,d),_=-1===d?"":l.substr(d);return f=f.replace(/\*/g,function(){return Math.floor(10*r.fraction())}),c+"://"+f+_}if(u){c=u[1]?i+"s":i;var p=o.substr(u[0].length);o=c+"://"+p}return-1!==o.indexOf("://")||t(o,"/")||(o=i+"://"+o),o=e._relativeToSiteRootUrl(o),n(o,"/")?o+a:o+"/"+a};v=function(e){return o(e,"http","sockjs")},m=function(e){var t=o(e,"ws","websocket");return t},p.toSockjsUrl=v,a.extend(p.ClientStream.prototype,{on:function(e,t){var n=this;if("message"!==e&&"reset"!==e&&"disconnect"!==e)throw new Error("unknown event type: "+e);n.eventCallbacks[e]||(n.eventCallbacks[e]=[]),n.eventCallbacks[e].push(t)},_initCommon:function(e){var t=this;e=e||{},t.CONNECT_TIMEOUT=e.connectTimeoutMs||1e4,t.eventCallbacks={},t._forcedToDisconnect=!1,t.currentStatus={status:"connecting",connected:!1,retryCount:0},t.statusListeners="undefined"!=typeof s&&new s.Dependency,t.statusChanged=function(){t.statusListeners&&t.statusListeners.changed()},t._retry=new l,t.connectionTimer=null},reconnect:function(e){var t=this;return e=e||{},e.url&&t._changeUrl(e.url),e._sockjsOptions&&(t.options._sockjsOptions=e._sockjsOptions),t.currentStatus.connected?void((e._force||e.url)&&t._lostConnection(new _.ForcedReconnectError)):("connecting"===t.currentStatus.status&&t._lostConnection(),t._retry.clear(),t.currentStatus.retryCount-=1,void t._retryNow())},disconnect:function(e){var t=this;e=e||{},t._forcedToDisconnect||(e._permanent&&(t._forcedToDisconnect=!0),t._cleanup(),t._retry.clear(),t.currentStatus={status:e._permanent?"failed":"offline",connected:!1,retryCount:0},e._permanent&&e._error&&(t.currentStatus.reason=e._error),t.statusChanged())},_lostConnection:function(e){var t=this;t._cleanup(e),t._retryLater(e)},_online:function(){"offline"!=this.currentStatus.status&&this.reconnect()},_retryLater:function(e){var t=this,n=0;t.options.retry||e&&"DDP.ForcedReconnectError"===e.errorType?(n=t._retry.retryLater(t.currentStatus.retryCount,a.bind(t._retryNow,t)),t.currentStatus.status="waiting",t.currentStatus.retryTime=(new Date).getTime()+n):(t.currentStatus.status="failed",delete t.currentStatus.retryTime),t.currentStatus.connected=!1,t.statusChanged()},_retryNow:function(){var e=this;e._forcedToDisconnect||(e.currentStatus.retryCount+=1,e.currentStatus.status="connecting",e.currentStatus.connected=!1,delete e.currentStatus.retryTime,e.statusChanged(),e._launchConnection())},status:function(){var e=this;return e.statusListeners&&e.statusListeners.depend(),e.currentStatus}}),_.ConnectionError=e.makeErrorType("DDP.ConnectionError",function(e){var t=this;t.message=e}),_.ForcedReconnectError=e.makeErrorType("DDP.ForcedReconnectError",function(){})}.call(this),function(){g=function(e){var t=this;t.heartbeatInterval=e.heartbeatInterval,t.heartbeatTimeout=e.heartbeatTimeout,t._sendPing=e.sendPing,t._onTimeout=e.onTimeout,t._heartbeatIntervalHandle=null,t._heartbeatTimeoutHandle=null},a.extend(g.prototype,{stop:function(){var e=this;e._clearHeartbeatIntervalTimer(),e._clearHeartbeatTimeoutTimer()},start:function(){var e=this;e.stop(),e._startHeartbeatIntervalTimer()},_startHeartbeatIntervalTimer:function(){var t=this;t._heartbeatIntervalHandle=e.setTimeout(a.bind(t._heartbeatIntervalFired,t),t.heartbeatInterval)},_startHeartbeatTimeoutTimer:function(){var t=this;t._heartbeatTimeoutHandle=e.setTimeout(a.bind(t._heartbeatTimeoutFired,t),t.heartbeatTimeout)},_clearHeartbeatIntervalTimer:function(){var t=this;t._heartbeatIntervalHandle&&(e.clearTimeout(t._heartbeatIntervalHandle),t._heartbeatIntervalHandle=null)},_clearHeartbeatTimeoutTimer:function(){var t=this;t._heartbeatTimeoutHandle&&(e.clearTimeout(t._heartbeatTimeoutHandle),t._heartbeatTimeoutHandle=null)},_heartbeatIntervalFired:function(){var e=this;e._heartbeatIntervalHandle=null,e._sendPing(),e._startHeartbeatTimeoutTimer()},_heartbeatTimeoutFired:function(){var e=this;e._heartbeatTimeoutHandle=null,e._onTimeout()},pingReceived:function(){var e=this;e._heartbeatIntervalHandle&&(e._clearHeartbeatIntervalTimer(),e._startHeartbeatIntervalTimer())},pongReceived:function(){var e=this;e._heartbeatTimeoutHandle&&(e._clearHeartbeatTimeoutTimer(),e._startHeartbeatIntervalTimer())}})}.call(this),function(){b=["1","pre2","pre1"],p.SUPPORTED_DDP_VERSIONS=b,y=function(e){var t=this;this.isSimulation=e.isSimulation,this._unblock=e.unblock||function(){},this._calledUnblock=!1,this.userId=e.userId,this._setUserId=e.setUserId||function(){},this.connection=e.connection,this.randomSeed=e.randomSeed,this.randomStream=null},a.extend(y.prototype,{unblock:function(){var e=this;e._calledUnblock=!0,e._unblock()},setUserId:function(e){var t=this;if(t._calledUnblock)throw new Error("Can't call setUserId in a method after calling unblock");t.userId=e,t._setUserId(e)}}),w=function(t){try{var n=i.parse(t)}catch(r){return e._debug("Discarding message with invalid JSON",t),null}return null===n||"object"!=typeof n?(e._debug("Discarding non-object DDP message",t),null):(a.has(n,"cleared")&&(a.has(n,"fields")||(n.fields={}),a.each(n.cleared,function(e){n.fields[e]=void 0}),delete n.cleared),a.each(["fields","params","result"],function(e){a.has(n,e)&&(n[e]=o._adjustTypesFromJSONValue(n[e]))}),n)},k=function(e){var t=o.clone(e);if(a.has(e,"fields")){var n=[];a.each(e.fields,function(e,r){void 0===e&&(n.push(r),delete t.fields[r])}),a.isEmpty(n)||(t.cleared=n),a.isEmpty(t.fields)&&delete t.fields}if(a.each(["fields","params","result"],function(e){a.has(t,e)&&(t[e]=o._adjustTypesToJSONValue(t[e]))}),e.id&&"string"!=typeof e.id)throw new Error("Message id is not a string");return i.stringify(t)},_._CurrentInvocation=new e.EnvironmentVariable}.call(this),function(){function e(){return r.hexString(20)}S=function(t){var n=this;this.seed=[].concat(t.seed||e()),this.sequences={}},S.get=function(e,t){if(t||(t="default"),!e)return r;var n=e.randomStream;return n||(e.randomStream=n=new S({seed:e.randomSeed})),n._sequence(t)},_.randomStream=function(e){var t=_._CurrentInvocation.get();return S.get(t,e)},C=function(e,t){var n=S.get(e,"/rpc/"+t);return n.hexString(20)},a.extend(S.prototype,{_sequence:function(e){var t=this,n=t.sequences[e]||null;if(null===n){for(var o=t.seed.concat(e),i=0;i<o.length;i++)a.isFunction(o[i])&&(o[i]=o[i]());t.sequences[e]=n=r.createWithSeeds.apply(null,o)}return n}})}.call(this),function(){if(e.isServer)var t=Npm.require("path"),n=Npm.require("fibers"),u=Npm.require(t.join("fibers","future"));var c=function(t,n){var r=this;n=a.extend({onConnected:function(){},onDDPVersionNegotiationFailure:function(t){e._debug(t)},heartbeatInterval:35e3,heartbeatTimeout:15e3,reloadWithOutstanding:!1,supportedDDPVersions:b,retry:!0,respondToPings:!0},n),r.onReconnect=null,r._stream="object"==typeof t?t:new p.ClientStream(t,{retry:n.retry,headers:n.headers,_sockjsOptions:n._sockjsOptions,_dontPrintErrors:n._dontPrintErrors,connectTimeoutMs:n.connectTimeoutMs}),r._lastSessionId=null,r._versionSuggestion=null,r._version=null,r._stores={},r._methodHandlers={},r._nextMethodId=1,r._supportedDDPVersions=n.supportedDDPVersions,r._heartbeatInterval=n.heartbeatInterval,r._heartbeatTimeout=n.heartbeatTimeout,r._methodInvokers={},r._outstandingMethodBlocks=[],r._documentsWrittenByStub={},r._serverDocuments={},r._afterUpdateCallbacks=[],r._messagesBufferedUntilQuiescence=[],r._methodsBlockingQuiescence={},r._subsBeingRevived={},r._resetStores=!1,r._updatesForUnknownStores={},r._retryMigrate=null,r._subscriptions={},r._userId=null,r._userIdDeps=new s.Dependency,e.isClient&&Package.reload&&!n.reloadWithOutstanding&&Package.reload.Reload._onMigrate(function(e){if(r._readyToMigrate())return[!0];if(r._retryMigrate)throw new Error("Two migrations in progress?");return r._retryMigrate=e,!1});var o=function(t){try{var o=w(t)}catch(i){return void e._debug("Exception while parsing DDP",i)}if(null===o||!o.msg)return void(o&&o.server_id||e._debug("discarding invalid livedata message",o));if("connected"===o.msg)r._version=r._versionSuggestion,r._livedata_connected(o),n.onConnected();else if("failed"==o.msg)if(a.contains(r._supportedDDPVersions,o.version))r._versionSuggestion=o.version,r._stream.reconnect({_force:!0});else{var s="DDP version negotiation failed; server requested version "+o.version;r._stream.disconnect({_permanent:!0,_error:s}),n.onDDPVersionNegotiationFailure(s)}else"ping"===o.msg?(n.respondToPings&&r._send({msg:"pong",id:o.id}),r._heartbeat&&r._heartbeat.pingReceived()):"pong"===o.msg?r._heartbeat&&r._heartbeat.pongReceived():a.include(["added","changed","removed","ready","updated"],o.msg)?r._livedata_data(o):"nosub"===o.msg?r._livedata_nosub(o):"result"===o.msg?r._livedata_result(o):"error"===o.msg?r._livedata_error(o):e._debug("discarding unknown livedata message type",o)},i=function(){var e={msg:"connect"};r._lastSessionId&&(e.session=r._lastSessionId),e.version=r._versionSuggestion||r._supportedDDPVersions[0],r._versionSuggestion=e.version,e.support=r._supportedDDPVersions,r._send(e),!a.isEmpty(r._outstandingMethodBlocks)&&a.isEmpty(r._outstandingMethodBlocks[0].methods)&&r._outstandingMethodBlocks.shift(),a.each(r._methodInvokers,function(e){e.sentMessage=!1}),r.onReconnect?r._callOnReconnectAndSendAppropriateOutstandingMethods():r._sendOutstandingMethods(),a.each(r._subscriptions,function(e,t){r._send({msg:"sub",id:t,name:e.name,params:e.params})})},u=function(){r._heartbeat&&(r._heartbeat.stop(),r._heartbeat=null)};e.isServer?(r._stream.on("message",e.bindEnvironment(o,e._debug)),r._stream.on("reset",e.bindEnvironment(i,e._debug)),r._stream.on("disconnect",e.bindEnvironment(u,e._debug))):(r._stream.on("message",o),r._stream.on("reset",i),r._stream.on("disconnect",u))},l=function(e){var t=this;t.methodId=e.methodId,t.sentMessage=!1,t._callback=e.callback,t._connection=e.connection,t._message=e.message,t._onResultReceived=e.onResultReceived||function(){},t._wait=e.wait,t._methodResult=null,t._dataVisible=!1,t._connection._methodInvokers[t.methodId]=t};a.extend(l.prototype,{sendMessage:function(){var e=this;if(e.gotResult())throw new Error("sendingMethod is called on method with result");e._dataVisible=!1,e.sentMessage=!0,e._wait&&(e._connection._methodsBlockingQuiescence[e.methodId]=!0),e._connection._send(e._message)},_maybeInvokeCallback:function(){var e=this;e._methodResult&&e._dataVisible&&(e._callback(e._methodResult[0],e._methodResult[1]),delete e._connection._methodInvokers[e.methodId],e._connection._outstandingMethodFinished())},receiveResult:function(e,t){var n=this;if(n.gotResult())throw new Error("Methods should only receive results once");n._methodResult=[e,t],n._onResultReceived(e,t),n._maybeInvokeCallback()},dataVisible:function(){var e=this;e._dataVisible=!0,e._maybeInvokeCallback()},gotResult:function(){var e=this;return!!e._methodResult}}),a.extend(c.prototype,{registerStore:function(e,t){var n=this;if(e in n._stores)return!1;var r={};a.each(["update","beginUpdate","endUpdate","saveOriginals","retrieveOriginals"],function(e){r[e]=function(){return t[e]?t[e].apply(t,arguments):void 0}}),n._stores[e]=r;var o=n._updatesForUnknownStores[e];return o&&(r.beginUpdate(o.length,!1),a.each(o,function(e){r.update(e)}),r.endUpdate(),delete n._updatesForUnknownStores[e]),!0},subscribe:function(e){var t=this,n=Array.prototype.slice.call(arguments,1),i={};if(n.length){var u=n[n.length-1];"function"==typeof u?i.onReady=n.pop():!u||"function"!=typeof u.onReady&&"function"!=typeof u.onError||(i=n.pop())}var c=a.find(t._subscriptions,function(t){return t.inactive&&t.name===e&&o.equals(t.params,n)}),l;c?(l=c.id,c.inactive=!1,i.onReady&&(c.ready||(c.readyCallback=i.onReady)),i.onError&&(c.errorCallback=i.onError)):(l=r.id(),t._subscriptions[l]={id:l,name:e,params:o.clone(n),inactive:!1,ready:!1,readyDeps:new s.Dependency,readyCallback:i.onReady,errorCallback:i.onError,connection:t,remove:function(){delete this.connection._subscriptions[this.id],this.ready&&this.readyDeps.changed()},stop:function(){this.connection._send({msg:"unsub",id:l}),this.remove()}},t._send({msg:"sub",id:l,name:e,params:n}));var d={stop:function(){a.has(t._subscriptions,l)&&t._subscriptions[l].stop()},ready:function(){if(!a.has(t._subscriptions,l))return!1;var e=t._subscriptions[l];return e.readyDeps.depend(),e.ready}};return s.active&&s.onInvalidate(function(e){a.has(t._subscriptions,l)&&(t._subscriptions[l].inactive=!0),s.afterFlush(function(){a.has(t._subscriptions,l)&&t._subscriptions[l].inactive&&d.stop()})}),d},_subscribeAndWait:function(e,t,n){var r=this,o=new u,i=!1,a;return t=t||[],t.push({onReady:function(){i=!0,o["return"]()},onError:function(e){i?n&&n.onLateError&&n.onLateError(e):o["throw"](e)}}),a=r.subscribe.apply(r,[e].concat(t)),o.wait(),a},methods:function(e){var t=this;a.each(e,function(e,n){if(t._methodHandlers[n])throw new Error("A method named '"+n+"' is already defined");t._methodHandlers[n]=e})},call:function(e){var t=Array.prototype.slice.call(arguments,1);if(t.length&&"function"==typeof t[t.length-1])var n=t.pop();return this.apply(e,t,n)},apply:function(t,n,r,i){var s=this;i||"function"!=typeof r||(i=r,r={}),r=r||{},i&&(i=e.bindEnvironment(i,"delivering result of invoking '"+t+"'")),n=o.clone(n);var c=function(){var e;return function(){return void 0===e&&(e=""+s._nextMethodId++),e}}(),d=_._CurrentInvocation.get(),f=d&&d.isSimulation,p=null,h=function(){return null===p&&(p=C(d,t)),p},v=s._methodHandlers[t];if(v){var m=function(e){s.setUserId(e)},g=new y({isSimulation:!0,userId:s.userId(),setUserId:m,randomSeed:function(){return h()}});f||s._saveOriginals();try{var b=_._CurrentInvocation.withValue(g,function(){return e.isServer?e._noYieldsAllowed(function(){return v.apply(g,o.clone(n))}):v.apply(g,o.clone(n))})}catch(w){var k=w}f||s._retrieveAndStoreOriginals(c())}if(f){if(i)return void i(k,b);if(k)throw k;return b}if(k&&!k.expected&&e._debug("Exception while simulating the effect of invoking '"+t+"'",k,k.stack),!i)if(e.isClient)i=function(n){n&&e._debug("Error invoking Method '"+t+"':",n.message)};else{var S=new u;i=S.resolver()}var T={msg:"method",method:t,params:n,id:c()};null!==p&&(T.randomSeed=p);var E=new l({methodId:c(),callback:i,connection:s,onResultReceived:r.onResultReceived,wait:!!r.wait,message:T});return r.wait?s._outstandingMethodBlocks.push({wait:!0,methods:[E]}):((a.isEmpty(s._outstandingMethodBlocks)||a.last(s._outstandingMethodBlocks).wait)&&s._outstandingMethodBlocks.push({wait:!1,methods:[]}),a.last(s._outstandingMethodBlocks).methods.push(E)),1===s._outstandingMethodBlocks.length&&E.sendMessage(),S?S.wait():r.returnStubValue?b:void 0},_saveOriginals:function(){var e=this;a.each(e._stores,function(e){e.saveOriginals()})},_retrieveAndStoreOriginals:function(e){var t=this;if(t._documentsWrittenByStub[e])throw new Error("Duplicate methodId in _retrieveAndStoreOriginals");var n=[];a.each(t._stores,function(r,o){var i=r.retrieveOriginals();i&&i.forEach(function(r,i){n.push({collection:o,id:i}),a.has(t._serverDocuments,o)||(t._serverDocuments[o]=new d._IdMap);var s=t._serverDocuments[o].setDefault(i,{});s.writtenByStubs?s.writtenByStubs[e]=!0:(s.document=r,s.flushCallbacks=[],s.writtenByStubs={},s.writtenByStubs[e]=!0)})}),a.isEmpty(n)||(t._documentsWrittenByStub[e]=n)},_unsubscribeAll:function(){var e=this;a.each(a.clone(e._subscriptions),function(t,n){"meteor_autoupdate_clientVersions"!==t.name&&e._subscriptions[n].stop()})},_send:function(e){var t=this;t._stream.send(k(e))},_lostConnection:function(e){var t=this;t._stream._lostConnection(e)},status:function(){var e=this;return e._stream.status.apply(e._stream,arguments)},reconnect:function(){var e=this;return e._stream.reconnect.apply(e._stream,arguments)},disconnect:function(){var e=this;return e._stream.disconnect.apply(e._stream,arguments)},close:function(){var e=this;return e._stream.disconnect({_permanent:!0})},userId:function(){var e=this;return e._userIdDeps&&e._userIdDeps.depend(),e._userId},setUserId:function(e){var t=this;t._userId!==e&&(t._userId=e,t._userIdDeps&&t._userIdDeps.changed())},_waitingForQuiescence:function(){var e=this;return!a.isEmpty(e._subsBeingRevived)||!a.isEmpty(e._methodsBlockingQuiescence)},_anyMethodsAreOutstanding:function(){var e=this;return a.any(a.pluck(e._methodInvokers,"sentMessage"))},_livedata_connected:function(e){var t=this;if("pre1"!==t._version&&0!==t._heartbeatInterval&&(t._heartbeat=new g({heartbeatInterval:t._heartbeatInterval,heartbeatTimeout:t._heartbeatTimeout,onTimeout:function(){t._lostConnection(new _.ConnectionError("DDP heartbeat timed out"))},sendPing:function(){t._send({msg:"ping"})}}),t._heartbeat.start()),t._lastSessionId&&(t._resetStores=!0),"string"==typeof e.session){var n=t._lastSessionId===e.session;t._lastSessionId=e.session}n||(t._updatesForUnknownStores={},t._resetStores&&(t._documentsWrittenByStub={},t._serverDocuments={}),t._afterUpdateCallbacks=[],t._subsBeingRevived={},a.each(t._subscriptions,function(e,n){e.ready&&(t._subsBeingRevived[n]=!0)}),t._methodsBlockingQuiescence={},t._resetStores&&a.each(t._methodInvokers,function(e){e.gotResult()?t._afterUpdateCallbacks.push(a.bind(e.dataVisible,e)):e.sentMessage&&(t._methodsBlockingQuiescence[e.methodId]=!0)}),t._messagesBufferedUntilQuiescence=[],t._waitingForQuiescence()||(t._resetStores&&(a.each(t._stores,function(e){e.beginUpdate(0,!0),e.endUpdate()}),t._resetStores=!1),t._runAfterUpdateCallbacks()))},_processOneDataMessage:function(e,t){var n=this;n["_process_"+e.msg](e,t)},_livedata_data:function(e){var t=this,n={};if(t._waitingForQuiescence()){if(t._messagesBufferedUntilQuiescence.push(e),"nosub"===e.msg&&delete t._subsBeingRevived[e.id],a.each(e.subs||[],function(e){delete t._subsBeingRevived[e]}),a.each(e.methods||[],function(e){delete t._methodsBlockingQuiescence[e]}),t._waitingForQuiescence())return;a.each(t._messagesBufferedUntilQuiescence,function(e){t._processOneDataMessage(e,n)}),t._messagesBufferedUntilQuiescence=[]}else t._processOneDataMessage(e,n);(t._resetStores||!a.isEmpty(n))&&(a.each(t._stores,function(e,r){e.beginUpdate(a.has(n,r)?n[r].length:0,t._resetStores)}),t._resetStores=!1,a.each(n,function(e,n){var r=t._stores[n];r?a.each(e,function(e){r.update(e)}):(a.has(t._updatesForUnknownStores,n)||(t._updatesForUnknownStores[n]=[]),Array.prototype.push.apply(t._updatesForUnknownStores[n],e))}),a.each(t._stores,function(e){e.endUpdate()})),t._runAfterUpdateCallbacks()},_runAfterUpdateCallbacks:function(){var e=this,t=e._afterUpdateCallbacks;e._afterUpdateCallbacks=[],a.each(t,function(e){e()})},_pushUpdate:function(e,t,n){var r=this;a.has(e,t)||(e[t]=[]),e[t].push(n)},_getServerDoc:function(e,t){var n=this;if(!a.has(n._serverDocuments,e))return null;var r=n._serverDocuments[e];return r.get(t)||null},_process_added:function(e,t){var n=this,r=d._idParse(e.id),o=n._getServerDoc(e.collection,r);if(o){if(void 0!==o.document)throw new Error("Server sent add for existing id: "+e.id);o.document=e.fields||{},o.document._id=r}else n._pushUpdate(t,e.collection,e)},_process_changed:function(e,t){var n=this,r=n._getServerDoc(e.collection,d._idParse(e.id));if(r){if(void 0===r.document)throw new Error("Server sent changed for nonexisting id: "+e.id);d._applyChanges(r.document,e.fields)}else n._pushUpdate(t,e.collection,e)},_process_removed:function(e,t){var n=this,r=n._getServerDoc(e.collection,d._idParse(e.id));if(r){if(void 0===r.document)throw new Error("Server sent removed for nonexisting id:"+e.id);r.document=void 0}else n._pushUpdate(t,e.collection,{msg:"removed",collection:e.collection,id:e.id})},_process_updated:function(e,t){var n=this;a.each(e.methods,function(e){a.each(n._documentsWrittenByStub[e],function(r){var o=n._getServerDoc(r.collection,r.id);if(!o)throw new Error("Lost serverDoc for "+i.stringify(r));if(!o.writtenByStubs[e])throw new Error("Doc "+i.stringify(r)+" not written by method "+e);delete o.writtenByStubs[e],a.isEmpty(o.writtenByStubs)&&(n._pushUpdate(t,r.collection,{msg:"replace",id:d._idStringify(r.id),replace:o.document}),a.each(o.flushCallbacks,function(e){e()}),n._serverDocuments[r.collection].remove(r.id))}),delete n._documentsWrittenByStub[e];var r=n._methodInvokers[e];if(!r)throw new Error("No callback invoker for method "+e);n._runWhenAllServerDocsAreFlushed(a.bind(r.dataVisible,r))})},_process_ready:function(e,t){var n=this;a.each(e.subs,function(e){n._runWhenAllServerDocsAreFlushed(function(){var t=n._subscriptions[e];t&&(t.ready||(t.readyCallback&&t.readyCallback(),t.ready=!0,t.readyDeps.changed()))})})},_runWhenAllServerDocsAreFlushed:function(e){var t=this,n=function(){t._afterUpdateCallbacks.push(e)},r=0,o=function(){--r,0===r&&n()};a.each(t._serverDocuments,function(e){e.forEach(function(e){var n=a.any(e.writtenByStubs,function(e,n){var r=t._methodInvokers[n];return r&&r.sentMessage});n&&(++r,e.flushCallbacks.push(o))})}),0===r&&n()},_livedata_nosub:function(t){var n=this;if(n._livedata_data(t),a.has(n._subscriptions,t.id)){var r=n._subscriptions[t.id].errorCallback;n._subscriptions[t.id].remove(),r&&t.error&&r(new e.Error(t.error.error,t.error.reason,t.error.details))}},_process_nosub:function(){},_livedata_result:function(t){var n=this;if(a.isEmpty(n._outstandingMethodBlocks))return void e._debug("Received method result but no methods outstanding");for(var r=n._outstandingMethodBlocks[0].methods,o,i=0;i<r.length&&(o=r[i],o.methodId!==t.id);i++);return o?(r.splice(i,1),void(a.has(t,"error")?o.receiveResult(new e.Error(t.error.error,t.error.reason,t.error.details)):o.receiveResult(void 0,t.result))):void e._debug("Can't match method response to original method call",t)},_outstandingMethodFinished:function(){var e=this;if(!e._anyMethodsAreOutstanding()){if(!a.isEmpty(e._outstandingMethodBlocks)){var t=e._outstandingMethodBlocks.shift();if(!a.isEmpty(t.methods))throw new Error("No methods outstanding but nonempty block: "+i.stringify(t));a.isEmpty(e._outstandingMethodBlocks)||e._sendOutstandingMethods()}e._maybeMigrate()}},_sendOutstandingMethods:function(){var e=this;a.isEmpty(e._outstandingMethodBlocks)||a.each(e._outstandingMethodBlocks[0].methods,function(e){e.sendMessage()})},_livedata_error:function(t){e._debug("Received error from server: ",t.reason),t.offendingMessage&&e._debug("For: ",t.offendingMessage)},_callOnReconnectAndSendAppropriateOutstandingMethods:function(){var e=this,t=e._outstandingMethodBlocks;if(e._outstandingMethodBlocks=[],e.onReconnect(),!a.isEmpty(t)){if(a.isEmpty(e._outstandingMethodBlocks))return e._outstandingMethodBlocks=t,void e._sendOutstandingMethods();a.last(e._outstandingMethodBlocks).wait||t[0].wait||(a.each(t[0].methods,function(t){a.last(e._outstandingMethodBlocks).methods.push(t),1===e._outstandingMethodBlocks.length&&t.sendMessage()}),t.shift()),a.each(t,function(t){e._outstandingMethodBlocks.push(t)})}},_readyToMigrate:function(){var e=this;return a.isEmpty(e._methodInvokers)},_maybeMigrate:function(){var e=this;e._retryMigrate&&e._readyToMigrate()&&(e._retryMigrate(),e._retryMigrate=null)}}),p.Connection=c,_.connect=function(e,t){var n=new c(e,t);return T.push(n),n},T=[],_._allSubscriptionsReady=function(){return a.all(T,function(e){return a.all(e._subscriptions,function(e){return e.ready})})}}.call(this),function(){if(e.refresh=function(e){},e.isClient){var t="/";"undefined"!=typeof __meteor_runtime_config__&&__meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL&&(t=__meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL);var n=new l,r=function(t){if(e._debug(t),Package.reload){var r=Package.reload.Reload._migrationData("livedata")||{},o=r.DDPVersionNegotiationFailures||0;++o,Package.reload.Reload._onMigrate("livedata",function(){return[!0,{DDPVersionNegotiationFailures:o}]}),n.retryLater(o,function(){Package.reload.Reload._reload()})}};e.connection=_.connect(t,{onDDPVersionNegotiationFailure:r}),a.each(["subscribe","methods","call","apply","status","reconnect","disconnect"],function(t){e[t]=a.bind(e.connection[t],e.connection)})}else e.connection=null;e.default_connection=e.connection,e.connect=_.connect}.call(this),"undefined"==typeof Package&&(Package={}),Package.ddp={DDP:_,LivedataTest:p}}(); + +!function(){var e=Package.meteor.Meteor,a=Package.logging.Log,g=Package.underscore._,o=Package.ddp.DDP,c=Package.ejson.EJSON,P;"undefined"==typeof Package&&(Package={}),Package["follower-livedata"]={Follower:P}}(); + +!function(){var a=Package.meteor.Meteor,e=Package.logging.Log,o=Package.underscore._,g=Package.ddp.DDP,c=Package.ejson.EJSON,n=Package["follower-livedata"].Follower;"undefined"==typeof Package&&(Package={}),Package["application-configuration"]={}}(); + +!function(){var e=Package.meteor.Meteor,n=Package.random.Random,o=Package.ejson.EJSON,t=Package.json.JSON,r=Package.underscore._,i=Package.minimongo.LocalCollection,c=Package.minimongo.Minimongo,l=Package.logging.Log,a=Package.ddp.DDP,s=Package.tracker.Tracker,d=Package.tracker.Deps,u=Package.check.check,f=Package.check.Match,_,p;(function(){p=function(){var e=this;e.noConnCollections={}};var e=function(e,n){return e in n||(n[e]=new i(e)),n[e]};r.extend(p.prototype,{open:function(n,o){var t=this;return n?o?(o._mongo_livedata_collections||(o._mongo_livedata_collections={}),e(n,o._mongo_livedata_collections)):e(n,t.noConnCollections):new i}}),p=new p}).call(this),function(){_={},_.Collection=function(o,t){var c=this;if(!(c instanceof _.Collection))throw new Error('use "new" to construct a Mongo.Collection');if(o||null===o||(e._debug("Warning: creating anonymous collection. It will not be saved or synchronized over the network. (Pass null for the collection name to turn off this warning.)"),o=null),null!==o&&"string"!=typeof o)throw new Error("First argument to new Mongo.Collection must be a string or null");switch(t&&t.methods&&(t={connection:t}),t&&t.manager&&!t.connection&&(t.connection=t.manager),t=r.extend({connection:void 0,idGeneration:"STRING",transform:null,_driver:void 0,_preventAutopublish:!1},t),t.idGeneration){case"MONGO":c._makeNewID=function(){var e=o?a.randomStream("/collection/"+o):n;return new _.ObjectID(e.hexString(24))};break;case"STRING":default:c._makeNewID=function(){var e=o?a.randomStream("/collection/"+o):n;return e.id()}}if(c._transform=i.wrapTransform(t.transform),c._connection=o&&null!==t.connection?t.connection?t.connection:e.isClient?e.connection:e.server:null,t._driver||(t._driver=o&&c._connection===e.server&&"undefined"!=typeof MongoInternals&&MongoInternals.defaultRemoteCollectionDriver?MongoInternals.defaultRemoteCollectionDriver():p),c._collection=t._driver.open(o,c._connection),c._name=o,c._connection&&c._connection.registerStore){var l=c._connection.registerStore(o,{beginUpdate:function(e,n){(e>1||n)&&c._collection.pauseObservers(),n&&c._collection.remove({})},update:function(e){var n=i._idParse(e.id),o=c._collection.findOne(n);if("replace"===e.msg){var t=e.replace;return void(t?o?c._collection.update(n,t):c._collection.insert(t):o&&c._collection.remove(n))}if("added"===e.msg){if(o)throw new Error("Expected not to find a document already present for an add");c._collection.insert(r.extend({_id:n},e.fields))}else if("removed"===e.msg){if(!o)throw new Error("Expected to find a document already present for removed");c._collection.remove(n)}else{if("changed"!==e.msg)throw new Error("I don't know how to deal with this message");if(!o)throw new Error("Expected to find a document to change");if(!r.isEmpty(e.fields)){var l={};r.each(e.fields,function(e,n){void 0===e?(l.$unset||(l.$unset={}),l.$unset[n]=1):(l.$set||(l.$set={}),l.$set[n]=e)}),c._collection.update(n,l)}}},endUpdate:function(){c._collection.resumeObservers()},saveOriginals:function(){c._collection.saveOriginals()},retrieveOriginals:function(){return c._collection.retrieveOriginals()}});if(!l)throw new Error("There is already a collection named '"+o+"'")}c._defineMutationMethods(),Package.autopublish&&!t._preventAutopublish&&c._connection&&c._connection.publish&&c._connection.publish(null,function(){return c.find()},{is_auto:!0})},r.extend(_.Collection.prototype,{_getFindSelector:function(e){return 0==e.length?{}:e[0]},_getFindOptions:function(e){var n=this;return e.length<2?{transform:n._transform}:(u(e[1],f.Optional(f.ObjectIncluding({fields:f.Optional(f.OneOf(Object,void 0)),sort:f.Optional(f.OneOf(Object,Array,void 0)),limit:f.Optional(f.OneOf(Number,void 0)),skip:f.Optional(f.OneOf(Number,void 0))}))),r.extend({transform:n._transform},e[1]))},find:function(){var e=this,n=r.toArray(arguments);return e._collection.find(e._getFindSelector(n),e._getFindOptions(n))},findOne:function(){var e=this,n=r.toArray(arguments);return e._collection.findOne(e._getFindSelector(n),e._getFindOptions(n))}}),_.Collection._publishCursor=function(e,n,o){var t=e.observeChanges({added:function(e,t){n.added(o,e,t)},changed:function(e,t){n.changed(o,e,t)},removed:function(e){n.removed(o,e)}});n.onStop(function(){t.stop()})},_.Collection._rewriteSelector=function(e){if(i._selectorIsId(e)&&(e={_id:e}),!e||"_id"in e&&!e._id)return{_id:n.id()};var o={};return r.each(e,function(e,n){e instanceof RegExp?o[n]=t(e):e&&e.$regex instanceof RegExp?(o[n]=t(e.$regex),void 0!==e.$options&&(o[n].$options=e.$options)):o[n]=r.contains(["$or","$and","$nor"],n)?r.map(e,function(e){return _.Collection._rewriteSelector(e)}):e}),o};var t=function(e){u(e,RegExp);var n={$regex:e.source},o="";return e.ignoreCase&&(o+="i"),e.multiline&&(o+="m"),o&&(n.$options=o),n},c=function(n,o){if(!i._selectorIsIdPerhapsAsObject(n))throw new e.Error(403,"Not permitted. Untrusted code may only "+o+" documents by ID.")};r.each(["insert","update","remove"],function(n){_.Collection.prototype[n]=function(){var o=this,t=r.toArray(arguments),i,l,s;if(t.length&&(void 0===t[t.length-1]||t[t.length-1]instanceof Function)&&(i=t.pop()),"insert"===n){if(!t.length)throw new Error("insert requires an argument");if(t[0]=r.extend({},t[0]),"_id"in t[0]){if(l=t[0]._id,!l||!("string"==typeof l||l instanceof _.ObjectID))throw new Error("Meteor requires document _id fields to be non-empty strings or ObjectIDs")}else{var d=!0;if(o._connection&&o._connection!==e.server){var u=a._CurrentInvocation.get();u||(d=!1)}d&&(l=t[0]._id=o._makeNewID())}}else if(t[0]=_.Collection._rewriteSelector(t[0]),"update"===n){var f=t[2]=r.clone(t[2])||{};if(f&&"function"!=typeof f&&f.upsert)if(f.insertedId){if(!("string"==typeof f.insertedId||f.insertedId instanceof _.ObjectID))throw new Error("insertedId must be string or ObjectID")}else f.insertedId=o._makeNewID()}var p=function(e){return"insert"===n?(!l&&e&&(l=e),l):e},h;if(i&&(h=function(e,n){i(e,!e&&p(n))}),o._connection&&o._connection!==e.server){var u=a._CurrentInvocation.get(),v=u&&u.isSimulation;!e.isClient||h||v||(h=function(o){o&&e._debug(n+" failed: "+(o.reason||o.stack))}),v||"insert"===n||c(t[0],n),s=p(o._connection.apply(o._prefix+n,t,{returnStubValue:!0},h))}else{t.push(h);try{var m=o._collection[n].apply(o._collection,t);s=p(m)}catch(g){if(i)return i(g),null;throw g}}return s}}),_.Collection.prototype.upsert=function(e,n,o,t){var i=this;return t||"function"!=typeof o||(t=o,o={}),i.update(e,n,r.extend({},o,{_returnObject:!0,upsert:!0}),t)},_.Collection.prototype._ensureIndex=function(e,n){var o=this;if(!o._collection._ensureIndex)throw new Error("Can only call _ensureIndex on server collections");o._collection._ensureIndex(e,n)},_.Collection.prototype._dropIndex=function(e){var n=this;if(!n._collection._dropIndex)throw new Error("Can only call _dropIndex on server collections");n._collection._dropIndex(e)},_.Collection.prototype._dropCollection=function(){var e=this;if(!e._collection.dropCollection)throw new Error("Can only call _dropCollection on server collections");e._collection.dropCollection()},_.Collection.prototype._createCappedCollection=function(e,n){var o=this;if(!o._collection._createCappedCollection)throw new Error("Can only call _createCappedCollection on server collections");o._collection._createCappedCollection(e,n)},_.ObjectID=i._ObjectID,_.Cursor=i.Cursor,_.Collection.Cursor=_.Cursor,_.Collection.ObjectID=_.ObjectID,function(){var e=function(e,n){var o=["insert","update","remove","fetch","transform"];r.each(r.keys(n),function(n){if(!r.contains(o,n))throw new Error(e+": Invalid key: "+n)});var t=this;if(t._restricted=!0,r.each(["insert","update","remove"],function(o){if(n[o]){if(!(n[o]instanceof Function))throw new Error(e+": Value for `"+o+"` must be a function");n[o].transform=void 0===n.transform?t._transform:i.wrapTransform(n.transform),t._validators[o][e].push(n[o])}}),n.update||n.remove||n.fetch){if(n.fetch&&!(n.fetch instanceof Array))throw new Error(e+": Value for `fetch` must be an array");t._updateFetch(n.fetch)}};_.Collection.prototype.allow=function(n){e.call(this,"allow",n)},_.Collection.prototype.deny=function(n){e.call(this,"deny",n)}}(),_.Collection.prototype._defineMutationMethods=function(){var n=this;if(n._restricted=!1,n._insecure=void 0,n._validators={insert:{allow:[],deny:[]},update:{allow:[],deny:[]},remove:{allow:[],deny:[]},upsert:{allow:[],deny:[]},fetch:[],fetchAllFields:!1},n._name&&(n._prefix="/"+n._name+"/",n._connection)){var o={};r.each(["insert","update","remove"],function(t){o[n._prefix+t]=function(){u(arguments,[f.Any]);var o=r.toArray(arguments);try{var i=null;if("insert"!==t||r.has(o[0],"_id")||(i=n._makeNewID()),this.isSimulation)return null!==i&&(o[0]._id=i),n._collection[t].apply(n._collection,o);if("insert"!==t&&c(o[0],t),n._restricted){if(0===n._validators[t].allow.length)throw new e.Error(403,"Access denied. No allow validators set on restricted collection for method '"+t+"'.");var l="_validated"+t.charAt(0).toUpperCase()+t.slice(1);return o.unshift(this.userId),"insert"===t&&o.push(i),n[l].apply(n,o)}if(n._isInsecure())return null!==i&&(o[0]._id=i),n._collection[t].apply(n._collection,o);throw new e.Error(403,"Access denied")}catch(a){throw"MongoError"===a.name||"MinimongoError"===a.name?new e.Error(409,a.toString()):a}}}),(e.isClient||n._connection===e.server)&&n._connection.methods(o)}},_.Collection.prototype._updateFetch=function(e){var n=this;n._validators.fetchAllFields||(e?n._validators.fetch=r.union(n._validators.fetch,e):(n._validators.fetchAllFields=!0,n._validators.fetch=null))},_.Collection.prototype._isInsecure=function(){var e=this;return void 0===e._insecure?!!Package.insecure:e._insecure};var l=function(e,n,t){var r=n;return e.transform&&(r=o.clone(n),null!==t&&(r._id=t),r=e.transform(r)),r};_.Collection.prototype._validatedInsert=function(n,o,t){var i=this;if(r.any(i._validators.insert.deny,function(e){return e(n,l(e,o,t))}))throw new e.Error(403,"Access denied");if(r.all(i._validators.insert.allow,function(e){return!e(n,l(e,o,t))}))throw new e.Error(403,"Access denied");null!==t&&(o._id=t),i._collection.insert.call(i._collection,o)};var s=function(e,n){return e.transform?e.transform(n):n};_.Collection.prototype._validatedUpdate=function(n,o,t,c){var l=this;if(u(t,Object),c=r.clone(c)||{},!i._selectorIsIdPerhapsAsObject(o))throw new Error("validated update should be of a single ID");if(c.upsert)throw new e.Error(403,"Access denied. Upserts not allowed in a restricted collection.");var a="Access denied. In a restricted collection you can only update documents, not replace them. Use a Mongo update operator, such as '$set'.",f=[];if(r.isEmpty(t))throw new e.Error(403,a);r.each(t,function(n,o){if("$"!==o.charAt(0))throw new e.Error(403,a);if(!r.has(d,o))throw new e.Error(403,"Access denied. Operator "+o+" not allowed in a restricted collection.");r.each(r.keys(n),function(e){-1!==e.indexOf(".")&&(e=e.substring(0,e.indexOf("."))),r.contains(f,e)||f.push(e)})});var _={transform:null};l._validators.fetchAllFields||(_.fields={},r.each(l._validators.fetch,function(e){_.fields[e]=1}));var p=l._collection.findOne(o,_);if(!p)return 0;var h;if(r.any(l._validators.update.deny,function(e){return h||(h=s(e,p)),e(n,h,f,t)}))throw new e.Error(403,"Access denied");if(r.all(l._validators.update.allow,function(e){return h||(h=s(e,p)),!e(n,h,f,t)}))throw new e.Error(403,"Access denied");return c._forbidReplace=!0,l._collection.update.call(l._collection,o,t,c)};var d={$inc:1,$set:1,$unset:1,$addToSet:1,$pop:1,$pullAll:1,$pull:1,$pushAll:1,$push:1,$bit:1};_.Collection.prototype._validatedRemove=function(n,o){var t=this,i={transform:null};t._validators.fetchAllFields||(i.fields={},r.each(t._validators.fetch,function(e){i.fields[e]=1}));var c=t._collection.findOne(o,i);if(!c)return 0;if(r.any(t._validators.remove.deny,function(e){return e(n,s(e,c))}))throw new e.Error(403,"Access denied");if(r.all(t._validators.remove.allow,function(e){return!e(n,s(e,c))}))throw new e.Error(403,"Access denied");return t._collection.remove.call(t._collection,o)},e.Collection=_.Collection}.call(this),"undefined"==typeof Package&&(Package={}),Package.mongo={Mongo:_}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.tracker.Tracker,n=Package.tracker.Deps,a=Package.retry.Retry,r=Package.ddp.DDP,o=Package.mongo.Mongo,i=Package.underscore._,s,c;(function(){var t=__meteor_runtime_config__.autoupdateVersion||"unknown",n=__meteor_runtime_config__.autoupdateVersionRefreshable||"unknown";c=new o.Collection("meteor_autoupdate_clientVersions"),s={},s.newClientAvailable=function(){return!!c.findOne({_id:"version",version:{$ne:t}})||!!c.findOne({_id:"version-refreshable",version:{$ne:n}})};var r=!1,u=new a({minCount:0,baseTimeout:3e4}),l=0;s._retrySubscription=function(){e.subscribe("meteor_autoupdate_clientVersions",{onError:function(t){e._debug("autoupdate subscription failed:",t),l++,u.retryLater(l,function(){s._retrySubscription()})},onReady:function(){if(Package.reload)var a=function(a){var s=this;if("version-refreshable"===a._id&&a.version!==n){n=a.version;var c=a.assets&&a.assets.allCss||[],u=[];i.each(document.getElementsByTagName("link"),function(e){"__meteor-css__"===e.className&&u.push(e)});var l=function(t,n){var a=i.once(n);if(t.onload=function(){r=!0,a()},!r)var o=e.setInterval(function(){t.sheet&&(a(),e.clearInterval(o))},50)},d=i.after(c.length,function(){i.each(u,function(e){e.parentNode.removeChild(e)})}),_=function(t){document.getElementsByTagName("head").item(0).appendChild(t),l(t,function(){e.setTimeout(d,200)})};0!==c.length?i.each(c,function(t){var n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css"),n.setAttribute("class","__meteor-css__"),n.setAttribute("href",e._relativeToSiteRootUrl(t.url)),_(n)}):d()}else"version"===a._id&&a.version!==t&&(o&&o.stop(),Package.reload.Reload._reload())},o=c.find().observe({added:a,changed:a})}})},s._retrySubscription()}).call(this),"undefined"==typeof Package&&(Package={}),Package.autoupdate={Autoupdate:s}}(); + +!function(){var a=Package.meteor.Meteor,e=Package.reload.Reload,o=Package.autoupdate.Autoupdate;"undefined"==typeof Package&&(Package={}),Package["meteor-platform"]={}}(); + +!function(){var t=Package.meteor.Meteor,e,n;(function(){n={exports:{}}}).call(this),function(){function t(n,i){"use strict";function o(t,e){return function(){return t.apply(e,arguments)}}var r;if(i=i||{},this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=i.touchBoundary||10,this.layer=n,this.tapDelay=i.tapDelay||200,!t.notNeeded(n)){for(var c=["onMouse","onClick","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel"],s=this,a=0,u=c.length;u>a;a++)s[c[a]]=o(s[c[a]],s);e&&(n.addEventListener("mouseover",this.onMouse,!0),n.addEventListener("mousedown",this.onMouse,!0),n.addEventListener("mouseup",this.onMouse,!0)),n.addEventListener("click",this.onClick,!0),n.addEventListener("touchstart",this.onTouchStart,!1),n.addEventListener("touchmove",this.onTouchMove,!1),n.addEventListener("touchend",this.onTouchEnd,!1),n.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(n.removeEventListener=function(t,e,i){var o=Node.prototype.removeEventListener;"click"===t?o.call(n,t,e.hijacked||e,i):o.call(n,t,e,i)},n.addEventListener=function(t,e,i){var o=Node.prototype.addEventListener;"click"===t?o.call(n,t,e.hijacked||(e.hijacked=function(t){t.propagationStopped||e(t)}),i):o.call(n,t,e,i)}),"function"==typeof n.onclick&&(r=n.onclick,n.addEventListener("click",function(t){r(t)},!1),n.onclick=null)}}var e=navigator.userAgent.indexOf("Android")>0,i=/iP(ad|hone|od)/.test(navigator.userAgent),o=i&&/OS 4_\d(_\d)?/.test(navigator.userAgent),r=i&&/OS ([6-9]|\d{2})_\d/.test(navigator.userAgent),c=navigator.userAgent.indexOf("BB10")>0;t.prototype.needsClick=function(t){"use strict";switch(t.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(t.disabled)return!0;break;case"input":if(i&&"file"===t.type||t.disabled)return!0;break;case"label":case"video":return!0}return/\bneedsclick\b/.test(t.className)},t.prototype.needsFocus=function(t){"use strict";switch(t.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!e;case"input":switch(t.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!t.disabled&&!t.readOnly;default:return/\bneedsfocus\b/.test(t.className)}},t.prototype.sendClick=function(t,e){"use strict";var n,i;document.activeElement&&document.activeElement!==t&&document.activeElement.blur(),i=e.changedTouches[0],n=document.createEvent("MouseEvents"),n.initMouseEvent(this.determineEventType(t),!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),n.forwardedTouchEvent=!0,t.dispatchEvent(n)},t.prototype.determineEventType=function(t){"use strict";return e&&"select"===t.tagName.toLowerCase()?"mousedown":"click"},t.prototype.focus=function(t){"use strict";var e;i&&t.setSelectionRange&&0!==t.type.indexOf("date")&&"time"!==t.type?(e=t.value.length,t.setSelectionRange(e,e)):t.focus()},t.prototype.updateScrollParent=function(t){"use strict";var e,n;if(e=t.fastClickScrollParent,!e||!e.contains(t)){n=t;do{if(n.scrollHeight>n.offsetHeight){e=n,t.fastClickScrollParent=n;break}n=n.parentElement}while(n)}e&&(e.fastClickLastScrollTop=e.scrollTop)},t.prototype.getTargetElementFromEventTarget=function(t){"use strict";return t.nodeType===Node.TEXT_NODE?t.parentNode:t},t.prototype.onTouchStart=function(t){"use strict";var e,n,r;if(t.targetTouches.length>1)return!0;if(e=this.getTargetElementFromEventTarget(t.target),n=t.targetTouches[0],i){if(r=window.getSelection(),r.rangeCount&&!r.isCollapsed)return!0;if(!o){if(n.identifier&&n.identifier===this.lastTouchIdentifier)return t.preventDefault(),!1;this.lastTouchIdentifier=n.identifier,this.updateScrollParent(e)}}return this.trackingClick=!0,this.trackingClickStart=t.timeStamp,this.targetElement=e,this.touchStartX=n.pageX,this.touchStartY=n.pageY,t.timeStamp-this.lastClickTime<this.tapDelay&&t.preventDefault(),!0},t.prototype.touchHasMoved=function(t){"use strict";var e=t.changedTouches[0],n=this.touchBoundary;return Math.abs(e.pageX-this.touchStartX)>n||Math.abs(e.pageY-this.touchStartY)>n?!0:!1},t.prototype.onTouchMove=function(t){"use strict";return this.trackingClick?((this.targetElement!==this.getTargetElementFromEventTarget(t.target)||this.touchHasMoved(t))&&(this.trackingClick=!1,this.targetElement=null),!0):!0},t.prototype.findControl=function(t){"use strict";return void 0!==t.control?t.control:t.htmlFor?document.getElementById(t.htmlFor):t.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},t.prototype.onTouchEnd=function(t){"use strict";var n,c,s,a,u,l=this.targetElement;if(!this.trackingClick)return!0;if(t.timeStamp-this.lastClickTime<this.tapDelay)return this.cancelNextClick=!0,!0;if(this.cancelNextClick=!1,this.lastClickTime=t.timeStamp,c=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,r&&(u=t.changedTouches[0],l=document.elementFromPoint(u.pageX-window.pageXOffset,u.pageY-window.pageYOffset)||l,l.fastClickScrollParent=this.targetElement.fastClickScrollParent),s=l.tagName.toLowerCase(),"label"===s){if(n=this.findControl(l)){if(this.focus(l),e)return!1;l=n}}else if(this.needsFocus(l))return t.timeStamp-c>100||i&&window.top!==window&&"input"===s?(this.targetElement=null,!1):(this.focus(l),this.sendClick(l,t),i&&"select"===s||(this.targetElement=null,t.preventDefault()),!1);return i&&!o&&(a=l.fastClickScrollParent,a&&a.fastClickLastScrollTop!==a.scrollTop)?!0:(this.needsClick(l)||(t.preventDefault(),this.sendClick(l,t)),!1)},t.prototype.onTouchCancel=function(){"use strict";this.trackingClick=!1,this.targetElement=null},t.prototype.onMouse=function(t){"use strict";return this.targetElement?t.forwardedTouchEvent?!0:t.cancelable&&(!this.needsClick(this.targetElement)||this.cancelNextClick)?(t.stopImmediatePropagation?t.stopImmediatePropagation():t.propagationStopped=!0,t.stopPropagation(),t.preventDefault(),!1):!0:!0},t.prototype.onClick=function(t){"use strict";var e;return this.trackingClick?(this.targetElement=null,this.trackingClick=!1,!0):"submit"===t.target.type&&0===t.detail?!0:(e=this.onMouse(t),e||(this.targetElement=null),e)},t.prototype.destroy=function(){"use strict";var t=this.layer;e&&(t.removeEventListener("mouseover",this.onMouse,!0),t.removeEventListener("mousedown",this.onMouse,!0),t.removeEventListener("mouseup",this.onMouse,!0)),t.removeEventListener("click",this.onClick,!0),t.removeEventListener("touchstart",this.onTouchStart,!1),t.removeEventListener("touchmove",this.onTouchMove,!1),t.removeEventListener("touchend",this.onTouchEnd,!1),t.removeEventListener("touchcancel",this.onTouchCancel,!1)},t.notNeeded=function(t){"use strict";var n,i,o;if("undefined"==typeof window.ontouchstart)return!0;if(i=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]){if(!e)return!0;if(n=document.querySelector("meta[name=viewport]")){if(-1!==n.content.indexOf("user-scalable=no"))return!0;if(i>31&&document.documentElement.scrollWidth<=window.outerWidth)return!0}}if(c&&(o=navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/),o[1]>=10&&o[2]>=3&&(n=document.querySelector("meta[name=viewport]")))){if(-1!==n.content.indexOf("user-scalable=no"))return!0;if(document.documentElement.scrollWidth<=window.outerWidth)return!0}return"none"===t.style.msTouchAction?!0:!1},t.attach=function(e,n){"use strict";return new t(e,n)},"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){"use strict";return t}):"undefined"!=typeof n&&n.exports?(n.exports=t.attach,n.exports.FastClick=t):window.FastClick=t}.call(this),function(){e=n.exports.FastClick,t.startup(function(){e.attach(document.body)})}.call(this),"undefined"==typeof Package&&(Package={}),Package.fastclick={FastClick:e}}(); + +!function(){var e=Package.meteor.Meteor;"undefined"==typeof Package&&(Package={}),Package.less={}}(); + +!function(){var e=Package.meteor.Meteor,n;(function(){n={},function(e){function n(e,n){var o={};if(t(e)&&e.length>0)for(var r=n?c:i,a=e.split(/;\s/g),u,f,s,g=0,p=a.length;p>g;g++){if(s=a[g].match(/([^=]+)=/i),s instanceof Array)try{u=c(s[1]),f=r(a[g].substring(s[1].length+1))}catch(m){}else u=c(a[g]),f="";u&&(o[u]=f)}return o}function t(e){return"string"==typeof e}function o(e){return t(e)&&""!==e}function r(e){if(!o(e))throw new TypeError("Cookie name must be a non-empty string")}function i(e){return e}var a=e,c=decodeURIComponent,u=encodeURIComponent;a.get=function(e,t){r(e),t="function"==typeof t?{converter:t}:t||{};var o=n(document.cookie,!t.raw);return(t.converter||i)(o[e])},a.set=function(e,n,t){r(e),t=t||{};var i=t.expires,a=t.domain,c=t.path;t.raw||(n=u(String(n)));var f=e+"="+n,s=i;return"number"==typeof s&&(s=new Date,s.setDate(s.getDate()+i)),s instanceof Date&&(f+="; expires="+s.toUTCString()),o(a)&&(f+="; domain="+a),o(c)&&(f+="; path="+c),t.secure&&(f+="; secure"),document.cookie=f,f},a.remove=function(e,n){return n=n||{},n.expires=new Date(0),this.set(e,"",n)}}(n)}).call(this),"undefined"==typeof Package&&(Package={}),Package["chuangbo:cookie"]={Cookie:n}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.underscore._,a;(function(){(function(e){function t(e,t,a){switch(arguments.length){case 2:return null!=e?e:t;case 3:return null!=e?e:null!=t?t:a;default:throw new Error("Implement me")}}function a(e,t){return wt.call(e,t)}function n(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function _(e){ft.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function s(e,t){var a=!0;return m(function(){return a&&(_(e),a=!1),t.apply(this,arguments)},t)}function r(e,t){ha[e]||(_(t),ha[e]=!0)}function d(e,t){return function(a){return L(e.call(this,a),t)}}function i(e,t){return function(a){return this.localeData().ordinal(e.call(this,a),t)}}function o(){}function u(e,t){t!==!1&&x(e),M(this,e),this._d=new Date(+e._d)}function l(e){var t=g(e),a=t.year||0,n=t.quarter||0,_=t.month||0,s=t.week||0,r=t.day||0,d=t.hour||0,i=t.minute||0,o=t.second||0,u=t.millisecond||0;this._milliseconds=+u+1e3*o+6e4*i+36e5*d,this._days=+r+7*s,this._months=+_+3*n+12*a,this._data={},this._locale=ft.localeData(),this._bubble()}function m(e,t){for(var n in t)a(t,n)&&(e[n]=t[n]);return a(t,"toString")&&(e.toString=t.toString),a(t,"valueOf")&&(e.valueOf=t.valueOf),e}function M(e,t){var a,n,_;if("undefined"!=typeof t._isAMomentObject&&(e._isAMomentObject=t._isAMomentObject),"undefined"!=typeof t._i&&(e._i=t._i),"undefined"!=typeof t._f&&(e._f=t._f),"undefined"!=typeof t._l&&(e._l=t._l),"undefined"!=typeof t._strict&&(e._strict=t._strict),"undefined"!=typeof t._tzm&&(e._tzm=t._tzm),"undefined"!=typeof t._isUTC&&(e._isUTC=t._isUTC),"undefined"!=typeof t._offset&&(e._offset=t._offset),"undefined"!=typeof t._pf&&(e._pf=t._pf),"undefined"!=typeof t._locale&&(e._locale=t._locale),Ft.length>0)for(a in Ft)n=Ft[a],_=t[n],"undefined"!=typeof _&&(e[n]=_);return e}function c(e){return 0>e?Math.ceil(e):Math.floor(e)}function L(e,t,a){for(var n=""+Math.abs(e),_=e>=0;n.length<t;)n="0"+n;return(_?a?"+":"":"-")+n}function h(e,t){var a={milliseconds:0,months:0};return a.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(a.months,"M").isAfter(t)&&--a.months,a.milliseconds=+t-+e.clone().add(a.months,"M"),a}function Y(e,t){var a;return t=A(t,e),e.isBefore(t)?a=h(e,t):(a=h(t,e),a.milliseconds=-a.milliseconds,a.months=-a.months),a}function y(e,t){return function(a,n){var _,s;return null===n||isNaN(+n)||(r(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period)."),s=a,a=n,n=s),a="string"==typeof a?+a:a,_=ft.duration(a,n),f(this,_,e),this}}function f(e,t,a,n){var _=t._milliseconds,s=t._days,r=t._months;n=null==n?!0:n,_&&e._d.setTime(+e._d+_*a),s&&Mt(e,"Date",mt(e,"Date")+s*a),r&<(e,mt(e,"Month")+r*a),n&&ft.updateOffset(e,s||r)}function p(e){return"[object Array]"===Object.prototype.toString.call(e)}function D(e){return"[object Date]"===Object.prototype.toString.call(e)||e instanceof Date}function k(e,t,a){var n,_=Math.min(e.length,t.length),s=Math.abs(e.length-t.length),r=0;for(n=0;_>n;n++)(a&&e[n]!==t[n]||!a&&v(e[n])!==v(t[n]))&&r++;return r+s}function T(e){if(e){var t=e.toLowerCase().replace(/(.)s$/,"$1");e=oa[e]||ua[t]||t}return e}function g(e){var t,n,_={};for(n in e)a(e,n)&&(t=T(n),t&&(_[t]=e[n]));return _}function w(t){var a,n;if(0===t.indexOf("week"))a=7,n="day";else{if(0!==t.indexOf("month"))return;a=12,n="month"}ft[t]=function(_,s){var r,d,i=ft._locale[t],o=[];if("number"==typeof _&&(s=_,_=e),d=function(e){var t=ft().utc().set(n,e);return i.call(ft._locale,t,_||"")},null!=s)return d(s);for(r=0;a>r;r++)o.push(d(r));return o}}function v(e){var t=+e,a=0;return 0!==t&&isFinite(t)&&(a=t>=0?Math.floor(t):Math.ceil(t)),a}function b(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}function S(e,t,a){return dt(ft([e,11,31+t-a]),t,a).week}function j(e){return W(e)?366:365}function W(e){return e%4===0&&e%100!==0||e%400===0}function x(e){var t;e._a&&-2===e._pf.overflow&&(t=e._a[bt]<0||e._a[bt]>11?bt:e._a[St]<1||e._a[St]>b(e._a[vt],e._a[bt])?St:e._a[jt]<0||e._a[jt]>23?jt:e._a[Wt]<0||e._a[Wt]>59?Wt:e._a[xt]<0||e._a[xt]>59?xt:e._a[zt]<0||e._a[zt]>999?zt:-1,e._pf._overflowDayOfYear&&(vt>t||t>St)&&(t=St),e._pf.overflow=t)}function z(e){return null==e._isValid&&(e._isValid=!isNaN(e._d.getTime())&&e._pf.overflow<0&&!e._pf.empty&&!e._pf.invalidMonth&&!e._pf.nullInput&&!e._pf.invalidFormat&&!e._pf.userInvalidated,e._strict&&(e._isValid=e._isValid&&0===e._pf.charsLeftOver&&0===e._pf.unusedTokens.length)),e._isValid}function H(e){return e?e.toLowerCase().replace("_","-"):e}function F(e){for(var t,a,n,_,s=0;s<e.length;){for(_=H(e[s]).split("-"),t=_.length,a=H(e[s+1]),a=a?a.split("-"):null;t>0;){if(n=E(_.slice(0,t).join("-")))return n;if(a&&a.length>=t&&k(_,a,!0)>=t-1)break;t--}s++}return null}function E(e){var t=null;if(!Ht[e]&&Et)try{t=ft.locale(),require("./locale/"+e),ft.locale(t)}catch(a){}return Ht[e]}function A(e,t){return t._isUTC?ft(e).zone(t._offset||0):ft(e).local()}function O(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function J(e){var t,a,n=e.match(Gt);for(t=0,a=n.length;a>t;t++)n[t]=La[n[t]]?La[n[t]]:O(n[t]);return function(_){var s="";for(t=0;a>t;t++)s+=n[t]instanceof Function?n[t].call(_,e):n[t];return s}}function G(e,t){return e.isValid()?(t=P(t,e.localeData()),la[t]||(la[t]=J(t)),la[t](e)):e.localeData().invalidDate()}function P(e,t){function a(e){return t.longDateFormat(e)||e}var n=5;for(Pt.lastIndex=0;n>=0&&Pt.test(e);)e=e.replace(Pt,a),Pt.lastIndex=0,n-=1;return e}function C(e,t){var a,n=t._strict;switch(e){case"Q":return Bt;case"DDDD":return Qt;case"YYYY":case"GGGG":case"gggg":return n?ea:Ut;case"Y":case"G":case"g":return aa;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return n?ta:Nt;case"S":if(n)return Bt;case"SS":if(n)return Xt;case"SSS":if(n)return Qt;case"DDD":return It;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return qt;case"a":case"A":return t._locale._meridiemParse;case"X":return $t;case"Z":case"ZZ":return Zt;case"T":return Kt;case"SSSS":return Vt;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return n?Xt:Ct;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Ct;case"Do":return Rt;default:return a=new RegExp(R($(e.replace("\\","")),"i"))}}function I(e){e=e||"";var t=e.match(Zt)||[],a=t[t.length-1]||[],n=(a+"").match(da)||["-",0,0],_=+(60*n[1])+v(n[2]);return"+"===n[0]?-_:_}function U(e,t,a){var n,_=a._a;switch(e){case"Q":null!=t&&(_[bt]=3*(v(t)-1));break;case"M":case"MM":null!=t&&(_[bt]=v(t)-1);break;case"MMM":case"MMMM":n=a._locale.monthsParse(t),null!=n?_[bt]=n:a._pf.invalidMonth=t;break;case"D":case"DD":null!=t&&(_[St]=v(t));break;case"Do":null!=t&&(_[St]=v(parseInt(t,10)));break;case"DDD":case"DDDD":null!=t&&(a._dayOfYear=v(t));break;case"YY":_[vt]=ft.parseTwoDigitYear(t);break;case"YYYY":case"YYYYY":case"YYYYYY":_[vt]=v(t);break;case"a":case"A":a._isPm=a._locale.isPM(t);break;case"H":case"HH":case"h":case"hh":_[jt]=v(t);break;case"m":case"mm":_[Wt]=v(t);break;case"s":case"ss":_[xt]=v(t);break;case"S":case"SS":case"SSS":case"SSSS":_[zt]=v(1e3*("0."+t));break;case"X":a._d=new Date(1e3*parseFloat(t));break;case"Z":case"ZZ":a._useUTC=!0,a._tzm=I(t);break;case"dd":case"ddd":case"dddd":n=a._locale.weekdaysParse(t),null!=n?(a._w=a._w||{},a._w.d=n):a._pf.invalidWeekday=t;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":e=e.substr(0,1);case"gggg":case"GGGG":case"GGGGG":e=e.substr(0,2),t&&(a._w=a._w||{},a._w[e]=v(t));break;case"gg":case"GG":a._w=a._w||{},a._w[e]=ft.parseTwoDigitYear(t)}}function N(e){var a,n,_,s,r,d,i;a=e._w,null!=a.GG||null!=a.W||null!=a.E?(r=1,d=4,n=t(a.GG,e._a[vt],dt(ft(),1,4).year),_=t(a.W,1),s=t(a.E,1)):(r=e._locale._week.dow,d=e._locale._week.doy,n=t(a.gg,e._a[vt],dt(ft(),r,d).year),_=t(a.w,1),null!=a.d?(s=a.d,r>s&&++_):s=null!=a.e?a.e+r:r),i=it(n,_,s,d,r),e._a[vt]=i.year,e._dayOfYear=i.dayOfYear}function V(e){var a,n,_,s,r=[];if(!e._d){for(_=Z(e),e._w&&null==e._a[St]&&null==e._a[bt]&&N(e),e._dayOfYear&&(s=t(e._a[vt],_[vt]),e._dayOfYear>j(s)&&(e._pf._overflowDayOfYear=!0),n=nt(s,0,e._dayOfYear),e._a[bt]=n.getUTCMonth(),e._a[St]=n.getUTCDate()),a=0;3>a&&null==e._a[a];++a)e._a[a]=r[a]=_[a];for(;7>a;a++)e._a[a]=r[a]=null==e._a[a]?2===a?1:0:e._a[a];e._d=(e._useUTC?nt:at).apply(null,r),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()+e._tzm)}}function q(e){var t;e._d||(t=g(e._i),e._a=[t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond],V(e))}function Z(e){var t=new Date;return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function K(e){if(e._f===ft.ISO_8601)return void X(e);e._a=[],e._pf.empty=!0;var t,a,n,_,s,r=""+e._i,d=r.length,i=0;for(n=P(e._f,e._locale).match(Gt)||[],t=0;t<n.length;t++)_=n[t],a=(r.match(C(_,e))||[])[0],a&&(s=r.substr(0,r.indexOf(a)),s.length>0&&e._pf.unusedInput.push(s),r=r.slice(r.indexOf(a)+a.length),i+=a.length),La[_]?(a?e._pf.empty=!1:e._pf.unusedTokens.push(_),U(_,a,e)):e._strict&&!a&&e._pf.unusedTokens.push(_);e._pf.charsLeftOver=d-i,r.length>0&&e._pf.unusedInput.push(r),e._isPm&&e._a[jt]<12&&(e._a[jt]+=12),e._isPm===!1&&12===e._a[jt]&&(e._a[jt]=0),V(e),x(e)}function $(e){return e.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,a,n,_){return t||a||n||_})}function R(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function B(e){var t,a,_,s,r;if(0===e._f.length)return e._pf.invalidFormat=!0,void(e._d=new Date(0/0));for(s=0;s<e._f.length;s++)r=0,t=M({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._pf=n(),t._f=e._f[s],K(t),z(t)&&(r+=t._pf.charsLeftOver,r+=10*t._pf.unusedTokens.length,t._pf.score=r,(null==_||_>r)&&(_=r,a=t));m(e,a||t)}function X(e){var t,a,n=e._i,_=na.exec(n);if(_){for(e._pf.iso=!0,t=0,a=sa.length;a>t;t++)if(sa[t][1].exec(n)){e._f=sa[t][0]+(_[6]||" ");break}for(t=0,a=ra.length;a>t;t++)if(ra[t][1].exec(n)){e._f+=ra[t][0];break}n.match(Zt)&&(e._f+="Z"),K(e)}else e._isValid=!1}function Q(e){X(e),e._isValid===!1&&(delete e._isValid,ft.createFromInputFallback(e))}function et(e,t){var a,n=[];for(a=0;a<e.length;++a)n.push(t(e[a],a));return n}function tt(t){var a,n=t._i;n===e?t._d=new Date:D(n)?t._d=new Date(+n):null!==(a=At.exec(n))?t._d=new Date(+a[1]):"string"==typeof n?Q(t):p(n)?(t._a=et(n.slice(0),function(e){return parseInt(e,10)}),V(t)):"object"==typeof n?q(t):"number"==typeof n?t._d=new Date(n):ft.createFromInputFallback(t)}function at(e,t,a,n,_,s,r){var d=new Date(e,t,a,n,_,s,r);return 1970>e&&d.setFullYear(e),d}function nt(e){var t=new Date(Date.UTC.apply(null,arguments));return 1970>e&&t.setUTCFullYear(e),t}function _t(e,t){if("string"==typeof e)if(isNaN(e)){if(e=t.weekdaysParse(e),"number"!=typeof e)return null}else e=parseInt(e,10);return e}function st(e,t,a,n,_){return _.relativeTime(t||1,!!a,e,n)}function rt(e,t,a){var n=ft.duration(e).abs(),_=gt(n.as("s")),s=gt(n.as("m")),r=gt(n.as("h")),d=gt(n.as("d")),i=gt(n.as("M")),o=gt(n.as("y")),u=_<ma.s&&["s",_]||1===s&&["m"]||s<ma.m&&["mm",s]||1===r&&["h"]||r<ma.h&&["hh",r]||1===d&&["d"]||d<ma.d&&["dd",d]||1===i&&["M"]||i<ma.M&&["MM",i]||1===o&&["y"]||["yy",o];return u[2]=t,u[3]=+e>0,u[4]=a,st.apply({},u)}function dt(e,t,a){var n,_=a-t,s=a-e.day();return s>_&&(s-=7),_-7>s&&(s+=7),n=ft(e).add(s,"d"),{week:Math.ceil(n.dayOfYear()/7),year:n.year()}}function it(e,t,a,n,_){var s,r,d=nt(e,0,1).getUTCDay();return d=0===d?7:d,a=null!=a?a:_,s=_-d+(d>n?7:0)-(_>d?7:0),r=7*(t-1)+(a-_)+s+1,{year:r>0?e:e-1,dayOfYear:r>0?r:j(e-1)+r}}function ot(t){var a=t._i,n=t._f;return t._locale=t._locale||ft.localeData(t._l),null===a||n===e&&""===a?ft.invalid({nullInput:!0}):("string"==typeof a&&(t._i=a=t._locale.preparse(a)),ft.isMoment(a)?new u(a,!0):(n?p(n)?B(t):K(t):tt(t),new u(t)))}function ut(e,t){var a,n;if(1===t.length&&p(t[0])&&(t=t[0]),!t.length)return ft();for(a=t[0],n=1;n<t.length;++n)t[n][e](a)&&(a=t[n]);return a}function lt(e,t){var a;return"string"==typeof t&&(t=e.localeData().monthsParse(t),"number"!=typeof t)?e:(a=Math.min(e.date(),b(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,a),e)}function mt(e,t){return e._d["get"+(e._isUTC?"UTC":"")+t]()}function Mt(e,t,a){return"Month"===t?lt(e,a):e._d["set"+(e._isUTC?"UTC":"")+t](a)}function ct(e,t){return function(a){return null!=a?(Mt(this,e,a),ft.updateOffset(this,t),this):mt(this,e)}}function Lt(e){return 400*e/146097}function ht(e){return 146097*e/400}function Yt(e){ft.duration.fn[e]=function(){return this._data[e]}}function yt(e){"undefined"==typeof ender&&(pt=Tt.moment,Tt.moment=e?s("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.",ft):ft)}for(var ft,pt,Dt,kt="2.8.3",Tt="undefined"!=typeof global?global:this,gt=Math.round,wt=Object.prototype.hasOwnProperty,vt=0,bt=1,St=2,jt=3,Wt=4,xt=5,zt=6,Ht={},Ft=[],Et="undefined"!=typeof module&&module.exports,At=/^\/?Date\((\-?\d+)/i,Ot=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Jt=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,Gt=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,Pt=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,Ct=/\d\d?/,It=/\d{1,3}/,Ut=/\d{1,4}/,Nt=/[+\-]?\d{1,6}/,Vt=/\d+/,qt=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Zt=/Z|[\+\-]\d\d:?\d\d/gi,Kt=/T/i,$t=/[\+\-]?\d+(\.\d{1,3})?/,Rt=/\d{1,2}/,Bt=/\d/,Xt=/\d\d/,Qt=/\d{3}/,ea=/\d{4}/,ta=/[+-]?\d{6}/,aa=/[+-]?\d+/,na=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_a="YYYY-MM-DDTHH:mm:ssZ",sa=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],ra=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],da=/([\+\-]|\d\d)/gi,ia=("Date|Hours|Minutes|Seconds|Milliseconds".split("|"),{Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6}),oa={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",Q:"quarter",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},ua={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},la={},ma={s:45,m:45,h:22,d:26,M:11},Ma="DDD w W M D d".split(" "),ca="M D H h m s w W".split(" "),La={M:function(){return this.month()+1},MMM:function(e){return this.localeData().monthsShort(this,e)},MMMM:function(e){return this.localeData().months(this,e)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(e){return this.localeData().weekdaysMin(this,e)},ddd:function(e){return this.localeData().weekdaysShort(this,e)},dddd:function(e){return this.localeData().weekdays(this,e)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return L(this.year()%100,2)},YYYY:function(){return L(this.year(),4)},YYYYY:function(){return L(this.year(),5)},YYYYYY:function(){var e=this.year(),t=e>=0?"+":"-";return t+L(Math.abs(e),6)},gg:function(){return L(this.weekYear()%100,2)},gggg:function(){return L(this.weekYear(),4)},ggggg:function(){return L(this.weekYear(),5)},GG:function(){return L(this.isoWeekYear()%100,2)},GGGG:function(){return L(this.isoWeekYear(),4)},GGGGG:function(){return L(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return v(this.milliseconds()/100)},SS:function(){return L(v(this.milliseconds()/10),2)},SSS:function(){return L(this.milliseconds(),3)},SSSS:function(){return L(this.milliseconds(),3)},Z:function(){var e=-this.zone(),t="+";return 0>e&&(e=-e,t="-"),t+L(v(e/60),2)+":"+L(v(e)%60,2)},ZZ:function(){var e=-this.zone(),t="+";return 0>e&&(e=-e,t="-"),t+L(v(e/60),2)+L(v(e)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},ha={},Ya=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];Ma.length;)Dt=Ma.pop(),La[Dt+"o"]=i(La[Dt],Dt);for(;ca.length;)Dt=ca.pop(),La[Dt+Dt]=d(La[Dt],2);La.DDDD=d(La.DDD,3),m(o.prototype,{set:function(e){var t,a;for(a in e)t=e[a],"function"==typeof t?this[a]=t:this["_"+a]=t},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(e){return this._months[e.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(e){return this._monthsShort[e.month()]},monthsParse:function(e){var t,a,n;for(this._monthsParse||(this._monthsParse=[]),t=0;12>t;t++)if(this._monthsParse[t]||(a=ft.utc([2e3,t]),n="^"+this.months(a,"")+"|^"+this.monthsShort(a,""),this._monthsParse[t]=new RegExp(n.replace(".",""),"i")),this._monthsParse[t].test(e))return t},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(e){return this._weekdays[e.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(e){return this._weekdaysShort[e.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(e){return this._weekdaysMin[e.day()]},weekdaysParse:function(e){var t,a,n;for(this._weekdaysParse||(this._weekdaysParse=[]),t=0;7>t;t++)if(this._weekdaysParse[t]||(a=ft([2e3,1]).day(t),n="^"+this.weekdays(a,"")+"|^"+this.weekdaysShort(a,"")+"|^"+this.weekdaysMin(a,""),this._weekdaysParse[t]=new RegExp(n.replace(".",""),"i")),this._weekdaysParse[t].test(e))return t},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},longDateFormat:function(e){var t=this._longDateFormat[e];return!t&&this._longDateFormat[e.toUpperCase()]&&(t=this._longDateFormat[e.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e]=t),t},isPM:function(e){return"p"===(e+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(e,t,a){return e>11?a?"pm":"PM":a?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(e,t){var a=this._calendar[e];return"function"==typeof a?a.apply(t):a},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(e,t,a,n){var _=this._relativeTime[a];return"function"==typeof _?_(e,t,a,n):_.replace(/%d/i,e)},pastFuture:function(e,t){var a=this._relativeTime[e>0?"future":"past"];return"function"==typeof a?a(t):a.replace(/%s/i,t)},ordinal:function(e){return this._ordinal.replace("%d",e)},_ordinal:"%d",preparse:function(e){return e},postformat:function(e){return e},week:function(e){return dt(e,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),ft=function(t,a,_,s){var r;return"boolean"==typeof _&&(s=_,_=e),r={},r._isAMomentObject=!0,r._i=t,r._f=a,r._l=_,r._strict=s,r._isUTC=!1,r._pf=n(),ot(r)},ft.suppressDeprecationWarnings=!1,ft.createFromInputFallback=s("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(e){e._d=new Date(e._i)}),ft.min=function(){var e=[].slice.call(arguments,0);return ut("isBefore",e)},ft.max=function(){var e=[].slice.call(arguments,0);return ut("isAfter",e)},ft.utc=function(t,a,_,s){var r;return"boolean"==typeof _&&(s=_,_=e),r={},r._isAMomentObject=!0,r._useUTC=!0,r._isUTC=!0,r._l=_,r._i=t,r._f=a,r._strict=s,r._pf=n(),ot(r).utc()},ft.unix=function(e){return ft(1e3*e)},ft.duration=function(e,t){var n,_,s,r,d=e,i=null;return ft.isDuration(e)?d={ms:e._milliseconds,d:e._days,M:e._months}:"number"==typeof e?(d={},t?d[t]=e:d.milliseconds=e):(i=Ot.exec(e))?(n="-"===i[1]?-1:1,d={y:0,d:v(i[St])*n,h:v(i[jt])*n,m:v(i[Wt])*n,s:v(i[xt])*n,ms:v(i[zt])*n}):(i=Jt.exec(e))?(n="-"===i[1]?-1:1,s=function(e){var t=e&&parseFloat(e.replace(",","."));return(isNaN(t)?0:t)*n},d={y:s(i[2]),M:s(i[3]),d:s(i[4]),h:s(i[5]),m:s(i[6]),s:s(i[7]),w:s(i[8])}):"object"==typeof d&&("from"in d||"to"in d)&&(r=Y(ft(d.from),ft(d.to)),d={},d.ms=r.milliseconds,d.M=r.months),_=new l(d),ft.isDuration(e)&&a(e,"_locale")&&(_._locale=e._locale),_},ft.version=kt,ft.defaultFormat=_a,ft.ISO_8601=function(){},ft.momentProperties=Ft,ft.updateOffset=function(){},ft.relativeTimeThreshold=function(t,a){return ma[t]===e?!1:a===e?ma[t]:(ma[t]=a,!0)},ft.lang=s("moment.lang is deprecated. Use moment.locale instead.",function(e,t){return ft.locale(e,t)}),ft.locale=function(e,t){var a;return e&&(a="undefined"!=typeof t?ft.defineLocale(e,t):ft.localeData(e),a&&(ft.duration._locale=ft._locale=a)),ft._locale._abbr},ft.defineLocale=function(e,t){return null!==t?(t.abbr=e,Ht[e]||(Ht[e]=new o),Ht[e].set(t),ft.locale(e),Ht[e]):(delete Ht[e],null)},ft.langData=s("moment.langData is deprecated. Use moment.localeData instead.",function(e){return ft.localeData(e)}),ft.localeData=function(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return ft._locale;if(!p(e)){if(t=E(e))return t;e=[e]}return F(e)},ft.isMoment=function(e){return e instanceof u||null!=e&&a(e,"_isAMomentObject")},ft.isDuration=function(e){return e instanceof l};for(Dt=Ya.length-1;Dt>=0;--Dt)w(Ya[Dt]);ft.normalizeUnits=function(e){return T(e)},ft.invalid=function(e){var t=ft.utc(0/0);return null!=e?m(t._pf,e):t._pf.userInvalidated=!0,t},ft.parseZone=function(){return ft.apply(null,arguments).parseZone()},ft.parseTwoDigitYear=function(e){return v(e)+(v(e)>68?1900:2e3)},m(ft.fn=u.prototype,{clone:function(){return ft(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var e=ft(this).utc();return 0<e.year()&&e.year()<=9999?G(e,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):G(e,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var e=this;return[e.year(),e.month(),e.date(),e.hours(),e.minutes(),e.seconds(),e.milliseconds()]},isValid:function(){return z(this)},isDSTShifted:function(){return this._a?this.isValid()&&k(this._a,(this._isUTC?ft.utc(this._a):ft(this._a)).toArray())>0:!1},parsingFlags:function(){return m({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(e){return this.zone(0,e)},local:function(e){return this._isUTC&&(this.zone(0,e),this._isUTC=!1,e&&this.add(this._dateTzOffset(),"m")),this},format:function(e){var t=G(this,e||ft.defaultFormat);return this.localeData().postformat(t)},add:y(1,"add"),subtract:y(-1,"subtract"),diff:function(e,t,a){var n,_,s,r=A(e,this),d=6e4*(this.zone()-r.zone());return t=T(t),"year"===t||"month"===t?(n=432e5*(this.daysInMonth()+r.daysInMonth()),_=12*(this.year()-r.year())+(this.month()-r.month()),s=this-ft(this).startOf("month")-(r-ft(r).startOf("month")),s-=6e4*(this.zone()-ft(this).startOf("month").zone()-(r.zone()-ft(r).startOf("month").zone())),_+=s/n,"year"===t&&(_/=12)):(n=this-r,_="second"===t?n/1e3:"minute"===t?n/6e4:"hour"===t?n/36e5:"day"===t?(n-d)/864e5:"week"===t?(n-d)/6048e5:n),a?_:c(_)},from:function(e,t){return ft.duration({to:this,from:e}).locale(this.locale()).humanize(!t)},fromNow:function(e){return this.from(ft(),e)},calendar:function(e){var t=e||ft(),a=A(t,this).startOf("day"),n=this.diff(a,"days",!0),_=-6>n?"sameElse":-1>n?"lastWeek":0>n?"lastDay":1>n?"sameDay":2>n?"nextDay":7>n?"nextWeek":"sameElse";return this.format(this.localeData().calendar(_,this))},isLeapYear:function(){return W(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(e){var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=_t(e,this.localeData()),this.add(e-t,"d")):t},month:ct("Month",!0),startOf:function(e){switch(e=T(e)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e?this.weekday(0):"isoWeek"===e&&this.isoWeekday(1),"quarter"===e&&this.month(3*Math.floor(this.month()/3)),this},endOf:function(e){return e=T(e),this.startOf(e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms")},isAfter:function(e,t){return t=T("undefined"!=typeof t?t:"millisecond"),"millisecond"===t?(e=ft.isMoment(e)?e:ft(e),+this>+e):+this.clone().startOf(t)>+ft(e).startOf(t)},isBefore:function(e,t){return t=T("undefined"!=typeof t?t:"millisecond"),"millisecond"===t?(e=ft.isMoment(e)?e:ft(e),+e>+this):+this.clone().startOf(t)<+ft(e).startOf(t)},isSame:function(e,t){return t=T(t||"millisecond"),"millisecond"===t?(e=ft.isMoment(e)?e:ft(e),+this===+e):+this.clone().startOf(t)===+A(e,this).startOf(t)},min:s("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(e){return e=ft.apply(null,arguments),this>e?this:e}),max:s("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(e){return e=ft.apply(null,arguments),e>this?this:e}),zone:function(e,t){var a,n=this._offset||0;return null==e?this._isUTC?n:this._dateTzOffset():("string"==typeof e&&(e=I(e)),Math.abs(e)<16&&(e=60*e),!this._isUTC&&t&&(a=this._dateTzOffset()),this._offset=e,this._isUTC=!0,null!=a&&this.subtract(a,"m"),n!==e&&(!t||this._changeInProgress?f(this,ft.duration(n-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,ft.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(e){return e=e?ft(e).zone():0,(this.zone()-e)%60===0},daysInMonth:function(){return b(this.year(),this.month())},dayOfYear:function(e){var t=gt((ft(this).startOf("day")-ft(this).startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},quarter:function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},weekYear:function(e){var t=dt(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==e?t:this.add(e-t,"y")},isoWeekYear:function(e){var t=dt(this,1,4).year;return null==e?t:this.add(e-t,"y")},week:function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},isoWeek:function(e){var t=dt(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},weekday:function(e){var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},isoWeekday:function(e){return null==e?this.day()||7:this.day(this.day()%7?e:e-7)},isoWeeksInYear:function(){return S(this.year(),1,4)},weeksInYear:function(){var e=this.localeData()._week;return S(this.year(),e.dow,e.doy)},get:function(e){return e=T(e),this[e]()},set:function(e,t){return e=T(e),"function"==typeof this[e]&&this[e](t),this},locale:function(t){var a;return t===e?this._locale._abbr:(a=ft.localeData(t),null!=a&&(this._locale=a),this)},lang:s("moment().lang() is deprecated. Use moment().localeData() instead.",function(t){return t===e?this.localeData():this.locale(t)}),localeData:function(){return this._locale},_dateTzOffset:function(){return 15*Math.round(this._d.getTimezoneOffset()/15)}}),ft.fn.millisecond=ft.fn.milliseconds=ct("Milliseconds",!1),ft.fn.second=ft.fn.seconds=ct("Seconds",!1),ft.fn.minute=ft.fn.minutes=ct("Minutes",!1),ft.fn.hour=ft.fn.hours=ct("Hours",!0),ft.fn.date=ct("Date",!0),ft.fn.dates=s("dates accessor is deprecated. Use date instead.",ct("Date",!0)),ft.fn.year=ct("FullYear",!0),ft.fn.years=s("years accessor is deprecated. Use year instead.",ct("FullYear",!0)),ft.fn.days=ft.fn.day,ft.fn.months=ft.fn.month,ft.fn.weeks=ft.fn.week,ft.fn.isoWeeks=ft.fn.isoWeek,ft.fn.quarters=ft.fn.quarter,ft.fn.toJSON=ft.fn.toISOString,m(ft.duration.fn=l.prototype,{_bubble:function(){var e,t,a,n=this._milliseconds,_=this._days,s=this._months,r=this._data,d=0;r.milliseconds=n%1e3,e=c(n/1e3),r.seconds=e%60,t=c(e/60),r.minutes=t%60,a=c(t/60),r.hours=a%24,_+=c(a/24),d=c(Lt(_)),_-=c(ht(d)),s+=c(_/30),_%=30,d+=c(s/12),s%=12,r.days=_,r.months=s,r.years=d},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return c(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*v(this._months/12)},humanize:function(e){var t=rt(this,!e,this.localeData());return e&&(t=this.localeData().pastFuture(+this,t)),this.localeData().postformat(t)},add:function(e,t){var a=ft.duration(e,t);return this._milliseconds+=a._milliseconds,this._days+=a._days,this._months+=a._months,this._bubble(),this},subtract:function(e,t){var a=ft.duration(e,t);return this._milliseconds-=a._milliseconds,this._days-=a._days,this._months-=a._months,this._bubble(),this},get:function(e){return e=T(e),this[e.toLowerCase()+"s"]()},as:function(e){var t,a;if(e=T(e),"month"===e||"year"===e)return t=this._days+this._milliseconds/864e5,a=this._months+12*Lt(t),"month"===e?a:a/12;switch(t=this._days+ht(this._months/12),e){case"week":return t/7+this._milliseconds/6048e5;case"day":return t+this._milliseconds/864e5;case"hour":return 24*t+this._milliseconds/36e5;case"minute":return 24*t*60+this._milliseconds/6e4;case"second":return 24*t*60*60+this._milliseconds/1e3;case"millisecond":return Math.floor(24*t*60*60*1e3)+this._milliseconds;default:throw new Error("Unknown unit "+e)}},lang:ft.fn.lang,locale:ft.fn.locale,toIsoString:s("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",function(){return this.toISOString()}),toISOString:function(){var e=Math.abs(this.years()),t=Math.abs(this.months()),a=Math.abs(this.days()),n=Math.abs(this.hours()),_=Math.abs(this.minutes()),s=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(e?e+"Y":"")+(t?t+"M":"")+(a?a+"D":"")+(n||_||s?"T":"")+(n?n+"H":"")+(_?_+"M":"")+(s?s+"S":""):"P0D"},localeData:function(){return this._locale}}),ft.duration.fn.toString=ft.duration.fn.toISOString;for(Dt in ia)a(ia,Dt)&&Yt(Dt.toLowerCase());ft.duration.fn.asMilliseconds=function(){return this.as("ms")},ft.duration.fn.asSeconds=function(){return this.as("s")},ft.duration.fn.asMinutes=function(){return this.as("m")},ft.duration.fn.asHours=function(){return this.as("h")},ft.duration.fn.asDays=function(){return this.as("d")},ft.duration.fn.asWeeks=function(){return this.as("weeks")},ft.duration.fn.asMonths=function(){return this.as("M")},ft.duration.fn.asYears=function(){return this.as("y")},ft.locale("en",{ordinal:function(e){var t=e%10,a=1===v(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th"; +return e+a}}),function(e){e(ft)}(function(e){return e.defineLocale("af",{months:"Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des".split("_"),weekdays:"Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag".split("_"),weekdaysShort:"Son_Maa_Din_Woe_Don_Vry_Sat".split("_"),weekdaysMin:"So_Ma_Di_Wo_Do_Vr_Sa".split("_"),meridiem:function(e,t,a){return 12>e?a?"vm":"VM":a?"nm":"NM"},longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Vandag om] LT",nextDay:"[Môre om] LT",nextWeek:"dddd [om] LT",lastDay:"[Gister om] LT",lastWeek:"[Laas] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oor %s",past:"%s gelede",s:"'n paar sekondes",m:"'n minuut",mm:"%d minute",h:"'n uur",hh:"%d ure",d:"'n dag",dd:"%d dae",M:"'n maand",MM:"%d maande",y:"'n jaar",yy:"%d jaar"},ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("ar-ma",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:6,doy:12}})}),function(e){e(ft)}(function(e){var t={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},a={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"};return e.defineLocale("ar-sa",{months:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},meridiem:function(e){return 12>e?"ص":"م"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},preparse:function(e){return e.replace(/[۰-۹]/g,function(e){return a[e]}).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]}).replace(/,/g,"،")},week:{dow:6,doy:12}})}),function(e){e(ft)}(function(e){var t={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},a={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},n=function(e){return 0===e?0:1===e?1:2===e?2:e%100>=3&&10>=e%100?3:e%100>=11?4:5},_={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},s=function(e){return function(t,a){var s=n(t),r=_[e][n(t)];return 2===s&&(r=r[a?0:1]),r.replace(/%d/i,t)}},r=["كانون الثاني يناير","شباط فبراير","آذار مارس","نيسان أبريل","أيار مايو","حزيران يونيو","تموز يوليو","آب أغسطس","أيلول سبتمبر","تشرين الأول أكتوبر","تشرين الثاني نوفمبر","كانون الأول ديسمبر"];return e.defineLocale("ar",{months:r,monthsShort:r,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},meridiem:function(e){return 12>e?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:s("s"),m:s("m"),mm:s("m"),h:s("h"),hh:s("h"),d:s("d"),dd:s("d"),M:s("M"),MM:s("M"),y:s("y"),yy:s("y")},preparse:function(e){return e.replace(/[۰-۹]/g,function(e){return a[e]}).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]}).replace(/,/g,"،")},week:{dow:6,doy:12}})}),function(e){e(ft)}(function(e){var t={1:"-inci",5:"-inci",8:"-inci",70:"-inci",80:"-inci",2:"-nci",7:"-nci",20:"-nci",50:"-nci",3:"-üncü",4:"-üncü",100:"-üncü",6:"-ncı",9:"-uncu",10:"-uncu",30:"-uncu",60:"-ıncı",90:"-ıncı"};return e.defineLocale("az",{months:"yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr".split("_"),monthsShort:"yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek".split("_"),weekdays:"Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə".split("_"),weekdaysShort:"Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən".split("_"),weekdaysMin:"Bz_BE_ÇA_Çə_CA_Cü_Şə".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[sabah saat] LT",nextWeek:"[gələn həftə] dddd [saat] LT",lastDay:"[dünən] LT",lastWeek:"[keçən həftə] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s əvvəl",s:"birneçə saniyyə",m:"bir dəqiqə",mm:"%d dəqiqə",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",M:"bir ay",MM:"%d ay",y:"bir il",yy:"%d il"},meridiem:function(e){return 4>e?"gecə":12>e?"səhər":17>e?"gündüz":"axşam"},ordinal:function(e){if(0===e)return e+"-ıncı";var a=e%10,n=e%100-a,_=e>=100?100:null;return e+(t[a]||t[n]||t[_])},week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){function t(e,t){var a=e.split("_");return t%10===1&&t%100!==11?a[0]:t%10>=2&&4>=t%10&&(10>t%100||t%100>=20)?a[1]:a[2]}function a(e,a,n){var _={mm:a?"хвіліна_хвіліны_хвілін":"хвіліну_хвіліны_хвілін",hh:a?"гадзіна_гадзіны_гадзін":"гадзіну_гадзіны_гадзін",dd:"дзень_дні_дзён",MM:"месяц_месяцы_месяцаў",yy:"год_гады_гадоў"};return"m"===n?a?"хвіліна":"хвіліну":"h"===n?a?"гадзіна":"гадзіну":e+" "+t(_[n],+e)}function n(e,t){var a={nominative:"студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань".split("_"),accusative:"студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня".split("_")},n=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/.test(t)?"accusative":"nominative";return a[n][e.month()]}function _(e,t){var a={nominative:"нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота".split("_"),accusative:"нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу".split("_")},n=/\[ ?[Вв] ?(?:мінулую|наступную)? ?\] ?dddd/.test(t)?"accusative":"nominative";return a[n][e.day()]}return e.defineLocale("be",{months:n,monthsShort:"студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж".split("_"),weekdays:_,weekdaysShort:"нд_пн_ат_ср_чц_пт_сб".split("_"),weekdaysMin:"нд_пн_ат_ср_чц_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., LT",LLLL:"dddd, D MMMM YYYY г., LT"},calendar:{sameDay:"[Сёння ў] LT",nextDay:"[Заўтра ў] LT",lastDay:"[Учора ў] LT",nextWeek:function(){return"[У] dddd [ў] LT"},lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return"[У мінулую] dddd [ў] LT";case 1:case 2:case 4:return"[У мінулы] dddd [ў] LT"}},sameElse:"L"},relativeTime:{future:"праз %s",past:"%s таму",s:"некалькі секунд",m:a,mm:a,h:a,hh:a,d:"дзень",dd:a,M:"месяц",MM:a,y:"год",yy:a},meridiem:function(e){return 4>e?"ночы":12>e?"раніцы":17>e?"дня":"вечара"},ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":case"w":case"W":return e%10!==2&&e%10!==3||e%100===12||e%100===13?e+"-ы":e+"-і";case"D":return e+"-га";default:return e}},week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){return e.defineLocale("bg",{months:"януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"),monthsShort:"янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"),weekdays:"неделя_понеделник_вторник_сряда_четвъртък_петък_събота".split("_"),weekdaysShort:"нед_пон_вто_сря_чет_пет_съб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"H:mm",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Днес в] LT",nextDay:"[Утре в] LT",nextWeek:"dddd [в] LT",lastDay:"[Вчера в] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[В изминалата] dddd [в] LT";case 1:case 2:case 4:case 5:return"[В изминалия] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"след %s",past:"преди %s",s:"няколко секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дни",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"},ordinal:function(e){var t=e%10,a=e%100;return 0===e?e+"-ев":0===a?e+"-ен":a>10&&20>a?e+"-ти":1===t?e+"-ви":2===t?e+"-ри":7===t||8===t?e+"-ми":e+"-ти"},week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){var t={1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"},a={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"};return e.defineLocale("bn",{months:"জানুয়ারী_ফেবুয়ারী_মার্চ_এপ্রিল_মে_জুন_জুলাই_অগাস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব_মার্চ_এপর_মে_জুন_জুল_অগ_সেপ্ট_অক্টো_নভ_ডিসেম্".split("_"),weekdays:"রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পত্তিবার_শুক্রুবার_শনিবার".split("_"),weekdaysShort:"রবি_সোম_মঙ্গল_বুধ_বৃহস্পত্তি_শুক্রু_শনি".split("_"),weekdaysMin:"রব_সম_মঙ্গ_বু_ব্রিহ_শু_শনি".split("_"),longDateFormat:{LT:"A h:mm সময়",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[আজ] LT",nextDay:"[আগামীকাল] LT",nextWeek:"dddd, LT",lastDay:"[গতকাল] LT",lastWeek:"[গত] dddd, LT",sameElse:"L"},relativeTime:{future:"%s পরে",past:"%s আগে",s:"কএক সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(e){return e.replace(/[১২৩৪৫৬৭৮৯০]/g,function(e){return a[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]})},meridiem:function(e){return 4>e?"রাত":10>e?"শকাল":17>e?"দুপুর":20>e?"বিকেল":"রাত"},week:{dow:0,doy:6}})}),function(e){e(ft)}(function(e){var t={1:"༡",2:"༢",3:"༣",4:"༤",5:"༥",6:"༦",7:"༧",8:"༨",9:"༩",0:"༠"},a={"༡":"1","༢":"2","༣":"3","༤":"4","༥":"5","༦":"6","༧":"7","༨":"8","༩":"9","༠":"0"};return e.defineLocale("bo",{months:"ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ".split("_"),monthsShort:"ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ".split("_"),weekdays:"གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་".split("_"),weekdaysShort:"ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),weekdaysMin:"ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),longDateFormat:{LT:"A h:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[དི་རིང] LT",nextDay:"[སང་ཉིན] LT",nextWeek:"[བདུན་ཕྲག་རྗེས་མ], LT",lastDay:"[ཁ་སང] LT",lastWeek:"[བདུན་ཕྲག་མཐའ་མ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ལ་",past:"%s སྔན་ལ",s:"ལམ་སང",m:"སྐར་མ་གཅིག",mm:"%d སྐར་མ",h:"ཆུ་ཚོད་གཅིག",hh:"%d ཆུ་ཚོད",d:"ཉིན་གཅིག",dd:"%d ཉིན་",M:"ཟླ་བ་གཅིག",MM:"%d ཟླ་བ",y:"ལོ་གཅིག",yy:"%d ལོ"},preparse:function(e){return e.replace(/[༡༢༣༤༥༦༧༨༩༠]/g,function(e){return a[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]})},meridiem:function(e){return 4>e?"མཚན་མོ":10>e?"ཞོགས་ཀས":17>e?"ཉིན་གུང":20>e?"དགོང་དག":"མཚན་མོ"},week:{dow:0,doy:6}})}),function(e){e(ft)}(function(t){function a(e,t,a){var n={mm:"munutenn",MM:"miz",dd:"devezh"};return e+" "+s(n[a],e)}function n(e){switch(_(e)){case 1:case 3:case 4:case 5:case 9:return e+" bloaz";default:return e+" vloaz"}}function _(e){return e>9?_(e%10):e}function s(e,t){return 2===t?r(e):e}function r(t){var a={m:"v",b:"v",d:"z"};return a[t.charAt(0)]===e?t:a[t.charAt(0)]+t.substring(1)}return t.defineLocale("br",{months:"Genver_C'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_C'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Merc'her_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),longDateFormat:{LT:"h[e]mm A",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY LT",LLLL:"dddd, D [a viz] MMMM YYYY LT"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warc'hoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Dec'h da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s 'zo",s:"un nebeud segondennoù",m:"ur vunutenn",mm:a,h:"un eur",hh:"%d eur",d:"un devezh",dd:a,M:"ur miz",MM:a,y:"ur bloaz",yy:n},ordinal:function(e){var t=1===e?"añ":"vet";return e+t},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){function t(e,t,a){var n=e+" ";switch(a){case"m":return t?"jedna minuta":"jedne minute";case"mm":return n+=1===e?"minuta":2===e||3===e||4===e?"minute":"minuta";case"h":return t?"jedan sat":"jednog sata";case"hh":return n+=1===e?"sat":2===e||3===e||4===e?"sata":"sati";case"dd":return n+=1===e?"dan":"dana";case"MM":return n+=1===e?"mjesec":2===e||3===e||4===e?"mjeseca":"mjeseci";case"yy":return n+=1===e?"godina":2===e||3===e||4===e?"godine":"godina"}}return e.defineLocale("bs",{months:"januar_februar_mart_april_maj_juni_juli_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",m:t,mm:t,h:t,hh:t,d:"dan",dd:t,M:"mjesec",MM:t,y:"godinu",yy:t},ordinal:"%d.",week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){return e.defineLocale("ca",{months:"gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),monthsShort:"gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.".split("_"),weekdays:"diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dt._dc._dj._dv._ds.".split("_"),weekdaysMin:"Dg_Dl_Dt_Dc_Dj_Dv_Ds".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[demà a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"fa %s",s:"uns segons",m:"un minut",mm:"%d minuts",h:"una hora",hh:"%d hores",d:"un dia",dd:"%d dies",M:"un mes",MM:"%d mesos",y:"un any",yy:"%d anys"},ordinal:"%dº",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){function t(e){return e>1&&5>e&&1!==~~(e/10)}function a(e,a,n,_){var s=e+" ";switch(n){case"s":return a||_?"pár sekund":"pár sekundami";case"m":return a?"minuta":_?"minutu":"minutou";case"mm":return a||_?s+(t(e)?"minuty":"minut"):s+"minutami";break;case"h":return a?"hodina":_?"hodinu":"hodinou";case"hh":return a||_?s+(t(e)?"hodiny":"hodin"):s+"hodinami";break;case"d":return a||_?"den":"dnem";case"dd":return a||_?s+(t(e)?"dny":"dní"):s+"dny";break;case"M":return a||_?"měsíc":"měsícem";case"MM":return a||_?s+(t(e)?"měsíce":"měsíců"):s+"měsíci";break;case"y":return a||_?"rok":"rokem";case"yy":return a||_?s+(t(e)?"roky":"let"):s+"lety"}}var n="leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_"),_="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_");return e.defineLocale("cs",{months:n,monthsShort:_,monthsParse:function(e,t){var a,n=[];for(a=0;12>a;a++)n[a]=new RegExp("^"+e[a]+"$|^"+t[a]+"$","i");return n}(n,_),weekdays:"neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"),weekdaysShort:"ne_po_út_st_čt_pá_so".split("_"),weekdaysMin:"ne_po_út_st_čt_pá_so".split("_"),longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd D. MMMM YYYY LT"},calendar:{sameDay:"[dnes v] LT",nextDay:"[zítra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v neděli v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve středu v] LT";case 4:return"[ve čtvrtek v] LT";case 5:return"[v pátek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[včera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou neděli v] LT";case 1:case 2:return"[minulé] dddd [v] LT";case 3:return"[minulou středu v] LT";case 4:case 5:return"[minulý] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"před %s",s:a,m:a,mm:a,h:a,hh:a,d:a,dd:a,M:a,MM:a,y:a,yy:a},ordinal:"%d.",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("cv",{months:"кăрлач_нарăс_пуш_ака_май_çĕртме_утă_çурла_авăн_юпа_чӳк_раштав".split("_"),monthsShort:"кăр_нар_пуш_ака_май_çĕр_утă_çур_ав_юпа_чӳк_раш".split("_"),weekdays:"вырсарникун_тунтикун_ытларикун_юнкун_кĕçнерникун_эрнекун_шăматкун".split("_"),weekdaysShort:"выр_тун_ытл_юн_кĕç_эрн_шăм".split("_"),weekdaysMin:"вр_тн_ыт_юн_кç_эр_шм".split("_"),longDateFormat:{LT:"HH:mm",L:"DD-MM-YYYY",LL:"YYYY [çулхи] MMMM [уйăхĕн] D[-мĕшĕ]",LLL:"YYYY [çулхи] MMMM [уйăхĕн] D[-мĕшĕ], LT",LLLL:"dddd, YYYY [çулхи] MMMM [уйăхĕн] D[-мĕшĕ], LT"},calendar:{sameDay:"[Паян] LT [сехетре]",nextDay:"[Ыран] LT [сехетре]",lastDay:"[Ĕнер] LT [сехетре]",nextWeek:"[Çитес] dddd LT [сехетре]",lastWeek:"[Иртнĕ] dddd LT [сехетре]",sameElse:"L"},relativeTime:{future:function(e){var t=/сехет$/i.exec(e)?"рен":/çул$/i.exec(e)?"тан":"ран";return e+t},past:"%s каялла",s:"пĕр-ик çеккунт",m:"пĕр минут",mm:"%d минут",h:"пĕр сехет",hh:"%d сехет",d:"пĕр кун",dd:"%d кун",M:"пĕр уйăх",MM:"%d уйăх",y:"пĕр çул",yy:"%d çул"},ordinal:"%d-мĕш",week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){return e.defineLocale("cy",{months:"Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr".split("_"),monthsShort:"Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag".split("_"),weekdays:"Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn".split("_"),weekdaysShort:"Sul_Llun_Maw_Mer_Iau_Gwe_Sad".split("_"),weekdaysMin:"Su_Ll_Ma_Me_Ia_Gw_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Heddiw am] LT",nextDay:"[Yfory am] LT",nextWeek:"dddd [am] LT",lastDay:"[Ddoe am] LT",lastWeek:"dddd [diwethaf am] LT",sameElse:"L"},relativeTime:{future:"mewn %s",past:"%s yn ôl",s:"ychydig eiliadau",m:"munud",mm:"%d munud",h:"awr",hh:"%d awr",d:"diwrnod",dd:"%d diwrnod",M:"mis",MM:"%d mis",y:"blwyddyn",yy:"%d flynedd"},ordinal:function(e){var t=e,a="",n=["","af","il","ydd","ydd","ed","ed","ed","fed","fed","fed","eg","fed","eg","eg","fed","eg","eg","fed","eg","fed"];return t>20?a=40===t||50===t||60===t||80===t||100===t?"fed":"ain":t>0&&(a=n[t]),e+a},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("da",{months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn_man_tir_ons_tor_fre_lør".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd [d.] D. MMMM YYYY LT"},calendar:{sameDay:"[I dag kl.] LT",nextDay:"[I morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[I går kl.] LT",lastWeek:"[sidste] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"få sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en måned",MM:"%d måneder",y:"et år",yy:"%d år"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){function t(e,t,a){var n={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[e+" Tage",e+" Tagen"],M:["ein Monat","einem Monat"],MM:[e+" Monate",e+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[e+" Jahre",e+" Jahren"]};return t?n[a][0]:n[a][1]}return e.defineLocale("de-at",{months:"Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jän._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm [Uhr]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[Heute um] LT",sameElse:"L",nextDay:"[Morgen um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gestern um] LT",lastWeek:"[letzten] dddd [um] LT"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",m:t,mm:"%d Minuten",h:t,hh:"%d Stunden",d:t,dd:t,M:t,MM:t,y:t,yy:t},ordinal:"%d.",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){function t(e,t,a){var n={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[e+" Tage",e+" Tagen"],M:["ein Monat","einem Monat"],MM:[e+" Monate",e+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[e+" Jahre",e+" Jahren"]};return t?n[a][0]:n[a][1]}return e.defineLocale("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm [Uhr]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[Heute um] LT",sameElse:"L",nextDay:"[Morgen um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gestern um] LT",lastWeek:"[letzten] dddd [um] LT"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",m:t,mm:"%d Minuten",h:t,hh:"%d Stunden",d:t,dd:t,M:t,MM:t,y:t,yy:t},ordinal:"%d.",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("el",{monthsNominativeEl:"Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"),monthsGenitiveEl:"Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"),months:function(e,t){return/D/.test(t.substring(0,t.indexOf("MMMM")))?this._monthsGenitiveEl[e.month()]:this._monthsNominativeEl[e.month()]},monthsShort:"Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ".split("_"),weekdays:"Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο".split("_"),weekdaysShort:"Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ".split("_"),weekdaysMin:"Κυ_Δε_Τρ_Τε_Πε_Πα_Σα".split("_"),meridiem:function(e,t,a){return e>11?a?"μμ":"ΜΜ":a?"πμ":"ΠΜ"},isPM:function(e){return"μ"===(e+"").toLowerCase()[0]},meridiemParse:/[ΠΜ]\.?Μ?\.?/i,longDateFormat:{LT:"h:mm A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendarEl:{sameDay:"[Σήμερα {}] LT",nextDay:"[Αύριο {}] LT",nextWeek:"dddd [{}] LT",lastDay:"[Χθες {}] LT",lastWeek:function(){switch(this.day()){case 6:return"[το προηγούμενο] dddd [{}] LT";default:return"[την προηγούμενη] dddd [{}] LT"}},sameElse:"L"},calendar:function(e,t){var a=this._calendarEl[e],n=t&&t.hours();return"function"==typeof a&&(a=a.apply(t)),a.replace("{}",n%12===1?"στη":"στις")},relativeTime:{future:"σε %s",past:"%s πριν",s:"δευτερόλεπτα",m:"ένα λεπτό",mm:"%d λεπτά",h:"μία ώρα",hh:"%d ώρες",d:"μία μέρα",dd:"%d μέρες",M:"ένας μήνας",MM:"%d μήνες",y:"ένας χρόνος",yy:"%d χρόνια"},ordinal:function(e){return e+"η"},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("en-au",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(e){var t=e%10,a=1===~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+a},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("en-ca",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",L:"YYYY-MM-DD",LL:"D MMMM, YYYY",LLL:"D MMMM, YYYY LT",LLLL:"dddd, D MMMM, YYYY LT"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(e){var t=e%10,a=1===~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+a}})}),function(e){e(ft)}(function(e){return e.defineLocale("en-gb",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(e){var t=e%10,a=1===~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+a},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("eo",{months:"januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec".split("_"),weekdays:"Dimanĉo_Lundo_Mardo_Merkredo_Ĵaŭdo_Vendredo_Sabato".split("_"),weekdaysShort:"Dim_Lun_Mard_Merk_Ĵaŭ_Ven_Sab".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Ĵa_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"D[-an de] MMMM, YYYY",LLL:"D[-an de] MMMM, YYYY LT",LLLL:"dddd, [la] D[-an de] MMMM, YYYY LT"},meridiem:function(e,t,a){return e>11?a?"p.t.m.":"P.T.M.":a?"a.t.m.":"A.T.M."},calendar:{sameDay:"[Hodiaŭ je] LT",nextDay:"[Morgaŭ je] LT",nextWeek:"dddd [je] LT",lastDay:"[Hieraŭ je] LT",lastWeek:"[pasinta] dddd [je] LT",sameElse:"L"},relativeTime:{future:"je %s",past:"antaŭ %s",s:"sekundoj",m:"minuto",mm:"%d minutoj",h:"horo",hh:"%d horoj",d:"tago",dd:"%d tagoj",M:"monato",MM:"%d monatoj",y:"jaro",yy:"%d jaroj"},ordinal:"%da",week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){var t="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),a="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_");return e.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,n){return/-MMM-/.test(n)?a[e.month()]:t[e.month()]},weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"Do_Lu_Ma_Mi_Ju_Vi_Sá".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY LT",LLLL:"dddd, D [de] MMMM [de] YYYY LT"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinal:"%dº",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){function t(e,t,a,n){var _={s:["mõne sekundi","mõni sekund","paar sekundit"],m:["ühe minuti","üks minut"],mm:[e+" minuti",e+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[e+" tunni",e+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[e+" kuu",e+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[e+" aasta",e+" aastat"]};return t?_[a][2]?_[a][2]:_[a][1]:n?_[a][0]:_[a][1]}return e.defineLocale("et",{months:"jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),monthsShort:"jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),weekdays:"pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev".split("_"),weekdaysShort:"P_E_T_K_N_R_L".split("_"),weekdaysMin:"P_E_T_K_N_R_L".split("_"),longDateFormat:{LT:"H:mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[Täna,] LT",nextDay:"[Homme,] LT",nextWeek:"[Järgmine] dddd LT",lastDay:"[Eile,] LT",lastWeek:"[Eelmine] dddd LT",sameElse:"L"},relativeTime:{future:"%s pärast",past:"%s tagasi",s:t,m:t,mm:t,h:t,hh:t,d:t,dd:"%d päeva",M:t,MM:t,y:t,yy:t},ordinal:"%d.",week:{dow:1,doy:4}}) +}),function(e){e(ft)}(function(e){return e.defineLocale("eu",{months:"urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),monthsShort:"urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),weekdays:"igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),weekdaysShort:"ig._al._ar._az._og._ol._lr.".split("_"),weekdaysMin:"ig_al_ar_az_og_ol_lr".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"YYYY[ko] MMMM[ren] D[a]",LLL:"YYYY[ko] MMMM[ren] D[a] LT",LLLL:"dddd, YYYY[ko] MMMM[ren] D[a] LT",l:"YYYY-M-D",ll:"YYYY[ko] MMM D[a]",lll:"YYYY[ko] MMM D[a] LT",llll:"ddd, YYYY[ko] MMM D[a] LT"},calendar:{sameDay:"[gaur] LT[etan]",nextDay:"[bihar] LT[etan]",nextWeek:"dddd LT[etan]",lastDay:"[atzo] LT[etan]",lastWeek:"[aurreko] dddd LT[etan]",sameElse:"L"},relativeTime:{future:"%s barru",past:"duela %s",s:"segundo batzuk",m:"minutu bat",mm:"%d minutu",h:"ordu bat",hh:"%d ordu",d:"egun bat",dd:"%d egun",M:"hilabete bat",MM:"%d hilabete",y:"urte bat",yy:"%d urte"},ordinal:"%d.",week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){var t={1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"},a={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"};return e.defineLocale("fa",{months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),weekdays:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysShort:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},meridiem:function(e){return 12>e?"قبل از ظهر":"بعد از ظهر"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [پیش] [ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چندین ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"},preparse:function(e){return e.replace(/[۰-۹]/g,function(e){return a[e]}).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]}).replace(/,/g,"،")},ordinal:"%dم",week:{dow:6,doy:12}})}),function(e){e(ft)}(function(e){function t(e,t,n,_){var s="";switch(n){case"s":return _?"muutaman sekunnin":"muutama sekunti";case"m":return _?"minuutin":"minuutti";case"mm":s=_?"minuutin":"minuuttia";break;case"h":return _?"tunnin":"tunti";case"hh":s=_?"tunnin":"tuntia";break;case"d":return _?"päivän":"päivä";case"dd":s=_?"päivän":"päivää";break;case"M":return _?"kuukauden":"kuukausi";case"MM":s=_?"kuukauden":"kuukautta";break;case"y":return _?"vuoden":"vuosi";case"yy":s=_?"vuoden":"vuotta"}return s=a(e,_)+" "+s}function a(e,t){return 10>e?t?_[e]:n[e]:e}var n="nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän".split(" "),_=["nolla","yhden","kahden","kolmen","neljän","viiden","kuuden",n[7],n[8],n[9]];return e.defineLocale("fi",{months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),longDateFormat:{LT:"HH.mm",L:"DD.MM.YYYY",LL:"Do MMMM[ta] YYYY",LLL:"Do MMMM[ta] YYYY, [klo] LT",LLLL:"dddd, Do MMMM[ta] YYYY, [klo] LT",l:"D.M.YYYY",ll:"Do MMM YYYY",lll:"Do MMM YYYY, [klo] LT",llll:"ddd, Do MMM YYYY, [klo] LT"},calendar:{sameDay:"[tänään] [klo] LT",nextDay:"[huomenna] [klo] LT",nextWeek:"dddd [klo] LT",lastDay:"[eilen] [klo] LT",lastWeek:"[viime] dddd[na] [klo] LT",sameElse:"L"},relativeTime:{future:"%s päästä",past:"%s sitten",s:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},ordinal:"%d.",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("fo",{months:"januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur".split("_"),weekdaysShort:"sun_mán_týs_mik_hós_frí_ley".split("_"),weekdaysMin:"su_má_tý_mi_hó_fr_le".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D. MMMM, YYYY LT"},calendar:{sameDay:"[Í dag kl.] LT",nextDay:"[Í morgin kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[Í gjár kl.] LT",lastWeek:"[síðstu] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"um %s",past:"%s síðani",s:"fá sekund",m:"ein minutt",mm:"%d minuttir",h:"ein tími",hh:"%d tímar",d:"ein dagur",dd:"%d dagar",M:"ein mánaði",MM:"%d mánaðir",y:"eitt ár",yy:"%d ár"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("fr-ca",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(e){return e+(1===e?"er":"")}})}),function(e){e(ft)}(function(e){return e.defineLocale("fr",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(e){return e+(1===e?"er":"")},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("gl",{months:"Xaneiro_Febreiro_Marzo_Abril_Maio_Xuño_Xullo_Agosto_Setembro_Outubro_Novembro_Decembro".split("_"),monthsShort:"Xan._Feb._Mar._Abr._Mai._Xuñ._Xul._Ago._Set._Out._Nov._Dec.".split("_"),weekdays:"Domingo_Luns_Martes_Mércores_Xoves_Venres_Sábado".split("_"),weekdaysShort:"Dom._Lun._Mar._Mér._Xov._Ven._Sáb.".split("_"),weekdaysMin:"Do_Lu_Ma_Mé_Xo_Ve_Sá".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:function(){return"[hoxe "+(1!==this.hours()?"ás":"á")+"] LT"},nextDay:function(){return"[mañá "+(1!==this.hours()?"ás":"á")+"] LT"},nextWeek:function(){return"dddd ["+(1!==this.hours()?"ás":"a")+"] LT"},lastDay:function(){return"[onte "+(1!==this.hours()?"á":"a")+"] LT"},lastWeek:function(){return"[o] dddd [pasado "+(1!==this.hours()?"ás":"a")+"] LT"},sameElse:"L"},relativeTime:{future:function(e){return"uns segundos"===e?"nuns segundos":"en "+e},past:"hai %s",s:"uns segundos",m:"un minuto",mm:"%d minutos",h:"unha hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un ano",yy:"%d anos"},ordinal:"%dº",week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){return e.defineLocale("he",{months:"ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"),monthsShort:"ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳".split("_"),weekdays:"ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת".split("_"),weekdaysShort:"א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳".split("_"),weekdaysMin:"א_ב_ג_ד_ה_ו_ש".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D [ב]MMMM YYYY",LLL:"D [ב]MMMM YYYY LT",LLLL:"dddd, D [ב]MMMM YYYY LT",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY LT",llll:"ddd, D MMM YYYY LT"},calendar:{sameDay:"[היום ב־]LT",nextDay:"[מחר ב־]LT",nextWeek:"dddd [בשעה] LT",lastDay:"[אתמול ב־]LT",lastWeek:"[ביום] dddd [האחרון בשעה] LT",sameElse:"L"},relativeTime:{future:"בעוד %s",past:"לפני %s",s:"מספר שניות",m:"דקה",mm:"%d דקות",h:"שעה",hh:function(e){return 2===e?"שעתיים":e+" שעות"},d:"יום",dd:function(e){return 2===e?"יומיים":e+" ימים"},M:"חודש",MM:function(e){return 2===e?"חודשיים":e+" חודשים"},y:"שנה",yy:function(e){return 2===e?"שנתיים":e+" שנים"}}})}),function(e){e(ft)}(function(e){var t={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},a={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};return e.defineLocale("hi",{months:"जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर".split("_"),monthsShort:"जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.".split("_"),weekdays:"रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[आज] LT",nextDay:"[कल] LT",nextWeek:"dddd, LT",lastDay:"[कल] LT",lastWeek:"[पिछले] dddd, LT",sameElse:"L"},relativeTime:{future:"%s में",past:"%s पहले",s:"कुछ ही क्षण",m:"एक मिनट",mm:"%d मिनट",h:"एक घंटा",hh:"%d घंटे",d:"एक दिन",dd:"%d दिन",M:"एक महीने",MM:"%d महीने",y:"एक वर्ष",yy:"%d वर्ष"},preparse:function(e){return e.replace(/[१२३४५६७८९०]/g,function(e){return a[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]})},meridiem:function(e){return 4>e?"रात":10>e?"सुबह":17>e?"दोपहर":20>e?"शाम":"रात"},week:{dow:0,doy:6}})}),function(e){e(ft)}(function(e){function t(e,t,a){var n=e+" ";switch(a){case"m":return t?"jedna minuta":"jedne minute";case"mm":return n+=1===e?"minuta":2===e||3===e||4===e?"minute":"minuta";case"h":return t?"jedan sat":"jednog sata";case"hh":return n+=1===e?"sat":2===e||3===e||4===e?"sata":"sati";case"dd":return n+=1===e?"dan":"dana";case"MM":return n+=1===e?"mjesec":2===e||3===e||4===e?"mjeseca":"mjeseci";case"yy":return n+=1===e?"godina":2===e||3===e||4===e?"godine":"godina"}}return e.defineLocale("hr",{months:"sječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac".split("_"),monthsShort:"sje._vel._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.".split("_"),weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",m:t,mm:t,h:t,hh:t,d:"dan",dd:t,M:"mjesec",MM:t,y:"godinu",yy:t},ordinal:"%d.",week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){function t(e,t,a,n){var _=e;switch(a){case"s":return n||t?"néhány másodperc":"néhány másodperce";case"m":return"egy"+(n||t?" perc":" perce");case"mm":return _+(n||t?" perc":" perce");case"h":return"egy"+(n||t?" óra":" órája");case"hh":return _+(n||t?" óra":" órája");case"d":return"egy"+(n||t?" nap":" napja");case"dd":return _+(n||t?" nap":" napja");case"M":return"egy"+(n||t?" hónap":" hónapja");case"MM":return _+(n||t?" hónap":" hónapja");case"y":return"egy"+(n||t?" év":" éve");case"yy":return _+(n||t?" év":" éve")}return""}function a(e){return(e?"":"[múlt] ")+"["+n[this.day()]+"] LT[-kor]"}var n="vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ");return e.defineLocale("hu",{months:"január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),monthsShort:"jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec".split("_"),weekdays:"vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),weekdaysShort:"vas_hét_kedd_sze_csüt_pén_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),longDateFormat:{LT:"H:mm",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D., LT",LLLL:"YYYY. MMMM D., dddd LT"},meridiem:function(e,t,a){return 12>e?a===!0?"de":"DE":a===!0?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return a.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return a.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s múlva",past:"%s",s:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},ordinal:"%d.",week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){function t(e,t){var a={nominative:"հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր".split("_"),accusative:"հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի".split("_")},n=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/.test(t)?"accusative":"nominative";return a[n][e.month()]}function a(e){var t="հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ".split("_");return t[e.month()]}function n(e){var t="կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ".split("_");return t[e.day()]}return e.defineLocale("hy-am",{months:t,monthsShort:a,weekdays:n,weekdaysShort:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),weekdaysMin:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY թ.",LLL:"D MMMM YYYY թ., LT",LLLL:"dddd, D MMMM YYYY թ., LT"},calendar:{sameDay:"[այսօր] LT",nextDay:"[վաղը] LT",lastDay:"[երեկ] LT",nextWeek:function(){return"dddd [օրը ժամը] LT"},lastWeek:function(){return"[անցած] dddd [օրը ժամը] LT"},sameElse:"L"},relativeTime:{future:"%s հետո",past:"%s առաջ",s:"մի քանի վայրկյան",m:"րոպե",mm:"%d րոպե",h:"ժամ",hh:"%d ժամ",d:"օր",dd:"%d օր",M:"ամիս",MM:"%d ամիս",y:"տարի",yy:"%d տարի"},meridiem:function(e){return 4>e?"գիշերվա":12>e?"առավոտվա":17>e?"ցերեկվա":"երեկոյան"},ordinal:function(e,t){switch(t){case"DDD":case"w":case"W":case"DDDo":return 1===e?e+"-ին":e+"-րդ";default:return e}},week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){return e.defineLocale("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des".split("_"),weekdays:"Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu".split("_"),weekdaysShort:"Min_Sen_Sel_Rab_Kam_Jum_Sab".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] LT",LLLL:"dddd, D MMMM YYYY [pukul] LT"},meridiem:function(e){return 11>e?"pagi":15>e?"siang":19>e?"sore":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Besok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kemarin pukul] LT",lastWeek:"dddd [lalu pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lalu",s:"beberapa detik",m:"semenit",mm:"%d menit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){function t(e){return e%100===11?!0:e%10===1?!1:!0}function a(e,a,n,_){var s=e+" ";switch(n){case"s":return a||_?"nokkrar sekúndur":"nokkrum sekúndum";case"m":return a?"mínúta":"mínútu";case"mm":return t(e)?s+(a||_?"mínútur":"mínútum"):a?s+"mínúta":s+"mínútu";case"hh":return t(e)?s+(a||_?"klukkustundir":"klukkustundum"):s+"klukkustund";case"d":return a?"dagur":_?"dag":"degi";case"dd":return t(e)?a?s+"dagar":s+(_?"daga":"dögum"):a?s+"dagur":s+(_?"dag":"degi");case"M":return a?"mánuður":_?"mánuð":"mánuði";case"MM":return t(e)?a?s+"mánuðir":s+(_?"mánuði":"mánuðum"):a?s+"mánuður":s+(_?"mánuð":"mánuði");case"y":return a||_?"ár":"ári";case"yy":return t(e)?s+(a||_?"ár":"árum"):s+(a||_?"ár":"ári")}}return e.defineLocale("is",{months:"janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember".split("_"),monthsShort:"jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des".split("_"),weekdays:"sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur".split("_"),weekdaysShort:"sun_mán_þri_mið_fim_fös_lau".split("_"),weekdaysMin:"Su_Má_Þr_Mi_Fi_Fö_La".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] LT",LLLL:"dddd, D. MMMM YYYY [kl.] LT"},calendar:{sameDay:"[í dag kl.] LT",nextDay:"[á morgun kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[í gær kl.] LT",lastWeek:"[síðasta] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"eftir %s",past:"fyrir %s síðan",s:a,m:a,mm:a,h:"klukkustund",hh:a,d:a,dd:a,M:a,MM:a,y:a,yy:a},ordinal:"%d.",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("it",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato".split("_"),weekdaysShort:"Dom_Lun_Mar_Mer_Gio_Ven_Sab".split("_"),weekdaysMin:"D_L_Ma_Me_G_V_S".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Oggi alle] LT",nextDay:"[Domani alle] LT",nextWeek:"dddd [alle] LT",lastDay:"[Ieri alle] LT",lastWeek:"[lo scorso] dddd [alle] LT",sameElse:"L"},relativeTime:{future:function(e){return(/^[0-9].+$/.test(e)?"tra":"in")+" "+e},past:"%s fa",s:"alcuni secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinal:"%dº",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("ja",{months:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),weekdaysShort:"日_月_火_水_木_金_土".split("_"),weekdaysMin:"日_月_火_水_木_金_土".split("_"),longDateFormat:{LT:"Ah時m分",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日LT",LLLL:"YYYY年M月D日LT dddd"},meridiem:function(e){return 12>e?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:"[来週]dddd LT",lastDay:"[昨日] LT",lastWeek:"[前週]dddd LT",sameElse:"L"},relativeTime:{future:"%s後",past:"%s前",s:"数秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}})}),function(e){e(ft)}(function(e){function t(e,t){var a={nominative:"იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი".split("_"),accusative:"იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს".split("_")},n=/D[oD] *MMMM?/.test(t)?"accusative":"nominative";return a[n][e.month()]}function a(e,t){var a={nominative:"კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი".split("_"),accusative:"კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს".split("_")},n=/(წინა|შემდეგ)/.test(t)?"accusative":"nominative";return a[n][e.day()]}return e.defineLocale("ka",{months:t,monthsShort:"იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ".split("_"),weekdays:a,weekdaysShort:"კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ".split("_"),weekdaysMin:"კვ_ორ_სა_ოთ_ხუ_პა_შა".split("_"),longDateFormat:{LT:"h:mm A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[დღეს] LT[-ზე]",nextDay:"[ხვალ] LT[-ზე]",lastDay:"[გუშინ] LT[-ზე]",nextWeek:"[შემდეგ] dddd LT[-ზე]",lastWeek:"[წინა] dddd LT-ზე",sameElse:"L"},relativeTime:{future:function(e){return/(წამი|წუთი|საათი|წელი)/.test(e)?e.replace(/ი$/,"ში"):e+"ში"},past:function(e){return/(წამი|წუთი|საათი|დღე|თვე)/.test(e)?e.replace(/(ი|ე)$/,"ის წინ"):/წელი/.test(e)?e.replace(/წელი$/,"წლის წინ"):void 0},s:"რამდენიმე წამი",m:"წუთი",mm:"%d წუთი",h:"საათი",hh:"%d საათი",d:"დღე",dd:"%d დღე",M:"თვე",MM:"%d თვე",y:"წელი",yy:"%d წელი"},ordinal:function(e){return 0===e?e:1===e?e+"-ლი":20>e||100>=e&&e%20===0||e%100===0?"მე-"+e:e+"-ე"},week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){return e.defineLocale("km",{months:"មករា_កុម្ភៈ_មិនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),monthsShort:"មករា_កុម្ភៈ_មិនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),weekdays:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),weekdaysShort:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),weekdaysMin:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[ថ្ងៃនៈ ម៉ោង] LT",nextDay:"[ស្អែក ម៉ោង] LT",nextWeek:"dddd [ម៉ោង] LT",lastDay:"[ម្សិលមិញ ម៉ោង] LT",lastWeek:"dddd [សប្តាហ៍មុន] [ម៉ោង] LT",sameElse:"L"},relativeTime:{future:"%sទៀត",past:"%sមុន",s:"ប៉ុន្មានវិនាទី",m:"មួយនាទី",mm:"%d នាទី",h:"មួយម៉ោង",hh:"%d ម៉ោង",d:"មួយថ្ងៃ",dd:"%d ថ្ងៃ",M:"មួយខែ",MM:"%d ខែ",y:"មួយឆ្នាំ",yy:"%d ឆ្នាំ"},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("ko",{months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),longDateFormat:{LT:"A h시 m분",L:"YYYY.MM.DD",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 LT",LLLL:"YYYY년 MMMM D일 dddd LT"},meridiem:function(e){return 12>e?"오전":"오후"},calendar:{sameDay:"오늘 LT",nextDay:"내일 LT",nextWeek:"dddd LT",lastDay:"어제 LT",lastWeek:"지난주 dddd LT",sameElse:"L"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇초",ss:"%d초",m:"일분",mm:"%d분",h:"한시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한달",MM:"%d달",y:"일년",yy:"%d년"},ordinal:"%d일",meridiemParse:/(오전|오후)/,isPM:function(e){return"오후"===e}})}),function(e){e(ft)}(function(e){function t(e,t,a){var n={m:["eng Minutt","enger Minutt"],h:["eng Stonn","enger Stonn"],d:["een Dag","engem Dag"],M:["ee Mount","engem Mount"],y:["ee Joer","engem Joer"]};return t?n[a][0]:n[a][1]}function a(e){var t=e.substr(0,e.indexOf(" "));return _(t)?"a "+e:"an "+e}function n(e){var t=e.substr(0,e.indexOf(" "));return _(t)?"viru "+e:"virun "+e}function _(e){if(e=parseInt(e,10),isNaN(e))return!1;if(0>e)return!0;if(10>e)return e>=4&&7>=e?!0:!1;if(100>e){var t=e%10,a=e/10;return _(0===t?a:t)}if(1e4>e){for(;e>=10;)e/=10;return _(e)}return e/=1e3,_(e)}return e.defineLocale("lb",{months:"Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),weekdays:"Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),weekdaysShort:"So._Mé._Dë._Më._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mé_Dë_Më_Do_Fr_Sa".split("_"),longDateFormat:{LT:"H:mm [Auer]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[Haut um] LT",sameElse:"L",nextDay:"[Muer um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gëschter um] LT",lastWeek:function(){switch(this.day()){case 2:case 4:return"[Leschten] dddd [um] LT";default:return"[Leschte] dddd [um] LT"}}},relativeTime:{future:a,past:n,s:"e puer Sekonnen",m:t,mm:"%d Minutten",h:t,hh:"%d Stonnen",d:t,dd:"%d Deeg",M:t,MM:"%d Méint",y:t,yy:"%d Joer"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){function t(e,t,a,n){return t?"kelios sekundės":n?"kelių sekundžių":"kelias sekundes"}function a(e,t,a,n){return t?_(a)[0]:n?_(a)[1]:_(a)[2]}function n(e){return e%10===0||e>10&&20>e}function _(e){return d[e].split("_")}function s(e,t,s,r){var d=e+" ";return 1===e?d+a(e,t,s[0],r):t?d+(n(e)?_(s)[1]:_(s)[0]):r?d+_(s)[1]:d+(n(e)?_(s)[1]:_(s)[2])}function r(e,t){var a=-1===t.indexOf("dddd HH:mm"),n=i[e.day()];return a?n:n.substring(0,n.length-2)+"į"}var d={m:"minutė_minutės_minutę",mm:"minutės_minučių_minutes",h:"valanda_valandos_valandą",hh:"valandos_valandų_valandas",d:"diena_dienos_dieną",dd:"dienos_dienų_dienas",M:"mėnuo_mėnesio_mėnesį",MM:"mėnesiai_mėnesių_mėnesius",y:"metai_metų_metus",yy:"metai_metų_metus"},i="sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis".split("_");return e.defineLocale("lt",{months:"sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio".split("_"),monthsShort:"sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd".split("_"),weekdays:r,weekdaysShort:"Sek_Pir_Ant_Tre_Ket_Pen_Šeš".split("_"),weekdaysMin:"S_P_A_T_K_Pn_Š".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"YYYY [m.] MMMM D [d.]",LLL:"YYYY [m.] MMMM D [d.], LT [val.]",LLLL:"YYYY [m.] MMMM D [d.], dddd, LT [val.]",l:"YYYY-MM-DD",ll:"YYYY [m.] MMMM D [d.]",lll:"YYYY [m.] MMMM D [d.], LT [val.]",llll:"YYYY [m.] MMMM D [d.], ddd, LT [val.]"},calendar:{sameDay:"[Šiandien] LT",nextDay:"[Rytoj] LT",nextWeek:"dddd LT",lastDay:"[Vakar] LT",lastWeek:"[Praėjusį] dddd LT",sameElse:"L"},relativeTime:{future:"po %s",past:"prieš %s",s:t,m:a,mm:s,h:a,hh:s,d:a,dd:s,M:a,MM:s,y:a,yy:s},ordinal:function(e){return e+"-oji"},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){function t(e,t,a){var n=e.split("_");return a?t%10===1&&11!==t?n[2]:n[3]:t%10===1&&11!==t?n[0]:n[1]}function a(e,a,_){return e+" "+t(n[_],e,a)}var n={mm:"minūti_minūtes_minūte_minūtes",hh:"stundu_stundas_stunda_stundas",dd:"dienu_dienas_diena_dienas",MM:"mēnesi_mēnešus_mēnesis_mēneši",yy:"gadu_gadus_gads_gadi"};return e.defineLocale("lv",{months:"janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"),monthsShort:"jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"),weekdays:"svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena".split("_"),weekdaysShort:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysMin:"Sv_P_O_T_C_Pk_S".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"YYYY. [gada] D. MMMM",LLL:"YYYY. [gada] D. MMMM, LT",LLLL:"YYYY. [gada] D. MMMM, dddd, LT"},calendar:{sameDay:"[Šodien pulksten] LT",nextDay:"[Rīt pulksten] LT",nextWeek:"dddd [pulksten] LT",lastDay:"[Vakar pulksten] LT",lastWeek:"[Pagājušā] dddd [pulksten] LT",sameElse:"L"},relativeTime:{future:"%s vēlāk",past:"%s agrāk",s:"dažas sekundes",m:"minūti",mm:a,h:"stundu",hh:a,d:"dienu",dd:a,M:"mēnesi",MM:a,y:"gadu",yy:a},ordinal:"%d.",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("mk",{months:"јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември".split("_"),monthsShort:"јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек".split("_"),weekdays:"недела_понеделник_вторник_среда_четврток_петок_сабота".split("_"),weekdaysShort:"нед_пон_вто_сре_чет_пет_саб".split("_"),weekdaysMin:"нe_пo_вт_ср_че_пе_сa".split("_"),longDateFormat:{LT:"H:mm",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Денес во] LT",nextDay:"[Утре во] LT",nextWeek:"dddd [во] LT",lastDay:"[Вчера во] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Во изминатата] dddd [во] LT";case 1:case 2:case 4:case 5:return"[Во изминатиот] dddd [во] LT"}},sameElse:"L"},relativeTime:{future:"после %s",past:"пред %s",s:"неколку секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дена",M:"месец",MM:"%d месеци",y:"година",yy:"%d години"},ordinal:function(e){var t=e%10,a=e%100;return 0===e?e+"-ев":0===a?e+"-ен":a>10&&20>a?e+"-ти":1===t?e+"-ви":2===t?e+"-ри":7===t||8===t?e+"-ми":e+"-ти"},week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){return e.defineLocale("ml",{months:"ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ".split("_"),monthsShort:"ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.".split("_"),weekdays:"ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച".split("_"),weekdaysShort:"ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി".split("_"),weekdaysMin:"ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ".split("_"),longDateFormat:{LT:"A h:mm -നു",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[ഇന്ന്] LT",nextDay:"[നാളെ] LT",nextWeek:"dddd, LT",lastDay:"[ഇന്നലെ] LT",lastWeek:"[കഴിഞ്ഞ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s കഴിഞ്ഞ്",past:"%s മുൻപ്",s:"അൽപ നിമിഷങ്ങൾ",m:"ഒരു മിനിറ്റ്",mm:"%d മിനിറ്റ്",h:"ഒരു മണിക്കൂർ",hh:"%d മണിക്കൂർ",d:"ഒരു ദിവസം",dd:"%d ദിവസം",M:"ഒരു മാസം",MM:"%d മാസം",y:"ഒരു വർഷം",yy:"%d വർഷം"},meridiem:function(e){return 4>e?"രാത്രി":12>e?"രാവിലെ":17>e?"ഉച്ച കഴിഞ്ഞ്":20>e?"വൈകുന്നേരം":"രാത്രി"}})}),function(e){e(ft)}(function(e){var t={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},a={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};return e.defineLocale("mr",{months:"जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),monthsShort:"जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),weekdays:"रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm वाजता",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[आज] LT",nextDay:"[उद्या] LT",nextWeek:"dddd, LT",lastDay:"[काल] LT",lastWeek:"[मागील] dddd, LT",sameElse:"L"},relativeTime:{future:"%s नंतर",past:"%s पूर्वी",s:"सेकंद",m:"एक मिनिट",mm:"%d मिनिटे",h:"एक तास",hh:"%d तास",d:"एक दिवस",dd:"%d दिवस",M:"एक महिना",MM:"%d महिने",y:"एक वर्ष",yy:"%d वर्षे"},preparse:function(e){return e.replace(/[१२३४५६७८९०]/g,function(e){return a[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]})},meridiem:function(e){return 4>e?"रात्री":10>e?"सकाळी":17>e?"दुपारी":20>e?"सायंकाळी":"रात्री"},week:{dow:0,doy:6}})}),function(e){e(ft)}(function(e){return e.defineLocale("ms-my",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] LT",LLLL:"dddd, D MMMM YYYY [pukul] LT"},meridiem:function(e){return 11>e?"pagi":15>e?"tengahari":19>e?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){var t={1:"၁",2:"၂",3:"၃",4:"၄",5:"၅",6:"၆",7:"၇",8:"၈",9:"၉",0:"၀"},a={"၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","၀":"0"}; +return e.defineLocale("my",{months:"ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ".split("_"),monthsShort:"ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ".split("_"),weekdays:"တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ".split("_"),weekdaysShort:"နွေ_လာ_င်္ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),weekdaysMin:"နွေ_လာ_င်္ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[ယနေ.] LT [မှာ]",nextDay:"[မနက်ဖြန်] LT [မှာ]",nextWeek:"dddd LT [မှာ]",lastDay:"[မနေ.က] LT [မှာ]",lastWeek:"[ပြီးခဲ့သော] dddd LT [မှာ]",sameElse:"L"},relativeTime:{future:"လာမည့် %s မှာ",past:"လွန်ခဲ့သော %s က",s:"စက္ကန်.အနည်းငယ်",m:"တစ်မိနစ်",mm:"%d မိနစ်",h:"တစ်နာရီ",hh:"%d နာရီ",d:"တစ်ရက်",dd:"%d ရက်",M:"တစ်လ",MM:"%d လ",y:"တစ်နှစ်",yy:"%d နှစ်"},preparse:function(e){return e.replace(/[၁၂၃၄၅၆၇၈၉၀]/g,function(e){return a[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]})},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("nb",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn_man_tirs_ons_tors_fre_lør".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),longDateFormat:{LT:"H.mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] LT",LLLL:"dddd D. MMMM YYYY [kl.] LT"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[forrige] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"for %s siden",s:"noen sekunder",m:"ett minutt",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dager",M:"en måned",MM:"%d måneder",y:"ett år",yy:"%d år"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){var t={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},a={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};return e.defineLocale("ne",{months:"जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर".split("_"),monthsShort:"जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.".split("_"),weekdays:"आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार".split("_"),weekdaysShort:"आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.".split("_"),weekdaysMin:"आइ._सो._मङ्_बु._बि._शु._श.".split("_"),longDateFormat:{LT:"Aको h:mm बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},preparse:function(e){return e.replace(/[१२३४५६७८९०]/g,function(e){return a[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]})},meridiem:function(e){return 3>e?"राती":10>e?"बिहान":15>e?"दिउँसो":18>e?"बेलुका":20>e?"साँझ":"राती"},calendar:{sameDay:"[आज] LT",nextDay:"[भोली] LT",nextWeek:"[आउँदो] dddd[,] LT",lastDay:"[हिजो] LT",lastWeek:"[गएको] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%sमा",past:"%s अगाडी",s:"केही समय",m:"एक मिनेट",mm:"%d मिनेट",h:"एक घण्टा",hh:"%d घण्टा",d:"एक दिन",dd:"%d दिन",M:"एक महिना",MM:"%d महिना",y:"एक बर्ष",yy:"%d बर्ष"},week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){var t="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),a="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_");return e.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(e,n){return/-MMM-/.test(n)?a[e.month()]:t[e.month()]},weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"Zo_Ma_Di_Wo_Do_Vr_Za".split("_"),longDateFormat:{LT:"HH:mm",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("nn",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag".split("_"),weekdaysShort:"sun_mån_tys_ons_tor_fre_lau".split("_"),weekdaysMin:"su_må_ty_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[I dag klokka] LT",nextDay:"[I morgon klokka] LT",nextWeek:"dddd [klokka] LT",lastDay:"[I går klokka] LT",lastWeek:"[Føregåande] dddd [klokka] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"for %s sidan",s:"nokre sekund",m:"eit minutt",mm:"%d minutt",h:"ein time",hh:"%d timar",d:"ein dag",dd:"%d dagar",M:"ein månad",MM:"%d månader",y:"eit år",yy:"%d år"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){function t(e){return 5>e%10&&e%10>1&&~~(e/10)%10!==1}function a(e,a,n){var _=e+" ";switch(n){case"m":return a?"minuta":"minutę";case"mm":return _+(t(e)?"minuty":"minut");case"h":return a?"godzina":"godzinę";case"hh":return _+(t(e)?"godziny":"godzin");case"MM":return _+(t(e)?"miesiące":"miesięcy");case"yy":return _+(t(e)?"lata":"lat")}}var n="styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_"),_="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_");return e.defineLocale("pl",{months:function(e,t){return/D MMMM/.test(t)?_[e.month()]:n[e.month()]},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),weekdays:"niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),weekdaysShort:"nie_pon_wt_śr_czw_pt_sb".split("_"),weekdaysMin:"N_Pn_Wt_Śr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Dziś o] LT",nextDay:"[Jutro o] LT",nextWeek:"[W] dddd [o] LT",lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszłą niedzielę o] LT";case 3:return"[W zeszłą środę o] LT";case 6:return"[W zeszłą sobotę o] LT";default:return"[W zeszły] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",m:a,mm:a,h:a,hh:a,d:"1 dzień",dd:"%d dni",M:"miesiąc",MM:a,y:"rok",yy:a},ordinal:"%d.",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("pt-br",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sáb".split("_"),weekdaysMin:"dom_2ª_3ª_4ª_5ª_6ª_sáb".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] LT",LLLL:"dddd, D [de] MMMM [de] YYYY [às] LT"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"%s atrás",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinal:"%dº"})}),function(e){e(ft)}(function(e){return e.defineLocale("pt",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sáb".split("_"),weekdaysMin:"dom_2ª_3ª_4ª_5ª_6ª_sáb".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY LT",LLLL:"dddd, D [de] MMMM [de] YYYY LT"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinal:"%dº",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){function t(e,t,a){var n={mm:"minute",hh:"ore",dd:"zile",MM:"luni",yy:"ani"},_=" ";return(e%100>=20||e>=100&&e%100===0)&&(_=" de "),e+_+n[a]}return e.defineLocale("ro",{months:"ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),monthsShort:"ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),weekdays:"duminică_luni_marți_miercuri_joi_vineri_sâmbătă".split("_"),weekdaysShort:"Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),weekdaysMin:"Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),longDateFormat:{LT:"H:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[azi la] LT",nextDay:"[mâine la] LT",nextWeek:"dddd [la] LT",lastDay:"[ieri la] LT",lastWeek:"[fosta] dddd [la] LT",sameElse:"L"},relativeTime:{future:"peste %s",past:"%s în urmă",s:"câteva secunde",m:"un minut",mm:t,h:"o oră",hh:t,d:"o zi",dd:t,M:"o lună",MM:t,y:"un an",yy:t},week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){function t(e,t){var a=e.split("_");return t%10===1&&t%100!==11?a[0]:t%10>=2&&4>=t%10&&(10>t%100||t%100>=20)?a[1]:a[2]}function a(e,a,n){var _={mm:a?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",MM:"месяц_месяца_месяцев",yy:"год_года_лет"};return"m"===n?a?"минута":"минуту":e+" "+t(_[n],+e)}function n(e,t){var a={nominative:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),accusative:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_")},n=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/.test(t)?"accusative":"nominative";return a[n][e.month()]}function _(e,t){var a={nominative:"янв_фев_мар_апр_май_июнь_июль_авг_сен_окт_ноя_дек".split("_"),accusative:"янв_фев_мар_апр_мая_июня_июля_авг_сен_окт_ноя_дек".split("_")},n=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/.test(t)?"accusative":"nominative";return a[n][e.month()]}function s(e,t){var a={nominative:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),accusative:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_")},n=/\[ ?[Вв] ?(?:прошлую|следующую)? ?\] ?dddd/.test(t)?"accusative":"nominative";return a[n][e.day()]}return e.defineLocale("ru",{months:n,monthsShort:_,weekdays:s,weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[й|я]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i],longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., LT",LLLL:"dddd, D MMMM YYYY г., LT"},calendar:{sameDay:"[Сегодня в] LT",nextDay:"[Завтра в] LT",lastDay:"[Вчера в] LT",nextWeek:function(){return 2===this.day()?"[Во] dddd [в] LT":"[В] dddd [в] LT"},lastWeek:function(){switch(this.day()){case 0:return"[В прошлое] dddd [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",m:a,mm:a,h:"час",hh:a,d:"день",dd:a,M:"месяц",MM:a,y:"год",yy:a},meridiemParse:/ночи|утра|дня|вечера/i,isPM:function(e){return/^(дня|вечера)$/.test(e)},meridiem:function(e){return 4>e?"ночи":12>e?"утра":17>e?"дня":"вечера"},ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":return e+"-й";case"D":return e+"-го";case"w":case"W":return e+"-я";default:return e}},week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){function t(e){return e>1&&5>e}function a(e,a,n,_){var s=e+" ";switch(n){case"s":return a||_?"pár sekúnd":"pár sekundami";case"m":return a?"minúta":_?"minútu":"minútou";case"mm":return a||_?s+(t(e)?"minúty":"minút"):s+"minútami";break;case"h":return a?"hodina":_?"hodinu":"hodinou";case"hh":return a||_?s+(t(e)?"hodiny":"hodín"):s+"hodinami";break;case"d":return a||_?"deň":"dňom";case"dd":return a||_?s+(t(e)?"dni":"dní"):s+"dňami";break;case"M":return a||_?"mesiac":"mesiacom";case"MM":return a||_?s+(t(e)?"mesiace":"mesiacov"):s+"mesiacmi";break;case"y":return a||_?"rok":"rokom";case"yy":return a||_?s+(t(e)?"roky":"rokov"):s+"rokmi"}}var n="január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_"),_="jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_");return e.defineLocale("sk",{months:n,monthsShort:_,monthsParse:function(e,t){var a,n=[];for(a=0;12>a;a++)n[a]=new RegExp("^"+e[a]+"$|^"+t[a]+"$","i");return n}(n,_),weekdays:"nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota".split("_"),weekdaysShort:"ne_po_ut_st_št_pi_so".split("_"),weekdaysMin:"ne_po_ut_st_št_pi_so".split("_"),longDateFormat:{LT:"H:mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd D. MMMM YYYY LT"},calendar:{sameDay:"[dnes o] LT",nextDay:"[zajtra o] LT",nextWeek:function(){switch(this.day()){case 0:return"[v nedeľu o] LT";case 1:case 2:return"[v] dddd [o] LT";case 3:return"[v stredu o] LT";case 4:return"[vo štvrtok o] LT";case 5:return"[v piatok o] LT";case 6:return"[v sobotu o] LT"}},lastDay:"[včera o] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulú nedeľu o] LT";case 1:case 2:return"[minulý] dddd [o] LT";case 3:return"[minulú stredu o] LT";case 4:case 5:return"[minulý] dddd [o] LT";case 6:return"[minulú sobotu o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"pred %s",s:a,m:a,mm:a,h:a,hh:a,d:a,dd:a,M:a,MM:a,y:a,yy:a},ordinal:"%d.",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){function t(e,t,a){var n=e+" ";switch(a){case"m":return t?"ena minuta":"eno minuto";case"mm":return n+=1===e?"minuta":2===e?"minuti":3===e||4===e?"minute":"minut";case"h":return t?"ena ura":"eno uro";case"hh":return n+=1===e?"ura":2===e?"uri":3===e||4===e?"ure":"ur";case"dd":return n+=1===e?"dan":"dni";case"MM":return n+=1===e?"mesec":2===e?"meseca":3===e||4===e?"mesece":"mesecev";case"yy":return n+=1===e?"leto":2===e?"leti":3===e||4===e?"leta":"let"}}return e.defineLocale("sl",{months:"januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),weekdays:"nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota".split("_"),weekdaysShort:"ned._pon._tor._sre._čet._pet._sob.".split("_"),weekdaysMin:"ne_po_to_sr_če_pe_so".split("_"),longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danes ob] LT",nextDay:"[jutri ob] LT",nextWeek:function(){switch(this.day()){case 0:return"[v] [nedeljo] [ob] LT";case 3:return"[v] [sredo] [ob] LT";case 6:return"[v] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[v] dddd [ob] LT"}},lastDay:"[včeraj ob] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[prejšnja] dddd [ob] LT";case 1:case 2:case 4:case 5:return"[prejšnji] dddd [ob] LT"}},sameElse:"L"},relativeTime:{future:"čez %s",past:"%s nazaj",s:"nekaj sekund",m:t,mm:t,h:t,hh:t,d:"en dan",dd:t,M:"en mesec",MM:t,y:"eno leto",yy:t},ordinal:"%d.",week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){return e.defineLocale("sq",{months:"Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor".split("_"),monthsShort:"Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj".split("_"),weekdays:"E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë".split("_"),weekdaysShort:"Die_Hën_Mar_Mër_Enj_Pre_Sht".split("_"),weekdaysMin:"D_H_Ma_Më_E_P_Sh".split("_"),meridiem:function(e){return 12>e?"PD":"MD"},longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Sot në] LT",nextDay:"[Nesër në] LT",nextWeek:"dddd [në] LT",lastDay:"[Dje në] LT",lastWeek:"dddd [e kaluar në] LT",sameElse:"L"},relativeTime:{future:"në %s",past:"%s më parë",s:"disa sekonda",m:"një minutë",mm:"%d minuta",h:"një orë",hh:"%d orë",d:"një ditë",dd:"%d ditë",M:"një muaj",MM:"%d muaj",y:"një vit",yy:"%d vite"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){var t={words:{m:["један минут","једне минуте"],mm:["минут","минуте","минута"],h:["један сат","једног сата"],hh:["сат","сата","сати"],dd:["дан","дана","дана"],MM:["месец","месеца","месеци"],yy:["година","године","година"]},correctGrammaticalCase:function(e,t){return 1===e?t[0]:e>=2&&4>=e?t[1]:t[2]},translate:function(e,a,n){var _=t.words[n];return 1===n.length?a?_[0]:_[1]:e+" "+t.correctGrammaticalCase(e,_)}};return e.defineLocale("sr-cyrl",{months:["јануар","фебруар","март","април","мај","јун","јул","август","септембар","октобар","новембар","децембар"],monthsShort:["јан.","феб.","мар.","апр.","мај","јун","јул","авг.","сеп.","окт.","нов.","дец."],weekdays:["недеља","понедељак","уторак","среда","четвртак","петак","субота"],weekdaysShort:["нед.","пон.","уто.","сре.","чет.","пет.","суб."],weekdaysMin:["не","по","ут","ср","че","пе","су"],longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[данас у] LT",nextDay:"[сутра у] LT",nextWeek:function(){switch(this.day()){case 0:return"[у] [недељу] [у] LT";case 3:return"[у] [среду] [у] LT";case 6:return"[у] [суботу] [у] LT";case 1:case 2:case 4:case 5:return"[у] dddd [у] LT"}},lastDay:"[јуче у] LT",lastWeek:function(){var e=["[прошле] [недеље] [у] LT","[прошлог] [понедељка] [у] LT","[прошлог] [уторка] [у] LT","[прошле] [среде] [у] LT","[прошлог] [четвртка] [у] LT","[прошлог] [петка] [у] LT","[прошле] [суботе] [у] LT"];return e[this.day()]},sameElse:"L"},relativeTime:{future:"за %s",past:"пре %s",s:"неколико секунди",m:t.translate,mm:t.translate,h:t.translate,hh:t.translate,d:"дан",dd:t.translate,M:"месец",MM:t.translate,y:"годину",yy:t.translate},ordinal:"%d.",week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){var t={words:{m:["jedan minut","jedne minute"],mm:["minut","minute","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mesec","meseca","meseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(e,t){return 1===e?t[0]:e>=2&&4>=e?t[1]:t[2]},translate:function(e,a,n){var _=t.words[n];return 1===n.length?a?_[0]:_[1]:e+" "+t.correctGrammaticalCase(e,_)}};return e.defineLocale("sr",{months:["januar","februar","mart","april","maj","jun","jul","avgust","septembar","oktobar","novembar","decembar"],monthsShort:["jan.","feb.","mar.","apr.","maj","jun","jul","avg.","sep.","okt.","nov.","dec."],weekdays:["nedelja","ponedeljak","utorak","sreda","četvrtak","petak","subota"],weekdaysShort:["ned.","pon.","uto.","sre.","čet.","pet.","sub."],weekdaysMin:["ne","po","ut","sr","če","pe","su"],longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedelju] [u] LT";case 3:return"[u] [sredu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){var e=["[prošle] [nedelje] [u] LT","[prošlog] [ponedeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"];return e[this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",m:t.translate,mm:t.translate,h:t.translate,hh:t.translate,d:"dan",dd:t.translate,M:"mesec",MM:t.translate,y:"godinu",yy:t.translate},ordinal:"%d.",week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){return e.defineLocale("sv",{months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Idag] LT",nextDay:"[Imorgon] LT",lastDay:"[Igår] LT",nextWeek:"dddd LT",lastWeek:"[Förra] dddd[en] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"},ordinal:function(e){var t=e%10,a=1===~~(e%100/10)?"e":1===t?"a":2===t?"a":3===t?"e":"e";return e+a},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("ta",{months:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),monthsShort:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),weekdays:"ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை".split("_"),weekdaysShort:"ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி".split("_"),weekdaysMin:"ஞா_தி_செ_பு_வி_வெ_ச".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[இன்று] LT",nextDay:"[நாளை] LT",nextWeek:"dddd, LT",lastDay:"[நேற்று] LT",lastWeek:"[கடந்த வாரம்] dddd, LT",sameElse:"L"},relativeTime:{future:"%s இல்",past:"%s முன்",s:"ஒரு சில விநாடிகள்",m:"ஒரு நிமிடம்",mm:"%d நிமிடங்கள்",h:"ஒரு மணி நேரம்",hh:"%d மணி நேரம்",d:"ஒரு நாள்",dd:"%d நாட்கள்",M:"ஒரு மாதம்",MM:"%d மாதங்கள்",y:"ஒரு வருடம்",yy:"%d ஆண்டுகள்"},ordinal:function(e){return e+"வது"},meridiem:function(e){return e>=6&&10>=e?" காலை":e>=10&&14>=e?" நண்பகல்":e>=14&&18>=e?" எற்பாடு":e>=18&&20>=e?" மாலை":e>=20&&24>=e?" இரவு":e>=0&&6>=e?" வைகறை":void 0},week:{dow:0,doy:6}})}),function(e){e(ft)}(function(e){return e.defineLocale("th",{months:"มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),monthsShort:"มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา".split("_"),weekdays:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),weekdaysShort:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),weekdaysMin:"อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),longDateFormat:{LT:"H นาฬิกา m นาที",L:"YYYY/MM/DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY เวลา LT",LLLL:"วันddddที่ D MMMM YYYY เวลา LT"},meridiem:function(e){return 12>e?"ก่อนเที่ยง":"หลังเที่ยง"},calendar:{sameDay:"[วันนี้ เวลา] LT",nextDay:"[พรุ่งนี้ เวลา] LT",nextWeek:"dddd[หน้า เวลา] LT",lastDay:"[เมื่อวานนี้ เวลา] LT",lastWeek:"[วัน]dddd[ที่แล้ว เวลา] LT",sameElse:"L"},relativeTime:{future:"อีก %s",past:"%sที่แล้ว",s:"ไม่กี่วินาที",m:"1 นาที",mm:"%d นาที",h:"1 ชั่วโมง",hh:"%d ชั่วโมง",d:"1 วัน",dd:"%d วัน",M:"1 เดือน",MM:"%d เดือน",y:"1 ปี",yy:"%d ปี"}})}),function(e){e(ft)}(function(e){return e.defineLocale("tl-ph",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM DD, YYYY LT"},calendar:{sameDay:"[Ngayon sa] LT",nextDay:"[Bukas sa] LT",nextWeek:"dddd [sa] LT",lastDay:"[Kahapon sa] LT",lastWeek:"dddd [huling linggo] LT",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},ordinal:function(e){return e},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){var t={1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"};return e.defineLocale("tr",{months:"Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"),monthsShort:"Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pts_Sal_Çar_Per_Cum_Cts".split("_"),weekdaysMin:"Pz_Pt_Sa_Ça_Pe_Cu_Ct".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[yarın saat] LT",nextWeek:"[haftaya] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen hafta] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",M:"bir ay",MM:"%d ay",y:"bir yıl",yy:"%d yıl"},ordinal:function(e){if(0===e)return e+"'ıncı";var a=e%10,n=e%100-a,_=e>=100?100:null;return e+(t[a]||t[n]||t[_])},week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){return e.defineLocale("tzm-latn",{months:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),monthsShort:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),weekdays:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysShort:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysMin:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[asdkh g] LT",nextDay:"[aska g] LT",nextWeek:"dddd [g] LT",lastDay:"[assant g] LT",lastWeek:"dddd [g] LT",sameElse:"L"},relativeTime:{future:"dadkh s yan %s",past:"yan %s",s:"imik",m:"minuḍ",mm:"%d minuḍ",h:"saɛa",hh:"%d tassaɛin",d:"ass",dd:"%d ossan",M:"ayowr",MM:"%d iyyirn",y:"asgas",yy:"%d isgasn"},week:{dow:6,doy:12}})}),function(e){e(ft)}(function(e){return e.defineLocale("tzm",{months:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),monthsShort:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),weekdays:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysShort:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysMin:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[ⴰⵙⴷⵅ ⴴ] LT",nextDay:"[ⴰⵙⴽⴰ ⴴ] LT",nextWeek:"dddd [ⴴ] LT",lastDay:"[ⴰⵚⴰⵏⵜ ⴴ] LT",lastWeek:"dddd [ⴴ] LT",sameElse:"L"},relativeTime:{future:"ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s",past:"ⵢⴰⵏ %s",s:"ⵉⵎⵉⴽ",m:"ⵎⵉⵏⵓⴺ",mm:"%d ⵎⵉⵏⵓⴺ",h:"ⵙⴰⵄⴰ",hh:"%d ⵜⴰⵙⵙⴰⵄⵉⵏ",d:"ⴰⵙⵙ",dd:"%d oⵙⵙⴰⵏ",M:"ⴰⵢoⵓⵔ",MM:"%d ⵉⵢⵢⵉⵔⵏ",y:"ⴰⵙⴳⴰⵙ",yy:"%d ⵉⵙⴳⴰⵙⵏ"},week:{dow:6,doy:12}})}),function(e){e(ft)}(function(e){function t(e,t){var a=e.split("_");return t%10===1&&t%100!==11?a[0]:t%10>=2&&4>=t%10&&(10>t%100||t%100>=20)?a[1]:a[2]}function a(e,a,n){var _={mm:"хвилина_хвилини_хвилин",hh:"година_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"};return"m"===n?a?"хвилина":"хвилину":"h"===n?a?"година":"годину":e+" "+t(_[n],+e)}function n(e,t){var a={nominative:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_"),accusative:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_")},n=/D[oD]? *MMMM?/.test(t)?"accusative":"nominative";return a[n][e.month()]}function _(e,t){var a={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")},n=/(\[[ВвУу]\]) ?dddd/.test(t)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(t)?"genitive":"nominative";return a[n][e.day()]}function s(e){return function(){return e+"о"+(11===this.hours()?"б":"")+"] LT"}}return e.defineLocale("uk",{months:n,monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:_,weekdaysShort:"нд_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY р.",LLL:"D MMMM YYYY р., LT",LLLL:"dddd, D MMMM YYYY р., LT"},calendar:{sameDay:s("[Сьогодні "),nextDay:s("[Завтра "),lastDay:s("[Вчора "),nextWeek:s("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return s("[Минулої] dddd [").call(this);case 1:case 2:case 4:return s("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",m:a,mm:a,h:"годину",hh:a,d:"день",dd:a,M:"місяць",MM:a,y:"рік",yy:a},meridiem:function(e){return 4>e?"ночі":12>e?"ранку":17>e?"дня":"вечора"},ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":case"w":case"W":return e+"-й";case"D":return e+"-го";default:return e}},week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){return e.defineLocale("uz",{months:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба".split("_"),weekdaysShort:"Якш_Душ_Сеш_Чор_Пай_Жум_Шан".split("_"),weekdaysMin:"Як_Ду_Се_Чо_Па_Жу_Ша".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"D MMMM YYYY, dddd LT"},calendar:{sameDay:"[Бугун соат] LT [да]",nextDay:"[Эртага] LT [да]",nextWeek:"dddd [куни соат] LT [да]",lastDay:"[Кеча соат] LT [да]",lastWeek:"[Утган] dddd [куни соат] LT [да]",sameElse:"L"},relativeTime:{future:"Якин %s ичида",past:"Бир неча %s олдин",s:"фурсат",m:"бир дакика",mm:"%d дакика",h:"бир соат",hh:"%d соат",d:"бир кун",dd:"%d кун",M:"бир ой",MM:"%d ой",y:"бир йил",yy:"%d йил"},week:{dow:1,doy:7}})}),function(e){e(ft)}(function(e){return e.defineLocale("vi",{months:"tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),monthsShort:"Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12".split("_"),weekdays:"chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM [năm] YYYY",LLL:"D MMMM [năm] YYYY LT",LLLL:"dddd, D MMMM [năm] YYYY LT",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY LT",llll:"ddd, D MMM YYYY LT"},calendar:{sameDay:"[Hôm nay lúc] LT",nextDay:"[Ngày mai lúc] LT",nextWeek:"dddd [tuần tới lúc] LT",lastDay:"[Hôm qua lúc] LT",lastWeek:"dddd [tuần rồi lúc] LT",sameElse:"L"},relativeTime:{future:"%s tới",past:"%s trước",s:"vài giây",m:"một phút",mm:"%d phút",h:"một giờ",hh:"%d giờ",d:"một ngày",dd:"%d ngày",M:"một tháng",MM:"%d tháng",y:"một năm",yy:"%d năm"},ordinal:function(e){return e},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("zh-cn",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"Ah点mm",L:"YYYY-MM-DD",LL:"YYYY年MMMD日",LLL:"YYYY年MMMD日LT",LLLL:"YYYY年MMMD日ddddLT",l:"YYYY-MM-DD",ll:"YYYY年MMMD日",lll:"YYYY年MMMD日LT",llll:"YYYY年MMMD日ddddLT"},meridiem:function(e,t){var a=100*e+t; +return 600>a?"凌晨":900>a?"早上":1130>a?"上午":1230>a?"中午":1800>a?"下午":"晚上"},calendar:{sameDay:function(){return 0===this.minutes()?"[今天]Ah[点整]":"[今天]LT"},nextDay:function(){return 0===this.minutes()?"[明天]Ah[点整]":"[明天]LT"},lastDay:function(){return 0===this.minutes()?"[昨天]Ah[点整]":"[昨天]LT"},nextWeek:function(){var t,a;return t=e().startOf("week"),a=this.unix()-t.unix()>=604800?"[下]":"[本]",0===this.minutes()?a+"dddAh点整":a+"dddAh点mm"},lastWeek:function(){var t,a;return t=e().startOf("week"),a=this.unix()<t.unix()?"[上]":"[本]",0===this.minutes()?a+"dddAh点整":a+"dddAh点mm"},sameElse:"LL"},ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"周";default:return e}},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1分钟",mm:"%d分钟",h:"1小时",hh:"%d小时",d:"1天",dd:"%d天",M:"1个月",MM:"%d个月",y:"1年",yy:"%d年"},week:{dow:1,doy:4}})}),function(e){e(ft)}(function(e){return e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"Ah點mm",L:"YYYY年MMMD日",LL:"YYYY年MMMD日",LLL:"YYYY年MMMD日LT",LLLL:"YYYY年MMMD日ddddLT",l:"YYYY年MMMD日",ll:"YYYY年MMMD日",lll:"YYYY年MMMD日LT",llll:"YYYY年MMMD日ddddLT"},meridiem:function(e,t){var a=100*e+t;return 900>a?"早上":1130>a?"上午":1230>a?"中午":1800>a?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",m:"一分鐘",mm:"%d分鐘",h:"一小時",hh:"%d小時",d:"一天",dd:"%d天",M:"一個月",MM:"%d個月",y:"一年",yy:"%d年"}})}),ft.locale("en"),Et?module.exports=ft:"function"==typeof define&&define.amd?(define("moment",function(e,t,a){return a.config&&a.config()&&a.config().noGlobal===!0&&(Tt.moment=pt),ft}),yt(!0)):yt()}).call(this)}).call(this),function(){"undefined"!=typeof Package&&(a=this.moment)}.call(this),"undefined"==typeof Package&&(Package={}),Package["jeeeyul:moment-with-langs"]={moment:a}}(); + +!function(){var e=Package.meteor.Meteor;"undefined"==typeof Package&&(Package={}),Package.coffeescript={}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.underscore._,a=Package.tracker.Tracker,i=Package.tracker.Deps,n=Package.ejson.EJSON,r;(function(){var e=function(e){return void 0===e?"undefined":n.stringify(e)},i=function(e){return void 0===e||"undefined"===e?void 0:n.parse(e)};r=function(e){if(e)if("string"==typeof e)r._registerDictForMigrate(e,this),this.keys=r._loadMigratedDict(e)||{};else{if("object"!=typeof e)throw new Error("Invalid ReactiveDict argument: "+e);this.keys=e}else this.keys={};this.keyDeps={},this.keyValueDeps={}},t.extend(r.prototype,{set:function(a,i){var n=this;i=e(i);var r="undefined";if(t.has(n.keys,a)&&(r=n.keys[a]),i!==r){n.keys[a]=i;var s=function(e){e&&e.changed()};s(n.keyDeps[a]),n.keyValueDeps[a]&&(s(n.keyValueDeps[a][r]),s(n.keyValueDeps[a][i]))}},setDefault:function(e,t){var a=this;void 0===a.keys[e]&&a.set(e,t)},get:function(e){var t=this;return t._ensureKey(e),t.keyDeps[e].depend(),i(t.keys[e])},equals:function(r,s){var c=this,o=null;if("undefined"!=typeof Mongo&&(o=Mongo.ObjectID),!("string"==typeof s||"number"==typeof s||"boolean"==typeof s||"undefined"==typeof s||s instanceof Date||o&&s instanceof o||null===s))throw new Error("ReactiveDict.equals: value must be scalar");var u=e(s);if(a.active){c._ensureKey(r),t.has(c.keyValueDeps[r],u)||(c.keyValueDeps[r][u]=new a.Dependency);var d=c.keyValueDeps[r][u].depend();d&&a.onInvalidate(function(){c.keyValueDeps[r][u].hasDependents()||delete c.keyValueDeps[r][u]})}var f=void 0;return t.has(c.keys,r)&&(f=i(c.keys[r])),n.equals(f,s)},_ensureKey:function(e){var t=this;e in t.keyDeps||(t.keyDeps[e]=new a.Dependency,t.keyValueDeps[e]={})},_getMigrationData:function(){return this.keys}})}).call(this),function(){if(r._migratedDictData={},r._dictsToMigrate={},r._loadMigratedDict=function(e){return t.has(r._migratedDictData,e)?r._migratedDictData[e]:null},r._registerDictForMigrate=function(e,a){if(t.has(r._dictsToMigrate,e))throw new Error("Duplicate ReactiveDict name: "+e);r._dictsToMigrate[e]=a},e.isClient&&Package.reload){var a=Package.reload.Reload._migrationData("reactive-dict");a&&a.dicts&&(r._migratedDictData=a.dicts),Package.reload.Reload._onMigrate("reactive-dict",function(){var e=r._dictsToMigrate,t={};for(var a in e)t[a]=e[a]._getMigrationData();return[!0,{dicts:t}]})}}.call(this),"undefined"==typeof Package&&(Package={}),Package["reactive-dict"]={ReactiveDict:r}}(); + +!function(){var e=Package.meteor.Meteor,a=Package.underscore._,c=Package["reactive-dict"].ReactiveDict,n=Package.ejson.EJSON,i;(function(){i=new c("session")}).call(this),"undefined"==typeof Package&&(Package={}),Package.session={Session:i}}(); + +!function(){var e=Package.meteor.Meteor,t,n;(function(){!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t=e.length,n=it.type(e);return"function"===n||it.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function r(e,t,n){if(it.isFunction(t))return it.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return it.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(ft.test(t))return it.filter(t,e,n);t=it.filter(t,e)}return it.grep(e,function(e){return it.inArray(e,t)>=0!==n})}function i(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function o(e){var t=xt[e]={};return it.each(e.match(bt)||[],function(e,n){t[n]=!0}),t}function a(){ht.addEventListener?(ht.removeEventListener("DOMContentLoaded",s,!1),e.removeEventListener("load",s,!1)):(ht.detachEvent("onreadystatechange",s),e.detachEvent("onload",s))}function s(){(ht.addEventListener||"load"===event.type||"complete"===ht.readyState)&&(a(),it.ready())}function u(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(Et,"-$1").toLowerCase();if(n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:Nt.test(n)?it.parseJSON(n):n}catch(i){}it.data(e,t,n)}else n=void 0}return n}function l(e){var t;for(t in e)if(("data"!==t||!it.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function c(e,t,n,r){if(it.acceptData(e)){var i,o,a=it.expando,s=e.nodeType,u=s?it.cache:e,l=s?e[a]:e[a]&&a;if(l&&u[l]&&(r||u[l].data)||void 0!==n||"string"!=typeof t)return l||(l=s?e[a]=J.pop()||it.guid++:a),u[l]||(u[l]=s?{}:{toJSON:it.noop}),("object"==typeof t||"function"==typeof t)&&(r?u[l]=it.extend(u[l],t):u[l].data=it.extend(u[l].data,t)),o=u[l],r||(o.data||(o.data={}),o=o.data),void 0!==n&&(o[it.camelCase(t)]=n),"string"==typeof t?(i=o[t],null==i&&(i=o[it.camelCase(t)])):i=o,i}}function d(e,t,n){if(it.acceptData(e)){var r,i,o=e.nodeType,a=o?it.cache:e,s=o?e[it.expando]:it.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){it.isArray(t)?t=t.concat(it.map(t,it.camelCase)):t in r?t=[t]:(t=it.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;for(;i--;)delete r[t[i]];if(n?!l(r):!it.isEmptyObject(r))return}(n||(delete a[s].data,l(a[s])))&&(o?it.cleanData([e],!0):nt.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}function f(){return!0}function p(){return!1}function h(){try{return ht.activeElement}catch(e){}}function m(e){var t=Ft.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function g(e,t){var n,r,i=0,o=typeof e.getElementsByTagName!==Tt?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==Tt?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(r=n[i]);i++)!t||it.nodeName(r,t)?o.push(r):it.merge(o,g(r,t));return void 0===t||t&&it.nodeName(e,t)?it.merge([e],o):o}function v(e){jt.test(e.type)&&(e.defaultChecked=e.checked)}function y(e,t){return it.nodeName(e,"table")&&it.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function b(e){return e.type=(null!==it.find.attr(e,"type"))+"/"+e.type,e}function x(e){var t=Vt.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function w(e,t){for(var n,r=0;null!=(n=e[r]);r++)it._data(n,"globalEval",!t||it._data(t[r],"globalEval"))}function T(e,t){if(1===t.nodeType&&it.hasData(e)){var n,r,i,o=it._data(e),a=it._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)it.event.add(t,n,s[n][r])}a.data&&(a.data=it.extend({},a.data))}}function C(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!nt.noCloneEvent&&t[it.expando]){i=it._data(t);for(r in i.events)it.removeEvent(t,r,i.handle);t.removeAttribute(it.expando)}"script"===n&&t.text!==e.text?(b(t).text=e.text,x(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),nt.html5Clone&&e.innerHTML&&!it.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&jt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}function N(t,n){var r,i=it(n.createElement(t)).appendTo(n.body),o=e.getDefaultComputedStyle&&(r=e.getDefaultComputedStyle(i[0]))?r.display:it.css(i[0],"display");return i.detach(),o}function E(e){var t=ht,n=Zt[e];return n||(n=N(e,t),"none"!==n&&n||(Kt=(Kt||it("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=(Kt[0].contentWindow||Kt[0].contentDocument).document,t.write(),t.close(),n=N(e,t),Kt.detach()),Zt[e]=n),n}function k(e,t){return{get:function(){var n=e();if(null!=n)return n?void delete this.get:(this.get=t).apply(this,arguments)}}}function S(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=pn.length;i--;)if(t=pn[i]+n,t in e)return t;return r}function A(e,t){for(var n,r,i,o=[],a=0,s=e.length;s>a;a++)r=e[a],r.style&&(o[a]=it._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&At(r)&&(o[a]=it._data(r,"olddisplay",E(r.nodeName)))):(i=At(r),(n&&"none"!==n||!i)&&it._data(r,"olddisplay",i?n:it.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}function D(e,t,n){var r=ln.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function j(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;4>o;o+=2)"margin"===n&&(a+=it.css(e,n+St[o],!0,i)),r?("content"===n&&(a-=it.css(e,"padding"+St[o],!0,i)),"margin"!==n&&(a-=it.css(e,"border"+St[o]+"Width",!0,i))):(a+=it.css(e,"padding"+St[o],!0,i),"padding"!==n&&(a+=it.css(e,"border"+St[o]+"Width",!0,i)));return a}function L(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=nn(e),a=nt.boxSizing&&"border-box"===it.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=rn(e,t,o),(0>i||null==i)&&(i=e.style[t]),tn.test(i))return i;r=a&&(nt.boxSizingReliable()||i===e.style[t]),i=parseFloat(i)||0}return i+j(e,t,n||(a?"border":"content"),r,o)+"px"}function H(e,t,n,r,i){return new H.prototype.init(e,t,n,r,i)}function q(){return setTimeout(function(){hn=void 0}),hn=it.now()}function _(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=St[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function M(e,t,n){for(var r,i=(xn[t]||[]).concat(xn["*"]),o=0,a=i.length;a>o;o++)if(r=i[o].call(n,t,e))return r}function F(e,t,n){var r,i,o,a,s,u,l,c,d=this,f={},p=e.style,h=e.nodeType&&At(e),m=it._data(e,"fxshow");n.queue||(s=it._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,u=s.empty.fire,s.empty.fire=function(){s.unqueued||u()}),s.unqueued++,d.always(function(){d.always(function(){s.unqueued--,it.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],l=it.css(e,"display"),c="none"===l?it._data(e,"olddisplay")||E(e.nodeName):l,"inline"===c&&"none"===it.css(e,"float")&&(nt.inlineBlockNeedsLayout&&"inline"!==E(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",nt.shrinkWrapBlocks()||d.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],gn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(h?"hide":"show")){if("show"!==i||!m||void 0===m[r])continue;h=!0}f[r]=m&&m[r]||it.style(e,r)}else l=void 0;if(it.isEmptyObject(f))"inline"===("none"===l?E(e.nodeName):l)&&(p.display=l);else{m?"hidden"in m&&(h=m.hidden):m=it._data(e,"fxshow",{}),o&&(m.hidden=!h),h?it(e).show():d.done(function(){it(e).hide()}),d.done(function(){var t;it._removeData(e,"fxshow");for(t in f)it.style(e,t,f[t])});for(r in f)a=M(h?m[r]:0,r,d),r in m||(m[r]=a.start,h&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function O(e,t){var n,r,i,o,a;for(n in e)if(r=it.camelCase(n),i=t[r],o=e[n],it.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=it.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function B(e,t,n){var r,i,o=0,a=bn.length,s=it.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=hn||q(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:it.extend({},t),opts:it.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:hn||q(),duration:n.duration,tweens:[],createTween:function(t,n){var r=it.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(O(c,l.opts.specialEasing);a>o;o++)if(r=bn[o].call(l,e,c,l.opts))return r;return it.map(c,M,l),it.isFunction(l.opts.start)&&l.opts.start.call(e,l),it.fx.timer(it.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function P(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(bt)||[];if(it.isFunction(n))for(;r=o[i++];)"+"===r.charAt(0)?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function R(e,t,n,r){function i(s){var u;return o[s]=!0,it.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||a||o[l]?a?!(u=l):void 0:(t.dataTypes.unshift(l),i(l),!1)}),u}var o={},a=e===In;return i(t.dataTypes[0])||!o["*"]&&i("*")}function W(e,t){var n,r,i=it.ajaxSettings.flatOptions||{};for(r in t)void 0!==t[r]&&((i[r]?e:n||(n={}))[r]=t[r]);return n&&it.extend(!0,e,n),e}function $(e,t,n){for(var r,i,o,a,s=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===i&&(i=e.mimeType||t.getResponseHeader("Content-Type"));if(i)for(a in s)if(s[a]&&s[a].test(i)){u.unshift(a);break}if(u[0]in n)o=u[0];else{for(a in n){if(!u[0]||e.converters[a+" "+u[0]]){o=a;break}r||(r=a)}o=o||r}return o?(o!==u[0]&&u.unshift(o),n[o]):void 0}function z(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];for(o=c.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(a=l[u+" "+o]||l["* "+o],!a)for(i in l)if(s=i.split(" "),s[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){a===!0?a=l[i]:l[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(d){return{state:"parsererror",error:a?d:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}function I(e,t,n,r){var i;if(it.isArray(t))it.each(t,function(t,i){n||Jn.test(e)?r(e,i):I(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==it.type(t))r(e,t);else for(i in t)I(e+"["+i+"]",t[i],n,r)}function X(){try{return new e.XMLHttpRequest}catch(t){}}function U(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function V(e){return it.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var J=[],Y=J.slice,Q=J.concat,G=J.push,K=J.indexOf,Z={},et=Z.toString,tt=Z.hasOwnProperty,nt={},rt="1.11.2",it=function(e,t){return new it.fn.init(e,t)},ot=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,at=/^-ms-/,st=/-([\da-z])/gi,ut=function(e,t){return t.toUpperCase()};it.fn=it.prototype={jquery:rt,constructor:it,selector:"",length:0,toArray:function(){return Y.call(this)},get:function(e){return null!=e?0>e?this[e+this.length]:this[e]:Y.call(this)},pushStack:function(e){var t=it.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return it.each(this,e,t)},map:function(e){return this.pushStack(it.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(Y.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:G,sort:J.sort,splice:J.splice},it.extend=it.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||it.isFunction(a)||(a={}),s===u&&(a=this,s--);u>s;s++)if(null!=(i=arguments[s]))for(r in i)e=a[r],n=i[r],a!==n&&(l&&n&&(it.isPlainObject(n)||(t=it.isArray(n)))?(t?(t=!1,o=e&&it.isArray(e)?e:[]):o=e&&it.isPlainObject(e)?e:{},a[r]=it.extend(l,o,n)):void 0!==n&&(a[r]=n));return a},it.extend({expando:"jQuery"+(rt+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===it.type(e)},isArray:Array.isArray||function(e){return"array"===it.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!it.isArray(e)&&e-parseFloat(e)+1>=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==it.type(e)||e.nodeType||it.isWindow(e))return!1;try{if(e.constructor&&!tt.call(e,"constructor")&&!tt.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}if(nt.ownLast)for(t in e)return tt.call(e,t);for(t in e);return void 0===t||tt.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?Z[et.call(e)]||"object":typeof e},globalEval:function(t){t&&it.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(at,"ms-").replace(st,ut)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,r){var i,o=0,a=e.length,s=n(e);if(r){if(s)for(;a>o&&(i=t.apply(e[o],r),i!==!1);o++);else for(o in e)if(i=t.apply(e[o],r),i===!1)break}else if(s)for(;a>o&&(i=t.call(e[o],o,e[o]),i!==!1);o++);else for(o in e)if(i=t.call(e[o],o,e[o]),i===!1)break;return e},trim:function(e){return null==e?"":(e+"").replace(ot,"")},makeArray:function(e,t){var r=t||[];return null!=e&&(n(Object(e))?it.merge(r,"string"==typeof e?[e]:e):G.call(r,e)),r},inArray:function(e,t,n){var r;if(t){if(K)return K.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;n>r;)e[i++]=t[r++];if(n!==n)for(;void 0!==t[r];)e[i++]=t[r++];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;a>o;o++)r=!t(e[o],o),r!==s&&i.push(e[o]);return i},map:function(e,t,r){var i,o=0,a=e.length,s=n(e),u=[];if(s)for(;a>o;o++)i=t(e[o],o,r),null!=i&&u.push(i);else for(o in e)i=t(e[o],o,r),null!=i&&u.push(i);return Q.apply([],u)},guid:1,proxy:function(e,t){var n,r,i;return"string"==typeof t&&(i=e[t],t=e,e=i),it.isFunction(e)?(n=Y.call(arguments,2),r=function(){return e.apply(t||this,n.concat(Y.call(arguments)))},r.guid=e.guid=e.guid||it.guid++,r):void 0},now:function(){return+new Date},support:nt}),it.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){Z["[object "+t+"]"]=t.toLowerCase()});var lt=function(e){function t(e,t,n,r){var i,o,a,s,u,l,d,p,h,m;if((t?t.ownerDocument||t:R)!==H&&L(t),t=t||H,n=n||[],s=t.nodeType,"string"!=typeof e||!e||1!==s&&9!==s&&11!==s)return n;if(!r&&_){if(11!==s&&(i=yt.exec(e)))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&B(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return K.apply(n,t.getElementsByTagName(e)),n;if((a=i[3])&&w.getElementsByClassName)return K.apply(n,t.getElementsByClassName(a)),n}if(w.qsa&&(!M||!M.test(e))){if(p=d=P,h=t,m=1!==s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){for(l=E(e),(d=t.getAttribute("id"))?p=d.replace(xt,"\\$&"):t.setAttribute("id",p),p="[id='"+p+"'] ",u=l.length;u--;)l[u]=p+f(l[u]);h=bt.test(e)&&c(t.parentNode)||t,m=l.join(",")}if(m)try{return K.apply(n,h.querySelectorAll(m)),n}catch(g){}finally{d||t.removeAttribute("id")}}}return S(e.replace(ut,"$1"),t,n,r)}function n(){function e(n,r){return t.push(n+" ")>T.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[P]=!0,e}function i(e){var t=H.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=e.length;r--;)T.attrHandle[n[r]]=t}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||V)-(~e.sourceIndex||V);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function u(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function l(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function c(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function d(){}function f(e){for(var t=0,n=e.length,r="";n>t;t++)r+=e[t].value;return r}function p(e,t,n){var r=t.dir,i=n&&"parentNode"===r,o=$++;return t.first?function(t,n,o){for(;t=t[r];)if(1===t.nodeType||i)return e(t,n,o)}:function(t,n,a){var s,u,l=[W,o];if(a){for(;t=t[r];)if((1===t.nodeType||i)&&e(t,n,a))return!0}else for(;t=t[r];)if(1===t.nodeType||i){if(u=t[P]||(t[P]={}),(s=u[r])&&s[0]===W&&s[1]===o)return l[2]=s[2];if(u[r]=l,l[2]=e(t,n,a))return!0}}}function h(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function m(e,n,r){for(var i=0,o=n.length;o>i;i++)t(e,n[i],r);return r}function g(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function v(e,t,n,i,o,a){return i&&!i[P]&&(i=v(i)),o&&!o[P]&&(o=v(o,a)),r(function(r,a,s,u){var l,c,d,f=[],p=[],h=a.length,v=r||m(t||"*",s.nodeType?[s]:s,[]),y=!e||!r&&t?v:g(v,f,e,s,u),b=n?o||(r?e:h||i)?[]:a:y;if(n&&n(y,b,s,u),i)for(l=g(b,p),i(l,[],s,u),c=l.length;c--;)(d=l[c])&&(b[p[c]]=!(y[p[c]]=d));if(r){if(o||e){if(o){for(l=[],c=b.length;c--;)(d=b[c])&&l.push(y[c]=d);o(null,b=[],l,u)}for(c=b.length;c--;)(d=b[c])&&(l=o?et(r,d):f[c])>-1&&(r[l]=!(a[l]=d))}}else b=g(b===a?b.splice(h,b.length):b),o?o(null,a,b,u):K.apply(a,b)})}function y(e){for(var t,n,r,i=e.length,o=T.relative[e[0].type],a=o||T.relative[" "],s=o?1:0,u=p(function(e){return e===t},a,!0),l=p(function(e){return et(t,e)>-1},a,!0),c=[function(e,n,r){var i=!o&&(r||n!==A)||((t=n).nodeType?u(e,n,r):l(e,n,r));return t=null,i}];i>s;s++)if(n=T.relative[e[s].type])c=[p(h(c),n)];else{if(n=T.filter[e[s].type].apply(null,e[s].matches),n[P]){for(r=++s;i>r&&!T.relative[e[r].type];r++);return v(s>1&&h(c),s>1&&f(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(ut,"$1"),n,r>s&&y(e.slice(s,r)),i>r&&y(e=e.slice(r)),i>r&&f(e))}c.push(n)}return h(c)}function b(e,n){var i=n.length>0,o=e.length>0,a=function(r,a,s,u,l){var c,d,f,p=0,h="0",m=r&&[],v=[],y=A,b=r||o&&T.find.TAG("*",l),x=W+=null==y?1:Math.random()||.1,w=b.length;for(l&&(A=a!==H&&a);h!==w&&null!=(c=b[h]);h++){if(o&&c){for(d=0;f=e[d++];)if(f(c,a,s)){u.push(c);break}l&&(W=x)}i&&((c=!f&&c)&&p--,r&&m.push(c))}if(p+=h,i&&h!==p){for(d=0;f=n[d++];)f(m,v,a,s);if(r){if(p>0)for(;h--;)m[h]||v[h]||(v[h]=Q.call(u));v=g(v)}K.apply(u,v),l&&!r&&v.length>0&&p+n.length>1&&t.uniqueSort(u)}return l&&(W=x,A=y),m};return i?r(a):a}var x,w,T,C,N,E,k,S,A,D,j,L,H,q,_,M,F,O,B,P="sizzle"+1*new Date,R=e.document,W=0,$=0,z=n(),I=n(),X=n(),U=function(e,t){return e===t&&(j=!0),0},V=1<<31,J={}.hasOwnProperty,Y=[],Q=Y.pop,G=Y.push,K=Y.push,Z=Y.slice,et=function(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1},tt="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",nt="[\\x20\\t\\r\\n\\f]",rt="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",it=rt.replace("w","w#"),ot="\\["+nt+"*("+rt+")(?:"+nt+"*([*^$|!~]?=)"+nt+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+it+"))|)"+nt+"*\\]",at=":("+rt+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ot+")*)|.*)\\)|)",st=new RegExp(nt+"+","g"),ut=new RegExp("^"+nt+"+|((?:^|[^\\\\])(?:\\\\.)*)"+nt+"+$","g"),lt=new RegExp("^"+nt+"*,"+nt+"*"),ct=new RegExp("^"+nt+"*([>+~]|"+nt+")"+nt+"*"),dt=new RegExp("="+nt+"*([^\\]'\"]*?)"+nt+"*\\]","g"),ft=new RegExp(at),pt=new RegExp("^"+it+"$"),ht={ID:new RegExp("^#("+rt+")"),CLASS:new RegExp("^\\.("+rt+")"),TAG:new RegExp("^("+rt.replace("w","w*")+")"),ATTR:new RegExp("^"+ot),PSEUDO:new RegExp("^"+at),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+nt+"*(even|odd|(([+-]|)(\\d*)n|)"+nt+"*(?:([+-]|)"+nt+"*(\\d+)|))"+nt+"*\\)|)","i"),bool:new RegExp("^(?:"+tt+")$","i"),needsContext:new RegExp("^"+nt+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+nt+"*((?:-\\d)?\\d*)"+nt+"*\\)|)(?=[^-]|$)","i")},mt=/^(?:input|select|textarea|button)$/i,gt=/^h\d$/i,vt=/^[^{]+\{\s*\[native \w/,yt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,bt=/[+~]/,xt=/'|\\/g,wt=new RegExp("\\\\([\\da-f]{1,6}"+nt+"?|("+nt+")|.)","ig"),Tt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},Ct=function(){L()};try{K.apply(Y=Z.call(R.childNodes),R.childNodes),Y[R.childNodes.length].nodeType}catch(Nt){K={apply:Y.length?function(e,t){G.apply(e,Z.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}w=t.support={},N=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},L=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:R;return r!==H&&9===r.nodeType&&r.documentElement?(H=r,q=r.documentElement,n=r.defaultView,n&&n!==n.top&&(n.addEventListener?n.addEventListener("unload",Ct,!1):n.attachEvent&&n.attachEvent("onunload",Ct)),_=!N(r),w.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),w.getElementsByTagName=i(function(e){return e.appendChild(r.createComment("")),!e.getElementsByTagName("*").length}),w.getElementsByClassName=vt.test(r.getElementsByClassName),w.getById=i(function(e){return q.appendChild(e).id=P,!r.getElementsByName||!r.getElementsByName(P).length}),w.getById?(T.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&_){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},T.filter.ID=function(e){var t=e.replace(wt,Tt);return function(e){return e.getAttribute("id")===t}}):(delete T.find.ID,T.filter.ID=function(e){var t=e.replace(wt,Tt);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),T.find.TAG=w.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):w.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},T.find.CLASS=w.getElementsByClassName&&function(e,t){return _?t.getElementsByClassName(e):void 0},F=[],M=[],(w.qsa=vt.test(r.querySelectorAll))&&(i(function(e){q.appendChild(e).innerHTML="<a id='"+P+"'></a><select id='"+P+"-\f]' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&M.push("[*^$]="+nt+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||M.push("\\["+nt+"*(?:value|"+tt+")"),e.querySelectorAll("[id~="+P+"-]").length||M.push("~="),e.querySelectorAll(":checked").length||M.push(":checked"),e.querySelectorAll("a#"+P+"+*").length||M.push(".#.+[+~]")}),i(function(e){var t=r.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&M.push("name"+nt+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||M.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),M.push(",.*:")})),(w.matchesSelector=vt.test(O=q.matches||q.webkitMatchesSelector||q.mozMatchesSelector||q.oMatchesSelector||q.msMatchesSelector))&&i(function(e){w.disconnectedMatch=O.call(e,"div"),O.call(e,"[s!='']:x"),F.push("!=",at)}),M=M.length&&new RegExp(M.join("|")),F=F.length&&new RegExp(F.join("|")),t=vt.test(q.compareDocumentPosition),B=t||vt.test(q.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},U=t?function(e,t){if(e===t)return j=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!w.sortDetached&&t.compareDocumentPosition(e)===n?e===r||e.ownerDocument===R&&B(R,e)?-1:t===r||t.ownerDocument===R&&B(R,t)?1:D?et(D,e)-et(D,t):0:4&n?-1:1)}:function(e,t){if(e===t)return j=!0,0;var n,i=0,o=e.parentNode,s=t.parentNode,u=[e],l=[t];if(!o||!s)return e===r?-1:t===r?1:o?-1:s?1:D?et(D,e)-et(D,t):0;if(o===s)return a(e,t);for(n=e;n=n.parentNode;)u.unshift(n);for(n=t;n=n.parentNode;)l.unshift(n);for(;u[i]===l[i];)i++;return i?a(u[i],l[i]):u[i]===R?-1:l[i]===R?1:0},r):H},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==H&&L(e),n=n.replace(dt,"='$1']"),!(!w.matchesSelector||!_||F&&F.test(n)||M&&M.test(n)))try{var r=O.call(e,n);if(r||w.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return t(n,H,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==H&&L(e),B(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==H&&L(e);var n=T.attrHandle[t.toLowerCase()],r=n&&J.call(T.attrHandle,t.toLowerCase())?n(e,t,!_):void 0;return void 0!==r?r:w.attributes||!_?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(j=!w.detectDuplicates,D=!w.sortStable&&e.slice(0),e.sort(U),j){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return D=null,e},C=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=C(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=C(t);return n},T=t.selectors={cacheLength:50,createPseudo:r,match:ht,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(wt,Tt),e[3]=(e[3]||e[4]||e[5]||"").replace(wt,Tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return ht.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&ft.test(n)&&(t=E(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(wt,Tt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=z[e+" "];return t||(t=new RegExp("(^|"+nt+")"+e+"("+nt+"|$)"))&&z(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(i){var o=t.attr(i,e);return null==o?"!="===n:n?(o+="","="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o.replace(st," ")+" ").indexOf(r)>-1:"|="===n?o===r||o.slice(0,r.length+1)===r+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,d,f,p,h,m=o!==a?"nextSibling":"previousSibling",g=t.parentNode,v=s&&t.nodeName.toLowerCase(),y=!u&&!s;if(g){if(o){for(;m;){for(d=t;d=d[m];)if(s?d.nodeName.toLowerCase()===v:1===d.nodeType)return!1;h=m="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?g.firstChild:g.lastChild],a&&y){for(c=g[P]||(g[P]={}),l=c[e]||[],p=l[0]===W&&l[1],f=l[0]===W&&l[2],d=p&&g.childNodes[p];d=++p&&d&&d[m]||(f=p=0)||h.pop();)if(1===d.nodeType&&++f&&d===t){c[e]=[W,p,f];break}}else if(y&&(l=(t[P]||(t[P]={}))[e])&&l[0]===W)f=l[1];else for(;(d=++p&&d&&d[m]||(f=p=0)||h.pop())&&((s?d.nodeName.toLowerCase()!==v:1!==d.nodeType)||!++f||(y&&((d[P]||(d[P]={}))[e]=[W,f]),d!==t)););return f-=i,f===r||f%r===0&&f/r>=0}}},PSEUDO:function(e,n){var i,o=T.pseudos[e]||T.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[P]?o(n):o.length>1?(i=[e,e,"",n],T.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,i=o(e,n),a=i.length;a--;)r=et(e,i[a]),e[r]=!(t[r]=i[a])}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=k(e.replace(ut,"$1"));return i[P]?r(function(e,t,n,r){for(var o,a=i(e,null,r,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,r,o){return t[0]=e,i(t,null,o,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(wt,Tt),function(t){return(t.textContent||t.innerText||C(t)).indexOf(e)>-1}}),lang:r(function(e){return pt.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(wt,Tt).toLowerCase(),function(t){var n;do if(n=_?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===q},focus:function(e){return e===H.activeElement&&(!H.hasFocus||H.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!T.pseudos.empty(e)},header:function(e){return gt.test(e.nodeName)},input:function(e){return mt.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:l(function(){return[0]}),last:l(function(e,t){return[t-1]}),eq:l(function(e,t,n){return[0>n?n+t:n]}),even:l(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:l(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:l(function(e,t,n){for(var r=0>n?n+t:n;--r>=0;)e.push(r);return e}),gt:l(function(e,t,n){for(var r=0>n?n+t:n;++r<t;)e.push(r);return e})}},T.pseudos.nth=T.pseudos.eq;for(x in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})T.pseudos[x]=s(x);for(x in{submit:!0,reset:!0})T.pseudos[x]=u(x);return d.prototype=T.filters=T.pseudos,T.setFilters=new d,E=t.tokenize=function(e,n){var r,i,o,a,s,u,l,c=I[e+" "];if(c)return n?0:c.slice(0);for(s=e,u=[],l=T.preFilter;s;){(!r||(i=lt.exec(s)))&&(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),r=!1,(i=ct.exec(s))&&(r=i.shift(),o.push({value:r,type:i[0].replace(ut," ")}),s=s.slice(r.length)); +for(a in T.filter)!(i=ht[a].exec(s))||l[a]&&!(i=l[a](i))||(r=i.shift(),o.push({value:r,type:a,matches:i}),s=s.slice(r.length));if(!r)break}return n?s.length:s?t.error(e):I(e,u).slice(0)},k=t.compile=function(e,t){var n,r=[],i=[],o=X[e+" "];if(!o){for(t||(t=E(e)),n=t.length;n--;)o=y(t[n]),o[P]?r.push(o):i.push(o);o=X(e,b(i,r)),o.selector=e}return o},S=t.select=function(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,d=!r&&E(e=l.selector||e);if(n=n||[],1===d.length){if(o=d[0]=d[0].slice(0),o.length>2&&"ID"===(a=o[0]).type&&w.getById&&9===t.nodeType&&_&&T.relative[o[1].type]){if(t=(T.find.ID(a.matches[0].replace(wt,Tt),t)||[])[0],!t)return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=ht.needsContext.test(e)?0:o.length;i--&&(a=o[i],!T.relative[s=a.type]);)if((u=T.find[s])&&(r=u(a.matches[0].replace(wt,Tt),bt.test(o[0].type)&&c(t.parentNode)||t))){if(o.splice(i,1),e=r.length&&f(o),!e)return K.apply(n,r),n;break}}return(l||k(e,d))(r,t,!_,n,bt.test(e)&&c(t.parentNode)||t),n},w.sortStable=P.split("").sort(U).join("")===P,w.detectDuplicates=!!j,L(),w.sortDetached=i(function(e){return 1&e.compareDocumentPosition(H.createElement("div"))}),i(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){return n?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),w.attributes&&i(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(tt,function(e,t,n){var r;return n?void 0:e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(e);it.find=lt,it.expr=lt.selectors,it.expr[":"]=it.expr.pseudos,it.unique=lt.uniqueSort,it.text=lt.getText,it.isXMLDoc=lt.isXML,it.contains=lt.contains;var ct=it.expr.match.needsContext,dt=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,ft=/^.[^:#\[\.,]*$/;it.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?it.find.matchesSelector(r,e)?[r]:[]:it.find.matches(e,it.grep(t,function(e){return 1===e.nodeType}))},it.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(it(e).filter(function(){for(t=0;i>t;t++)if(it.contains(r[t],this))return!0}));for(t=0;i>t;t++)it.find(e,r[t],n);return n=this.pushStack(i>1?it.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},filter:function(e){return this.pushStack(r(this,e||[],!1))},not:function(e){return this.pushStack(r(this,e||[],!0))},is:function(e){return!!r(this,"string"==typeof e&&ct.test(e)?it(e):e||[],!1).length}});var pt,ht=e.document,mt=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,gt=it.fn.init=function(e,t){var n,r;if(!e)return this;if("string"==typeof e){if(n="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:mt.exec(e),!n||!n[1]&&t)return!t||t.jquery?(t||pt).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof it?t[0]:t,it.merge(this,it.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:ht,!0)),dt.test(n[1])&&it.isPlainObject(t))for(n in t)it.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}if(r=ht.getElementById(n[2]),r&&r.parentNode){if(r.id!==n[2])return pt.find(e);this.length=1,this[0]=r}return this.context=ht,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):it.isFunction(e)?"undefined"!=typeof pt.ready?pt.ready(e):e(it):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),it.makeArray(e,this))};gt.prototype=it.fn,pt=it(ht);var vt=/^(?:parents|prev(?:Until|All))/,yt={children:!0,contents:!0,next:!0,prev:!0};it.extend({dir:function(e,t,n){for(var r=[],i=e[t];i&&9!==i.nodeType&&(void 0===n||1!==i.nodeType||!it(i).is(n));)1===i.nodeType&&r.push(i),i=i[t];return r},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}}),it.fn.extend({has:function(e){var t,n=it(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(it.contains(this,n[t]))return!0})},closest:function(e,t){for(var n,r=0,i=this.length,o=[],a=ct.test(e)||"string"!=typeof e?it(e,t||this.context):0;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&it.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?it.unique(o):o)},index:function(e){return e?"string"==typeof e?it.inArray(this[0],it(e)):it.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(it.unique(it.merge(this.get(),it(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),it.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return it.dir(e,"parentNode")},parentsUntil:function(e,t,n){return it.dir(e,"parentNode",n)},next:function(e){return i(e,"nextSibling")},prev:function(e){return i(e,"previousSibling")},nextAll:function(e){return it.dir(e,"nextSibling")},prevAll:function(e){return it.dir(e,"previousSibling")},nextUntil:function(e,t,n){return it.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return it.dir(e,"previousSibling",n)},siblings:function(e){return it.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return it.sibling(e.firstChild)},contents:function(e){return it.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:it.merge([],e.childNodes)}},function(e,t){it.fn[e]=function(n,r){var i=it.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=it.filter(r,i)),this.length>1&&(yt[e]||(i=it.unique(i)),vt.test(e)&&(i=i.reverse())),this.pushStack(i)}});var bt=/\S+/g,xt={};it.Callbacks=function(e){e="string"==typeof e?xt[e]||o(e):it.extend({},e);var t,n,r,i,a,s,u=[],l=!e.once&&[],c=function(o){for(n=e.memory&&o,r=!0,a=s||0,s=0,i=u.length,t=!0;u&&i>a;a++)if(u[a].apply(o[0],o[1])===!1&&e.stopOnFalse){n=!1;break}t=!1,u&&(l?l.length&&c(l.shift()):n?u=[]:d.disable())},d={add:function(){if(u){var r=u.length;!function o(t){it.each(t,function(t,n){var r=it.type(n);"function"===r?e.unique&&d.has(n)||u.push(n):n&&n.length&&"string"!==r&&o(n)})}(arguments),t?i=u.length:n&&(s=r,c(n))}return this},remove:function(){return u&&it.each(arguments,function(e,n){for(var r;(r=it.inArray(n,u,r))>-1;)u.splice(r,1),t&&(i>=r&&i--,a>=r&&a--)}),this},has:function(e){return e?it.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],i=0,this},disable:function(){return u=l=n=void 0,this},disabled:function(){return!u},lock:function(){return l=void 0,n||d.disable(),this},locked:function(){return!l},fireWith:function(e,n){return!u||r&&!l||(n=n||[],n=[e,n.slice?n.slice():n],t?l.push(n):c(n)),this},fire:function(){return d.fireWith(this,arguments),this},fired:function(){return!!r}};return d},it.extend({Deferred:function(e){var t=[["resolve","done",it.Callbacks("once memory"),"resolved"],["reject","fail",it.Callbacks("once memory"),"rejected"],["notify","progress",it.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return it.Deferred(function(n){it.each(t,function(t,o){var a=it.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&it.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[o[0]+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?it.extend(e,r):r}},i={};return r.pipe=r.then,it.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=Y.call(arguments),r=n.length,i=1!==r||e&&it.isFunction(e.promise)?r:0,o=1===i?e:it.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?Y.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=new Array(r),u=new Array(r),l=new Array(r);r>t;t++)n[t]&&it.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}});var wt;it.fn.ready=function(e){return it.ready.promise().done(e),this},it.extend({isReady:!1,readyWait:1,holdReady:function(e){e?it.readyWait++:it.ready(!0)},ready:function(e){if(e===!0?!--it.readyWait:!it.isReady){if(!ht.body)return setTimeout(it.ready);it.isReady=!0,e!==!0&&--it.readyWait>0||(wt.resolveWith(ht,[it]),it.fn.triggerHandler&&(it(ht).triggerHandler("ready"),it(ht).off("ready")))}}}),it.ready.promise=function(t){if(!wt)if(wt=it.Deferred(),"complete"===ht.readyState)setTimeout(it.ready);else if(ht.addEventListener)ht.addEventListener("DOMContentLoaded",s,!1),e.addEventListener("load",s,!1);else{ht.attachEvent("onreadystatechange",s),e.attachEvent("onload",s);var n=!1;try{n=null==e.frameElement&&ht.documentElement}catch(r){}n&&n.doScroll&&!function i(){if(!it.isReady){try{n.doScroll("left")}catch(e){return setTimeout(i,50)}a(),it.ready()}}()}return wt.promise(t)};var Tt="undefined",Ct;for(Ct in it(nt))break;nt.ownLast="0"!==Ct,nt.inlineBlockNeedsLayout=!1,it(function(){var e,t,n,r;n=ht.getElementsByTagName("body")[0],n&&n.style&&(t=ht.createElement("div"),r=ht.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),typeof t.style.zoom!==Tt&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",nt.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(r))}),function(){var e=ht.createElement("div");if(null==nt.deleteExpando){nt.deleteExpando=!0;try{delete e.test}catch(t){nt.deleteExpando=!1}}e=null}(),it.acceptData=function(e){var t=it.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return 1!==n&&9!==n?!1:!t||t!==!0&&e.getAttribute("classid")===t};var Nt=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Et=/([A-Z])/g;it.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?it.cache[e[it.expando]]:e[it.expando],!!e&&!l(e)},data:function(e,t,n){return c(e,t,n)},removeData:function(e,t){return d(e,t)},_data:function(e,t,n){return c(e,t,n,!0)},_removeData:function(e,t){return d(e,t,!0)}}),it.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=it.data(o),1===o.nodeType&&!it._data(o,"parsedAttrs"))){for(n=a.length;n--;)a[n]&&(r=a[n].name,0===r.indexOf("data-")&&(r=it.camelCase(r.slice(5)),u(o,r,i[r])));it._data(o,"parsedAttrs",!0)}return i}return"object"==typeof e?this.each(function(){it.data(this,e)}):arguments.length>1?this.each(function(){it.data(this,e,t)}):o?u(o,e,it.data(o,e)):void 0},removeData:function(e){return this.each(function(){it.removeData(this,e)})}}),it.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=it._data(e,t),n&&(!r||it.isArray(n)?r=it._data(e,t,it.makeArray(n)):r.push(n)),r||[]):void 0},dequeue:function(e,t){t=t||"fx";var n=it.queue(e,t),r=n.length,i=n.shift(),o=it._queueHooks(e,t),a=function(){it.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return it._data(e,n)||it._data(e,n,{empty:it.Callbacks("once memory").add(function(){it._removeData(e,t+"queue"),it._removeData(e,n)})})}}),it.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?it.queue(this[0],e):void 0===t?this:this.each(function(){var n=it.queue(this,e,t);it._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&it.dequeue(this,e)})},dequeue:function(e){return this.each(function(){it.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=it.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";a--;)n=it._data(o[a],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var kt=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,St=["Top","Right","Bottom","Left"],At=function(e,t){return e=t||e,"none"===it.css(e,"display")||!it.contains(e.ownerDocument,e)},Dt=it.access=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===it.type(n)){i=!0;for(s in n)it.access(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,it.isFunction(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(it(e),n)})),t))for(;u>s;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},jt=/^(?:checkbox|radio)$/i;!function(){var e=ht.createElement("input"),t=ht.createElement("div"),n=ht.createDocumentFragment();if(t.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",nt.leadingWhitespace=3===t.firstChild.nodeType,nt.tbody=!t.getElementsByTagName("tbody").length,nt.htmlSerialize=!!t.getElementsByTagName("link").length,nt.html5Clone="<:nav></:nav>"!==ht.createElement("nav").cloneNode(!0).outerHTML,e.type="checkbox",e.checked=!0,n.appendChild(e),nt.appendChecked=e.checked,t.innerHTML="<textarea>x</textarea>",nt.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue,n.appendChild(t),t.innerHTML="<input type='radio' checked='checked' name='t'/>",nt.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,nt.noCloneEvent=!0,t.attachEvent&&(t.attachEvent("onclick",function(){nt.noCloneEvent=!1}),t.cloneNode(!0).click()),null==nt.deleteExpando){nt.deleteExpando=!0;try{delete t.test}catch(r){nt.deleteExpando=!1}}}(),function(){var t,n,r=ht.createElement("div");for(t in{submit:!0,change:!0,focusin:!0})n="on"+t,(nt[t+"Bubbles"]=n in e)||(r.setAttribute(n,"t"),nt[t+"Bubbles"]=r.attributes[n].expando===!1);r=null}();var Lt=/^(?:input|select|textarea)$/i,Ht=/^key/,qt=/^(?:mouse|pointer|contextmenu)|click/,_t=/^(?:focusinfocus|focusoutblur)$/,Mt=/^([^.]*)(?:\.(.+)|)$/;it.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,d,f,p,h,m,g=it._data(e);if(g){for(n.handler&&(u=n,n=u.handler,i=u.selector),n.guid||(n.guid=it.guid++),(a=g.events)||(a=g.events={}),(c=g.handle)||(c=g.handle=function(e){return typeof it===Tt||e&&it.event.triggered===e.type?void 0:it.event.dispatch.apply(c.elem,arguments)},c.elem=e),t=(t||"").match(bt)||[""],s=t.length;s--;)o=Mt.exec(t[s])||[],p=m=o[1],h=(o[2]||"").split(".").sort(),p&&(l=it.event.special[p]||{},p=(i?l.delegateType:l.bindType)||p,l=it.event.special[p]||{},d=it.extend({type:p,origType:m,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&it.expr.match.needsContext.test(i),namespace:h.join(".")},u),(f=a[p])||(f=a[p]=[],f.delegateCount=0,l.setup&&l.setup.call(e,r,h,c)!==!1||(e.addEventListener?e.addEventListener(p,c,!1):e.attachEvent&&e.attachEvent("on"+p,c))),l.add&&(l.add.call(e,d),d.handler.guid||(d.handler.guid=n.guid)),i?f.splice(f.delegateCount++,0,d):f.push(d),it.event.global[p]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,d,f,p,h,m,g=it.hasData(e)&&it._data(e);if(g&&(c=g.events)){for(t=(t||"").match(bt)||[""],l=t.length;l--;)if(s=Mt.exec(t[l])||[],p=m=s[1],h=(s[2]||"").split(".").sort(),p){for(d=it.event.special[p]||{},p=(r?d.delegateType:d.bindType)||p,f=c[p]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;o--;)a=f[o],!i&&m!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,d.remove&&d.remove.call(e,a));u&&!f.length&&(d.teardown&&d.teardown.call(e,h,g.handle)!==!1||it.removeEvent(e,p,g.handle),delete c[p])}else for(p in c)it.event.remove(e,p+t[l],n,r,!0);it.isEmptyObject(c)&&(delete g.handle,it._removeData(e,"events"))}},trigger:function(t,n,r,i){var o,a,s,u,l,c,d,f=[r||ht],p=tt.call(t,"type")?t.type:t,h=tt.call(t,"namespace")?t.namespace.split("."):[];if(s=c=r=r||ht,3!==r.nodeType&&8!==r.nodeType&&!_t.test(p+it.event.triggered)&&(p.indexOf(".")>=0&&(h=p.split("."),p=h.shift(),h.sort()),a=p.indexOf(":")<0&&"on"+p,t=t[it.expando]?t:new it.Event(p,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=h.join("."),t.namespace_re=t.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:it.makeArray(n,[t]),l=it.event.special[p]||{},i||!l.trigger||l.trigger.apply(r,n)!==!1)){if(!i&&!l.noBubble&&!it.isWindow(r)){for(u=l.delegateType||p,_t.test(u+p)||(s=s.parentNode);s;s=s.parentNode)f.push(s),c=s;c===(r.ownerDocument||ht)&&f.push(c.defaultView||c.parentWindow||e)}for(d=0;(s=f[d++])&&!t.isPropagationStopped();)t.type=d>1?u:l.bindType||p,o=(it._data(s,"events")||{})[t.type]&&it._data(s,"handle"),o&&o.apply(s,n),o=a&&s[a],o&&o.apply&&it.acceptData(s)&&(t.result=o.apply(s,n),t.result===!1&&t.preventDefault());if(t.type=p,!i&&!t.isDefaultPrevented()&&(!l._default||l._default.apply(f.pop(),n)===!1)&&it.acceptData(r)&&a&&r[p]&&!it.isWindow(r)){c=r[a],c&&(r[a]=null),it.event.triggered=p;try{r[p]()}catch(m){}it.event.triggered=void 0,c&&(r[a]=c)}return t.result}},dispatch:function(e){e=it.event.fix(e);var t,n,r,i,o,a=[],s=Y.call(arguments),u=(it._data(this,"events")||{})[e.type]||[],l=it.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){for(a=it.event.handlers.call(this,e,u),t=0;(i=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=i.elem,o=0;(r=i.handlers[o++])&&!e.isImmediatePropagationStopped();)(!e.namespace_re||e.namespace_re.test(r.namespace))&&(e.handleObj=r,e.data=r.data,n=((it.event.special[r.origType]||{}).handle||r.handler).apply(i.elem,s),void 0!==n&&(e.result=n)===!1&&(e.preventDefault(),e.stopPropagation()));return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,a=[],s=t.delegateCount,u=e.target;if(s&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(i=[],o=0;s>o;o++)r=t[o],n=r.selector+" ",void 0===i[n]&&(i[n]=r.needsContext?it(n,this).index(u)>=0:it.find(n,this,null,[u]).length),i[n]&&i.push(r);i.length&&a.push({elem:u,handlers:i})}return s<t.length&&a.push({elem:this,handlers:t.slice(s)}),a},fix:function(e){if(e[it.expando])return e;var t,n,r,i=e.type,o=e,a=this.fixHooks[i];for(a||(this.fixHooks[i]=a=qt.test(i)?this.mouseHooks:Ht.test(i)?this.keyHooks:{}),r=a.props?this.props.concat(a.props):this.props,e=new it.Event(o),t=r.length;t--;)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||ht),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,a.filter?a.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,o=t.button,a=t.fromElement;return null==e.pageX&&null!=t.clientX&&(r=e.target.ownerDocument||ht,i=r.documentElement,n=r.body,e.pageX=t.clientX+(i&&i.scrollLeft||n&&n.scrollLeft||0)-(i&&i.clientLeft||n&&n.clientLeft||0),e.pageY=t.clientY+(i&&i.scrollTop||n&&n.scrollTop||0)-(i&&i.clientTop||n&&n.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?t.toElement:a),e.which||void 0===o||(e.which=1&o?1:2&o?3:4&o?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==h()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===h()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return it.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(e){return it.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=it.extend(new it.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?it.event.trigger(i,null,t):it.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},it.removeEvent=ht.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===Tt&&(e[r]=null),e.detachEvent(r,n))},it.Event=function(e,t){return this instanceof it.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&e.returnValue===!1?f:p):this.type=e,t&&it.extend(this,t),this.timeStamp=e&&e.timeStamp||it.now(),void(this[it.expando]=!0)):new it.Event(e,t)},it.Event.prototype={isDefaultPrevented:p,isPropagationStopped:p,isImmediatePropagationStopped:p,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=f,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=f,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=f,e&&e.stopImmediatePropagation&&e.stopImmediatePropagation(),this.stopPropagation()}},it.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){it.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!it.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),nt.submitBubbles||(it.event.special.submit={setup:function(){return it.nodeName(this,"form")?!1:void it.event.add(this,"click._submit keypress._submit",function(e){var t=e.target,n=it.nodeName(t,"input")||it.nodeName(t,"button")?t.form:void 0;n&&!it._data(n,"submitBubbles")&&(it.event.add(n,"submit._submit",function(e){e._submit_bubble=!0}),it._data(n,"submitBubbles",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&it.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return it.nodeName(this,"form")?!1:void it.event.remove(this,"._submit")}}),nt.changeBubbles||(it.event.special.change={setup:function(){return Lt.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(it.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),it.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),it.event.simulate("change",this,e,!0)})),!1):void it.event.add(this,"beforeactivate._change",function(e){var t=e.target;Lt.test(t.nodeName)&&!it._data(t,"changeBubbles")&&(it.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||it.event.simulate("change",this.parentNode,e,!0)}),it._data(t,"changeBubbles",!0))})},handle:function(e){var t=e.target;return this!==t||e.isSimulated||e.isTrigger||"radio"!==t.type&&"checkbox"!==t.type?e.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return it.event.remove(this,"._change"),!Lt.test(this.nodeName)}}),nt.focusinBubbles||it.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){it.event.simulate(t,e.target,it.event.fix(e),!0)};it.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=it._data(r,t);i||r.addEventListener(e,n,!0),it._data(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=it._data(r,t)-1;i?it._data(r,t,i):(r.removeEventListener(e,n,!0),it._removeData(r,t))}}}),it.fn.extend({on:function(e,t,n,r,i){var o,a;if("object"==typeof e){"string"!=typeof t&&(n=n||t,t=void 0);for(o in e)this.on(o,t,n,e[o],i);return this}if(null==n&&null==r?(r=t,n=t=void 0):null==r&&("string"==typeof t?(r=n,n=void 0):(r=n,n=t,t=void 0)),r===!1)r=p;else if(!r)return this;return 1===i&&(a=r,r=function(e){return it().off(e),a.apply(this,arguments)},r.guid=a.guid||(a.guid=it.guid++)),this.each(function(){it.event.add(this,e,r,n,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,it(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return(t===!1||"function"==typeof t)&&(n=t,t=void 0),n===!1&&(n=p),this.each(function(){it.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){it.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?it.event.trigger(e,t,n,!0):void 0}});var Ft="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Ot=/ jQuery\d+="(?:null|\d+)"/g,Bt=new RegExp("<(?:"+Ft+")[\\s/>]","i"),Pt=/^\s+/,Rt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Wt=/<([\w:]+)/,$t=/<tbody/i,zt=/<|&#?\w+;/,It=/<(?:script|style|link)/i,Xt=/checked\s*(?:[^=]|=\s*.checked.)/i,Ut=/^$|\/(?:java|ecma)script/i,Vt=/^true\/(.*)/,Jt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Yt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:nt.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Qt=m(ht),Gt=Qt.appendChild(ht.createElement("div"));Yt.optgroup=Yt.option,Yt.tbody=Yt.tfoot=Yt.colgroup=Yt.caption=Yt.thead,Yt.th=Yt.td,it.extend({clone:function(e,t,n){var r,i,o,a,s,u=it.contains(e.ownerDocument,e);if(nt.html5Clone||it.isXMLDoc(e)||!Bt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Gt.innerHTML=e.outerHTML,Gt.removeChild(o=Gt.firstChild)),!(nt.noCloneEvent&&nt.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||it.isXMLDoc(e)))for(r=g(o),s=g(e),a=0;null!=(i=s[a]);++a)r[a]&&C(i,r[a]);if(t)if(n)for(s=s||g(e),r=r||g(o),a=0;null!=(i=s[a]);a++)T(i,r[a]);else T(e,o);return r=g(o,"script"),r.length>0&&w(r,!u&&g(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){for(var i,o,a,s,u,l,c,d=e.length,f=m(t),p=[],h=0;d>h;h++)if(o=e[h],o||0===o)if("object"===it.type(o))it.merge(p,o.nodeType?[o]:o);else if(zt.test(o)){for(s=s||f.appendChild(t.createElement("div")),u=(Wt.exec(o)||["",""])[1].toLowerCase(),c=Yt[u]||Yt._default,s.innerHTML=c[1]+o.replace(Rt,"<$1></$2>")+c[2],i=c[0];i--;)s=s.lastChild;if(!nt.leadingWhitespace&&Pt.test(o)&&p.push(t.createTextNode(Pt.exec(o)[0])),!nt.tbody)for(o="table"!==u||$t.test(o)?"<table>"!==c[1]||$t.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;i--;)it.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l);for(it.merge(p,s.childNodes),s.textContent="";s.firstChild;)s.removeChild(s.firstChild);s=f.lastChild}else p.push(t.createTextNode(o));for(s&&f.removeChild(s),nt.appendChecked||it.grep(g(p,"input"),v),h=0;o=p[h++];)if((!r||-1===it.inArray(o,r))&&(a=it.contains(o.ownerDocument,o),s=g(f.appendChild(o),"script"),a&&w(s),n))for(i=0;o=s[i++];)Ut.test(o.type||"")&&n.push(o);return s=null,f},cleanData:function(e,t){for(var n,r,i,o,a=0,s=it.expando,u=it.cache,l=nt.deleteExpando,c=it.event.special;null!=(n=e[a]);a++)if((t||it.acceptData(n))&&(i=n[s],o=i&&u[i])){if(o.events)for(r in o.events)c[r]?it.event.remove(n,r):it.removeEvent(n,r,o.handle);u[i]&&(delete u[i],l?delete n[s]:typeof n.removeAttribute!==Tt?n.removeAttribute(s):n[s]=null,J.push(i))}}}),it.fn.extend({text:function(e){return Dt(this,function(e){return void 0===e?it.text(this):this.empty().append((this[0]&&this[0].ownerDocument||ht).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=y(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=y(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){for(var n,r=e?it.filter(e,this):this,i=0;null!=(n=r[i]);i++)t||1!==n.nodeType||it.cleanData(g(n)),n.parentNode&&(t&&it.contains(n.ownerDocument,n)&&w(g(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&it.cleanData(g(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&it.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return it.clone(this,e,t)})},html:function(e){return Dt(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e)return 1===t.nodeType?t.innerHTML.replace(Ot,""):void 0;if(!("string"!=typeof e||It.test(e)||!nt.htmlSerialize&&Bt.test(e)||!nt.leadingWhitespace&&Pt.test(e)||Yt[(Wt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(Rt,"<$1></$2>");try{for(;r>n;n++)t=this[n]||{},1===t.nodeType&&(it.cleanData(g(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=arguments[0];return this.domManip(arguments,function(t){e=this.parentNode,it.cleanData(g(this)),e&&e.replaceChild(t,this)}),e&&(e.length||e.nodeType)?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t){e=Q.apply([],e);var n,r,i,o,a,s,u=0,l=this.length,c=this,d=l-1,f=e[0],p=it.isFunction(f);if(p||l>1&&"string"==typeof f&&!nt.checkClone&&Xt.test(f))return this.each(function(n){var r=c.eq(n);p&&(e[0]=f.call(this,n,r.html())),r.domManip(e,t)});if(l&&(s=it.buildFragment(e,this[0].ownerDocument,!1,this),n=s.firstChild,1===s.childNodes.length&&(s=n),n)){for(o=it.map(g(s,"script"),b),i=o.length;l>u;u++)r=s,u!==d&&(r=it.clone(r,!0,!0),i&&it.merge(o,g(r,"script"))),t.call(this[u],r,u);if(i)for(a=o[o.length-1].ownerDocument,it.map(o,x),u=0;i>u;u++)r=o[u],Ut.test(r.type||"")&&!it._data(r,"globalEval")&&it.contains(a,r)&&(r.src?it._evalUrl&&it._evalUrl(r.src):it.globalEval((r.text||r.textContent||r.innerHTML||"").replace(Jt,"")));s=n=null}return this}}),it.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){it.fn[e]=function(e){for(var n,r=0,i=[],o=it(e),a=o.length-1;a>=r;r++)n=r===a?this:this.clone(!0),it(o[r])[t](n),G.apply(i,n.get());return this.pushStack(i)}});var Kt,Zt={};!function(){var e;nt.shrinkWrapBlocks=function(){if(null!=e)return e;e=!1;var t,n,r;return n=ht.getElementsByTagName("body")[0],n&&n.style?(t=ht.createElement("div"),r=ht.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),typeof t.style.zoom!==Tt&&(t.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",t.appendChild(ht.createElement("div")).style.width="5px",e=3!==t.offsetWidth),n.removeChild(r),e):void 0}}();var en=/^margin/,tn=new RegExp("^("+kt+")(?!px)[a-z%]+$","i"),nn,rn,on=/^(top|right|bottom|left)$/;e.getComputedStyle?(nn=function(t){return t.ownerDocument.defaultView.opener?t.ownerDocument.defaultView.getComputedStyle(t,null):e.getComputedStyle(t,null)},rn=function(e,t,n){var r,i,o,a,s=e.style;return n=n||nn(e),a=n?n.getPropertyValue(t)||n[t]:void 0,n&&(""!==a||it.contains(e.ownerDocument,e)||(a=it.style(e,t)),tn.test(a)&&en.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0===a?a:a+"" +}):ht.documentElement.currentStyle&&(nn=function(e){return e.currentStyle},rn=function(e,t,n){var r,i,o,a,s=e.style;return n=n||nn(e),a=n?n[t]:void 0,null==a&&s&&s[t]&&(a=s[t]),tn.test(a)&&!on.test(t)&&(r=s.left,i=e.runtimeStyle,o=i&&i.left,o&&(i.left=e.currentStyle.left),s.left="fontSize"===t?"1em":a,a=s.pixelLeft+"px",s.left=r,o&&(i.left=o)),void 0===a?a:a+""||"auto"}),function(){function t(){var t,n,r,i;n=ht.getElementsByTagName("body")[0],n&&n.style&&(t=ht.createElement("div"),r=ht.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),t.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",o=a=!1,u=!0,e.getComputedStyle&&(o="1%"!==(e.getComputedStyle(t,null)||{}).top,a="4px"===(e.getComputedStyle(t,null)||{width:"4px"}).width,i=t.appendChild(ht.createElement("div")),i.style.cssText=t.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",t.style.width="1px",u=!parseFloat((e.getComputedStyle(i,null)||{}).marginRight),t.removeChild(i)),t.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=t.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",s=0===i[0].offsetHeight,s&&(i[0].style.display="",i[1].style.display="none",s=0===i[0].offsetHeight),n.removeChild(r))}var n,r,i,o,a,s,u;n=ht.createElement("div"),n.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",i=n.getElementsByTagName("a")[0],r=i&&i.style,r&&(r.cssText="float:left;opacity:.5",nt.opacity="0.5"===r.opacity,nt.cssFloat=!!r.cssFloat,n.style.backgroundClip="content-box",n.cloneNode(!0).style.backgroundClip="",nt.clearCloneStyle="content-box"===n.style.backgroundClip,nt.boxSizing=""===r.boxSizing||""===r.MozBoxSizing||""===r.WebkitBoxSizing,it.extend(nt,{reliableHiddenOffsets:function(){return null==s&&t(),s},boxSizingReliable:function(){return null==a&&t(),a},pixelPosition:function(){return null==o&&t(),o},reliableMarginRight:function(){return null==u&&t(),u}}))}(),it.swap=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};var an=/alpha\([^)]*\)/i,sn=/opacity\s*=\s*([^)]*)/,un=/^(none|table(?!-c[ea]).+)/,ln=new RegExp("^("+kt+")(.*)$","i"),cn=new RegExp("^([+-])=("+kt+")","i"),dn={position:"absolute",visibility:"hidden",display:"block"},fn={letterSpacing:"0",fontWeight:"400"},pn=["Webkit","O","Moz","ms"];it.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=rn(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":nt.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=it.camelCase(t),u=e.style;if(t=it.cssProps[s]||(it.cssProps[s]=S(u,s)),a=it.cssHooks[t]||it.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:u[t];if(o=typeof n,"string"===o&&(i=cn.exec(n))&&(n=(i[1]+1)*i[2]+parseFloat(it.css(e,t)),o="number"),null!=n&&n===n&&("number"!==o||it.cssNumber[s]||(n+="px"),nt.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),!(a&&"set"in a&&void 0===(n=a.set(e,n,r)))))try{u[t]=n}catch(l){}}},css:function(e,t,n,r){var i,o,a,s=it.camelCase(t);return t=it.cssProps[s]||(it.cssProps[s]=S(e.style,s)),a=it.cssHooks[t]||it.cssHooks[s],a&&"get"in a&&(o=a.get(e,!0,n)),void 0===o&&(o=rn(e,t,r)),"normal"===o&&t in fn&&(o=fn[t]),""===n||n?(i=parseFloat(o),n===!0||it.isNumeric(i)?i||0:o):o}}),it.each(["height","width"],function(e,t){it.cssHooks[t]={get:function(e,n,r){return n?un.test(it.css(e,"display"))&&0===e.offsetWidth?it.swap(e,dn,function(){return L(e,t,r)}):L(e,t,r):void 0},set:function(e,n,r){var i=r&&nn(e);return D(e,n,r?j(e,t,r,nt.boxSizing&&"border-box"===it.css(e,"boxSizing",!1,i),i):0)}}}),nt.opacity||(it.cssHooks.opacity={get:function(e,t){return sn.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=it.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===it.trim(o.replace(an,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=an.test(o)?o.replace(an,i):o+" "+i)}}),it.cssHooks.marginRight=k(nt.reliableMarginRight,function(e,t){return t?it.swap(e,{display:"inline-block"},rn,[e,"marginRight"]):void 0}),it.each({margin:"",padding:"",border:"Width"},function(e,t){it.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];4>r;r++)i[e+St[r]+t]=o[r]||o[r-2]||o[0];return i}},en.test(e)||(it.cssHooks[e+t].set=D)}),it.fn.extend({css:function(e,t){return Dt(this,function(e,t,n){var r,i,o={},a=0;if(it.isArray(t)){for(r=nn(e),i=t.length;i>a;a++)o[t[a]]=it.css(e,t[a],!1,r);return o}return void 0!==n?it.style(e,t,n):it.css(e,t)},e,t,arguments.length>1)},show:function(){return A(this,!0)},hide:function(){return A(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){At(this)?it(this).show():it(this).hide()})}}),it.Tween=H,H.prototype={constructor:H,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(it.cssNumber[n]?"":"px")},cur:function(){var e=H.propHooks[this.prop];return e&&e.get?e.get(this):H.propHooks._default.get(this)},run:function(e){var t,n=H.propHooks[this.prop];return this.pos=t=this.options.duration?it.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):H.propHooks._default.set(this),this}},H.prototype.init.prototype=H.prototype,H.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=it.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){it.fx.step[e.prop]?it.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[it.cssProps[e.prop]]||it.cssHooks[e.prop])?it.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},H.propHooks.scrollTop=H.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},it.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},it.fx=H.prototype.init,it.fx.step={};var hn,mn,gn=/^(?:toggle|show|hide)$/,vn=new RegExp("^(?:([+-])=|)("+kt+")([a-z%]*)$","i"),yn=/queueHooks$/,bn=[F],xn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=vn.exec(t),o=i&&i[3]||(it.cssNumber[e]?"":"px"),a=(it.cssNumber[e]||"px"!==o&&+r)&&vn.exec(it.css(n.elem,e)),s=1,u=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,it.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--u)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};it.Animation=it.extend(B,{tweener:function(e,t){it.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,i=e.length;i>r;r++)n=e[r],xn[n]=xn[n]||[],xn[n].unshift(t)},prefilter:function(e,t){t?bn.unshift(e):bn.push(e)}}),it.speed=function(e,t,n){var r=e&&"object"==typeof e?it.extend({},e):{complete:n||!n&&t||it.isFunction(e)&&e,duration:e,easing:n&&t||t&&!it.isFunction(t)&&t};return r.duration=it.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in it.fx.speeds?it.fx.speeds[r.duration]:it.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){it.isFunction(r.old)&&r.old.call(this),r.queue&&it.dequeue(this,r.queue)},r},it.fn.extend({fadeTo:function(e,t,n,r){return this.filter(At).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=it.isEmptyObject(e),o=it.speed(t,n,r),a=function(){var t=B(this,it.extend({},e),o);(i||it._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=it.timers,a=it._data(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&yn.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));(t||!n)&&it.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=it._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=it.timers,a=r?r.length:0;for(n.finish=!0,it.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),it.each(["toggle","show","hide"],function(e,t){var n=it.fn[t];it.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(_(t,!0),e,r,i)}}),it.each({slideDown:_("show"),slideUp:_("hide"),slideToggle:_("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){it.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),it.timers=[],it.fx.tick=function(){var e,t=it.timers,n=0;for(hn=it.now();n<t.length;n++)e=t[n],e()||t[n]!==e||t.splice(n--,1);t.length||it.fx.stop(),hn=void 0},it.fx.timer=function(e){it.timers.push(e),e()?it.fx.start():it.timers.pop()},it.fx.interval=13,it.fx.start=function(){mn||(mn=setInterval(it.fx.tick,it.fx.interval))},it.fx.stop=function(){clearInterval(mn),mn=null},it.fx.speeds={slow:600,fast:200,_default:400},it.fn.delay=function(e,t){return e=it.fx?it.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},function(){var e,t,n,r,i;t=ht.createElement("div"),t.setAttribute("className","t"),t.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",r=t.getElementsByTagName("a")[0],n=ht.createElement("select"),i=n.appendChild(ht.createElement("option")),e=t.getElementsByTagName("input")[0],r.style.cssText="top:1px",nt.getSetAttribute="t"!==t.className,nt.style=/top/.test(r.getAttribute("style")),nt.hrefNormalized="/a"===r.getAttribute("href"),nt.checkOn=!!e.value,nt.optSelected=i.selected,nt.enctype=!!ht.createElement("form").enctype,n.disabled=!0,nt.optDisabled=!i.disabled,e=ht.createElement("input"),e.setAttribute("value",""),nt.input=""===e.getAttribute("value"),e.value="t",e.setAttribute("type","radio"),nt.radioValue="t"===e.value}();var wn=/\r/g;it.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=it.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,it(this).val()):e,null==i?i="":"number"==typeof i?i+="":it.isArray(i)&&(i=it.map(i,function(e){return null==e?"":e+""})),t=it.valHooks[this.type]||it.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return t=it.valHooks[i.type]||it.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(wn,""):null==n?"":n)}}}),it.extend({valHooks:{option:{get:function(e){var t=it.find.attr(e,"value");return null!=t?t:it.trim(it.text(e))}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(nt.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&it.nodeName(n.parentNode,"optgroup"))){if(t=it(n).val(),o)return t;a.push(t)}return a},set:function(e,t){for(var n,r,i=e.options,o=it.makeArray(t),a=i.length;a--;)if(r=i[a],it.inArray(it.valHooks.option.get(r),o)>=0)try{r.selected=n=!0}catch(s){r.scrollHeight}else r.selected=!1;return n||(e.selectedIndex=-1),i}}}}),it.each(["radio","checkbox"],function(){it.valHooks[this]={set:function(e,t){return it.isArray(t)?e.checked=it.inArray(it(e).val(),t)>=0:void 0}},nt.checkOn||(it.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Tn,Cn,Nn=it.expr.attrHandle,En=/^(?:checked|selected)$/i,kn=nt.getSetAttribute,Sn=nt.input;it.fn.extend({attr:function(e,t){return Dt(this,it.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){it.removeAttr(this,e)})}}),it.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(e&&3!==o&&8!==o&&2!==o)return typeof e.getAttribute===Tt?it.prop(e,t,n):(1===o&&it.isXMLDoc(e)||(t=t.toLowerCase(),r=it.attrHooks[t]||(it.expr.match.bool.test(t)?Cn:Tn)),void 0===n?r&&"get"in r&&null!==(i=r.get(e,t))?i:(i=it.find.attr(e,t),null==i?void 0:i):null!==n?r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:(e.setAttribute(t,n+""),n):void it.removeAttr(e,t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(bt);if(o&&1===e.nodeType)for(;n=o[i++];)r=it.propFix[n]||n,it.expr.match.bool.test(n)?Sn&&kn||!En.test(n)?e[r]=!1:e[it.camelCase("default-"+n)]=e[r]=!1:it.attr(e,n,""),e.removeAttribute(kn?n:r)},attrHooks:{type:{set:function(e,t){if(!nt.radioValue&&"radio"===t&&it.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}}}),Cn={set:function(e,t,n){return t===!1?it.removeAttr(e,n):Sn&&kn||!En.test(n)?e.setAttribute(!kn&&it.propFix[n]||n,n):e[it.camelCase("default-"+n)]=e[n]=!0,n}},it.each(it.expr.match.bool.source.match(/\w+/g),function(e,t){var n=Nn[t]||it.find.attr;Nn[t]=Sn&&kn||!En.test(t)?function(e,t,r){var i,o;return r||(o=Nn[t],Nn[t]=i,i=null!=n(e,t,r)?t.toLowerCase():null,Nn[t]=o),i}:function(e,t,n){return n?void 0:e[it.camelCase("default-"+t)]?t.toLowerCase():null}}),Sn&&kn||(it.attrHooks.value={set:function(e,t,n){return it.nodeName(e,"input")?void(e.defaultValue=t):Tn&&Tn.set(e,t,n)}}),kn||(Tn={set:function(e,t,n){var r=e.getAttributeNode(n);return r||e.setAttributeNode(r=e.ownerDocument.createAttribute(n)),r.value=t+="","value"===n||t===e.getAttribute(n)?t:void 0}},Nn.id=Nn.name=Nn.coords=function(e,t,n){var r;return n?void 0:(r=e.getAttributeNode(t))&&""!==r.value?r.value:null},it.valHooks.button={get:function(e,t){var n=e.getAttributeNode(t);return n&&n.specified?n.value:void 0},set:Tn.set},it.attrHooks.contenteditable={set:function(e,t,n){Tn.set(e,""===t?!1:t,n)}},it.each(["width","height"],function(e,t){it.attrHooks[t]={set:function(e,n){return""===n?(e.setAttribute(t,"auto"),n):void 0}}})),nt.style||(it.attrHooks.style={get:function(e){return e.style.cssText||void 0},set:function(e,t){return e.style.cssText=t+""}});var An=/^(?:input|select|textarea|button|object)$/i,Dn=/^(?:a|area)$/i;it.fn.extend({prop:function(e,t){return Dt(this,it.prop,e,t,arguments.length>1)},removeProp:function(e){return e=it.propFix[e]||e,this.each(function(){try{this[e]=void 0,delete this[e]}catch(t){}})}}),it.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,o,a=e.nodeType;if(e&&3!==a&&8!==a&&2!==a)return o=1!==a||!it.isXMLDoc(e),o&&(t=it.propFix[t]||t,i=it.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=it.find.attr(e,"tabindex");return t?parseInt(t,10):An.test(e.nodeName)||Dn.test(e.nodeName)&&e.href?0:-1}}}}),nt.hrefNormalized||it.each(["href","src"],function(e,t){it.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),nt.optSelected||(it.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),it.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){it.propFix[this.toLowerCase()]=this}),nt.enctype||(it.propFix.enctype="encoding");var jn=/[\t\r\n\f]/g;it.fn.extend({addClass:function(e){var t,n,r,i,o,a,s=0,u=this.length,l="string"==typeof e&&e;if(it.isFunction(e))return this.each(function(t){it(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(bt)||[];u>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(jn," "):" ")){for(o=0;i=t[o++];)r.indexOf(" "+i+" ")<0&&(r+=i+" ");a=it.trim(r),n.className!==a&&(n.className=a)}return this},removeClass:function(e){var t,n,r,i,o,a,s=0,u=this.length,l=0===arguments.length||"string"==typeof e&&e;if(it.isFunction(e))return this.each(function(t){it(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(bt)||[];u>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(jn," "):"")){for(o=0;i=t[o++];)for(;r.indexOf(" "+i+" ")>=0;)r=r.replace(" "+i+" "," ");a=e?it.trim(r):"",n.className!==a&&(n.className=a)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):this.each(it.isFunction(e)?function(n){it(this).toggleClass(e.call(this,n,this.className,t),t)}:function(){if("string"===n)for(var t,r=0,i=it(this),o=e.match(bt)||[];t=o[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else(n===Tt||"boolean"===n)&&(this.className&&it._data(this,"__className__",this.className),this.className=this.className||e===!1?"":it._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(jn," ").indexOf(t)>=0)return!0;return!1}}),it.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){it.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),it.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var Ln=it.now(),Hn=/\?/,qn=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;it.parseJSON=function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t+"");var n,r=null,i=it.trim(t+"");return i&&!it.trim(i.replace(qn,function(e,t,i,o){return n&&t&&(r=0),0===r?e:(n=i||t,r+=!o-!i,"")}))?Function("return "+i)():it.error("Invalid JSON: "+t)},it.parseXML=function(t){var n,r;if(!t||"string"!=typeof t)return null;try{e.DOMParser?(r=new DOMParser,n=r.parseFromString(t,"text/xml")):(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(t))}catch(i){n=void 0}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||it.error("Invalid XML: "+t),n};var _n,Mn,Fn=/#.*$/,On=/([?&])_=[^&]*/,Bn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Pn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Rn=/^(?:GET|HEAD)$/,Wn=/^\/\//,$n=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,zn={},In={},Xn="*/".concat("*");try{Mn=location.href}catch(Un){Mn=ht.createElement("a"),Mn.href="",Mn=Mn.href}_n=$n.exec(Mn.toLowerCase())||[],it.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Mn,type:"GET",isLocal:Pn.test(_n[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Xn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":it.parseJSON,"text xml":it.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?W(W(e,it.ajaxSettings),t):W(it.ajaxSettings,e)},ajaxPrefilter:P(zn),ajaxTransport:P(In),ajax:function(e,t){function n(e,t,n,r){var i,c,v,y,x,T=t;2!==b&&(b=2,s&&clearTimeout(s),l=void 0,a=r||"",w.readyState=e>0?4:0,i=e>=200&&300>e||304===e,n&&(y=$(d,w,n)),y=z(d,y,w,i),i?(d.ifModified&&(x=w.getResponseHeader("Last-Modified"),x&&(it.lastModified[o]=x),x=w.getResponseHeader("etag"),x&&(it.etag[o]=x)),204===e||"HEAD"===d.type?T="nocontent":304===e?T="notmodified":(T=y.state,c=y.data,v=y.error,i=!v)):(v=T,(e||!T)&&(T="error",0>e&&(e=0))),w.status=e,w.statusText=(t||T)+"",i?h.resolveWith(f,[c,T,w]):h.rejectWith(f,[w,T,v]),w.statusCode(g),g=void 0,u&&p.trigger(i?"ajaxSuccess":"ajaxError",[w,d,i?c:v]),m.fireWith(f,[w,T]),u&&(p.trigger("ajaxComplete",[w,d]),--it.active||it.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,i,o,a,s,u,l,c,d=it.ajaxSetup({},t),f=d.context||d,p=d.context&&(f.nodeType||f.jquery)?it(f):it.event,h=it.Deferred(),m=it.Callbacks("once memory"),g=d.statusCode||{},v={},y={},b=0,x="canceled",w={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c)for(c={};t=Bn.exec(a);)c[t[1].toLowerCase()]=t[2];t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=y[n]=y[n]||e,v[e]=t),this},overrideMimeType:function(e){return b||(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)g[t]=[g[t],e[t]];else w.always(e[w.status]);return this},abort:function(e){var t=e||x;return l&&l.abort(t),n(0,t),this}};if(h.promise(w).complete=m.add,w.success=w.done,w.error=w.fail,d.url=((e||d.url||Mn)+"").replace(Fn,"").replace(Wn,_n[1]+"//"),d.type=t.method||t.type||d.method||d.type,d.dataTypes=it.trim(d.dataType||"*").toLowerCase().match(bt)||[""],null==d.crossDomain&&(r=$n.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]===_n[1]&&r[2]===_n[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(_n[3]||("http:"===_n[1]?"80":"443")))),d.data&&d.processData&&"string"!=typeof d.data&&(d.data=it.param(d.data,d.traditional)),R(zn,d,t,w),2===b)return w;u=it.event&&d.global,u&&0===it.active++&&it.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Rn.test(d.type),o=d.url,d.hasContent||(d.data&&(o=d.url+=(Hn.test(o)?"&":"?")+d.data,delete d.data),d.cache===!1&&(d.url=On.test(o)?o.replace(On,"$1_="+Ln++):o+(Hn.test(o)?"&":"?")+"_="+Ln++)),d.ifModified&&(it.lastModified[o]&&w.setRequestHeader("If-Modified-Since",it.lastModified[o]),it.etag[o]&&w.setRequestHeader("If-None-Match",it.etag[o])),(d.data&&d.hasContent&&d.contentType!==!1||t.contentType)&&w.setRequestHeader("Content-Type",d.contentType),w.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Xn+"; q=0.01":""):d.accepts["*"]);for(i in d.headers)w.setRequestHeader(i,d.headers[i]);if(d.beforeSend&&(d.beforeSend.call(f,w,d)===!1||2===b))return w.abort();x="abort";for(i in{success:1,error:1,complete:1})w[i](d[i]);if(l=R(In,d,t,w)){w.readyState=1,u&&p.trigger("ajaxSend",[w,d]),d.async&&d.timeout>0&&(s=setTimeout(function(){w.abort("timeout")},d.timeout));try{b=1,l.send(v,n)}catch(T){if(!(2>b))throw T;n(-1,T)}}else n(-1,"No Transport");return w},getJSON:function(e,t,n){return it.get(e,t,n,"json")},getScript:function(e,t){return it.get(e,void 0,t,"script")}}),it.each(["get","post"],function(e,t){it[t]=function(e,n,r,i){return it.isFunction(n)&&(i=i||r,r=n,n=void 0),it.ajax({url:e,type:t,dataType:i,data:n,success:r})}}),it._evalUrl=function(e){return it.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},it.fn.extend({wrapAll:function(e){if(it.isFunction(e))return this.each(function(t){it(this).wrapAll(e.call(this,t))});if(this[0]){var t=it(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return this.each(it.isFunction(e)?function(t){it(this).wrapInner(e.call(this,t))}:function(){var t=it(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=it.isFunction(e);return this.each(function(n){it(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){it.nodeName(this,"body")||it(this).replaceWith(this.childNodes)}).end()}}),it.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0||!nt.reliableHiddenOffsets()&&"none"===(e.style&&e.style.display||it.css(e,"display"))},it.expr.filters.visible=function(e){return!it.expr.filters.hidden(e)};var Vn=/%20/g,Jn=/\[\]$/,Yn=/\r?\n/g,Qn=/^(?:submit|button|image|reset|file)$/i,Gn=/^(?:input|select|textarea|keygen)/i;it.param=function(e,t){var n,r=[],i=function(e,t){t=it.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=it.ajaxSettings&&it.ajaxSettings.traditional),it.isArray(e)||e.jquery&&!it.isPlainObject(e))it.each(e,function(){i(this.name,this.value)});else for(n in e)I(n,e[n],t,i);return r.join("&").replace(Vn,"+")},it.fn.extend({serialize:function(){return it.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=it.prop(this,"elements");return e?it.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!it(this).is(":disabled")&&Gn.test(this.nodeName)&&!Qn.test(e)&&(this.checked||!jt.test(e))}).map(function(e,t){var n=it(this).val();return null==n?null:it.isArray(n)?it.map(n,function(e){return{name:t.name,value:e.replace(Yn,"\r\n")}}):{name:t.name,value:n.replace(Yn,"\r\n")}}).get()}}),it.ajaxSettings.xhr=void 0!==e.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&X()||U()}:X;var Kn=0,Zn={},er=it.ajaxSettings.xhr();e.attachEvent&&e.attachEvent("onunload",function(){for(var e in Zn)Zn[e](void 0,!0)}),nt.cors=!!er&&"withCredentials"in er,er=nt.ajax=!!er,er&&it.ajaxTransport(function(e){if(!e.crossDomain||nt.cors){var t;return{send:function(n,r){var i,o=e.xhr(),a=++Kn;if(o.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(i in e.xhrFields)o[i]=e.xhrFields[i];e.mimeType&&o.overrideMimeType&&o.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(i in n)void 0!==n[i]&&o.setRequestHeader(i,n[i]+"");o.send(e.hasContent&&e.data||null),t=function(n,i){var s,u,l;if(t&&(i||4===o.readyState))if(delete Zn[a],t=void 0,o.onreadystatechange=it.noop,i)4!==o.readyState&&o.abort();else{l={},s=o.status,"string"==typeof o.responseText&&(l.text=o.responseText);try{u=o.statusText}catch(c){u=""}s||!e.isLocal||e.crossDomain?1223===s&&(s=204):s=l.text?200:404}l&&r(s,u,l,o.getAllResponseHeaders())},e.async?4===o.readyState?setTimeout(t):o.onreadystatechange=Zn[a]=t:t()},abort:function(){t&&t(void 0,!0)}}}}),it.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return it.globalEval(e),e}}}),it.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),it.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=ht.head||it("head")[0]||ht.documentElement;return{send:function(r,i){t=ht.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||i(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var tr=[],nr=/(=)\?(?=&|$)|\?\?/;it.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=tr.pop()||it.expando+"_"+Ln++;return this[e]=!0,e}}),it.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=t.jsonp!==!1&&(nr.test(t.url)?"url":"string"==typeof t.data&&!(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&nr.test(t.data)&&"data");return s||"jsonp"===t.dataTypes[0]?(i=t.jsonpCallback=it.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(nr,"$1"+i):t.jsonp!==!1&&(t.url+=(Hn.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||it.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,tr.push(i)),a&&it.isFunction(o)&&o(a[0]),a=o=void 0}),"script"):void 0}),it.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||ht;var r=dt.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=it.buildFragment([e],t,i),i&&i.length&&it(i).remove(),it.merge([],r.childNodes))};var rr=it.fn.load;it.fn.load=function(e,t,n){if("string"!=typeof e&&rr)return rr.apply(this,arguments);var r,i,o,a=this,s=e.indexOf(" ");return s>=0&&(r=it.trim(e.slice(s,e.length)),e=e.slice(0,s)),it.isFunction(t)?(n=t,t=void 0):t&&"object"==typeof t&&(o="POST"),a.length>0&&it.ajax({url:e,type:o,dataType:"html",data:t}).done(function(e){i=arguments,a.html(r?it("<div>").append(it.parseHTML(e)).find(r):e)}).complete(n&&function(e,t){a.each(n,i||[e.responseText,t,e])}),this},it.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){it.fn[t]=function(e){return this.on(t,e)}}),it.expr.filters.animated=function(e){return it.grep(it.timers,function(t){return e===t.elem}).length};var ir=e.document.documentElement;it.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=it.css(e,"position"),d=it(e),f={};"static"===c&&(e.style.position="relative"),s=d.offset(),o=it.css(e,"top"),u=it.css(e,"left"),l=("absolute"===c||"fixed"===c)&&it.inArray("auto",[o,u])>-1,l?(r=d.position(),a=r.top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),it.isFunction(t)&&(t=t.call(e,n,s)),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):d.css(f)}},it.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){it.offset.setOffset(this,e,t)});var t,n,r={top:0,left:0},i=this[0],o=i&&i.ownerDocument;if(o)return t=o.documentElement,it.contains(t,i)?(typeof i.getBoundingClientRect!==Tt&&(r=i.getBoundingClientRect()),n=V(o),{top:r.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:r.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):r},position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===it.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),it.nodeName(e[0],"html")||(n=e.offset()),n.top+=it.css(e[0],"borderTopWidth",!0),n.left+=it.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-it.css(r,"marginTop",!0),left:t.left-n.left-it.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||ir;e&&!it.nodeName(e,"html")&&"static"===it.css(e,"position");)e=e.offsetParent;return e||ir})}}),it.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n=/Y/.test(t);it.fn[e]=function(r){return Dt(this,function(e,r,i){var o=V(e);return void 0===i?o?t in o?o[t]:o.document.documentElement[r]:e[r]:void(o?o.scrollTo(n?it(o).scrollLeft():i,n?i:it(o).scrollTop()):e[r]=i)},e,r,arguments.length,null)}}),it.each(["top","left"],function(e,t){it.cssHooks[t]=k(nt.pixelPosition,function(e,n){return n?(n=rn(e,t),tn.test(n)?it(e).position()[t]+"px":n):void 0})}),it.each({Height:"height",Width:"width"},function(e,t){it.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){it.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),a=n||(r===!0||i===!0?"margin":"border");return Dt(this,function(t,n,r){var i;return it.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):void 0===r?it.css(t,n,a):it.style(t,n,r,a) +},t,o?r:void 0,o,null)}})}),it.fn.size=function(){return this.length},it.fn.andSelf=it.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return it});var or=e.jQuery,ar=e.$;return it.noConflict=function(t){return e.$===it&&(e.$=ar),t&&e.jQuery===it&&(e.jQuery=or),it},typeof t===Tt&&(e.jQuery=e.$=it),it})}).call(this),function(){t=n=window.jQuery.noConflict()}.call(this),"undefined"==typeof Package&&(Package={}),Package.jquery={$:t,jQuery:n}}(); + +!function(){var e=Package.meteor.Meteor,a=Package.tracker.Tracker,c=Package.tracker.Deps,a,c;"undefined"==typeof Package&&(Package={}),Package.deps={Tracker:a,Deps:c}}(); + +!function(){var t=Package.meteor.Meteor,e=Package.tracker.Tracker,r=Package.tracker.Deps,i,n,a;(function(){i={},n=function(t){return t},a=Array.prototype.slice}).call(this),function(){var t=Object.prototype.hasOwnProperty,e=function(e,r){for(var i in r)t.call(r,i)&&(e[i]=r[i]);return e};i.Visitor=function(t){e(this,t)},i.Visitor.def=function(t){e(this.prototype,t)},i.Visitor.extend=function(t){var r=this,n=function a(){i.Visitor.apply(this,arguments)};return n.prototype=new r,n.extend=r.extend,n.def=r.def,t&&e(n.prototype,t),n},i.Visitor.def({visit:function(t){if(null==t)return this.visitNull.apply(this,arguments);if("object"==typeof t){if(t.htmljsType)switch(t.htmljsType){case i.Tag.htmljsType:return this.visitTag.apply(this,arguments);case i.CharRef.htmljsType:return this.visitCharRef.apply(this,arguments);case i.Comment.htmljsType:return this.visitComment.apply(this,arguments);case i.Raw.htmljsType:return this.visitRaw.apply(this,arguments);default:throw new Error("Unknown htmljs type: "+t.htmljsType)}return i.isArray(t)?this.visitArray.apply(this,arguments):this.visitObject.apply(this,arguments)}if("string"==typeof t||"boolean"==typeof t||"number"==typeof t)return this.visitPrimitive.apply(this,arguments);if("function"==typeof t)return this.visitFunction.apply(this,arguments);throw new Error("Unexpected object in htmljs: "+t)},visitNull:function(t){},visitPrimitive:function(t){},visitArray:function(t){},visitComment:function(t){},visitCharRef:function(t){},visitRaw:function(t){},visitTag:function(t){},visitObject:function(t){throw new Error("Unexpected object in htmljs: "+t)},visitFunction:function(t){throw new Error("Unexpected function in htmljs: "+t)}}),i.TransformingVisitor=i.Visitor.extend(),i.TransformingVisitor.def({visitNull:n,visitPrimitive:n,visitArray:function(t){for(var e=a.call(arguments),r=t,i=0;i<t.length;i++){var n=t[i];e[0]=n;var o=this.visit.apply(this,e);o!==n&&(r===t&&(r=t.slice()),r[i]=o)}return r},visitComment:n,visitCharRef:n,visitRaw:n,visitObject:n,visitFunction:n,visitTag:function(t){var e=t.children,r=a.call(arguments);r[0]=e;var n=this.visitChildren.apply(this,r),o=t.attrs;r[0]=o;var s=this.visitAttributes.apply(this,r);if(s===o&&n===e)return t;var u=i.getTag(t.tagName).apply(null,n);return u.attrs=s,u},visitChildren:function(t){return this.visitArray.apply(this,arguments)},visitAttributes:function(t){if(i.isArray(t)){for(var r=a.call(arguments),n=t,o=0;o<t.length;o++){var s=t[o];r[0]=s;var u=this.visitAttributes.apply(this,r);u!==s&&(n===t&&(n=t.slice()),n[o]=u)}return n}if(t&&i.isConstructedObject(t))throw new Error("The basic HTML.TransformingVisitor does not support foreign objects in attributes. Define a custom visitAttributes for this case.");var l=t,f=l;if(l){var c=[null,null];c.push.apply(c,arguments);for(var h in l){var p=l[h];c[0]=h,c[1]=p;var m=this.visitAttribute.apply(this,c);m!==p&&(f===l&&(f=e({},l)),f[h]=m)}}return f},visitAttribute:function(t,e,r){var i=a.call(arguments,2);return i[0]=e,this.visit.apply(this,i)}}),i.ToTextVisitor=i.Visitor.extend(),i.ToTextVisitor.def({visitNull:function(t){return""},visitPrimitive:function(t){var e=String(t);return this.textMode===i.TEXTMODE.RCDATA?e.replace(/&/g,"&").replace(/</g,"<"):this.textMode===i.TEXTMODE.ATTRIBUTE?e.replace(/&/g,"&").replace(/"/g,"""):e},visitArray:function(t){for(var e=[],r=0;r<t.length;r++)e.push(this.visit(t[r]));return e.join("")},visitComment:function(t){throw new Error("Can't have a comment here")},visitCharRef:function(t){return this.textMode===i.TEXTMODE.RCDATA||this.textMode===i.TEXTMODE.ATTRIBUTE?t.html:t.str},visitRaw:function(t){return t.value},visitTag:function(t){return this.visit(this.toHTML(t))},visitObject:function(t){throw new Error("Unexpected object in htmljs in toText: "+t)},toHTML:function(t){return i.toHTML(t)}}),i.ToHTMLVisitor=i.Visitor.extend(),i.ToHTMLVisitor.def({visitNull:function(t){return""},visitPrimitive:function(t){var e=String(t);return e.replace(/&/g,"&").replace(/</g,"<")},visitArray:function(t){for(var e=[],r=0;r<t.length;r++)e.push(this.visit(t[r]));return e.join("")},visitComment:function(t){return"<!--"+t.sanitizedValue+"-->"},visitCharRef:function(t){return t.html},visitRaw:function(t){return t.value},visitTag:function(t){var e=[],r=t.tagName,n=t.children,a=t.attrs;if(a){a=i.flattenAttributes(a);for(var o in a)if("value"===o&&"textarea"===r)n=[a[o],n];else{var s=this.toText(a[o],i.TEXTMODE.ATTRIBUTE);e.push(" "+o+'="'+s+'"')}}var u="<"+r+e.join("")+">",l=[],f;if("textarea"===r){for(var c=0;c<n.length;c++)l.push(this.toText(n[c],i.TEXTMODE.RCDATA));f=l.join(""),"\n"===f.slice(0,1)&&(f="\n"+f)}else{for(var c=0;c<n.length;c++)l.push(this.visit(n[c]));f=l.join("")}var h=u+f;return(n.length||!i.isVoidElement(r))&&(h+="</"+r+">"),h},visitObject:function(t){throw new Error("Unexpected object in htmljs in toHTML: "+t)},toText:function(t,e){return i.toText(t,e)}})}.call(this),function(){i.Tag=function(){},i.Tag.prototype.tagName="",i.Tag.prototype.attrs=null,i.Tag.prototype.children=Object.freeze?Object.freeze([]):[],i.Tag.prototype.htmljsType=i.Tag.htmljsType=["Tag"];var t=function(t){var e=function(){var t=this instanceof i.Tag?this:new e,r=0,n=arguments.length&&arguments[0];if(n&&"object"==typeof n)if(i.isConstructedObject(n)){if(n instanceof i.Attrs){var o=n.value;1===o.length?t.attrs=o[0]:o.length>1&&(t.attrs=o),r++}}else t.attrs=n,r++;return r<arguments.length&&(t.children=a.call(arguments,r)),t};return e.prototype=new i.Tag,e.prototype.constructor=e,e.prototype.tagName=t,e},e=i.Attrs=function(){var t=this instanceof e?this:new e;return t.value=a.call(arguments),t};i.getTag=function(e){var r=i.getSymbolName(e);if(r===e)throw new Error("Use the lowercase or camelCase form of '"+e+"' here");return i[r]||(i[r]=t(e)),i[r]},i.ensureTag=function(t){i.getTag(t)},i.isTagEnsured=function(t){return i.isKnownElement(t)},i.getSymbolName=function(t){return t.toUpperCase().replace(/-/g,"_")},i.knownElementNames="a abbr acronym address applet area article aside audio b base basefont bdi bdo big blockquote body br button canvas caption center cite code col colgroup command data datagrid datalist dd del details dfn dir div dl dt em embed eventsource fieldset figcaption figure font footer form frame frameset h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins isindex kbd keygen label legend li link main map mark menu meta meter nav noframes noscript object ol optgroup option output p param pre progress q rp rt ruby s samp script section select small source span strike strong style sub summary sup table tbody td textarea tfoot th thead time title tr track tt u ul var video wbr".split(" "),i.knownSVGElementNames="altGlyph altGlyphDef altGlyphItem animate animateColor animateMotion animateTransform circle clipPath color-profile cursor defs desc ellipse feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence filter font font-face font-face-format font-face-name font-face-src font-face-uri foreignObject g glyph glyphRef hkern image line linearGradient marker mask metadata missing-glyph path pattern polygon polyline radialGradient rect script set stop style svg switch symbol text textPath title tref tspan use view vkern".split(" "),i.knownElementNames=i.knownElementNames.concat(i.knownSVGElementNames),i.voidElementNames="area base br col command embed hr img input keygen link meta param source track wbr".split(" ");var r={yes:!0},n=function(t){for(var e={},i=0;i<t.length;i++)e[t[i]]=r;return e},o=n(i.voidElementNames),s=n(i.knownElementNames),u=n(i.knownSVGElementNames);i.isKnownElement=function(t){return s[t]===r},i.isKnownSVGElement=function(t){return u[t]===r},i.isVoidElement=function(t){return o[t]===r};for(var l=0;l<i.knownElementNames.length;l++)i.ensureTag(i.knownElementNames[l]);var f=i.CharRef=function(t){if(!(this instanceof f))return new f(t);if(!(t&&t.html&&t.str))throw new Error("HTML.CharRef must be constructed with ({html:..., str:...})");this.html=t.html,this.str=t.str};f.prototype.htmljsType=f.htmljsType=["CharRef"];var c=i.Comment=function(t){if(!(this instanceof c))return new c(t);if("string"!=typeof t)throw new Error("HTML.Comment must be constructed with a string");this.value=t,this.sanitizedValue=t.replace(/^-|--+|-$/g,"")};c.prototype.htmljsType=c.htmljsType=["Comment"];var h=i.Raw=function(t){if(!(this instanceof h))return new h(t);if("string"!=typeof t)throw new Error("HTML.Raw must be constructed with a string");this.value=t};h.prototype.htmljsType=h.htmljsType=["Raw"],i.isArray=function(t){return t instanceof Array},i.isConstructedObject=function(t){return t&&"object"==typeof t&&t.constructor!==Object&&!Object.prototype.hasOwnProperty.call(t,"constructor")},i.isNully=function(t){if(null==t)return!0;if(i.isArray(t)){for(var e=0;e<t.length;e++)if(!i.isNully(t[e]))return!1;return!0}return!1},i.isValidAttributeName=function(t){return/^[:_A-Za-z][:_A-Za-z0-9.\-]*/.test(t)},i.flattenAttributes=function(t){if(!t)return t;var e=i.isArray(t);if(e&&0===t.length)return null;for(var r={},n=0,a=e?t.length:1;a>n;n++){var o=e?t[n]:t;if("object"!=typeof o||i.isConstructedObject(o))throw new Error("Expected plain JS object as attrs, found: "+o);for(var s in o){if(!i.isValidAttributeName(s))throw new Error("Illegal HTML attribute name: "+s);var u=o[s];i.isNully(u)||(r[s]=u)}}return r},i.toHTML=function(t){return(new i.ToHTMLVisitor).visit(t)},i.TEXTMODE={STRING:1,RCDATA:2,ATTRIBUTE:3},i.toText=function(t,e){if(!e)throw new Error("textMode required for HTML.toText");if(e!==i.TEXTMODE.STRING&&e!==i.TEXTMODE.RCDATA&&e!==i.TEXTMODE.ATTRIBUTE)throw new Error("Unknown textMode: "+e);var r=new i.ToTextVisitor({textMode:e});return r.visit(t)}}.call(this),"undefined"==typeof Package&&(Package={}),Package.htmljs={HTML:i}}(); + +!function(){var e=Package.meteor.Meteor,n=Package.tracker.Tracker,o=Package.tracker.Deps,r=Package.minimongo.LocalCollection,t=Package.minimongo.Minimongo,i=Package.underscore._,a=Package.random.Random,c,u,f,d;(function(){var e=function(){c._suppressWarnings?c._suppressWarnings--:("undefined"!=typeof console&&console.warn&&console.warn.apply(console,arguments),c._loggedWarnings++)},o=r._idStringify,t=r._idParse;c={_suppressWarnings:0,_loggedWarnings:0,observe:function(e,o){var r=null,t=null,a=[],c=n.autorun(function(){var c=e();n.nonreactive(function(){var e;if(t&&(a=i.map(r.fetch(),function(e){return{_id:e._id,item:e}}),t.stop(),t=null),c)if(c instanceof Array)e=f(a,c,o);else{if(!l(c))throw s();var n=d(a,c,o);e=n[0],t=n[1]}else e=u(a,o);v(a,e,o),r=c,a=e})});return{stop:function(){c.stop(),t&&t.stop()}}},fetch:function(e){if(e){if(e instanceof Array)return e;if(l(e))return e.fetch();throw s()}return[]}};var s=function(){return new Error("{{#each}} currently only accepts arrays, cursors or falsey values.")},l=function(e){return e&&i.isObject(e)&&i.isFunction(e.observe)&&i.isFunction(e.fetch)},v=function(e,n,r){var a=Package.minimongo.LocalCollection._diffQueryOrderedChanges,c=[],u=[],f={},d={},s={},l=e.length;i.each(n,function(e,n){u.push({_id:e._id}),d[o(e._id)]=n}),i.each(e,function(e,n){c.push({_id:e._id}),f[o(e._id)]=n,s[o(e._id)]=n}),a(c,u,{addedBefore:function(e,t,a){var c=a?s[o(a)]:l;i.each(s,function(e,n){e>=c&&s[n]++}),l++,s[o(e)]=c,r.addedAt(e,n[d[o(e)]].item,c,a)},movedBefore:function(e,t){var a=s[o(e)],c=t?s[o(t)]:l-1;i.each(s,function(e,n){e>=a&&c>=e?s[n]--:a>=e&&e>=c&&s[n]++}),s[o(e)]=c,r.movedTo(e,n[d[o(e)]].item,a,c,t)},removed:function(n){var t=s[o(n)];i.each(s,function(e,n){e>=t&&s[n]--}),delete s[o(n)],l--,r.removedAt(n,e[f[o(n)]].item,t)}}),i.each(d,function(o,a){var c=t(a);if(i.has(f,a)){var u=n[o].item,d=e[f[a]].item;("object"==typeof u||u!==d)&&r.changedAt(c,u,d,o)}})};u=function(e,n){return[]},f=function(n,r,t){var c={},u=i.map(r,function(n,t){var i;if("string"==typeof n)i="-"+n;else if("number"==typeof n||"boolean"==typeof n||void 0===n)i=n;else{if("object"!=typeof n)throw new Error("{{#each}} doesn't support arrays with elements of type "+typeof n);i=n&&n._id||t}var u=o(i);return c[u]?("object"==typeof n&&"_id"in n&&e("duplicate id "+i+" in",r),i=a.id()):c[u]=!0,{_id:i,item:n}});return u},d=function(e,n,o){var r=!0,t=[],i=n.observe({addedAt:function(e,n,i){if(r){if(null!==i)throw new Error("Expected initial data from observe in order");t.push({_id:e._id,item:e})}else o.addedAt(e._id,e,n,i)},changedAt:function(e,n,r){o.changedAt(e._id,e,n,r)},removedAt:function(e,n){o.removedAt(e._id,e,n)},movedTo:function(e,n,r,t){o.movedTo(e._id,e,n,r,t)}});return r=!1,[t,i]}}).call(this),"undefined"==typeof Package&&(Package={}),Package["observe-sequence"]={ObserveSequence:c}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.tracker.Tracker,n=Package.tracker.Deps,r;(function(){r=function(e,n){return this instanceof r?(this.curValue=e,this.equalsFunc=n,void(this.dep=new t.Dependency)):new r(e,n)},r._isEqual=function(e,t){var n=e,r=t;return n!==r?!1:!n||"number"==typeof n||"boolean"==typeof n||"string"==typeof n},r.prototype.get=function(){return t.active&&this.dep.depend(),this.curValue},r.prototype.set=function(e){var t=this.curValue;(this.equalsFunc||r._isEqual)(t,e)||(this.curValue=e,this.dep.changed())},r.prototype.toString=function(){return"ReactiveVar{"+this.get()+"}"},r.prototype._numListeners=function(){var e=0;for(var t in this.dep._dependentsById)e++;return e}}).call(this),"undefined"==typeof Package&&(Package={}),Package["reactive-var"]={ReactiveVar:r}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.jquery.$,n=Package.jquery.jQuery,r=Package.tracker.Tracker,i=Package.tracker.Deps,a=Package.underscore._,o=Package.htmljs.HTML,s=Package["observe-sequence"].ObserveSequence,u=Package["reactive-var"].ReactiveVar,l,c,d,f,p,h;(function(){l={},l._escape=function(){var e={"<":"<",">":">",'"':""","'":"'","`":"`","&":"&"},t=function(t){return e[t]};return function(e){return e.replace(/[&<>"'`]/g,t)}}(),l._warn=function(e){e="Warning: "+e,"undefined"!=typeof Log&&Log&&Log.warn?Log.warn(e):"undefined"!=typeof console&&console.log&&console.log(e)}}).call(this),function(){var e={};l._DOMBackend=e;var t="undefined"!=typeof n?n:"undefined"!=typeof Package?Package.jquery&&Package.jquery.jQuery:null;if(!t)throw new Error("jQuery not found");e._$jq=t,e.parseHTML=function(e){return t.parseHTML(e)||[]},e.Events={delegateEvents:function(e,n,r,i){t(e).on(n,r,i)},undelegateEvents:function(e,n,r){t(e).off(n,"**",r)},bindEventCapturer:function(n,r,i,a){var o=t(n),s=function(e){e=t.event.fix(e),e.currentTarget=e.target;var r=t(e.currentTarget);r.is(o.find(i))&&a.call(n,e)};a._meteorui_wrapper=s,r=e.Events.parseEventType(r),n.addEventListener(r,s,!0)},unbindEventCapturer:function(t,n,r){n=e.Events.parseEventType(n),t.removeEventListener(n,r._meteorui_wrapper,!0)},parseEventType:function(e){var t=e.indexOf(".");return t>=0?e.slice(0,t):e}};var r=function(){},i=function(e){this.next=this,this.prev=this,this.func=e};i.prototype.linkBefore=function(e){this.prev=e.prev,this.next=e,e.prev.next=this,e.prev=this},i.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},i.prototype.go=function(){var e=this.func;e&&e()},i.prototype.stop=i.prototype.unlink,e.Teardown={_JQUERY_EVENT_NAME:"blaze_teardown_watcher",_CB_PROP:"$blaze_teardown_callbacks",onElementTeardown:function(n,a){var o=new i(a),s=e.Teardown._CB_PROP;return n[s]||(n[s]=new i,t(n).on(e.Teardown._JQUERY_EVENT_NAME,r)),o.linkBefore(n[s]),o},tearDownElement:function(e){for(var n=[],r=e.getElementsByTagName("*"),i=0;i<r.length;i++)n.push(r[i]);n.push(e),t.cleanData(n)}},t.event.special[e.Teardown._JQUERY_EVENT_NAME]={setup:function(){},teardown:function(){var t=this,n=t[e.Teardown._CB_PROP];if(n){for(var r=n.next;r!==n;)r.go(),r=r.next;n.go(),t[e.Teardown._CB_PROP]=null}}},e.findBySelector=function(e,n){return t(e,n)}}.call(this),function(){var e=Object.freeze?Object.freeze([]):[];l._DOMRange=function(n){if(!(this instanceof t))return new t(n);var r=n||e;if(!r||"number"!=typeof r.length)throw new Error("Expected array");for(var i=0;i<r.length;i++)this._memberIn(r[i]);this.members=r,this.emptyRangePlaceholder=null,this.attached=!1,this.parentElement=null,this.parentRange=null,this.attachedCallbacks=e};var t=l._DOMRange;t._USE_COMMENT_PLACEHOLDERS=function(){var e=!1,t=document.createTextNode("");try{t.someProp=!0}catch(n){e=!0}return e}(),t._insert=function(e,n,r,i){var a=e;a instanceof t?a.attach(n,r,i):i?t._moveNodeWithHooks(a,n,r):t._insertNodeWithHooks(a,n,r)},t._remove=function(e){var n=e;n instanceof t?n.detach():t._removeNodeWithHooks(n)},t._removeNodeWithHooks=function(e){e.parentNode&&(1===e.nodeType&&e.parentNode._uihooks&&e.parentNode._uihooks.removeElement?e.parentNode._uihooks.removeElement(e):e.parentNode.removeChild(e))},t._insertNodeWithHooks=function(e,t,n){n=n||null,1===e.nodeType&&t._uihooks&&t._uihooks.insertElement?t._uihooks.insertElement(e,n):t.insertBefore(e,n)},t._moveNodeWithHooks=function(e,t,n){e.parentNode===t&&(n=n||null,1===e.nodeType&&t._uihooks&&t._uihooks.moveElement?t._uihooks.moveElement(e,n):t.insertBefore(e,n))},t.forElement=function(e){if(1!==e.nodeType)throw new Error("Expected element, found: "+e);for(var t=null;e&&!t;)t=e.$blaze_range||null,t||(e=e.parentNode);return t},t.prototype.attach=function(e,n,r,i){if((r||i)&&(this.parentElement!==e||!this.attached))throw new Error("Can only move or replace an attached DOMRange, and only under the same parent element");var a=this.members;if(a.length){this.emptyRangePlaceholder=null;for(var o=0;o<a.length;o++)t._insert(a[o],e,n,r)}else{var s=t._USE_COMMENT_PLACEHOLDERS?document.createComment(""):document.createTextNode("");this.emptyRangePlaceholder=s,e.insertBefore(s,n||null)}if(this.attached=!0,this.parentElement=e,!r&&!i)for(var o=0;o<this.attachedCallbacks.length;o++){var u=this.attachedCallbacks[o];u.attached&&u.attached(this,e)}},t.prototype.setMembers=function(e){var t=e;if(!t||"number"!=typeof t.length)throw new Error("Expected array");for(var n=this.members,r=0;r<n.length;r++)this._memberOut(n[r]);for(var r=0;r<t.length;r++)this._memberIn(t[r]);if(this.attached){if(t.length||n.length){var i=this.lastNode().nextSibling,a=this.parentElement;this.detach(!0),this.members=t,this.attach(a,i,!1,!0)}}else this.members=t},t.prototype.firstNode=function(){if(!this.attached)throw new Error("Must be attached");if(!this.members.length)return this.emptyRangePlaceholder;var e=this.members[0];return e instanceof t?e.firstNode():e},t.prototype.lastNode=function(){if(!this.attached)throw new Error("Must be attached");if(!this.members.length)return this.emptyRangePlaceholder;var e=this.members[this.members.length-1];return e instanceof t?e.lastNode():e},t.prototype.detach=function(e){if(!this.attached)throw new Error("Must be attached");var n=this.parentElement,r=this.members;if(r.length)for(var i=0;i<r.length;i++)t._remove(r[i]);else{var a=this.emptyRangePlaceholder;this.parentElement.removeChild(a),this.emptyRangePlaceholder=null}if(!e){this.attached=!1,this.parentElement=null;for(var i=0;i<this.attachedCallbacks.length;i++){var o=this.attachedCallbacks[i];o.detached&&o.detached(this,n)}}},t.prototype.addMember=function(e,n,r){var i=this.members;if(!(n>=0&&n<=i.length))throw new Error("Bad index in range.addMember: "+n);if(r||this._memberIn(e),this.attached)if(0===i.length)this.setMembers([e]);else{var a;if(n===i.length)a=this.lastNode().nextSibling;else{var o=i[n];a=o instanceof t?o.firstNode():o}i.splice(n,0,e),t._insert(e,this.parentElement,a,r)}else i.splice(n,0,e)},t.prototype.removeMember=function(n,r){var i=this.members;if(!(n>=0&&n<i.length))throw new Error("Bad index in range.removeMember: "+n);if(r)i.splice(n,1);else{var a=i[n];this._memberOut(a),1===i.length?this.setMembers(e):(i.splice(n,1),this.attached&&t._remove(a))}},t.prototype.moveMember=function(e,t){var n=this.members[e];this.removeMember(e,!0),this.addMember(n,t,!0)},t.prototype.getMember=function(e){var t=this.members;if(!(e>=0&&e<t.length))throw new Error("Bad index in range.getMember: "+e);return this.members[e]},t.prototype._memberIn=function(e){e instanceof t?e.parentRange=this:1===e.nodeType&&(e.$blaze_range=this)},t._destroy=function(e,n){e instanceof t?e.view&&l._destroyView(e.view,n):n||1!==e.nodeType||e.$blaze_range&&(l._destroyNode(e),e.$blaze_range=null)},t.prototype._memberOut=t._destroy,t.prototype.destroyMembers=function(e){for(var t=this.members,n=0;n<t.length;n++)this._memberOut(t[n],e)},t.prototype.destroy=function(e){t._destroy(this,e)},t.prototype.containsElement=function(e){if(!this.attached)throw new Error("Must be attached");if(!l._elementContains(this.parentElement,e))return!1;for(;e.parentNode!==this.parentElement;)e=e.parentNode;for(var t=e.$blaze_range;t&&t!==this;)t=t.parentRange;return t===this},t.prototype.containsRange=function(e){if(!this.attached)throw new Error("Must be attached");if(!e.attached)return!1;if(e.parentElement!==this.parentElement)return this.containsElement(e.parentElement);if(e===this)return!1;for(;e&&e!==this;)e=e.parentRange;return e===this},t.prototype.onAttached=function(e){this.onAttachedDetached({attached:e})},t.prototype.onAttachedDetached=function(t){this.attachedCallbacks===e&&(this.attachedCallbacks=[]),this.attachedCallbacks.push(t)},t.prototype.$=function(e){var t=this,n=this.parentElement;if(!n)throw new Error("Can't select in removed DomRange");if(11===n.nodeType)throw new Error("Can't use $ on an offscreen range");var r=l._DOMBackend.findBySelector(e,n),i=function(e){return"number"==typeof e&&(e=this),t.containsElement(e)};if(r.filter)r=r.filter(i);else{for(var a=[],o=0;o<r.length;o++){var s=r[o];i(s)&&a.push(s)}r=a}return r},l._elementContains=function(e,t){return 1!==e.nodeType?!1:e===t?!1:e.compareDocumentPosition?16&e.compareDocumentPosition(t):(t=t.parentNode,t&&1===t.nodeType?e===t?!0:e.contains(t):!1)}}.call(this),function(){var e=l._EventSupport={},t=l._DOMBackend,n=e.eventsToDelegate={blur:1,change:1,click:1,focus:1,focusin:1,focusout:1,reset:1,submit:1},r=e.EVENT_MODE={TBD:0,BUBBLING:1,CAPTURING:2},i=1,o=function(e,o,s,u,l){this.elem=e,this.type=o,this.selector=s,this.handler=u,this.recipient=l,this.id=i++,this.mode=r.TBD,this.delegatedHandler=function(e){return function(t){return e.selector||t.currentTarget===t.target?e.handler.apply(e.recipient,arguments):void 0}}(this);var c=e.addEventListener&&!a.has(n,t.Events.parseEventType(o));c?this.capturingHandler=function(e){return function(n){if(e.mode===r.TBD){if(n.bubbles)return e.mode=r.BUBBLING,void t.Events.unbindEventCapturer(e.elem,e.type,e.capturingHandler);e.mode=r.CAPTURING,t.Events.undelegateEvents(e.elem,e.type,e.delegatedHandler)}e.delegatedHandler(n)}}(this):this.mode=r.BUBBLING};e.HandlerRec=o,o.prototype.bind=function(){this.mode!==r.BUBBLING&&t.Events.bindEventCapturer(this.elem,this.type,this.selector||"*",this.capturingHandler),this.mode!==r.CAPTURING&&t.Events.delegateEvents(this.elem,this.type,this.selector||"*",this.delegatedHandler)},o.prototype.unbind=function(){this.mode!==r.BUBBLING&&t.Events.unbindEventCapturer(this.elem,this.type,this.capturingHandler),this.mode!==r.CAPTURING&&t.Events.undelegateEvents(this.elem,this.type,this.delegatedHandler)},e.listen=function(e,t,n,r,i,a){try{e=e}finally{}var s=[];t.replace(/[^ /]+/g,function(e){s.push(e)});for(var u=[],l=0,c=s.length;c>l;l++){var d=s[l],f=e.$blaze_events;f||(f=e.$blaze_events={});var p=f[d];p||(p=f[d]={},p.handlers=[]);var h=p.handlers,m=new o(e,d,n,r,i);if(u.push(m),m.bind(),h.push(m),a)for(var w=a(i);w;w=a(w))for(var v=0,_=h.length;_>v;v++){var g=h[v];g.recipient===w&&(g.unbind(),g.bind(),h.splice(v,1),h.push(g),v--,_--)}}return{stop:function(){var t=e.$blaze_events;if(t){for(var n=0;n<u.length;n++){var r=u[n],i=t[r.type];if(i)for(var a=i.handlers,o=a.length-1;o>=0;o--)a[o]===r&&(r.unbind(),a.splice(o,1))}u.length=0}}}}}.call(this),function(){var n=!1;l._allowJavascriptUrls=function(){n=!0},l._javascriptUrlsAllowed=function(){return n},f=function(e,t){this.name=e,this.value=t},l._AttributeHandler=f,f.prototype.update=function(e,t,n){null===n?null!==t&&e.removeAttribute(this.name):e.setAttribute(this.name,n)},f.extend=function(e){var t=this,n=function r(){f.apply(this,arguments)};return n.prototype=new t,n.extend=t.extend,e&&a.extend(n.prototype,e),n};var r=f.extend({update:function(e,t,n){if(!this.getCurrentValue||!this.setValue||!this.parseValue)throw new Error("Missing methods in subclass of 'DiffingAttributeHandler'");var r=t?this.parseValue(t):{},i=n?this.parseValue(n):{},o=this.getCurrentValue(e),s=o?this.parseValue(o):{};a.each(a.keys(r),function(e){e in i||delete s[e]}),a.each(a.keys(i),function(e){s[e]=i[e]}),this.setValue(e,a.values(s).join(" "))}}),i=r.extend({getCurrentValue:function(e){return e.className},setValue:function(e,t){e.className=t},parseValue:function(e){var t={};return a.each(e.split(" "),function(e){e&&(t[e]=e)}),t}}),o=i.extend({getCurrentValue:function(e){return e.className.baseVal},setValue:function(e,t){e.setAttribute("class",t)}}),s=r.extend({getCurrentValue:function(e){return e.getAttribute("style")},setValue:function(e,t){""===t?e.removeAttribute("style"):e.setAttribute("style",t)},parseValue:function(e){for(var n={},r=/(\*?[-#\/\*\\\w]+(?:\[[0-9a-z_-]+\])?)\s*:\s*(?:\'(?:\\\'|.)*?\'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+[;\s]*/g,i=r.exec(e);i;)n[" "+i[1]]=i[0].trim?i[0].trim():t.trim(i[0]),i=r.exec(e);return n}}),u=f.extend({update:function(e,t,n){var r=this.name;null==n?null!=t&&(e[r]=!1):e[r]=!0}}),c=f.extend({update:function(e,t,n){n!==e.value&&(e.value=n)}}),d=f.extend({update:function(e,t,n){var r="http://www.w3.org/1999/xlink";null===n?null!==t&&e.removeAttributeNS(r,this.name):e.setAttributeNS(r,this.name,this.value)}}),m=function(e){return"ownerSVGElement"in e},w=function(e,t){var n={FORM:["action"],BODY:["background"],BLOCKQUOTE:["cite"],Q:["cite"],DEL:["cite"],INS:["cite"],OBJECT:["classid","codebase","data","usemap"],APPLET:["codebase"],A:["href"],AREA:["href"],LINK:["href"],BASE:["href"],IMG:["longdesc","src","usemap"],FRAME:["longdesc","src"],IFRAME:["longdesc","src"],HEAD:["profile"],SCRIPT:["src"],INPUT:["src","usemap","formaction"],BUTTON:["formaction"],BASE:["href"],MENUITEM:["icon"],HTML:["manifest"],VIDEO:["poster"]};if("itemid"===t)return!0;var r=n[e]||[];return a.contains(r,t)};if(e.isClient)var v=document.createElement("A");var _=function(t){if(e.isClient)return v.href=t,(v.protocol||"").toLowerCase();throw new Error("getUrlProtocol not implemented on the server")},g=f.prototype.update,E=f.extend({update:function(e,t,n){var r=this,i=arguments;if(l._javascriptUrlsAllowed())g.apply(r,i);else{var a="javascript:"===_(n);a?(l._warn("URLs that use the 'javascript:' protocol are not allowed in URL attribute values. Call Blaze._allowJavascriptUrls() to enable them."),g.apply(r,[e,t,null])):g.apply(r,i)}}});p=function(e,t,n){return"class"===t?m(e)?new o(t,n):new i(t,n):"style"===t?new s(t,n):"OPTION"===e.tagName&&"selected"===t||"INPUT"===e.tagName&&"checked"===t?new u(t,n):"TEXTAREA"!==e.tagName&&"INPUT"!==e.tagName||"value"!==t?"xlink:"===t.substring(0,6)?new d(t.substring(6),n):w(e.tagName,t)?new E(t,n):new f(t,n):new c(t,n)},h=function(e){this.elem=e,this.handlers={}},h.prototype.update=function(e){var t=this.elem,n=this.handlers;for(var r in n)if(!a.has(e,r)){var i=n[r],o=i.value;i.value=null,i.update(t,o,null),delete n[r]}for(var r in e){var i=null,o,s=e[r];a.has(n,r)?(i=n[r],o=i.value):null!==s&&(i=p(t,r,s),n[r]=i,o=null),o!==s&&(i.value=s,i.update(t,o,s),null===s&&delete n[r])}}}.call(this),function(){l._DOMMaterializer=o.Visitor.extend(),l._DOMMaterializer.def({visitNull:function(e,t){return t},visitPrimitive:function(e,t){var n=String(e);return t.push(document.createTextNode(n)),t},visitCharRef:function(e,t){return this.visitPrimitive(e.str,t)},visitArray:function(e,t){for(var n=0;n<e.length;n++)this.visit(e[n],t);return t},visitComment:function(e,t){return t.push(document.createComment(e.sanitizedValue)),t},visitRaw:function(e,t){for(var n=l._DOMBackend.parseHTML(e.value),r=0;r<n.length;r++)t.push(n[r]);return t},visitTag:function(t,n){var i=this,s=t.tagName,u;u=(o.isKnownSVGElement(s)||e(t))&&document.createElementNS?document.createElementNS("http://www.w3.org/2000/svg",s):document.createElement(s);var c=t.attrs,d=t.children;if("textarea"===s&&t.children.length&&!(c&&"value"in c)){if("function"==typeof c||o.isArray(c))throw new Error("Can't have reactive children of TEXTAREA node; use the 'value' attribute instead.");c=a.extend({},c||null),c.value=l._expand(d,i.parentView),d=[]}if(c){var f=new h(u),p=function(){var e=i.parentView,t=l._expandAttributes(c,e),n=o.flattenAttributes(t),r={};for(var a in n)r[a]=l._toText(n[a],e,o.TEXTMODE.STRING);f.update(r)},m;m=i.parentView?i.parentView.autorun(p):r.nonreactive(function(){return r.autorun(function(){r._withCurrentView(i.parentView,p)})}),l._DOMBackend.Teardown.onElementTeardown(u,function g(){m.stop()})}for(var w=i.visit(d,[]),v=0;v<w.length;v++){var _=w[v];_ instanceof l._DOMRange?_.attach(u):u.appendChild(_)}return n.push(u),n},visitObject:function(e,t){return e instanceof l.Template&&(e=e.constructView()),e instanceof l.View?(t.push(l._materializeView(e,this.parentView)),t):o.Visitor.prototype.visitObject.call(this,e)}});var e=function(e){return"a"===e.tagName&&e.attrs&&void 0!==e.attrs["xlink:href"]}}.call(this),function(){var t;l._throwNextException=!1,l._reportException=function(n,r){if(l._throwNextException)throw l._throwNextException=!1,n;t||(t=function(){return"undefined"!=typeof e?e._debug:"undefined"!=typeof console&&console.log?console.log:function(){}}),t()(r||"Exception caught in template:",n.stack||n.message)},l._wrapCatchingExceptions=function(e,t){return"function"!=typeof e?e:function(){try{return e.apply(this,arguments)}catch(n){l._reportException(n,"Exception in "+t+":")}}}}.call(this),function(){l.View=function(e,t){return this instanceof l.View?("function"==typeof e&&(t=e,e=""),this.name=e,this._render=t,this._callbacks={created:null,rendered:null,destroyed:null},this.isCreated=!1,this._isCreatedForExpansion=!1,this.isRendered=!1,this._isAttached=!1,this.isDestroyed=!1,this._isInRender=!1,this.parentView=null,this._domrange=null,this._hasGeneratedParent=!1,void(this.renderCount=0)):new l.View(e,t)},l.View.prototype._render=function(){return null},l.View.prototype.onViewCreated=function(e){this._callbacks.created=this._callbacks.created||[],this._callbacks.created.push(e)},l.View.prototype._onViewRendered=function(e){this._callbacks.rendered=this._callbacks.rendered||[],this._callbacks.rendered.push(e)},l.View.prototype.onViewReady=function(e){var t=this,n=function(){r.afterFlush(function(){t.isDestroyed||l._withCurrentView(t,function(){e.call(t)})})};t._onViewRendered(function i(){t.isDestroyed||(t._domrange.attached?n():t._domrange.onAttached(n))})},l.View.prototype.onViewDestroyed=function(e){this._callbacks.destroyed=this._callbacks.destroyed||[],this._callbacks.destroyed.push(e)},l.View.prototype.autorun=function(e,t){var n=this;if(!n.isCreated)throw new Error("View#autorun must be called from the created callback at the earliest");if(this._isInRender)throw new Error("Can't call View#autorun from inside render(); try calling it from the created or rendered callback");if(r.active)throw new Error("Can't call View#autorun from a Tracker Computation; try calling it from the created or rendered callback");var i=r.autorun(function a(r){return l._withCurrentView(t||n,function(){return e.call(n,r)})});return n.onViewDestroyed(function(){i.stop()}),i},l.View.prototype.firstNode=function(){if(!this._isAttached)throw new Error("View must be attached before accessing its DOM");return this._domrange.firstNode()},l.View.prototype.lastNode=function(){if(!this._isAttached)throw new Error("View must be attached before accessing its DOM");return this._domrange.lastNode()},l._fireCallbacks=function(e,t){l._withCurrentView(e,function(){r.nonreactive(function n(){for(var n=e._callbacks[t],r=0,i=n&&n.length;i>r;r++)n[r].call(e)})})},l._createView=function(e,t,n){if(e.isCreated)throw new Error("Can't render the same View twice");e.parentView=t||null,e.isCreated=!0,n&&(e._isCreatedForExpansion=!0),l._fireCallbacks(e,"created")},l._materializeView=function(e,t){l._createView(e,t);var n,i;return r.nonreactive(function(){e.autorun(function a(t){e.renderCount++,e._isInRender=!0;var a=e._render();e._isInRender=!1,r.nonreactive(function o(){var r=new l._DOMMaterializer({parentView:e}),o=r.visit(a,[]);(t.firstRun||!l._isContentEqual(i,a))&&(t.firstRun?(n=new l._DOMRange(o),e._domrange=n,n.view=e,e.isRendered=!0):n.setMembers(o),l._fireCallbacks(e,"rendered"))}),i=a,r.onInvalidate(function(){n.destroyMembers()})});var t=null;n.onAttached(function o(n,r){e._isAttached=!0,t=l._DOMBackend.Teardown.onElementTeardown(r,function i(){l._destroyView(e,!0)})}),e.onViewDestroyed(function(){t&&t.stop(),t=null})}),n},l._expandView=function(e,t){l._createView(e,t,!0),e._isInRender=!0;var n=l._withCurrentView(e,function(){return e._render()});e._isInRender=!1;var i=l._expand(n,e);return r.active?r.onInvalidate(function(){l._destroyView(e)}):l._destroyView(e),i},l._HTMLJSExpander=o.TransformingVisitor.extend(),l._HTMLJSExpander.def({visitObject:function(e){return e instanceof l.Template&&(e=e.constructView()),e instanceof l.View?l._expandView(e,this.parentView):o.TransformingVisitor.prototype.visitObject.call(this,e)},visitAttributes:function(e){return"function"==typeof e&&(e=l._withCurrentView(this.parentView,e)),o.TransformingVisitor.prototype.visitAttributes.call(this,e)},visitAttribute:function(e,t,n){return"function"==typeof t&&(t=l._withCurrentView(this.parentView,t)),o.TransformingVisitor.prototype.visitAttribute.call(this,e,t,n)}});var e=function(){var e=l.currentView;return e&&e._isInRender?e:null};l._expand=function(t,n){return n=n||e(),new l._HTMLJSExpander({parentView:n}).visit(t)},l._expandAttributes=function(t,n){return n=n||e(),new l._HTMLJSExpander({parentView:n}).visitAttributes(t)},l._destroyView=function(e,t){e.isDestroyed||(e.isDestroyed=!0,l._fireCallbacks(e,"destroyed"),e._domrange&&e._domrange.destroyMembers(t))},l._destroyNode=function(e){1===e.nodeType&&l._DOMBackend.Teardown.tearDownElement(e)},l._isContentEqual=function(e,t){return e instanceof o.Raw?t instanceof o.Raw&&e.value===t.value:null==e?null==t:e===t&&("number"==typeof e||"boolean"==typeof e||"string"==typeof e)},l.currentView=null,l._withCurrentView=function(e,t){var n=l.currentView;try{return l.currentView=e,t()}finally{l.currentView=n}};var t=function(e){if(null===e)throw new Error("Can't render null");if("undefined"==typeof e)throw new Error("Can't render undefined");if(!(e instanceof l.View||e instanceof l.Template||"function"==typeof e))try{(new o.Visitor).visit(e)}catch(t){throw new Error("Expected Template or View")}},n=function(e){if(t(e),e instanceof l.Template)return e.constructView();if(e instanceof l.View)return e;var n=e;return"function"!=typeof n&&(n=function(){return e}),l.View("render",n)},i=function(e){return t(e),"function"!=typeof e?function(){return e}:e};l.render=function(t,r,i,a){if(r||l._warn("Blaze.render without a parent element is deprecated. You must specify where to insert the rendered content."),i instanceof l.View&&(a=i,i=null),r&&"number"!=typeof r.nodeType)throw new Error("'parentElement' must be a DOM node");if(i&&"number"!=typeof i.nodeType)throw new Error("'nextNode' must be a DOM node");a=a||e();var o=n(t);return l._materializeView(o,a),r&&o._domrange.attach(r,i),o},l.insert=function(e,t,n){if(l._warn("Blaze.insert has been deprecated. Specify where to insert the rendered content in the call to Blaze.render."),!(e&&e._domrange instanceof l._DOMRange))throw new Error("Expected template rendered with Blaze.render");e._domrange.attach(t,n)},l.renderWithData=function(e,t,n,r,a){return l.render(l._TemplateWith(t,i(e)),n,r,a)},l.remove=function(e){if(!(e&&e._domrange instanceof l._DOMRange))throw new Error("Expected template rendered with Blaze.render");for(;e;){if(!e.isDestroyed){var t=e._domrange;t.attached&&!t.parentRange&&t.detach(),t.destroy()}e=e._hasGeneratedParent&&e.parentView}},l.toHTML=function(t,r){return r=r||e(),o.toHTML(l._expandView(n(t),r))},l.toHTMLWithData=function(t,n,r){return r=r||e(),o.toHTML(l._expandView(l._TemplateWith(n,i(t)),r))},l._toText=function(t,n,r){if("function"==typeof t)throw new Error("Blaze._toText doesn't take a function, just HTMLjs");if(null==n||n instanceof l.View||(r=n,n=null),n=n||e(),!r)throw new Error("textMode required");if(r!==o.TEXTMODE.STRING&&r!==o.TEXTMODE.RCDATA&&r!==o.TEXTMODE.ATTRIBUTE)throw new Error("Unknown textMode: "+r);return o.toText(l._expand(t,n),r)},l.getData=function(e){var t;if(e)if(e instanceof l.View){var n=e;t="with"===n.name?n:l.getView(n,"with")}else{if("number"!=typeof e.nodeType)throw new Error("Expected DOM element or View");if(1!==e.nodeType)throw new Error("Expected DOM element");t=l.getView(e,"with")}else t=l.getView("with");return t?t.dataVar.get():null},l.getElementData=function(e){if(l._warn("Blaze.getElementData has been deprecated. Use Blaze.getData(element) instead."),1!==e.nodeType)throw new Error("Expected DOM element");return l.getData(e)},l.getView=function(e,t){var n=t;if("string"==typeof e&&(n=e,e=null),e){if(e instanceof l.View)return l._getParentView(e,n);if("number"==typeof e.nodeType)return l._getElementView(e,n);throw new Error("Expected DOM element or View")}return l._getCurrentView(n)},l._getCurrentView=function(e){var t=l.currentView;if(!t)throw new Error("There is no current view");if(e){for(;t&&t.name!==e;)t=t.parentView;return t||null}return t},l._getParentView=function(e,t){var n=e.parentView;if(t)for(;n&&n.name!==t;)n=n.parentView;return n||null},l._getElementView=function(e,t){for(var n=l._DOMRange.forElement(e),r=null;n&&!r;)r=n.view||null,r||(n=n.parentRange?n.parentRange:l._DOMRange.forElement(n.parentElement));if(t){for(;r&&r.name!==t;)r=r.parentView;return r||null}return r},l._addEventMap=function(e,t,n){n=n||null;var r=[];if(!e._domrange)throw new Error("View must have a DOMRange");e._domrange.onAttached(function i(o,s){a.each(t,function(t,i){var u=i.split(/,\s+/);a.each(u,function(i){var a=i.split(/\s+/);if(0!==a.length){var u=a.shift(),c=a.join(" ");r.push(l._EventSupport.listen(s,u,c,function(r){if(!o.containsElement(r.currentTarget))return null;var i=n||this,a=arguments;return l._withCurrentView(e,function(){return t.apply(i,a)})},o,function(e){return e.parentRange}))}})})}),e.onViewDestroyed(function(){a.each(r,function(e){e.stop()}),r.length=0})}}.call(this),function(){l._calculateCondition=function(e){return e instanceof Array&&0===e.length&&(e=!1),!!e},l.With=function(e,t){var n=l.View("with",t);return n.dataVar=new u,n.onViewCreated(function(){"function"==typeof e?n.autorun(function(){n.dataVar.set(e())},n.parentView):n.dataVar.set(e)}),n},l.If=function(e,t,n,r){var i=new u,a=l.View(r?"unless":"if",function(){return i.get()?t():n?n():null});return a.__conditionVar=i,a.onViewCreated(function(){this.autorun(function(){var t=l._calculateCondition(e());i.set(r?!t:t)},this.parentView)}),a},l.Unless=function(e,t,n){return l.If(e,t,n,!0)},l.Each=function(e,t,n){var i=l.View("each",function(){var e=this.initialSubviews;return this.initialSubviews=null,this._isCreatedForExpansion&&(this.expandedValueDep=new r.Dependency,this.expandedValueDep.depend()),e});return i.initialSubviews=[],i.numItems=0,i.inElseMode=!1,i.stopHandle=null,i.contentFunc=t,i.elseFunc=n,i.argVar=new u,i.onViewCreated(function(){i.autorun(function(){i.argVar.set(e())},i.parentView),i.stopHandle=s.observe(function(){return i.argVar.get()},{addedAt:function(e,t,n){r.nonreactive(function(){var e=l.With(t,i.contentFunc);if(i.numItems++,i.expandedValueDep)i.expandedValueDep.changed();else if(i._domrange){i.inElseMode&&(i._domrange.removeMember(0),i.inElseMode=!1);var r=l._materializeView(e,i);i._domrange.addMember(r,n)}else i.initialSubviews.splice(n,0,e)})},removedAt:function(e,t,n){r.nonreactive(function(){i.numItems--,i.expandedValueDep?i.expandedValueDep.changed():i._domrange?(i._domrange.removeMember(n),i.elseFunc&&0===i.numItems&&(i.inElseMode=!0,i._domrange.addMember(l._materializeView(l.View("each_else",i.elseFunc),i),0))):i.initialSubviews.splice(n,1)})},changedAt:function(e,t,n,a){r.nonreactive(function(){var e;i.expandedValueDep?i.expandedValueDep.changed():e=i._domrange?i._domrange.getMember(a).view:i.initialSubviews[a],e.dataVar.set(t)})},movedTo:function(e,t,n,a){r.nonreactive(function(){if(i.expandedValueDep)i.expandedValueDep.changed();else if(i._domrange)i._domrange.moveMember(n,a);else{var e=i.initialSubviews,t=e[n];e.splice(n,1),e.splice(a,0,t)}})}}),i.elseFunc&&0===i.numItems&&(i.inElseMode=!0,i.initialSubviews[0]=l.View("each_else",i.elseFunc))}),i.onViewDestroyed(function(){i.stopHandle&&i.stopHandle.stop()}),i},l._TemplateWith=function(e,t){var n,r=e;"function"!=typeof e&&(r=function(){return e});var i=function(){var e=null;return n.parentView&&"InOuterTemplateScope"===n.parentView.name&&(e=n.parentView.originalParentView),e?l._withCurrentView(e,r):r()},a=function(){var e=t.call(this);return e instanceof l.Template&&(e=e.constructView()),e instanceof l.View&&(e._hasGeneratedParent=!0),e};return n=l.With(i,a),n.__isTemplateWith=!0,n},l._InOuterTemplateScope=function(e,t){var n=l.View("InOuterTemplateScope",t),r=e.parentView;return r.__isTemplateWith&&(r=r.parentView),n.onViewCreated(function(){this.originalParentView=this.parentView,this.parentView=r}),n},l.InOuterTemplateScope=l._InOuterTemplateScope}.call(this),function(){l._globalHelpers={},l.registerHelper=function(e,t){l._globalHelpers[e]=t};var e=function(e,t){return"function"!=typeof e?e:function(){return e.apply(t,arguments)}},t=function(e){return"function"==typeof e?function(){var t=l.getData();return null==t&&(t={}),e.apply(t,arguments)}:e};l._OLDSTYLE_HELPER={};var n=l._getTemplateHelper=function(e,t){var n=!1;if(e.__helpers.has(t)){var r=e.__helpers.get(t);if(r!==l._OLDSTYLE_HELPER)return r;n=!0}return t in e?(n||(e.__helpers.set(t,l._OLDSTYLE_HELPER),e._NOWARN_OLDSTYLE_HELPERS||l._warn("Assigning helper with `"+e.viewName+"."+t+" = ...` is deprecated. Use `"+e.viewName+".helpers(...)` instead.")),e[t]):null},r=function(e){return l._wrapCatchingExceptions(e,"template helper")};l.View.prototype.lookup=function(e,i){var a=this.template,o=i&&i.template,s;if(/^\./.test(e)){if(!/^(\.)+$/.test(e))throw new Error("id starting with dot must be a series of dots");return l._parentData(e.length-1,!0)}return a&&null!=(s=n(a,e))?r(t(s)):o&&e in l.Template&&l.Template[e]instanceof l.Template?l.Template[e]:null!=l._globalHelpers[e]?r(t(l._globalHelpers[e])):function(){var t=arguments.length>0,n=l.getData();if(o&&(!n||!n[e]))throw new Error("No such template: "+e);if(t&&(!n||!n[e]))throw new Error("No such function: "+e);if(!n)return null;var r=n[e];if("function"!=typeof r){if(t)throw new Error("Can't call non-function: "+r);return r}return r.apply(n,arguments)};return null},l._parentData=function(e,t){null==e&&(e=1);for(var n=l.getView("with"),r=0;e>r&&n;r++)n=l.getView(n,"with");return n?t?function(){return n.dataVar.get()}:n.dataVar.get():null},l.View.prototype.lookupTemplate=function(e){return this.lookup(e,{template:!0})}}.call(this),function(){l.Template=function(e,n){if(!(this instanceof l.Template))return new l.Template(e,n);if("function"==typeof e&&(n=e,e=""),"string"!=typeof e)throw new Error("viewName must be a String (or omitted)");if("function"!=typeof n)throw new Error("renderFunction must be a function");this.viewName=e,this.renderFunction=n,this.__helpers=new t,this.__eventMaps=[]};var e=l.Template,t=function(){};t.prototype.get=function(e){return this[" "+e]},t.prototype.set=function(e,t){this[" "+e]=t},t.prototype.has=function(e){return" "+e in this},l.isTemplate=function(e){return e instanceof l.Template},e.prototype.constructView=function(t,n){var r=this,i=l.View(r.viewName,r.renderFunction);return i.template=r,i.templateContentBlock=t?new e("(contentBlock)",t):null,i.templateElseBlock=n?new e("(elseBlock)",n):null,(r.__eventMaps||"object"==typeof r.events)&&i._onViewRendered(function(){1===i.renderCount&&(r.__eventMaps.length||"object"!=typeof r.events||e.prototype.events.call(r,r.events),a.each(r.__eventMaps,function(e){l._addEventMap(i,e,i)}))}),i._templateInstance=new l.TemplateInstance(i),i.templateInstance=function(){var e=i._templateInstance;return e.data=l.getData(i),i._domrange&&!i.isDestroyed?(e.firstNode=i._domrange.firstNode(),e.lastNode=i._domrange.lastNode()):(e.firstNode=null,e.lastNode=null),e},r.created&&i.onViewCreated(function(){r.created.call(i.templateInstance())}),r.rendered&&i.onViewReady(function(){r.rendered.call(i.templateInstance())}),r.destroyed&&i.onViewDestroyed(function(){r.destroyed.call(i.templateInstance())}),i},l.TemplateInstance=function(e){if(!(this instanceof l.TemplateInstance))return new l.TemplateInstance(e);if(!(e instanceof l.View))throw new Error("View required");e._templateInstance=this,this.view=e,this.data=null,this.firstNode=null,this.lastNode=null},l.TemplateInstance.prototype.$=function(e){var t=this.view;if(!t._domrange)throw new Error("Can't use $ on template instance with no DOM");return t._domrange.$(e)},l.TemplateInstance.prototype.findAll=function(e){return Array.prototype.slice.call(this.$(e))},l.TemplateInstance.prototype.find=function(e){var t=this.$(e);return t[0]||null},l.TemplateInstance.prototype.autorun=function(e){return this.view.autorun(e) +},e.prototype.helpers=function(e){for(var t in e)this.__helpers.set(t,e[t])},e.prototype.events=function(e){var t=this,n={};for(var r in e)n[r]=function(e,t){return function(e){var n=this,r=l.getData(e.currentTarget);null==r&&(r={});var i=Array.prototype.slice.call(arguments),a=n.templateInstance();return i.splice(1,0,a),t.apply(r,i)}}(r,e[r]);t.__eventMaps.push(n)},e.instance=function(){for(var e=l.currentView;e&&!e.template;)e=e.parentView;return e?e.templateInstance():null},e.currentData=l.getData,e.parentData=l._parentData,e.registerHelper=l.registerHelper}.call(this),function(){c=l,l.ReactiveVar=u,c._templateInstance=l.Template.instance,d={},d.registerHelper=l.registerHelper,d._escape=l._escape,d.SafeString=function(e){this.string=e},d.SafeString.prototype.toString=function(){return this.string.toString()}}.call(this),"undefined"==typeof Package&&(Package={}),Package.blaze={Blaze:l,UI:c,Handlebars:d}}(); + +!function(){var e=Package.meteor.Meteor,n=Package.underscore._,t=Package.blaze.Blaze,o=Package.blaze.UI,a=Package.blaze.Handlebars,d=Package.htmljs.HTML,c;(function(){c=t.Template;var e="__proto__ name".split(" ");c.__checkName=function(t){if(t in c||n.contains(e,t)){if(c[t]instanceof c&&"body"!==t)throw new Error("There are multiple templates named '"+t+"'. Each template needs a unique name.");throw new Error("This template name is reserved: "+t)}},c.__define__=function(e,n){c.__checkName(e),c[e]=new c("Template."+e,n),c[e]._NOWARN_OLDSTYLE_HELPERS=!0},c.body=new c("body",function(){for(var e=c.body.contentViews,n=0;n<e.length;n++)e[n].template=c.body;return e}),c.body.contentViews=[],c.body.view=null,c.body.addContent=function(e){var n="body_content_"+c.body.contentViews.length;c.body.contentViews.push(t.View(n,e))},c.body.renderToDocument=function(){if(!c.body.view){var e=t.render(c.body,document.body);c.body.view=e}},o.body=c.body,c.__body__=c.body,c.__body__.__contentParts=c.body.contentViews,c.__body__.__instantiate=c.body.renderToDocument}).call(this),"undefined"==typeof Package&&(Package={}),Package.templating={Template:c}}(); + +!function(){var e=Package.underscore._,n=Package.meteor.Meteor,r=Package.tracker.Tracker,t=Package.tracker.Deps,a=Package.session.Session,u=Package.jquery.$,o=Package.jquery.jQuery,s=Package.templating.Template,l=Package.blaze.Blaze,i=Package.blaze.UI,c=Package.blaze.Handlebars,f=Package.htmljs.HTML,p,m,g,d;(function(){g={fallback_language:"en",langauges_tags_regex:"([a-z]{2})(-[A-Z]{2})?",project_translations_domain:"project",browser_path:"/tap-i18n",debug:!1}}).call(this),function(){p={},function(){function e(e,n){if(!n||"function"==typeof n)return e;for(var r in n)e[r]=n[r];return e}function n(e,n,r){var t,a=0,u=e.length,o=void 0===u||"[object Array]"!==Object.prototype.toString.apply(e)||"function"==typeof e;if(r)if(o){for(t in e)if(n.apply(e[t],r)===!1)break}else for(;u>a&&n.apply(e[a++],r)!==!1;);else if(o){for(t in e)if(n.call(e[t],t,e[t])===!1)break}else for(;u>a&&n.call(e[a],a,e[a++])!==!1;);return e}function r(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,function(e){return E[e]}):e}function t(e){var n=function(e){if(window.XMLHttpRequest)return e(null,new XMLHttpRequest);if(window.ActiveXObject)try{return e(null,new ActiveXObject("Msxml2.XMLHTTP"))}catch(n){return e(null,new ActiveXObject("Microsoft.XMLHTTP"))}return e(new Error)},r=function(e){if("string"==typeof e)return e;var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return n.join("&")},t=function(e){e=e.replace(/\r\n/g,"\n");for(var n="",r=0;r<e.length;r++){var t=e.charCodeAt(r);128>t?n+=String.fromCharCode(t):t>127&&2048>t?(n+=String.fromCharCode(t>>6|192),n+=String.fromCharCode(63&t|128)):(n+=String.fromCharCode(t>>12|224),n+=String.fromCharCode(t>>6&63|128),n+=String.fromCharCode(63&t|128))}return n},a=function(e){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e=t(e);var r="",a,u,o,s,l,i,c,f=0;do a=e.charCodeAt(f++),u=e.charCodeAt(f++),o=e.charCodeAt(f++),s=a>>2,l=(3&a)<<4|u>>4,i=(15&u)<<2|o>>6,c=63&o,isNaN(u)?i=c=64:isNaN(o)&&(c=64),r+=n.charAt(s)+n.charAt(l)+n.charAt(i)+n.charAt(c),a=u=o="",s=l=i=c="";while(f<e.length);return r},u=function(){for(var e=arguments[0],n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])}return e},o=function(e,t,a,s){"function"==typeof a&&(s=a,a={}),a.cache=a.cache||!1,a.data=a.data||{},a.headers=a.headers||{},a.jsonp=a.jsonp||!1,a.async=void 0===a.async?!0:a.async;var l=u({accept:"*/*","content-type":"application/x-www-form-urlencoded;charset=UTF-8"},o.headers,a.headers),i;if(i="application/json"===l["content-type"]?JSON.stringify(a.data):r(a.data),"GET"===e){var c=[];if(i&&(c.push(i),i=null),a.cache||c.push("_="+(new Date).getTime()),a.jsonp&&(c.push("callback="+a.jsonp),c.push("jsonp="+a.jsonp)),c=c.join("&"),c.length>1&&(t+=t.indexOf("?")>-1?"&"+c:"?"+c),a.jsonp){var f=document.getElementsByTagName("head")[0],p=document.createElement("script");return p.type="text/javascript",p.src=t,void f.appendChild(p)}}n(function(n,r){if(n)return s(n);r.open(e,t,a.async);for(var u in l)l.hasOwnProperty(u)&&r.setRequestHeader(u,l[u]);r.onreadystatechange=function(){if(4===r.readyState){var e=r.responseText||"";if(!s)return;s(r.status,{text:function(){return e},json:function(){return JSON.parse(e)}})}},r.send(i)})},s={authBasic:function(e,n){o.headers.Authorization="Basic "+a(e+":"+n)},connect:function(e,n,r){return o("CONNECT",e,n,r)},del:function(e,n,r){return o("DELETE",e,n,r)},get:function(e,n,r){return o("GET",e,n,r)},head:function(e,n,r){return o("HEAD",e,n,r)},headers:function(e){o.headers=e||{}},isAllowed:function(e,n,r){this.options(e,function(e,t){r(-1!==t.text().indexOf(n))})},options:function(e,n,r){return o("OPTIONS",e,n,r)},patch:function(e,n,r){return o("PATCH",e,n,r)},post:function(e,n,r){return o("POST",e,n,r)},put:function(e,n,r){return o("PUT",e,n,r)},trace:function(e,n,r){return o("TRACE",e,n,r)}},l=e.type?e.type.toLowerCase():"get";s[l](e.url,e,function(n,r){200===n?e.success(r.json(),n,null):e.error(r.text(),n,null)})}function a(e,n){"function"==typeof e&&(n=e,e={}),e=e||{},D.extend(M,e),delete M.fixLng,"string"==typeof M.ns&&(M.ns={namespaces:[M.ns],defaultNs:M.ns}),"string"==typeof M.fallbackNS&&(M.fallbackNS=[M.fallbackNS]),("string"==typeof M.fallbackLng||"boolean"==typeof M.fallbackLng)&&(M.fallbackLng=[M.fallbackLng]),M.interpolationPrefixEscaped=D.regexEscape(M.interpolationPrefix),M.interpolationSuffixEscaped=D.regexEscape(M.interpolationSuffix),M.lng||(M.lng=D.detectLanguage()),M.lng?M.useCookie&&D.cookie.create(M.cookieName,M.lng,M.cookieExpirationTime,M.cookieDomain):(M.lng=M.fallbackLng[0],M.useCookie&&D.cookie.remove(M.cookieName)),A=D.toLanguages(M.lng),O=A[0],D.log("currentLng set to: "+O);var r=x;e.fixLng&&(r=function(e,n){return n=n||{},n.lng=n.lng||r.lng,x(e,n)},r.lng=O),z.setCurrentLng(O),S&&M.setJqueryExt&&g();var t;if(S&&S.Deferred&&(t=S.Deferred()),!M.resStore){var a=D.toLanguages(M.lng);"string"==typeof M.preload&&(M.preload=[M.preload]);for(var u=0,o=M.preload.length;o>u;u++)for(var s=D.toLanguages(M.preload[u]),l=0,i=s.length;i>l;l++)a.indexOf(s[l])<0&&a.push(s[l]);return p.sync.load(a,M,function(e,a){T=a,C=!0,n&&n(r),t&&t.resolve(r)}),t?t.promise():void 0}return T=M.resStore,C=!0,n&&n(r),t&&t.resolve(r),t?t.promise():void 0}function u(e,n){"string"==typeof e&&(e=[e]);for(var r=0,t=e.length;t>r;r++)M.preload.indexOf(e[r])<0&&M.preload.push(e[r]);return a(n)}function o(e,n,r){"string"!=typeof n?(r=n,n=M.ns.defaultNs):M.ns.namespaces.indexOf(n)<0&&M.ns.namespaces.push(n),T[e]=T[e]||{},T[e][n]=T[e][n]||{},D.extend(T[e][n],r)}function s(e,n){"string"!=typeof n&&(n=M.ns.defaultNs),T[e]=T[e]||{},T[e][n]={}}function l(e){M.ns.defaultNs=e}function i(e,n){c([e],n)}function c(e,n){var r={dynamicLoad:M.dynamicLoad,resGetPath:M.resGetPath,getAsync:M.getAsync,customLoad:M.customLoad,ns:{namespaces:e,defaultNs:""}},t=D.toLanguages(M.lng);"string"==typeof M.preload&&(M.preload=[M.preload]);for(var a=0,u=M.preload.length;u>a;a++)for(var o=D.toLanguages(M.preload[a]),s=0,l=o.length;l>s;s++)t.indexOf(o[s])<0&&t.push(o[s]);for(var i=[],c=0,f=t.length;f>c;c++){var m=!1,g=T[t[c]];if(g)for(var d=0,b=e.length;b>d;d++)g[e[d]]||(m=!0);else m=!0;m&&i.push(t[c])}i.length?p.sync._fetch(i,r,function(r,t){var a=e.length*i.length;D.each(e,function(e,r){M.ns.namespaces.indexOf(r)<0&&M.ns.namespaces.push(r),D.each(i,function(e,u){T[u]=T[u]||{},T[u][r]=t[u][r],a--,0===a&&n&&(M.useLocalStorage&&p.sync._storeLocal(T),n())})})}):n&&n()}function f(e,n,r){return"function"==typeof n?(r=n,n={}):n||(n={}),n.lng=e,a(n,r)}function m(){return O}function g(){function e(e,n,r){if(0!==n.length){var t="text";if(0===n.indexOf("[")){var a=n.split("]");n=a[1],t=a[0].substr(1,a[0].length-1)}n.indexOf(";")===n.length-1&&(n=n.substr(0,n.length-2));var u;if("html"===t)u=M.defaultValueFromContent?S.extend({defaultValue:e.html()},r):r,e.html(S.t(n,u));else if("text"===t)u=M.defaultValueFromContent?S.extend({defaultValue:e.text()},r):r,e.text(S.t(n,u));else if("prepend"===t)u=M.defaultValueFromContent?S.extend({defaultValue:e.html()},r):r,e.prepend(S.t(n,u));else if("append"===t)u=M.defaultValueFromContent?S.extend({defaultValue:e.html()},r):r,e.append(S.t(n,u));else if(0===t.indexOf("data-")){var o=t.substr("data-".length);u=M.defaultValueFromContent?S.extend({defaultValue:e.data(o)},r):r;var s=S.t(n,u);e.data(o,s),e.attr(t,s)}else u=M.defaultValueFromContent?S.extend({defaultValue:e.attr(t)},r):r,e.attr(t,S.t(n,u))}}function n(n,r){var t=n.attr(M.selectorAttr);if(t||"undefined"==typeof t||t===!1||(t=n.text()||n.val()),t){var a=n,u=n.data("i18n-target");if(u&&(a=n.find(u)||n),r||M.useDataAttrOptions!==!0||(r=n.data("i18n-options")),r=r||{},t.indexOf(";")>=0){var o=t.split(";");S.each(o,function(n,t){""!==t&&e(a,t,r)})}else e(a,t,r);M.useDataAttrOptions===!0&&n.data("i18n-options",r)}}S.t=S.t||x,S.fn.TAPi18next=function(e){return this.each(function(){n(S(this),e);var r=S(this).find("["+M.selectorAttr+"]");r.each(function(){n(S(this),e)})})}}function d(e,n,r,t){if(!e)return e;if(t=t||n,e.indexOf(t.interpolationPrefix||M.interpolationPrefix)<0)return e;var a=t.interpolationPrefix?D.regexEscape(t.interpolationPrefix):M.interpolationPrefixEscaped,u=t.interpolationSuffix?D.regexEscape(t.interpolationSuffix):M.interpolationSuffixEscaped,o="HTML"+u;return D.each(n,function(n,s){var l=r?r+M.keyseparator+n:n;"object"==typeof s&&null!==s?e=d(e,s,l,t):t.escapeInterpolation||M.escapeInterpolation?(e=e.replace(new RegExp([a,l,o].join(""),"g"),s),e=e.replace(new RegExp([a,l,u].join(""),"g"),D.escape(s))):e=e.replace(new RegExp([a,l,u].join(""),"g"),s)}),e}function b(e,n){var r=",",t="{",a="}",u=D.extend({},n);for(delete u.postProcess;-1!=e.indexOf(M.reusePrefix)&&(w++,!(w>M.maxRecursion));){var o=e.lastIndexOf(M.reusePrefix),s=e.indexOf(M.reuseSuffix,o)+M.reuseSuffix.length,l=e.substring(o,s),i=l.replace(M.reusePrefix,"").replace(M.reuseSuffix,"");if(-1!=i.indexOf(r)){var c=i.indexOf(r);if(-1!=i.indexOf(t,c)&&-1!=i.indexOf(a,c)){var f=i.indexOf(t,c),p=i.indexOf(a,f)+a.length;try{u=D.extend(u,JSON.parse(i.substring(f,p))),i=i.substring(0,c)}catch(m){}}}var g=k(i,u);e=e.replace(l,g)}return e}function h(e){return e.context&&("string"==typeof e.context||"number"==typeof e.context)}function v(e){return void 0!==e.count&&"string"!=typeof e.count&&1!==e.count}function y(e,n){n=n||{};var r=N(e,n),t=L(e,n);return void 0!==t||t===r}function x(e,n){return n=n||{},C?(w=0,k.apply(null,arguments)):(D.log("i18next not finished initialization. you might have called t function before loading resources finished."),n.defaultValue||"")}function N(e,n){return void 0!==n.defaultValue?n.defaultValue:e}function _(){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);return{postProcess:"sprintf",sprintf:e}}function k(e,n){if(n&&"object"!=typeof n?"sprintf"===M.shortcutFunction?n=_.apply(null,arguments):"defaultValue"===M.shortcutFunction&&(n={defaultValue:n}):n=n||{},void 0===e||null===e)return"";"string"==typeof e&&(e=[e]);var r=e[0];if(e.length>1)for(var t=0;t<e.length&&(r=e[t],!y(r,n));t++);var a=N(r,n),u=L(r,n),o=n.lng?D.toLanguages(n.lng):A,s=n.ns||M.ns.defaultNs,l;r.indexOf(M.nsseparator)>-1&&(l=r.split(M.nsseparator),s=l[0],r=l[1]),void 0===u&&M.sendMissing&&(n.lng?H.postMissing(o[0],s,r,a,o):H.postMissing(M.lng,s,r,a,o));var i=n.postProcess||M.postProcess;void 0!==u&&i&&I[i]&&(u=I[i](u,r,n));var c=a;if(a.indexOf(M.nsseparator)>-1&&(l=a.split(M.nsseparator),c=l[1]),c===r&&M.parseMissingKey&&(a=M.parseMissingKey(a)),void 0===u&&(a=d(a,n),a=b(a,n),i&&I[i])){var f=N(r,n);u=I[i](f,r,n)}return void 0!==u?u:a}function L(e,n){n=n||{};var r,t,a=N(e,n),u=A;if(!T)return a;if("cimode"===u[0].toLowerCase())return a;if(n.lng&&(u=D.toLanguages(n.lng),!T[u[0]])){var o=M.getAsync;M.getAsync=!1,p.sync.load(u,M,function(e,n){D.extend(T,n),M.getAsync=o})}var s=n.ns||M.ns.defaultNs;if(e.indexOf(M.nsseparator)>-1){var l=e.split(M.nsseparator);s=l[0],e=l[1]}if(h(n)){r=D.extend({},n),delete r.context,r.defaultValue=M.contextNotFound;var i=s+M.nsseparator+e+"_"+n.context;if(t=x(i,r),t!=M.contextNotFound)return d(t,{context:n.context})}if(v(n)){r=D.extend({},n),delete r.count,r.defaultValue=M.pluralNotFound;var c=s+M.nsseparator+e+M.pluralSuffix,f=z.get(u[0],n.count);if(f>=0?c=c+"_"+f:1===f&&(c=s+M.nsseparator+e),t=x(c,r),t!=M.pluralNotFound)return d(t,{count:n.count,interpolationPrefix:n.interpolationPrefix,interpolationSuffix:n.interpolationSuffix})}for(var m,g=e.split(M.keyseparator),y=0,_=u.length;_>y&&void 0===m;y++){for(var j=u[y],P=0,S=T[j]&&T[j][s];g[P];)S=S&&S[g[P]],P++;if(void 0!==S){var O=Object.prototype.toString.apply(S);if("string"==typeof S)S=d(S,n),S=b(S,n);else if("[object Array]"!==O||M.returnObjectTrees||n.returnObjectTrees){if(null===S&&M.fallbackOnNull===!0)S=void 0;else if(null!==S)if(M.returnObjectTrees||n.returnObjectTrees){if("[object Number]"!==O&&"[object Function]"!==O&&"[object RegExp]"!==O){var w="[object Array]"===O?[]:{};D.each(S,function(r){w[r]=k(s+M.nsseparator+e+M.keyseparator+r,n)}),S=w}}else M.objectTreeKeyHandler&&"function"==typeof M.objectTreeKeyHandler?S=M.objectTreeKeyHandler(e,S,j,s,n):(S="key '"+s+":"+e+" ("+j+")' returned an object instead of string.",D.log(S))}else S=S.join("\n"),S=d(S,n),S=b(S,n);"string"==typeof S&&""===S.trim()&&M.fallbackOnEmpty===!0&&(S=void 0),m=S}}if(void 0===m&&!n.isFallbackLookup&&(M.fallbackToDefaultNS===!0||M.fallbackNS&&M.fallbackNS.length>0))if(n.isFallbackLookup=!0,M.fallbackNS.length){for(var C=0,E=M.fallbackNS.length;E>C;C++)if(m=L(M.fallbackNS[C]+M.nsseparator+e,n)){var F=m.indexOf(M.nsseparator)>-1?m.split(M.nsseparator)[1]:m,R=a.indexOf(M.nsseparator)>-1?a.split(M.nsseparator)[1]:a;if(F!==R)break}}else m=L(e,n);return m}function j(){var e,n=[];if("undefined"!=typeof window&&(!function(){for(var e=window.location.search.substring(1),r=e.split("&"),t=0;t<r.length;t++){var a=r[t].indexOf("=");if(a>0){var u=r[t].substring(0,a),o=r[t].substring(a+1);n[u]=o}}}(),n[M.detectLngQS]&&(e=n[M.detectLngQS])),!e&&"undefined"!=typeof document&&M.useCookie){var r=D.cookie.read(M.cookieName);r&&(e=r)}return e||"undefined"==typeof navigator||(e=navigator.language?navigator.language:navigator.userLanguage),e}Array.prototype.indexOf||(Array.prototype.indexOf=function(e){"use strict";if(null==this)throw new TypeError;var n=Object(this),r=n.length>>>0;if(0===r)return-1;var t=0;if(arguments.length>0&&(t=Number(arguments[1]),t!=t?t=0:0!=t&&1/0!=t&&t!=-1/0&&(t=(t>0||-1)*Math.floor(Math.abs(t)))),t>=r)return-1;for(var a=t>=0?t:Math.max(r-Math.abs(t),0);r>a;a++)if(a in n&&n[a]===e)return a;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(e){"use strict";if(null==this)throw new TypeError;var n=Object(this),r=n.length>>>0;if(0===r)return-1;var t=r;arguments.length>1&&(t=Number(arguments[1]),t!=t?t=0:0!=t&&t!=1/0&&t!=-(1/0)&&(t=(t>0||-1)*Math.floor(Math.abs(t))));for(var a=t>=0?Math.min(t,r-1):r-Math.abs(t);a>=0;a--)if(a in n&&n[a]===e)return a;return-1}),"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var P=this,S=P.jQuery||P.Zepto,T={},O,w=0,A=[],C=!1;"undefined"!=typeof module&&module.exports?module.exports=p:(S&&(S.TAPi18next=S.TAPi18next||p),P.TAPi18next=P.TAPi18next||p);var M={lng:void 0,load:"all",preload:[],lowerCaseLng:!1,returnObjectTrees:!1,fallbackLng:["dev"],fallbackNS:[],detectLngQS:"setLng",ns:"translation",fallbackOnNull:!0,fallbackOnEmpty:!1,fallbackToDefaultNS:!1,nsseparator:":",keyseparator:".",selectorAttr:"data-i18n",debug:!1,resGetPath:"locales/__lng__/__ns__.json",resPostPath:"locales/add/__lng__/__ns__",getAsync:!0,postAsync:!0,resStore:void 0,useLocalStorage:!1,localStorageExpirationTime:6048e5,dynamicLoad:!1,sendMissing:!1,sendMissingTo:"fallback",sendType:"POST",interpolationPrefix:"__",interpolationSuffix:"__",reusePrefix:"$t(",reuseSuffix:")",pluralSuffix:"_plural",pluralNotFound:["plural_not_found",Math.random()].join(""),contextNotFound:["context_not_found",Math.random()].join(""),escapeInterpolation:!1,setJqueryExt:!1,defaultValueFromContent:!0,useDataAttrOptions:!1,cookieExpirationTime:void 0,useCookie:!0,cookieName:"TAPi18next",cookieDomain:void 0,objectTreeKeyHandler:void 0,postProcess:["sprintf"],parseMissingKey:void 0,shortcutFunction:"sprintf"},E={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},F={create:function(e,n,r,t){var a;if(r){var u=new Date;u.setTime(u.getTime()+60*r*1e3),a="; expires="+u.toGMTString()}else a="";t=t?"domain="+t+";":"",document.cookie=e+"="+n+a+";"+t+"path=/"},read:function(e){for(var n=e+"=",r=document.cookie.split(";"),t=0;t<r.length;t++){for(var a=r[t];" "==a.charAt(0);)a=a.substring(1,a.length);if(0===a.indexOf(n))return a.substring(n.length,a.length)}return null},remove:function(e){this.create(e,"",-1)}},R={create:function(e,n,r,t){},read:function(e){return null},remove:function(e){}},D={extend:S?S.extend:e,each:S?S.each:n,ajax:S?S.ajax:"undefined"!=typeof document?t:function(){},cookie:"undefined"!=typeof document?F:R,detectLanguage:j,escape:r,log:function(e){M.debug&&"undefined"!=typeof console&&console.log(e)},toLanguages:function(e){var n=[];if("string"==typeof e&&e.indexOf("-")>-1){var r=e.split("-");e=M.lowerCaseLng?r[0].toLowerCase()+"-"+r[1].toLowerCase():r[0].toLowerCase()+"-"+r[1].toUpperCase(),"unspecific"!==M.load&&n.push(e),"current"!==M.load&&n.push(r[0])}else n.push(e);for(var t=0;t<M.fallbackLng.length;t++)-1===n.indexOf(M.fallbackLng[t])&&M.fallbackLng[t]&&n.push(M.fallbackLng[t]);return n},regexEscape:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}};D.applyReplacement=d;var H={load:function(e,n,r){n.useLocalStorage?H._loadLocal(e,n,function(t,a){for(var u=[],o=0,s=e.length;s>o;o++)a[e[o]]||u.push(e[o]);u.length>0?H._fetch(u,n,function(e,n){D.extend(a,n),H._storeLocal(n),r(null,a)}):r(null,a)}):H._fetch(e,n,function(e,n){r(null,n)})},_loadLocal:function(e,n,r){var t={},a=(new Date).getTime();if(window.localStorage){var u=e.length;D.each(e,function(e,o){var s=window.localStorage.getItem("res_"+o);s&&(s=JSON.parse(s),s.i18nStamp&&s.i18nStamp+n.localStorageExpirationTime>a&&(t[o]=s)),u--,0===u&&r(null,t)})}},_storeLocal:function(e){if(window.localStorage)for(var n in e)e[n].i18nStamp=(new Date).getTime(),window.localStorage.setItem("res_"+n,JSON.stringify(e[n]))},_fetch:function(e,n,r){var t=n.ns,a={};if(n.dynamicLoad){var u=function(e,n){r(null,n)};if("function"==typeof n.customLoad)n.customLoad(e,t.namespaces,n,u);else{var o=d(n.resGetPath,{lng:e.join("+"),ns:t.namespaces.join("+")});D.ajax({url:o,success:function(e,n,r){D.log("loaded: "+o),u(null,e)},error:function(e,n,r){D.log("failed loading: "+o),u("failed loading resource.json error: "+r)},dataType:"json",async:n.getAsync})}}else{var s=t.namespaces.length*e.length,l;D.each(t.namespaces,function(t,u){D.each(e,function(e,t){var o=function(e,n){e&&(l=l||[],l.push(e)),a[t]=a[t]||{},a[t][u]=n,s--,0===s&&r(l,a)};"function"==typeof n.customLoad?n.customLoad(t,u,n,o):H._fetchOne(t,u,n,o)})})}},_fetchOne:function(e,n,r,t){var a=d(r.resGetPath,{lng:e,ns:n});D.ajax({url:a,success:function(e,n,r){D.log("loaded: "+a),t(null,e)},error:function(e,n,r){if(n&&200==n||e&&e.status&&200==e.status)D.log("There is a typo in: "+a);else if(n&&404==n||e&&e.status&&404==e.status)D.log("Does not exist: "+a);else{var u=n?n:e&&e.status?e.status:null;D.log(u+" when loading "+a)}t(r,{})},dataType:"json",async:r.getAsync})},postMissing:function(e,n,r,t,a){var u={};u[r]=t;var o=[];if("fallback"===M.sendMissingTo&&M.fallbackLng[0]!==!1)for(var s=0;s<M.fallbackLng.length;s++)o.push({lng:M.fallbackLng[s],url:d(M.resPostPath,{lng:M.fallbackLng[s],ns:n})});else if("current"===M.sendMissingTo||"fallback"===M.sendMissingTo&&M.fallbackLng[0]===!1)o.push({lng:e,url:d(M.resPostPath,{lng:e,ns:n})});else if("all"===M.sendMissingTo)for(var s=0,l=a.length;l>s;s++)o.push({lng:a[s],url:d(M.resPostPath,{lng:a[s],ns:n})});for(var i=0,c=o.length;c>i;i++){var f=o[i];D.ajax({url:f.url,type:M.sendType,data:u,success:function(e,a,u){D.log("posted missing key '"+r+"' to: "+f.url);for(var o=r.split("."),s=0,l=T[f.lng][n];o[s];)l=l[o[s]]=s===o.length-1?t:l[o[s]]||{},s++},error:function(e,n,t){D.log("failed posting missing key '"+r+"' to: "+f.url)},dataType:"json",async:M.postAsync})}}},z={rules:{ach:{name:"Acholi",numbers:[1,2],plurals:function(e){return Number(e>1)}},af:{name:"Afrikaans",numbers:[1,2],plurals:function(e){return Number(1!=e)}},ak:{name:"Akan",numbers:[1,2],plurals:function(e){return Number(e>1)}},am:{name:"Amharic",numbers:[1,2],plurals:function(e){return Number(e>1)}},an:{name:"Aragonese",numbers:[1,2],plurals:function(e){return Number(1!=e)}},ar:{name:"Arabic",numbers:[0,1,2,3,11,100],plurals:function(e){return Number(0===e?0:1==e?1:2==e?2:e%100>=3&&10>=e%100?3:e%100>=11?4:5)}},arn:{name:"Mapudungun",numbers:[1,2],plurals:function(e){return Number(e>1)}},ast:{name:"Asturian",numbers:[1,2],plurals:function(e){return Number(1!=e)}},ay:{name:"Aymará",numbers:[1],plurals:function(e){return 0}},az:{name:"Azerbaijani",numbers:[1,2],plurals:function(e){return Number(1!=e)}},be:{name:"Belarusian",numbers:[1,2,5],plurals:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&4>=e%10&&(10>e%100||e%100>=20)?1:2)}},bg:{name:"Bulgarian",numbers:[1,2],plurals:function(e){return Number(1!=e)}},bn:{name:"Bengali",numbers:[1,2],plurals:function(e){return Number(1!=e)}},bo:{name:"Tibetan",numbers:[1],plurals:function(e){return 0}},br:{name:"Breton",numbers:[1,2],plurals:function(e){return Number(e>1)}},bs:{name:"Bosnian",numbers:[1,2,5],plurals:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&4>=e%10&&(10>e%100||e%100>=20)?1:2)}},ca:{name:"Catalan",numbers:[1,2],plurals:function(e){return Number(1!=e)}},cgg:{name:"Chiga",numbers:[1],plurals:function(e){return 0}},cs:{name:"Czech",numbers:[1,2,5],plurals:function(e){return Number(1==e?0:e>=2&&4>=e?1:2)}},csb:{name:"Kashubian",numbers:[1,2,5],plurals:function(e){return Number(1==e?0:e%10>=2&&4>=e%10&&(10>e%100||e%100>=20)?1:2)}},cy:{name:"Welsh",numbers:[1,2,3,8],plurals:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)}},da:{name:"Danish",numbers:[1,2],plurals:function(e){return Number(1!=e)}},de:{name:"German",numbers:[1,2],plurals:function(e){return Number(1!=e)}},dz:{name:"Dzongkha",numbers:[1],plurals:function(e){return 0}},el:{name:"Greek",numbers:[1,2],plurals:function(e){return Number(1!=e)}},en:{name:"English",numbers:[1,2],plurals:function(e){return Number(1!=e)}},eo:{name:"Esperanto",numbers:[1,2],plurals:function(e){return Number(1!=e)}},es:{name:"Spanish",numbers:[1,2],plurals:function(e){return Number(1!=e)}},es_ar:{name:"Argentinean Spanish",numbers:[1,2],plurals:function(e){return Number(1!=e)}},et:{name:"Estonian",numbers:[1,2],plurals:function(e){return Number(1!=e)}},eu:{name:"Basque",numbers:[1,2],plurals:function(e){return Number(1!=e)}},fa:{name:"Persian",numbers:[1],plurals:function(e){return 0}},fi:{name:"Finnish",numbers:[1,2],plurals:function(e){return Number(1!=e)}},fil:{name:"Filipino",numbers:[1,2],plurals:function(e){return Number(e>1)}},fo:{name:"Faroese",numbers:[1,2],plurals:function(e){return Number(1!=e)}},fr:{name:"French",numbers:[1,2],plurals:function(e){return Number(e>1)}},fur:{name:"Friulian",numbers:[1,2],plurals:function(e){return Number(1!=e)}},fy:{name:"Frisian",numbers:[1,2],plurals:function(e){return Number(1!=e)}},ga:{name:"Irish",numbers:[1,2,3,7,11],plurals:function(e){return Number(1==e?0:2==e?1:7>e?2:11>e?3:4)}},gd:{name:"Scottish Gaelic",numbers:[1,2,3,20],plurals:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&20>e?2:3)}},gl:{name:"Galician",numbers:[1,2],plurals:function(e){return Number(1!=e)}},gu:{name:"Gujarati",numbers:[1,2],plurals:function(e){return Number(1!=e)}},gun:{name:"Gun",numbers:[1,2],plurals:function(e){return Number(e>1)}},ha:{name:"Hausa",numbers:[1,2],plurals:function(e){return Number(1!=e)}},he:{name:"Hebrew",numbers:[1,2],plurals:function(e){return Number(1!=e)}},hi:{name:"Hindi",numbers:[1,2],plurals:function(e){return Number(1!=e)}},hr:{name:"Croatian",numbers:[1,2,5],plurals:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&4>=e%10&&(10>e%100||e%100>=20)?1:2)}},hu:{name:"Hungarian",numbers:[1,2],plurals:function(e){return Number(1!=e)}},hy:{name:"Armenian",numbers:[1,2],plurals:function(e){return Number(1!=e)}},ia:{name:"Interlingua",numbers:[1,2],plurals:function(e){return Number(1!=e)}},id:{name:"Indonesian",numbers:[1],plurals:function(e){return 0}},is:{name:"Icelandic",numbers:[1,2],plurals:function(e){return Number(e%10!=1||e%100==11)}},it:{name:"Italian",numbers:[1,2],plurals:function(e){return Number(1!=e)}},ja:{name:"Japanese",numbers:[1],plurals:function(e){return 0}},jbo:{name:"Lojban",numbers:[1],plurals:function(e){return 0}},jv:{name:"Javanese",numbers:[0,1],plurals:function(e){return Number(0!==e)}},ka:{name:"Georgian",numbers:[1],plurals:function(e){return 0}},kk:{name:"Kazakh",numbers:[1],plurals:function(e){return 0}},km:{name:"Khmer",numbers:[1],plurals:function(e){return 0}},kn:{name:"Kannada",numbers:[1,2],plurals:function(e){return Number(1!=e)}},ko:{name:"Korean",numbers:[1],plurals:function(e){return 0}},ku:{name:"Kurdish",numbers:[1,2],plurals:function(e){return Number(1!=e)}},kw:{name:"Cornish",numbers:[1,2,3,4],plurals:function(e){return Number(1==e?0:2==e?1:3==e?2:3)}},ky:{name:"Kyrgyz",numbers:[1],plurals:function(e){return 0}},lb:{name:"Letzeburgesch",numbers:[1,2],plurals:function(e){return Number(1!=e)}},ln:{name:"Lingala",numbers:[1,2],plurals:function(e){return Number(e>1)}},lo:{name:"Lao",numbers:[1],plurals:function(e){return 0}},lt:{name:"Lithuanian",numbers:[1,2,10],plurals:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(10>e%100||e%100>=20)?1:2)}},lv:{name:"Latvian",numbers:[1,2,0],plurals:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)}},mai:{name:"Maithili",numbers:[1,2],plurals:function(e){return Number(1!=e)}},mfe:{name:"Mauritian Creole",numbers:[1,2],plurals:function(e){return Number(e>1)}},mg:{name:"Malagasy",numbers:[1,2],plurals:function(e){return Number(e>1)}},mi:{name:"Maori",numbers:[1,2],plurals:function(e){return Number(e>1)}},mk:{name:"Macedonian",numbers:[1,2],plurals:function(e){return Number(1==e||e%10==1?0:1)}},ml:{name:"Malayalam",numbers:[1,2],plurals:function(e){return Number(1!=e)}},mn:{name:"Mongolian",numbers:[1,2],plurals:function(e){return Number(1!=e)}},mnk:{name:"Mandinka",numbers:[0,1,2],plurals:function(e){return Number(1==e?1:2)}},mr:{name:"Marathi",numbers:[1,2],plurals:function(e){return Number(1!=e)}},ms:{name:"Malay",numbers:[1],plurals:function(e){return 0}},mt:{name:"Maltese",numbers:[1,2,11,20],plurals:function(e){return Number(1==e?0:0===e||e%100>1&&11>e%100?1:e%100>10&&20>e%100?2:3)}},nah:{name:"Nahuatl",numbers:[1,2],plurals:function(e){return Number(1!=e)}},nap:{name:"Neapolitan",numbers:[1,2],plurals:function(e){return Number(1!=e)}},nb:{name:"Norwegian Bokmal",numbers:[1,2],plurals:function(e){return Number(1!=e)}},ne:{name:"Nepali",numbers:[1,2],plurals:function(e){return Number(1!=e)}},nl:{name:"Dutch",numbers:[1,2],plurals:function(e){return Number(1!=e)}},nn:{name:"Norwegian Nynorsk",numbers:[1,2],plurals:function(e){return Number(1!=e)}},no:{name:"Norwegian",numbers:[1,2],plurals:function(e){return Number(1!=e)}},nso:{name:"Northern Sotho",numbers:[1,2],plurals:function(e){return Number(1!=e)}},oc:{name:"Occitan",numbers:[1,2],plurals:function(e){return Number(e>1)}},or:{name:"Oriya",numbers:[2,1],plurals:function(e){return Number(1!=e)}},pa:{name:"Punjabi",numbers:[1,2],plurals:function(e){return Number(1!=e)}},pap:{name:"Papiamento",numbers:[1,2],plurals:function(e){return Number(1!=e)}},pl:{name:"Polish",numbers:[1,2,5],plurals:function(e){return Number(1==e?0:e%10>=2&&4>=e%10&&(10>e%100||e%100>=20)?1:2)}},pms:{name:"Piemontese",numbers:[1,2],plurals:function(e){return Number(1!=e)}},ps:{name:"Pashto",numbers:[1,2],plurals:function(e){return Number(1!=e)}},pt:{name:"Portuguese",numbers:[1,2],plurals:function(e){return Number(1!=e)}},pt_br:{name:"Brazilian Portuguese",numbers:[1,2],plurals:function(e){return Number(1!=e)}},rm:{name:"Romansh",numbers:[1,2],plurals:function(e){return Number(1!=e)}},ro:{name:"Romanian",numbers:[1,2,20],plurals:function(e){return Number(1==e?0:0===e||e%100>0&&20>e%100?1:2)}},ru:{name:"Russian",numbers:[1,2,5],plurals:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&4>=e%10&&(10>e%100||e%100>=20)?1:2)}},sah:{name:"Yakut",numbers:[1],plurals:function(e){return 0}},sco:{name:"Scots",numbers:[1,2],plurals:function(e){return Number(1!=e)}},se:{name:"Northern Sami",numbers:[1,2],plurals:function(e){return Number(1!=e)}},si:{name:"Sinhala",numbers:[1,2],plurals:function(e){return Number(1!=e)}},sk:{name:"Slovak",numbers:[1,2,5],plurals:function(e){return Number(1==e?0:e>=2&&4>=e?1:2)}},sl:{name:"Slovenian",numbers:[5,1,2,3],plurals:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)}},so:{name:"Somali",numbers:[1,2],plurals:function(e){return Number(1!=e)}},son:{name:"Songhay",numbers:[1,2],plurals:function(e){return Number(1!=e)}},sq:{name:"Albanian",numbers:[1,2],plurals:function(e){return Number(1!=e)}},sr:{name:"Serbian",numbers:[1,2,5],plurals:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&4>=e%10&&(10>e%100||e%100>=20)?1:2)}},su:{name:"Sundanese",numbers:[1],plurals:function(e){return 0}},sv:{name:"Swedish",numbers:[1,2],plurals:function(e){return Number(1!=e)}},sw:{name:"Swahili",numbers:[1,2],plurals:function(e){return Number(1!=e)}},ta:{name:"Tamil",numbers:[1,2],plurals:function(e){return Number(1!=e)}},te:{name:"Telugu",numbers:[1,2],plurals:function(e){return Number(1!=e)}},tg:{name:"Tajik",numbers:[1,2],plurals:function(e){return Number(e>1)}},th:{name:"Thai",numbers:[1],plurals:function(e){return 0}},ti:{name:"Tigrinya",numbers:[1,2],plurals:function(e){return Number(e>1)}},tk:{name:"Turkmen",numbers:[1,2],plurals:function(e){return Number(1!=e)}},tr:{name:"Turkish",numbers:[1,2],plurals:function(e){return Number(e>1)}},tt:{name:"Tatar",numbers:[1],plurals:function(e){return 0}},ug:{name:"Uyghur",numbers:[1],plurals:function(e){return 0}},uk:{name:"Ukrainian",numbers:[1,2,5],plurals:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&4>=e%10&&(10>e%100||e%100>=20)?1:2)}},ur:{name:"Urdu",numbers:[1,2],plurals:function(e){return Number(1!=e)}},uz:{name:"Uzbek",numbers:[1,2],plurals:function(e){return Number(e>1)}},vi:{name:"Vietnamese",numbers:[1],plurals:function(e){return 0}},wa:{name:"Walloon",numbers:[1,2],plurals:function(e){return Number(e>1)}},wo:{name:"Wolof",numbers:[1],plurals:function(e){return 0}},yo:{name:"Yoruba",numbers:[1,2],plurals:function(e){return Number(1!=e)}},zh:{name:"Chinese",numbers:[1],plurals:function(e){return 0}}},addRule:function(e,n){z.rules[e]=n},setCurrentLng:function(e){if(!z.currentRule||z.currentRule.lng!==e){var n=e.split("-");z.currentRule={lng:e,rule:z.rules[n[0]]}}},get:function(e,n){function r(n,r){var t;if(t=z.currentRule&&z.currentRule.lng===e?z.currentRule.rule:z.rules[n]){var a=t.plurals(r),u=t.numbers[a];return 2===t.numbers.length&&1===t.numbers[0]&&(2===u?u=-1:1===u&&(u=1)),u}return 1===r?"1":"-1"}var t=e.split("-");return r(t[0],n)}},I={},V=function(e,n){I[e]=n},B=function(){function e(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function n(e,n){for(var r=[];n>0;r[--n]=e);return r.join("")}var r=function(){return r.cache.hasOwnProperty(arguments[0])||(r.cache[arguments[0]]=r.parse(arguments[0])),r.format.call(null,r.cache[arguments[0]],arguments)};return r.format=function(r,t){var a=1,u=r.length,o="",s,l=[],i,c,f,p,m,g;for(i=0;u>i;i++)if(o=e(r[i]),"string"===o)l.push(r[i]);else if("array"===o){if(f=r[i],f[2])for(s=t[a],c=0;c<f[2].length;c++){if(!s.hasOwnProperty(f[2][c]))throw B('[sprintf] property "%s" does not exist',f[2][c]);s=s[f[2][c]]}else s=f[1]?t[f[1]]:t[a++];if(/[^s]/.test(f[8])&&"number"!=e(s))throw B("[sprintf] expecting number but found %s",e(s));switch(f[8]){case"b":s=s.toString(2);break;case"c":s=String.fromCharCode(s);break;case"d":s=parseInt(s,10);break;case"e":s=f[7]?s.toExponential(f[7]):s.toExponential();break;case"f":s=f[7]?parseFloat(s).toFixed(f[7]):parseFloat(s);break;case"o":s=s.toString(8);break;case"s":s=(s=String(s))&&f[7]?s.substring(0,f[7]):s;break;case"u":s=Math.abs(s);break;case"x":s=s.toString(16);break;case"X":s=s.toString(16).toUpperCase()}s=/[def]/.test(f[8])&&f[3]&&s>=0?"+"+s:s,m=f[4]?"0"==f[4]?"0":f[4].charAt(1):" ",g=f[6]-String(s).length,p=f[6]?n(m,g):"",l.push(f[5]?s+p:p+s)}return l.join("")},r.cache={},r.parse=function(e){for(var n=e,r=[],t=[],a=0;n;){if(null!==(r=/^[^\x25]+/.exec(n)))t.push(r[0]);else if(null!==(r=/^\x25{2}/.exec(n)))t.push("%");else{if(null===(r=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(n)))throw"[sprintf] huh?";if(r[2]){a|=1;var u=[],o=r[2],s=[];if(null===(s=/^([a-z_][a-z_\d]*)/i.exec(o)))throw"[sprintf] huh?";for(u.push(s[1]);""!==(o=o.substring(s[0].length));)if(null!==(s=/^\.([a-z_][a-z_\d]*)/i.exec(o)))u.push(s[1]); +else{if(null===(s=/^\[(\d+)\]/.exec(o)))throw"[sprintf] huh?";u.push(s[1])}r[2]=u}else a|=2;if(3===a)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";t.push(r)}n=n.substring(r[0].length)}return t},r}(),G=function(e,n){return n.unshift(e),B.apply(null,n)};V("sprintf",function(e,n,r){return r.sprintf?"[object Array]"===Object.prototype.toString.apply(r.sprintf)?G(e,r.sprintf):"object"==typeof r.sprintf?B(e,r.sprintf):e:e}),p.init=a,p.setLng=f,p.preload=u,p.addResourceBundle=o,p.removeResourceBundle=s,p.loadNamespace=i,p.loadNamespaces=c,p.setDefaultNamespace=l,p.t=x,p.translate=x,p.exists=y,p.detectLanguage=D.detectLanguage,p.pluralExtensions=z,p.sync=H,p.functions=D,p.lng=m,p.addPostProcessor=V,p.options=M}()}.call(this),function(){p.init({resStore:{},fallbackLng:g.fallback_language,useCookie:!1})}.call(this),function(){d="object"==typeof d?d:{};var e=d;e.helpers={}}.call(this),d="object"==typeof d?d:{};var b=d,h;m={},h=g.fallback_language,e.extend(m,{_language_changed_tracker:new r.Dependency,_loaded_languages:[h],_fallback_language:h,_loaded_lang_session_key:"TAPi18n::loaded_lang",conf:null,packages:{},languages_names:{},translations:{},_enable:function(e){return this.conf=e,this._onceEnabled()},_onceEnabled:function(){},_enabled:function(){return null!=this.conf},_getPackageDomain:function(e){return e.replace(/:/g,"-")},addResourceBundle:function(e,n,r){return p.addResourceBundle(e,m._getPackageDomain(n),r)},_getProjectLanguages:function(){return this._enabled()?e.isArray(this.conf.supported_languages)?e.union([this._fallback_language],this.conf.supported_languages):e.keys(this.languages_names):[this._fallback_language]},getLanguages:function(){var e,n,r,t,a;if(!this._enabled())return null;for(n={},a=this._getProjectLanguages(),r=0,t=a.length;t>r;r++)e=a[r],n[e]={name:this.languages_names[e][1],en:this.languages_names[e][0]};return n},_loadLangFileObject:function(n,r){var t,a,u,o;o=[];for(a in r)t=r[a],t=e.extend({},t,(null!=(u=this._loadTranslations_cache[n])?u[a]:void 0)||{}),o.push(m.addResourceBundle(n,a,t));return o},_loadTranslations_cache:{},loadTranslations:function(r,t){var a,u,o,s;u=this._getProjectLanguages(),s=[];for(a in r)o=r[a],null==this._loadTranslations_cache[a]&&(this._loadTranslations_cache[a]={}),null==this._loadTranslations_cache[a][t]&&(this._loadTranslations_cache[a][t]={}),e.extend(this._loadTranslations_cache[a][t],o),m.addResourceBundle(a,t,o),s.push(n.isClient&&this.getLanguage()===a?this._language_changed_tracker.changed():void 0);return s}}),d="object"==typeof d?d:{};var b=d,v,y=[].indexOf||function(e){for(var n=0,r=this.length;r>n;n++)if(n in this&&this[n]===e)return n;return-1},x=[].slice;v=m._loaded_lang_session_key,a.set(v,null),e.extend(m,{_getLanguageFilePath:function(e){var r;return this._enabled()?(r=null!=this.conf.cdn_path?this.conf.cdn_path:this.conf.i18n_files_route,r=r.replace(/\/$/,""),n.isCordova&&"/"===r[0]&&(r=n.absoluteUrl()+r),""+r+"/"+e+".json"):null},_loadLanguage:function(e){var n,r,t,a,o,s;return s=this,r=new u.Deferred,this._enabled()?(o=s._getProjectLanguages(),y.call(o,e)>=0?y.call(s._loaded_languages,e)<0?(a=function(){var n;return n=u.getJSON(s._getLanguageFilePath(e)),n.done(function(n){return m._loadLangFileObject(e,n),s._loaded_languages.push(e),r.resolve()}),n.fail(function(n,t){return r.reject("Couldn't load language '"+e+"' JSON: "+t)})},t=y.call(e,"-")>=0?e.replace(/-.*/,""):h,e!==h&&y.call(o,t)>=0?(n=s._loadLanguage(t),n.done(function(){return a()}),n.fail(function(e){return r.reject("Loading process failed since dependency language '"+t+"' failed to load: "+e)})):a()):r.resolve():r.reject(["Language "+e+" is not supported"]),r.promise()):r.reject("tap-i18n is not enabled in the project level, check tap-i18n README")},_registerHelpers:function(n,r){var t,a,u,o;return a=this,u=this._getPackageI18nextProxy(n!==g.project_translations_domain?a.packages[n].namespace:g.project_translations_domain),o=function(){var n,r,t;return r=arguments[0],n=2<=arguments.length?x.call(arguments,1):[],t=n.pop().hash,e.isEmpty(n)||(t.sprintf=n),u(r,t)},n===g.project_translations_domain?(i.registerHelper(a.conf.helper_name,o),i.registerHelper("languageTag",function(){return a.getLanguage()})):null!=s[r]&&null!=s[r].helpers?(t={},t[a.packages[n].helper_name]=o,s[r].helpers(t)):void 0},_getRegisterHelpersProxy:function(e){var n;return n=this,function(r){return n._registerHelpers(e,r)}},_getPackageI18nextProxy:function(e){var n;return n=this,function(r,t,a){return null==a&&(a=null),null!=a&&console.log("Warning: specifying lang_tag is not supported in client side, using session language"),n._language_changed_tracker.depend(),p.t(""+m._getPackageDomain(e)+":"+r,t)}},_onceEnabled:function(){return m._registerHelpers(g.project_translations_domain)},setLanguage:function(e){var n;return n=this,this._loadLanguage(e).then(function(){return p.setLng(e),n._language_changed_tracker.changed(),a.set(v,e)})},getLanguage:function(){var e;return this._enabled()?(e=a.get(v),null!=e?e:this._fallback_language):null}}),m.__=m._getPackageI18nextProxy(g.project_translations_domain),"undefined"==typeof Package&&(Package={}),Package["tap:i18n"]={TAPi18next:p,TAPi18n:m}}(); + +!function(){var a=Package.meteor.Meteor,e=Package.blaze.Blaze,c=Package.blaze.UI,g=Package.blaze.Handlebars,k=Package.htmljs.HTML,e,c,g;"undefined"==typeof Package&&(Package={}),Package.ui={Blaze:e,UI:c,Handlebars:g}}(); + +!function(){var e=Package.meteor.Meteor,r=Package.blaze.Blaze,n=Package.blaze.UI,t=Package.blaze.Handlebars,i=Package.session.Session,o=Package.tracker.Tracker,a=Package.tracker.Deps,u=Package.underscore._,s=Package.htmljs.HTML,c,n;(function(){"undefined"==typeof c&&(c={});var r={},n=e.isClient?new a.Dependency:null,t="en";c.setLanguage=function(r){r&&r!==t&&(t=r,e.isClient&&n.changed())},c.language=function(){return e.isClient&&n.depend(),t},c.setDictionary=function(e){r=e},c.addDictionary=function(e){u.extend(r,e)};var i=function(e,r){return e==e.toLowerCase()?r.toLowerCase():e==e.toUpperCase()?r.toUpperCase():e.substr(1)==e.substr(1).toLowerCase()?r.substr(0,1).toUpperCase()+r.substr(1).toLowerCase():e.substr(0,2)==e.substr(0,2).toUpperCase()?r:r.replace(/( [a-z])/g,function(e){return e.toUpperCase()})};c.getText=function(e,n){var t=e.toLowerCase(),o=r&&r[t],a="string"==typeof n?n:c.language();return i(e,o?o[a]?o[a]:o.en:"["+e+"]")}}).call(this),function(){("undefined"==typeof n||"function"!=typeof n.registerHelper)&&(n={registerHelper:function(e,r){if("undefined"!=typeof t)return t.registerHelper(e,r);throw new Error("No UI or Handlebars found")}}),"undefined"!=typeof n&&(n.registerHelper("getLength",function(e){return e&&e.length}),n.registerHelper("isSelected",function(e,r){return e===r?" selected":""}),n.registerHelper("isChecked",function(e,r){return e===r?" checked":""}),n.registerHelper("cutString",function(e,r){return e.length>r?e.substr(0,Math.max(r-3,0))+"...":e}),n.registerHelper("$eq",function(e,r){return e===r}),n.registerHelper("$neq",function(e,r){return e!==r}),n.registerHelper("$in",function(e,r,n,t){return e===r||e===n||e===t}),n.registerHelper("$nin",function(e,r,n,t){return e!==r&&e!==n&&e!==t}),n.registerHelper("$exists",function(e){return void 0!==e}),n.registerHelper("$lt",function(e,r){return r>e}),n.registerHelper("$gt",function(e,r){return e>r}),n.registerHelper("$lte",function(e,r){return r>=e}),n.registerHelper("$gte",function(e,r){return e>=r}),n.registerHelper("$and",function(e,r){return e&&r}),n.registerHelper("$or",function(e,r){return e||r}),n.registerHelper("$not",function(e){return!e}),n.registerHelper("nl2br",function(e){var r=(e+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1<br>$2");return new Spacebars.SafeString(r)}),n.registerHelper("getText",function(e,r){var n=r||null;return c.getText(e,n)}),n.registerHelper("$mapped",function(e){if(!Array.isArray(e))try{e=e.fetch()}catch(r){return console.log("Error in $mapped: perhaps you aren't sending in a collection or array."),[]}var n=e.map(function(r,n){return r.$index=n,r.$first=0===n,r.$last=n===e.length-1,r});return n||[]}),c.superScope={},c.addScope=function(e,r){c.superScope[e]=u.bind(function(){return this},r)},c.removeScope=function(e){delete n._globalHelpers[e],delete c.superScope[e]},c.addScope("Session",i),c.addScope("Meteor",e),n.registerHelper("$",function(){return c.superScope}))}.call(this),"undefined"==typeof Package&&(Package={}),Package["raix:handlebar-helpers"]={Helpers:c}}(); + +!function(){var n=Package.meteor.Meteor,i=Package.underscore._,e=Package.templating.Template,a=Package.jquery.$,t=Package.jquery.jQuery,o=Package.blaze.Blaze,r=Package.blaze.UI,s=Package.blaze.Handlebars,m=Package.htmljs.HTML;(function(){e.__checkName("Animate"),e.Animate=new e("Template.Animate",function(){var n=this;return o._InOuterTemplateScope(n,function(){return Spacebars.include(function(){return Spacebars.call(n.templateContentBlock)})})})}).call(this),function(){var t=function(n){return"all 0s ease 0s"===n.css("transition")&&"none 0s ease 0s 1 normal none running"===n.css("animation")?(console.warn('animation-helper error: The following element has no transition defined, but an "animate" class:',n[0]),!0):!1};e.Animate.rendered=function(){var e=this;i.each(this.findAll(".animate"),function(n){var i=a(n);t(i)||(i.width(),i.removeClass("animate"),i.on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd transitionEnd msTransitionEnd animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd animationEnd msAnimationEnd",function(e){e.target===n&&(i.off(e),n._animation_helper_isVisible=!0)}))}),e._animation_helper_parentNode=this.firstNode.parentNode,e._animation_helper_parentNode._uihooks={insertElement:function(n,i){var e=a(n);e.insertBefore(i),e.hasClass("animate")&&!t(e)&&(e.width(),e.removeClass("animate"),e.on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd transitionEnd msTransitionEnd animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd animationEnd msAnimationEnd",function(i){i.target===n&&(e.off(i),n._animation_helper_isVisible=!0)}))},removeElement:function(i){var e=a(i);if(i._animation_helper_isVisible){var t;n.isClient&&(t=n.setTimeout(function(){e.remove(),e=null},5e3)),e.on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd transitionEnd msTransitionEnd animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd animationEnd msAnimationEnd",function(a){a.target===i&&(e.off(a),n.clearTimeout(t),delete i._animation_helper_isVisible,e.remove(),e=null)}),e.addClass("animate").width()}else e.remove(),e=null}}},e.Animate.destroyed=function(){var i=this;n.isClient&&i._animation_helper_parentNode&&Tracker.afterFlush(function(){i._animation_helper_parentNode._uihooks=null})}}.call(this),"undefined"==typeof Package&&(Package={}),Package["frozeman:animation-helper"]={}}(); + +!function(){var e=Package.meteor.Meteor,a=Package.underscore._,t=Package["reactive-var"].ReactiveVar,r;(function(){r={_getTemplateInstance:function(r,n,l){var p=null;if(a.isObject(r)&&(r.hasOwnProperty("_templateInstance")||r.hasOwnProperty("view")))r.hasOwnProperty("_templateInstance")?p=r:r.hasOwnProperty("view")&&(p=r.view);else try{p=Template.instance().view,l=n,n=r}catch(c){throw new e.Error("TemplateVar works only from withing template helpers, callbacks or events. Additonally you can pass a template instance as the first parameter.")}for(;-1===p.name.indexOf("Template.")&&p.parentView;)p=p.parentView;return p&&!p._templateVar&&(p._templateVar={}),p&&!p._templateVar[n]&&(p._templateVar[n]=new t(l)),{key:n,value:l,template:p}},get:function(e,a){var t=r._getTemplateInstance(e,a);return t.template._templateVar[t.key].get()},set:function(e,a,t){var n=r._getTemplateInstance(e,a,t);n.template._templateVar[n.key].set(n.value)}}}).call(this),"undefined"==typeof Package&&(Package={}),Package["frozeman:template-var"]={TemplateVar:r}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.jquery.$,r=Package.jquery.jQuery;(function(){!function(e,t){var r=[].slice,s={},n=e.amplify={publish:function(e){if("string"!=typeof e)throw new Error("You must provide a valid topic to publish.");var t=r.call(arguments,1),n,u,a,o=0,i;if(!s[e])return!0;for(n=s[e].slice(),a=n.length;a>o&&(u=n[o],i=u.callback.apply(u.context,t),i!==!1);o++);return i!==!1},subscribe:function(e,t,r,n){if("string"!=typeof e)throw new Error("You must provide a valid topic to create a subscription.");3===arguments.length&&"number"==typeof r&&(n=r,r=t,t=null),2===arguments.length&&(r=t,t=null),n=n||10;for(var u=0,a=e.split(/\s/),o=a.length,i;o>u;u++){e=a[u],i=!1,s[e]||(s[e]=[]);for(var c=s[e].length-1,l={callback:r,context:t,priority:n};c>=0;c--)if(s[e][c].priority<=n){s[e].splice(c+1,0,l),i=!0;break}i||s[e].unshift(l)}return r},unsubscribe:function(e,t,r){if("string"!=typeof e)throw new Error("You must provide a valid topic to remove a subscription.");if(2===arguments.length&&(r=t,t=null),s[e])for(var n=s[e].length,u=0;n>u;u++)s[e][u].callback===r&&(t&&s[e][u].context!==t||(s[e].splice(u,1),u--,n--))}}}(this),function(e,t){function r(e,r){s.addType(e,function(u,a,o){var i,c,l,p,f=a,d=(new Date).getTime();if(!u){f={},p=[],l=0;try{for(u=r.length;u=r.key(l++);)n.test(u)&&(c=JSON.parse(r.getItem(u)),c.expires&&c.expires<=d?p.push(u):f[u.replace(n,"")]=c.data);for(;u=p.pop();)r.removeItem(u)}catch(y){}return f}if(u="__amplify__"+u,a===t){if(i=r.getItem(u),c=i?JSON.parse(i):{expires:-1},!(c.expires&&c.expires<=d))return c.data;r.removeItem(u)}else if(null===a)r.removeItem(u);else{c=JSON.stringify({data:a,expires:o.expires?d+o.expires:null});try{r.setItem(u,c)}catch(y){s[e]();try{r.setItem(u,c)}catch(y){throw s.error()}}}return f})}var s=e.store=function(e,t,r){var n=s.type;return r&&r.type&&r.type in s.types&&(n=r.type),s.types[n](e,t,r||{})};s.types={},s.type=null,s.addType=function(e,t){s.type||(s.type=e),s.types[e]=t,s[e]=function(t,r,n){return n=n||{},n.type=e,s(t,r,n)}},s.error=function(){return"amplify.store quota exceeded"};var n=/^__amplify__/;for(var u in{localStorage:1,sessionStorage:1})try{window[u].setItem("__amplify__","x"),window[u].removeItem("__amplify__"),r(u,window[u])}catch(a){}if(!s.types.localStorage&&window.globalStorage)try{r("globalStorage",window.globalStorage[window.location.hostname]),"sessionStorage"===s.type&&(s.type="globalStorage")}catch(a){}!function(){if(!s.types.localStorage){var e=document.createElement("div"),r="amplify";e.style.display="none",document.getElementsByTagName("head")[0].appendChild(e);try{e.addBehavior("#default#userdata"),e.load(r)}catch(n){return void e.parentNode.removeChild(e)}s.addType("userData",function(n,u,a){e.load(r);var o,i,c,l,p,f=u,d=(new Date).getTime();if(!n){for(f={},p=[],l=0;o=e.XMLDocument.documentElement.attributes[l++];)i=JSON.parse(o.value),i.expires&&i.expires<=d?p.push(o.name):f[o.name]=i.data;for(;n=p.pop();)e.removeAttribute(n);return e.save(r),f}if(n=n.replace(/[^\-._0-9A-Za-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c-\u200d\u203f\u2040\u2070-\u218f]/g,"-"),n=n.replace(/^-/,"_-"),u===t){if(o=e.getAttribute(n),i=o?JSON.parse(o):{expires:-1},!(i.expires&&i.expires<=d))return i.data;e.removeAttribute(n)}else null===u?e.removeAttribute(n):(c=e.getAttribute(n),i=JSON.stringify({data:u,expires:a.expires?d+a.expires:null}),e.setAttribute(n,i));try{e.save(r)}catch(y){null===c?e.removeAttribute(n):e.setAttribute(n,c),s.userData();try{e.setAttribute(n,i),e.save(r)}catch(y){throw null===c?e.removeAttribute(n):e.setAttribute(n,c),s.error()}}return f})}}(),function(){function e(e){return e===t?t:JSON.parse(JSON.stringify(e))}var r={},n={};s.addType("memory",function(s,u,a){return s?u===t?e(r[s]):(n[s]&&(clearTimeout(n[s]),delete n[s]),null===u?(delete r[s],null):(r[s]=u,a.expires&&(n[s]=setTimeout(function(){delete r[s],delete n[s]},a.expires)),u)):e(r)})}()}(this.amplify=this.amplify||{}),function(e,t){"use strict";function r(){}function s(e){return"[object Function]"==={}.toString.call(e)}function n(e){var t=!1;return setTimeout(function(){t=!0},1),function(){var r=this,s=arguments;t?e.apply(r,s):setTimeout(function(){e.apply(r,s)},1)}}e.request=function(t,u,a){var o=t||{};"string"==typeof o&&(s(u)&&(a=u,u={}),o={resourceId:t,data:u||{},success:a});var i={abort:r},c=e.request.resources[o.resourceId],l=o.success||r,p=o.error||r;if(o.success=n(function(t,r){r=r||"success",e.publish("request.success",o,t,r),e.publish("request.complete",o,t,r),l(t,r)}),o.error=n(function(t,r){r=r||"error",e.publish("request.error",o,t,r),e.publish("request.complete",o,t,r),p(t,r)}),!c){if(!o.resourceId)throw"amplify.request: no resourceId provided";throw"amplify.request: unknown resourceId: "+o.resourceId}return e.publish("request.before",o)?(e.request.resources[o.resourceId](o,i),i):void o.error(null,"abort")},e.request.types={},e.request.resources={},e.request.define=function(t,r,s){if("string"==typeof r){if(!(r in e.request.types))throw"amplify.request.define: unknown type: "+r;s.resourceId=t,e.request.resources[t]=e.request.types[r](s)}else e.request.resources[t]=r}}(amplify),function(e,t,r){"use strict";var s=["status","statusText","responseText","responseXML","readyState"],n=/\{([^\}]+)\}/g;e.request.types.ajax=function(n){return n=t.extend({type:"GET"},n),function(u,a){var o,i,c=n.url,l=a.abort,p=t.extend(!0,{},n,{data:u.data}),f=!1,d={readyState:0,setRequestHeader:function(e,t){return o.setRequestHeader(e,t)},getAllResponseHeaders:function(){return o.getAllResponseHeaders()},getResponseHeader:function(e){return o.getResponseHeader(e)},overrideMimeType:function(e){return o.overrideMimeType(e)},abort:function(){f=!0;try{o.abort()}catch(e){}i(null,"abort")},success:function(e,t){u.success(e,t)},error:function(e,t){u.error(e,t)}};i=function(e,n){t.each(s,function(e,t){try{d[t]=o[t]}catch(r){}}),/OK$/.test(d.statusText)&&(d.statusText="success"),e===r&&(e=null),f&&(n="abort"),/timeout|error|abort/.test(n)?d.error(e,n):d.success(e,n),i=t.noop},e.publish("request.ajax.preprocess",n,u,p,d),t.extend(p,{isJSONP:function(){return/jsonp/gi.test(this.dataType)},cacheURL:function(){if(!this.isJSONP())return this.url;var e="callback";this.hasOwnProperty("jsonp")&&(this.jsonp!==!1?e=this.jsonp:this.hasOwnProperty("jsonpCallback")&&(e=this.jsonpCallback));var t=new RegExp("&?"+e+"=[^&]*&?","gi");return this.url.replace(t,"")},success:function(e,t){i(e,t)},error:function(e,t){i(null,t)},beforeSend:function(t,r){o=t,p=r;var s=n.beforeSend?n.beforeSend.call(this,d,p):!0;return s&&e.publish("request.before.ajax",n,u,p,d)}}),p.cache&&p.isJSONP()&&t.extend(p,{cache:!0}),t.ajax(p),a.abort=function(){d.abort(),l.call(this)}}},e.subscribe("request.ajax.preprocess",function(e,r,s){var u=[],a=s.data;"string"!=typeof a&&(a=t.extend(!0,{},e.data,a),s.url=s.url.replace(n,function(e,t){return t in a?(u.push(t),a[t]):void 0}),t.each(u,function(e,t){delete a[t]}),s.data=a)}),e.subscribe("request.ajax.preprocess",function(e,r,s){var n=s.data,u=e.dataMap;u&&"string"!=typeof n&&(t.isFunction(u)?s.data=u(n):(t.each(e.dataMap,function(e,t){e in n&&(n[t]=n[e],delete n[e])}),s.data=n))});var u=e.request.cache={_key:function(e,t,r){function s(){return r.charCodeAt(u++)<<24|r.charCodeAt(u++)<<16|r.charCodeAt(u++)<<8|r.charCodeAt(u++)<<0}r=t+r;for(var n=r.length,u=0,a=s();n>u;)a^=s();return"request-"+e+"-"+a},_default:function(){var e={};return function(t,r,s,n){var a=u._key(r.resourceId,s.cacheURL(),s.data),o=t.cache;if(a in e)return n.success(e[a]),!1;var i=n.success;n.success=function(t){e[a]=t,"number"==typeof o&&setTimeout(function(){delete e[a]},o),i.apply(this,arguments)}}}()};e.store&&(t.each(e.store.types,function(t){u[t]=function(r,s,n,a){var o=u._key(s.resourceId,n.cacheURL(),n.data),i=e.store[t](o);if(i)return n.success(i),!1;var c=a.success;a.success=function(s){e.store[t](o,s,{expires:r.cache.expires}),c.apply(this,arguments)}}}),u.persist=u[e.store.type]),e.subscribe("request.before.ajax",function(e){var t=e.cache;return t?(t=t.type||t,u[t in u?t:"_default"].apply(this,arguments)):void 0}),e.request.decoders={jsend:function(e,t,r,s,n){"success"===e.status?s(e.data):"fail"===e.status?n(e.data,"fail"):"error"===e.status?(delete e.status,n(e,"error")):n(null,"error")}},e.subscribe("request.before.ajax",function(r,s,n,u){function a(e,t){i(e,t)}function o(e,t){c(e,t)}var i=u.success,c=u.error,l=t.isFunction(r.decoder)?r.decoder:r.decoder in e.request.decoders?e.request.decoders[r.decoder]:e.request.decoders._default;l&&(u.success=function(e,t){l(e,t,u,a,o)},u.error=function(e,t){l(e,t,u,a,o)})})}(amplify,r)}).call(this),"undefined"==typeof Package&&(Package={}),Package.amplify={}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.underscore._,n;(function(){var o=4.8,a=50;n=function(e){var o=this;if(!(o instanceof n))throw new Error('use "new" to construct a PersistentMinimongo');o.key="minimongo__"+e._name,o.col=e,o.cur=o.col.find({}),o.stats={added:0,removed:0,changed:0},i.push(o),o.refresh(!0),o.cur.observe({added:function(e){o.capCollection();var n=amplify.store(o.key);n||(n=[]),t.contains(n,e._id)||(n.push(e._id),amplify.store(o.key,n));var a=o._makeDataKey(e._id);amplify.store(a)||amplify.store(a,e),++o.stats.added},removed:function(e){var n=amplify.store(o.key);t.contains(n,e._id)&&(n=t.without(n,e._id),amplify.store(o._makeDataKey(e._id),null),amplify.store(o.key,0===n.length?null:n),++o.stats.removed)},changed:function(e,t){amplify.store(o._makeDataKey(e._id),e),++o.stats.changed}})},n.prototype={constructor:n,_getStats:function(){return this.stats},_getKey:function(){return this.key},_makeDataKey:function(e){return this.key+"__"+e},refresh:function(e){var n=this,o=amplify.store(n.key),a=[];if(n.stats.added=0,o){var i=o.length;o=t.filter(o,function(e){var t=amplify.store(n._makeDataKey(e));if(t){var o=n.col.findOne({_id:t._id});o?n.col.update({_id:o._id},t):n.col.insert(t)}return!!t}),e||(n.col.find({}).forEach(function(e){t.contains(o,e._id)||a.push(e._id)}),t.each(a,function(e){n.col.remove({_id:e})})),e&&i!=o.length&&lify.store(n.key,0===o.length?null:o)}},localStorageSize:function(){var e=0;return localStorage&&t.each(Object.keys(localStorage),function(t){e+=2*localStorage[t].length/1024/1024}),e},capCollection:function(){var e=this;e.localStorageSize()>o&&(console.log(e.localStorageSize(),e.col.find({}).count()),t.each(e.col.find({},{limit:a}).fetch(),function(t){e.col.remove(t._id)}))}};var i=[],r=null;e.startup(function(){$(window).bind("storage",function(n){e.clearTimeout(r),r=e.setTimeout(function(){t.each(i,function(e){e.refresh(!1)})},250)})})}).call(this),"undefined"==typeof Package&&(Package={}),Package["frozeman:persistent-minimongo"]={PersistentMinimongo:n}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.tracker.Tracker,n=Package.tracker.Deps,a=Package.underscore._,i;(function(){i=function(){function n(e){this._dependency=new t.Dependency,this._intervalId=null,a.isFinite(e)&&this.start(e)}return n.prototype.start=function(t){var n=this;this._intervalId=e.setInterval(function(){n._dependency.changed()},1e3*t)},n.prototype.stop=function(){e.clearInterval(this._intervalId),this._intervalId=null},n.prototype.tick=function(){this._dependency.depend()},n}()}).call(this),"undefined"==typeof Package&&(Package={}),Package["frozeman:reactive-timer"]={ReactiveTimer:i}}(); + +!function(){var e=Package.meteor.Meteor,n;(function(){n=function(){"use strict";function e(n,t){var r,s,u,f,h,g,v=this;if(!(v instanceof e))return new e(n,t);if(n instanceof e){if(null==t)return S=0,v.s=n.s,v.e=n.e,void(v.c=(n=n.c)?n.slice():n);n+=""}else if(f="number"==(h=typeof n)){if(null==t&&n===~~n){for(v.s=0>1/n?(n=-n,-1):1,s=S=0,u=n;u>=10;u/=10,s++);return v.e=s,void(v.c=[n])}n=0===n&&0>1/n?"-0":n+""}else"string"!=h&&(n+="");if(h=n,null==t&&A.test(h))v.s=45===h.charCodeAt(0)?(h=h.slice(1),-1):1;else{if(10==t)return v=new e(h),l(v,c+v.e+1,a);if(h=R.call(h).replace(/^\+(?!-)/,""),v.s=45===h.charCodeAt(0)?(h=h.replace(/^-(?!-)/,""),-1):1,null!=t?t!=~~t&&d||(O=!(t>=2&&65>t))?(o(t,2),g=A.test(h)):(r="["+b.slice(0,t=0|t)+"]+",h=h.replace(/\.$/,"").replace(/^\./,"0."),(g=new RegExp("^"+r+"(?:\\."+r+")?$",37>t?"i":"").test(h))?(f&&(h.replace(/^0\.0*|\./,"").length>15&&o(n,0),f=!f),h=i(h,10,t,v.s)):"Infinity"!=h&&"NaN"!=h&&(o(n,1,t),n="NaN")):g=A.test(h),!g)return v.c=v.e=null,"Infinity"!=h&&("NaN"!=h&&o(n,3),v.s=null),void(S=0)}for((s=h.indexOf("."))>-1&&(h=h.replace(".","")),(u=h.search(/e/i))>0?(0>s&&(s=u),s+=+h.slice(u+1),h=h.substring(0,u)):0>s&&(s=h.length),u=0;48===h.charCodeAt(u);u++);for(t=h.length;48===h.charCodeAt(--t););if(h=h.slice(u,t+1))if(t=h.length,f&&t>15&&o(n,0),s=s-u-1,s>m)v.c=v.e=null;else if(p>s)v.c=[v.e=0];else{if(v.e=s,v.c=[],u=(s+1)%_,0>s&&(u+=_),t>u){for(u&&v.c.push(+h.slice(0,u)),t-=_;t>u;v.c.push(+h.slice(u,u+=_)));h=h.slice(u),u=_-h.length}else u-=t;for(;u--;h+="0");v.c.push(+h)}else v.c=[v.e=0];S=0}function n(e,n,t){for(var r=1,i=n.length;!n[--i];n.pop());for(i=n[0];i>=10;i/=10,r++);return(t=r+t*_-1)>m?e.c=e.e=null:p>t?e.c=[e.e=0]:(e.e=t,e.c=n),e}function t(e){for(var n,t,r=1,i=e.length,s=e[0]+"";i>r;){for(n=e[r++]+"",t=_-n.length;t--;n="0"+n);s+=n}for(i=s.length;48===s.charCodeAt(--i););return s.slice(0,i+1||1)}function r(e,n,t){for(var r,i=[0],s,o=0,l=e.length;l>o;){for(s=i.length;s--;i[s]*=n);for(i[r=0]+=b.indexOf(e.charAt(o++));r<i.length;r++)i[r]>t-1&&(null==i[r+1]&&(i[r+1]=0),i[r+1]+=i[r]/t|0,i[r]%=t)}return i.reverse()}function i(n,t,i,s){var o,l,u,f,h,g,p,m=n.indexOf("."),d=a;for(37>i&&(n=n.toLowerCase()),m>=0&&(n=n.replace(".",""),p=new e(i),h=p.pow(n.length-m),p.c=r(h.toFixed(),10,t),p.e=p.c.length),g=r(n,i,t),l=u=g.length;0==g[--u];g.pop());if(!g[0])return"0";if(0>m?--l:(h.c=g,h.e=l,h.s=s,h=D(h,p,c,d,t),g=h.c,f=h.r,l=h.e),o=l+c+1,m=g[o],u=t/2,f=f||0>o||null!=g[o+1],f=4>d?(null!=m||f)&&(0==d||d==(h.s<0?3:2)):m>u||m==u&&(4==d||f||6==d&&1&g[o-1]||d==(h.s<0?8:7)),1>o||!g[0])g.length=1,u=0,f?(g[0]=1,l=-c):l=g[0]=0;else{if(g.length=o,f)for(--t;++g[--o]>t;)g[o]=0,o||(++l,g.unshift(1));for(u=g.length;!g[--u];);}for(m=0,n="";u>=m;n+=b.charAt(g[m++]));if(0>l){for(;++l;n="0"+n);n="0."+n}else if(m=n.length,++l>m)for(l-=m;l--;n+="0");else m>l&&(n=n.slice(0,l)+"."+n.slice(l));return n}function s(n,r,i){var s,o,u,f=(n=new e(n)).e;if(null==r?s=0:(l(n,++r,a),s=i?r:r+n.e-f,f=n.e),o=t(n.c),1==i||2==i&&(f>=r||h>=f)){for(;o.length<s;o+="0");o.length>1&&(o=o.charAt(0)+"."+o.slice(1)),o+=(0>f?"e":"e+")+f}else{if(i=o.length,0>f){for(u=s-i;++f;o="0"+o);o="0."+o}else if(++f>i){for(u=s-f,f-=i;f--;o+="0");u>0&&(o+=".")}else u=s-i,i>f?o=o.slice(0,f)+"."+o.slice(f):u>0&&(o+=".");if(u>0)for(;u--;o+="0");}return n.s<0&&n.c[0]?"-"+o:o}function o(e,n,t,r,i,s){if(d){var o,l=["new BigNumber","cmp","div","eq","gt","gte","lt","lte","minus","mod","plus","times","toFraction","divToInt"][S?0>S?-S:S:0>1/S?1:0]+"()",u=O?" out of range":" not a"+(i?" non-zero":"n")+" integer";throw u=([l+" number type has more than 15 significant digits",l+" not a base "+t+" number",l+" base"+u,l+" not a number"][n]||t+"() "+n+(s?" not a boolean or binary digit":u+(r?" or not ["+(O?" negative, positive":" integer, integer")+" ]":"")))+": "+e,O=S=0,o=new Error(u),o.name="BigNumber Error",o}}function l(e,n,t,r){var i,s,o,l,u,f,c,a,h=y;if(a=e.c){e:{for(i=1,l=a[0];l>=10;l/=10,i++);if(s=n-i,0>s)s+=_,o=n,u=a[f=0],c=u/h[i-o-1]%10|0;else if(f=Math.ceil((s+1)/_),f>=a.length){if(!r)break e;for(;a.length<=f;a.push(0));u=c=0,i=1,s%=_,o=s-_+1}else{for(u=l=a[f],i=1;l>=10;l/=10,i++);s%=_,o=s-_+i,c=0>o?0:u/h[i-o-1]%10|0}if(r=r||0>n||null!=a[f+1]||(0>o?u:u%h[i-o-1]),r=4>t?(c||r)&&(0==t||t==(e.s<0?3:2)):c>5||5==c&&(4==t||r||6==t&&(s>0?o>0?u/h[i-o]:0:a[f-1])%10&1||t==(e.s<0?8:7)),1>n||!a[0])return a.length=0,r?(n-=e.e+1,a[0]=h[n%_],e.e=-n||0):a[0]=e.e=0,e;if(0==s?(a.length=f,l=1,f--):(a.length=f+1,l=h[_-s],a[f]=o>0?E(u/h[i-o]%h[o])*l:0),r)for(;;){if(0==f){for(s=1,o=a[0];o>=10;o/=10,s++);for(o=a[0]+=l,l=1;o>=10;o/=10,l++);s!=l&&(e.e++,a[0]==F&&(a[0]=1));break}if(a[f]+=l,a[f]!=F)break;a[f--]=0,l=1}for(s=a.length;0===a[--s];a.pop());}e.e>m?e.c=e.e=null:e.e<p&&(e.c=[e.e=0])}return e}var u=1e9,f=1e6,c=20,a=4,h=-7,g=21,p=-u,m=u,d=!0,v=parseInt,w={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0},N=e.prototype,b="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",O,S=0,E=Math.floor,A=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,R=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},F=1e14,_=14,x=1e7,y=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],I=new e(1);e.ROUND_UP=0,e.ROUND_DOWN=1,e.ROUND_CEIL=2,e.ROUND_FLOOR=3,e.ROUND_HALF_UP=4,e.ROUND_HALF_DOWN=5,e.ROUND_HALF_EVEN=6,e.ROUND_HALF_CEIL=7,e.ROUND_HALF_FLOOR=8,e.config=function(){var e,n,t=0,r={},i=arguments,s=i[0],l="config",f=function(e,n,t){return!((O=n>e||e>t)||v(e)!=e&&0!==e)},N=s&&"object"==typeof s?function(){return s.hasOwnProperty(n)?null!=(e=s[n]):void 0}:function(){return i.length>t?null!=(e=i[t++]):void 0};if(N(n="DECIMAL_PLACES")&&(f(e,0,u)?c=0|e:o(e,n,l)),r[n]=c,N(n="ROUNDING_MODE")&&(f(e,0,8)?a=0|e:o(e,n,l)),r[n]=a,N(n="EXPONENTIAL_AT")&&(f(e,-u,u)?h=-(g=~~(0>e?-e:+e)):!O&&e&&f(e[0],-u,0)&&f(e[1],0,u)?(h=~~e[0],g=~~e[1]):o(e,n,l,1)),r[n]=[h,g],N(n="RANGE")&&(f(e,-u,u)&&~~e?p=-(m=~~(0>e?-e:+e)):!O&&e&&f(e[0],-u,-1)&&f(e[1],1,u)?(p=~~e[0],m=~~e[1]):o(e,n,l,1,1)),r[n]=[p,m],N(n="ERRORS")&&(e===!!e||1===e||0===e?(O=S=0,v=(d=!!e)?parseInt:parseFloat):o(e,n,l,0,0,1)),r[n]=d,N(n="FORMAT"))if("object"==typeof e)w=e;else if(d)throw r=new Error(l+"() "+n+" not an object: "+e),r.name="BigNumber Error",r;return r[n]=w,r};var D=function(){function n(e,n,t){var r,i,s,o,l=0,u=e.length,f=n%x,c=n/x|0;for(e=e.slice();u--;)s=e[u]%x,o=e[u]/x|0,r=c*s+o*f,i=f*s+r%x*x+l,l=(i/t|0)+(r/x|0)+c*o,e[u]=i%t;return l&&e.unshift(l),e}function t(e,n,t,r){var i,s;if(t!=r)s=t>r?1:-1;else for(i=s=0;t>i;i++)if(e[i]!=n[i]){s=e[i]>n[i]?1:-1;break}return s}function r(e,n,t,r){for(var i=0;t--;)e[t]-=i,i=e[t]<n[t]?1:0,e[t]=i*r+e[t]-n[t];for(;!e[0]&&e.length>1;e.shift());}return function(i,s,o,u,f){var c,a,h,g,p,m,d,v,w,N,b,O,S,A,R,x,y,I=i.s==s.s?1:-1,D=i.c,L=s.c;if(!(D&&D[0]&&L&&L[0]))return new e(i.s&&s.s&&(D?!L||D[0]!=L[0]:L)?D&&0==D[0]||!L?0*I:I/0:0/0);for(v=new e(I),w=v.c=[],a=i.e-s.e,I=o+a+1,f||(f=F,A=i.e/_,h=0|A,a=(A>0||A===h?h:h-1)-(x=s.e/_,h=0|x,x>0||x===h?h:h-1),I=I/_|0),h=0;L[h]==(D[h]||0);h++);if(L[h]>(D[h]||0)&&a--,0>I)w.push(1),g=!0;else{for(A=D.length,x=L.length,h=0,I+=2,p=E(f/(L[0]+1)),p>1&&(L=n(L,p,f),D=n(D,p,f),x=L.length,A=D.length),S=x,N=D.slice(0,x),b=N.length;x>b;N[b++]=0);y=L.slice(),y.unshift(0),R=L[0],L[1]>=f/2&&R++;do p=0,c=t(L,N,x,b),0>c?(O=N[0],x!=b&&(O=O*f+(N[1]||0)),p=E(O/R),p>1?(p>=f&&(p=f-1),m=n(L,p,f),d=m.length,b=N.length,c=t(m,N,d,b),1==c&&(p--,r(m,d>x?y:L,d,f))):(0==p&&(c=p=1),m=L.slice()),d=m.length,b>d&&m.unshift(0),r(N,m,b,f),-1==c&&(b=N.length,c=t(L,N,x,b),1>c&&(p++,r(N,b>x?y:L,b,f))),b=N.length):0===c&&(p++,N=[0]),w[h++]=p,c&&N[0]?N[b++]=D[S]||0:(N=[D[S]],b=1);while((S++<A||null!=N[0])&&I--);g=null!=N[0],w[0]||w.shift()}if(f==F){for(h=1,I=w[0];I>=10;I/=10,h++);l(v,o+(v.e=h+a*_-1)+1,u,g)}else v.e=a,v.r=+g;return v}}();return N.absoluteValue=N.abs=function(){var n=new e(this);return n.s<0&&(n.s=1),n},N.ceil=function(){return l(new e(this),this.e+1,2)},N.comparedTo=N.cmp=function(n,t){var r,i=this,s=i.c,o=(S=-S,n=new e(n,t)).c,l=i.s,u=n.s,f=i.e,c=n.e;if(!l||!u)return null;if(r=s&&!s[0],t=o&&!o[0],r||t)return r?t?0:-u:l;if(l!=u)return l;if(r=0>l,t=f==c,!s||!o)return t?0:!s^r?1:-1;if(!t)return f>c^r?1:-1;for(l=-1,u=(f=s.length)<(c=o.length)?f:c;++l<u;)if(s[l]!=o[l])return s[l]>o[l]^r?1:-1;return f==c?0:f>c^r?1:-1},N.decimalPlaces=N.dp=function(){var e,n,t=this.c;if(!t)return null;if(e=((n=t.length-1)-E(this.e/_))*_,n=t[n])for(;n%10==0;n/=10,e--);return 0>e&&(e=0),e},N.dividedBy=N.div=function(n,t){return S=2,D(this,new e(n,t),c,a)},N.dividedToIntegerBy=N.divToInt=function(n,t){return S=13,D(this,new e(n,t),0,1)},N.equals=N.eq=function(e,n){return S=3,0===this.cmp(e,n)},N.floor=function(){return l(new e(this),this.e+1,3)},N.greaterThan=N.gt=function(e,n){return S=4,this.cmp(e,n)>0},N.greaterThanOrEqualTo=N.gte=function(e,n){return S=5,1==(n=this.cmp(e,n))||0===n},N.isFinite=function(){return!!this.c},N.isInteger=N.isInt=function(){return!!this.c&&E(this.e/_)>this.c.length-2},N.isNaN=function(){return!this.s},N.isNegative=N.isNeg=function(){return this.s<0},N.isZero=function(){return!!this.c&&0==this.c[0]},N.lessThan=N.lt=function(e,n){return S=6,this.cmp(e,n)<0},N.lessThanOrEqualTo=N.lte=function(e,n){return S=7,-1==(n=this.cmp(e,n))||0===n},N.minus=function(t,r){var i,s,o,l,u=this,f=u.s;if(S=8,t=new e(t,r),r=t.s,!f||!r)return new e(0/0);if(f!=r)return t.s=-r,u.plus(t);var c=u.e/_,h=t.e/_,g=u.c,p=t.c;if(!c||!h){if(!g||!p)return g?(t.s=-r,t):new e(p?u:0/0);if(!g[0]||!p[0])return p[0]?(t.s=-r,t):new e(g[0]?u:3==a?-0:0)}if(i=0|c,c=c>0||c===i?i:i-1,i=0|h,h=h>0||h===i?i:i-1,g=g.slice(),f=c-h){for((l=0>f)?(f=-f,o=g):(h=c,o=p),o.reverse(),r=f;r--;o.push(0));o.reverse()}else for(s=(l=(f=g.length)<(r=p.length))?f:r,f=r=0;s>r;r++)if(g[r]!=p[r]){l=g[r]<p[r];break}if(l&&(o=g,g=p,p=o,t.s=-t.s),r=(s=p.length)-(i=g.length),r>0)for(;r--;g[i++]=0);for(r=F-1;s>f;){if(g[--s]<p[s]){for(i=s;i&&!g[--i];g[i]=r);--g[i],g[s]+=F}g[s]-=p[s]}for(;0==g[0];g.shift(),--h);return g[0]?n(t,g,h):(t.s=3==a?-1:1,t.c=[t.e=0],t)},N.modulo=N.mod=function(n,t){S=9;var r=this,i=r.c,s=(n=new e(n,t)).c,o=r.s,l=n.s;return t=!o||!l||s&&!s[0],t||i&&!i[0]?new e(t?0/0:r):(r.s=n.s=1,t=1==n.cmp(r),r.s=o,n.s=l,t?new e(r):r.minus(D(r,n,0,1).times(n)))},N.negated=N.neg=function(){var n=new e(this);return n.s=-n.s||null,n},N.plus=function(t,r){var i,s=this,o=s.s;if(S=10,t=new e(t,r),r=t.s,!o||!r)return new e(0/0);if(o!=r)return t.s=-r,s.minus(t);var l=s.e/_,u=t.e/_,f=s.c,c=t.c;if(!l||!u){if(!f||!c)return new e(o/0);if(!f[0]||!c[0])return c[0]?t:new e(f[0]?s:0*o)}if(o=0|l,l=l>0||l===o?o:o-1,o=0|u,u=u>0||u===o?o:o-1,f=f.slice(),o=l-u){for(o>0?(u=l,i=c):(o=-o,i=f),i.reverse();o--;i.push(0));i.reverse()}for(o=f.length,r=c.length,0>o-r&&(i=c,c=f,f=i,r=o),o=0;r;)o=(f[--r]=f[r]+c[r]+o)/F|0,f[r]%=F;return o&&(f.unshift(o),++u),n(t,f,u)},N.round=function(n,t){return n=null==n||((O=0>n||n>u)||v(n)!=n)&&!o(n,"decimal places","round")?0:0|n,t=null==t||((O=0>t||t>8)||v(t)!=t&&0!==t)&&!o(t,"mode","round")?a:0|t,l(new e(this),n+this.e+1,t)},N.squareRoot=N.sqrt=function(){var n,r,i,s,o,u=this,f=u.c,h=u.s,g=u.e,p=c+4,m=new e("0.5");if(1!==h||!f||!f[0])return new e(!h||0>h&&(!f||f[0])?0/0:f?u:1/0);if(h=Math.sqrt(+u),0==h||h==1/0?(r=t(f),(r.length+g)%2==0&&(r+="0"),h=Math.sqrt(r),g=E((g+1)/2)-(0>g||g%2),h==1/0?r="1e"+g:(r=h.toExponential(),r=r.slice(0,r.indexOf("e")+1)+g),i=new e(r)):i=new e(h.toString()),i.c[0])for(g=i.e,h=g+p,3>h&&(h=0);;)if(o=i,i=m.times(o.plus(D(u,o,p,1))),t(o.c).slice(0,h)===(r=t(i.c)).slice(0,h)){if(i.e<g&&--h,r=r.slice(h-3,h+1),"9999"!=r&&(s||"4999"!=r)){(!+r||!+r.slice(1)&&"5"==r.charAt(0))&&(l(i,i.e+c+2,1),n=!i.times(i).eq(u));break}if(!s&&(l(o,o.e+c+2,0),o.times(o).eq(u))){i=o;break}p+=4,h+=4,s=1}return l(i,i.e+c+1,a,n)},N.times=function(t,r){var i,s,o,l,u,f,c,a,h,g=this,p=g.c,m=(S=11,t=new e(t,r)).c,d=g.e/_,v=t.e/_,w=g.s;if(t.s=w==(r=t.s)?1:-1,!((d||p&&p[0])&&(v||m&&m[0])))return new e(!w||!r||p&&!p[0]&&!m||m&&!m[0]&&!p?0/0:p&&m?0*t.s:t.s/0);for(s=0|d,s=(d>0||d===s?s:s-1)+(s=0|v,v>0||v===s?s:s-1),w=p.length,r=m.length,r>w&&(u=p,p=m,m=u,v=w,w=r,r=v),v=w+r,u=[];v--;u.push(0));for(d=r;--d>=0;){for(i=0,v=w+d,o=w,a=m[d]%x,h=m[d]/x|0;v>d;)f=p[--o]%x,c=p[o]/x|0,l=h*f+c*a,f=a*f+l%x*x+u[v]+i,i=(f/F|0)+(l/x|0)+h*c,u[v--]=f%F;u[v]=i}return i?++s:u.shift(),n(t,u,s)},N.toExponential=function(e){var n=this;return n.c?s(n,null==e||((O=0>e||e>u)||v(e)!=e&&0!==e)&&!o(e,"decimal places","toExponential")?null:0|e,1):n.toString()},N.toFixed=function(e){var n,t=this,r=h,i=g;return e=null==e||((O=0>e||e>u)||v(e)!=e&&0!==e)&&!o(e,"decimal places","toFixed")?null:t.e+(0|e),h=-(g=1/0),null!=e&&t.c?(n=s(t,e),t.s<0&&t.c&&(t.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace("-",""))):n=t.toString(),h=r,g=i,n},N.toFormat=function(e){var n=this;if(!n.c)return n.toString();var t,r=n.s<0,i=w.groupSeparator,s=+w.groupSize,o=+w.secondaryGroupSize,l=n.toFixed(e).split("."),u=l[0],f=l[1],c=r?u.slice(1):u,a=c.length;if(o&&(t=s,s=o,o=t,a-=t),s>0&&a>0){for(t=a%s||s,u=c.substr(0,t);a>t;t+=s)u+=i+c.substr(t,s);o>0&&(u+=i+c.slice(t)),r&&(u="-"+u)}return f?u+w.decimalSeparator+((o=+w.fractionGroupSize)?f.replace(new RegExp("\\d{"+o+"}\\B","g"),"$&"+w.fractionGroupSeparator):f):u},N.toFraction=function(n){var r,i,s,l,u,f,c,h,g,p=i=new e(I),v=c=new e(I),w=this,N=w.c,b=new e(I);if(!N)return w.toString();for(g=t(N),l=b.e=g.length-w.e-1,b.c[0]=y[(u=l%_)<0?_+u:u],(null==n||(!(S=12,f=new e(n)).s||(O=f.cmp(p)<0||!f.c)||d&&E(f.e/_)<f.c.length-1)&&!o(n,"max denominator","toFraction")||(n=f).cmp(b)>0)&&(n=l>0?b:p),u=m,m=1/0,f=new e(g),c.c[0]=0;h=D(f,b,0,1),s=i.plus(h.times(v)),1!=s.cmp(n);)i=v,v=s,p=c.plus(h.times(s=p)),c=s,b=f.minus(h.times(s=b)),f=s;return s=D(n.minus(i),v,0,1),c=c.plus(s.times(p)),i=i.plus(s.times(v)),c.s=p.s=w.s,l*=2,r=D(p,v,l,a).minus(w).abs().cmp(D(c,i,l,a).minus(w).abs())<1?[p.toString(),v.toString()]:[c.toString(),i.toString()],m=u,r},N.toNumber=function(){var e=this;return+e||(e.s?0*e.s:0/0)},N.toPower=N.pow=function(n){var t=0*n==0?~~n:n,r=new e(this),i=new e(I);if(((O=-f>n||n>f)&&(t=1*n/0)||v(n)!=n&&0!==n&&!(t=0/0))&&!o(n,"exponent","pow")||!t)return new e(Math.pow(+r,t));for(t=0>t?-t:t;1&t&&(i=i.times(r)),t>>=1,t;)r=r.times(r);return 0>n?I.div(i):i},N.toPrecision=function(e){var n=this;return null!=e&&(!(O=1>e||e>u)&&v(e)==e||o(e,"precision","toPrecision"))&&n.c?s(n,0|--e,2):n.toString()},N.toString=function(e){var n,r,l,u=this,f=u.e;if(null===f)r=u.s?"Infinity":"NaN";else{if(e==n&&(h>=f||f>=g))return s(u,n,1);if(r=t(u.c),0>f){for(;++f;r="0"+r);r="0."+r}else if(l=r.length,f>0)if(++f>l)for(f-=l;f--;r+="0");else l>f&&(r=r.slice(0,f)+"."+r.slice(f));else if(n=r.charAt(0),l>1)r=n+"."+r.slice(1);else if("0"==n)return n;if(null!=e)if((O=!(e>=2&&65>e))||e!=~~e&&d)o(e,"base","toS");else if(r=i(r,0|e,10,u.s),"0"==r)return r}return u.s<0?"-"+r:r},N.valueOf=N.toJSON=function(){return this.toString()},e}()}).call(this),"undefined"==typeof Package&&(Package={}),Package["3stack:bignumber"]={BigNumber:n}}(); + +!function(){var e=Package.meteor.Meteor,r;(function(){r={extensions:{}};var e=r.forEach=function(e,r){if("function"==typeof e.forEach)e.forEach(r);else{var n,t=e.length;for(n=0;t>n;n++)r(e[n],n,e)}},n=function(e){return e.replace(/[_-]||\s/g,"").toLowerCase()};r.converter=function(e){var t,a,c,o=0,l=[],i=[];if("undefind"!=typeof module&&"undefined"!=typeof exports&&"undefind"!=typeof require){var u=require("fs");if(u){var p=u.readdirSync((__dirname||".")+"/extensions").filter(function(e){return~e.indexOf(".js")}).map(function(e){return e.replace(/\.js$/,"")});r.forEach(p,function(e){var t=n(e);r.extensions[t]=require("./extensions/"+e)})}}if(this.makeHtml=function(e){return t={},a={},c=[],e=e.replace(/~/g,"~T"),e=e.replace(/\$/g,"~D"),e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n"),e="\n\n"+e+"\n\n",e=D(e),e=e.replace(/^[ \t]+$/gm,""),r.forEach(l,function(r){e=g(r,e)}),e=C(e),e=d(e),e=s(e),e=m(e),e=j(e),e=e.replace(/~D/g,"$$"),e=e.replace(/~T/g,"~"),r.forEach(i,function(r){e=g(r,e)}),e},e&&e.extensions){var f=this;r.forEach(e.extensions,function(e){if("string"==typeof e&&(e=r.extensions[n(e)]),"function"!=typeof e)throw"Extension '"+e+"' could not be loaded. It was either not found or is not a valid extension.";r.forEach(e(f),function(e){e.type?"language"===e.type||"lang"===e.type?l.push(e):("output"===e.type||"html"===e.type)&&i.push(e):i.push(e)})})}var g=function(e,r){if(e.regex){var n=new RegExp(e.regex,"g");return r.replace(n,e.replace)}return e.filter?e.filter(r):void 0},s=function(e){return e+="~0",e=e.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|(?=~0))/gm,function(e,r,n,c,o){return r=r.toLowerCase(),t[r]=A(n),c?c+o:(o&&(a[r]=o.replace(/"/g,""")),"")}),e=e.replace(/~0/,"")},d=function(e){e=e.replace(/\n/g,"\n\n");var r="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del|style|section|header|footer|nav|article|aside",n="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside";return e=e.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,h),e=e.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside)\b[^\r]*?<\/\2>[ \t]*(?=\n+)\n)/gm,h),e=e.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,h),e=e.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,h),e=e.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,h),e=e.replace(/\n\n/g,"\n")},h=function(e,r){var n=r;return n=n.replace(/\n\n/g,"\n"),n=n.replace(/^\n/,""),n=n.replace(/\n+$/g,""),n="\n\n~K"+(c.push(n)-1)+"K\n\n"},m=function(e){e=E(e);var r=q("<hr />");return e=e.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,r),e=e.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,r),e=e.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,r),e=_(e),e=S(e),e=P(e),e=d(e),e=z(e)},v=function(e){return e=K(e),e=$(e),e=B(e),e=x(e),e=w(e),e=M(e),e=A(e),e=L(e),e=e.replace(/ +\n/g," <br />\n")},$=function(e){var r=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;return e=e.replace(r,function(e){var r=e.replace(/(.)<\/?code>(?=.)/g,"$1`");return r=I(r,"\\`*_")})},w=function(e){return e=e.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,k),e=e.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?(?:\(.*?\).*?)?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,k),e=e.replace(/(\[([^\[\]]+)\])()()()()()/g,k)},k=function(e,r,n,c,o,l,i,u){void 0==u&&(u="");var p=r,f=n,g=c.toLowerCase(),s=o,d=u;if(""==s)if(""==g&&(g=f.toLowerCase().replace(/ ?\n/g," ")),s="#"+g,void 0!=t[g])s=t[g],void 0!=a[g]&&(d=a[g]);else{if(!(p.search(/\(\s*\)$/m)>-1))return p;s=""}s=I(s,"*_");var h='<a href="'+s+'"';return""!=d&&(d=d.replace(/"/g,"""),d=I(d,"*_"),h+=' title="'+d+'"'),h+=">"+f+"</a>"},x=function(e){return e=e.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,y),e=e.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,y)},y=function(e,r,n,c,o,l,i,u){var p=r,f=n,g=c.toLowerCase(),s=o,d=u;if(d||(d=""),""==s){if(""==g&&(g=f.toLowerCase().replace(/ ?\n/g," ")),s="#"+g,void 0==t[g])return p;s=t[g],void 0!=a[g]&&(d=a[g])}f=f.replace(/"/g,"""),s=I(s,"*_");var h='<img src="'+s+'" alt="'+f+'"';return d=d.replace(/"/g,"""),d=I(d,"*_"),h+=' title="'+d+'"',h+=" />"},E=function(e){function r(e){return e.replace(/[^\w]/g,"").toLowerCase()}return e=e.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(e,n){return q('<h1 id="'+r(n)+'">'+v(n)+"</h1>")}),e=e.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(e,n){return q('<h2 id="'+r(n)+'">'+v(n)+"</h2>")}),e=e.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(e,n,t){var a=n.length;return q("<h"+a+' id="'+r(t)+'">'+v(t)+"</h"+a+">")})},b,_=function(e){e+="~0";var r=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return o?e=e.replace(r,function(e,r,n){var t=r,a=n.search(/[*+-]/g)>-1?"ul":"ol";t=t.replace(/\n{2,}/g,"\n\n\n");var c=b(t);return c=c.replace(/\s+$/,""),c="<"+a+">"+c+"</"+a+">\n"}):(r=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,e=e.replace(r,function(e,r,n,t){var a=r,c=n,o=t.search(/[*+-]/g)>-1?"ul":"ol",c=c.replace(/\n{2,}/g,"\n\n\n"),l=b(c);return l=a+"<"+o+">\n"+l+"</"+o+">\n"})),e=e.replace(/~0/,"")};b=function(e){return o++,e=e.replace(/\n{2,}$/,"\n"),e+="~0",e=e.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(e,r,n,t,a){var c=a,o=r,l=n;return o||c.search(/\n{2,}/)>-1?c=m(H(c)):(c=_(H(c)),c=c.replace(/\n$/,""),c=v(c)),"<li>"+c+"</li>\n"}),e=e.replace(/~0/g,""),o--,e};var S=function(e){return e+="~0",e=e.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(e,r,n){var t=r,a=n;return t=T(H(t)),t=D(t),t=t.replace(/^\n+/g,""),t=t.replace(/\n+$/g,""),t="<pre><code>"+t+"\n</code></pre>",q(t)+a}),e=e.replace(/~0/,"")},C=function(e){return e+="~0",e=e.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(e,r,n){var t=r,a=n;return a=T(a),a=D(a),a=a.replace(/^\n+/g,""),a=a.replace(/\n+$/g,""),a="<pre><code"+(t?' class="'+t+'"':"")+">"+a+"\n</code></pre>",q(a)}),e=e.replace(/~0/,"")},q=function(e){return e=e.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(c.push(e)-1)+"K\n\n"},K=function(e){return e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,r,n,t,a){var c=t;return c=c.replace(/^([ \t]*)/g,""),c=c.replace(/[ \t]*$/g,""),c=T(c),r+"<code>"+c+"</code>"})},T=function(e){return e=e.replace(/&/g,"&"),e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=I(e,"*_{}[]\\",!1)},L=function(e){return e=e.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>"),e=e.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>")},P=function(e){return e=e.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(e,r){var n=r;return n=n.replace(/^[ \t]*>[ \t]?/gm,"~0"),n=n.replace(/~0/g,""),n=n.replace(/^[ \t]+$/gm,""),n=m(n),n=n.replace(/(^|\n)/g,"$1 "),n=n.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(e,r){var n=r;return n=n.replace(/^ /gm,"~0"),n=n.replace(/~0/g,"")}),q("<blockquote>\n"+n+"\n</blockquote>")})},z=function(e){e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,"");for(var r=e.split(/\n{2,}/g),n=[],t=r.length,a=0;t>a;a++){var o=r[a];o.search(/~K(\d+)K/g)>=0?n.push(o):o.search(/\S/)>=0&&(o=v(o),o=o.replace(/^([ \t]*)/g,"<p>"),o+="</p>",n.push(o))}t=n.length;for(var a=0;t>a;a++)for(;n[a].search(/~K(\d+)K/)>=0;){var l=c[RegExp.$1];l=l.replace(/\$/g,"$$$$"),n[a]=n[a].replace(/~K\d+K/,l)}return n.join("\n\n")},A=function(e){return e=e.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"),e=e.replace(/<(?![a-z\/?\$!])/gi,"<")},B=function(e){return e=e.replace(/\\(\\)/g,O),e=e.replace(/\\([`*_{}\[\]()>#+-.!])/g,O)},M=function(e){return e=e.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>'),e=e.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(e,r){return R(j(r))})},R=function(e){var r=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e="mailto:"+e,e=e.replace(/./g,function(e){if("@"==e)e=r[Math.floor(2*Math.random())](e);else if(":"!=e){var n=Math.random();e=n>.9?r[2](e):n>.45?r[1](e):r[0](e)}return e}),e='<a href="'+e+'">'+e+"</a>",e=e.replace(/">.+:/g,'">')},j=function(e){return e=e.replace(/~E(\d+)E/g,function(e,r){var n=parseInt(r);return String.fromCharCode(n)})},H=function(e){return e=e.replace(/^(\t|[ ]{1,4})/gm,"~0"),e=e.replace(/~0/g,"")},D=function(e){return e=e.replace(/\t(?=\t)/g," "),e=e.replace(/\t/g,"~A~B"),e=e.replace(/~B(.+?)~A/g,function(e,r,n){for(var t=r,a=4-t.length%4,c=0;a>c;c++)t+=" ";return t}),e=e.replace(/~A/g," "),e=e.replace(/~B/g,"")},I=function(e,r,n){var t="(["+r.replace(/([\[\]\\])/g,"\\$1")+"])";n&&(t="\\\\"+t);var a=new RegExp(t,"g");return e=e.replace(a,O)},O=function(e,r){var n=r.charCodeAt(0);return"~E"+n+"E"}},"undefined"!=typeof module&&(module.exports=r),"function"==typeof define&&define.amd&&define("showdown",function(){return r})}).call(this),function(){if(Package.templating){var e=Package.templating.Template,n=Package.blaze.Blaze,t=Package.htmljs.HTML;n.Template.registerHelper("markdown",new e("markdown",function(){var e=this,a="";e.templateContentBlock&&(a=n._toText(e.templateContentBlock,t.TEXTMODE.STRING));var c=new r.converter;return t.Raw(c.makeHtml(a))}))}}.call(this),"undefined"==typeof Package&&(Package={}),Package.markdown={Showdown:r}}(); + +!function(){var e=Package.meteor.Meteor,n;(function(){(function(){function e(e){this._value=e}function n(e,n,i,t){var l=Math.pow(10,n),o,r;return r=(i(e*l)/l).toFixed(n),t&&(o=new RegExp("0{1,"+t+"}$"),r=r.replace(o,"")),r}function i(e,n,i){var t;return t=n.indexOf("$")>-1?l(e,n,i):n.indexOf("%")>-1?o(e,n,i):n.indexOf(":")>-1?r(e,n):a(e._value,n,i)}function t(e,n){var i=n,t,l,o,r,a=["KB","MB","GB","TB","PB","EB","ZB","YB"],d=!1,s;if(n.indexOf(":")>-1)e._value=u(n);else if(n===b)e._value=0;else{for("."!==h[p].delimiters.decimal&&(n=n.replace(/\./g,"").replace(h[p].delimiters.decimal,".")),t=new RegExp("[^a-zA-Z]"+h[p].abbreviations.thousand+"(?:\\)|(\\"+h[p].currency.symbol+")?(?:\\))?)?$"),l=new RegExp("[^a-zA-Z]"+h[p].abbreviations.million+"(?:\\)|(\\"+h[p].currency.symbol+")?(?:\\))?)?$"),o=new RegExp("[^a-zA-Z]"+h[p].abbreviations.billion+"(?:\\)|(\\"+h[p].currency.symbol+")?(?:\\))?)?$"),r=new RegExp("[^a-zA-Z]"+h[p].abbreviations.trillion+"(?:\\)|(\\"+h[p].currency.symbol+")?(?:\\))?)?$"),s=0;s<=a.length&&!(d=n.indexOf(a[s])>-1?Math.pow(1024,s+1):!1);s++);e._value=(d?d:1)*(i.match(t)?Math.pow(10,3):1)*(i.match(l)?Math.pow(10,6):1)*(i.match(o)?Math.pow(10,9):1)*(i.match(r)?Math.pow(10,12):1)*(n.indexOf("%")>-1?.01:1)*((n.split("-").length+Math.min(n.split("(").length-1,n.split(")").length-1))%2?1:-1)*Number(n.replace(/[^0-9\.]+/g,"")),e._value=d?Math.ceil(e._value):e._value}return e._value}function l(e,n,i){var t=n.indexOf("$"),l=n.indexOf("("),o=n.indexOf("-"),r="",u,d;return n.indexOf(" $")>-1?(r=" ",n=n.replace(" $","")):n.indexOf("$ ")>-1?(r=" ",n=n.replace("$ ","")):n=n.replace("$",""),d=a(e._value,n,i),1>=t?d.indexOf("(")>-1||d.indexOf("-")>-1?(d=d.split(""),u=1,(l>t||o>t)&&(u=0),d.splice(u,0,h[p].currency.symbol+r),d=d.join("")):d=h[p].currency.symbol+r+d:d.indexOf(")")>-1?(d=d.split(""),d.splice(-1,0,r+h[p].currency.symbol),d=d.join("")):d=d+r+h[p].currency.symbol,d}function o(e,n,i){var t="",l,o=100*e._value;return n.indexOf(" %")>-1?(t=" ",n=n.replace(" %","")):n=n.replace("%",""),l=a(o,n,i),l.indexOf(")")>-1?(l=l.split(""),l.splice(-1,0,t+"%"),l=l.join("")):l=l+t+"%",l}function r(e){var n=Math.floor(e._value/60/60),i=Math.floor((e._value-60*n*60)/60),t=Math.round(e._value-60*n*60-60*i);return n+":"+(10>i?"0"+i:i)+":"+(10>t?"0"+t:t)}function u(e){var n=e.split(":"),i=0;return 3===n.length?(i+=60*Number(n[0])*60,i+=60*Number(n[1]),i+=Number(n[2])):2===n.length&&(i+=60*Number(n[0]),i+=Number(n[1])),Number(i)}function a(e,i,t){var l=!1,o=!1,r=!1,u="",a=!1,d=!1,s=!1,m=!1,c=!1,f="",g="",y=Math.abs(e),v=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],w,x,M,O,_,k,$="",B=!1;if(0===e&&null!==b)return b;if(i.indexOf("(")>-1?(l=!0,i=i.slice(1,-1)):i.indexOf("+")>-1&&(o=!0,i=i.replace(/\+/g,"")),i.indexOf("a")>-1&&(a=i.indexOf("aK")>=0,d=i.indexOf("aM")>=0,s=i.indexOf("aB")>=0,m=i.indexOf("aT")>=0,c=a||d||s||m,i.indexOf(" a")>-1?(u=" ",i=i.replace(" a","")):i=i.replace("a",""),y>=Math.pow(10,12)&&!c||m?(u+=h[p].abbreviations.trillion,e/=Math.pow(10,12)):y<Math.pow(10,12)&&y>=Math.pow(10,9)&&!c||s?(u+=h[p].abbreviations.billion,e/=Math.pow(10,9)):y<Math.pow(10,9)&&y>=Math.pow(10,6)&&!c||d?(u+=h[p].abbreviations.million,e/=Math.pow(10,6)):(y<Math.pow(10,6)&&y>=Math.pow(10,3)&&!c||a)&&(u+=h[p].abbreviations.thousand,e/=Math.pow(10,3))),i.indexOf("b")>-1)for(i.indexOf(" b")>-1?(f=" ",i=i.replace(" b","")):i=i.replace("b",""),M=0;M<=v.length;M++)if(w=Math.pow(1024,M),x=Math.pow(1024,M+1),e>=w&&x>e){f+=v[M],w>0&&(e/=w);break}return i.indexOf("o")>-1&&(i.indexOf(" o")>-1?(g=" ",i=i.replace(" o","")):i=i.replace("o",""),g+=h[p].ordinal(e)),i.indexOf("[.]")>-1&&(r=!0,i=i.replace("[.]",".")),O=e.toString().split(".")[0],_=i.split(".")[1],k=i.indexOf(","),_?(_.indexOf("[")>-1?(_=_.replace("]",""),_=_.split("["),$=n(e,_[0].length+_[1].length,t,_[1].length)):$=n(e,_.length,t),O=$.split(".")[0],$=$.split(".")[1].length?h[p].delimiters.decimal+$.split(".")[1]:"",r&&0===Number($.slice(1))&&($="")):O=n(e,null,t),O.indexOf("-")>-1&&(O=O.slice(1),B=!0),k>-1&&(O=O.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+h[p].delimiters.thousands)),0===i.indexOf(".")&&(O=""),(l&&B?"(":"")+(!l&&B?"-":"")+(!B&&o?"+":"")+O+$+(g?g:"")+(u?u:"")+(f?f:"")+(l&&B?")":"")}function d(e,n){h[e]=n}function s(e){var n=e.toString().split(".");return n.length<2?1:Math.pow(10,n[1].length)}function m(){var e=Array.prototype.slice.call(arguments);return e.reduce(function(e,n){var i=s(e),t=s(n);return i>t?i:t},-1/0)}var c,f="1.5.3",h={},p="en",b=null,g="0,0",y="undefined"!=typeof module&&module.exports;c=function(n){return c.isNumeral(n)?n=n.value():0===n||"undefined"==typeof n?n=0:Number(n)||(n=c.fn.unformat(n)),new e(Number(n))},c.version=f,c.isNumeral=function(n){return n instanceof e},c.language=function(e,n){if(!e)return p;if(e=e.toLowerCase(),e&&!n){if(!h[e])throw new Error("Unknown language : "+e);p=e}return(n||!h[e])&&d(e,n),c},c.languageData=function(e){if(!e)return h[p];if(!h[e])throw new Error("Unknown language : "+e);return h[e]},c.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){var n=e%10;return 1===~~(e%100/10)?"th":1===n?"st":2===n?"nd":3===n?"rd":"th"},currency:{symbol:"$"}}),c.zeroFormat=function(e){b="string"==typeof e?e:null},c.defaultFormat=function(e){g="string"==typeof e?e:"0.0"},c.validate=function(e,n){var i,t,l,o,r,u,a,d;if("string"!=typeof e&&(e+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",e)),e=e.trim(),e.match(/^\d+$/))return!0;if(""===e)return!1;try{a=c.languageData(n)}catch(s){a=c.languageData(c.language())}return l=a.currency.symbol,r=a.abbreviations,i=a.delimiters.decimal,t="."===a.delimiters.thousands?"\\.":a.delimiters.thousands,d=e.match(/^[^\d]+/),null!==d&&(e=e.substr(1),d[0]!==l)?!1:(d=e.match(/[^\d]+$/),null!==d&&(e=e.slice(0,-1),d[0]!==r.thousand&&d[0]!==r.million&&d[0]!==r.billion&&d[0]!==r.trillion)?!1:(u=new RegExp(t+"{2}"),e.match(/[^\d.,]/g)?!1:(o=e.split(i),o.length>2?!1:o.length<2?!!o[0].match(/^\d+.*\d$/)&&!o[0].match(u):1===o[0].length?!!o[0].match(/^\d+$/)&&!o[0].match(u)&&!!o[1].match(/^\d+$/):!!o[0].match(/^\d+.*\d$/)&&!o[0].match(u)&&!!o[1].match(/^\d+$/))))},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(e,n){"use strict";if(null===this||"undefined"==typeof this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof e)throw new TypeError(e+" is not a function");var i,t,l=this.length>>>0,o=!1;for(1<arguments.length&&(t=n,o=!0),i=0;l>i;++i)this.hasOwnProperty(i)&&(o?t=e(t,this[i],i,this):(t=this[i],o=!0));if(!o)throw new TypeError("Reduce of empty array with no initial value");return t}),c.fn=e.prototype={clone:function(){return c(this)},format:function(e,n){return i(this,e?e:g,void 0!==n?n:Math.round)},unformat:function(e){return"[object Number]"===Object.prototype.toString.call(e)?e:t(this,e?e:g)},value:function(){return this._value},valueOf:function(){return this._value},set:function(e){return this._value=Number(e),this},add:function(e){function n(e,n,t,l){return e+i*n}var i=m.call(null,this._value,e);return this._value=[this._value,e].reduce(n,0)/i,this},subtract:function(e){function n(e,n,t,l){return e-i*n}var i=m.call(null,this._value,e);return this._value=[e].reduce(n,this._value*i)/i,this},multiply:function(e){function n(e,n,i,t){var l=m(e,n);return e*l*n*l/(l*l)}return this._value=[this._value,e].reduce(n,1),this},divide:function(e){function n(e,n,i,t){var l=m(e,n);return e*l/(n*l)}return this._value=[this._value,e].reduce(n),this},difference:function(e){return Math.abs(c(this._value).subtract(e).value())}},y&&(module.exports=c),"undefined"==typeof ender&&(this.numeral=c),"function"==typeof define&&define.amd&&define([],function(){return c})}).call(this)}).call(this),function(){!function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"k",million:" mln",billion:" mld",trillion:" bln"},ordinal:function(e){var n=e%100;return 0!==e&&1>=n||8===n||n>=20?"ste":"de"},currency:{symbol:"€ "}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("be-nl",e)}(),function(){var e={delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"千",million:"百万",billion:"十亿",trillion:"兆"},ordinal:function(){return"."},currency:{symbol:"¥"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("chs",e)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"tis.",million:"mil.",billion:"b",trillion:"t"},ordinal:function(){return"."},currency:{symbol:"Kč"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("cs",e)}(),function(){var e={delimiters:{thousands:".",decimal:","},abbreviations:{thousand:"k",million:"mio",billion:"mia",trillion:"b"},ordinal:function(){return"."},currency:{symbol:"DKK"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("da-dk",e)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(){return"."},currency:{symbol:"CHF"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("de-ch",e)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(){return"."},currency:{symbol:"€"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("de",e)}(),function(){var e={delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){var n=e%10;return 1===~~(e%100/10)?"th":1===n?"st":2===n?"nd":3===n?"rd":"th"},currency:{symbol:"£"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("en-gb",e)}(),function(){var e={delimiters:{thousands:".",decimal:","},abbreviations:{thousand:"k",million:"mm",billion:"b",trillion:"t"},ordinal:function(e){var n=e%10;return 1===n||3===n?"er":2===n?"do":7===n||0===n?"mo":8===n?"vo":9===n?"no":"to"},currency:{symbol:"€"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("es",e)}(),function(){var e={delimiters:{thousands:".",decimal:","},abbreviations:{thousand:"k",million:"mm",billion:"b",trillion:"t"},ordinal:function(e){var n=e%10;return 1===n||3===n?"er":2===n?"do":7===n||0===n?"mo":8===n?"vo":9===n?"no":"to"},currency:{symbol:"$"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("es",e)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:" tuh",million:" mln",billion:" mld",trillion:" trl"},ordinal:function(){return"."},currency:{symbol:"€"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("et",e)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"k",million:"M",billion:"G",trillion:"T"},ordinal:function(){return"."},currency:{symbol:"€"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("fi",e)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"k",million:"M",billion:"G",trillion:"T"},ordinal:function(e){return 1===e?"er":"e"},currency:{symbol:"$"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("fr-CA",e)}(),function(){var e={delimiters:{thousands:"'",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){return 1===e?"er":"e"},currency:{symbol:"CHF"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("fr-ch",e)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){return 1===e?"er":"e"},currency:{symbol:"€"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("fr",e)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"E",million:"M",billion:"Mrd",trillion:"T"},ordinal:function(){return"."},currency:{symbol:" Ft"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("hu",e)}(),function(){var e={delimiters:{thousands:".",decimal:","},abbreviations:{thousand:"mila",million:"mil",billion:"b",trillion:"t"},ordinal:function(){return"º"},currency:{symbol:"€"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("it",e)}(),function(){var e={delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"千",million:"百万",billion:"十億",trillion:"兆"},ordinal:function(){return"."},currency:{symbol:"¥"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("ja",e)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:" tūkst.",million:" milj.",billion:" mljrd.",trillion:" trilj."},ordinal:function(){return"."},currency:{symbol:"€"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("lv",e)}(),function(){var e={delimiters:{thousands:".",decimal:","},abbreviations:{thousand:"k",million:"mln",billion:"mrd",trillion:"bln"},ordinal:function(e){var n=e%100;return 0!==e&&1>=n||8===n||n>=20?"ste":"de"},currency:{symbol:"€ "}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("nl-nl",e)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"tys.",million:"mln",billion:"mld",trillion:"bln"},ordinal:function(){return"."},currency:{symbol:"PLN"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("pl",e)}(),function(){var e={delimiters:{thousands:".",decimal:","},abbreviations:{thousand:"mil",million:"milhões",billion:"b",trillion:"t"},ordinal:function(){return"º"},currency:{symbol:"R$"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("pt-br",e)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(){return"º"},currency:{symbol:"€"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("pt-pt",e)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"тыс.",million:"млн",billion:"b",trillion:"t"},ordinal:function(){return"."},currency:{symbol:"₴"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("ru-UA",e)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"тыс.",million:"млн",billion:"b",trillion:"t"},ordinal:function(){return"."},currency:{symbol:"руб."}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("ru",e)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"tis.",million:"mil.",billion:"b",trillion:"t"},ordinal:function(){return"."},currency:{symbol:"€"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("sk",e)}(),function(){var e={delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"พัน",million:"ล้าน",billion:"พันล้าน",trillion:"ล้านล้าน"},ordinal:function(){return"."},currency:{symbol:"฿"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("th",e)}(),function(){var e={1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"},n={delimiters:{thousands:".",decimal:","},abbreviations:{thousand:"bin",million:"milyon",billion:"milyar",trillion:"trilyon"},ordinal:function(n){if(0===n)return"'ıncı";var i=n%10,t=n%100-i,l=n>=100?100:null;return e[i]||e[t]||e[l]},currency:{symbol:"₺"}};"undefined"!=typeof module&&module.exports&&(module.exports=n),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("tr",n)}(),function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"тис.",million:"млн",billion:"млрд",trillion:"блн"},ordinal:function(){return""},currency:{symbol:"₴"}};"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("uk-UA",e)}()}.call(this),function(){e.isClient&&(n=window.numeral,delete window.numeral),e.isServer&&(n=Npm.require("numeral"))}.call(this),"undefined"==typeof Package&&(Package={}),Package["numeral:numeral"]={numeral:n}}(); + +!function(){var e=Package.meteor.Meteor,a=Package["3stack:bignumber"].BigNumber,i;(function(){i={},i.fromWei=function(e,i){if(!e)return e;switch("string"==typeof e&&0===e.indexOf("0x")&&(e=web3.toDecimal(e)),e instanceof a||(e=new a(e.toString())),i=i.toLowerCase()){case"kwei":case"ada":e=e.dividedBy(1e3);break;case"mwei":case"babbage":e=e.dividedBy(1e6);break;case"gwei":case"schannon":e=e.dividedBy(1e9);break;case"szabo":e=e.dividedBy(1e12);break;case"finney":e=e.dividedBy(1e15);break;case"ether":e=e.dividedBy(1e18);break;case"kether":case"grand":case"einstein":e=e.dividedBy(1e21);break;case"mether":e=e.dividedBy(1e24);break;case"gether":e=e.dividedBy(1e27);break;case"tether":e=e.dividedBy(1e30)}return e.toNumber()},i.toWei=function(e,i){if(!e)return e;switch("string"==typeof e&&0===e.indexOf("0x")&&(e=web3.toDecimal(e)),e instanceof a||(e=new a(e.toString())),i=i.toLowerCase()){case"kwei":case"ada":e=e.times(1e3);break;case"mwei":case"babbage":e=e.times(1e6);break;case"gwei":case"schannon":e=e.times(1e9);break;case"szabo":e=e.times(1e12);break;case"finney":e=e.times(1e15);break;case"ether":e=e.times(1e18);break;case"kether":case"grand":case"einstein":e=e.times(1e21);break;case"mether":e=e.times(1e24);break;case"gether":e=e.times(1e27);break;case"tether":e=e.times(1e30)}return e.toNumber()},i.isAddress=function(e){return 0===e.indexOf("0x")&&42!=e.length?!1:-1===e.indexOf("0x")&&40!=e.length?!1:/^\w+$/.test(e)}}).call(this),"undefined"==typeof Package&&(Package={}),Package["ethereum:tools"]={EthTools:i}}(); + +!function(){var e=Package.meteor.Meteor;(function(){!function(){function e(e){c=0;for(var t=0;t<e.length;t+=2){var r=e.charCodeAt(t)<<8|e.charCodeAt(t+1);c^=r}}function t(){var e=(Math.sin(c++)+1)/2,t=1e4*e;return e=t-Math.floor(t)}function r(){var e=Math.floor(360*t()),r=50*t()+50+"%",a=60*t()+20+"%",n="hsl("+e+","+r+","+a+")";return n}function a(e){for(var r=e,a=e,n=Math.ceil(r/2),o=r-n,c=[],i=0;a>i;i++){for(var l=[],f=0;n>f;f++)l[f]=t()>=.5;var h=l.slice(0,o);h.reverse(),l=l.concat(h);for(var s=0;s<l.length;s++)c.push(l[s])}return c}function n(e,t,r,a){var n=document.createElement("canvas"),o=Math.sqrt(e.length);n.width=n.height=o*r;var c=n.getContext("2d");c.fillStyle=a,c.fillRect(0,0,n.width,n.height),c.fillStyle=t;for(var i=0;i<e.length;i++){var l=Math.floor(i/o),f=i%o;e[i]&&c.fillRect(f*r,l*r,r,r)}return n}function o(t){t=t||{};var o=t.size||10,c=t.scale||5,i=t.seed||Math.random().toString(36).substr(2),l=t.bgcolor||"#fff";e(i);var f=t.color||r(),h=a(o),s=n(h,f,c,l);return s}var c=0;window.blockies={create:o}}()}).call(this),function(){"use strict";Package.templating&&Package.templating.Template.registerHelper("identicon",function(e,t){return t=t&&t.hash||{},e&&(t.seed=e),blockies.create(t).toDataURL()})}.call(this),"undefined"==typeof Package&&(Package={}),Package["mistereo:identicon"]={}}(); + +!function(){var e=Package.meteor.Meteor,a=Package.underscore._,n=Package.jquery.$,t=Package.jquery.jQuery,c=Package.templating.Template,o=Package["ethereum:tools"].EthTools,r=Package["frozeman:template-var"].TemplateVar,u=Package.blaze.Blaze,l=Package.blaze.UI,s=Package.blaze.Handlebars,i=Package.htmljs.HTML;(function(){c.__checkName("dapp_identicon"),c.dapp_identicon=new c("Template.dapp_identicon",function(){var e=this;return u.If(function(){return Spacebars.call(e.lookup("identity"))},function(){return["\n ",i.A({href:function(){return Spacebars.mustache(e.lookup("pathFor"),Spacebars.kw({route:"userProfile",userId:e.lookup("identity")}))},"class":function(){return["dapp-identicon ",Spacebars.mustache(e.lookup("class"))]},style:function(){return["background-image: url('",Spacebars.mustache(e.lookup("identicon"),e.lookup("identity"),Spacebars.kw({size:8,scale:8,bgcolor:"#424343"})),"')"]}}),"\n "]})})}).call(this),function(){c.dapp_identicon.helpers({})}.call(this),function(){c.__checkName("dapp_addressInput"),c.dapp_addressInput=new c("Template.dapp_addressInput",function(){var e=this;return i.DIV({"class":"dapp-address-input"},"\n ",i.INPUT({type:"text",name:"to",placeholder:function(){return Spacebars.mustache(e.lookup("placeholder"))},"class":function(){return[Spacebars.mustache(e.lookup("class"))," ",u.Unless(function(){return Spacebars.call(e.lookup("isValid"))},function(){return"dapp-error"})]},autofocus:"true",value:function(){return Spacebars.mustache(e.lookup("value"))}}),"\n ",u.If(function(){return Spacebars.call(e.lookup("isValid"))},function(){return["\n ",u._TemplateWith(function(){return{identity:Spacebars.call(e.lookup("address")),"class":Spacebars.call("dapp-small")}},function(){return Spacebars.include(e.lookupTemplate("dapp_identicon"))}),"\n "]},function(){return["\n ",i.I({"class":"icon-shield"}),"\n "]}),"\n ")})}.call(this),function(){c.dapp_addressInput.created=function(){r.set("isValid",!0),this.data.value&&r.set("address",this.data.value)},c.dapp_addressInput.helpers({address:function(){var e=r.get("address");return a.isString(e)?e.replace("0x",""):""},isValid:function(){return r.get("isValid")}}),c.dapp_addressInput.events({'input input[name="to"], change input[name="to"]':function(e){o.isAddress(e.currentTarget.value)||a.isEmpty(e.currentTarget.value)?r.set("isValid",!0):r.set("isValid",!1),r.set("address",e.currentTarget.value)},"click a":function(e){e.preventDefault()}})}.call(this),function(){c.__checkName("dapp_modal"),c.dapp_modal=new c("Template.dapp_modal",function(){var e=this;return Spacebars.include(e.lookupTemplate("Animate"),function(){return["\n ",i.DIV({"class":"dapp-modal-overlay animate"},"\n ",i.SECTION({"class":"dapp-modal-container"},"\n ",u.If(function(){return Spacebars.call(e.lookup("yield"))},function(){return["\n ",u._TemplateWith(function(){return{region:Spacebars.call("modalContent")}},function(){return Spacebars.include(e.lookupTemplate("yield"))}),"\n "]}),"\n "),"\n "),"\n "]})})}.call(this),function(){c.dapp_modal.created=function(){n("body").addClass("disable-scroll blur")},c.dapp_modal.destroyed=function(){n("body").removeClass("disable-scroll blur")},c.dapp_modal.events({"click .dapp-modal-overlay":function(e){n(e.target).hasClass("dapp-modal-overlay")&&"undefined"!=typeof Router&&(this.closePath?Router.go(this.closePath):Router.current().render(null,{to:"modal"}))}})}.call(this),function(){c.__checkName("dapp_modal_question"),c.dapp_modal_question=new c("Template.dapp_modal_question",function(){var e=this;return[i.P(u.View(function(){return Spacebars.mustache(e.lookup("text"))})),"\n ",i.DIV({"class":"dapp-modal-buttons"},"\n ",u.If(function(){return Spacebars.call(e.lookup("hasCancel"))},function(){return["\n ",i.BUTTON({"class":"cancel"},u.View(function(){return Spacebars.mustache(e.lookup("i18nText"),"cancel")})),"\n "]}),"\n ",u.If(function(){return Spacebars.call(e.lookup("hasOk"))},function(){return["\n ",i.BUTTON({"class":"ok dapp-primary-button"},u.View(function(){return Spacebars.mustache(e.lookup("i18nText"),"ok")})),"\n "]}),"\n ")]})}.call(this),function(){c.dapp_modal_question.helpers({hasOk:function(){return this.ok},hasCancel:function(){return this.cancel},i18nText:function(e){return"undefined"==typeof TAPi18n?"ok"===e?"OK":"Cancel":TAPi18n.__("buttons."+e)}}),c.dapp_modal_question.events({"click button.ok":function(e){a.isFunction(this.ok)&&this.ok(),Router.current().render(null,{to:"modal"})},"click button.cancel":function(e){a.isFunction(this.cancel)&&this.cancel(),Router.current().render(null,{to:"modal"})}})}.call(this),"undefined"==typeof Package&&(Package={}),Package["ethereum:elements"]={}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.underscore._,n=Package.ejson.EJSON,r;(function(){if(Package["cmather:iron-core"])throw new Error("\n\n Sorry! The cmather:iron-{x} packages were migrated to the new package system with the wrong name, and you have duplicate copies.\n You can see which cmather:iron-{x} packages have been installed by using this command:\n\n > meteor list\n\n Can you remove any installed cmather:iron-{x} packages like this: \n\n > meteor remove cmather:iron-core\n > meteor remove cmather:iron-router\n > meteor remove cmather:iron-dynamic-template\n > meteor remove cmather:iron-dynamic-layout\n \n The new packages are named iron:{x}. For example:\n\n > meteor add iron:router\n\n Sorry for the hassle, but thank you! \n\n ")}).call(this),function(){r={},r.utils={},r.utils.assert=function(e,t){if(!e)throw new Error(t)},r.utils.warn=function(e,t){e||console&&console.warn&&console.warn(t)},r.utils.defaultValue=function(e,t,n){return"undefined"==typeof e[t]?(e[t]=n,n):e[t]},r.utils.inherits=function(e,o,i){r.utils.assert("undefined"!=typeof e,"Child is undefined in inherits function"),r.utils.assert("undefined"!=typeof o,"Parent is undefined in inherits function");for(var a in o)t.has(o,a)&&(e[a]=n.clone(o[a]));var s=function(){this.constructor=e};return s.prototype=o.prototype,e.prototype=new s,e.__super__=o.prototype,t.isObject(i)&&t.extend(e.prototype,i),e},r.utils.extend=function(e,n){n=n||{};var o=function(){var e;e=t.has(n,"constructor")?n.constructor:o.__super__.constructor,e.apply(this,arguments)};return r.utils.inherits(o,e,n)},r.utils.global=function(){return e.isClient?window:global}(),r.utils.namespace=function(e,t){var n=r.utils.global,o,i,a,s;r.utils.assert("string"==typeof e,"namespace must be a string"),o=e.split("."),a=o.pop(),s=n;for(var u=0;u<o.length;u++)i=o[u],s=s[i]=s[i]||{};return 2===arguments.length?(s[a]=t,t):s[a]},r.utils.resolve=function(e){var t=r.utils.global,n,o;if("string"==typeof e){n=e.split("."),o=t;for(var i=0;i<n.length;i++)if(o=o[n[i]],!o)return void 0}else o=e;return o},r.utils.capitalize=function(e){return e.charAt(0).toUpperCase()+e.slice(1,e.length)},r.utils.classCase=function(e){var n=/_|-|\.|\//;return e?t.map(e.split(n),function(e){return r.utils.capitalize(e)}).join(""):""},r.utils.camelCase=function(e){var t=r.utils.classCase(e);return t=t.charAt(0).toLowerCase()+t.slice(1,t.length)},r.utils.notifyDeprecated=function(e){var n,r,o,i,a="[:where] ':name' is deprecated. Please use ':instead' instead.";t.isObject(e)?(n=e.name,r=e.instead,o=e.message||a,i=e.where||"IronRouter"):(o=e,n="",r="",i=""),"undefined"!=typeof console&&console.warn&&console.warn("<deprecated> "+o.replace(":name",n).replace(":instead",r).replace(":where",i)+" "+(new Error).stack)},r.utils.withDeprecatedNotice=function(e,t,n){return function(){return Utils.notifyDeprecated(e),t&&t.apply(n||this,arguments)}},Function.prototype.deprecate=function(e){var t=this;return r.utils.withDeprecatedNotice(e,t)},r.utils.debug=function(e){return r.utils.assert("string"==typeof e,"debug requires a package name"),function n(){if(console&&console.log&&r.debug===!0){var n=t.toArray(arguments).join(" ");console.log("%c<"+e+"> %c"+n,"color: #999;","color: #000;")}}},r.utils.get=function(e){for(var t=1;t<arguments.length;t++){if(!(e&&arguments[t]in e))return void 0;e=e[arguments[t]]}return e},r.utils.global.Iron=r}.call(this),"undefined"==typeof Package&&(Package={}),Package["iron:core"]={Iron:r}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.ui.Blaze,n=Package.ui.UI,a=Package.ui.Handlebars,r=Package.underscore._,i=Package.jquery.$,o=Package.jquery.jQuery,s=Package.tracker.Tracker,u=Package.tracker.Deps,c=Package["reactive-var"].ReactiveVar,l=Package.templating.Template,p=Package.random.Random,h=Package["iron:core"].Iron,d=Package.htmljs.HTML,m;(function(){if(Package["cmather:iron-dynamic-template"])throw new Error("\n\n Sorry! The cmather:iron-{x} packages were migrated to the new package system with the wrong name, and you have duplicate copies.\n You can see which cmather:iron-{x} packages have been installed by using this command:\n\n > meteor list\n\n Can you remove any installed cmather:iron-{x} packages like this: \n\n > meteor remove cmather:iron-core\n > meteor remove cmather:iron-router\n > meteor remove cmather:iron-dynamic-template\n > meteor remove cmather:iron-dynamic-layout\n \n The new packages are named iron:{x}. For example:\n\n > meteor add iron:router\n\n Sorry for the hassle, but thank you! \n\n ")}).call(this),function(){l.__checkName("__DynamicTemplateError__"),l.__DynamicTemplateError__=new l("Template.__DynamicTemplateError__",function(){var e=this;return d.DIV({style:"margin: 0 auto; color: red;"},"\n ",t.View(function(){return Spacebars.mustache(e.lookup("msg"))}),"\n ")})}.call(this),function(){var e=h.utils.debug("iron:dynamic-template"),a=h.utils.assert,o=h.utils.get,d=h.utils.camelCase,f=function(e){return Object.prototype.toString.call(e)};m=function(e){this._id=p.id(),this.options=e=e||{},this._template=e.template,this._defaultTemplate=e.defaultTemplate,this._content=e.content,this._data=e.data,this._templateDep=new s.Dependency,this._dataDep=new s.Dependency,this._lookupHostDep=new s.Dependency,this._lookupHostValue=null,this._hooks={},this._eventMap=null,this._eventHandles=null,this._eventThisArg=null,this.name=e.name||this.constructor.prototype.name||"DynamicTemplate",this.isCreated=!1,this.isDestroyed=!1},m.prototype.template=function(e){if(1===arguments.length&&e!==this._template)return this._template=e,void this._templateDep.changed();if(!(arguments.length>0))return this._templateDep.depend(),this._template?"function"==typeof this._template?this._template():this._template:this._defaultTemplate?"function"==typeof this._defaultTemplate?this._defaultTemplate():this._defaultTemplate:void 0},m.prototype.defaultTemplate=function(e){return 1!==arguments.length?this._defaultTemplate:void(this._defaultTemplate=e)},m.prototype.clear=function(){this._template=void 0,this._data=void 0,this._templateDep.changed()},m.prototype.data=function(e){return 1===arguments.length&&e!==this._data?(this._data=e,void this._dataDep.changed()):(this._dataDep.depend(),"function"==typeof this._data?this._data():this._data)},m.prototype.create=function(e){var n=this;if(this.isCreated)throw new Error("DynamicTemplate view is already created");this.isCreated=!0,this.isDestroyed=!1;var a=c(null),i=t.View("DynamicTemplate",function(){var e=this,r=a.get();return t.With(function(){var t=n.data();return"undefined"!=typeof t?t:m.getParentDataContext(e)},function(){return n.renderView(r)})});return i.onViewCreated(function(){this.autorun(function(){a.set(n.template())})}),r.each(["onViewCreated","onViewReady","_onViewRendered","onViewDestroyed"],function(e){i[e](function(){n._runHooks(e,this)})}),i._onViewRendered(function(){n.isInserted=!0,1===i.renderCount&&n._attachEvents()}),i.onViewDestroyed(function(){n._detachEvents()}),i._templateInstance=new t.TemplateInstance(i),i.templateInstance=function(){var e=i._templateInstance;return e.data=t.getData(i),i._domrange&&!i.isDestroyed?(e.firstNode=i._domrange.firstNode(),e.lastNode=i._domrange.lastNode()):(e.firstNode=null,e.lastNode=null),e},this.view=i,i.__dynamicTemplate__=this,i.name=this.name,i},m.prototype.renderView=function(e){var n=this,a=null;return"string"==typeof e?(a=l[e],a||(a=l[d(e)]),a||(a=t.With({msg:"Couldn't find a template named "+JSON.stringify(e)+" or "+JSON.stringify(d(e))+". Are you sure you defined it?"},function(){return l.__DynamicTemplateError__}))):"[object Object]"===f(e)?a=e:"undefined"!=typeof n._content&&(a=n._content),a},m.prototype.destroy=function(){this.isCreated&&(t.remove(this.view),this.view=null,this.isDestroyed=!0,this.isCreated=!1)},r.each(["onViewCreated","onViewReady","_onViewRendered","onViewDestroyed"],function(e){m.prototype[e]=function(t){var n=this._hooks[e]=this._hooks[e]||[];return n.push(t),this}}),m.prototype._runHooks=function(e,t){for(var n=this._hooks[e]||[],a,r=0;r<n.length;r++)a=n[r],a.call(t,this)},m.prototype.events=function(e,n){var a=this;this._detachEvents(),this._eventThisArg=n;var r=this._eventMap={};for(var i in e)r[i]=function(e,r){return function(e){var i=t.getData(e.currentTarget);null==i&&(i={});var o=a.view.templateInstance();return r.call(n||this,e,o,i)}}(i,e[i]);this._attachEvents()},m.prototype._attachEvents=function(){var e=this,n=e._eventThisArg,a=e._eventMap,i=e.view,o=e._eventHandles;if(i){var s=i._domrange;if(!s)throw new Error("no domrange");var u=function(n,s){r.each(a,function(a,u){var c=u.split(/,\s+/);r.each(c,function(r){var u=r.split(/\s+/);if(0!==u.length){var c=u.shift(),l=u.join(" ");o.push(t._EventSupport.listen(s,c,l,function(r){if(!n.containsElement(r.currentTarget))return null;var o=e._eventThisArg||this,s=arguments;return t._withCurrentView(i,function(){return a.apply(o,s)})},n,function(e){return e.parentRange}))}})})};s.attached?u(s,s.parentElement):s.onAttached(u)}},m.prototype._detachEvents=function(){r.each(this._eventHandles,function(e){e.stop()}),this._eventHandles=[]};var _=function(e,n,a,i){r.each(a,function(a,o){var s=o.split(/,\s+/);r.each(s,function(r){var o=r.split(/\s+/);if(0!==o.length){var s=o.shift(),u=o.join(" ");handles.push(t._EventSupport.listen(n,s,u,function(n){if(!e.containsElement(n.currentTarget))return null;var r=i||this,o=arguments;return t._withCurrentView(view,function(){return a.apply(r,o)})},e,function(e){return e.parentRange}))}})})};m.prototype.insert=function(e){if(e=e||{},!this.isInserted){this.isInserted=!0;var n=e.el||document.body,a=i(n);if(0===a.length)throw new Error("No element to insert layout into. Is your element defined? Try a Meteor.startup callback.");return this.view||this.create(e),t.render(this.view,a[0],e.nextNode,e.parentView),this}},m.prototype._getLookupHost=function(){return this._lookupHostValue},m.prototype._setLookupHost=function(e){var t=this;return t._lookupHostValue!==e&&(t._lookupHostValue=e,u.afterFlush(function(){t._lookupHostDep.changed()})),this},m.getParentDataContext=function(e){return m.getDataContext(e&&e.parentView)},m.getDataContext=function(e){for(;e;){if("with"===e.name&&!e.__isTemplateWith)return e.dataVar.get();e=e.parentView}return null},m.getInclusionArguments=function(e){var t=e&&e.parentView;return t&&t.__isTemplateWith?t.dataVar.get():null},m.args=function(e){return function(t){var n=m.getInclusionArguments(e);return n?t?n[t]:n:null}},m.extend=function(e){return h.utils.extend(this,e)},m.findFirstLookupHost=function(e){var n,r;for(a(e instanceof t.View,"view must be a Blaze.View");e;)if(e.__dynamicTemplate__){var n=e.__dynamicTemplate__._getLookupHost();if(n)return n}else e=e.parentView;return void 0},m.findLookupHostWithProperty=function(e,n){var r,i;for(a(e instanceof t.View,"view must be a Blaze.View");e;){if(e.__dynamicTemplate__){var r=e.__dynamicTemplate__._getLookupHost();if(r&&o(r,n))return r}e=e.parentView}return void 0},m.findLookupHostWithHelper=function(e,n){var r,i;for(a(e instanceof t.View,"view must be a Blaze.View");e;){if(e.__dynamicTemplate__){var r=e.__dynamicTemplate__._getLookupHost();if(r&&o(r,"constructor","_helpers",n))return r}e=e.parentView}return void 0},"undefined"!=typeof l&&n.registerHelper("DynamicTemplate",new l("DynamicTemplateHelper",function(){var e=m.args(this);return new m({data:function(){return e("data")},template:function(){return e("template")},content:this.templateContentBlock}).create()})),h.DynamicTemplate=m}.call(this),function(){var e=h.utils.assert,n=h.utils.get,a=t.View.prototype.lookup;t.View.prototype.lookup=function(e){var r;return r=m.findLookupHostWithHelper(t.getView(),e),r?function i(){var t=n(r,"constructor","_helpers",e),a=[].slice.call(arguments);return"function"==typeof t?t.apply(r,a):t}:a.apply(this,arguments)}}.call(this),"undefined"==typeof Package&&(Package={}),Package["iron:dynamic-template"]={}}(); + +!function(){var e=Package.meteor.Meteor,n=Package.templating.Template,t=Package.blaze.Blaze,r=Package.blaze.UI,o=Package.blaze.Handlebars,i=Package.underscore._,a=Package["iron:core"].Iron,s=Package.htmljs.HTML,c,u,h;(function(){var e=[];if(Package["cmather:iron-layout"]&&e.push("\n\n The cmather:iron-{x} packages were migrated to the new package system with the wrong name, and you have duplicate copies.\n You can see which cmather:iron-{x} packages have been installed by using this command:\n\n > meteor list\n\n Can you remove any installed cmather:iron-{x} packages like this: \n\n > meteor remove cmather:iron-core\n > meteor remove cmather:iron-router\n > meteor remove cmather:iron-dynamic-template\n > meteor remove cmather:iron-dynamic-layout\n \n The new packages are named iron:{x}. For example:\n\n > meteor add iron:router\n\n Sorry for the hassle, but thank you! \n\n "),Package["cmather:blaze-layout"]&&e.push("The blaze-layout package has been replaced by iron-layout. Please remove the package like this:\n> meteor remove cmather:blaze-layout\n"),e.length>0)throw new Error("Sorry! Looks like there's a few errors related to iron:layout\n\n"+e.join("\n\n"))}).call(this),function(){n.__checkName("__IronDefaultLayout__"),n.__IronDefaultLayout__=new n("Template.__IronDefaultLayout__",function(){var e=this;return Spacebars.include(e.lookupTemplate("yield"))})}.call(this),function(){var e=a.DynamicTemplate,o=a.utils.inherits;c=function(e){for(;e;){if("Iron.Layout"===e.name)return e.__dynamicTemplate__;e=e.parentView}return null},u=function(e){var n=this;u.__super__.constructor.apply(this,arguments),e=e||{},this.name="Iron.Layout",this._regions={},this._regionHooks={},this.defaultTemplate("__IronDefaultLayout__"),e.content&&this.render(e.content)},h=u.DEFAULT_REGION="main",o(u,a.DynamicTemplate),u.prototype.region=function(e,n){return this._ensureRegion(e,n)},u.prototype.destroyRegions=function(){i.each(this._regions,function(e){e.destroy()}),this._regions={}},u.prototype.render=function(e,n){n=n||{};var t=n.to||n.region||h,r=this.region(t);return this._trackRenderedRegion(t),r.template(e),r.data(n.data),r},u.prototype.has=function(e){return e=e||u.DEFAULT_REGION,!!this._regions[e]},u.prototype.regionKeys=function(){return i.keys(this._regions)},u.prototype.clear=function(e){return e=e||u.DEFAULT_REGION,this.has(e)&&this.region(e).template(null),this},u.prototype.clearAll=function(){return i.each(this._regions,function(e){e.template(null)}),this},u.prototype.beginRendering=function(e){var n=this;if(this._finishRenderingTransaction&&this._finishRenderingTransaction(),this._finishRenderingTransaction=i.once(function(){var t=n._endRendering({flush:!1});e&&e(t)}),Deps.afterFlush(this._finishRenderingTransaction),this._renderedRegions)throw new Error("You called beginRendering again before calling endRendering");this._renderedRegions={}},u.prototype._trackRenderedRegion=function(e){this._renderedRegions&&(this._renderedRegions[e]=!0)},u.prototype._endRendering=function(e){e=e||{},e.flush!==!1&&Deps.flush();var n=this._renderedRegions||{};return this._renderedRegions=null,i.keys(n)},i.each(["onRegionCreated","onRegionRendered","onRegionDestroyed"],function(e){u.prototype[e]=function(n){var t=this._regionHooks[e]=this._regionHooks[e]||[];return t.push(n),this}}),u.prototype._ensureRegion=function(e,n){return this._regions[e]=this._regions[e]||this._createDynamicTemplate(e,n)},u.prototype._createDynamicTemplate=function(e,n){var t=this,r=new a.DynamicTemplate(n),o=a.utils.capitalize;return r._region=e,i.each(["viewCreated","viewReady","viewDestroyed"],function(e){e=o(e),r["on"+e](function(n){var r=this,o={viewCreated:"regionCreated",viewReady:"regionRendered",viewDestroyed:"regionDestroyed"}[e];t._runRegionHooks("on"+o,r,n)})}),r},u.prototype._runRegionHooks=function(e,n,t){for(var r=this,o=this._regionHooks[e]||[],i,a=0;a<o.length;a++)i=o[a],i.call(n,t.region,t,this)},"undefined"!=typeof n&&(r.registerHelper("yield",new n("yield",function(){var n=c(this);if(!n)throw new Error("No Iron.Layout found so you can't use yield!");var t=e.getInclusionArguments(this),r,o;return i.isString(t)?r=t:i.isObject(t)&&(r=t.region),r=r||h,o=n.region(r),o.isCreated&&o.destroy(),o.create()})),r.registerHelper("contentFor",new n("contentFor",function(){var n=c(this);if(!n)throw new Error("No Iron.Layout found so you can't use contentFor!");var t=e.getInclusionArguments(this)||{},r=this.templateContentBlock,o=t.template,a=t.data,s;if(i.isString(t))s=t;else{if(!i.isObject(t))throw new Error("Which region is this contentFor block supposed to be for?");s=t.region}return n.region(s).template(o||r),n._trackRenderedRegion(s),a&&n.region(s).data(a),null})),r.registerHelper("hasRegion",function(e){var n=c(t.getView());if(!n)throw new Error("No Iron.Layout found so you can't use hasRegion!");if(!i.isString(e))throw new Error("You need to provide an region argument to hasRegion");return!!n.region(e).template()}),r.registerHelper("Layout",new n("layout",function(){var e=a.DynamicTemplate.args(this),n=new u({template:function(){return e("template")},data:function(){return e("data")},content:this.templateContentBlock});return n.create()}))),a.Layout=u}.call(this),"undefined"==typeof Package&&(Package={}),Package["iron:layout"]={}}(); + +!function(){var e=Package.meteor.Meteor,r=Package.underscore._,n=Package["iron:core"].Iron,t,i;(function(){function e(e){return e.replace(/([=!:$\/()])/g,"\\$1")}function r(t,a,s){a&&"[object Array]"!==n(a)&&(s=a,a=null),a=a||[],s=s||{};var c=s.strict,u=s.end!==!1,p=s.sensitive?"":"i",h=0;if(t instanceof RegExp){var l=t.source.match(/\((?!\?)/g)||[];return a.push.apply(a,l.map(function(e,r){return{name:r,delimiter:null,optional:!1,repeat:!1}})),o(t,a)}if("[object Array]"===n(t))return t=t.map(function(e){return r(e,a,s).source}),o(new RegExp("(?:"+t.join("|")+")",p),a);t=t.replace(i,function(r,n,t,i,o,s,c,u){if(n)return n;if(u)return"\\"+u;var p="+"===c||"*"===c,l="?"===c||"*"===c;return a.push({name:i||h++,delimiter:t||"/",optional:l,repeat:p}),t=t?"\\"+t:"",o=e(o||s||"[^"+(t||"\\/")+"]+?"),p&&(o=o+"(?:"+t+o+")*"),l?"(?:"+t+"("+o+"))?":t+"("+o+")"});var f="/"===t[t.length-1];return c||(t=(f?t.slice(0,-2):t)+"(?:\\/(?=$))?"),u||(t+=c&&f?"":"(?=\\/|$)"),o(new RegExp("^"+t+(u?"$":""),p),a)}var n=function(e){return Object.prototype.toString.call(e)},i=new RegExp(["(\\\\.)","([\\/.])?(?:\\:(\\w+)(?:\\(((?:\\\\.|[^)])*)\\))?|\\(((?:\\\\.|[^)])*)\\))([+*?])?","([.+*?=^!:${}()[\\]|\\/])"].join("|"),"g"),o=function(e,r){return e.keys=r,e};t=r}).call(this),function(){function e(e){try{return decodeURIComponent(e).replace(/\+/g," ")}catch(r){return void(r.constructor==URIError&&a("Tried to decode an invalid URI component: "+JSON.stringify(e)+" "+r.stack))}}function o(e){try{return decodeURI(e).replace(/\+/g," ")}catch(r){return void(r.constructor==URIError&&a("Tried to decode an invalid URI: "+JSON.stringify(e)+" "+r.stack))}}var a=n.utils.warn;i=function(e,n){n=n||{},this.options=n,this.keys=[],this.regexp=t(e,this.keys,n),this._originalPath=e,r.extend(this,i.parse(e))},i.normalize=function(e){if(e instanceof RegExp)return e;if("string"!=typeof e)return"/";var r=i.parse(e),n=r.pathname;return"/"!==n.charAt(0)&&(n="/"+n),n.length>1&&"/"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1)),n},i.isSameOrigin=function(e,r){var n=i.parse(e),t=i.parse(r),o=n.origin===t.origin;return o},i.fromQueryString=function(n){if(!n)return{};if("string"!=typeof n)throw new Error("expected string");"?"===n.charAt(0)&&(n=n.slice(1));var t=n.split("&"),i={},o;return r.each(t,function(r){var n=r.split("="),t=n[0],o=e(n[1]);"[]"===t.slice(-2)?(t=t.slice(0,-2),i[t]=i[t]||[],i[t].push(o)):i[t]=o}),i},i.toQueryString=function(e){var n=[];return"string"==typeof e?"?"!==e.charAt(0)?"?"+e:e:(r.each(e,function(e,t){r.isArray(e)?r.each(e,function(e){n.push(encodeURIComponent(t+"[]")+"="+encodeURIComponent(e))}):n.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}),n.length>0?"?"+n.join("&"):"")},i.parse=function(e){if("string"!=typeof e)return{};var r=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,n=e.match(r),t=n[1]?n[1].toLowerCase():void 0,o=n[3],a=!!o,s=n[4]?n[4].toLowerCase():void 0,c=s?s.split("@"):[],u,p;2==c.length?(p=c[0],u=c[1]):1==c.length?(u=c[0],p=void 0):(u=void 0,p=void 0);var h=u&&u.split(":")||[],l=h[0],f=h[1],g=t&&u?t+"//"+u:void 0,d=n[5],m=n[8],y=e,v=n[6],w,R=m&&m.indexOf("?")||-1;~R&&!v?(v=m.slice(R),m=m.substr(0,R),w=v.slice(1)):w=n[7];var x=d+(v||""),U=i.fromQueryString(w),S=[t||"",a?"//":"",s||""].join(""),I=[t||"",a?"//":"",s||"",d||"",v||"",m||""].join("");return{rootUrl:S||"",originalUrl:e||"",href:I||"",protocol:t||"",auth:p||"",host:u||"",hostname:l||"",port:f||"",origin:g||"",path:x||"",pathname:d||"",search:v||"",query:w||"",queryObject:U||"",hash:m||"",slashes:a}},i.prototype.test=function(e){return this.regexp.test(i.normalize(e))},i.prototype.exec=function(e){return this.regexp.exec(i.normalize(e))},i.prototype.params=function(r){if(!r)return[];var n=[],t=this.exec(r),a,s=this.keys,c,u;if(!t)throw new Error('The route named "'+this.name+'" does not match the path "'+r+'"');for(var p=1,h=t.length;h>p;++p)c=s[p-1],u="string"==typeof t[p]?e(t[p]):t[p],c?n[c.name]=void 0!==n[c.name]?n[c.name]:u:n.push(u);return r=o(r),"undefined"!=typeof r&&(a=r.split("?")[1],a&&(a=a.split("#")[0]),n.hash=r.split("#")[1]||null,n.query=i.fromQueryString(a)),n},i.prototype.resolve=function(e,n){var t,o,a,s=0,c=this._originalPath,u,p,h=[],l=e;if(n=n||{},e=e||[],p=n.query,u=n.hash&&n.hash.toString(),c instanceof RegExp)throw new Error("Cannot currently resolve a regular expression path");if(c=c.replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,function(n,i,a,s,c,u,p){if(i=i||"",t=e[s],o="undefined"!=typeof t,u&&!o)t="";else if(!o)return void h.push(s);t=r.isFunction(t)?t.call(e):t;var l=r.map(String(t).split("/"),function(e){return encodeURIComponent(e)}).join("/");return i+l}).replace(/\*/g,function(n){if("undefined"==typeof e[s])throw new Error("You are trying to access a wild card parameter at index "+s+" but the value of params at that index is undefined");var t=String(e[s++]);return r.map(t.split("/"),function(e){return encodeURIComponent(e)}).join("/")}),p=i.toQueryString(p),c+=p,u&&(u=encodeURI(u.replace("#","")),c=c+"#"+u),c=c.replace(/\/+/g,"/"),c=c.replace(/^(.+)\/$/g,"$1"),0==h.length)return c;if(n.throwOnMissingParams===!0)throw new Error("Missing required parameters on path "+JSON.stringify(this._originalPath)+". The missing params are: "+JSON.stringify(h)+". The params object passed in was: "+JSON.stringify(l)+".");return null},n.Url=i}.call(this),"undefined"==typeof Package&&(Package={}),Package["iron:url"]={}}(); + +!function(){var t=Package.meteor.Meteor,e=Package.underscore._,n=Package["iron:core"].Iron,r,i,n;(function(){var t=n.Url;r=function(n,r,i){e.isFunction(n)&&(i=i||r||{},r=n,n="/",this.middleware=!0,"undefined"==typeof i.mount&&(i.mount=!0)),"object"==typeof r&&(i=r,r=i.action||"action"),i=i||{},this.options=i,this.mount=i.mount,this.method=i.method&&i.method.toLowerCase()||!1,this.where=i.where||"client",this.mount&&(i.end=!1),i.name?this.name=i.name:"string"==typeof n&&"/"!==n.charAt(0)?this.name=n:r&&r.name?this.name=r.name:"string"==typeof n&&"/"!==n&&(this.name=n.split("/").slice(1).join(".")),n=i.path||n,"string"==typeof n&&"/"!==n.charAt(0)&&(n="/"+n),this.path=n,this.compiledUrl=new t(n,i),e.isString(r)?this.handle=function o(){var t=this[r];if("function"!=typeof t)throw new Error("No method named "+JSON.stringify(r)+" found on handler.");return t.apply(this,arguments)}:e.isFunction(r)&&(this.handle=r)},r.prototype.test=function(t,e){e=e||{};var n=this.compiledUrl.test(t),r=!0,i=!0;return this.method&&e.method&&(r=this.method==e.method.toLowerCase()),e.where&&(i=this.where==e.where),n&&r&&i},r.prototype.params=function(t){return this.compiledUrl.params(t)},r.prototype.resolve=function(t,e){return this.compiledUrl.resolve(t,e)},r.prototype.clone=function(){var t=new r(this.path,this.handle,this.options);return t.name=this.name,t}}).call(this),function(){var o=n.Url,a=n.utils.assert,s=n.utils.defaultValue;i=function(){this._stack=[],this.length=0},i.prototype._create=function(t,n,i){var o=new r(t,n,i),a=o.name;if(a){if(e.has(this._stack,a))throw new Error("Handler with name '"+a+"' already exists.");this._stack[a]=o}return o},i.prototype.findByName=function(t){return this._stack[t]},i.prototype.push=function(t,e,n){var r=this._create(t,e,n);return this._stack.push(r),this.length++,r},i.prototype.append=function(){var t=this,n=e.toArray(arguments),r={};return"object"==typeof n[n.length-1]&&(r=n.pop()),e.each(n,function(n){if("undefined"!=typeof n)if("function"==typeof n)t.push(n,r);else{if(!e.isArray(n))throw new Error("Can only append functions or arrays to the MiddlewareStack");t.append.apply(t,n.concat([r]))}}),this},i.prototype.insertAt=function(t,e,n,r){var i=this._create(e,n,r);return this._stack.splice(t,0,i),this.length=this._stack.length,this},i.prototype.insertBefore=function(t,n,r,i){var o,a;if(!(o=this._stack[t]))throw new Error("Couldn't find a handler named '"+t+"' on the path stack");return a=e.indexOf(this._stack,o),this.insertAt(a,n,r,i),this},i.prototype.insertAfter=function(t,n,r,i){var o,a;if(!(o=this._stack[t]))throw new Error("Couldn't find a handler named '"+t+"' on the path stack");return a=e.indexOf(this._stack,o),this.insertAt(a+1,n,r,i),this},i.prototype.concat=function(){var t=new i,n=Array.prototype.concat,r=EJSON.clone(this._stack),o=e.map(e.toArray(arguments),function(t){return EJSON.clone(t._stack)});return t._stack=n.apply(r,o),this.length=t._stack.length,t},i.prototype.dispatch=function h(e,n,r){var i=this,h=e;a("string"==typeof e,"Requires url"),a("object"==typeof n,"Requires context object"),e=o.normalize(e||"/"),s(n,"request",{}),s(n,"response",{}),s(n,"originalUrl",e),s(n,"_method",n.method),s(n,"_handlersForEnv",{client:!1,server:!1}),s(n,"_handled",!1),s(n,"isHandled",function(){return n._handled}),s(n,"willBeHandledOnClient",function(){return n._handlersForEnv.client}),s(n,"willBeHandledOnServer",function(){return n._handlersForEnv.server});var l=function(){if(r)try{r.apply(this,arguments)}catch(t){throw t._punt=!0,t}},c=0,u=t.bindEnvironment(function p(r){var a=i._stack[c++];if(n.url=n.request.url=n.originalUrl,!a)return l.call(n,r);if(!a.test(e,{method:n._method}))return u(r);var s=t.isClient?"client":"server";if(a.middleware||(n._handlersForEnv[a.where]=!0),a.where!==s)return u(r);if(n.next=u,a.mount){var h=o.normalize(a.compiledUrl.pathname),p=e.substr(h.length,e.length);p=o.normalize(p),n.url=n.request.url=p}try{var d=a.handle.length,f=n.request,m=n.response;return r&&4===d?a.handle.call(n,r,f,m,u):!r&&4>d?a.handle.call(n,f,m,u):u(r)}catch(r){if(r._punt)throw r;u(r)}finally{n._handled=!0,n.next=null}});return u(),n.next=null,n},n=n||{},n.MiddlewareStack=i}.call(this),"undefined"==typeof Package&&(Package={}),Package["iron:middleware-stack"]={Handler:r}}(); + +!function(){var t=Package.meteor.Meteor,e=Package.underscore._,n=Package.tracker.Tracker,a=Package.tracker.Deps,r=Package.jquery.$,o=Package.jquery.jQuery,i=Package["iron:core"].Iron,c,s,h,u,l;(function(){var t=i.Url,n="__hash__";c=function(e){var a=t.parse(e),r=a.hash&&a.hash.replace("#",""),o=a.search,i=a.pathname,c=a.rootUrl;if(r&&"!"!==r.charAt(0)){var s=n+"="+r;o=o?o+"&":"?",o+=s,r=""}return!r&&i?r="#!"+i.substring(1):r&&(r="#"+r),[c,r,o].join("")},s=function(a){var r=t.parse(a),o=r.hash&&r.hash.replace("#!","/"),i=r.search,c=r.rootUrl,s;return e.has(r.queryObject,n)?(s="#"+r.queryObject[n],delete r.queryObject[n]):s="",[c,o,t.toQueryString(r.queryObject),s].join("")},h=function(e){var a=t.parse(e),r=a.queryObject;return a.hash&&(r[n]=a.hash.replace("#","")),["!",a.pathname.substring(1),t.toQueryString(r)].join("")}}).call(this),function(){var t=i.Url;u=function(n,a){e.extend(this,t.parse(n),{options:a||{}})},u.prototype.equals=function(t){return t&&t instanceof u&&t.pathname==this.pathname&&t.search==this.search&&t.hash==this.hash&&t.options.historyState===this.options.historyState?!0:!1},u.prototype.isCancelled=function(){return!!this._isCancelled},u.prototype.cancelUrlChange=function(){this._isCancelled=!0}}.call(this),function(){var n=i.Url,o=null,f=new a.Dependency,p={go:[],popState:[]},y=function(){return/MSIE 9/.test(navigator.appVersion)},g=function(){return/MSIE 8/.test(navigator.appVersion)},d=function(){return!!Package.appcache},S=function(){return"undefined"==typeof history||"function"!=typeof history.pushState},v=function(){return l.options.useHashPaths||g()||y()||d()||S()},k=function(){return!!l.options.useHashPaths},w=function(t,n){e.each(p[t],function(t){t.call(n)})},P=function(t){if(!(t instanceof u))throw new Error("Expected a State instance");return t.equals(o)?!1:(o=t,f.changed(),!0)},m=function(){var t=location.href,e;e=k()?new u(s(t)):new u(t,{historyState:history.state}),w("popState",e),P(e)},j=function(t){var e=q;e&&e(t)},_=function(t,e){e=e||{};var n=new u(t,e);w("go",n),P(n)&&a.afterFlush(function(){n.isCancelled()||(k()?location.hash=h(t):e.replaceState===!0?history.replaceState(e.historyState,null,t):history.pushState(e.historyState,null,t))})},q=function(t){try{var e=t.currentTarget,a=e.href,r=e.pathname+e.search+e.hash;if(r=r.replace(/(^\/?)/,"/"),t.isDefaultPrevented())return void t.preventDefault();if(t.metaKey||t.ctrlKey||t.shiftKey)return;if(e.target)return;if(!n.isSameOrigin(a,location.href))return;t.preventDefault(),_(r)}catch(o){throw t.preventDefault(),o}};l={},l.options={linkSelector:"a[href]",useHashPaths:!1},l.configure=function(t){e.extend(this.options,t||{})},l.get=function(){return f.depend(),o},l.start=function(){if(!this._isStarted){var e=n.parse(location.href);if(v()){if(e.pathname.length>1){var a=c(location.href);window.location=a}this.configure({useHashPaths:!0})}var o=location.href;if(k()){var i=new u(s(o));P(i)}else{if("!"===e.hash.replace("#","")[0])var o=s(o);var h={initial:!0};history.replaceState(h,null,o);var i=new u(o,{historyState:h});P(i)}r(window).on("popstate.iron-location",m),r(window).on("hashchange.iron-location",m),t.startup(function(){r(document).on("click.iron-location",l.options.linkSelector,j)}),this._isStarted=!0}},l.stop=function(){this._isStarted&&(r(window).on("popstate.iron-location"),r(window).on("hashchange.iron-location"),r(document).off("click.iron-location"),this._isStarted=!1)},l.onClick=function(t){q=t},l.go=function(t,e){return _(t,e)},l.onGo=function(t){p.go.push(t)},l.onPopState=function(t){p.popState.push(t)},l.start(),i.Location=l}.call(this),"undefined"==typeof Package&&(Package={}),Package["iron:location"]={urlToHashStyle:c,urlFromHashStyle:s}}(); + +!function(){var t=Package.meteor.Meteor,n=Package.underscore._,e=Package.tracker.Tracker,o=Package.tracker.Deps,a=Package["reactive-dict"].ReactiveDict,r=Package.templating.Template,i=Package["iron:core"].Iron,u=Package.blaze.Blaze,s=Package.blaze.UI,c=Package.blaze.Handlebars,l=Package.htmljs.HTML,p,d;(function(){var t=i.utils.assert,e=function(){for(var t={},n=o.currentComputation;n;)t[String(n._id)]=!0,n=n._parent;return t},a=function(o){var a=e(),r=n.keys(o._dependentsById);r.forEach(function(n){t(!a[n],"\n\nYou called wait() after calling ready() inside the same computation tree.\n\nYou can fix this problem in two possible ways:\n\n1) Put all of your wait() calls before any ready() calls.\n2) Put your ready() call in its own computation with Deps.autorun.")})};p=function(){this._readyDep=new o.Dependency,this._comps=[],this._notReadyCount=0},p.prototype.wait=function(t){var e=this,r=o.currentComputation;a(e._readyDep),o.nonreactive(function(){var a=null,i=o.autorun(function(n){var o=!!t(),r=e._notReadyCount;n.firstRun&&!o?e._notReadyCount++:null!==a&&o!==a&&o===!0?e._notReadyCount--:null!==a&&o!==a&&o===!1&&e._notReadyCount++,a=o,0===r&&e._notReadyCount>0?e._readyDep.changed():r>0&&0===e._notReadyCount&&e._readyDep.changed()});e._comps.push(i),r&&r.onInvalidate(function(){o.afterFlush(function(){i.stop(),e._comps.splice(n.indexOf(e._comps,i),1),a===!1&&(e._notReadyCount--,0===e._notReadyCount&&e._readyDep.changed())})})})},p.prototype.ready=function(){return this._readyDep.depend(),0===this._notReadyCount},p.prototype.stop=function(){n.each(this._comps,function(t){t.stop()}),this._comps=[]},i.WaitList=p}).call(this),function(){var t=i.utils.debug("iron:controller"),e=i.Layout,o=i.DynamicTemplate,a=function(t,n){return function(){return"function"==typeof t?t.apply(n,arguments):t}};d=function(t){var n=this;this.options=t||{},this._layout=this.options.layout||new e(this.options),this._isController=!0,this._layout._setLookupHost(this);var o=d._collectEventMaps.call(this.constructor);this._layout.events(o,this),this.init(t)},d.prototype.layout=function(t,e){var o=this;return this._layout.template(t),e&&n.has(e,"data")&&this._layout.data(a(e.data,this)),{data:function(t){return o._layout.data(a(t,o))}}},d.prototype.render=function(t,n){var e=this;n&&"undefined"!=typeof n.data&&(n.data=a(n.data,this));var o=this._layout.render(t,n);return{data:function(t){return o.data(a(t,e))}}},d.prototype.beginRendering=function(t){return this._layout.beginRendering(t)},d.extend=function(t){return i.utils.extend(this,t)},d.events=function(t){return this._eventMap=t,this};var s=function(t,e){var o={};return t.__super__&&n.extend(o,s(t.__super__.constructor,e)),n.has(t,e)?n.extend(o,t[e]):o};d._collectEventMaps=function(){return s(this,"_eventMap")},d._helpers={},d.helpers=function(t){return n.extend(this._helpers,t),this},"undefined"!=typeof r&&(i.controller=function(){return o.findLookupHostWithProperty(u.getView(),"_isController")},r.registerHelper("get",function(t){var n=i.controller();return n&&n.state?n.state.get(t):void 0})),i.Controller=d}.call(this),function(){var t=i.Layout,e=i.utils.debug("iron:controller"),o=i.utils.defaultValue,r=function(t,n){return function(){return"function"==typeof t?t.apply(n,arguments):t}};d.prototype.init=function(t){this._waitlist=new p,this.state=new a},d.prototype.insert=function(t){return this._layout.insert.apply(this._layout,arguments)},d.prototype.wait=function(t){var e=this;if(t)return n.isArray(t)?n.each(t,function o(t){e.wait(t)}):this._waitlist.wait(t.ready?function(){return t.ready()}:t),this},d.prototype.ready=function(){return this._waitlist.ready()},d.prototype.stop=function(){this._waitlist.stop()}}.call(this),"undefined"==typeof Package&&(Package={}),Package["iron:controller"]={}}(); + +!function(){var t=Package.underscore._,e=Package.tracker.Tracker,o=Package.tracker.Deps,r=Package.blaze.Blaze,n=Package.blaze.UI,i=Package.blaze.Handlebars,a=Package.templating.Template,u=Package.ejson.EJSON,s=Package.meteor.Meteor,l=Package["iron:core"].Iron,p=Package.htmljs.HTML,c,h,f,d,y,m;(function(){f=new s.EnvironmentVariable}).call(this),function(){d=["get","post","put","delete"]}.call(this),function(){var e=l.Controller,o=l.Url,r=l.MiddlewareStack,n=l.utils.assert;h=e.extend({constructor:function(e){h.__super__.constructor.apply(this,arguments),e=e||{},this.options=e,this._onStopCallbacks=[],this.route=e.route,this.params=[];var o=this.lookupOption("data");"function"==typeof o?this.data=t.bind(o,this):"undefined"!=typeof o&&(this.data=function(){return o}),this.init(e)}}),h.prototype.lookupOption=function(e){if(this.route&&this.route.options&&t.has(this.route.options,e))return this.route.options[e];if(t.has(this.options,e))return this.options[e];if("undefined"!=typeof this[e])return this[e];var o=f.get();return o&&t.has(o,e)?o[e]:this.router&&this.router.options&&t.has(this.router.options,e)?this.router.options[e]:void 0},h.prototype.configureFromUrl=function(t,e,o){n("string"==typeof t,"url must be a string"),e=e||{},this.request=e.request||{},this.response=e.response||{},this.url=e.url||t,this.originalUrl=e.originalUrl||t,this.method=this.request.method,this.route&&this.setParams(this.route.params(t),o)},h.prototype._collectHooks=function(){var e=this,o=t.toArray(arguments),r=function(o){if(!o)return[];var r=e.router.lookupHook,n=t.isArray(o)?o:[o];return t.map(n,function(t){return r(t)})},n=function(e,o){var i=[];return e.__super__&&(i=i.concat(n(e.__super__.constructor,o))),t.has(e.prototype,o)?i.concat(r(e.prototype[o])):i},i=function(t){for(var e=0;e<o.length;e++)t(o[e])},a=[];i(function(t){var o=e.route&&e.route.getName(),r=e.router.getHooks(t,o);a=a.concat(r)});var u=[];i(function(t){var o=n(e.constructor,t);u=u.concat(o)});var s=[];i(function(o){if(t.has(e,o)){var n=r(e[o]);s=s.concat(n)}});var l=[];e.route&&i(function(t){var o=r(e.route.options[t]);l=l.concat(o)});var p=a.concat(l).concat(u).concat(s);return p},h.prototype.runHooks=function(){for(var t=this._collectHooks.apply(this,arguments),e=0,o=t.length;o>e;e++){var r=t[e];r.call(this)}return t.length},h.prototype.getParams=function(){return this.params},h.prototype.setParams=function(t){return this.params=t,this},l.RouteController=h}.call(this),function(){var r=l.Controller,n=l.Url,i=l.MiddlewareStack,a=l.utils.debug("iron-router:RouteController");if(h.prototype.init=function(t){h.__super__.init.apply(this,arguments),this._computation=null,this._paramsDep=new e.Dependency,this.location=l.Location},h.prototype.getParams=function(){return this._paramsDep.depend(),this.params},h.prototype.setParams=function(e,o){var r=function(e,r){if(!(e instanceof Array))throw new Error("you called equals with a non array value in setParams");if(!(r instanceof Array))return!1;if(e.length!==r.length)return!1;for(var n=0;n<e.length;n++)if(!u.equals(e[n],r[n],o))return!1;var i=t.keys(e),a=t.keys(r),s;if(i.length!==a.length)return!1;for(var n=0;n<i.length;n++){if(s=i[n],!t.has(r,s))return!1;if(!u.equals(e[s],r[s]))return!1}return!0};if(!r(this.params,e))return this.params=e,o=o||{},o.reactive!==!1&&this._paramsDep.changed(),this},h.prototype.dispatch=function(t,e,r){if(this._computation&&!this._computation.stopped)throw new Error("RouteController computation is already running. Stop it first.");var n=this;return o.nonreactive(function(){o.autorun(function(o){n._computation=o,t.dispatch(e,n,r)})}),n},h.prototype._runRoute=function(e,r,n){var a=this,u=this._collectHooks("subscriptions");t.each(u,function(t){a.wait(t.call(a))});var s=this._collectHooks("waitOn");t.each(s,function(t){a.wait(t.call(a))});var p=s.length>0,c,f,d=function(){return o.nonreactive(function(){return a._layout.template()})},y=function(){return o.nonreactive(function(){var t=a._layout._regions.main;return t&&t.template()})},m=d(),_=y();this.beginRendering(function R(e){if(!a.isStopped){var o=d(),r=y();if(m!==o||_!=r){var n=a._layout.regionKeys(),i=t.difference(n,e);t.each(i,function(t){a._layout.clear(t)})}}}),this.layout(this.lookupOption("layoutTemplate"),{data:this.lookupOption("data")});var g=new i,v=new i,k=new i;v.append(this._collectHooks("onRun","load"),{where:"client"}),k.append(this._collectHooks("onRerun"),{where:"client"}),g.append(function b(t,e,o){this._computation.firstRun&&!h._hasJustReloaded?(h._hasJustReloaded=!1,v.length>0?v.dispatch(t.url,this,o):o()):o()},function C(t,e,o){this._computation.firstRun?o():k.length>0?k.dispatch(t.url,this,o):o()},{where:"client"}),p&&g.push(t.bind(l.Router.hooks.loading,a));var w=this._collectHooks("onBeforeAction","before");g.append(w,{where:"client"}),0===e._actionStack.length&&e._actionStack.push(e._path,"action",e.options),g=g.concat(e._actionStack),this._rendered=!1,g.dispatch(r,this,n),o.afterFlush(function(){l.utils.warn(a._rendered||a.isStopped,"Route dispatch never rendered. Did you forget to call this.next() in an onBeforeAction?")}),this.runHooks("onAfterAction","after")},h.prototype.action=function(){this.render()},h.prototype.lookupTemplate=function(){return this.lookupOption("template")||this.router&&this.router.toTemplateName(this.route.getName())},h.prototype.lookupRegionTemplates=function(){return this.lookupOption("yieldRegions")||this.lookupOption("regionTemplates")||this.lookupOption("yieldTemplates")||{}},h.prototype.render=function(t,e){if(this._rendered=!0,0===arguments.length){var t=this.lookupTemplate(),o=h.__super__.render.call(this,t);return this.renderRegions(),o}return h.__super__.render.call(this,t,e)},h.prototype.renderRegions=function(){var e=this,o=this.lookupRegionTemplates();a("regionTemplates: "+JSON.stringify(o)),t.each(o,function(t,o){e.render(o,t)})},h.prototype.stop=function(){h.__super__.stop.call(this),this._computation&&this._computation.stop(),this.runHooks("onStop","unload"),this.isStopped=!0},h.prototype.redirect=function(){return this.router.go.apply(this.router,arguments)},h.prototype.subscribe=function(){var e=this,o=s.subscribe.apply(this,arguments);return t.extend(o,{wait:function(){e.wait(this)}})},s._reload){s._reload.onMigrate("iron-router",function(){return[!0,!0]});var p=s._reload.migrationData("iron-router");h._hasJustReloaded=p}}.call(this),function(){var e=l.Url,o=l.MiddlewareStack,r=l.utils.assert;y=function(e,r,n){var i=function(t,e,o){var r=this;r.request=t,r.response=e,i.dispatch(t.url,r,o)};return"object"==typeof r&&(n=r,r=n.action),n=n||{},"string"==typeof e&&"/"!==e.charAt(0)&&(e=n.path?n.path:"/"+e),t.extend(i,this),n=i.options=n||{},i._actionStack=new o,i._beforeStack=new o,i._beforeStack.append(i.options.onBeforeAction),i._beforeStack.append(i.options.before),i._afterStack=new o,i._afterStack.append(i.options.onAfterAction),i._afterStack.append(i.options.after),i._methods={},"string"==typeof r?i._actionStack.push(e,t.extend(n,{template:r})):("function"==typeof r||"object"==typeof r)&&i._actionStack.push(e,r,n),i._path=e,i},y.prototype.getName=function(){return this.handler&&this.handler.name},y.prototype.findControllerConstructor=function(){var t=this,e=function(t,e){e=e||{};var o=l.utils.resolve(t);if(o&&h.prototype.isPrototypeOf(o.prototype))return o;if(e.supressErrors!==!0)throw new Error("RouteController '"+t+"' is not defined.");return void 0},o=function(e){return t.router.toControllerName(e)},r,n=this.getName();return"function"==typeof this.options.controller?this.options.controller:"string"==typeof this.options.controller?e(this.options.controller):n&&(r=e(o(n),{supressErrors:!0}))?r:h},y.prototype.createController=function(t){t=t||{};var e=this.findControllerConstructor();t.route=this;var o=new e(t);return o},y.prototype.setControllerParams=function(t,e){},y.prototype.dispatch=function(t,e,o){return r(e._runRoute,"context doesn't have a _runRoute method"),e._runRoute(this,t,o)},y.prototype.path=function(t,e){return this.handler.resolve(t,e)},y.prototype.url=function(t,e){var o=this.path(t,e),r=e&&e.host||s.absoluteUrl();return"/"===r.charAt(r.length-1),r=r.slice(0,r.length-1),r+o},y.prototype.params=function(t){return this.handler.params(t)},t.each(d,function(t){y.prototype[t]=function(e){return this._methods[t]=!0,this._actionStack.push(this._path,e,{name:this.getName()+"_"+t.toLowerCase(),method:t,where:this.handler.where,mount:!1}),this}}),l.Route=y}.call(this),function(){var e=l.MiddlewareStack,o=l.Url,r=l.Layout,n=l.utils.warn,i=l.utils.assert;c=function(o){function r(t,e,o){r.dispatch(t.url,{request:t,response:e},o)}return r._stack=new e,r._globalHooks={},r.routes=[],r.routes._byPath={},this.configure.call(r,o),t.extend(r,this),this.init.call(r,o),s.startup(function(){s.defer(function(){r.options.autoStart!==!1&&r.start()})}),r},c.prototype.init=function(t){},c.prototype.configure=function(e){var o=this;e=e||{};var r=function(e){return e?t.isArray(e)?e:[e]:[]};return t.each(l.Router.HOOK_TYPES,function n(i){e[i]&&(t.each(r(e[i]),function a(t){o.addHook(i,t)}),delete e[i])}),this.options=this.options||{},t.extend(this.options,e),this},c.prototype.map=function(t){return t.call(this)},c.prototype.route=function(t,e,o){var r=function(t){return Object.prototype.toString.call(t)};i("[object String]"===r(t)||"[object RegExp]"===r(t),"Router.route requires a path that is a string or regular expression."),"object"==typeof e&&(o=e,e=o.action);var n=new y(t,e,o);o=o||{},o.mount=!1;var a=this._stack.push(t,n,o);return a.route=n,n.handler=a,n.router=this,i(!this.routes._byPath[a.path],"A route for the path "+JSON.stringify(a.path)+" already exists by the name of "+JSON.stringify(a.name)+"."),this.routes._byPath[a.path]=n,this.routes.push(n),"string"==typeof a.name&&(this.routes[a.name]=n),n},c.prototype.findFirstRoute=function(t){for(var e,o,r=0;r<this.routes.length;r++)if(m=this.routes[r],e=m.handler.test(t,{where:s.isServer?"server":"client"}))return m;return null},c.prototype.path=function(t,e,o){var r=this.routes[t];return n(r,"You called Router.path for a route named "+JSON.stringify(t)+" but that route doesn't seem to exist. Are you sure you created it?"),r&&r.path(e,o)},c.prototype.url=function(t,e,o){var r=this.routes[t];return n(r,"You called Router.url for a route named "+JSON.stringify(t)+" but that route doesn't seem to exist. Are you sure you created it?"),r&&r.url(e,o)},c.prototype.createController=function(t,e){var o=this.findFirstRoute(t),r;return e=e||{},r=o?o.createController({layout:this._layout}):new h({layout:this._layout}),r.router=this,r.configureFromUrl(t,e,{reactive:!1}),r},c.prototype.setTemplateNameConverter=function(t){return this._templateNameConverter=t,this},c.prototype.setControllerNameConverter=function(t){return this._controllerNameConverter=t,this},c.prototype.toTemplateName=function(t){return this._templateNameConverter?this._templateNameConverter(t):l.utils.classCase(t)},c.prototype.toControllerName=function(t){return this._controllerNameConverter?this._controllerNameConverter(t):l.utils.classCase(t)+"Controller"},c.prototype.addHook=function(e,o,r){var n=this;r=r||{};var i=function(e){return e?t.isArray(e)?e:[e]:[]};r.only&&(r.only=i(r.only)),r.except&&(r.except=i(r.except));var a=this._globalHooks[e]=this._globalHooks[e]||[],u=function(){var t=this,e=arguments;return f.withValue(r,function(){return n.lookupHook(o).apply(t,e)})};return a.push({options:r,hook:u}),this},c.prototype.lookupHook=function(e){var o=e;if(t.isFunction(o))return o;if(t.isString(o)&&t.isFunction(l.Router.hooks[o]))return l.Router.hooks[o];throw new Error("No hook found named: "+e)},c.prototype.getHooks=function(e,o){var r=this,n=[];return t.each(this._globalHooks[e],function(e){var r=e.options;return r.except&&t.include(r.except,o)?[]:r.only&&!t.include(r.only,o)?[]:void n.push(e.hook)}),n},c.HOOK_TYPES=["onRun","onRerun","onBeforeAction","onAfterAction","onStop","waitOn","subscriptions","load","before","after","unload"],c.hooks={},c.plugins={},t.each(c.HOOK_TYPES,function(t){c.prototype[t]=function(e,o){this.addHook(t,e,o)}}),c.prototype.plugin=function(t,e){var o;if("function"==typeof t?o=t:"string"==typeof t&&(o=l.Router.plugins[t]),!o)throw new Error("No plugin found named "+JSON.stringify(t));return o.call(this,this,e),this},l.Router=c}.call(this),function(){if("undefined"!=typeof a)var t=new a("DefaultLoadingTemplate",function(){return"Loading..."}),e=new a("DefaultDataNotFoundTemplate",function(){return"Data not found..."});c.hooks.loading=function(){if(this.ready())return void this.next();var e=this.lookupOption("loadingTemplate");this.render(e||t),this.renderRegions()},c.hooks.dataNotFound=function(){if(!this.ready())return void this.next();var t=this.lookupOption("data"),o,r=this.lookupOption("notFoundTemplate");return"function"!=typeof t||(o=t.call(this))?void this.next():(this.render(r||e),void this.renderRegions())}}.call(this),function(){var e=l.utils.warn,o=l.DynamicTemplate,i=l.utils.debug("iron:router <helpers>");n.registerHelper("Router",new r.Template("Router",function(){return c.createView()})),n.registerHelper("pathFor",function(o){var r;arguments.length>1&&(r=arguments[0],o=arguments[1]||{});var n=o&&o.hash;n=n||{};var i="",a=n.query,s=n.hash,r=r||n.route,l=t.extend({},n.data||this),p=c.routes[r];return e(p,"pathFor couldn't find a route named "+JSON.stringify(r)),p&&(t.each(p.handler.compiledUrl.keys,function(e){var o=e.name;t.has(n,o)&&(l[o]=u.clone(n[o]),delete n[o])}),i=p.path(l,{query:a,hash:s})),i}),n.registerHelper("urlFor",function(o){var r;arguments.length>1&&(r=arguments[0],o=arguments[1]||{});var n=o&&o.hash;n=n||{};var i="",a=n.query,s=n.hash,r=r||n.route,l=t.extend({},n.data||this),p=c.routes[r];return e(p,"urlFor couldn't find a route named "+JSON.stringify(r)),p&&(t.each(p.handler.compiledUrl.keys,function(e){var o=e.name;t.has(n,o)&&(l[o]=u.clone(n[o]),delete n[o])}),i=p.url(l,{query:a,hash:s})),i}),n.registerHelper("linkTo",new r.Template("linkTo",function(){var n=this,i=o.getInclusionArguments(this);if("object"!=typeof i)throw new Error("linkTo options must be key value pairs such as {{#linkTo route='my.route.name'}}. You passed: "+JSON.stringify(i));i=i||{};var a="",s=i.query,l=i.hash,h=i.route,f=t.extend({},i.data||o.getParentDataContext(this)),d=c.routes[h],y;e(d,"linkTo couldn't find a route named "+JSON.stringify(h)),d&&(t.each(d.handler.compiledUrl.keys,function(e){var o=e.name;t.has(i,o)&&(f[o]=u.clone(i[o]),delete i[o])}),a=d.path(f,{query:s,hash:l}));var m=t.omit(i,"route","query","hash","data");return m.href=a,r.With(function(){return o.getParentDataContext(n)},function(){return p.A(m,n.templateContentBlock)})}))}.call(this),function(){var e=l.MiddlewareStack,r=l.Url,n=l.Layout,i=l.utils.assert,a="__IronRouterNotFound__",u="__IronRouterNoRoutes__";c.prototype.init=function(t){var e=this;e._currentController=null,e._currentRoute=null,e._currentDep=new o.Dependency,e._locationComputation=null,e._layout=new n({template:e.options.layoutTemplate}),s.startup(function(){setTimeout(function t(){e.options.autoRender!==!1&&e.insert({el:document.body})})})},c.prototype.insert=function(t){return this._layout.insert(t),this},c.prototype.createView=function(){return this._layout.create()},c.prototype.lookupNotFoundTemplate=function(){return this.options.notFoundTemplate?this.options.notFoundTemplate:0===this.routes.length?u:a},c.prototype.lookupLayoutTemplate=function(){return this.options.layoutTemplate},c.prototype.dispatch=function(t,e,r){var n=this;i("string"==typeof t,"expected url string in router dispatch");var s=this._currentController,l=this.findFirstRoute(t),p=this._currentRoute;return this._currentRoute=l,this._currentController&&this._currentController.stop(),s&&l&&p===l?s.configureFromUrl(t,e):s=this.createController(t,e),this._currentController=s,s.dispatch(n._stack,t,function c(t){if(t)throw t;if(!s.isHandled()){var e=o.nonreactive(function(){return s.location.get().options.historyState});if(e&&e.initial===!0){this.layout(this.lookupOption("layoutTemplate"),{data:{url:this.url}});var i=this.lookupOption("notFoundTemplate");i||(i=0===n.routes.length?u:a),this.render(i,{data:{url:this.url}}),this.renderRegions(),s.isHandled=function(){return!0}}return r&&r.call(s)}}),this._currentController==s&&this._currentDep.changed(),s},c.prototype.current=function(){return this._currentDep.depend(),this._currentController},c.prototype._scrollToHash=function(t){try{var e=$(t);$("html, body").scrollTop(e.offset().top)}catch(o){}},c.prototype.start=function(){var t=this,e;t._locationComputation=o.autorun(function r(o){var r,n=l.Location.get(),i,a,u,s=t._currentController;!s||e&&e.path!==n.path?r=t.dispatch(n.href,null,function p(t){this.isHandled()||(n.cancelUrlChange(),window.location=n.path)}):(t._scrollToHash(n.hash),s.configureFromUrl(n.href)),e=n})},c.prototype.stop=function(){this._isStarted&&(this._locationComputation&&this._locationComputation.stop(),this._currentController&&this._currentController.stop(),this._isStarted=!1)},c.prototype.go=function(e,o,r){var n=this,a=/^\/|http/,u;if(r=r||{},a.test(e))u=e;else{var s=n.routes[e];i(s,"No route found named "+JSON.stringify(e)),u=s.path(o,t.extend(r,{throwOnMissingParams:!0}))}l.Location.go(u,r)}}.call(this),function(){c.plugins.loading=function(t,e){t.onBeforeAction("loading",e)},c.plugins.dataNotFound=function(t,e){t.onBeforeAction("dataNotFound",e)}}.call(this),function(){c=new l.Router}.call(this),function(){a.__checkName("__IronRouterNotFound__"),a.__IronRouterNotFound__=new a("Template.__IronRouterNotFound__",function(){var t=this;return p.DIV({style:"width: 600px; margin: 0 auto; padding: 20px;"},"\n ",p.DIV({style:"font-size: 18pt; color: #999;"},"\n Oops, looks like there's no route on the client or the server for url: \"",r.View(function(){return Spacebars.mustache(t.lookup("url"))}),'."\n '),"\n ")}),a.__checkName("__IronRouterNoRoutes__"),a.__IronRouterNoRoutes__=new a("Template.__IronRouterNoRoutes__",function(){var t=this;return p.Raw('<div style="font-family: helvetica; color: #777; max-width: 600px; margin: 20px auto;">\n <h1 style="text-align: center; margin: 0; font-size: 48pt;">\n iron:router\n </h1>\n <p style="text-align: center; font-size: 1.3em;">\n Organize your Meteor application.\n </p>\n <div style="margin: 50px 0px;">\n <pre style="background: #f2f2f2; margin: 0; padding: 10px;">\nRouter.route(\'/\', function () {\n this.render(\'Home\', {\n data: function () { return Items.findOne({_id: this.params._id}); }\n });\n});\n </pre>\n </div>\n <div style="margin: 50px 0px;">\n Check it out on Github:<br>\n <a href="https://github.com/eventedmind/iron-router" target="_blank">https://github.com/eventedmind/iron-router</a>\n <br>\n <br>\n And check out the new Guide:<br>\n <a href="https://eventedmind.github.io/iron-router" target="_blank">\n https://eventedmind.github.io/iron-router\n </a>\n </div>\n </div>')})}.call(this),"undefined"==typeof Package&&(Package={}),Package["iron:router"]={Router:c,RouteController:h}}(); + +!function(){var e=Package.meteor.Meteor,t=Package.underscore._,n;(function(){n={_isCssLoaded:function(){return 0===document.styleSheets.length?!0:t.find(document.styleSheets,function(e){return e.cssText&&!e.cssRules?!e.cssText.match(/meteor-css-not-found-error/):!t.find(e.cssRules,function(e){return".meteor-css-not-found-error"===e.selectorText})})}}}).call(this),"undefined"==typeof Package&&(Package={}),Package.webapp={WebApp:n}}(); + +!function(){var a=Package.meteor.Meteor,e=Package.ddp.DDP,e,t;"undefined"==typeof Package&&(Package={}),Package.livedata={DDP:e,LivedataTest:t}}(); + +!function(){var t=Package.meteor.Meteor,n=Package.htmljs.HTML,e=Package.tracker.Tracker,a=Package.tracker.Deps,r=Package.blaze.Blaze,u=Package.blaze.UI,i=Package.blaze.Handlebars,o=Package["observe-sequence"].ObserveSequence,c=Package.templating.Template,l;(function(){l={};var t=function(t,n){return t===n};l.include=function(n,e,a){if(!n)return null;if("function"!=typeof n){var u=n;if(!r.isTemplate(u))throw new Error("Expected template or null, found: "+u);return n.constructView(e,a)}var i=r.ReactiveVar(null,t),o=r.View("Spacebars.include",function(){var t=i.get();if(null===t)return null;if(!r.isTemplate(t))throw new Error("Expected template or null, found: "+t);return t.constructView(e,a)});return o.__templateVar=i,o.onViewCreated(function(){this.autorun(function(){i.set(n())})}),o},l.mustacheImpl=function(t){var n=arguments;if(n.length>1){var e=n[n.length-1];if(e instanceof l.kw){var a={};for(var r in e.hash){var u=e.hash[r];a[r]="function"==typeof u?u():u}n[n.length-1]=l.kw(a)}else e=l.kw(),n=Array.prototype.slice.call(arguments),n.push(e)}return l.call.apply(null,n)},l.mustache=function(t){var e=l.mustacheImpl.apply(null,arguments);return e instanceof l.SafeString?n.Raw(e.toString()):null==e||e===!1?null:String(e)},l.attrMustache=function(t){var e=l.mustacheImpl.apply(null,arguments);if(null==e||""===e)return null;if("object"==typeof e)return e;if("string"==typeof e&&n.isValidAttributeName(e)){var a={};return a[e]="",a}throw new Error("Expected valid attribute name, '', null, or object")},l.dataMustache=function(t){var n=l.mustacheImpl.apply(null,arguments);return n},l.makeRaw=function(t){return null==t?null:t instanceof n.Raw?t:n.Raw(t)},l.call=function(t){if("function"==typeof t){for(var n=[],e=1;e<arguments.length;e++){var a=arguments[e];n[e-1]="function"==typeof a?a():a}return t.apply(null,n)}if(arguments.length>1)throw new Error("Can't call non-function: "+t);return t},l.kw=function(t){return this instanceof l.kw?void(this.hash=t||{}):new l.kw(t)},l.SafeString=function(t){return this instanceof l.SafeString?new i.SafeString(t):new l.SafeString(t)},l.SafeString.prototype=i.SafeString.prototype,l.dot=function(t,n){if(arguments.length>2){var e=[];return e.push(l.dot(t,n)),e.push.apply(e,Array.prototype.slice.call(arguments,2)),l.dot.apply(null,e)}if("function"==typeof t&&(t=t()),!t)return t;var a=t[n];return"function"!=typeof a?a:function(){return a.apply(t,arguments)}},l.With=function(t,n,a){var u=new r.ReactiveVar,i=r.View("Spacebars_with",function(){return r.If(function(){return u.get()},function(){return r.With(function(){return u.get()},n)},a)});return i.onViewCreated(function(){this.autorun(function(){u.set(t()),e.onInvalidate(function(){u.dep.changed()})})}),i},l.TemplateWith=r._TemplateWith}).call(this),function(){c.__checkName("__dynamic"),c.__dynamic=new c("Template.__dynamic",function(){var t=this;return[r.View(function(){return l.mustache(t.lookup("checkContext"))}),"\n ",r.If(function(){return l.call(t.lookup("dataContextPresent"))},function(){return["\n ",l.include(t.lookupTemplate("__dynamicWithDataContext")),"\n "]},function(){return["\n \n ",r._TemplateWith(function(){return{template:l.call(t.lookup("template")),data:l.call(t.lookup(".."))}},function(){return l.include(t.lookupTemplate("__dynamicWithDataContext"))}),"\n "]})]}),c.__checkName("__dynamicWithDataContext"),c.__dynamicWithDataContext=new c("Template.__dynamicWithDataContext",function(){var t=this;return l.With(function(){return l.dataMustache(t.lookup("chooseTemplate"),t.lookup("template"))},function(){return["\n ",r._TemplateWith(function(){return l.call(l.dot(t.lookup(".."),"data"))},function(){return l.include(t.lookupTemplate(".."))})," \n "]})})}.call(this),function(){c.__dynamicWithDataContext.helpers({chooseTemplate:function(t){return c[t]||null}}),c.__dynamic.helpers({dataContextPresent:function(){return _.has(this,"data")},checkContext:function(){if(!_.has(this,"template"))throw new Error("Must specify name in the 'template' argument to {{> Template.dynamic}}.");_.each(this,function(t,n){if("template"!==n&&"data"!==n)throw new Error("Invalid argument to {{> Template.dynamic}}: "+n)})}})}.call(this),"undefined"==typeof Package&&(Package={}),Package.spacebars={Spacebars:l}}(); + +!function(){var e=Package.meteor.Meteor,a;(function(){var n=0,r=!1;a={hold:function(){if(!e.isCordova)return{release:function(){}};if(r)throw new Error("Can't show launch screen once it's hidden");n++;var a=!1,t=function(){e.isCordova&&(a||(n--,0===n&&"undefined"!=typeof navigator&&navigator.splashscreen&&(r=!0,navigator.splashscreen.hide())))};return{release:t}}}}).call(this),function(){var n=a.hold(),r=Package.templating&&Package.templating.Template;e.startup(function(){if(r)if(Package["iron:router"])Package["iron:router"].Router.onAfterAction(function(){n.release()});else{var e=setInterval(function(){r.body.view&&r.body.view.isRendered&&(n.release(),clearInterval(e))},50);setTimeout(function(){n.release()},6e3)}else n.release()})}.call(this),"undefined"==typeof Package&&(Package={}),Package["launch-screen"]={LaunchScreen:a}}(); + +FastClick=Package.fastclick.FastClick,Cookie=Package["chuangbo:cookie"].Cookie,moment=Package["jeeeyul:moment-with-langs"].moment,TAPi18next=Package["tap:i18n"].TAPi18next,TAPi18n=Package["tap:i18n"].TAPi18n,Helpers=Package["raix:handlebar-helpers"].Helpers,TemplateVar=Package["frozeman:template-var"].TemplateVar,PersistentMinimongo=Package["frozeman:persistent-minimongo"].PersistentMinimongo,ReactiveTimer=Package["frozeman:reactive-timer"].ReactiveTimer,BigNumber=Package["3stack:bignumber"].BigNumber,Showdown=Package.markdown.Showdown,numeral=Package["numeral:numeral"].numeral,EthTools=Package["ethereum:tools"].EthTools,Router=Package["iron:router"].Router,RouteController=Package["iron:router"].RouteController,Meteor=Package.meteor.Meteor,WebApp=Package.webapp.WebApp,Log=Package.logging.Log,Tracker=Package.deps.Tracker,Deps=Package.deps.Deps,Session=Package.session.Session,DDP=Package.livedata.DDP,Mongo=Package.mongo.Mongo,Blaze=Package.ui.Blaze,UI=Package.ui.UI,Handlebars=Package.ui.Handlebars,Spacebars=Package.spacebars.Spacebars,Template=Package.templating.Template,check=Package.check.check,Match=Package.check.Match,_=Package.underscore._,$=Package.jquery.$,jQuery=Package.jquery.jQuery,Random=Package.random.Random,EJSON=Package.ejson.EJSON,LaunchScreen=Package["launch-screen"].LaunchScreen,Iron=Package["iron:core"].Iron,HTML=Package.htmljs.HTML; + +!function(){Template.__checkName("layout_notFound"),Template.layout_notFound=new Template("Template.layout_notFound",function(){var n=this;return HTML.Raw('<main class="dapp-content">\n <h1>Nothing here...</h1>\n </main>')})}(); + +!function(){Template.__checkName("views_home"),Template.views_home=new Template("Template.views_home",function(){var e=this;return[HTML.H2({"class":"page-title"}," ",Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.NetworkHealth")})),"\n \n\n ",HTML.H2(" ",Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.Mining")})," "),"\n \n ",HTML.DIV({"class":"dapp container mining-stats"},"\n ",HTML.DIV({"class":"mining-slider dapp-big-number"},"\n ",HTML.INPUT({type:"range",name:"fee",min:"0",max:"1",step:"1",value:function(){return Spacebars.mustache(e.lookup("miningSlider"))},"class":"slider-vertical"}),"\n ",HTML.DD(Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.MiningStatus")})),"\n ",HTML.DT({"class":"mining-status"},"\n ",Blaze.If(function(){return Spacebars.call(e.lookup("miningSlider"))},function(){return["\n ",Blaze.If(function(){return Spacebars.call(e.lookup("hashrate"))},function(){return["\n ",Blaze.View(function(){return Spacebars.mustache(e.lookup("hashrate"))})," ",HTML.SMALL("KHash "),"\n "]},function(){return["\n ",Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.on")}),"\n "]}),"\n "]},function(){return["\n ",Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.off")}),"\n "]}),"\n \n "),"\n "),"\n ",HTML.DIV({"class":"dapp-big-number"},"\n ",HTML.DD(Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.TimeSpent")})),"\n ",HTML.DT({"class":"time-spent"},Blaze.View(function(){return Spacebars.makeRaw(Spacebars.mustache(e.lookup("timeSpent")))})),"\n ")," \n ",HTML.DIV({"class":"dapp-big-number"},"\n ",HTML.DD(Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.Rewards")})),"\n ",HTML.DT(Blaze.View(function(){return Spacebars.makeRaw(Spacebars.mustache(e.lookup("totalRewards")))})),"\n ")," \n ",HTML.DIV({"class":"dapp-big-number"},"\n ",HTML.DD(Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.AverageReward")})),"\n ",HTML.DT(" ",Blaze.View(function(){return Spacebars.makeRaw(Spacebars.mustache(e.lookup("averageRewardPerHour")))})),"\n ")," \n "),"\n\n \n ",HTML.H2(" ",Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.Connections")})," "),"\n\n ",HTML.DIV({"class":"dapp-container"},"\n\n ",HTML.DL({"class":"latest-block-info"},"\n\n ",HTML.DIV({"class":"dapp-big-number"},"\n ",HTML.DD(Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.PeerCount")})),"\n ",HTML.DT(Blaze.View(function(){return Spacebars.mustache(e.lookup("peerCount"))})," ",HTML.SMALL(" ",Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.Peers")})," ")),"\n "),"\n ",HTML.DIV({"class":"dapp-big-number"},"\n ",HTML.DD(Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.GasPrice")})),"\n ",HTML.DT(Blaze.View(function(){return Spacebars.mustache(e.lookup("gasPrice"))})," ",HTML.SMALL(" ",Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.Finney")})," ")),"\n "),"\n "),"\n\n "),"\n \n ",HTML.H2(" ",Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.Blockchain")})," "),"\n\n ",HTML.DIV({"class":"block-chain"},"\n ",HTML.DIV({"class":"wrapper"},"\n ",Blaze.Each(function(){return Spacebars.call(e.lookup("blocks"))},function(){return["\n ",HTML.DIV({"class":"dapp-box card",style:function(){return["background-image:",Spacebars.mustache(e.lookup("currentBlockPattern"))]}},"\n ",Blaze._TemplateWith(function(){return{identity:Spacebars.call("miner")}},function(){return Spacebars.include(e.lookupTemplate("dapp_identicon"))}),"\n ",HTML.H1(" ",Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.Block")})," ",Blaze.View(function(){return Spacebars.mustache(e.lookup("number"))})),"\n ",HTML.H3(Blaze.View(function(){return Spacebars.mustache(e.lookup("hash"))})),"\n ",HTML.DL("\n ",HTML.DD(" ",Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.GasUsed")})," "),"\n ",HTML.DT(Blaze.View(function(){return Spacebars.mustache(e.lookup("gasUsed"))})),"\n ",HTML.DD(" ",Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.Size")})," "),"\n ",HTML.DT(Blaze.View(function(){return Spacebars.mustache(e.lookup("size"))})),"\n ",HTML.DD(" ",Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.Uncles")})," "),"\n ",HTML.DT(Blaze.View(function(){return Spacebars.mustache(e.lookup("uncles"))})),"\n ",HTML.DD(" ",Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.Time")})," "),"\n ",HTML.DT(Blaze.View(function(){return Spacebars.mustache(e.lookup("formatTime"),e.lookup("time"),"YYYY-MM-DD HH:mm:ss")})),"\n "),"\n "),"\n "]}),"\n ",HTML.DIV({"class":"",style:""},"\n ",HTML.H3(" ",Blaze.View(function(){return Spacebars.mustache(e.lookup("i18n"),"network.home.EndOfBlocks")})," "),"\n "),"\n "),"\n ")]})}(); + +!function(){Template.body.addContent(function(){var e=this;return[Spacebars.include(e.lookupTemplate("layout_main")),HTML.Raw('\n \n <!-- Form Helper iFrame -->\n <iframe id="dapp-form-helper-iframe" name="dapp-form-helper-iframe" src="javascript:false;"></iframe>')]}),Meteor.startup(Template.body.renderToDocument)}(); + +!function(){Template.__checkName("layout_main"),Template.layout_main=new Template("Template.layout_main",function(){var n=this;return[HTML.Raw('<!-- <div class="dapp-grid"></div>\n --> \n '),HTML.DIV({"class":"dapp-flex-content"},"\n\n ",HTML.Raw("<!-- content -->"),"\n ",HTML.MAIN({"class":"dapp-content"},"\n ",Spacebars.include(n.lookupTemplate("views_home")),"\n "),"\n\n ")]})}(); + +!function(){Helpers={},Helpers.rerun={"10s":new ReactiveTimer(10)},Helpers.getLocalStorageSize=function(){var e=0;return localStorage&&_.each(Object.keys(localStorage),function(n){e+=2*localStorage[n].length/1024/1024}),e},Helpers.moment=function(e){return TAPi18n.getLanguage(),_.isFinite(e)&&moment.unix(e).isValid()?moment.unix(e):moment(e)},Helpers.formatTime=function(e,n){return n instanceof Spacebars.kw&&(n=null),e?(_.isString(n)&&!_.isEmpty(n)&&("iso"===n.toLowerCase()?e=Helpers.moment(e).toISOString():"fromnow"===n.toLowerCase()?(Helpers.rerun["10s"].tick(),e=Helpers.moment(e).fromNow()):e=Helpers.moment(e).format(n)),e):""}}(); + +!function(){Template.registerHelper("debug",function(e){console.log(e)}),Template.registerHelper("username",function(e){var t=Users.findOne(e);return Whisper.getIdentity().identity===e?Whisper.getIdentity().name:t?t.name:"anonymous"}),Template.registerHelper("currentIdentity",function(e){return Whisper.getIdentity()}),Template.registerHelper("formatTime",Helpers.formatTime)}(); + +!function(){!function(){function a(e){if(!(this instanceof a))return new a(e);if("function"==typeof e)return this.random=e,this;var n;arguments.length&&(this.seed=0);for(var i=0;i<arguments.length;i++){if(n=0,"string"==typeof arguments[i])for(var t=0;t<arguments[i].length;t++)n+=(arguments[i].length-t)*arguments[i].charCodeAt(t);else n=arguments[i];this.seed+=(arguments.length-i)*n}return this.mt=this.mersenne_twister(this.seed),this.random=function(){return this.mt.random(this.seed)},this}function e(a,e){if(a||(a={}),e)for(var n in e)"undefined"==typeof a[n]&&(a[n]=e[n]);return a}function n(a,e){if(a)throw new RangeError(e)}function i(a){return function(){return this.natural(a)}}function t(a,e){for(var n=y(a),i=0,t=n.length;t>i;i++)key=n[i],e[key]=a[key]||e[key]}function r(a,e){for(var n=0,i=a.length;i>n;n++)e[n]=a[n]}function o(a,e){var n=Array.isArray(a),i=e||(n?new Array(a.length):{});return n?r(a,i):t(a,i),i}var s=9007199254740992,m=-s,l="0123456789",b="abcdefghijklmnopqrstuvwxyz",h=b.toUpperCase(),c=l+"abcdef",u=Array.prototype.slice;a.prototype.VERSION="0.7.1";var d=function(){throw new Error("No Base64 encoder available.")};!function(){"function"==typeof btoa?d=btoa:"function"==typeof Buffer&&(d=function(a){return new Buffer(a).toString("base64")})}(),a.prototype.bool=function(a){return a=e(a,{likelihood:50}),n(a.likelihood<0||a.likelihood>100,"Chance: Likelihood accepts values from 0 to 100."),100*this.random()<a.likelihood},a.prototype.character=function(a){a=e(a);var i,t,r="!@#$%^&*()[]";return n(a.alpha&&a.symbols,"Chance: Cannot specify both alpha and symbols."),i="lower"===a.casing?b:"upper"===a.casing?h:b+h,t=a.pool?a.pool:a.alpha?i:a.symbols?r:i+l+r,t.charAt(this.natural({max:t.length-1}))},a.prototype.floating=function(a){var i;a=e(a,{fixed:4});var t=Math.pow(10,a.fixed);n(a.fixed&&a.precision,"Chance: Cannot specify both fixed and precision.");var r=s/t,o=-r;n(a.min&&a.fixed&&a.min<o,"Chance: Min specified is out of range with fixed. Min should be, at least, "+o),n(a.max&&a.fixed&&a.max>r,"Chance: Max specified is out of range with fixed. Max should be, at most, "+r),a=e(a,{min:o,max:r}),i=this.integer({min:a.min*t,max:a.max*t});var m=(i/t).toFixed(a.fixed);return parseFloat(m)},a.prototype.integer=function(a){return a=e(a,{min:m,max:s}),n(a.min>a.max,"Chance: Min cannot be greater than Max."),Math.floor(this.random()*(a.max-a.min+1)+a.min)},a.prototype.natural=function(a){return a=e(a,{min:0,max:s}),this.integer(a)},a.prototype.string=function(a){a=e(a);var n=a.length||this.natural({min:5,max:20}),i=a.pool,t=this.n(this.character,n,{pool:i});return t.join("")},a.prototype.capitalize=function(a){return a.charAt(0).toUpperCase()+a.substr(1)},a.prototype.mixin=function(e){for(var n in e)a.prototype[n]=e[n];return this},a.prototype.unique=function(a,n,i){i=e(i,{comparator:function(a,e){return-1!==a.indexOf(e)}});for(var t,r=[],o=0,s=50*n,m=u.call(arguments,2);r.length<n;)if(t=a.apply(this,m),i.comparator(r,t)||(r.push(t),o=0),++o>s)throw new RangeError("Chance: num is likely too large for sample set");return r},a.prototype.n=function(a,e){var n=e||1,i=[],t=u.call(arguments,2);for(n=Math.max(0,n),null;n--;null)i.push(a.apply(this,t));return i},a.prototype.pad=function(a,e,n){return n=n||"0",a+="",a.length>=e?a:new Array(e-a.length+1).join(n)+a},a.prototype.pick=function(a,e){if(0===a.length)throw new RangeError("Chance: Cannot pick() from an empty array");return e&&1!==e?this.shuffle(a).slice(0,e):a[this.natural({max:a.length-1})]},a.prototype.shuffle=function(a){for(var e=a.slice(0),n=[],i=0,t=Number(e.length),r=0;t>r;r++)i=this.natural({max:e.length-1}),n[r]=e[i],e.splice(i,1);return n},a.prototype.weighted=function(a,e){if(a.length!==e.length)throw new RangeError("Chance: length of array and weights must match");if(e.some(function(a){return 1>a})){var n=e.reduce(function(a,e){return a>e?e:a},e[0]),i=1/n;e=e.map(function(a){return a*i})}var t,r=e.reduce(function(a,e){return a+e},0),o=this.natural({min:1,max:r}),s=0;return e.some(function(e,n){return s+e>=o?(t=a[n],!0):(s+=e,!1)}),t},a.prototype.paragraph=function(a){a=e(a);var n=a.sentences||this.natural({min:3,max:7}),i=this.n(this.sentence,n);return i.join(" ")},a.prototype.sentence=function(a){a=e(a);var n,i=a.words||this.natural({min:12,max:18}),t=this.n(this.word,i);return n=t.join(" "),n=this.capitalize(n)+"."},a.prototype.syllable=function(a){a=e(a);for(var n,i=a.length||this.natural({min:2,max:3}),t="bcdfghjklmnprstvwz",r="aeiou",o=t+r,s="",m=0;i>m;m++)n=this.character(0===m?{pool:o}:-1===t.indexOf(n)?{pool:t}:{pool:r}),s+=n;return s},a.prototype.word=function(a){a=e(a),n(a.syllables&&a.length,"Chance: Cannot specify both syllables AND length.");var i=a.syllables||this.natural({min:1,max:3}),t="";if(a.length){do t+=this.syllable();while(t.length<a.length);t=t.substring(0,a.length)}else for(var r=0;i>r;r++)t+=this.syllable();return t},a.prototype.age=function(a){a=e(a);var n;switch(a.type){case"child":n={min:1,max:12};break;case"teen":n={min:13,max:19};break;case"adult":n={min:18,max:65};break;case"senior":n={min:65,max:100};break;case"all":n={min:1,max:100};break;default:n={min:18,max:65}}return this.natural(n)},a.prototype.birthday=function(a){return a=e(a,{year:(new Date).getFullYear()-this.age(a)}),this.date(a)},a.prototype.cpf=function(){var a=this.n(this.natural,9,{max:9}),e=2*a[8]+3*a[7]+4*a[6]+5*a[5]+6*a[4]+7*a[3]+8*a[2]+9*a[1]+10*a[0];e=11-e%11,e>=10&&(e=0);var n=2*e+3*a[8]+4*a[7]+5*a[6]+6*a[5]+7*a[4]+8*a[3]+9*a[2]+10*a[1]+11*a[0];return n=11-n%11,n>=10&&(n=0),""+a[0]+a[1]+a[2]+"."+a[3]+a[4]+a[5]+"."+a[6]+a[7]+a[8]+"-"+e+n},a.prototype.first=function(a){return a=e(a,{gender:this.gender()}),this.pick(this.get("firstNames")[a.gender.toLowerCase()])},a.prototype.gender=function(){return this.pick(["Male","Female"])},a.prototype.last=function(){return this.pick(this.get("lastNames"))},a.prototype.name=function(a){a=e(a);var n,i=this.first(a),t=this.last();return n=a.middle?i+" "+this.first(a)+" "+t:a.middle_initial?i+" "+this.character({alpha:!0,casing:"upper"})+". "+t:i+" "+t,a.prefix&&(n=this.prefix(a)+" "+n),a.suffix&&(n=n+" "+this.suffix(a)),n},a.prototype.name_prefixes=function(a){a=a||"all",a=a.toLowerCase();var e=[{name:"Doctor",abbreviation:"Dr."}];return("male"===a||"all"===a)&&e.push({name:"Mister",abbreviation:"Mr."}),("female"===a||"all"===a)&&(e.push({name:"Miss",abbreviation:"Miss"}),e.push({name:"Misses",abbreviation:"Mrs."})),e},a.prototype.prefix=function(a){return this.name_prefix(a)},a.prototype.name_prefix=function(a){return a=e(a,{gender:"all"}),a.full?this.pick(this.name_prefixes(a.gender)).name:this.pick(this.name_prefixes(a.gender)).abbreviation},a.prototype.ssn=function(a){a=e(a,{ssnFour:!1,dashes:!0});var n,i="1234567890",t=a.dashes?"-":"";return n=a.ssnFour?this.string({pool:i,length:4}):this.string({pool:i,length:3})+t+this.string({pool:i,length:2})+t+this.string({pool:i,length:4})},a.prototype.name_suffixes=function(){var a=[{name:"Doctor of Osteopathic Medicine",abbreviation:"D.O."},{name:"Doctor of Philosophy",abbreviation:"Ph.D."},{name:"Esquire",abbreviation:"Esq."},{name:"Junior",abbreviation:"Jr."},{name:"Juris Doctor",abbreviation:"J.D."},{name:"Master of Arts",abbreviation:"M.A."},{name:"Master of Business Administration",abbreviation:"M.B.A."},{name:"Master of Science",abbreviation:"M.S."},{name:"Medical Doctor",abbreviation:"M.D."},{name:"Senior",abbreviation:"Sr."},{name:"The Third",abbreviation:"III"},{name:"The Fourth",abbreviation:"IV"}];return a},a.prototype.suffix=function(a){return this.name_suffix(a)},a.prototype.name_suffix=function(a){return a=e(a),a.full?this.pick(this.name_suffixes()).name:this.pick(this.name_suffixes()).abbreviation},a.prototype.android_id=function(){return"APA91"+this.string({pool:"0123456789abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_",length:178})},a.prototype.apple_token=function(){return this.string({pool:"abcdef1234567890",length:64})},a.prototype.wp8_anid2=function(){return d(this.hash({length:32}))},a.prototype.wp7_anid=function(){return"A="+this.guid().replace(/-/g,"").toUpperCase()+"&E="+this.hash({length:3})+"&W="+this.integer({min:0,max:9})},a.prototype.bb_pin=function(){return this.hash({length:8})},a.prototype.color=function(a){function n(a,e){return[a,a,a].join(e||"")}a=e(a,{format:this.pick(["hex","shorthex","rgb","0x"]),grayscale:!1,casing:"lower"});var i,t=a.grayscale;if("hex"===a.format)i="#"+(t?n(this.hash({length:2})):this.hash({length:6}));else if("shorthex"===a.format)i="#"+(t?n(this.hash({length:1})):this.hash({length:3}));else if("rgb"===a.format)i=t?"rgb("+n(this.natural({max:255}),",")+")":"rgb("+this.natural({max:255})+","+this.natural({max:255})+","+this.natural({max:255})+")";else{if("0x"!==a.format)throw new Error('Invalid format provided. Please provide one of "hex", "shorthex", "rgb" or "0x".');i="0x"+(t?n(this.hash({length:2})):this.hash({length:6}))}return"upper"===a.casing&&(i=i.toUpperCase()),i},a.prototype.domain=function(a){return a=e(a),this.word()+"."+(a.tld||this.tld())},a.prototype.email=function(a){return a=e(a),this.word({length:a.length})+"@"+(a.domain||this.domain())},a.prototype.fbid=function(){return parseInt("10000"+this.natural({max:1e11}),10)},a.prototype.google_analytics=function(){var a=this.pad(this.natural({max:999999}),6),e=this.pad(this.natural({max:99}),2);return"UA-"+a+"-"+e},a.prototype.hashtag=function(){return"#"+this.word()},a.prototype.ip=function(){return this.natural({max:255})+"."+this.natural({max:255})+"."+this.natural({max:255})+"."+this.natural({max:255})},a.prototype.ipv6=function(){var a=this.n(this.hash,8,{length:4});return a.join(":")},a.prototype.klout=function(){return this.natural({min:1,max:99})},a.prototype.tlds=function(){return["com","org","edu","gov","co.uk","net","io"]},a.prototype.tld=function(){return this.pick(this.tlds())},a.prototype.twitter=function(){return"@"+this.word()},a.prototype.url=function(a){a=e(a,{protocol:"http",domain:this.domain(a),domain_prefix:"",path:this.word(),extensions:[]});var n=a.extensions.length>0?"."+this.pick(a.extensions):"",i=a.domain_prefix?a.domain_prefix+"."+a.domain:a.domain;return a.protocol+"://"+i+"/"+a.path+n},a.prototype.address=function(a){return a=e(a),this.natural({min:5,max:2e3})+" "+this.street(a)},a.prototype.altitude=function(a){return a=e(a,{fixed:5,max:8848}),this.floating({min:0,max:a.max,fixed:a.fixed})},a.prototype.areacode=function(a){a=e(a,{parens:!0});var n=this.natural({min:2,max:9}).toString()+this.natural({min:0,max:8}).toString()+this.natural({min:0,max:9}).toString();return a.parens?"("+n+")":n},a.prototype.city=function(){return this.capitalize(this.word({syllables:3}))},a.prototype.coordinates=function(a){return a=e(a),this.latitude(a)+", "+this.longitude(a)},a.prototype.countries=function(){return this.get("countries")},a.prototype.country=function(a){a=e(a);var n=this.pick(this.countries());return a.full?n.name:n.abbreviation},a.prototype.depth=function(a){return a=e(a,{fixed:5,min:-2550}),this.floating({min:a.min,max:0,fixed:a.fixed})},a.prototype.geohash=function(a){return a=e(a,{length:7}),this.string({length:a.length,pool:"0123456789bcdefghjkmnpqrstuvwxyz"})},a.prototype.geojson=function(a){return a=e(a),this.latitude(a)+", "+this.longitude(a)+", "+this.altitude(a)},a.prototype.latitude=function(a){return a=e(a,{fixed:5,min:-90,max:90}),this.floating({min:a.min,max:a.max,fixed:a.fixed})},a.prototype.longitude=function(a){return a=e(a,{fixed:5,min:-180,max:180}),this.floating({min:a.min,max:a.max,fixed:a.fixed})},a.prototype.phone=function(a){var n,i=this,t=function(a){var e=[];return a.sections.forEach(function(a){e.push(i.string({pool:"0123456789",length:a}))}),a.area+e.join(" ")};a=e(a,{formatted:!0,country:"us",mobile:!1}),a.formatted||(a.parens=!1);var r;switch(a.country){case"fr":a.mobile?(n=this.pick(["06","07"])+i.string({pool:"0123456789",length:8}),r=a.formatted?n.match(/../g).join(" "):n):(n=this.pick(["01"+this.pick(["30","34","39","40","41","42","43","44","45","46","47","48","49","53","55","56","58","60","64","69","70","72","73","74","75","76","77","78","79","80","81","82","83"])+i.string({pool:"0123456789",length:6}),"02"+this.pick(["14","18","22","23","28","29","30","31","32","33","34","35","36","37","38","40","41","43","44","45","46","47","48","49","50","51","52","53","54","56","57","61","62","69","72","76","77","78","85","90","96","97","98","99"])+i.string({pool:"0123456789",length:6}),"03"+this.pick(["10","20","21","22","23","24","25","26","27","28","29","39","44","45","51","52","54","55","57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","80","81","82","83","84","85","86","87","88","89","90"])+i.string({pool:"0123456789",length:6}),"04"+this.pick(["11","13","15","20","22","26","27","30","32","34","37","42","43","44","50","56","57","63","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","88","89","90","91","92","93","94","95","97","98"])+i.string({pool:"0123456789",length:6}),"05"+this.pick(["08","16","17","19","24","31","32","33","34","35","40","45","46","47","49","53","55","56","57","58","59","61","62","63","64","65","67","79","81","82","86","87","90","94"])+i.string({pool:"0123456789",length:6}),"09"+i.string({pool:"0123456789",length:8})]),r=a.formatted?n.match(/../g).join(" "):n);break;case"uk":a.mobile?(n=this.pick([{area:"07"+this.pick(["4","5","7","8","9"]),sections:[2,6]},{area:"07624 ",sections:[6]}]),r=a.formatted?t(n):t(n).replace(" ","")):(n=this.pick([{area:"01"+this.character({pool:"234569"})+"1 ",sections:[3,4]},{area:"020 "+this.character({pool:"378"}),sections:[3,4]},{area:"023 "+this.character({pool:"89"}),sections:[3,4]},{area:"024 7",sections:[3,4]},{area:"028 "+this.pick(["25","28","37","71","82","90","92","95"]),sections:[2,4]},{area:"012"+this.pick(["04","08","54","76","97","98"])+" ",sections:[5]},{area:"013"+this.pick(["63","64","84","86"])+" ",sections:[5]},{area:"014"+this.pick(["04","20","60","61","80","88"])+" ",sections:[5]},{area:"015"+this.pick(["24","27","62","66"])+" ",sections:[5]},{area:"016"+this.pick(["06","29","35","47","59","95"])+" ",sections:[5]},{area:"017"+this.pick(["26","44","50","68"])+" ",sections:[5]},{area:"018"+this.pick(["27","37","84","97"])+" ",sections:[5]},{area:"019"+this.pick(["00","05","35","46","49","63","95"])+" ",sections:[5]}]),r=a.formatted?t(n):t(n).replace(" ","","g"));break;case"us":var o=this.areacode(a).toString(),s=this.natural({min:2,max:9}).toString()+this.natural({min:0,max:9}).toString()+this.natural({min:0,max:9}).toString(),m=this.natural({min:1e3,max:9999}).toString();r=a.formatted?o+" "+s+"-"+m:o+s+m}return r},a.prototype.postal=function(){var a=this.character({pool:"XVTSRPNKLMHJGECBA"}),e=a+this.natural({max:9})+this.character({alpha:!0,casing:"upper"}),n=this.natural({max:9})+this.character({alpha:!0,casing:"upper"})+this.natural({max:9});return e+" "+n},a.prototype.provinces=function(){return this.get("provinces")},a.prototype.province=function(a){return a&&a.full?this.pick(this.provinces()).name:this.pick(this.provinces()).abbreviation},a.prototype.state=function(a){return a&&a.full?this.pick(this.states(a)).name:this.pick(this.states(a)).abbreviation},a.prototype.states=function(a){a=e(a);var n,i=this.get("us_states_and_dc"),t=this.get("territories"),r=this.get("armed_forces");return n=i,a.territories&&(n=n.concat(t)),a.armed_forces&&(n=n.concat(r)),n},a.prototype.street=function(a){a=e(a);var n=this.word({syllables:2});return n=this.capitalize(n),n+=" ",n+=a.short_suffix?this.street_suffix().abbreviation:this.street_suffix().name},a.prototype.street_suffix=function(){return this.pick(this.street_suffixes())},a.prototype.street_suffixes=function(){return this.get("street_suffixes")},a.prototype.zip=function(a){var e=this.n(this.natural,5,{max:9});return a&&a.plusfour===!0&&(e.push("-"),e=e.concat(this.n(this.natural,4,{max:9}))),e.join("")},a.prototype.ampm=function(){return this.bool()?"am":"pm"},a.prototype.date=function(a){var n,i;if(a&&(a.min||a.max)){a=e(a,{american:!0,string:!1});var t="undefined"!=typeof a.min?a.min.getTime():1,r="undefined"!=typeof a.max?a.max.getTime():864e13;i=new Date(this.natural({min:t,max:r}))}else{var o=this.month({raw:!0});a=e(a,{year:parseInt(this.year(),10),month:o.numeric-1,day:this.natural({min:1,max:o.days}),hour:this.hour(),minute:this.minute(),second:this.second(),millisecond:this.millisecond(),american:!0,string:!1}),i=new Date(a.year,a.month,a.day,a.hour,a.minute,a.second,a.millisecond)}return n=a.american?i.getMonth()+1+"/"+i.getDate()+"/"+i.getFullYear():i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),a.string?n:i},a.prototype.hammertime=function(a){return this.date(a).getTime()},a.prototype.hour=function(a){return a=e(a,{min:1,max:a&&a.twentyfour?24:12}),n(a.min<1,"Chance: Min cannot be less than 1."),n(a.twentyfour&&a.max>24,"Chance: Max cannot be greater than 24 for twentyfour option."),n(!a.twentyfour&&a.max>12,"Chance: Max cannot be greater than 12."),n(a.min>a.max,"Chance: Min cannot be greater than Max."),this.natural({min:a.min,max:a.max})},a.prototype.millisecond=function(){return this.natural({max:999})},a.prototype.minute=a.prototype.second=function(a){return a=e(a,{min:0,max:59}),n(a.min<0,"Chance: Min cannot be less than 0."),n(a.max>59,"Chance: Max cannot be greater than 59."),n(a.min>a.max,"Chance: Min cannot be greater than Max."),this.natural({min:a.min,max:a.max})},a.prototype.month=function(a){a=e(a,{min:1,max:12}),n(a.min<1,"Chance: Min cannot be less than 1."),n(a.max>12,"Chance: Max cannot be greater than 12."),n(a.min>a.max,"Chance: Min cannot be greater than Max.");var i=this.pick(this.months().slice(a.min-1,a.max));return a.raw?i:i.name},a.prototype.months=function(){return this.get("months")},a.prototype.second=function(){return this.natural({max:59})},a.prototype.timestamp=function(){return this.natural({min:1,max:parseInt((new Date).getTime()/1e3,10)})},a.prototype.year=function(a){return a=e(a,{min:(new Date).getFullYear()}),a.max="undefined"!=typeof a.max?a.max:a.min+100,this.natural(a).toString()},a.prototype.cc=function(a){a=e(a);var n,i,t;return n=this.cc_type(a.type?{name:a.type,raw:!0}:{raw:!0}),i=n.prefix.split(""),t=n.length-n.prefix.length-1,i=i.concat(this.n(this.integer,t,{min:0,max:9})),i.push(this.luhn_calculate(i.join(""))),i.join("")},a.prototype.cc_types=function(){return this.get("cc_types")},a.prototype.cc_type=function(a){a=e(a);var n=this.cc_types(),i=null;if(a.name){for(var t=0;t<n.length;t++)if(n[t].name===a.name||n[t].short_name===a.name){i=n[t];break}if(null===i)throw new Error("Credit card type '"+a.name+"'' is not supported")}else i=this.pick(n);return a.raw?i:i.name},a.prototype.currency_types=function(){return this.get("currency_types")},a.prototype.currency=function(){return this.pick(this.currency_types())},a.prototype.currency_pair=function(a){var e=this.unique(this.currency,2,{comparator:function(a,e){return a.reduce(function(a,n){return a||n.code===e.code},!1)}});return a?e[0]+"/"+e[1]:e},a.prototype.dollar=function(a){a=e(a,{max:1e4,min:0});var n=this.floating({min:a.min,max:a.max,fixed:2}).toString(),i=n.split(".")[1];return void 0===i?n+=".00":i.length<2&&(n+="0"),0>n?"-$"+n.replace("-",""):"$"+n},a.prototype.exp=function(a){a=e(a);var n={};return n.year=this.exp_year(),n.month=n.year===(new Date).getFullYear()?this.exp_month({future:!0}):this.exp_month(),a.raw?n:n.month+"/"+n.year},a.prototype.exp_month=function(a){a=e(a);var n,i,t=(new Date).getMonth();if(a.future){do n=this.month({raw:!0}).numeric,i=parseInt(n,10);while(t>i)}else n=this.month({raw:!0}).numeric;return n},a.prototype.exp_year=function(){return this.year({max:(new Date).getFullYear()+10})},a.prototype.d4=i({min:1,max:4}),a.prototype.d6=i({min:1,max:6}),a.prototype.d8=i({min:1,max:8}),a.prototype.d10=i({min:1,max:10}),a.prototype.d12=i({min:1,max:12}),a.prototype.d20=i({min:1,max:20}),a.prototype.d30=i({min:1,max:30}),a.prototype.d100=i({min:1,max:100}),a.prototype.rpg=function(a,n){if(n=e(n),null===a)throw new Error("A type of die roll must be included");var i=a.toLowerCase().split("d"),t=[];if(2!==i.length||!parseInt(i[0],10)||!parseInt(i[1],10))throw new Error("Invalid format provided. Please provide #d# where the first # is the number of dice to roll, the second # is the max of each die");for(var r=i[0];r>0;r--)t[r-1]=this.natural({min:1,max:i[1]});return"undefined"!=typeof n.sum&&n.sum?t.reduce(function(a,e){return a+e}):t},a.prototype.guid=function(a){a=e(a,{version:5});var n="abcdef1234567890",i="ab89",t=this.string({pool:n,length:8})+"-"+this.string({pool:n,length:4})+"-"+a.version+this.string({pool:n,length:3})+"-"+this.string({pool:i,length:1})+this.string({pool:n,length:3})+"-"+this.string({pool:n,length:12});return t},a.prototype.hash=function(a){a=e(a,{length:40,casing:"lower"});var n="upper"===a.casing?c.toUpperCase():c;return this.string({pool:n,length:a.length})},a.prototype.luhn_check=function(a){var e=a.toString(),n=+e.substring(e.length-1);return n===this.luhn_calculate(+e.substring(0,e.length-1))},a.prototype.luhn_calculate=function(a){for(var e,n=a.toString().split("").reverse(),i=0,t=0,r=n.length;r>t;++t)e=+n[t],t%2===0&&(e*=2,e>9&&(e-=9)),i+=e;return 9*i%10};var p={firstNames:{male:["James","John","Robert","Michael","William","David","Richard","Joseph","Charles","Thomas","Christopher","Daniel","Matthew","George","Donald","Anthony","Paul","Mark","Edward","Steven","Kenneth","Andrew","Brian","Joshua","Kevin","Ronald","Timothy","Jason","Jeffrey","Frank","Gary","Ryan","Nicholas","Eric","Stephen","Jacob","Larry","Jonathan","Scott","Raymond","Justin","Brandon","Gregory","Samuel","Benjamin","Patrick","Jack","Henry","Walter","Dennis","Jerry","Alexander","Peter","Tyler","Douglas","Harold","Aaron","Jose","Adam","Arthur","Zachary","Carl","Nathan","Albert","Kyle","Lawrence","Joe","Willie","Gerald","Roger","Keith","Jeremy","Terry","Harry","Ralph","Sean","Jesse","Roy","Louis","Billy","Austin","Bruce","Eugene","Christian","Bryan","Wayne","Russell","Howard","Fred","Ethan","Jordan","Philip","Alan","Juan","Randy","Vincent","Bobby","Dylan","Johnny","Phillip","Victor","Clarence","Ernest","Martin","Craig","Stanley","Shawn","Travis","Bradley","Leonard","Earl","Gabriel","Jimmy","Francis","Todd","Noah","Danny","Dale","Cody","Carlos","Allen","Frederick","Logan","Curtis","Alex","Joel","Luis","Norman","Marvin","Glenn","Tony","Nathaniel","Rodney","Melvin","Alfred","Steve","Cameron","Chad","Edwin","Caleb","Evan","Antonio","Lee","Herbert","Jeffery","Isaac","Derek","Ricky","Marcus","Theodore","Elijah","Luke","Jesus","Eddie","Troy","Mike","Dustin","Ray","Adrian","Bernard","Leroy","Angel","Randall","Wesley","Ian","Jared","Mason","Hunter","Calvin","Oscar","Clifford","Jay","Shane","Ronnie","Barry","Lucas","Corey","Manuel","Leo","Tommy","Warren","Jackson","Isaiah","Connor","Don","Dean","Jon","Julian","Miguel","Bill","Lloyd","Charlie","Mitchell","Leon","Jerome","Darrell","Jeremiah","Alvin","Brett","Seth","Floyd","Jim","Blake","Micheal","Gordon","Trevor","Lewis","Erik","Edgar","Vernon","Devin","Gavin","Jayden","Chris","Clyde","Tom","Derrick","Mario","Brent","Marc","Herman","Chase","Dominic","Ricardo","Franklin","Maurice","Max","Aiden","Owen","Lester","Gilbert","Elmer","Gene","Francisco","Glen","Cory","Garrett","Clayton","Sam","Jorge","Chester","Alejandro","Jeff","Harvey","Milton","Cole","Ivan","Andre","Duane","Landon"],female:["Mary","Emma","Elizabeth","Minnie","Margaret","Ida","Alice","Bertha","Sarah","Annie","Clara","Ella","Florence","Cora","Martha","Laura","Nellie","Grace","Carrie","Maude","Mabel","Bessie","Jennie","Gertrude","Julia","Hattie","Edith","Mattie","Rose","Catherine","Lillian","Ada","Lillie","Helen","Jessie","Louise","Ethel","Lula","Myrtle","Eva","Frances","Lena","Lucy","Edna","Maggie","Pearl","Daisy","Fannie","Josephine","Dora","Rosa","Katherine","Agnes","Marie","Nora","May","Mamie","Blanche","Stella","Ellen","Nancy","Effie","Sallie","Nettie","Della","Lizzie","Flora","Susie","Maud","Mae","Etta","Harriet","Sadie","Caroline","Katie","Lydia","Elsie","Kate","Susan","Mollie","Alma","Addie","Georgia","Eliza","Lulu","Nannie","Lottie","Amanda","Belle","Charlotte","Rebecca","Ruth","Viola","Olive","Amelia","Hannah","Jane","Virginia","Emily","Matilda","Irene","Kathryn","Esther","Willie","Henrietta","Ollie","Amy","Rachel","Sara","Estella","Theresa","Augusta","Ora","Pauline","Josie","Lola","Sophia","Leona","Anne","Mildred","Ann","Beulah","Callie","Lou","Delia","Eleanor","Barbara","Iva","Louisa","Maria","Mayme","Evelyn","Estelle","Nina","Betty","Marion","Bettie","Dorothy","Luella","Inez","Lela","Rosie","Allie","Millie","Janie","Cornelia","Victoria","Ruby","Winifred","Alta","Celia","Christine","Beatrice","Birdie","Harriett","Mable","Myra","Sophie","Tillie","Isabel","Sylvia","Carolyn","Isabelle","Leila","Sally","Ina","Essie","Bertie","Nell","Alberta","Katharine","Lora","Rena","Mina","Rhoda","Mathilda","Abbie","Eula","Dollie","Hettie","Eunice","Fanny","Ola","Lenora","Adelaide","Christina","Lelia","Nelle","Sue","Johanna","Lilly","Lucinda","Minerva","Lettie","Roxie","Cynthia","Helena","Hilda","Hulda","Bernice","Genevieve","Jean","Cordelia","Marian","Francis","Jeanette","Adeline","Gussie","Leah","Lois","Lura","Mittie","Hallie","Isabella","Olga","Phoebe","Teresa","Hester","Lida","Lina","Winnie","Claudia","Marguerite","Vera","Cecelia","Bess","Emilie","John","Rosetta","Verna","Myrtie","Cecilia","Elva","Olivia","Ophelia","Georgie","Elnora","Violet","Adele","Lily","Linnie","Loretta","Madge","Polly","Virgie","Eugenia","Lucile","Lucille","Mabelle","Rosalie"]},lastNames:["Smith","Johnson","Williams","Jones","Brown","Davis","Miller","Wilson","Moore","Taylor","Anderson","Thomas","Jackson","White","Harris","Martin","Thompson","Garcia","Martinez","Robinson","Clark","Rodriguez","Lewis","Lee","Walker","Hall","Allen","Young","Hernandez","King","Wright","Lopez","Hill","Scott","Green","Adams","Baker","Gonzalez","Nelson","Carter","Mitchell","Perez","Roberts","Turner","Phillips","Campbell","Parker","Evans","Edwards","Collins","Stewart","Sanchez","Morris","Rogers","Reed","Cook","Morgan","Bell","Murphy","Bailey","Rivera","Cooper","Richardson","Cox","Howard","Ward","Torres","Peterson","Gray","Ramirez","James","Watson","Brooks","Kelly","Sanders","Price","Bennett","Wood","Barnes","Ross","Henderson","Coleman","Jenkins","Perry","Powell","Long","Patterson","Hughes","Flores","Washington","Butler","Simmons","Foster","Gonzales","Bryant","Alexander","Russell","Griffin","Diaz","Hayes","Myers","Ford","Hamilton","Graham","Sullivan","Wallace","Woods","Cole","West","Jordan","Owens","Reynolds","Fisher","Ellis","Harrison","Gibson","McDonald","Cruz","Marshall","Ortiz","Gomez","Murray","Freeman","Wells","Webb","Simpson","Stevens","Tucker","Porter","Hunter","Hicks","Crawford","Henry","Boyd","Mason","Morales","Kennedy","Warren","Dixon","Ramos","Reyes","Burns","Gordon","Shaw","Holmes","Rice","Robertson","Hunt","Black","Daniels","Palmer","Mills","Nichols","Grant","Knight","Ferguson","Rose","Stone","Hawkins","Dunn","Perkins","Hudson","Spencer","Gardner","Stephens","Payne","Pierce","Berry","Matthews","Arnold","Wagner","Willis","Ray","Watkins","Olson","Carroll","Duncan","Snyder","Hart","Cunningham","Bradley","Lane","Andrews","Ruiz","Harper","Fox","Riley","Armstrong","Carpenter","Weaver","Greene","Lawrence","Elliott","Chavez","Sims","Austin","Peters","Kelley","Franklin","Lawson","Fields","Gutierrez","Ryan","Schmidt","Carr","Vasquez","Castillo","Wheeler","Chapman","Oliver","Montgomery","Richards","Williamson","Johnston","Banks","Meyer","Bishop","McCoy","Howell","Alvarez","Morrison","Hansen","Fernandez","Garza","Harvey","Little","Burton","Stanley","Nguyen","George","Jacobs","Reid","Kim","Fuller","Lynch","Dean","Gilbert","Garrett","Romero","Welch","Larson","Frazier","Burke","Hanson","Day","Mendoza","Moreno","Bowman","Medina","Fowler","Brewer","Hoffman","Carlson","Silva","Pearson","Holland","Douglas","Fleming","Jensen","Vargas","Byrd","Davidson","Hopkins","May","Terry","Herrera","Wade","Soto","Walters","Curtis","Neal","Caldwell","Lowe","Jennings","Barnett","Graves","Jimenez","Horton","Shelton","Barrett","Obrien","Castro","Sutton","Gregory","McKinney","Lucas","Miles","Craig","Rodriquez","Chambers","Holt","Lambert","Fletcher","Watts","Bates","Hale","Rhodes","Pena","Beck","Newman","Haynes","McDaniel","Mendez","Bush","Vaughn","Parks","Dawson","Santiago","Norris","Hardy","Love","Steele","Curry","Powers","Schultz","Barker","Guzman","Page","Munoz","Ball","Keller","Chandler","Weber","Leonard","Walsh","Lyons","Ramsey","Wolfe","Schneider","Mullins","Benson","Sharp","Bowen","Daniel","Barber","Cummings","Hines","Baldwin","Griffith","Valdez","Hubbard","Salazar","Reeves","Warner","Stevenson","Burgess","Santos","Tate","Cross","Garner","Mann","Mack","Moss","Thornton","Dennis","McGee","Farmer","Delgado","Aguilar","Vega","Glover","Manning","Cohen","Harmon","Rodgers","Robbins","Newton","Todd","Blair","Higgins","Ingram","Reese","Cannon","Strickland","Townsend","Potter","Goodwin","Walton","Rowe","Hampton","Ortega","Patton","Swanson","Joseph","Francis","Goodman","Maldonado","Yates","Becker","Erickson","Hodges","Rios","Conner","Adkins","Webster","Norman","Malone","Hammond","Flowers","Cobb","Moody","Quinn","Blake","Maxwell","Pope","Floyd","Osborne","Paul","McCarthy","Guerrero","Lindsey","Estrada","Sandoval","Gibbs","Tyler","Gross","Fitzgerald","Stokes","Doyle","Sherman","Saunders","Wise","Colon","Gill","Alvarado","Greer","Padilla","Simon","Waters","Nunez","Ballard","Schwartz","McBride","Houston","Christensen","Klein","Pratt","Briggs","Parsons","McLaughlin","Zimmerman","French","Buchanan","Moran","Copeland","Roy","Pittman","Brady","McCormick","Holloway","Brock","Poole","Frank","Logan","Owen","Bass","Marsh","Drake","Wong","Jefferson","Park","Morton","Abbott","Sparks","Patrick","Norton","Huff","Clayton","Massey","Lloyd","Figueroa","Carson","Bowers","Roberson","Barton","Tran","Lamb","Harrington","Casey","Boone","Cortez","Clarke","Mathis","Singleton","Wilkins","Cain","Bryan","Underwood","Hogan","McKenzie","Collier","Luna","Phelps","McGuire","Allison","Bridges","Wilkerson","Nash","Summers","Atkins"],countries:[{name:"Afghanistan",abbreviation:"AF"},{name:"Albania",abbreviation:"AL"},{name:"Algeria",abbreviation:"DZ"},{name:"American Samoa",abbreviation:"AS"},{name:"Andorra",abbreviation:"AD"},{name:"Angola",abbreviation:"AO"},{name:"Anguilla",abbreviation:"AI"},{name:"Antarctica",abbreviation:"AQ"},{name:"Antigua and Barbuda",abbreviation:"AG"},{name:"Argentina",abbreviation:"AR"},{name:"Armenia",abbreviation:"AM"},{name:"Aruba",abbreviation:"AW"},{name:"Australia",abbreviation:"AU"},{name:"Austria",abbreviation:"AT"},{name:"Azerbaijan",abbreviation:"AZ"},{name:"Bahamas",abbreviation:"BS"},{name:"Bahrain",abbreviation:"BH"},{name:"Bangladesh",abbreviation:"BD"},{name:"Barbados",abbreviation:"BB"},{name:"Belarus",abbreviation:"BY"},{name:"Belgium",abbreviation:"BE"},{name:"Belize",abbreviation:"BZ"},{name:"Benin",abbreviation:"BJ"},{name:"Bermuda",abbreviation:"BM"},{name:"Bhutan",abbreviation:"BT"},{name:"Bolivia",abbreviation:"BO"},{name:"Bosnia and Herzegovina",abbreviation:"BA"},{name:"Botswana",abbreviation:"BW"},{name:"Bouvet Island",abbreviation:"BV"},{name:"Brazil",abbreviation:"BR"},{name:"British Antarctic Territory",abbreviation:"BQ"},{name:"British Indian Ocean Territory",abbreviation:"IO"},{name:"British Virgin Islands",abbreviation:"VG"},{name:"Brunei",abbreviation:"BN"},{name:"Bulgaria",abbreviation:"BG"},{name:"Burkina Faso",abbreviation:"BF"},{name:"Burundi",abbreviation:"BI"},{name:"Cambodia",abbreviation:"KH"},{name:"Cameroon",abbreviation:"CM"},{name:"Canada",abbreviation:"CA"},{name:"Canton and Enderbury Islands",abbreviation:"CT"},{name:"Cape Verde",abbreviation:"CV"},{name:"Cayman Islands",abbreviation:"KY"},{name:"Central African Republic",abbreviation:"CF"},{name:"Chad",abbreviation:"TD"},{name:"Chile",abbreviation:"CL"},{name:"China",abbreviation:"CN"},{name:"Christmas Island",abbreviation:"CX"},{name:"Cocos [Keeling] Islands",abbreviation:"CC"},{name:"Colombia",abbreviation:"CO"},{name:"Comoros",abbreviation:"KM"},{name:"Congo - Brazzaville",abbreviation:"CG"},{name:"Congo - Kinshasa",abbreviation:"CD"},{name:"Cook Islands",abbreviation:"CK"},{name:"Costa Rica",abbreviation:"CR"},{name:"Croatia",abbreviation:"HR"},{name:"Cuba",abbreviation:"CU"},{name:"Cyprus",abbreviation:"CY"},{name:"Czech Republic",abbreviation:"CZ"},{name:"Côte d’Ivoire",abbreviation:"CI"},{name:"Denmark",abbreviation:"DK"},{name:"Djibouti",abbreviation:"DJ"},{name:"Dominica",abbreviation:"DM"},{name:"Dominican Republic",abbreviation:"DO"},{name:"Dronning Maud Land",abbreviation:"NQ"},{name:"East Germany",abbreviation:"DD"},{name:"Ecuador",abbreviation:"EC"},{name:"Egypt",abbreviation:"EG"},{name:"El Salvador",abbreviation:"SV"},{name:"Equatorial Guinea",abbreviation:"GQ"},{name:"Eritrea",abbreviation:"ER"},{name:"Estonia",abbreviation:"EE"},{name:"Ethiopia",abbreviation:"ET"},{name:"Falkland Islands",abbreviation:"FK"},{name:"Faroe Islands",abbreviation:"FO"},{name:"Fiji",abbreviation:"FJ"},{name:"Finland",abbreviation:"FI"},{name:"France",abbreviation:"FR"},{name:"French Guiana",abbreviation:"GF"},{name:"French Polynesia",abbreviation:"PF"},{name:"French Southern Territories",abbreviation:"TF"},{name:"French Southern and Antarctic Territories",abbreviation:"FQ"},{name:"Gabon",abbreviation:"GA"},{name:"Gambia",abbreviation:"GM"},{name:"Georgia",abbreviation:"GE"},{name:"Germany",abbreviation:"DE"},{name:"Ghana",abbreviation:"GH"},{name:"Gibraltar",abbreviation:"GI"},{name:"Greece",abbreviation:"GR"},{name:"Greenland",abbreviation:"GL"},{name:"Grenada",abbreviation:"GD"},{name:"Guadeloupe",abbreviation:"GP"},{name:"Guam",abbreviation:"GU"},{name:"Guatemala",abbreviation:"GT"},{name:"Guernsey",abbreviation:"GG"},{name:"Guinea",abbreviation:"GN"},{name:"Guinea-Bissau",abbreviation:"GW"},{name:"Guyana",abbreviation:"GY"},{name:"Haiti",abbreviation:"HT"},{name:"Heard Island and McDonald Islands",abbreviation:"HM"},{name:"Honduras",abbreviation:"HN"},{name:"Hong Kong SAR China",abbreviation:"HK"},{name:"Hungary",abbreviation:"HU"},{name:"Iceland",abbreviation:"IS"},{name:"India",abbreviation:"IN"},{name:"Indonesia",abbreviation:"ID"},{name:"Iran",abbreviation:"IR"},{name:"Iraq",abbreviation:"IQ"},{name:"Ireland",abbreviation:"IE"},{name:"Isle of Man",abbreviation:"IM"},{name:"Israel",abbreviation:"IL"},{name:"Italy",abbreviation:"IT"},{name:"Jamaica",abbreviation:"JM"},{name:"Japan",abbreviation:"JP"},{name:"Jersey",abbreviation:"JE"},{name:"Johnston Island",abbreviation:"JT"},{name:"Jordan",abbreviation:"JO"},{name:"Kazakhstan",abbreviation:"KZ"},{name:"Kenya",abbreviation:"KE"},{name:"Kiribati",abbreviation:"KI"},{name:"Kuwait",abbreviation:"KW"},{name:"Kyrgyzstan",abbreviation:"KG"},{name:"Laos",abbreviation:"LA"},{name:"Latvia",abbreviation:"LV"},{name:"Lebanon",abbreviation:"LB"},{name:"Lesotho",abbreviation:"LS"},{name:"Liberia",abbreviation:"LR"},{name:"Libya",abbreviation:"LY"},{name:"Liechtenstein",abbreviation:"LI"},{name:"Lithuania",abbreviation:"LT"},{name:"Luxembourg",abbreviation:"LU"},{name:"Macau SAR China",abbreviation:"MO"},{name:"Macedonia",abbreviation:"MK"},{name:"Madagascar",abbreviation:"MG"},{name:"Malawi",abbreviation:"MW"},{name:"Malaysia",abbreviation:"MY"},{name:"Maldives",abbreviation:"MV"},{name:"Mali",abbreviation:"ML"},{name:"Malta",abbreviation:"MT"},{name:"Marshall Islands",abbreviation:"MH"},{name:"Martinique",abbreviation:"MQ"},{name:"Mauritania",abbreviation:"MR"},{name:"Mauritius",abbreviation:"MU"},{name:"Mayotte",abbreviation:"YT"},{name:"Metropolitan France",abbreviation:"FX"},{name:"Mexico",abbreviation:"MX"},{name:"Micronesia",abbreviation:"FM"},{name:"Midway Islands",abbreviation:"MI"},{name:"Moldova",abbreviation:"MD"},{name:"Monaco",abbreviation:"MC"},{name:"Mongolia",abbreviation:"MN"},{name:"Montenegro",abbreviation:"ME"},{name:"Montserrat",abbreviation:"MS"},{name:"Morocco",abbreviation:"MA"},{name:"Mozambique",abbreviation:"MZ"},{name:"Myanmar [Burma]",abbreviation:"MM"},{name:"Namibia",abbreviation:"NA"},{name:"Nauru",abbreviation:"NR"},{name:"Nepal",abbreviation:"NP"},{name:"Netherlands",abbreviation:"NL"},{name:"Netherlands Antilles",abbreviation:"AN"},{name:"Neutral Zone",abbreviation:"NT"},{name:"New Caledonia",abbreviation:"NC"},{name:"New Zealand",abbreviation:"NZ"},{name:"Nicaragua",abbreviation:"NI"},{name:"Niger",abbreviation:"NE"},{name:"Nigeria",abbreviation:"NG"},{name:"Niue",abbreviation:"NU"},{name:"Norfolk Island",abbreviation:"NF"},{name:"North Korea",abbreviation:"KP"},{name:"North Vietnam",abbreviation:"VD"},{name:"Northern Mariana Islands",abbreviation:"MP"},{name:"Norway",abbreviation:"NO"},{name:"Oman",abbreviation:"OM"},{name:"Pacific Islands Trust Territory",abbreviation:"PC"},{name:"Pakistan",abbreviation:"PK"},{name:"Palau",abbreviation:"PW"},{name:"Palestinian Territories",abbreviation:"PS"},{name:"Panama",abbreviation:"PA"},{name:"Panama Canal Zone",abbreviation:"PZ"},{name:"Papua New Guinea",abbreviation:"PG"},{name:"Paraguay",abbreviation:"PY"},{name:"People's Democratic Republic of Yemen",abbreviation:"YD"},{name:"Peru",abbreviation:"PE"},{name:"Philippines",abbreviation:"PH"},{name:"Pitcairn Islands",abbreviation:"PN"},{name:"Poland",abbreviation:"PL"},{name:"Portugal",abbreviation:"PT"},{name:"Puerto Rico",abbreviation:"PR"},{name:"Qatar",abbreviation:"QA"},{name:"Romania",abbreviation:"RO"},{name:"Russia",abbreviation:"RU"},{name:"Rwanda",abbreviation:"RW"},{name:"Réunion",abbreviation:"RE"},{name:"Saint Barthélemy",abbreviation:"BL"},{name:"Saint Helena",abbreviation:"SH"},{name:"Saint Kitts and Nevis",abbreviation:"KN"},{name:"Saint Lucia",abbreviation:"LC"},{name:"Saint Martin",abbreviation:"MF"},{name:"Saint Pierre and Miquelon",abbreviation:"PM"},{name:"Saint Vincent and the Grenadines",abbreviation:"VC"},{name:"Samoa",abbreviation:"WS"},{name:"San Marino",abbreviation:"SM"},{name:"Saudi Arabia",abbreviation:"SA"},{name:"Senegal",abbreviation:"SN"},{name:"Serbia",abbreviation:"RS"},{name:"Serbia and Montenegro",abbreviation:"CS"},{name:"Seychelles",abbreviation:"SC"},{name:"Sierra Leone",abbreviation:"SL"},{name:"Singapore",abbreviation:"SG"},{name:"Slovakia",abbreviation:"SK"},{name:"Slovenia",abbreviation:"SI"},{name:"Solomon Islands",abbreviation:"SB"},{name:"Somalia",abbreviation:"SO"},{name:"South Africa",abbreviation:"ZA"},{name:"South Georgia and the South Sandwich Islands",abbreviation:"GS"},{name:"South Korea",abbreviation:"KR"},{name:"Spain",abbreviation:"ES"},{name:"Sri Lanka",abbreviation:"LK"},{name:"Sudan",abbreviation:"SD"},{name:"Suriname",abbreviation:"SR"},{name:"Svalbard and Jan Mayen",abbreviation:"SJ"},{name:"Swaziland",abbreviation:"SZ"},{name:"Sweden",abbreviation:"SE"},{name:"Switzerland",abbreviation:"CH"},{name:"Syria",abbreviation:"SY"},{name:"São Tomé and Príncipe",abbreviation:"ST"},{name:"Taiwan",abbreviation:"TW"},{name:"Tajikistan",abbreviation:"TJ"},{name:"Tanzania",abbreviation:"TZ"},{name:"Thailand",abbreviation:"TH"},{name:"Timor-Leste",abbreviation:"TL"},{name:"Togo",abbreviation:"TG"},{name:"Tokelau",abbreviation:"TK"},{name:"Tonga",abbreviation:"TO"},{name:"Trinidad and Tobago",abbreviation:"TT"},{name:"Tunisia",abbreviation:"TN"},{name:"Turkey",abbreviation:"TR"},{name:"Turkmenistan",abbreviation:"TM"},{name:"Turks and Caicos Islands",abbreviation:"TC"},{name:"Tuvalu",abbreviation:"TV"},{name:"U.S. Minor Outlying Islands",abbreviation:"UM"},{name:"U.S. Miscellaneous Pacific Islands",abbreviation:"PU"},{name:"U.S. Virgin Islands",abbreviation:"VI"},{name:"Uganda",abbreviation:"UG"},{name:"Ukraine",abbreviation:"UA"},{name:"Union of Soviet Socialist Republics",abbreviation:"SU"},{name:"United Arab Emirates",abbreviation:"AE"},{name:"United Kingdom",abbreviation:"GB"},{name:"United States",abbreviation:"US"},{name:"Unknown or Invalid Region",abbreviation:"ZZ"},{name:"Uruguay",abbreviation:"UY"},{name:"Uzbekistan",abbreviation:"UZ"},{name:"Vanuatu",abbreviation:"VU"},{name:"Vatican City",abbreviation:"VA"},{name:"Venezuela",abbreviation:"VE"},{name:"Vietnam",abbreviation:"VN"},{name:"Wake Island",abbreviation:"WK"},{name:"Wallis and Futuna",abbreviation:"WF"},{name:"Western Sahara",abbreviation:"EH"},{name:"Yemen",abbreviation:"YE"},{name:"Zambia",abbreviation:"ZM"},{name:"Zimbabwe",abbreviation:"ZW"},{name:"Åland Islands",abbreviation:"AX"}],provinces:[{name:"Alberta",abbreviation:"AB"},{name:"British Columbia",abbreviation:"BC"},{name:"Manitoba",abbreviation:"MB"},{name:"New Brunswick",abbreviation:"NB"},{name:"Newfoundland and Labrador",abbreviation:"NL"},{name:"Nova Scotia",abbreviation:"NS"},{name:"Ontario",abbreviation:"ON"},{name:"Prince Edward Island",abbreviation:"PE"},{name:"Quebec",abbreviation:"QC"},{name:"Saskatchewan",abbreviation:"SK"},{name:"Northwest Territories",abbreviation:"NT"},{name:"Nunavut",abbreviation:"NU"},{name:"Yukon",abbreviation:"YT"}],us_states_and_dc:[{name:"Alabama",abbreviation:"AL"},{name:"Alaska",abbreviation:"AK"},{name:"Arizona",abbreviation:"AZ"},{name:"Arkansas",abbreviation:"AR"},{name:"California",abbreviation:"CA"},{name:"Colorado",abbreviation:"CO"},{name:"Connecticut",abbreviation:"CT"},{name:"Delaware",abbreviation:"DE"},{name:"District of Columbia",abbreviation:"DC"},{name:"Florida",abbreviation:"FL"},{name:"Georgia",abbreviation:"GA"},{name:"Hawaii",abbreviation:"HI"},{name:"Idaho",abbreviation:"ID"},{name:"Illinois",abbreviation:"IL"},{name:"Indiana",abbreviation:"IN"},{name:"Iowa",abbreviation:"IA"},{name:"Kansas",abbreviation:"KS"},{name:"Kentucky",abbreviation:"KY"},{name:"Louisiana",abbreviation:"LA"},{name:"Maine",abbreviation:"ME"},{name:"Maryland",abbreviation:"MD"},{name:"Massachusetts",abbreviation:"MA"},{name:"Michigan",abbreviation:"MI"},{name:"Minnesota",abbreviation:"MN"},{name:"Mississippi",abbreviation:"MS"},{name:"Missouri",abbreviation:"MO"},{name:"Montana",abbreviation:"MT"},{name:"Nebraska",abbreviation:"NE"},{name:"Nevada",abbreviation:"NV"},{name:"New Hampshire",abbreviation:"NH"},{name:"New Jersey",abbreviation:"NJ"},{name:"New Mexico",abbreviation:"NM"},{name:"New York",abbreviation:"NY"},{name:"North Carolina",abbreviation:"NC"},{name:"North Dakota",abbreviation:"ND"},{name:"Ohio",abbreviation:"OH"},{name:"Oklahoma",abbreviation:"OK"},{name:"Oregon",abbreviation:"OR"},{name:"Pennsylvania",abbreviation:"PA"},{name:"Rhode Island",abbreviation:"RI"},{name:"South Carolina",abbreviation:"SC"},{name:"South Dakota",abbreviation:"SD"},{name:"Tennessee",abbreviation:"TN"},{name:"Texas",abbreviation:"TX"},{name:"Utah",abbreviation:"UT"},{name:"Vermont",abbreviation:"VT"},{name:"Virginia",abbreviation:"VA"},{name:"Washington",abbreviation:"WA"},{name:"West Virginia",abbreviation:"WV"},{name:"Wisconsin",abbreviation:"WI"},{name:"Wyoming",abbreviation:"WY"}],territories:[{name:"American Samoa",abbreviation:"AS"},{name:"Federated States of Micronesia",abbreviation:"FM"},{name:"Guam",abbreviation:"GU"},{name:"Marshall Islands",abbreviation:"MH"},{name:"Northern Mariana Islands",abbreviation:"MP"},{name:"Puerto Rico",abbreviation:"PR"},{name:"Virgin Islands, U.S.",abbreviation:"VI"}],armed_forces:[{name:"Armed Forces Europe",abbreviation:"AE"},{name:"Armed Forces Pacific",abbreviation:"AP"},{name:"Armed Forces the Americas",abbreviation:"AA"}],street_suffixes:[{name:"Avenue",abbreviation:"Ave"},{name:"Boulevard",abbreviation:"Blvd"},{name:"Center",abbreviation:"Ctr"},{name:"Circle",abbreviation:"Cir"},{name:"Court",abbreviation:"Ct"},{name:"Drive",abbreviation:"Dr"},{name:"Extension",abbreviation:"Ext"},{name:"Glen",abbreviation:"Gln"},{name:"Grove",abbreviation:"Grv"},{name:"Heights",abbreviation:"Hts"},{name:"Highway",abbreviation:"Hwy"},{name:"Junction",abbreviation:"Jct"},{name:"Key",abbreviation:"Key"},{name:"Lane",abbreviation:"Ln"},{name:"Loop",abbreviation:"Loop"},{name:"Manor",abbreviation:"Mnr"},{name:"Mill",abbreviation:"Mill"},{name:"Park",abbreviation:"Park"},{name:"Parkway",abbreviation:"Pkwy"},{name:"Pass",abbreviation:"Pass"},{name:"Path",abbreviation:"Path"},{name:"Pike",abbreviation:"Pike"},{name:"Place",abbreviation:"Pl"},{name:"Plaza",abbreviation:"Plz"},{name:"Point",abbreviation:"Pt"},{name:"Ridge",abbreviation:"Rdg"},{name:"River",abbreviation:"Riv"},{name:"Road",abbreviation:"Rd"},{name:"Square",abbreviation:"Sq"},{name:"Street",abbreviation:"St"},{name:"Terrace",abbreviation:"Ter"},{name:"Trail",abbreviation:"Trl"},{name:"Turnpike",abbreviation:"Tpke"},{name:"View",abbreviation:"Vw"},{name:"Way",abbreviation:"Way"}],months:[{name:"January",short_name:"Jan",numeric:"01",days:31},{name:"February",short_name:"Feb",numeric:"02",days:28},{name:"March",short_name:"Mar",numeric:"03",days:31},{name:"April",short_name:"Apr",numeric:"04",days:30},{name:"May",short_name:"May",numeric:"05",days:31},{name:"June",short_name:"Jun",numeric:"06",days:30},{name:"July",short_name:"Jul",numeric:"07",days:31},{name:"August",short_name:"Aug",numeric:"08",days:31},{name:"September",short_name:"Sep",numeric:"09",days:30},{name:"October",short_name:"Oct",numeric:"10",days:31},{name:"November",short_name:"Nov",numeric:"11",days:30},{name:"December",short_name:"Dec",numeric:"12",days:31}],cc_types:[{name:"American Express",short_name:"amex",prefix:"34",length:15},{name:"Bankcard",short_name:"bankcard",prefix:"5610",length:16},{name:"China UnionPay",short_name:"chinaunion",prefix:"62",length:16},{name:"Diners Club Carte Blanche",short_name:"dccarte",prefix:"300",length:14},{name:"Diners Club enRoute",short_name:"dcenroute",prefix:"2014",length:15},{name:"Diners Club International",short_name:"dcintl",prefix:"36",length:14},{name:"Diners Club United States & Canada",short_name:"dcusc",prefix:"54",length:16},{name:"Discover Card",short_name:"discover",prefix:"6011",length:16},{name:"InstaPayment",short_name:"instapay",prefix:"637",length:16},{name:"JCB",short_name:"jcb",prefix:"3528",length:16},{name:"Laser",short_name:"laser",prefix:"6304",length:16},{name:"Maestro",short_name:"maestro",prefix:"5018",length:16},{name:"Mastercard",short_name:"mc",prefix:"51",length:16},{name:"Solo",short_name:"solo",prefix:"6334",length:16},{name:"Switch",short_name:"switch",prefix:"4903",length:16},{name:"Visa",short_name:"visa",prefix:"4",length:16},{name:"Visa Electron",short_name:"electron",prefix:"4026",length:16}],currency_types:[{code:"AED",name:"United Arab Emirates Dirham"},{code:"AFN",name:"Afghanistan Afghani"},{code:"ALL",name:"Albania Lek"},{code:"AMD",name:"Armenia Dram"},{code:"ANG",name:"Netherlands Antilles Guilder"},{code:"AOA",name:"Angola Kwanza"},{code:"ARS",name:"Argentina Peso"},{code:"AUD",name:"Australia Dollar"},{code:"AWG",name:"Aruba Guilder"},{code:"AZN",name:"Azerbaijan New Manat"},{code:"BAM",name:"Bosnia and Herzegovina Convertible Marka"},{code:"BBD",name:"Barbados Dollar"},{code:"BDT",name:"Bangladesh Taka"},{code:"BGN",name:"Bulgaria Lev"},{code:"BHD",name:"Bahrain Dinar"},{code:"BIF",name:"Burundi Franc"},{code:"BMD",name:"Bermuda Dollar"},{code:"BND",name:"Brunei Darussalam Dollar"},{code:"BOB",name:"Bolivia Boliviano"},{code:"BRL",name:"Brazil Real"},{code:"BSD",name:"Bahamas Dollar"},{code:"BTN",name:"Bhutan Ngultrum"},{code:"BWP",name:"Botswana Pula"},{code:"BYR",name:"Belarus Ruble"},{code:"BZD",name:"Belize Dollar"},{code:"CAD",name:"Canada Dollar"},{code:"CDF",name:"Congo/Kinshasa Franc"},{code:"CHF",name:"Switzerland Franc"},{code:"CLP",name:"Chile Peso"},{code:"CNY",name:"China Yuan Renminbi"},{code:"COP",name:"Colombia Peso"},{code:"CRC",name:"Costa Rica Colon"},{code:"CUC",name:"Cuba Convertible Peso"},{code:"CUP",name:"Cuba Peso"},{code:"CVE",name:"Cape Verde Escudo"},{code:"CZK",name:"Czech Republic Koruna"},{code:"DJF",name:"Djibouti Franc"},{code:"DKK",name:"Denmark Krone"},{code:"DOP",name:"Dominican Republic Peso"},{code:"DZD",name:"Algeria Dinar"},{code:"EGP",name:"Egypt Pound"},{code:"ERN",name:"Eritrea Nakfa"},{code:"ETB",name:"Ethiopia Birr"},{code:"EUR",name:"Euro Member Countries"},{code:"FJD",name:"Fiji Dollar"},{code:"FKP",name:"Falkland Islands (Malvinas) Pound"},{code:"GBP",name:"United Kingdom Pound"},{code:"GEL",name:"Georgia Lari"},{code:"GGP",name:"Guernsey Pound"},{code:"GHS",name:"Ghana Cedi"},{code:"GIP",name:"Gibraltar Pound"},{code:"GMD",name:"Gambia Dalasi"},{code:"GNF",name:"Guinea Franc"},{code:"GTQ",name:"Guatemala Quetzal"},{code:"GYD",name:"Guyana Dollar"},{code:"HKD",name:"Hong Kong Dollar"},{code:"HNL",name:"Honduras Lempira"},{code:"HRK",name:"Croatia Kuna"},{code:"HTG",name:"Haiti Gourde"},{code:"HUF",name:"Hungary Forint"},{code:"IDR",name:"Indonesia Rupiah"},{code:"ILS",name:"Israel Shekel"},{code:"IMP",name:"Isle of Man Pound"},{code:"INR",name:"India Rupee"},{code:"IQD",name:"Iraq Dinar"},{code:"IRR",name:"Iran Rial"},{code:"ISK",name:"Iceland Krona"},{code:"JEP",name:"Jersey Pound"},{code:"JMD",name:"Jamaica Dollar"},{code:"JOD",name:"Jordan Dinar"},{code:"JPY",name:"Japan Yen"},{code:"KES",name:"Kenya Shilling"},{code:"KGS",name:"Kyrgyzstan Som"},{code:"KHR",name:"Cambodia Riel"},{code:"KMF",name:"Comoros Franc"},{code:"KPW",name:"Korea (North) Won"},{code:"KRW",name:"Korea (South) Won"},{code:"KWD",name:"Kuwait Dinar"},{code:"KYD",name:"Cayman Islands Dollar"},{code:"KZT",name:"Kazakhstan Tenge"},{code:"LAK",name:"Laos Kip"},{code:"LBP",name:"Lebanon Pound"},{code:"LKR",name:"Sri Lanka Rupee"},{code:"LRD",name:"Liberia Dollar"},{code:"LSL",name:"Lesotho Loti"},{code:"LTL",name:"Lithuania Litas"},{code:"LYD",name:"Libya Dinar"},{code:"MAD",name:"Morocco Dirham"},{code:"MDL",name:"Moldova Leu"},{code:"MGA",name:"Madagascar Ariary"},{code:"MKD",name:"Macedonia Denar"},{code:"MMK",name:"Myanmar (Burma) Kyat"},{code:"MNT",name:"Mongolia Tughrik"},{code:"MOP",name:"Macau Pataca"},{code:"MRO",name:"Mauritania Ouguiya"},{code:"MUR",name:"Mauritius Rupee"},{code:"MVR",name:"Maldives (Maldive Islands) Rufiyaa"},{code:"MWK",name:"Malawi Kwacha"},{code:"MXN",name:"Mexico Peso"},{code:"MYR",name:"Malaysia Ringgit"},{code:"MZN",name:"Mozambique Metical"},{code:"NAD",name:"Namibia Dollar"},{code:"NGN",name:"Nigeria Naira"},{code:"NIO",name:"Nicaragua Cordoba"},{code:"NOK",name:"Norway Krone"},{code:"NPR",name:"Nepal Rupee"},{code:"NZD",name:"New Zealand Dollar"},{code:"OMR",name:"Oman Rial"},{code:"PAB",name:"Panama Balboa"},{code:"PEN",name:"Peru Nuevo Sol"},{code:"PGK",name:"Papua New Guinea Kina"},{code:"PHP",name:"Philippines Peso"},{code:"PKR",name:"Pakistan Rupee"},{code:"PLN",name:"Poland Zloty"},{code:"PYG",name:"Paraguay Guarani"},{code:"QAR",name:"Qatar Riyal"},{code:"RON",name:"Romania New Leu"},{code:"RSD",name:"Serbia Dinar"},{code:"RUB",name:"Russia Ruble"},{code:"RWF",name:"Rwanda Franc"},{code:"SAR",name:"Saudi Arabia Riyal"},{code:"SBD",name:"Solomon Islands Dollar"},{code:"SCR",name:"Seychelles Rupee"},{code:"SDG",name:"Sudan Pound"},{code:"SEK",name:"Sweden Krona"},{code:"SGD",name:"Singapore Dollar"},{code:"SHP",name:"Saint Helena Pound"},{code:"SLL",name:"Sierra Leone Leone"},{code:"SOS",name:"Somalia Shilling"},{code:"SPL",name:"Seborga Luigino"},{code:"SRD",name:"Suriname Dollar"},{code:"STD",name:"São Tomé and Príncipe Dobra"},{code:"SVC",name:"El Salvador Colon"},{code:"SYP",name:"Syria Pound"},{code:"SZL",name:"Swaziland Lilangeni"},{code:"THB",name:"Thailand Baht"},{code:"TJS",name:"Tajikistan Somoni"},{code:"TMT",name:"Turkmenistan Manat"},{code:"TND",name:"Tunisia Dinar"},{code:"TOP",name:"Tonga Pa'anga"},{code:"TRY",name:"Turkey Lira"},{code:"TTD",name:"Trinidad and Tobago Dollar"},{code:"TVD",name:"Tuvalu Dollar"},{code:"TWD",name:"Taiwan New Dollar"},{code:"TZS",name:"Tanzania Shilling"},{code:"UAH",name:"Ukraine Hryvnia"},{code:"UGX",name:"Uganda Shilling"},{code:"USD",name:"United States Dollar"},{code:"UYU",name:"Uruguay Peso"},{code:"UZS",name:"Uzbekistan Som"},{code:"VEF",name:"Venezuela Bolivar"},{code:"VND",name:"Viet Nam Dong"},{code:"VUV",name:"Vanuatu Vatu"},{code:"WST",name:"Samoa Tala"},{code:"XAF",name:"Communauté Financière Africaine (BEAC) CFA Franc BEAC"},{code:"XCD",name:"East Caribbean Dollar"},{code:"XDR",name:"International Monetary Fund (IMF) Special Drawing Rights"},{code:"XOF",name:"Communauté Financière Africaine (BCEAO) Franc"},{code:"XPF",name:"Comptoirs Français du Pacifique (CFP) Franc"},{code:"YER",name:"Yemen Rial"},{code:"ZAR",name:"South Africa Rand"},{code:"ZMW",name:"Zambia Kwacha"},{code:"ZWD",name:"Zimbabwe Dollar"}]},v=Object.prototype.hasOwnProperty,y=Object.keys||function(a){var e=[]; +for(var n in a)v.call(a,n)&&e.push(n);return e};a.prototype.get=function(a){return o(p[a])},a.prototype.mac_address=function(a){a=e(a),a.separator||(a.separator=a.networkVersion?".":":");var n="ABCDEF1234567890",i="";return i=a.networkVersion?this.n(this.string,3,{pool:n,length:4}).join(a.separator):this.n(this.string,6,{pool:n,length:2}).join(a.separator)},a.prototype.normal=function(a){a=e(a,{mean:0,dev:1});var n,i,t,r,o=a.mean,s=a.dev;do i=2*this.random()-1,t=2*this.random()-1,n=i*i+t*t;while(n>=1);return r=i*Math.sqrt(-2*Math.log(n)/n),s*r+o},a.prototype.radio=function(a){a=e(a,{side:"?"});var n="";switch(a.side.toLowerCase()){case"east":case"e":n="W";break;case"west":case"w":n="K";break;default:n=this.character({pool:"KW"})}return n+this.character({alpha:!0,casing:"upper"})+this.character({alpha:!0,casing:"upper"})+this.character({alpha:!0,casing:"upper"})},a.prototype.set=function(a,e){"string"==typeof a?p[a]=e:p=o(a,p)},a.prototype.tv=function(a){return this.radio(a)},a.prototype.cnpj=function(){var a=this.n(this.natural,8,{max:9}),e=2+6*a[7]+7*a[6]+8*a[5]+9*a[4]+2*a[3]+3*a[2]+4*a[1]+5*a[0];e=11-e%11,e>=10&&(e=0);var n=2*e+3+7*a[7]+8*a[6]+9*a[5]+2*a[4]+3*a[3]+4*a[2]+5*a[1]+6*a[0];return n=11-n%11,n>=10&&(n=0),""+a[0]+a[1]+"."+a[2]+a[3]+a[4]+"."+a[5]+a[6]+a[7]+"/0001-"+e+n},a.prototype.mersenne_twister=function(a){return new g(a)};var g=function(a){void 0===a&&(a=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(a)};g.prototype.init_genrand=function(a){for(this.mt[0]=a>>>0,this.mti=1;this.mti<this.N;this.mti++)a=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30,this.mt[this.mti]=(1812433253*((4294901760&a)>>>16)<<16)+1812433253*(65535&a)+this.mti,this.mt[this.mti]>>>=0},g.prototype.init_by_array=function(a,e){var n,i,t=1,r=0;for(this.init_genrand(19650218),n=this.N>e?this.N:e;n;n--)i=this.mt[t-1]^this.mt[t-1]>>>30,this.mt[t]=(this.mt[t]^(1664525*((4294901760&i)>>>16)<<16)+1664525*(65535&i))+a[r]+r,this.mt[t]>>>=0,t++,r++,t>=this.N&&(this.mt[0]=this.mt[this.N-1],t=1),r>=e&&(r=0);for(n=this.N-1;n;n--)i=this.mt[t-1]^this.mt[t-1]>>>30,this.mt[t]=(this.mt[t]^(1566083941*((4294901760&i)>>>16)<<16)+1566083941*(65535&i))-t,this.mt[t]>>>=0,t++,t>=this.N&&(this.mt[0]=this.mt[this.N-1],t=1);this.mt[0]=2147483648},g.prototype.genrand_int32=function(){var a,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti===this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)a=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^a>>>1^e[1&a];for(;n<this.N-1;n++)a=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^a>>>1^e[1&a];a=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^a>>>1^e[1&a],this.mti=0}return a=this.mt[this.mti++],a^=a>>>11,a^=a<<7&2636928640,a^=a<<15&4022730752,a^=a>>>18,a>>>0},g.prototype.genrand_int31=function(){return this.genrand_int32()>>>1},g.prototype.genrand_real1=function(){return this.genrand_int32()*(1/4294967295)},g.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},g.prototype.genrand_real3=function(){return(this.genrand_int32()+.5)*(1/4294967296)},g.prototype.genrand_res53=function(){var a=this.genrand_int32()>>>5,e=this.genrand_int32()>>>6;return(67108864*a+e)*(1/9007199254740992)},"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(exports=module.exports=a),exports.Chance=a),"function"==typeof define&&define.amd&&define([],function(){return a}),"undefined"!=typeof importScripts&&(chance=new a),"object"==typeof window&&"object"==typeof window.document&&(window.Chance=a,window.chance=new a)}()}(); + +!function(){require=function t(e,n,r){function i(a,f){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!f&&u)return u(a,!0);if(o)return o(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){var n=e[a][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e,n){var r=t("./web3");BigNumber.config({ROUNDING_MODE:BigNumber.ROUND_DOWN});var i=32,o=4,a=function(t,e){for(var n=!1,r=0;r<t.length&&!n;r++)n=e(t[r]);return n?r-1:-1},f=function(t,e){return a(t,function(t){return t.name===e})},u=function(t,e){var n=f(t,e);return-1===n?void console.error("method "+e+" not found in the abi"):t[n]},s=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},c=function(t){return function(e){return 0===e.indexOf(t)}},l=function(t){return function(e){return t===e}},h=function(t){return"[]"===t.slice(-2)},p=function(t){var e=2*i;return t instanceof BigNumber||"number"==typeof t?("number"==typeof t&&(t=new BigNumber(t)),t=t.round(),t.lessThan(0)&&(t=new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1)),t=t.toString(16)):t=0===t.indexOf("0x")?t.substr(2):"string"==typeof t?p(new BigNumber(t)):(+t).toString(16),s(t,e)},d=function(t){return r.fromAscii(t,i).substr(2)},m=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},g=function(t){return p(new BigNumber(t).times(new BigNumber(2).pow(128)))},v=function(t,e){return h(t)||"string"===t?p(e.length):""},b=function(){return[{type:c("uint"),format:p},{type:c("int"),format:p},{type:c("hash"),format:p},{type:c("string"),format:d},{type:c("real"),format:g},{type:c("ureal"),format:g},{type:l("address"),format:p},{type:l("bool"),format:m}]},y=b(),_=function(t,e,n){var r="",o=u(t,e),a=2*i;return o.inputs.forEach(function(t,e){r+=v(t.type,n[e])}),o.inputs.forEach(function(t,e){for(var i=!1,a=0;a<y.length&&!i;a++)i=y[a].type(o.inputs[e].type,n[e]);i||console.error("input parser does not support type: "+o.inputs[e].type);var f=y[a-1].format,u="";u=h(o.inputs[e].type)?n[e].reduce(function(t,e){return t+f(e)},""):f(n[e]),r+=u}),r},w=function(t){return"1"===new BigNumber(t.substr(0,1),16).toString(2).substr(0,1)},N=function(t){return t=t||"0",w(t)?new BigNumber(t,16).minus(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new BigNumber(t,16)},x=function(t){return t=t||"0",new BigNumber(t,16)},B=function(t){return N(t).dividedBy(new BigNumber(2).pow(128))},A=function(t){return x(t).dividedBy(new BigNumber(2).pow(128))},S=function(t){return"0x"+t},O=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},P=function(t){return r.toAscii(t)},E=function(t){return"0x"+t.slice(t.length-40,t.length)},k=function(t){return h(t)||"string"===t?2*i:0},F=function(){return[{type:c("uint"),format:x},{type:c("int"),format:N},{type:c("hash"),format:S},{type:c("string"),format:P},{type:c("real"),format:B},{type:c("ureal"),format:A},{type:l("address"),format:E},{type:l("bool"),format:O}]},T=F(),M=function(t,e,n){n=n.slice(2);var r=[],o=u(t,e),a=2*i,f=o.outputs.reduce(function(t,e){return t+k(e.type)},0),s=n.slice(0,f);return n=n.slice(f),o.outputs.forEach(function(t,e){for(var i=!1,f=0;f<T.length&&!i;f++)i=T[f].type(o.outputs[e].type);i||console.error("output parser does not support type: "+o.outputs[e].type);var u=T[f-1].format;if(h(o.outputs[e].type)){var l=x(s.slice(0,a));s=s.slice(a);for(var p=[],d=0;l>d;d++)p.push(u(n.slice(0,a))),n=n.slice(a);r.push(p)}else c("string")(o.outputs[e].type)?(s=s.slice(a),r.push(u(n.slice(0,a))),n=n.slice(a)):(r.push(u(n.slice(0,a))),n=n.slice(a))}),r},D=function(t){var e=t.indexOf("(");return-1!==e?t.substr(0,e):t},C=function(t){var e=t.indexOf("(");return-1!==e?t.substr(e+1,t.length-1-(e+1)):""},q=function(t){var e={};return t.forEach(function(n){var r=D(n.name),i=C(n.name),o=function(){var e=Array.prototype.slice.call(arguments);return _(t,n.name,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},I=function(t){var e={};return t.forEach(function(n){var r=D(n.name),i=C(n.name),o=function(e){return M(t,n.name,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},G=function(t){return r.sha3(r.fromAscii(t)).slice(0,2+2*o)};e.exports={inputParser:q,outputParser:I,methodSignature:G,methodDisplayName:D,methodTypeName:C,getMethodWithName:u}},{"./web3":7}],2:[function(t,e,n){var r=t("./web3"),i=t("./abi"),o=function(t,e){e.forEach(function(t){if(-1===t.name.indexOf("(")){var e=t.name,n=t.inputs.map(function(t){return t.type}).join();t.name=e+"("+n+")"}});var n=i.inputParser(e),o=i.outputParser(e),a={};return a.call=function(t){return a._isTransact=!1,a._options=t,a},a.transact=function(t){return a._isTransact=!0,a._options=t,a},a._options={},["gas","gasPrice","value","from"].forEach(function(t){a[t]=function(e){return a._options[t]=e,a}}),e.forEach(function(f){var u=i.methodDisplayName(f.name),s=i.methodTypeName(f.name),c=function(){var c=Array.prototype.slice.call(arguments),l=i.methodSignature(f.name),h=n[u][s].apply(null,c),p=a._options||{};p.to=t,p.data=l+h;var d=a._isTransact===!0||a._isTransact!==!1&&!f.constant,m=p.collapse!==!1;if(a._options={},a._isTransact=null,d)return r._currentContractAbi=e,r._currentContractAddress=t,r._currentContractMethodName=f.name,r._currentContractMethodParams=c,void r.eth.transact(p);var g=r.eth.call(p),v=o[u][s](g);return m&&(1===v.length?v=v[0]:0===v.length&&(v=null)),v};void 0===a[u]&&(a[u]=c),a[u][s]=c}),a};e.exports=o},{"./abi":1,"./web3":7}],3:[function(t,e,n){var r=t("./web3"),i=function(t,e){this.impl=e,this.callbacks=[],this.id=e.newFilter(t),r.provider.startPolling({call:e.changed,args:[this.id]},this.id,this.trigger.bind(this))};i.prototype.arrived=function(t){this.changed(t)},i.prototype.changed=function(t){this.callbacks.push(t)},i.prototype.trigger=function(t){for(var e=0;e<this.callbacks.length;e++)for(var n=0;n<t.length;n++)this.callbacks[e].call(this,t[n])},i.prototype.uninstall=function(){this.impl.uninstallFilter(this.id),r.provider.stopPolling(this.id)},i.prototype.messages=function(){return this.impl.getMessages(this.id)},i.prototype.logs=function(){return this.messages()},e.exports=i},{"./web3":7}],4:[function(t,e,n){function r(t){return{jsonrpc:"2.0",method:t.call,params:t.args,id:t._id}}function i(t){var e=JSON.parse(t);return{_id:e.id,data:e.result,error:e.error}}var o=function(t){this.handlers=[],this.host=t||"http://localhost:8080"};o.prototype.send=function(t){var e=r(t),n=new XMLHttpRequest;return n.open("POST",this.host,!1),n.send(JSON.stringify(e)),n.responseText},e.exports=o},{}],5:[function(t,e,n){var r=t("./web3"),i=function(){this.polls=[],this.provider=void 0,this.id=1;var t=this,e=function(){t.provider&&t.polls.forEach(function(e){e.data._id=t.id,t.id++;var n=t.provider.send(e.data);n=JSON.parse(n),!n.error&&n.result instanceof Array&&0!==n.result.length&&e.callback(n.result)}),setTimeout(e,1e3)};e()};i.prototype.send=function(t){if(t.args=t.args||[],t._id=this.id++,void 0===this.provider)return console.error("provider is not set"),null;var e=this.provider.send(t);return e=JSON.parse(e),e.error?(console.log(e.error),null):e.result},i.prototype.set=function(t){this.provider=t},i.prototype.startPolling=function(t,e,n){this.polls.push({data:t,id:e,callback:n})},i.prototype.stopPolling=function(t){for(var e=this.polls.length;e--;){var n=this.polls[e];n.id===t&&this.polls.splice(e,1)}},e.exports=i},{"./web3":7}],6:[function(t,e,n){var r=function(){};r.prototype.send=function(t){return navigator.qt.callMethod(JSON.stringify(t))},e.exports=r},{}],7:[function(t,e,n){var r=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"],i=function(){return[{name:"sha3",call:"web3_sha3"}]},o=function(){var t=function(t){return"string"==typeof t[0]?"eth_blockByHash":"eth_blockByNumber"},e=function(t){return"string"==typeof t[0]?"eth_transactionByHash":"eth_transactionByNumber"},n=function(t){return"string"==typeof t[0]?"eth_uncleByHash":"eth_uncleByNumber"},r=[{name:"balanceAt",call:"eth_balanceAt"},{name:"stateAt",call:"eth_stateAt"},{name:"storageAt",call:"eth_storageAt"},{name:"countAt",call:"eth_countAt"},{name:"codeAt",call:"eth_codeAt"},{name:"transact",call:"eth_transact"},{name:"call",call:"eth_call"},{name:"block",call:t},{name:"transaction",call:e},{name:"uncle",call:n},{name:"compilers",call:"eth_compilers"},{name:"flush",call:"eth_flush"},{name:"lll",call:"eth_lll"},{name:"solidity",call:"eth_solidity"},{name:"serpent",call:"eth_serpent"},{name:"logs",call:"eth_logs"}];return r},a=function(){return[{name:"coinbase",getter:"eth_coinbase",setter:"eth_setCoinbase"},{name:"listening",getter:"eth_listening",setter:"eth_setListening"},{name:"mining",getter:"eth_mining",setter:"eth_setMining"},{name:"gasPrice",getter:"eth_gasPrice"},{name:"accounts",getter:"eth_accounts"},{name:"peerCount",getter:"eth_peerCount"},{name:"defaultBlock",getter:"eth_defaultBlock",setter:"eth_setDefaultBlock"},{name:"number",getter:"eth_number"}]},f=function(){return[{name:"put",call:"db_put"},{name:"get",call:"db_get"},{name:"putString",call:"db_putString"},{name:"getString",call:"db_getString"}]},u=function(){return[{name:"post",call:"shh_post"},{name:"newIdentity",call:"shh_newIdentity"},{name:"haveIdentity",call:"shh_haveIdentity"},{name:"newGroup",call:"shh_newGroup"},{name:"addToGroup",call:"shh_addToGroup"}]},s=function(){var t=function(t){return"string"==typeof t[0]?"eth_newFilterString":"eth_newFilter"};return[{name:"newFilter",call:t},{name:"uninstallFilter",call:"eth_uninstallFilter"},{name:"getMessages",call:"eth_filterLogs"}]},c=function(){return[{name:"newFilter",call:"shh_newFilter"},{name:"uninstallFilter",call:"shh_uninstallFilter"},{name:"getMessages",call:"shh_getMessages"}]},l=function(t,e){e.forEach(function(e){t[e.name]=function(){var t=Array.prototype.slice.call(arguments),n="function"==typeof e.call?e.call(t):e.call;return p.provider.send({call:n,args:t})}})},h=function(t,e){e.forEach(function(e){var n={};n.get=function(){return p.provider.send({call:e.getter})},e.setter&&(n.set=function(t){return p.provider.send({call:e.setter,args:[t]})}),Object.defineProperty(t,e.name,n)})},p={_callbacks:{},_events:{},providers:{},toHex:function(t){for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n).toString(16);e+=r.length<2?"0"+r:r}return e},toAscii:function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var i=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}return e},fromAscii:function(t,e){e=void 0===e?0:e;for(var n=this.toHex(t);n.length<2*e;)n+="00";return"0x"+n},toDecimal:function(t){return t=t.length>2?t.substring(2):"0",new BigNumber(t,16).toString(10)},fromDecimal:function(t){return"0x"+new BigNumber(t).toString(16)},toEth:function(t){for(var e="string"==typeof t?0===t.indexOf("0x")?parseInt(t.substr(2),16):parseInt(t):t,n=0,i=r;e>3e3&&n<i.length-1;)e/=1e3,n++;for(var o=e.toString().length<e.toFixed(2).length?e.toString():e.toFixed(2),a=function(t,e,n){return e+","+n};;){var f=o;if(o=o.replace(/(\d)(\d\d\d[\.\,])/,a),f===o)break}return o+" "+i[n]},eth:{contractFromAbi:function(t){return function(e){e=e||"0xc6d9d2cd449a754c494264e1809c50e34d64562b";var n=p.eth.contract(e,t);return n.address=e,n}},watch:function(t){return new p.filter(t,d)}},db:{},shh:{watch:function(t){return new p.filter(t,m)}},haveProvider:function(){return!!p.provider.provider}};l(p,i()),l(p.eth,o()),h(p.eth,a()),l(p.db,f()),l(p.shh,u());var d={changed:"eth_changed"};l(d,s());var m={changed:"shh_changed"};l(m,c()),p.setProvider=function(t){p.provider.set(t)},e.exports=p},{}],web3:[function(t,e,n){var r=t("./lib/web3"),i=t("./lib/providermanager");r.provider=new i,r.filter=t("./lib/filter"),r.providers.HttpSyncProvider=t("./lib/httpsync"),r.providers.QtSyncProvider=t("./lib/qtsync"),r.eth.contract=t("./lib/contract"),r.abi=t("./lib/abi"),e.exports=r},{"./lib/abi":1,"./lib/contract":2,"./lib/filter":3,"./lib/httpsync":4,"./lib/providermanager":5,"./lib/qtsync":6,"./lib/web3":7}]},{},["web3"])}(); + +!function(){!function(t){if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else{var r;"undefined"!=typeof window?r=window:"undefined"!=typeof global?r=global:"undefined"!=typeof self&&(r=self),r.GeoPattern=t()}}(function(){return function t(r,s,e){function i(o,a){if(!s[o]){if(!r[o]){var h="function"==typeof require&&require;if(!a&&h)return h(o,!0);if(n)return n(o,!0);throw new Error("Cannot find module '"+o+"'")}var l=s[o]={exports:{}};r[o][0].call(l.exports,function(t){var s=r[o][1][t];return i(s?s:t)},l,l.exports,t,r,s,e)}return s[o].exports}for(var n="function"==typeof require&&require,o=0;o<e.length;o++)i(e[o]);return i}({1:[function(t,r){r.exports=t("./lib/")},{"./lib/":3}],2:[function(t,r){"use strict";function s(t){var r=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(r,function(t,r,s,e){return r+r+s+s+e+e});var s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return s?{r:parseInt(s[1],16),g:parseInt(s[2],16),b:parseInt(s[3],16)}:null}function e(t){return"#"+["r","g","b"].map(function(r){return("0"+t[r].toString(16)).slice(-2)}).join("")}function i(t){var r=t.r,s=t.g,e=t.b;r/=255,s/=255,e/=255;var i,n,o=Math.max(r,s,e),a=Math.min(r,s,e),h=(o+a)/2;if(o===a)i=n=0;else{var l=o-a;switch(n=h>.5?l/(2-o-a):l/(o+a),o){case r:i=(s-e)/l+(e>s?6:0);break;case s:i=(e-r)/l+2;break;case e:i=(r-s)/l+4}i/=6}return{h:i,s:n,l:h}}function n(t){function r(t,r,s){return 0>s&&(s+=1),s>1&&(s-=1),1/6>s?t+6*(r-t)*s:.5>s?r:2/3>s?t+(r-t)*(2/3-s)*6:t}var s,e,i,n=t.h,o=t.s,a=t.l;if(0===o)s=e=i=a;else{var h=.5>a?a*(1+o):a+o-a*o,l=2*a-h;s=r(l,h,n+1/3),e=r(l,h,n),i=r(l,h,n-1/3)}return{r:Math.round(255*s),g:Math.round(255*e),b:Math.round(255*i)}}r.exports={hex2rgb:s,rgb2hex:e,rgb2hsl:i,hsl2rgb:n,rgb2rgbString:function(t){return"rgb("+[t.r,t.g,t.b].join(",")+")"}}},{}],3:[function(t,r){!function(s){"use strict";function e(t){return function(r,s){return"object"==typeof r&&(s=r,r=null),(null===r||void 0===r)&&(r=(new Date).toString()),s||(s={}),t.call(this,r,s)}}var i=t("./pattern"),n=r.exports={generate:e(function(t,r){return new i(t,r)})};s&&(s.fn.geopattern=e(function(t,r){return this.each(function(){var e=s(this).attr("data-title-sha");e&&(r=s.extend({hash:e},r));var i=n.generate(t,r);s(this).css("background-image",i.toDataUrl())})}))}("undefined"!=typeof jQuery?jQuery:null)},{"./pattern":4}],4:[function(t,r){(function(s){"use strict";function e(t,r,s){return parseInt(t.substr(r,s||1),16)}function i(t,r,s,e,i){var n=parseFloat(t),o=s-r,a=i-e;return(n-r)*a/o+e}function n(t){return t%2===0?C:j}function o(t){return i(t,0,15,M,W)}function a(t){var r=t,s=r/2,e=Math.sin(60*Math.PI/180)*r;return[0,e,s,0,s+r,0,2*r,e,s+r,2*e,s,2*e,0,e].join(",")}function h(t,r){var s=.66*r;return[[0,0,t/2,r-s,t/2,r,0,s,0,0],[t/2,r-s,t,0,t,s,t/2,r,t/2,r-s]].map(function(t){return t.join(",")})}function l(t){return[[t,0,t,3*t],[0,t,3*t,t]]}function c(t){var r=t,s=.33*r;return[s,0,r-s,0,r,s,r,r-s,r-s,r,s,r,0,r-s,0,s,s,0].join(",")}function f(t,r){var s=t/2;return[s,0,t,r,0,r,s,0].join(",")}function u(t,r){return[t/2,0,t,r/2,t/2,r,0,r/2].join(",")}function p(t){return[0,0,t,t,0,t,0,0].join(",")}function g(t,r,s,e,i){var a=p(e),h=o(i[0]),l=n(i[0]),c={stroke:S,"stroke-opacity":A,"fill-opacity":h,fill:l};t.polyline(a,c).transform({translate:[r+e,s],scale:[-1,1]}),t.polyline(a,c).transform({translate:[r+e,s+2*e],scale:[1,-1]}),h=o(i[1]),l=n(i[1]),c={stroke:S,"stroke-opacity":A,"fill-opacity":h,fill:l},t.polyline(a,c).transform({translate:[r+e,s+2*e],scale:[-1,-1]}),t.polyline(a,c).transform({translate:[r+e,s],scale:[1,1]})}function v(t,r,s,e,i){var a=o(i),h=n(i),l=p(e),c={stroke:S,"stroke-opacity":A,"fill-opacity":a,fill:h};t.polyline(l,c).transform({translate:[r,s+e],scale:[1,-1]}),t.polyline(l,c).transform({translate:[r+2*e,s+e],scale:[-1,-1]}),t.polyline(l,c).transform({translate:[r,s+e],scale:[1,1]}),t.polyline(l,c).transform({translate:[r+2*e,s+e],scale:[-1,1]})}function y(t,r){var s=t/2;return[0,0,r,s,0,t,0,0].join(",")}var d=t("extend"),b=t("./color"),m=t("./sha1"),k=t("./svg"),x={baseColor:"#933c3c"},w=["octogons","overlappingCircles","plusSigns","xes","sineWaves","hexagons","overlappingRings","plaid","triangles","squares","concentricCircles","diamonds","tessellation","nestedSquares","mosaicSquares","chevrons"],j="#222",C="#ddd",S="#000",A=.02,M=.02,W=.15,H=r.exports=function(t,r){return this.opts=d({},x,r),this.hash=r.hash||m(t),this.svg=new k,this.generateBackground(),this.generatePattern(),this};H.prototype.toSvg=function(){return this.svg.toString()},H.prototype.toString=function(){return this.toSvg()},H.prototype.toBase64=function(){var t,r=this.toSvg();return t="undefined"!=typeof window&&"function"==typeof window.btoa?window.btoa(r):new s(r).toString("base64")},H.prototype.toDataUri=function(){return"data:image/svg+xml;base64,"+this.toBase64()},H.prototype.toDataUrl=function(){return'url("'+this.toDataUri()+'")'},H.prototype.generateBackground=function(){var t,r,s,n;this.opts.color?s=b.hex2rgb(this.opts.color):(r=i(e(this.hash,14,3),0,4095,0,359),n=e(this.hash,17),t=b.rgb2hsl(b.hex2rgb(this.opts.baseColor)),t.h=(360*t.h-r+360)%360/360,t.s=n%2===0?Math.min(1,(100*t.s+n)/100):Math.max(0,(100*t.s-n)/100),s=b.hsl2rgb(t)),this.color=b.rgb2hex(s),this.svg.rect(0,0,"100%","100%",{fill:b.rgb2rgbString(s)})},H.prototype.generatePattern=function(){var t=this.opts.generator;if(t){if(w.indexOf(t)<0)throw new Error("The generator "+t+" does not exist.")}else t=w[e(this.hash,20)];return this["geo"+t.slice(0,1).toUpperCase()+t.slice(1)]()},H.prototype.geoHexagons=function(){var t,r,s,h,l,c,f,u,p=e(this.hash,0),g=i(p,0,15,8,60),v=g*Math.sqrt(3),y=2*g,d=a(g);for(this.svg.setWidth(3*y+3*g),this.svg.setHeight(6*v),s=0,u=0;6>u;u++)for(f=0;6>f;f++)c=e(this.hash,s),t=f%2===0?u*v:u*v+v/2,h=o(c),r=n(c),l={fill:r,"fill-opacity":h,stroke:S,"stroke-opacity":A},this.svg.polyline(d,l).transform({translate:[f*g*1.5-y/2,t-v/2]}),0===f&&this.svg.polyline(d,l).transform({translate:[6*g*1.5-y/2,t-v/2]}),0===u&&(t=f%2===0?6*v:6*v+v/2,this.svg.polyline(d,l).transform({translate:[f*g*1.5-y/2,t-v/2]})),0===f&&0===u&&this.svg.polyline(d,l).transform({translate:[6*g*1.5-y/2,5*v+v/2]}),s++},H.prototype.geoSineWaves=function(){var t,r,s,a,h,l,c,f=Math.floor(i(e(this.hash,0),0,15,100,400)),u=Math.floor(i(e(this.hash,1),0,15,30,100)),p=Math.floor(i(e(this.hash,2),0,15,3,30));for(this.svg.setWidth(f),this.svg.setHeight(36*p),r=0;36>r;r++)l=e(this.hash,r),s=o(l),t=n(l),c=f/4*.7,h={fill:"none",stroke:t,opacity:s,"stroke-width":""+p+"px"},a="M0 "+u+" C "+c+" 0, "+(f/2-c)+" 0, "+f/2+" "+u+" S "+(f-c)+" "+2*u+", "+f+" "+u+" S "+(1.5*f-c)+" 0, "+1.5*f+", "+u,this.svg.path(a,h).transform({translate:[-f/4,p*r-1.5*u]}),this.svg.path(a,h).transform({translate:[-f/4,p*r-1.5*u+36*p]})},H.prototype.geoChevrons=function(){var t,r,s,a,l,c,f,u=i(e(this.hash,0),0,15,30,80),p=i(e(this.hash,0),0,15,30,80),g=h(u,p);for(this.svg.setWidth(6*u),this.svg.setHeight(6*p*.66),r=0,f=0;6>f;f++)for(c=0;6>c;c++)l=e(this.hash,r),s=o(l),t=n(l),a={stroke:S,"stroke-opacity":A,fill:t,"fill-opacity":s,"stroke-width":1},this.svg.group(a).transform({translate:[c*u,f*p*.66-p/2]}).polyline(g).end(),0===f&&this.svg.group(a).transform({translate:[c*u,6*p*.66-p/2]}).polyline(g).end(),r+=1},H.prototype.geoPlusSigns=function(){var t,r,s,a,h,c,f,u,p=i(e(this.hash,0),0,15,10,25),g=3*p,v=l(p);for(this.svg.setWidth(12*p),this.svg.setHeight(12*p),s=0,u=0;6>u;u++)for(f=0;6>f;f++)c=e(this.hash,s),a=o(c),r=n(c),t=u%2===0?0:1,h={fill:r,stroke:S,"stroke-opacity":A,"fill-opacity":a},this.svg.group(h).transform({translate:[f*g-f*p+t*p-p,u*g-u*p-g/2]}).rect(v).end(),0===f&&this.svg.group(h).transform({translate:[4*g-f*p+t*p-p,u*g-u*p-g/2]}).rect(v).end(),0===u&&this.svg.group(h).transform({translate:[f*g-f*p+t*p-p,4*g-u*p-g/2]}).rect(v).end(),0===f&&0===u&&this.svg.group(h).transform({translate:[4*g-f*p+t*p-p,4*g-u*p-g/2]}).rect(v).end(),s++},H.prototype.geoXes=function(){var t,r,s,a,h,c,f,u,p=i(e(this.hash,0),0,15,10,25),g=l(p),v=3*p*.943;for(this.svg.setWidth(3*v),this.svg.setHeight(3*v),s=0,u=0;6>u;u++)for(f=0;6>f;f++)c=e(this.hash,s),a=o(c),t=f%2===0?u*v-.5*v:u*v-.5*v+v/4,r=n(c),h={fill:r,opacity:a},this.svg.group(h).transform({translate:[f*v/2-v/2,t-u*v/2],rotate:[45,v/2,v/2]}).rect(g).end(),0===f&&this.svg.group(h).transform({translate:[6*v/2-v/2,t-u*v/2],rotate:[45,v/2,v/2]}).rect(g).end(),0===u&&(t=f%2===0?6*v-v/2:6*v-v/2+v/4,this.svg.group(h).transform({translate:[f*v/2-v/2,t-6*v/2],rotate:[45,v/2,v/2]}).rect(g).end()),5===u&&this.svg.group(h).transform({translate:[f*v/2-v/2,t-11*v/2],rotate:[45,v/2,v/2]}).rect(g).end(),0===f&&0===u&&this.svg.group(h).transform({translate:[6*v/2-v/2,t-6*v/2],rotate:[45,v/2,v/2]}).rect(g).end(),s++},H.prototype.geoOverlappingCircles=function(){var t,r,s,a,h,l,c,f=e(this.hash,0),u=i(f,0,15,25,200),p=u/2;for(this.svg.setWidth(6*p),this.svg.setHeight(6*p),r=0,c=0;6>c;c++)for(l=0;6>l;l++)h=e(this.hash,r),s=o(h),t=n(h),a={fill:t,opacity:s},this.svg.circle(l*p,c*p,p,a),0===l&&this.svg.circle(6*p,c*p,p,a),0===c&&this.svg.circle(l*p,6*p,p,a),0===l&&0===c&&this.svg.circle(6*p,6*p,p,a),r++},H.prototype.geoOctogons=function(){var t,r,s,a,h,l,f=i(e(this.hash,0),0,15,10,60),u=c(f);for(this.svg.setWidth(6*f),this.svg.setHeight(6*f),r=0,l=0;6>l;l++)for(h=0;6>h;h++)a=e(this.hash,r),s=o(a),t=n(a),this.svg.polyline(u,{fill:t,"fill-opacity":s,stroke:S,"stroke-opacity":A}).transform({translate:[h*f,l*f]}),r+=1},H.prototype.geoSquares=function(){var t,r,s,a,h,l,c=i(e(this.hash,0),0,15,10,60);for(this.svg.setWidth(6*c),this.svg.setHeight(6*c),r=0,l=0;6>l;l++)for(h=0;6>h;h++)a=e(this.hash,r),s=o(a),t=n(a),this.svg.rect(h*c,l*c,c,c,{fill:t,"fill-opacity":s,stroke:S,"stroke-opacity":A}),r+=1},H.prototype.geoConcentricCircles=function(){var t,r,s,a,h,l,c=e(this.hash,0),f=i(c,0,15,10,60),u=f/5;for(this.svg.setWidth(6*(f+u)),this.svg.setHeight(6*(f+u)),r=0,l=0;6>l;l++)for(h=0;6>h;h++)a=e(this.hash,r),s=o(a),t=n(a),this.svg.circle(h*f+h*u+(f+u)/2,l*f+l*u+(f+u)/2,f/2,{fill:"none",stroke:t,opacity:s,"stroke-width":u+"px"}),a=e(this.hash,39-r),s=o(a),t=n(a),this.svg.circle(h*f+h*u+(f+u)/2,l*f+l*u+(f+u)/2,f/4,{fill:t,"fill-opacity":s}),r+=1},H.prototype.geoOverlappingRings=function(){var t,r,s,a,h,l,c,f=e(this.hash,0),u=i(f,0,15,10,60),p=u/4;for(this.svg.setWidth(6*u),this.svg.setHeight(6*u),r=0,c=0;6>c;c++)for(l=0;6>l;l++)h=e(this.hash,r),s=o(h),t=n(h),a={fill:"none",stroke:t,opacity:s,"stroke-width":p+"px"},this.svg.circle(l*u,c*u,u-p/2,a),0===l&&this.svg.circle(6*u,c*u,u-p/2,a),0===c&&this.svg.circle(l*u,6*u,u-p/2,a),0===l&&0===c&&this.svg.circle(6*u,6*u,u-p/2,a),r+=1},H.prototype.geoTriangles=function(){var t,r,s,a,h,l,c,u,p=e(this.hash,0),g=i(p,0,15,15,80),v=g/2*Math.sqrt(3),y=f(g,v);for(this.svg.setWidth(3*g),this.svg.setHeight(6*v),r=0,u=0;6>u;u++)for(c=0;6>c;c++)l=e(this.hash,r),s=o(l),t=n(l),h={fill:t,"fill-opacity":s,stroke:S,"stroke-opacity":A},a=u%2===0?c%2===0?180:0:c%2!==0?180:0,this.svg.polyline(y,h).transform({translate:[c*g*.5-g/2,v*u],rotate:[a,g/2,v/2]}),0===c&&this.svg.polyline(y,h).transform({translate:[6*g*.5-g/2,v*u],rotate:[a,g/2,v/2]}),r+=1},H.prototype.geoDiamonds=function(){var t,r,s,a,h,l,c,f,p=i(e(this.hash,0),0,15,10,50),g=i(e(this.hash,1),0,15,10,50),v=u(p,g);for(this.svg.setWidth(6*p),this.svg.setHeight(3*g),s=0,f=0;6>f;f++)for(c=0;6>c;c++)l=e(this.hash,s),a=o(l),r=n(l),h={fill:r,"fill-opacity":a,stroke:S,"stroke-opacity":A},t=f%2===0?0:p/2,this.svg.polyline(v,h).transform({translate:[c*p-p/2+t,g/2*f-g/2]}),0===c&&this.svg.polyline(v,h).transform({translate:[6*p-p/2+t,g/2*f-g/2]}),0===f&&this.svg.polyline(v,h).transform({translate:[c*p-p/2+t,g/2*6-g/2]}),0===c&&0===f&&this.svg.polyline(v,h).transform({translate:[6*p-p/2+t,g/2*6-g/2]}),s+=1},H.prototype.geoNestedSquares=function(){var t,r,s,a,h,l,c,f=i(e(this.hash,0),0,15,4,12),u=7*f;for(this.svg.setWidth(6*(u+f)+6*f),this.svg.setHeight(6*(u+f)+6*f),r=0,c=0;6>c;c++)for(l=0;6>l;l++)h=e(this.hash,r),s=o(h),t=n(h),a={fill:"none",stroke:t,opacity:s,"stroke-width":f+"px"},this.svg.rect(l*u+l*f*2+f/2,c*u+c*f*2+f/2,u,u,a),h=e(this.hash,39-r),s=o(h),t=n(h),a={fill:"none",stroke:t,opacity:s,"stroke-width":f+"px"},this.svg.rect(l*u+l*f*2+f/2+2*f,c*u+c*f*2+f/2+2*f,3*f,3*f,a),r+=1},H.prototype.geoMosaicSquares=function(){var t,r,s,n=i(e(this.hash,0),0,15,15,50);for(this.svg.setWidth(8*n),this.svg.setHeight(8*n),t=0,s=0;4>s;s++)for(r=0;4>r;r++)r%2===0?s%2===0?v(this.svg,r*n*2,s*n*2,n,e(this.hash,t)):g(this.svg,r*n*2,s*n*2,n,[e(this.hash,t),e(this.hash,t+1)]):s%2===0?g(this.svg,r*n*2,s*n*2,n,[e(this.hash,t),e(this.hash,t+1)]):v(this.svg,r*n*2,s*n*2,n,e(this.hash,t)),t+=1},H.prototype.geoPlaid=function(){var t,r,s,i,a,h,l,c=0,f=0;for(r=0;36>r;)i=e(this.hash,r),c+=i+5,l=e(this.hash,r+1),s=o(l),t=n(l),a=l+5,this.svg.rect(0,c,"100%",a,{opacity:s,fill:t}),c+=a,r+=2;for(r=0;36>r;)i=e(this.hash,r),f+=i+5,l=e(this.hash,r+1),s=o(l),t=n(l),h=l+5,this.svg.rect(f,0,h,"100%",{opacity:s,fill:t}),f+=h,r+=2;this.svg.setWidth(f),this.svg.setHeight(c)},H.prototype.geoTessellation=function(){var t,r,s,a,h,l=i(e(this.hash,0),0,15,5,40),c=l*Math.sqrt(3),f=2*l,u=l/2*Math.sqrt(3),p=y(l,u),g=3*l+2*u,v=2*c+2*l;for(this.svg.setWidth(g),this.svg.setHeight(v),r=0;20>r;r++)switch(h=e(this.hash,r),s=o(h),t=n(h),a={stroke:S,"stroke-opacity":A,fill:t,"fill-opacity":s,"stroke-width":1},r){case 0:this.svg.rect(-l/2,-l/2,l,l,a),this.svg.rect(g-l/2,-l/2,l,l,a),this.svg.rect(-l/2,v-l/2,l,l,a),this.svg.rect(g-l/2,v-l/2,l,l,a);break;case 1:this.svg.rect(f/2+u,c/2,l,l,a);break;case 2:this.svg.rect(-l/2,v/2-l/2,l,l,a),this.svg.rect(g-l/2,v/2-l/2,l,l,a);break;case 3:this.svg.rect(f/2+u,1.5*c+l,l,l,a);break;case 4:this.svg.polyline(p,a).transform({translate:[l/2,-l/2],rotate:[0,l/2,u/2]}),this.svg.polyline(p,a).transform({translate:[l/2,v- -l/2],rotate:[0,l/2,u/2],scale:[1,-1]});break;case 5:this.svg.polyline(p,a).transform({translate:[g-l/2,-l/2],rotate:[0,l/2,u/2],scale:[-1,1]}),this.svg.polyline(p,a).transform({translate:[g-l/2,v+l/2],rotate:[0,l/2,u/2],scale:[-1,-1]});break;case 6:this.svg.polyline(p,a).transform({translate:[g/2+l/2,c/2]});break;case 7:this.svg.polyline(p,a).transform({translate:[g-g/2-l/2,c/2],scale:[-1,1]});break;case 8:this.svg.polyline(p,a).transform({translate:[g/2+l/2,v-c/2],scale:[1,-1]});break;case 9:this.svg.polyline(p,a).transform({translate:[g-g/2-l/2,v-c/2],scale:[-1,-1]});break;case 10:this.svg.polyline(p,a).transform({translate:[l/2,v/2-l/2]});break;case 11:this.svg.polyline(p,a).transform({translate:[g-l/2,v/2-l/2],scale:[-1,1]});break;case 12:this.svg.rect(0,0,l,l,a).transform({translate:[l/2,l/2],rotate:[-30,0,0]});break;case 13:this.svg.rect(0,0,l,l,a).transform({scale:[-1,1],translate:[-g+l/2,l/2],rotate:[-30,0,0]});break;case 14:this.svg.rect(0,0,l,l,a).transform({translate:[l/2,v/2-l/2-l],rotate:[30,0,l]});break;case 15:this.svg.rect(0,0,l,l,a).transform({scale:[-1,1],translate:[-g+l/2,v/2-l/2-l],rotate:[30,0,l]});break;case 16:this.svg.rect(0,0,l,l,a).transform({scale:[1,-1],translate:[l/2,-v+v/2-l/2-l],rotate:[30,0,l]});break;case 17:this.svg.rect(0,0,l,l,a).transform({scale:[-1,-1],translate:[-g+l/2,-v+v/2-l/2-l],rotate:[30,0,l]});break;case 18:this.svg.rect(0,0,l,l,a).transform({scale:[1,-1],translate:[l/2,-v+l/2],rotate:[-30,0,0]});break;case 19:this.svg.rect(0,0,l,l,a).transform({scale:[-1,-1],translate:[-g+l/2,-v+l/2],rotate:[-30,0,0]})}}}).call(this,t("buffer").Buffer)},{"./color":2,"./sha1":5,"./svg":6,buffer:8,extend:9}],5:[function(t,r){"use strict";function s(){function t(){for(var t=16;80>t;t++){var r=f[t-3]^f[t-8]^f[t-14]^f[t-16];f[t]=r<<1|r>>>31}var s,e,i=o,n=a,p=h,g=l,v=c;for(t=0;80>t;t++){20>t?(s=g^n&(p^g),e=1518500249):40>t?(s=n^p^g,e=1859775393):60>t?(s=n&p|g&(n|p),e=2400959708):(s=n^p^g,e=3395469782);var y=(i<<5|i>>>27)+s+v+e+(0|f[t]);v=g,g=p,p=n<<30|n>>>2,n=i,i=y}for(o=o+i|0,a=a+n|0,h=h+p|0,l=l+g|0,c=c+v|0,u=0,t=0;16>t;t++)f[t]=0}function r(r){f[u]|=(255&r)<<p,p?p-=8:(u++,p=24),16===u&&t()}function s(t){var s=t.length;g+=8*s;for(var e=0;s>e;e++)r(t.charCodeAt(e))}function e(t){if("string"==typeof t)return s(t);var e=t.length;g+=8*e;for(var i=0;e>i;i++)r(t[i])}function i(t){for(var r="",s=28;s>=0;s-=4)r+=(t>>s&15).toString(16);return r}function n(){r(128),(u>14||14===u&&24>p)&&t(),u=14,p=24,r(0),r(0),r(g>0xffffffffff?g/1099511627776:0),r(g>4294967295?g/4294967296:0);for(var s=24;s>=0;s-=8)r(g>>s);return i(o)+i(a)+i(h)+i(l)+i(c)}var o=1732584193,a=4023233417,h=2562383102,l=271733878,c=3285377520,f=new Uint32Array(80),u=0,p=24,g=0;return{update:e,digest:n}}r.exports=function(t){if(void 0===t)return s();var r=s();return r.update(t),r.digest()}},{}],6:[function(t,r){"use strict";function s(){return this.width=100,this.height=100,this.svg=new i("svg"),this.context=[],this.setAttributes(this.svg,{xmlns:"http://www.w3.org/2000/svg",width:this.width,height:this.height}),this}var e=t("extend"),i=t("./xml");r.exports=s,s.prototype.currentContext=function(){return this.context[this.context.length-1]||this.svg},s.prototype.end=function(){return this.context.pop(),this},s.prototype.currentNode=function(){var t=this.currentContext();return t.lastChild||t},s.prototype.transform=function(t){return this.currentNode().setAttribute("transform",Object.keys(t).map(function(r){return r+"("+t[r].join(",")+")"}).join(" ")),this},s.prototype.setAttributes=function(t,r){Object.keys(r).forEach(function(s){t.setAttribute(s,r[s])})},s.prototype.setWidth=function(t){this.svg.setAttribute("width",Math.floor(t))},s.prototype.setHeight=function(t){this.svg.setAttribute("height",Math.floor(t))},s.prototype.toString=function(){return this.svg.toString()},s.prototype.rect=function(t,r,s,n,o){var a=this;if(Array.isArray(t))return t.forEach(function(t){a.rect.apply(a,t.concat(o))}),this;var h=new i("rect");return this.currentContext().appendChild(h),this.setAttributes(h,e({x:t,y:r,width:s,height:n},o)),this},s.prototype.circle=function(t,r,s,n){var o=new i("circle");return this.currentContext().appendChild(o),this.setAttributes(o,e({cx:t,cy:r,r:s},n)),this},s.prototype.path=function(t,r){var s=new i("path");return this.currentContext().appendChild(s),this.setAttributes(s,e({d:t},r)),this},s.prototype.polyline=function(t,r){var s=this;if(Array.isArray(t))return t.forEach(function(t){s.polyline(t,r)}),this;var n=new i("polyline");return this.currentContext().appendChild(n),this.setAttributes(n,e({points:t},r)),this},s.prototype.group=function(t){var r=new i("g");return this.currentContext().appendChild(r),this.context.push(r),this.setAttributes(r,e({},t)),this}},{"./xml":7,extend:9}],7:[function(t,r){"use strict";var s=r.exports=function(t){return this instanceof s?(this.tagName=t,this.attributes=Object.create(null),this.children=[],this.lastChild=null,this):new s(t)};s.prototype.appendChild=function(t){return this.children.push(t),this.lastChild=t,this},s.prototype.setAttribute=function(t,r){return this.attributes[t]=r,this},s.prototype.toString=function(){var t=this;return["<",t.tagName,Object.keys(t.attributes).map(function(r){return[" ",r,'="',t.attributes[r],'"'].join("")}).join(""),">",t.children.map(function(t){return t.toString()}).join(""),"</",t.tagName,">"].join("")}},{}],8:[function(){},{}],9:[function(t,r){function s(t){if(!t||"[object Object]"!==i.call(t)||t.nodeType||t.setInterval)return!1;var r=e.call(t,"constructor"),s=e.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!s)return!1;var n;for(n in t);return void 0===n||e.call(t,n)}var e=Object.prototype.hasOwnProperty,i=Object.prototype.toString;r.exports=function n(){var t,r,e,i,o,a,h=arguments[0]||{},l=1,c=arguments.length,f=!1;for("boolean"==typeof h&&(f=h,h=arguments[1]||{},l=2),"object"!=typeof h&&"function"!=typeof h&&(h={});c>l;l++)if(null!=(t=arguments[l]))for(r in t)e=h[r],i=t[r],h!==i&&(f&&i&&(s(i)||(o=Array.isArray(i)))?(o?(o=!1,a=e&&Array.isArray(e)?e:[]):a=e&&s(e)?e:{},h[r]=n(f,a,i)):void 0!==i&&(h[r]=i));return h}},{}]},{},[1])(1)})}(); + +!function(){!function(t,e,i){!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):jQuery&&!jQuery.fn.sparkline&&t(jQuery)}(function(s){"use strict";var r={},n,a,h,o,l,g,p,u,c,d,f,m,v,x,y,C,w,b,R,S,k,M,_,H,W,T,q,I,j,P,L,A,F=0;n=function(){return{common:{type:"line",lineColor:"#00f",fillColor:"#cdf",defaultPixelsPerValue:3,width:"auto",height:"auto",composite:!1,tagValuesAttribute:"values",tagOptionsPrefix:"spark",enableTagOptions:!1,enableHighlight:!0,highlightLighten:1.4,tooltipSkipNull:!0,tooltipPrefix:"",tooltipSuffix:"",disableHiddenCheck:!1,numberFormatter:!1,numberDigitGroupCount:3,numberDigitGroupSep:",",numberDecimalMark:".",disableTooltips:!1,disableInteraction:!1},line:{spotColor:"#f80",highlightSpotColor:"#5f5",highlightLineColor:"#f22",spotRadius:1.5,minSpotColor:"#f80",maxSpotColor:"#f80",lineWidth:1,normalRangeMin:i,normalRangeMax:i,normalRangeColor:"#ccc",drawNormalOnTop:!1,chartRangeMin:i,chartRangeMax:i,chartRangeMinX:i,chartRangeMaxX:i,tooltipFormat:new h('<span style="color: {{color}}">●</span> {{prefix}}{{y}}{{suffix}}')},bar:{barColor:"#3366cc",negBarColor:"#f44",stackedBarColor:["#3366cc","#dc3912","#ff9900","#109618","#66aa00","#dd4477","#0099c6","#990099"],zeroColor:i,nullColor:i,zeroAxis:!0,barWidth:4,barSpacing:1,chartRangeMax:i,chartRangeMin:i,chartRangeClip:!1,colorMap:i,tooltipFormat:new h('<span style="color: {{color}}">●</span> {{prefix}}{{value}}{{suffix}}')},tristate:{barWidth:4,barSpacing:1,posBarColor:"#6f6",negBarColor:"#f44",zeroBarColor:"#999",colorMap:{},tooltipFormat:new h('<span style="color: {{color}}">●</span> {{value:map}}'),tooltipValueLookups:{map:{"-1":"Loss",0:"Draw",1:"Win"}}},discrete:{lineHeight:"auto",thresholdColor:i,thresholdValue:0,chartRangeMax:i,chartRangeMin:i,chartRangeClip:!1,tooltipFormat:new h("{{prefix}}{{value}}{{suffix}}")},bullet:{targetColor:"#f33",targetWidth:3,performanceColor:"#33f",rangeColors:["#d3dafe","#a8b6ff","#7f94ff"],base:i,tooltipFormat:new h("{{fieldkey:fields}} - {{value}}"),tooltipValueLookups:{fields:{r:"Range",p:"Performance",t:"Target"}}},pie:{offset:0,sliceColors:["#3366cc","#dc3912","#ff9900","#109618","#66aa00","#dd4477","#0099c6","#990099"],borderWidth:0,borderColor:"#000",tooltipFormat:new h('<span style="color: {{color}}">●</span> {{value}} ({{percent.1}}%)')},box:{raw:!1,boxLineColor:"#000",boxFillColor:"#cdf",whiskerColor:"#000",outlierLineColor:"#333",outlierFillColor:"#fff",medianColor:"#f00",showOutliers:!0,outlierIQR:1.5,spotRadius:1.5,target:i,targetColor:"#4a2",chartRangeMax:i,chartRangeMin:i,tooltipFormat:new h("{{field:fields}}: {{value}}"),tooltipFormatFieldlistKey:"field",tooltipValueLookups:{fields:{lq:"Lower Quartile",med:"Median",uq:"Upper Quartile",lo:"Left Outlier",ro:"Right Outlier",lw:"Left Whisker",rw:"Right Whisker"}}}}},T='.jqstooltip { position: absolute;left: 0px;top: 0px;visibility: hidden;background: rgb(0, 0, 0) transparent;background-color: rgba(0,0,0,0.6);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";color: white;font: 10px arial, san serif;text-align: left;white-space: nowrap;padding: 5px;border: 1px solid white;z-index: 10000;}.jqsfield { color: white;font: 10px arial, san serif;text-align: left;}',a=function(){var t,e;return t=function(){this.init.apply(this,arguments)},arguments.length>1?(arguments[0]?(t.prototype=s.extend(new arguments[0],arguments[arguments.length-1]),t._super=arguments[0].prototype):t.prototype=arguments[arguments.length-1],arguments.length>2&&(e=Array.prototype.slice.call(arguments,1,-1),e.unshift(t.prototype),s.extend.apply(s,e))):t.prototype=arguments[0],t.prototype.cls=t,t},s.SPFormatClass=h=a({fre:/\{\{([\w.]+?)(:(.+?))?\}\}/g,precre:/(\w+)\.(\d+)/,init:function(t,e){this.format=t,this.fclass=e},render:function(t,e,s){var r=this,n=t,a,h,o,l,g;return this.format.replace(this.fre,function(){var t;return h=arguments[1],o=arguments[3],a=r.precre.exec(h),a?(g=a[2],h=a[1]):g=!1,l=n[h],l===i?"":o&&e&&e[o]?(t=e[o],t.get?e[o].get(l)||l:e[o][l]||l):(c(l)&&(l=s.get("numberFormatter")?s.get("numberFormatter")(l):x(l,g,s.get("numberDigitGroupCount"),s.get("numberDigitGroupSep"),s.get("numberDecimalMark"))),l)})}}),s.spformat=function(t,e){return new h(t,e)},o=function(t,e,i){return e>t?e:t>i?i:t},l=function(t,i){var s;return 2===i?(s=e.floor(t.length/2),t.length%2?t[s]:(t[s-1]+t[s])/2):t.length%2?(s=(t.length*i+i)/4,s%1?(t[e.floor(s)]+t[e.floor(s)-1])/2:t[s-1]):(s=(t.length*i+2)/4,s%1?(t[e.floor(s)]+t[e.floor(s)-1])/2:t[s-1])},g=function(t){var e;switch(t){case"undefined":t=i;break;case"null":t=null;break;case"true":t=!0;break;case"false":t=!1;break;default:e=parseFloat(t),t==e&&(t=e)}return t},p=function(t){var e,i=[];for(e=t.length;e--;)i[e]=g(t[e]);return i},u=function(t,e){var i,s,r=[];for(i=0,s=t.length;s>i;i++)t[i]!==e&&r.push(t[i]);return r},c=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},x=function(t,e,i,r,n){var a,h;for(t=(e===!1?parseFloat(t).toString():t.toFixed(e)).split(""),a=(a=s.inArray(".",t))<0?t.length:a,a<t.length&&(t[a]=n),h=a-i;h>0;h-=i)t.splice(h,0,r);return t.join("")},d=function(t,e,i){var s;for(s=e.length;s--;)if((!i||null!==e[s])&&e[s]!==t)return!1;return!0},f=function(t){var e=0,i;for(i=t.length;i--;)e+="number"==typeof t[i]?t[i]:0;return e},v=function(t){return s.isArray(t)?t:[t]},m=function(e){var i;t.createStyleSheet?t.createStyleSheet().cssText=e:(i=t.createElement("style"),i.type="text/css",t.getElementsByTagName("head")[0].appendChild(i),i["string"==typeof t.body.style.WebkitAppearance?"innerText":"innerHTML"]=e)},s.fn.simpledraw=function(e,r,n,a){var h,o;if(n&&(h=this.data("_jqs_vcanvas")))return h;if(s.fn.sparkline.canvas===!1)return!1;if(s.fn.sparkline.canvas===i){var l=t.createElement("canvas");if(l.getContext&&l.getContext("2d"))s.fn.sparkline.canvas=function(t,e,i,s){return new P(t,e,i,s)};else{if(!t.namespaces||t.namespaces.v)return s.fn.sparkline.canvas=!1,!1;t.namespaces.add("v","urn:schemas-microsoft-com:vml","#default#VML"),s.fn.sparkline.canvas=function(t,e,i,s){return new L(t,e,i)}}}return e===i&&(e=s(this).innerWidth()),r===i&&(r=s(this).innerHeight()),h=s.fn.sparkline.canvas(e,r,this,a),o=s(this).data("_jqs_mhandler"),o&&o.registerCanvas(h),h},s.fn.cleardraw=function(){var t=this.data("_jqs_vcanvas");t&&t.reset()},s.RangeMapClass=y=a({init:function(t){var e,i,s=[];for(e in t)t.hasOwnProperty(e)&&"string"==typeof e&&e.indexOf(":")>-1&&(i=e.split(":"),i[0]=0===i[0].length?-1/0:parseFloat(i[0]),i[1]=0===i[1].length?1/0:parseFloat(i[1]),i[2]=t[e],s.push(i));this.map=t,this.rangelist=s||!1},get:function(t){var e=this.rangelist,s,r,n;if((n=this.map[t])!==i)return n;if(e)for(s=e.length;s--;)if(r=e[s],r[0]<=t&&r[1]>=t)return r[2];return i}}),s.range_map=function(t){return new y(t)},C=a({init:function(t,e){var i=s(t);this.$el=i,this.options=e,this.currentPageX=0,this.currentPageY=0,this.el=t,this.splist=[],this.tooltip=null,this.over=!1,this.displayTooltips=!e.get("disableTooltips"),this.highlightEnabled=!e.get("disableHighlight")},registerSparkline:function(t){this.splist.push(t),this.over&&this.updateDisplay()},registerCanvas:function(t){var e=s(t.canvas);this.canvas=t,this.$canvas=e,e.mouseenter(s.proxy(this.mouseenter,this)),e.mouseleave(s.proxy(this.mouseleave,this)),e.click(s.proxy(this.mouseclick,this))},reset:function(t){this.splist=[],this.tooltip&&t&&(this.tooltip.remove(),this.tooltip=i)},mouseclick:function(t){var e=s.Event("sparklineClick");e.originalEvent=t,e.sparklines=this.splist,this.$el.trigger(e)},mouseenter:function(e){s(t.body).unbind("mousemove.jqs"),s(t.body).bind("mousemove.jqs",s.proxy(this.mousemove,this)),this.over=!0,this.currentPageX=e.pageX,this.currentPageY=e.pageY,this.currentEl=e.target,!this.tooltip&&this.displayTooltips&&(this.tooltip=new w(this.options),this.tooltip.updatePosition(e.pageX,e.pageY)),this.updateDisplay()},mouseleave:function(){s(t.body).unbind("mousemove.jqs");var e=this.splist,i=e.length,r=!1,n,a;for(this.over=!1,this.currentEl=null,this.tooltip&&(this.tooltip.remove(),this.tooltip=null),a=0;i>a;a++)n=e[a],n.clearRegionHighlight()&&(r=!0);r&&this.canvas.render()},mousemove:function(t){this.currentPageX=t.pageX,this.currentPageY=t.pageY,this.currentEl=t.target,this.tooltip&&this.tooltip.updatePosition(t.pageX,t.pageY),this.updateDisplay()},updateDisplay:function(){var t=this.splist,e=t.length,i=!1,r=this.$canvas.offset(),n=this.currentPageX-r.left,a=this.currentPageY-r.top,h,o,l,g,p;if(this.over){for(l=0;e>l;l++)o=t[l],g=o.setRegionHighlight(this.currentEl,n,a),g&&(i=!0);if(i){if(p=s.Event("sparklineRegionChange"),p.sparklines=this.splist,this.$el.trigger(p),this.tooltip){for(h="",l=0;e>l;l++)o=t[l],h+=o.getCurrentRegionTooltip();this.tooltip.setContent(h)}this.disableHighlight||this.canvas.render()}null===g&&this.mouseleave()}}}),w=a({sizeStyle:"position: static !important;display: block !important;visibility: hidden !important;float: left !important;",init:function(e){var i=e.get("tooltipClassname","jqstooltip"),r=this.sizeStyle,n;this.container=e.get("tooltipContainer")||t.body,this.tooltipOffsetX=e.get("tooltipOffsetX",10),this.tooltipOffsetY=e.get("tooltipOffsetY",12),s("#jqssizetip").remove(),s("#jqstooltip").remove(),this.sizetip=s("<div/>",{id:"jqssizetip",style:r,"class":i}),this.tooltip=s("<div/>",{id:"jqstooltip","class":i}).appendTo(this.container),n=this.tooltip.offset(),this.offsetLeft=n.left,this.offsetTop=n.top,this.hidden=!0,s(window).unbind("resize.jqs scroll.jqs"),s(window).bind("resize.jqs scroll.jqs",s.proxy(this.updateWindowDims,this)),this.updateWindowDims()},updateWindowDims:function(){this.scrollTop=s(window).scrollTop(),this.scrollLeft=s(window).scrollLeft(),this.scrollRight=this.scrollLeft+s(window).width(),this.updatePosition()},getSize:function(t){this.sizetip.html(t).appendTo(this.container),this.width=this.sizetip.width()+1,this.height=this.sizetip.height(),this.sizetip.remove()},setContent:function(t){return t?(this.getSize(t),this.tooltip.html(t).css({width:this.width,height:this.height,visibility:"visible"}),this.hidden&&(this.hidden=!1,this.updatePosition()),void 0):(this.tooltip.css("visibility","hidden"),void(this.hidden=!0))},updatePosition:function(t,e){if(t===i){if(this.mousex===i)return;t=this.mousex-this.offsetLeft,e=this.mousey-this.offsetTop}else this.mousex=t-=this.offsetLeft,this.mousey=e-=this.offsetTop;this.height&&this.width&&!this.hidden&&(e-=this.height+this.tooltipOffsetY,t+=this.tooltipOffsetX,e<this.scrollTop&&(e=this.scrollTop),t<this.scrollLeft?t=this.scrollLeft:t+this.width>this.scrollRight&&(t=this.scrollRight-this.width),this.tooltip.css({left:t,top:e}))},remove:function(){this.tooltip.remove(),this.sizetip.remove(),this.sizetip=this.tooltip=i,s(window).unbind("resize.jqs scroll.jqs")}}),q=function(){m(T)},s(q),A=[],s.fn.sparkline=function(e,r){return this.each(function(){var n=new s.fn.sparkline.options(this,r),a=s(this),h,o;if(h=function(){var r,h,o,l,g,p,u;return"html"===e||e===i?(u=this.getAttribute(n.get("tagValuesAttribute")),(u===i||null===u)&&(u=a.html()),r=u.replace(/(^\s*<!--)|(-->\s*$)|\s+/g,"").split(",")):r=e,h="auto"===n.get("width")?r.length*n.get("defaultPixelsPerValue"):n.get("width"),"auto"===n.get("height")?n.get("composite")&&s.data(this,"_jqs_vcanvas")||(l=t.createElement("span"),l.innerHTML="a",a.html(l),o=s(l).innerHeight()||s(l).height(),s(l).remove(),l=null):o=n.get("height"),n.get("disableInteraction")?g=!1:(g=s.data(this,"_jqs_mhandler"),g?n.get("composite")||g.reset():(g=new C(this,n),s.data(this,"_jqs_mhandler",g))),n.get("composite")&&!s.data(this,"_jqs_vcanvas")?void(s.data(this,"_jqs_errnotify")||(alert("Attempted to attach a composite sparkline to an element with no existing sparkline"),s.data(this,"_jqs_errnotify",!0))):(p=new(s.fn.sparkline[n.get("type")])(this,r,n,h,o),p.render(),g&&g.registerSparkline(p),void 0)},s(this).html()&&!n.get("disableHiddenCheck")&&s(this).is(":hidden")||!s(this).parents("body").length){if(!n.get("composite")&&s.data(this,"_jqs_pending"))for(o=A.length;o;o--)A[o-1][0]==this&&A.splice(o-1,1);A.push([this,h]),s.data(this,"_jqs_pending",!0)}else h.call(this)})},s.fn.sparkline.defaults=n(),s.sparkline_display_visible=function(){var t,e,i,r=[];for(e=0,i=A.length;i>e;e++)t=A[e][0],s(t).is(":visible")&&!s(t).parents().is(":hidden")?(A[e][1].call(t),s.data(A[e][0],"_jqs_pending",!1),r.push(e)):!s(t).closest("html").length&&!s.data(t,"_jqs_pending")&&(s.data(A[e][0],"_jqs_pending",!1),r.push(e));for(e=r.length;e;e--)A.splice(r[e-1],1)},s.fn.sparkline.options=a({init:function(t,e){var i,n,a,h;this.userOptions=e=e||{},this.tag=t,this.tagValCache={},n=s.fn.sparkline.defaults,a=n.common,this.tagOptionsPrefix=e.enableTagOptions&&(e.tagOptionsPrefix||a.tagOptionsPrefix),h=this.getTagSetting("type"),i=h===r?n[e.type||a.type]:n[h],this.mergedOptions=s.extend({},a,i,e)},getTagSetting:function(t){var e=this.tagOptionsPrefix,s,n,a,h;if(e===!1||e===i)return r;if(this.tagValCache.hasOwnProperty(t))s=this.tagValCache.key;else{if(s=this.tag.getAttribute(e+t),s===i||null===s)s=r;else if("["===s.substr(0,1))for(s=s.substr(1,s.length-2).split(","),n=s.length;n--;)s[n]=g(s[n].replace(/(^\s*)|(\s*$)/g,""));else if("{"===s.substr(0,1))for(a=s.substr(1,s.length-2).split(","),s={},n=a.length;n--;)h=a[n].split(":",2),s[h[0].replace(/(^\s*)|(\s*$)/g,"")]=g(h[1].replace(/(^\s*)|(\s*$)/g,""));else s=g(s);this.tagValCache.key=s}return s},get:function(t,e){var s=this.getTagSetting(t),n;return s!==r?s:(n=this.mergedOptions[t])===i?e:n}}),s.fn.sparkline._base=a({disabled:!1,init:function(t,e,r,n,a){this.el=t,this.$el=s(t),this.values=e,this.options=r,this.width=n,this.height=a,this.currentRegion=i},initTarget:function(){var t=!this.options.get("disableInteraction");(this.target=this.$el.simpledraw(this.width,this.height,this.options.get("composite"),t))?(this.canvasWidth=this.target.pixelWidth,this.canvasHeight=this.target.pixelHeight):this.disabled=!0},render:function(){return this.disabled?(this.el.innerHTML="",!1):!0},getRegion:function(t,e){},setRegionHighlight:function(t,e,s){var r=this.currentRegion,n=!this.options.get("disableHighlight"),a;return e>this.canvasWidth||s>this.canvasHeight||0>e||0>s?null:(a=this.getRegion(t,e,s),r!==a?(r!==i&&n&&this.removeHighlight(),this.currentRegion=a,a!==i&&n&&this.renderHighlight(),!0):!1)},clearRegionHighlight:function(){return this.currentRegion!==i?(this.removeHighlight(),this.currentRegion=i,!0):!1},renderHighlight:function(){this.changeHighlight(!0)},removeHighlight:function(){this.changeHighlight(!1)},changeHighlight:function(t){},getCurrentRegionTooltip:function(){var t=this.options,e="",r=[],n,a,o,l,g,p,u,c,d,f,m,v,x,y;if(this.currentRegion===i)return"";if(n=this.getCurrentRegionFields(),m=t.get("tooltipFormatter"))return m(this,t,n);if(t.get("tooltipChartTitle")&&(e+='<div class="jqs jqstitle">'+t.get("tooltipChartTitle")+"</div>\n"),a=this.options.get("tooltipFormat"),!a)return"";if(s.isArray(a)||(a=[a]),s.isArray(n)||(n=[n]),u=this.options.get("tooltipFormatFieldlist"),c=this.options.get("tooltipFormatFieldlistKey"),u&&c){for(d=[],p=n.length;p--;)f=n[p][c],-1!=(y=s.inArray(f,u))&&(d[y]=n[p]);n=d}for(o=a.length,x=n.length,p=0;o>p;p++)for(v=a[p],"string"==typeof v&&(v=new h(v)),l=v.fclass||"jqsfield",y=0;x>y;y++)n[y].isNull&&t.get("tooltipSkipNull")||(s.extend(n[y],{prefix:t.get("tooltipPrefix"),suffix:t.get("tooltipSuffix")}),g=v.render(n[y],t.get("tooltipValueLookups"),t),r.push('<div class="'+l+'">'+g+"</div>"));return r.length?e+r.join("\n"):""},getCurrentRegionFields:function(){},calcHighlightColor:function(t,i){var s=i.get("highlightColor"),r=i.get("highlightLighten"),n,a,h,l;if(s)return s;if(r&&(n=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(t)||/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t))){for(h=[],a=4===t.length?16:1,l=0;3>l;l++)h[l]=o(e.round(parseInt(n[l+1],16)*a*r),0,255);return"rgb("+h.join(",")+")"}return t}}),b={changeHighlight:function(t){var e=this.currentRegion,i=this.target,r=this.regionShapes[e],n;r&&(n=this.renderRegion(e,t),s.isArray(n)||s.isArray(r)?(i.replaceWithShapes(r,n),this.regionShapes[e]=s.map(n,function(t){return t.id})):(i.replaceWithShape(r,n),this.regionShapes[e]=n.id))},render:function(){var t=this.values,e=this.target,i=this.regionShapes,r,n,a,h;if(this.cls._super.render.call(this)){for(a=t.length;a--;)if(r=this.renderRegion(a))if(s.isArray(r)){for(n=[],h=r.length;h--;)r[h].append(),n.push(r[h].id);i[a]=n}else r.append(),i[a]=r.id;else i[a]=null;e.render()}}},s.fn.sparkline.line=R=a(s.fn.sparkline._base,{type:"line",init:function(t,e,i,s,r){R._super.init.call(this,t,e,i,s,r),this.vertices=[],this.regionMap=[],this.xvalues=[],this.yvalues=[],this.yminmax=[],this.hightlightSpotId=null,this.lastShapeId=null,this.initTarget()},getRegion:function(t,e,s){var r,n=this.regionMap;for(r=n.length;r--;)if(null!==n[r]&&e>=n[r][0]&&e<=n[r][1])return n[r][2];return i},getCurrentRegionFields:function(){var t=this.currentRegion;return{isNull:null===this.yvalues[t],x:this.xvalues[t],y:this.yvalues[t],color:this.options.get("lineColor"),fillColor:this.options.get("fillColor"),offset:t}},renderHighlight:function(){var t=this.currentRegion,e=this.target,s=this.vertices[t],r=this.options,n=r.get("spotRadius"),a=r.get("highlightSpotColor"),h=r.get("highlightLineColor"),o,l;s&&(n&&a&&(o=e.drawCircle(s[0],s[1],n,i,a),this.highlightSpotId=o.id,e.insertAfterShape(this.lastShapeId,o)),h&&(l=e.drawLine(s[0],this.canvasTop,s[0],this.canvasTop+this.canvasHeight,h),this.highlightLineId=l.id,e.insertAfterShape(this.lastShapeId,l)))},removeHighlight:function(){var t=this.target;this.highlightSpotId&&(t.removeShapeId(this.highlightSpotId),this.highlightSpotId=null),this.highlightLineId&&(t.removeShapeId(this.highlightLineId),this.highlightLineId=null)},scanValues:function(){var t=this.values,i=t.length,s=this.xvalues,r=this.yvalues,n=this.yminmax,a,h,o,l,g;for(a=0;i>a;a++)h=t[a],o="string"==typeof t[a],l="object"==typeof t[a]&&t[a]instanceof Array,g=o&&t[a].split(":"),o&&2===g.length?(s.push(Number(g[0])),r.push(Number(g[1])),n.push(Number(g[1]))):l?(s.push(h[0]),r.push(h[1]),n.push(h[1])):(s.push(a),null===t[a]||"null"===t[a]?r.push(null):(r.push(Number(h)),n.push(Number(h))));this.options.get("xvalues")&&(s=this.options.get("xvalues")),this.maxy=this.maxyorg=e.max.apply(e,n),this.miny=this.minyorg=e.min.apply(e,n),this.maxx=e.max.apply(e,s),this.minx=e.min.apply(e,s),this.xvalues=s,this.yvalues=r,this.yminmax=n},processRangeOptions:function(){var t=this.options,e=t.get("normalRangeMin"),s=t.get("normalRangeMax");e!==i&&(e<this.miny&&(this.miny=e),s>this.maxy&&(this.maxy=s)),t.get("chartRangeMin")!==i&&(t.get("chartRangeClip")||t.get("chartRangeMin")<this.miny)&&(this.miny=t.get("chartRangeMin")),t.get("chartRangeMax")!==i&&(t.get("chartRangeClip")||t.get("chartRangeMax")>this.maxy)&&(this.maxy=t.get("chartRangeMax")),t.get("chartRangeMinX")!==i&&(t.get("chartRangeClipX")||t.get("chartRangeMinX")<this.minx)&&(this.minx=t.get("chartRangeMinX")),t.get("chartRangeMaxX")!==i&&(t.get("chartRangeClipX")||t.get("chartRangeMaxX")>this.maxx)&&(this.maxx=t.get("chartRangeMaxX"))},drawNormalRange:function(t,s,r,n,a){var h=this.options.get("normalRangeMin"),o=this.options.get("normalRangeMax"),l=s+e.round(r-r*((o-this.miny)/a)),g=e.round(r*(o-h)/a);this.target.drawRect(t,l,n,g,i,this.options.get("normalRangeColor")).append()},render:function(){var t=this.options,r=this.target,n=this.canvasWidth,a=this.canvasHeight,h=this.vertices,o=t.get("spotRadius"),l=this.regionMap,g,p,u,c,d,f,m,v,x,C,w,b,S,k,M,_,H,W,T,q,I,j,P,L,A;if(R._super.render.call(this)&&(this.scanValues(),this.processRangeOptions(),P=this.xvalues,L=this.yvalues,this.yminmax.length&&!(this.yvalues.length<2))){for(c=d=0,g=this.maxx-this.minx===0?1:this.maxx-this.minx,p=this.maxy-this.miny===0?1:this.maxy-this.miny,u=this.yvalues.length-1,o&&(4*o>n||4*o>a)&&(o=0),o&&(I=t.get("highlightSpotColor")&&!t.get("disableInteraction"),(I||t.get("minSpotColor")||t.get("spotColor")&&L[u]===this.miny)&&(a-=e.ceil(o)),(I||t.get("maxSpotColor")||t.get("spotColor")&&L[u]===this.maxy)&&(a-=e.ceil(o),c+=e.ceil(o)),(I||(t.get("minSpotColor")||t.get("maxSpotColor"))&&(L[0]===this.miny||L[0]===this.maxy))&&(d+=e.ceil(o),n-=e.ceil(o)),(I||t.get("spotColor")||t.get("minSpotColor")||t.get("maxSpotColor")&&(L[u]===this.miny||L[u]===this.maxy))&&(n-=e.ceil(o))),a--,t.get("normalRangeMin")!==i&&!t.get("drawNormalOnTop")&&this.drawNormalRange(d,c,a,n,p),m=[],v=[m],k=M=null,_=L.length,A=0;_>A;A++)x=P[A],w=P[A+1],C=L[A],b=d+e.round((x-this.minx)*(n/g)),S=_-1>A?d+e.round((w-this.minx)*(n/g)):n,M=b+(S-b)/2,l[A]=[k||0,M,A],k=M,null===C?A&&(null!==L[A-1]&&(m=[],v.push(m)),h.push(null)):(C<this.miny&&(C=this.miny),C>this.maxy&&(C=this.maxy),m.length||m.push([b,c+a]),f=[b,c+e.round(a-a*((C-this.miny)/p))],m.push(f),h.push(f));for(H=[],W=[],T=v.length,A=0;T>A;A++)m=v[A],m.length&&(t.get("fillColor")&&(m.push([m[m.length-1][0],c+a]),W.push(m.slice(0)),m.pop()),m.length>2&&(m[0]=[m[0][0],m[1][1]]),H.push(m));for(T=W.length,A=0;T>A;A++)r.drawShape(W[A],t.get("fillColor"),t.get("fillColor")).append();for(t.get("normalRangeMin")!==i&&t.get("drawNormalOnTop")&&this.drawNormalRange(d,c,a,n,p),T=H.length,A=0;T>A;A++)r.drawShape(H[A],t.get("lineColor"),i,t.get("lineWidth")).append();if(o&&t.get("valueSpots"))for(q=t.get("valueSpots"),q.get===i&&(q=new y(q)),A=0;_>A;A++)j=q.get(L[A]),j&&r.drawCircle(d+e.round((P[A]-this.minx)*(n/g)),c+e.round(a-a*((L[A]-this.miny)/p)),o,i,j).append();o&&t.get("spotColor")&&null!==L[u]&&r.drawCircle(d+e.round((P[P.length-1]-this.minx)*(n/g)),c+e.round(a-a*((L[u]-this.miny)/p)),o,i,t.get("spotColor")).append(),this.maxy!==this.minyorg&&(o&&t.get("minSpotColor")&&(x=P[s.inArray(this.minyorg,L)],r.drawCircle(d+e.round((x-this.minx)*(n/g)),c+e.round(a-a*((this.minyorg-this.miny)/p)),o,i,t.get("minSpotColor")).append()),o&&t.get("maxSpotColor")&&(x=P[s.inArray(this.maxyorg,L)],r.drawCircle(d+e.round((x-this.minx)*(n/g)),c+e.round(a-a*((this.maxyorg-this.miny)/p)),o,i,t.get("maxSpotColor")).append())),this.lastShapeId=r.getLastShapeId(),this.canvasTop=c,r.render()}}}),s.fn.sparkline.bar=S=a(s.fn.sparkline._base,b,{type:"bar",init:function(t,r,n,a,h){var l=parseInt(n.get("barWidth"),10),c=parseInt(n.get("barSpacing"),10),d=n.get("chartRangeMin"),f=n.get("chartRangeMax"),m=n.get("chartRangeClip"),v=1/0,x=-1/0,C,w,b,R,k,M,_,H,W,T,q,I,j,P,L,A,F,B,O,V,X,z,N;for(S._super.init.call(this,t,r,n,a,h),M=0,_=r.length;_>M;M++)V=r[M],C="string"==typeof V&&V.indexOf(":")>-1,(C||s.isArray(V))&&(L=!0,C&&(V=r[M]=p(V.split(":"))),V=u(V,null),w=e.min.apply(e,V),b=e.max.apply(e,V),v>w&&(v=w),b>x&&(x=b));this.stacked=L,this.regionShapes={},this.barWidth=l,this.barSpacing=c,this.totalBarWidth=l+c,this.width=a=r.length*l+(r.length-1)*c,this.initTarget(),m&&(j=d===i?-1/0:d,P=f===i?1/0:f),k=[],R=L?[]:k;var E=[],D=[];for(M=0,_=r.length;_>M;M++)if(L)for(A=r[M],r[M]=O=[],E[M]=0,R[M]=D[M]=0,F=0,B=A.length;B>F;F++)V=O[F]=m?o(A[F],j,P):A[F],null!==V&&(V>0&&(E[M]+=V),0>v&&x>0?0>V?D[M]+=e.abs(V):R[M]+=V:R[M]+=e.abs(V-(0>V?x:v)),k.push(V));else V=m?o(r[M],j,P):r[M],V=r[M]=g(V),null!==V&&k.push(V);this.max=I=e.max.apply(e,k),this.min=q=e.min.apply(e,k),this.stackMax=x=L?e.max.apply(e,E):I,this.stackMin=v=L?e.min.apply(e,k):q,n.get("chartRangeMin")!==i&&(n.get("chartRangeClip")||n.get("chartRangeMin")<q)&&(q=n.get("chartRangeMin")),n.get("chartRangeMax")!==i&&(n.get("chartRangeClip")||n.get("chartRangeMax")>I)&&(I=n.get("chartRangeMax")),this.zeroAxis=W=n.get("zeroAxis",!0),T=0>=q&&I>=0&&W?0:0==W?q:q>0?q:I,this.xaxisOffset=T,H=L?e.max.apply(e,R)+e.max.apply(e,D):I-q,this.canvasHeightEf=W&&0>q?this.canvasHeight-2:this.canvasHeight-1,T>q?(z=L&&I>=0?x:I,X=(z-T)/H*this.canvasHeight,X!==e.ceil(X)&&(this.canvasHeightEf-=2,X=e.ceil(X))):X=this.canvasHeight,this.yoffset=X,s.isArray(n.get("colorMap"))?(this.colorMapByIndex=n.get("colorMap"),this.colorMapByValue=null):(this.colorMapByIndex=null,this.colorMapByValue=n.get("colorMap"),this.colorMapByValue&&this.colorMapByValue.get===i&&(this.colorMapByValue=new y(this.colorMapByValue))),this.range=H},getRegion:function(t,s,r){var n=e.floor(s/this.totalBarWidth);return 0>n||n>=this.values.length?i:n},getCurrentRegionFields:function(){var t=this.currentRegion,e=v(this.values[t]),i=[],s,r;for(r=e.length;r--;)s=e[r],i.push({isNull:null===s,value:s,color:this.calcColor(r,s,t),offset:t});return i},calcColor:function(t,e,r){var n=this.colorMapByIndex,a=this.colorMapByValue,h=this.options,o,l;return o=h.get(this.stacked?"stackedBarColor":0>e?"negBarColor":"barColor"),0===e&&h.get("zeroColor")!==i&&(o=h.get("zeroColor")),a&&(l=a.get(e))?o=l:n&&n.length>r&&(o=n[r]),s.isArray(o)?o[t%o.length]:o},renderRegion:function(t,r){var n=this.values[t],a=this.options,h=this.xaxisOffset,o=[],l=this.range,g=this.stacked,p=this.target,u=t*this.totalBarWidth,c=this.canvasHeightEf,f=this.yoffset,m,v,x,y,C,w,b,R,S,k;if(n=s.isArray(n)?n:[n],b=n.length,R=n[0],y=d(null,n),k=d(h,n,!0),y)return a.get("nullColor")?(x=r?a.get("nullColor"):this.calcHighlightColor(a.get("nullColor"),a),m=f>0?f-1:f,p.drawRect(u,m,this.barWidth-1,0,x,x)):i;for(C=f,w=0;b>w;w++){if(R=n[w],g&&R===h){if(!k||S)continue;S=!0}v=l>0?e.floor(c*(e.abs(R-h)/l))+1:1,h>R||R===h&&0===f?(m=C,C+=v):(m=f-v,f-=v),x=this.calcColor(w,R,t),r&&(x=this.calcHighlightColor(x,a)),o.push(p.drawRect(u,m,this.barWidth-1,v-1,x,x))}return 1===o.length?o[0]:o}}),s.fn.sparkline.tristate=k=a(s.fn.sparkline._base,b,{type:"tristate",init:function(t,e,r,n,a){var h=parseInt(r.get("barWidth"),10),o=parseInt(r.get("barSpacing"),10);k._super.init.call(this,t,e,r,n,a),this.regionShapes={},this.barWidth=h,this.barSpacing=o,this.totalBarWidth=h+o,this.values=s.map(e,Number),this.width=n=e.length*h+(e.length-1)*o,s.isArray(r.get("colorMap"))?(this.colorMapByIndex=r.get("colorMap"),this.colorMapByValue=null):(this.colorMapByIndex=null,this.colorMapByValue=r.get("colorMap"),this.colorMapByValue&&this.colorMapByValue.get===i&&(this.colorMapByValue=new y(this.colorMapByValue))),this.initTarget()},getRegion:function(t,i,s){return e.floor(i/this.totalBarWidth)},getCurrentRegionFields:function(){var t=this.currentRegion;return{isNull:this.values[t]===i,value:this.values[t],color:this.calcColor(this.values[t],t),offset:t}},calcColor:function(t,e){var i=this.values,s=this.options,r=this.colorMapByIndex,n=this.colorMapByValue,a,h;return a=n&&(h=n.get(t))?h:r&&r.length>e?r[e]:s.get(i[e]<0?"negBarColor":i[e]>0?"posBarColor":"zeroBarColor")},renderRegion:function(t,i){var s=this.values,r=this.options,n=this.target,a,h,o,l,g,p;return a=n.pixelHeight,o=e.round(a/2),l=t*this.totalBarWidth,s[t]<0?(g=o,h=o-1):s[t]>0?(g=0,h=o-1):(g=o-1,h=2),p=this.calcColor(s[t],t),null!==p?(i&&(p=this.calcHighlightColor(p,r)),n.drawRect(l,g,this.barWidth-1,h-1,p,p)):void 0}}),s.fn.sparkline.discrete=M=a(s.fn.sparkline._base,b,{type:"discrete",init:function(t,r,n,a,h){M._super.init.call(this,t,r,n,a,h),this.regionShapes={},this.values=r=s.map(r,Number),this.min=e.min.apply(e,r),this.max=e.max.apply(e,r),this.range=this.max-this.min,this.width=a="auto"===n.get("width")?2*r.length:this.width,this.interval=e.floor(a/r.length),this.itemWidth=a/r.length,n.get("chartRangeMin")!==i&&(n.get("chartRangeClip")||n.get("chartRangeMin")<this.min)&&(this.min=n.get("chartRangeMin")),n.get("chartRangeMax")!==i&&(n.get("chartRangeClip")||n.get("chartRangeMax")>this.max)&&(this.max=n.get("chartRangeMax")),this.initTarget(),this.target&&(this.lineHeight="auto"===n.get("lineHeight")?e.round(.3*this.canvasHeight):n.get("lineHeight"))},getRegion:function(t,i,s){return e.floor(i/this.itemWidth)},getCurrentRegionFields:function(){var t=this.currentRegion;return{isNull:this.values[t]===i,value:this.values[t],offset:t}},renderRegion:function(t,i){var s=this.values,r=this.options,n=this.min,a=this.max,h=this.range,l=this.interval,g=this.target,p=this.canvasHeight,u=this.lineHeight,c=p-u,d,f,m,v;return f=o(s[t],n,a),v=t*l,d=e.round(c-c*((f-n)/h)),m=r.get(r.get("thresholdColor")&&f<r.get("thresholdValue")?"thresholdColor":"lineColor"),i&&(m=this.calcHighlightColor(m,r)),g.drawLine(v,d,v,d+u,m)}}),s.fn.sparkline.bullet=_=a(s.fn.sparkline._base,{type:"bullet",init:function(t,s,r,n,a){var h,o,l;_._super.init.call(this,t,s,r,n,a),this.values=s=p(s),l=s.slice(),l[0]=null===l[0]?l[2]:l[0],l[1]=null===s[1]?l[2]:l[1],h=e.min.apply(e,s),o=e.max.apply(e,s),h=r.get("base")===i?0>h?h:0:r.get("base"),this.min=h,this.max=o,this.range=o-h,this.shapes={},this.valueShapes={},this.regiondata={},this.width=n="auto"===r.get("width")?"4.0em":n,this.target=this.$el.simpledraw(n,a,r.get("composite")),s.length||(this.disabled=!0),this.initTarget()},getRegion:function(t,e,s){var r=this.target.getShapeAt(t,e,s);return r!==i&&this.shapes[r]!==i?this.shapes[r]:i},getCurrentRegionFields:function(){var t=this.currentRegion;return{fieldkey:t.substr(0,1),value:this.values[t.substr(1)],region:t}},changeHighlight:function(t){var e=this.currentRegion,i=this.valueShapes[e],s;switch(delete this.shapes[i],e.substr(0,1)){case"r":s=this.renderRange(e.substr(1),t);break;case"p":s=this.renderPerformance(t);break;case"t":s=this.renderTarget(t)}this.valueShapes[e]=s.id,this.shapes[s.id]=e,this.target.replaceWithShape(i,s)},renderRange:function(t,i){var s=this.values[t],r=e.round(this.canvasWidth*((s-this.min)/this.range)),n=this.options.get("rangeColors")[t-2];return i&&(n=this.calcHighlightColor(n,this.options)),this.target.drawRect(0,0,r-1,this.canvasHeight-1,n,n)},renderPerformance:function(t){var i=this.values[1],s=e.round(this.canvasWidth*((i-this.min)/this.range)),r=this.options.get("performanceColor");return t&&(r=this.calcHighlightColor(r,this.options)),this.target.drawRect(0,e.round(.3*this.canvasHeight),s-1,e.round(.4*this.canvasHeight)-1,r,r)},renderTarget:function(t){var i=this.values[0],s=e.round(this.canvasWidth*((i-this.min)/this.range)-this.options.get("targetWidth")/2),r=e.round(.1*this.canvasHeight),n=this.canvasHeight-2*r,a=this.options.get("targetColor");return t&&(a=this.calcHighlightColor(a,this.options)),this.target.drawRect(s,r,this.options.get("targetWidth")-1,n-1,a,a)},render:function(){var t=this.values.length,e=this.target,i,s;if(_._super.render.call(this)){for(i=2;t>i;i++)s=this.renderRange(i).append(),this.shapes[s.id]="r"+i,this.valueShapes["r"+i]=s.id;null!==this.values[1]&&(s=this.renderPerformance().append(),this.shapes[s.id]="p1",this.valueShapes.p1=s.id),null!==this.values[0]&&(s=this.renderTarget().append(),this.shapes[s.id]="t0",this.valueShapes.t0=s.id),e.render()}}}),s.fn.sparkline.pie=H=a(s.fn.sparkline._base,{type:"pie",init:function(t,i,r,n,a){var h=0,o;if(H._super.init.call(this,t,i,r,n,a),this.shapes={},this.valueShapes={},this.values=i=s.map(i,Number),"auto"===r.get("width")&&(this.width=this.height),i.length>0)for(o=i.length;o--;)h+=i[o];this.total=h,this.initTarget(),this.radius=e.floor(e.min(this.canvasWidth,this.canvasHeight)/2)},getRegion:function(t,e,s){var r=this.target.getShapeAt(t,e,s);return r!==i&&this.shapes[r]!==i?this.shapes[r]:i},getCurrentRegionFields:function(){var t=this.currentRegion;return{isNull:this.values[t]===i,value:this.values[t],percent:this.values[t]/this.total*100,color:this.options.get("sliceColors")[t%this.options.get("sliceColors").length],offset:t}},changeHighlight:function(t){var e=this.currentRegion,i=this.renderSlice(e,t),s=this.valueShapes[e];delete this.shapes[s],this.target.replaceWithShape(s,i),this.valueShapes[e]=i.id,this.shapes[i.id]=e},renderSlice:function(t,s){var r=this.target,n=this.options,a=this.radius,h=n.get("borderWidth"),o=n.get("offset"),l=2*e.PI,g=this.values,p=this.total,u=o?2*e.PI*(o/360):0,c,d,f,m,v;for(m=g.length,f=0;m>f;f++){if(c=u,d=u,p>0&&(d=u+l*(g[f]/p)),t===f)return v=n.get("sliceColors")[f%n.get("sliceColors").length],s&&(v=this.calcHighlightColor(v,n)),r.drawPieSlice(a,a,a-h,c,d,i,v);u=d}},render:function(){var t=this.target,s=this.values,r=this.options,n=this.radius,a=r.get("borderWidth"),h,o; +if(H._super.render.call(this)){for(a&&t.drawCircle(n,n,e.floor(n-a/2),r.get("borderColor"),i,a).append(),o=s.length;o--;)s[o]&&(h=this.renderSlice(o).append(),this.valueShapes[o]=h.id,this.shapes[h.id]=o);t.render()}}}),s.fn.sparkline.box=W=a(s.fn.sparkline._base,{type:"box",init:function(t,e,i,r,n){W._super.init.call(this,t,e,i,r,n),this.values=s.map(e,Number),this.width="auto"===i.get("width")?"4.0em":r,this.initTarget(),this.values.length||(this.disabled=1)},getRegion:function(){return 1},getCurrentRegionFields:function(){var t=[{field:"lq",value:this.quartiles[0]},{field:"med",value:this.quartiles[1]},{field:"uq",value:this.quartiles[2]}];return this.loutlier!==i&&t.push({field:"lo",value:this.loutlier}),this.routlier!==i&&t.push({field:"ro",value:this.routlier}),this.lwhisker!==i&&t.push({field:"lw",value:this.lwhisker}),this.rwhisker!==i&&t.push({field:"rw",value:this.rwhisker}),t},render:function(){var t=this.target,s=this.values,r=s.length,n=this.options,a=this.canvasWidth,h=this.canvasHeight,o=n.get("chartRangeMin")===i?e.min.apply(e,s):n.get("chartRangeMin"),g=n.get("chartRangeMax")===i?e.max.apply(e,s):n.get("chartRangeMax"),p=0,u,c,d,f,m,v,x,y,C,w,b;if(W._super.render.call(this)){if(n.get("raw"))n.get("showOutliers")&&s.length>5?(c=s[0],u=s[1],f=s[2],m=s[3],v=s[4],x=s[5],y=s[6]):(u=s[0],f=s[1],m=s[2],v=s[3],x=s[4]);else if(s.sort(function(t,e){return t-e}),f=l(s,1),m=l(s,2),v=l(s,3),d=v-f,n.get("showOutliers")){for(u=x=i,C=0;r>C;C++)u===i&&s[C]>f-d*n.get("outlierIQR")&&(u=s[C]),s[C]<v+d*n.get("outlierIQR")&&(x=s[C]);c=s[0],y=s[r-1]}else u=s[0],x=s[r-1];this.quartiles=[f,m,v],this.lwhisker=u,this.rwhisker=x,this.loutlier=c,this.routlier=y,b=a/(g-o+1),n.get("showOutliers")&&(p=e.ceil(n.get("spotRadius")),a-=2*e.ceil(n.get("spotRadius")),b=a/(g-o+1),u>c&&t.drawCircle((c-o)*b+p,h/2,n.get("spotRadius"),n.get("outlierLineColor"),n.get("outlierFillColor")).append(),y>x&&t.drawCircle((y-o)*b+p,h/2,n.get("spotRadius"),n.get("outlierLineColor"),n.get("outlierFillColor")).append()),t.drawRect(e.round((f-o)*b+p),e.round(.1*h),e.round((v-f)*b),e.round(.8*h),n.get("boxLineColor"),n.get("boxFillColor")).append(),t.drawLine(e.round((u-o)*b+p),e.round(h/2),e.round((f-o)*b+p),e.round(h/2),n.get("lineColor")).append(),t.drawLine(e.round((u-o)*b+p),e.round(h/4),e.round((u-o)*b+p),e.round(h-h/4),n.get("whiskerColor")).append(),t.drawLine(e.round((x-o)*b+p),e.round(h/2),e.round((v-o)*b+p),e.round(h/2),n.get("lineColor")).append(),t.drawLine(e.round((x-o)*b+p),e.round(h/4),e.round((x-o)*b+p),e.round(h-h/4),n.get("whiskerColor")).append(),t.drawLine(e.round((m-o)*b+p),e.round(.1*h),e.round((m-o)*b+p),e.round(.9*h),n.get("medianColor")).append(),n.get("target")&&(w=e.ceil(n.get("spotRadius")),t.drawLine(e.round((n.get("target")-o)*b+p),e.round(h/2-w),e.round((n.get("target")-o)*b+p),e.round(h/2+w),n.get("targetColor")).append(),t.drawLine(e.round((n.get("target")-o)*b+p-w),e.round(h/2),e.round((n.get("target")-o)*b+p+w),e.round(h/2),n.get("targetColor")).append()),t.render()}}}),I=a({init:function(t,e,i,s){this.target=t,this.id=e,this.type=i,this.args=s},append:function(){return this.target.appendShape(this),this}}),j=a({_pxregex:/(\d+)(px)?\s*$/i,init:function(t,e,i){t&&(this.width=t,this.height=e,this.target=i,this.lastShapeId=null,i[0]&&(i=i[0]),s.data(i,"_jqs_vcanvas",this))},drawLine:function(t,e,i,s,r,n){return this.drawShape([[t,e],[i,s]],r,n)},drawShape:function(t,e,i,s){return this._genShape("Shape",[t,e,i,s])},drawCircle:function(t,e,i,s,r,n){return this._genShape("Circle",[t,e,i,s,r,n])},drawPieSlice:function(t,e,i,s,r,n,a){return this._genShape("PieSlice",[t,e,i,s,r,n,a])},drawRect:function(t,e,i,s,r,n){return this._genShape("Rect",[t,e,i,s,r,n])},getElement:function(){return this.canvas},getLastShapeId:function(){return this.lastShapeId},reset:function(){alert("reset not implemented")},_insert:function(t,e){s(e).html(t)},_calculatePixelDims:function(t,e,i){var r;r=this._pxregex.exec(e),this.pixelHeight=r?r[1]:s(i).height(),r=this._pxregex.exec(t),this.pixelWidth=r?r[1]:s(i).width()},_genShape:function(t,e){var i=F++;return e.unshift(i),new I(this,i,t,e)},appendShape:function(t){alert("appendShape not implemented")},replaceWithShape:function(t,e){alert("replaceWithShape not implemented")},insertAfterShape:function(t,e){alert("insertAfterShape not implemented")},removeShapeId:function(t){alert("removeShapeId not implemented")},getShapeAt:function(t,e,i){alert("getShapeAt not implemented")},render:function(){alert("render not implemented")}}),P=a(j,{init:function(e,r,n,a){P._super.init.call(this,e,r,n),this.canvas=t.createElement("canvas"),n[0]&&(n=n[0]),s.data(n,"_jqs_vcanvas",this),s(this.canvas).css({display:"inline-block",width:e,height:r,verticalAlign:"top"}),this._insert(this.canvas,n),this._calculatePixelDims(e,r,this.canvas),this.canvas.width=this.pixelWidth,this.canvas.height=this.pixelHeight,this.interact=a,this.shapes={},this.shapeseq=[],this.currentTargetShapeId=i,s(this.canvas).css({width:this.pixelWidth,height:this.pixelHeight})},_getContext:function(t,e,s){var r=this.canvas.getContext("2d");return t!==i&&(r.strokeStyle=t),r.lineWidth=s===i?1:s,e!==i&&(r.fillStyle=e),r},reset:function(){var t=this._getContext();t.clearRect(0,0,this.pixelWidth,this.pixelHeight),this.shapes={},this.shapeseq=[],this.currentTargetShapeId=i},_drawShape:function(t,e,s,r,n){var a=this._getContext(s,r,n),h,o;for(a.beginPath(),a.moveTo(e[0][0]+.5,e[0][1]+.5),h=1,o=e.length;o>h;h++)a.lineTo(e[h][0]+.5,e[h][1]+.5);s!==i&&a.stroke(),r!==i&&a.fill(),this.targetX!==i&&this.targetY!==i&&a.isPointInPath(this.targetX,this.targetY)&&(this.currentTargetShapeId=t)},_drawCircle:function(t,s,r,n,a,h,o){var l=this._getContext(a,h,o);l.beginPath(),l.arc(s,r,n,0,2*e.PI,!1),this.targetX!==i&&this.targetY!==i&&l.isPointInPath(this.targetX,this.targetY)&&(this.currentTargetShapeId=t),a!==i&&l.stroke(),h!==i&&l.fill()},_drawPieSlice:function(t,e,s,r,n,a,h,o){var l=this._getContext(h,o);l.beginPath(),l.moveTo(e,s),l.arc(e,s,r,n,a,!1),l.lineTo(e,s),l.closePath(),h!==i&&l.stroke(),o&&l.fill(),this.targetX!==i&&this.targetY!==i&&l.isPointInPath(this.targetX,this.targetY)&&(this.currentTargetShapeId=t)},_drawRect:function(t,e,i,s,r,n,a){return this._drawShape(t,[[e,i],[e+s,i],[e+s,i+r],[e,i+r],[e,i]],n,a)},appendShape:function(t){return this.shapes[t.id]=t,this.shapeseq.push(t.id),this.lastShapeId=t.id,t.id},replaceWithShape:function(t,e){var i=this.shapeseq,s;for(this.shapes[e.id]=e,s=i.length;s--;)i[s]==t&&(i[s]=e.id);delete this.shapes[t]},replaceWithShapes:function(t,e){var i=this.shapeseq,s={},r,n,a;for(n=t.length;n--;)s[t[n]]=!0;for(n=i.length;n--;)r=i[n],s[r]&&(i.splice(n,1),delete this.shapes[r],a=n);for(n=e.length;n--;)i.splice(a,0,e[n].id),this.shapes[e[n].id]=e[n]},insertAfterShape:function(t,e){var i=this.shapeseq,s;for(s=i.length;s--;)if(i[s]===t)return i.splice(s+1,0,e.id),void(this.shapes[e.id]=e)},removeShapeId:function(t){var e=this.shapeseq,i;for(i=e.length;i--;)if(e[i]===t){e.splice(i,1);break}delete this.shapes[t]},getShapeAt:function(t,e,i){return this.targetX=e,this.targetY=i,this.render(),this.currentTargetShapeId},render:function(){var t=this.shapeseq,e=this.shapes,i=t.length,s=this._getContext(),r,n,a;for(s.clearRect(0,0,this.pixelWidth,this.pixelHeight),a=0;i>a;a++)r=t[a],n=e[r],this["_draw"+n.type].apply(this,n.args);this.interact||(this.shapes={},this.shapeseq=[])}}),L=a(j,{init:function(e,i,r){var n;L._super.init.call(this,e,i,r),r[0]&&(r=r[0]),s.data(r,"_jqs_vcanvas",this),this.canvas=t.createElement("span"),s(this.canvas).css({display:"inline-block",position:"relative",overflow:"hidden",width:e,height:i,margin:"0px",padding:"0px",verticalAlign:"top"}),this._insert(this.canvas,r),this._calculatePixelDims(e,i,this.canvas),this.canvas.width=this.pixelWidth,this.canvas.height=this.pixelHeight,n='<v:group coordorigin="0 0" coordsize="'+this.pixelWidth+" "+this.pixelHeight+'" style="position:absolute;top:0;left:0;width:'+this.pixelWidth+"px;height="+this.pixelHeight+'px;"></v:group>',this.canvas.insertAdjacentHTML("beforeEnd",n),this.group=s(this.canvas).children()[0],this.rendered=!1,this.prerender=""},_drawShape:function(t,e,s,r,n){var a=[],h,o,l,g,p,u,c;for(c=0,u=e.length;u>c;c++)a[c]=""+e[c][0]+","+e[c][1];return h=a.splice(0,1),n=n===i?1:n,o=s===i?' stroked="false" ':' strokeWeight="'+n+'px" strokeColor="'+s+'" ',l=r===i?' filled="false"':' fillColor="'+r+'" filled="true" ',g=a[0]===a[a.length-1]?"x ":"",p='<v:shape coordorigin="0 0" coordsize="'+this.pixelWidth+" "+this.pixelHeight+'" id="jqsshape'+t+'" '+o+l+' style="position:absolute;left:0px;top:0px;height:'+this.pixelHeight+"px;width:"+this.pixelWidth+'px;padding:0px;margin:0px;" path="m '+h+" l "+a.join(", ")+" "+g+'e"> </v:shape>'},_drawCircle:function(t,e,s,r,n,a,h){var o,l,g;return e-=r,s-=r,o=n===i?' stroked="false" ':' strokeWeight="'+h+'px" strokeColor="'+n+'" ',l=a===i?' filled="false"':' fillColor="'+a+'" filled="true" ',g='<v:oval id="jqsshape'+t+'" '+o+l+' style="position:absolute;top:'+s+"px; left:"+e+"px; width:"+2*r+"px; height:"+2*r+'px"></v:oval>'},_drawPieSlice:function(t,s,r,n,a,h,o,l){var g,p,u,c,d,f,m,v;if(a===h)return"";if(h-a===2*e.PI&&(a=0,h=2*e.PI),p=s+e.round(e.cos(a)*n),u=r+e.round(e.sin(a)*n),c=s+e.round(e.cos(h)*n),d=r+e.round(e.sin(h)*n),p===c&&u===d){if(h-a<e.PI)return"";p=c=s+n,u=d=r}return p===c&&u===d&&h-a<e.PI?"":(g=[s-n,r-n,s+n,r+n,p,u,c,d],f=o===i?' stroked="false" ':' strokeWeight="1px" strokeColor="'+o+'" ',m=l===i?' filled="false"':' fillColor="'+l+'" filled="true" ',v='<v:shape coordorigin="0 0" coordsize="'+this.pixelWidth+" "+this.pixelHeight+'" id="jqsshape'+t+'" '+f+m+' style="position:absolute;left:0px;top:0px;height:'+this.pixelHeight+"px;width:"+this.pixelWidth+'px;padding:0px;margin:0px;" path="m '+s+","+r+" wa "+g.join(", ")+' x e"> </v:shape>')},_drawRect:function(t,e,i,s,r,n,a){return this._drawShape(t,[[e,i],[e,i+r],[e+s,i+r],[e+s,i],[e,i]],n,a)},reset:function(){this.group.innerHTML=""},appendShape:function(t){var e=this["_draw"+t.type].apply(this,t.args);return this.rendered?this.group.insertAdjacentHTML("beforeEnd",e):this.prerender+=e,this.lastShapeId=t.id,t.id},replaceWithShape:function(t,e){var i=s("#jqsshape"+t),r=this["_draw"+e.type].apply(this,e.args);i[0].outerHTML=r},replaceWithShapes:function(t,e){var i=s("#jqsshape"+t[0]),r="",n=e.length,a;for(a=0;n>a;a++)r+=this["_draw"+e[a].type].apply(this,e[a].args);for(i[0].outerHTML=r,a=1;a<t.length;a++)s("#jqsshape"+t[a]).remove()},insertAfterShape:function(t,e){var i=s("#jqsshape"+t),r=this["_draw"+e.type].apply(this,e.args);i[0].insertAdjacentHTML("afterEnd",r)},removeShapeId:function(t){var e=s("#jqsshape"+t);this.group.removeChild(e[0])},getShapeAt:function(t,e,i){var s=t.id.substr(8);return s},render:function(){this.rendered||(this.group.innerHTML=this.prerender,this.rendered=!0)}})})}(document,Math)}(); + +!function(){"undefined"==typeof web3&&(web3=require("web3"),web3.setProvider(new web3.providers.HttpSyncProvider("http://localhost:8545")))}(); + +!function(){Template.views_home.created=function(){var e=Blocks.findOne({},{sort:{number:-1}}),t=GeoPattern.generate(e?e.hash:"---");$(".latest-block-info").css("background-image",t.toDataUrl());try{if(void 0!=web3.eth.number)for(currentBlock=web3.eth.number,Blocks.remove({number:{$lt:currentBlock-50}}),i=currentBlock;i>currentBlock-10;i--)Blocks.upsert("block_"+i,{_id:"block_"+i,number:i,gasUsed:web3.eth.block(i).gasUsed,size:web3.eth.block(i).size,time:web3.eth.block(i).time,hash:web3.eth.block(i).hash,miner:web3.eth.block(i).coinbase,uncles:web3.eth.block(i).uncles.Length})}catch(n){console.log("no web3 object")}},Template.views_home.destroyed=function(){},Template.views_home.helpers({blocks:function(){var e=Blocks.find({},{limit:50,sort:{number:-1}}),t=Template.instance();return Tracker.afterFlush(function(){t.view.isRendered&&t.$(".wrapper").css("width",562*e.count()+500+"px")}),e.fetch()},currentBlockPattern:function(){var e=GeoPattern.generate(this.hash);return e?e.toDataUrl():"white"},peerCount:function(){try{return web3.eth.peerCount}catch(e){return"---"}},gasPrice:function(){try{return EthTools.fromWei(web3.eth.gasPrice,"finney")}catch(e){return"---"}},miningSlider:function(){return Miner.mining||0},hashrate:function(){return Miner.hashrate},timeSpent:function(){var e=MiningData.findOne().totalTimeSpent;return e?180>e?Math.round(10*e)/10+"<small> Seconds </small>":10800>e?Math.round(10*e/60)/10+"<small> Minutes </small>":86400>e?Math.round(10*e/3600)/10+"<small> Hours </small>":Math.round(10*e/86400)/10+"<small> Days </small>":"---"},totalRewards:function(){var e=MiningData.findOne().totalRewards;return e&&e>0?1e3>e?Math.floor(100*e)/100+"<small> Finney </small>":e>1e6?Math.floor(e/1e3).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+"<small> Ether </small>":Math.floor(e/10)/100+"<small> Ether </small>":"---"},averageRewardPerHour:function(){var e=MiningData.findOne().totalRewards,t=MiningData.findOne().totalTimeSpent;if(e&&t>0){var n=3600*e/t;return 1e3>n?Math.floor(100*n)/100+"<small> Finney/h </small>":n>1e6?Math.floor(n/1e3).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+"<small> Ether/h </small>":Math.floor(n/10)/100+"<small> Ether/h </small>";return reward}return"---"}}),Template.views_home.events({"change input.slider-vertical, input input.slider-vertical":function(e){Miner.mining=Number(e.currentTarget.value)}})}(); + +!function(){Blocks=new Mongo.Collection("blocks",{connection:null}),new PersistentMinimongo(Blocks),MiningData=new Mongo.Collection("miningdata",{connection:null}),new PersistentMinimongo(MiningData),MiningData.findOne()||MiningData.insert({totalTimeSpent:0,lastCoinbaseBalance:0,totalRewards:0})}(); + +!function(){"localhost:3000"!==location.host&&"127.0.0.1:3000"!==location.host&&Meteor.disconnect(),Meteor.startup(function(){if(Cookie.get("TAPi18next"))TAPi18n.setLanguage(Cookie.get("TAPi18next"));else{var e=navigator.language||navigator.userLanguage,n=TAPi18n.getLanguages();TAPi18n.setLanguage(_.isObject(n)&&n[e]?e:_.isObject(n)&&n[e.substr(0,2)]?e.substr(0,2):"en")}Tracker.autorun(function(){_.isString(TAPi18n.getLanguage())&&(moment.locale(TAPi18n.getLanguage().substr(0,2)),numeral.language(TAPi18n.getLanguage().substr(0,2)))})})}(); + +!function(){var e=function(e,n,r){_.isUndefined(r)||(e["__tracker_"+n+"_value__"]=r),e["__tracker_"+n+"_dependency__"]=new Tracker.Dependency,Object.defineProperty(e,n,{get:function(){return this["__tracker_"+n+"_dependency__"].depend(),this["__tracker_"+n+"_value__"]},set:function(_){_!==this["__tracker_"+n+"_value__"]&&(this["__tracker_"+n+"_value__"]=_,this["__tracker_"+n+"_dependency__"].changed())}})};Miner={},e(Miner,"mining",0),e(Miner,"hashrate",0)}(); + +!function(){Router.configure({layoutTemplate:"layout_main",yieldRegions:{layout_header:{to:"header"}},autoRun:!1,autoRender:!1}),Router.route("/",{template:"views_home",name:"home"}),Router.route("/profile",{template:"views_home",name:"userProfile"})}(); + +!function(){var e=web3.eth.watch("chain");e.changed(function(e){if(e.number=web3.eth.number,Blocks.upsert("block_"+e.number,{_id:"block_"+e.number,number:e.number,gasUsed:web3.eth.block(e.number).gasUsed,size:web3.eth.block(e.number).size,time:web3.eth.block(e.number).time,hash:web3.eth.block(e.number).hash,miner:web3.eth.block(e.number).coinbase,uncles:web3.eth.block(e.number).uncles.Length}),web3.eth.coinbase==web3.eth.block(e.number).coinbase){var a=MiningData.findOne();WeiToFin=1e15,lastBalance=a.lastCoinbaseBalance||Number(web3.toDecimal(web3.eth.balanceAt(web3.eth.coinbase)))/WeiToFin,currentBalance=Number(web3.toDecimal(web3.eth.balanceAt(web3.eth.coinbase)))/WeiToFin,blockReward=currentBalance-lastBalance,console.log("New Block! last balance: "+a.lastCoinbaseBalance+" Reward: "+blockReward),MiningData.update(a._id,{$inc:{totalRewards:blockReward}}),MiningData.update(a._id,{$set:{lastCoinbaseBalance:currentBalance}})}else{WeiToFin=1e15,currentBalance=Number(web3.toDecimal(web3.eth.balanceAt(web3.eth.coinbase)))/WeiToFin;var a=MiningData.findOne();MiningData.update(a._id,{lastCoinbaseBalance:currentBalance}),console.log("New Block! last balance: "+a.lastCoinbaseBalance)}})}(); + +!function(){var n=Package.underscore._,e="project",o="project";"project"!=e&&(o=TAPi18n.packages[e].namespace),TAPi18n._enable({helper_name:"_",supported_languages:null,i18n_files_route:"/tap-i18n",cdn_path:null}),TAPi18n.languages_names.en=["English","English"],translations={},translations[o]={app:{loading:"Loading...",offline:"Can't connect are you offline?",logginIn:"Logging in..."},error:{insufficientRights:"You don't have enough rights for this action."},buttons:{ok:"OK",cancel:"Cancel",save:"Save",edit:"edit",send:"Send",create:"Create",tryToReconnect:"Try to reconnect"},commonWords:{you:"You",send:"Send",or:"or","with":"with",and:"and",on:"on",off:"off",per:"per"}},TAPi18n._loadLangFileObject("en",translations)}(); + +!function(){var e=Package.underscore._,n="project",a="project";"project"!=n&&(a=TAPi18n.packages[n].namespace),translations={},translations[a]={network:{home:{NetworkHealth:"Network Health",Mining:"Mining",MiningStatus:"Mining Status",on:"On",off:"Off",TimeSpent:"Time Spent",Rewards:"Rewards",AverageReward:"Average Reward",Connections:"Connections",PeerCount:"Peer Count",Peers:"Peers",GasPrice:"Gas Price",Finney:"Finney",Blockchain:"Blockchain",Block:"Block",GasUsed:"Gas Used",Size:"Size",Uncles:"Number of uncles",Time:"Time",EndOfBlocks:"No more loaded blocks"}}},TAPi18n._loadLangFileObject("en",translations)}(); + +!function(){TAPi18n._enable({helper_name:"i18n",supported_languages:["en","de"],i18n_files_route:"/i18n",cdn_path:null}),TAPi18n.languages_names.en=["English","English"],TAPi18n.languages_names.en=["English","English"],TAPi18n.languages_names.de=["German","Deutsch"]}();
\ No newline at end of file diff --git a/cmd/mist/assets/qml/views/network-health/529f30ee0ee386c5143b4ccb62073179ca8253c3.css b/cmd/mist/assets/qml/views/network-health/529f30ee0ee386c5143b4ccb62073179ca8253c3.css new file mode 100644 index 000000000..379e5808b --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/529f30ee0ee386c5143b4ccb62073179ca8253c3.css @@ -0,0 +1,4 @@ +@font-face{font-family:'Simple-Line-Icons';src:url('packages/ethereum_elements/icons/Simple-Line-Icons.eot');src:url('packages/ethereum_elements/icons/Simple-Line-Icons.eot?') format('embedded-opentype'), + url('packages/ethereum_elements/icons/Simple-Line-Icons.woff') format('woff'), + url('packages/ethereum_elements/icons/Simple-Line-Icons.ttf') format('truetype'), + url('packages/ethereum_elements/icons/Simple-Line-Icons.svg') format('svg');font-weight:normal;font-style:normal}[data-icon]:before{font-family:'Simple-Line-Icons';content:attr(data-icon);speak:none;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-user-female,.icon-user-follow,.icon-user-following,.icon-user-unfollow,.icon-trophy,.icon-screen-smartphone,.icon-screen-desktop,.icon-plane,.icon-notebook,.icon-moustache,.icon-mouse,.icon-magnet,.icon-energy,.icon-emoticon-smile,.icon-disc,.icon-cursor-move,.icon-crop,.icon-credit-card,.icon-chemistry,.icon-user,.icon-speedometer,.icon-social-youtube,.icon-social-twitter,.icon-social-tumblr,.icon-social-facebook,.icon-social-dropbox,.icon-social-dribbble,.icon-shield,.icon-screen-tablet,.icon-magic-wand,.icon-hourglass,.icon-graduation,.icon-ghost,.icon-game-controller,.icon-fire,.icon-eyeglasses,.icon-envelope-open,.icon-envelope-letter,.icon-bell,.icon-badge,.icon-anchor,.icon-wallet,.icon-vector,.icon-speech,.icon-puzzle,.icon-printer,.icon-present,.icon-playlist,.icon-pin,.icon-picture,.icon-map,.icon-layers,.icon-handbag,.icon-globe-alt,.icon-globe,.icon-frame,.icon-folder-alt,.icon-film,.icon-feed,.icon-earphones-alt,.icon-earphones,.icon-drop,.icon-drawer,.icon-docs,.icon-directions,.icon-direction,.icon-diamond,.icon-cup,.icon-compass,.icon-call-out,.icon-call-in,.icon-call-end,.icon-calculator,.icon-bubbles,.icon-briefcase,.icon-book-open,.icon-basket-loaded,.icon-basket,.icon-bag,.icon-action-undo,.icon-action-redo,.icon-wrench,.icon-umbrella,.icon-trash,.icon-tag,.icon-support,.icon-size-fullscreen,.icon-size-actual,.icon-shuffle,.icon-share-alt,.icon-share,.icon-rocket,.icon-question,.icon-pie-chart,.icon-pencil,.icon-note,.icon-music-tone-alt,.icon-music-tone,.icon-microphone,.icon-loop,.icon-logout,.icon-login,.icon-list,.icon-like,.icon-home,.icon-grid,.icon-graph,.icon-equalizer,.icon-dislike,.icon-cursor,.icon-control-start,.icon-control-rewind,.icon-control-play,.icon-control-pause,.icon-control-forward,.icon-control-end,.icon-calendar,.icon-bulb,.icon-bar-chart,.icon-arrow-up,.icon-arrow-right,.icon-arrow-left,.icon-arrow-down,.icon-ban,.icon-bubble,.icon-camcorder,.icon-camera,.icon-check,.icon-clock,.icon-close,.icon-cloud-download,.icon-cloud-upload,.icon-doc,.icon-envelope,.icon-eye,.icon-flag,.icon-folder,.icon-heart,.icon-info,.icon-key,.icon-link,.icon-lock,.icon-lock-open,.icon-magnifier,.icon-magnifier-add,.icon-magnifier-remove,.icon-paper-clip,.icon-paper-plane,.icon-plus,.icon-pointer,.icon-power,.icon-refresh,.icon-reload,.icon-settings,.icon-star,.icon-symbol-female,.icon-symbol-male,.icon-target,.icon-volume-1,.icon-volume-2,.icon-volume-off,.icon-users{font-family:'Simple-Line-Icons';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased}.icon-user-female:before{content:"\e000"}.icon-user-follow:before{content:"\e002"}.icon-user-following:before{content:"\e003"}.icon-user-unfollow:before{content:"\e004"}.icon-trophy:before{content:"\e006"}.icon-screen-smartphone:before{content:"\e010"}.icon-screen-desktop:before{content:"\e011"}.icon-plane:before{content:"\e012"}.icon-notebook:before{content:"\e013"}.icon-moustache:before{content:"\e014"}.icon-mouse:before{content:"\e015"}.icon-magnet:before{content:"\e016"}.icon-energy:before{content:"\e020"}.icon-emoticon-smile:before{content:"\e021"}.icon-disc:before{content:"\e022"}.icon-cursor-move:before{content:"\e023"}.icon-crop:before{content:"\e024"}.icon-credit-card:before{content:"\e025"}.icon-chemistry:before{content:"\e026"}.icon-user:before{content:"\e005"}.icon-speedometer:before{content:"\e007"}.icon-social-youtube:before{content:"\e008"}.icon-social-twitter:before{content:"\e009"}.icon-social-tumblr:before{content:"\e00a"}.icon-social-facebook:before{content:"\e00b"}.icon-social-dropbox:before{content:"\e00c"}.icon-social-dribbble:before{content:"\e00d"}.icon-shield:before{content:"\e00e"}.icon-screen-tablet:before{content:"\e00f"}.icon-magic-wand:before{content:"\e017"}.icon-hourglass:before{content:"\e018"}.icon-graduation:before{content:"\e019"}.icon-ghost:before{content:"\e01a"}.icon-game-controller:before{content:"\e01b"}.icon-fire:before{content:"\e01c"}.icon-eyeglasses:before{content:"\e01d"}.icon-envelope-open:before{content:"\e01e"}.icon-envelope-letter:before{content:"\e01f"}.icon-bell:before{content:"\e027"}.icon-badge:before{content:"\e028"}.icon-anchor:before{content:"\e029"}.icon-wallet:before{content:"\e02a"}.icon-vector:before{content:"\e02b"}.icon-speech:before{content:"\e02c"}.icon-puzzle:before{content:"\e02d"}.icon-printer:before{content:"\e02e"}.icon-present:before{content:"\e02f"}.icon-playlist:before{content:"\e030"}.icon-pin:before{content:"\e031"}.icon-picture:before{content:"\e032"}.icon-map:before{content:"\e033"}.icon-layers:before{content:"\e034"}.icon-handbag:before{content:"\e035"}.icon-globe-alt:before{content:"\e036"}.icon-globe:before{content:"\e037"}.icon-frame:before{content:"\e038"}.icon-folder-alt:before{content:"\e039"}.icon-film:before{content:"\e03a"}.icon-feed:before{content:"\e03b"}.icon-earphones-alt:before{content:"\e03c"}.icon-earphones:before{content:"\e03d"}.icon-drop:before{content:"\e03e"}.icon-drawer:before{content:"\e03f"}.icon-docs:before{content:"\e040"}.icon-directions:before{content:"\e041"}.icon-direction:before{content:"\e042"}.icon-diamond:before{content:"\e043"}.icon-cup:before{content:"\e044"}.icon-compass:before{content:"\e045"}.icon-call-out:before{content:"\e046"}.icon-call-in:before{content:"\e047"}.icon-call-end:before{content:"\e048"}.icon-calculator:before{content:"\e049"}.icon-bubbles:before{content:"\e04a"}.icon-briefcase:before{content:"\e04b"}.icon-book-open:before{content:"\e04c"}.icon-basket-loaded:before{content:"\e04d"}.icon-basket:before{content:"\e04e"}.icon-bag:before{content:"\e04f"}.icon-action-undo:before{content:"\e050"}.icon-action-redo:before{content:"\e051"}.icon-wrench:before{content:"\e052"}.icon-umbrella:before{content:"\e053"}.icon-trash:before{content:"\e054"}.icon-tag:before{content:"\e055"}.icon-support:before{content:"\e056"}.icon-size-fullscreen:before{content:"\e057"}.icon-size-actual:before{content:"\e058"}.icon-shuffle:before{content:"\e059"}.icon-share-alt:before{content:"\e05a"}.icon-share:before{content:"\e05b"}.icon-rocket:before{content:"\e05c"}.icon-question:before{content:"\e05d"}.icon-pie-chart:before{content:"\e05e"}.icon-pencil:before{content:"\e05f"}.icon-note:before{content:"\e060"}.icon-music-tone-alt:before{content:"\e061"}.icon-music-tone:before{content:"\e062"}.icon-microphone:before{content:"\e063"}.icon-loop:before{content:"\e064"}.icon-logout:before{content:"\e065"}.icon-login:before{content:"\e066"}.icon-list:before{content:"\e067"}.icon-like:before{content:"\e068"}.icon-home:before{content:"\e069"}.icon-grid:before{content:"\e06a"}.icon-graph:before{content:"\e06b"}.icon-equalizer:before{content:"\e06c"}.icon-dislike:before{content:"\e06d"}.icon-cursor:before{content:"\e06e"}.icon-control-start:before{content:"\e06f"}.icon-control-rewind:before{content:"\e070"}.icon-control-play:before{content:"\e071"}.icon-control-pause:before{content:"\e072"}.icon-control-forward:before{content:"\e073"}.icon-control-end:before{content:"\e074"}.icon-calendar:before{content:"\e075"}.icon-bulb:before{content:"\e076"}.icon-bar-chart:before{content:"\e077"}.icon-arrow-up:before{content:"\e078"}.icon-arrow-right:before{content:"\e079"}.icon-arrow-left:before{content:"\e07a"}.icon-arrow-down:before{content:"\e07b"}.icon-ban:before{content:"\e07c"}.icon-bubble:before{content:"\e07d"}.icon-camcorder:before{content:"\e07e"}.icon-camera:before{content:"\e07f"}.icon-check:before{content:"\e080"}.icon-clock:before{content:"\e081"}.icon-close:before{content:"\e082"}.icon-cloud-download:before{content:"\e083"}.icon-cloud-upload:before{content:"\e084"}.icon-doc:before{content:"\e085"}.icon-envelope:before{content:"\e086"}.icon-eye:before{content:"\e087"}.icon-flag:before{content:"\e088"}.icon-folder:before{content:"\e089"}.icon-heart:before{content:"\e08a"}.icon-info:before{content:"\e08b"}.icon-key:before{content:"\e08c"}.icon-link:before{content:"\e08d"}.icon-lock:before{content:"\e08e"}.icon-lock-open:before{content:"\e08f"}.icon-magnifier:before{content:"\e090"}.icon-magnifier-add:before{content:"\e091"}.icon-magnifier-remove:before{content:"\e092"}.icon-paper-clip:before{content:"\e093"}.icon-paper-plane:before{content:"\e094"}.icon-plus:before{content:"\e095"}.icon-pointer:before{content:"\e096"}.icon-power:before{content:"\e097"}.icon-refresh:before{content:"\e098"}.icon-reload:before{content:"\e099"}.icon-settings:before{content:"\e09a"}.icon-star:before{content:"\e09b"}.icon-symbol-female:before{content:"\e09c"}.icon-symbol-male:before{content:"\e09d"}.icon-target:before{content:"\e09e"}.icon-volume-1:before{content:"\e09f"}.icon-volume-2:before{content:"\e0a0"}.icon-volume-off:before{content:"\e0a1"}.icon-users:before{content:"\e001"}body.disable-scroll{overflow:hidden}body.blur .dapp-flex-content,body.blur .dapp-footer,body.blur .dapp-header{-webkit-filter:blur(4px);-moz-filter:blur(4px);-ms-filter:blur(4px);filter:blur(4px)}.dapp-modal-overlay{z-index:99;position:fixed;top:0;left:0;right:0;bottom:0;display:-webkit-box;display:-moz-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:start;-moz-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;-webkit-box-pack:center;-moz-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;background:rgba(17, 17, 17, 0.5);-webkit-transition:opacity 400ms;-moz-transition:opacity 400ms;-o-transition:opacity 400ms;transition:opacity 400ms}.dapp-modal-overlay.animate{zoom:1;filter:alpha(opacity=0);-webkit-opacity:0;-moz-opacity:0;opacity:0}.dapp-modal-overlay.animate .dapp-modal-container{-webkit-transform:translateY(-20%);-moz-transform:translateY(-20%);-o-transform:translateY(-20%);-ms-transform:translateY(-20%);transform:translateY(-20%)}.dapp-modal-container{position:relative;width:448px;margin:110.4px auto;padding:18.4px 32px;background:#fafafa;box-sizing:border-box;box-shadow:0 1px 4px rgba(0, 0, 0, 0.3);border-radius:3px;text-align:center;-webkit-transition:-webkit-transform 400ms;-moz-transition:-moz-transform 400ms;-o-transition:-o-transform 400ms;transition:-webkit-transform 400ms,-moz-transform 400ms,-o-transform 400ms,transform 400ms}.dapp-modal-container .dapp-modal-header{position:relative;padding:36.8px 0;margin:-18.4px -32px;margin-bottom:18.4px;border-radius:2px 2px 0 0;color:#111111;line-height:36.8px;text-align:center}.dapp-modal-container .dapp-modal-header.dapp-pattern{color:#fafafa}.dapp-modal-container .dapp-modal-header h1{margin:0}.dapp-modal-container .dapp-modal-header .dapp-identicon{position:absolute;top:-34.96px;left:50%;margin-left:-32px}.dapp-modal-container p{margin:36.8px 0;line-height:22.08px;font-size:1.2em}.dapp-overflow{overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch}.dapp-shadow-none{box-shadow:0 0 0 rgba(0, 0, 0, 0)}.dapp-shadow-small{box-shadow:0 0px 1px rgba(0, 0, 0, 0.3)}.dapp-shadow-medium{box-shadow:0 1px 4px rgba(0, 0, 0, 0.3)}.dapp-shadow-large{box-shadow:0 1px 16px rgba(0, 0, 0, 0.3)}.dapp-input{display:inline-block;width:300px;max-width:100%;margin-top:18.4px;padding:9.2px 16px;padding-bottom:6.13333333px;border:0;border-bottom:solid 2px #dddcdb;box-sizing:border-box;background-color:#f5f4f2;font-size:1em;font-weight:300;color:#6691c2}.dapp-input::-webkit-input-placeholder{color:#dddcdb}.dapp-input:-moz-placeholder{color:#dddcdb}.dapp-input::-moz-placeholder{color:#dddcdb}.dapp-input:-ms-input-placeholder{color:#dddcdb}.dapp-input:focus{outline:0}.dapp-input.dapp-large{font-size:1.5em}.dapp-input.dapp-error{color:#c20e25;background:rgba(194, 14, 37, 0.1);border-color:rgba(194, 14, 37, 0.15)}.dapp-input:disabled{color:#797673}.dapp-identicon{display:inline-block;width:64px;height:64px;border-radius:50%;background-size:cover;background-positon:50% 50%;box-shadow:inset rgba(255, 255, 255, 0.2) 0 2px 2px, inset rgba(0, 0, 0, 0.3) 0 -1px 8px}.dapp-identicon.dapp-small{width:32px;height:32px}.dapp-identicon.dapp-medium{width:48px;height:48px}.dapp-modal-buttons{position:relative;display:-webkit-box;display:-moz-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-moz-box-pack:end;-ms-flex-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end;margin-top:16px}.dapp-modal-buttons button,.dapp-modal-buttons a,.dapp-modal-buttons a:visited{-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;margin:0 8px;height:36.8px;line-height:36.8px;font-family:'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, Sans;font-size:0.9em;text-transform:uppercase;font-weight:400}.dapp-modal-buttons button.dapp-primary-button,.dapp-modal-buttons a.dapp-primary-button,.dapp-modal-buttons a:visited.dapp-primary-button{font-weight:600}.dapp-address-input{position:relative}.dapp-address-input input{display:inline-block;width:300px;max-width:100%;margin-top:18.4px;padding:9.2px 16px;padding-bottom:6.13333333px;border:0;border-bottom:solid 2px #dddcdb;box-sizing:border-box;background-color:#f5f4f2;font-size:1em;font-weight:300;color:#6691c2;z-index:1;margin-top:0;padding-left:48px}.dapp-address-input input::-webkit-input-placeholder{color:#dddcdb}.dapp-address-input input:-moz-placeholder{color:#dddcdb}.dapp-address-input input::-moz-placeholder{color:#dddcdb}.dapp-address-input input:-ms-input-placeholder{color:#dddcdb}.dapp-address-input input:focus{outline:0}.dapp-address-input input.dapp-large{font-size:1.5em}.dapp-address-input input.dapp-error{color:#c20e25;background:rgba(194, 14, 37, 0.1);border-color:rgba(194, 14, 37, 0.15)}.dapp-address-input input:disabled{color:#797673}.dapp-address-input input.dapp-large{font-size:1.5em}.dapp-address-input input.dapp-large+.dapp-identicon{top:6px;width:32px;height:32px}.dapp-address-input input.dapp-large+.icon-shield{top:12px}.dapp-address-input input.dapp-error{border-color:#c20e25}.dapp-address-input .dapp-identicon{z-index:2;position:absolute;top:3px;left:5px;width:26.66666667px;height:26.66666667px}.dapp-address-input .icon-shield{position:absolute;top:6px;left:13px;font-size:1.4em;color:#c20e25}@font-face{font-family:'Simple-Line-Icons';src:url('dapp-styles/icons/Simple-Line-Icons.eot');src:url('dapp-styles/icons/Simple-Line-Icons.eot?') format('embedded-opentype'), url('dapp-styles/icons/Simple-Line-Icons.woff') format('woff'), url('dapp-styles/icons/Simple-Line-Icons.ttf') format('truetype'), url('dapp-styles/icons/Simple-Line-Icons.svg') format('svg');font-weight:normal;font-style:normal}[data-icon]:before{font-family:'Simple-Line-Icons';content:attr(data-icon);speak:none;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-user-female,.icon-user-follow,.icon-user-following,.icon-user-unfollow,.icon-trophy,.icon-screen-smartphone,.icon-screen-desktop,.icon-plane,.icon-notebook,.icon-moustache,.icon-mouse,.icon-magnet,.icon-energy,.icon-emoticon-smile,.icon-disc,.icon-cursor-move,.icon-crop,.icon-credit-card,.icon-chemistry,.icon-user,.icon-speedometer,.icon-social-youtube,.icon-social-twitter,.icon-social-tumblr,.icon-social-facebook,.icon-social-dropbox,.icon-social-dribbble,.icon-shield,.icon-screen-tablet,.icon-magic-wand,.icon-hourglass,.icon-graduation,.icon-ghost,.icon-game-controller,.icon-fire,.icon-eyeglasses,.icon-envelope-open,.icon-envelope-letter,.icon-bell,.icon-badge,.icon-anchor,.icon-wallet,.icon-vector,.icon-speech,.icon-puzzle,.icon-printer,.icon-present,.icon-playlist,.icon-pin,.icon-picture,.icon-map,.icon-layers,.icon-handbag,.icon-globe-alt,.icon-globe,.icon-frame,.icon-folder-alt,.icon-film,.icon-feed,.icon-earphones-alt,.icon-earphones,.icon-drop,.icon-drawer,.icon-docs,.icon-directions,.icon-direction,.icon-diamond,.icon-cup,.icon-compass,.icon-call-out,.icon-call-in,.icon-call-end,.icon-calculator,.icon-bubbles,.icon-briefcase,.icon-book-open,.icon-basket-loaded,.icon-basket,.icon-bag,.icon-action-undo,.icon-action-redo,.icon-wrench,.icon-umbrella,.icon-trash,.icon-tag,.icon-support,.icon-size-fullscreen,.icon-size-actual,.icon-shuffle,.icon-share-alt,.icon-share,.icon-rocket,.icon-question,.icon-pie-chart,.icon-pencil,.icon-note,.icon-music-tone-alt,.icon-music-tone,.icon-microphone,.icon-loop,.icon-logout,.icon-login,.icon-list,.icon-like,.icon-home,.icon-grid,.icon-graph,.icon-equalizer,.icon-dislike,.icon-cursor,.icon-control-start,.icon-control-rewind,.icon-control-play,.icon-control-pause,.icon-control-forward,.icon-control-end,.icon-calendar,.icon-bulb,.icon-bar-chart,.icon-arrow-up,.icon-arrow-right,.icon-arrow-left,.icon-arrow-down,.icon-ban,.icon-bubble,.icon-camcorder,.icon-camera,.icon-check,.icon-clock,.icon-close,.icon-cloud-download,.icon-cloud-upload,.icon-doc,.icon-envelope,.icon-eye,.icon-flag,.icon-folder,.icon-heart,.icon-info,.icon-key,.icon-link,.icon-lock,.icon-lock-open,.icon-magnifier,.icon-magnifier-add,.icon-magnifier-remove,.icon-paper-clip,.icon-paper-plane,.icon-plus,.icon-pointer,.icon-power,.icon-refresh,.icon-reload,.icon-settings,.icon-star,.icon-symbol-female,.icon-symbol-male,.icon-target,.icon-volume-1,.icon-volume-2,.icon-volume-off,.icon-users{font-family:'Simple-Line-Icons';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased}.icon-user-female:before{content:"\e000"}.icon-user-follow:before{content:"\e002"}.icon-user-following:before{content:"\e003"}.icon-user-unfollow:before{content:"\e004"}.icon-trophy:before{content:"\e006"}.icon-screen-smartphone:before{content:"\e010"}.icon-screen-desktop:before{content:"\e011"}.icon-plane:before{content:"\e012"}.icon-notebook:before{content:"\e013"}.icon-moustache:before{content:"\e014"}.icon-mouse:before{content:"\e015"}.icon-magnet:before{content:"\e016"}.icon-energy:before{content:"\e020"}.icon-emoticon-smile:before{content:"\e021"}.icon-disc:before{content:"\e022"}.icon-cursor-move:before{content:"\e023"}.icon-crop:before{content:"\e024"}.icon-credit-card:before{content:"\e025"}.icon-chemistry:before{content:"\e026"}.icon-user:before{content:"\e005"}.icon-speedometer:before{content:"\e007"}.icon-social-youtube:before{content:"\e008"}.icon-social-twitter:before{content:"\e009"}.icon-social-tumblr:before{content:"\e00a"}.icon-social-facebook:before{content:"\e00b"}.icon-social-dropbox:before{content:"\e00c"}.icon-social-dribbble:before{content:"\e00d"}.icon-shield:before{content:"\e00e"}.icon-screen-tablet:before{content:"\e00f"}.icon-magic-wand:before{content:"\e017"}.icon-hourglass:before{content:"\e018"}.icon-graduation:before{content:"\e019"}.icon-ghost:before{content:"\e01a"}.icon-game-controller:before{content:"\e01b"}.icon-fire:before{content:"\e01c"}.icon-eyeglasses:before{content:"\e01d"}.icon-envelope-open:before{content:"\e01e"}.icon-envelope-letter:before{content:"\e01f"}.icon-bell:before{content:"\e027"}.icon-badge:before{content:"\e028"}.icon-anchor:before{content:"\e029"}.icon-wallet:before{content:"\e02a"}.icon-vector:before{content:"\e02b"}.icon-speech:before{content:"\e02c"}.icon-puzzle:before{content:"\e02d"}.icon-printer:before{content:"\e02e"}.icon-present:before{content:"\e02f"}.icon-playlist:before{content:"\e030"}.icon-pin:before{content:"\e031"}.icon-picture:before{content:"\e032"}.icon-map:before{content:"\e033"}.icon-layers:before{content:"\e034"}.icon-handbag:before{content:"\e035"}.icon-globe-alt:before{content:"\e036"}.icon-globe:before{content:"\e037"}.icon-frame:before{content:"\e038"}.icon-folder-alt:before{content:"\e039"}.icon-film:before{content:"\e03a"}.icon-feed:before{content:"\e03b"}.icon-earphones-alt:before{content:"\e03c"}.icon-earphones:before{content:"\e03d"}.icon-drop:before{content:"\e03e"}.icon-drawer:before{content:"\e03f"}.icon-docs:before{content:"\e040"}.icon-directions:before{content:"\e041"}.icon-direction:before{content:"\e042"}.icon-diamond:before{content:"\e043"}.icon-cup:before{content:"\e044"}.icon-compass:before{content:"\e045"}.icon-call-out:before{content:"\e046"}.icon-call-in:before{content:"\e047"}.icon-call-end:before{content:"\e048"}.icon-calculator:before{content:"\e049"}.icon-bubbles:before{content:"\e04a"}.icon-briefcase:before{content:"\e04b"}.icon-book-open:before{content:"\e04c"}.icon-basket-loaded:before{content:"\e04d"}.icon-basket:before{content:"\e04e"}.icon-bag:before{content:"\e04f"}.icon-action-undo:before{content:"\e050"}.icon-action-redo:before{content:"\e051"}.icon-wrench:before{content:"\e052"}.icon-umbrella:before{content:"\e053"}.icon-trash:before{content:"\e054"}.icon-tag:before{content:"\e055"}.icon-support:before{content:"\e056"}.icon-size-fullscreen:before{content:"\e057"}.icon-size-actual:before{content:"\e058"}.icon-shuffle:before{content:"\e059"}.icon-share-alt:before{content:"\e05a"}.icon-share:before{content:"\e05b"}.icon-rocket:before{content:"\e05c"}.icon-question:before{content:"\e05d"}.icon-pie-chart:before{content:"\e05e"}.icon-pencil:before{content:"\e05f"}.icon-note:before{content:"\e060"}.icon-music-tone-alt:before{content:"\e061"}.icon-music-tone:before{content:"\e062"}.icon-microphone:before{content:"\e063"}.icon-loop:before{content:"\e064"}.icon-logout:before{content:"\e065"}.icon-login:before{content:"\e066"}.icon-list:before{content:"\e067"}.icon-like:before{content:"\e068"}.icon-home:before{content:"\e069"}.icon-grid:before{content:"\e06a"}.icon-graph:before{content:"\e06b"}.icon-equalizer:before{content:"\e06c"}.icon-dislike:before{content:"\e06d"}.icon-cursor:before{content:"\e06e"}.icon-control-start:before{content:"\e06f"}.icon-control-rewind:before{content:"\e070"}.icon-control-play:before{content:"\e071"}.icon-control-pause:before{content:"\e072"}.icon-control-forward:before{content:"\e073"}.icon-control-end:before{content:"\e074"}.icon-calendar:before{content:"\e075"}.icon-bulb:before{content:"\e076"}.icon-bar-chart:before{content:"\e077"}.icon-arrow-up:before{content:"\e078"}.icon-arrow-right:before{content:"\e079"}.icon-arrow-left:before{content:"\e07a"}.icon-arrow-down:before{content:"\e07b"}.icon-ban:before{content:"\e07c"}.icon-bubble:before{content:"\e07d"}.icon-camcorder:before{content:"\e07e"}.icon-camera:before{content:"\e07f"}.icon-check:before{content:"\e080"}.icon-clock:before{content:"\e081"}.icon-close:before{content:"\e082"}.icon-cloud-download:before{content:"\e083"}.icon-cloud-upload:before{content:"\e084"}.icon-doc:before{content:"\e085"}.icon-envelope:before{content:"\e086"}.icon-eye:before{content:"\e087"}.icon-flag:before{content:"\e088"}.icon-folder:before{content:"\e089"}.icon-heart:before{content:"\e08a"}.icon-info:before{content:"\e08b"}.icon-key:before{content:"\e08c"}.icon-link:before{content:"\e08d"}.icon-lock:before{content:"\e08e"}.icon-lock-open:before{content:"\e08f"}.icon-magnifier:before{content:"\e090"}.icon-magnifier-add:before{content:"\e091"}.icon-magnifier-remove:before{content:"\e092"}.icon-paper-clip:before{content:"\e093"}.icon-paper-plane:before{content:"\e094"}.icon-plus:before{content:"\e095"}.icon-pointer:before{content:"\e096"}.icon-power:before{content:"\e097"}.icon-refresh:before{content:"\e098"}.icon-reload:before{content:"\e099"}.icon-settings:before{content:"\e09a"}.icon-star:before{content:"\e09b"}.icon-symbol-female:before{content:"\e09c"}.icon-symbol-male:before{content:"\e09d"}.icon-target:before{content:"\e09e"}.icon-volume-1:before{content:"\e09f"}.icon-volume-2:before{content:"\e0a0"}.icon-volume-off:before{content:"\e0a1"}.icon-users:before{content:"\e001"}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-size:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}html,button,input,select,textarea{font-family:sans-serif}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:0.67em 0}h2{font-size:1.5em;margin:0.83em 0}h3{font-size:1.17em;margin:1em 0}h4{font-size:1em;margin:1.33em 0}h5{font-size:0.83em;margin:1.67em 0}h6{font-size:0.67em;margin:2.33em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}blockquote{margin:1em 40px}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}p,pre{margin:1em 0}code,kbd,pre,samp{font-family:monospace, serif;_font-family:'courier new', monospace;font-size:1em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}q{quotes:none}q:before,q:after{content:'';content:none}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}dl,menu,ol,ul{margin:1em 0}dd{margin:0 0 0 40px}menu,ol,ul{padding:0 0 0 40px}nav ul,nav ol{list-style:none;list-style-image:none}img{border:0;-ms-interpolation-mode:bicubic;}svg:not(:root){overflow:hidden}figure{margin:0}form{margin:0}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0;white-space:normal;*margin-left:-7px;}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle;}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;*overflow:visible;}button[disabled],html input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;*height:13px;*width:13px;}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top;}table{border-collapse:collapse;border-spacing:0}*,*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}html,button,input,select,textarea{font-family:sans-serif}body,form,fieldset,legend,input,select,textarea,button{margin:0}html{font-size:100%}.section{position:relative}.container{max-width:960px;margin-left:auto;margin-right:auto;padding-left:10px;padding-right:10px}.container-full{max-width:960px;margin-left:auto;margin-right:auto}.col{float:left;padding-left:10px;padding-right:10px}[class*="pull-"],[class*="push-"]{position:relative}.no-gutter{padding-left:0;padding-right:0}.col-1{width:8.33333%;width:calc(100% / 12 * 1);width:-webkit-calc(100% / 12 * 1);width:-moz-calc(100% / 12 * 1)}.col-2{width:16.66667%;width:calc(100% / 12 * 2);width:-webkit-calc(100% / 12 * 2);width:-moz-calc(100% / 12 * 2)}.col-3,.col-1-4{width:25%;width:calc(100% / 12 * 3);width:-webkit-calc(100% / 12 * 3);width:-moz-calc(100% / 12 * 3)}.col-4,.col-1-3{width:33.33333%;width:calc(100% / 12 * 4);width:-webkit-calc(100% / 12 * 4);width:-moz-calc(100% / 12 * 4)}.col-5{width:41.66665%;width:calc(100% / 12 * 5);width:-webkit-calc(100% / 12 * 5);width:-moz-calc(100% / 12 * 5)}.col-6,.col-1-2{width:50%;width:calc(100% / 12 * 6);width:-webkit-calc(100% / 12 * 6);width:-moz-calc(100% / 12 * 6)}.col-7{width:58.33333%;width:calc(100% / 12 * 7);width:-webkit-calc(100% / 12 * 7);width:-moz-calc(100% / 12 * 7)}.col-8{width:66.66666%;width:calc(100% / 12 * 8);width:-webkit-calc(100% / 12 * 8);width:-moz-calc(100% / 12 * 8)}.col-9,.col-3-4{width:75%;width:calc(100% / 12 * 9);width:-webkit-calc(100% / 12 * 9);width:-moz-calc(100% / 12 * 9)}.col-10{width:83.33333%;width:calc(100% / 12 * 10);width:-webkit-calc(100% / 12 * 10);width:-moz-calc(100% / 12 * 10)}.col-11{width:91.66666%;width:calc(100% / 12 * 11);width:-webkit-calc(100% / 12 * 11);width:-moz-calc(100% / 12 * 11)}.col-12{width:100%}.push-1{left:8.33333%;left:calc(100% / 12 * 1);left:-webkit-calc(100% / 12 * 1);left:-moz-calc(100% / 12 * 1)}.pull-1{left:-8.33333%;left:calc(-100% / 12 * 1);left:-webkit-calc(-100% / 12 * 1);left:-moz-calc(-100% / 12 * 1)}.push-2{left:16.66667%;left:calc(100% / 12 * 2);left:-webkit-calc(100% / 12 * 2);left:-moz-calc(100% / 12 * 2)}.pull-2{left:-16.66667%;left:calc(-100% / 12 * 2);left:-webkit-calc(-100% / 12 * 2);left:-moz-calc(-100% / 12 * 2)}.push-3,.push-1-4{left:25%;left:calc(100% / 12 * 3);left:-webkit-calc(100% / 12 * 3);left:-moz-calc(100% / 12 * 3)}.pull-3,.pull-1-4{left:-25%;left:calc(-100% / 12 * 3);left:-webkit-calc(-100% / 12 * 3);left:-moz-calc(-100% / 12 * 3)}.push-4,.push-1-3{left:33.33333%;left:calc(100% / 12 * 4);left:-webkit-calc(100% / 12 * 4);left:-moz-calc(100% / 12 * 4)}.pull-4,.pull-1-3{left:-33.33333%;left:calc(-100% / 12 * 4);left:-webkit-calc(-100% / 12 * 4);left:-moz-calc(-100% / 12 * 4)}.push-5{left:41.66665%;left:calc(100% / 12 * 5);left:-webkit-calc(100% / 12 * 5);left:-moz-calc(100% / 12 * 5)}.pull-5{left:-41.66665%;left:calc(-100% / 12 * 5);left:-webkit-calc(-100% / 12 * 5);left:-moz-calc(-100% / 12 * 5)}.push-6,.push-1-2{left:50%;left:calc(100% / 12 * 6);left:-webkit-calc(100% / 12 * 6);left:-moz-calc(100% / 12 * 6)}.pull-6,.pull-1-2{left:-50%;left:calc(-100% / 12 * 6);left:-webkit-calc(-100% / 12 * 6);left:-moz-calc(-100% / 12 * 6)}.push-7{left:58.33333%;left:calc(100% / 12 * 7);left:-webkit-calc(100% / 12 * 7);left:-moz-calc(100% / 12 * 7)}.pull-7{left:-58.33333%;left:calc(-100% / 12 * 7);left:-webkit-calc(-100% / 12 * 7);left:-moz-calc(-100% / 12 * 7)}.push-8{left:66.66666%;left:calc(100% / 12 * 8);left:-webkit-calc(100% / 12 * 8);left:-moz-calc(100% / 12 * 8)}.pull-8{left:-66.66666%;left:calc(-100% / 12 * 8);left:-webkit-calc(-100% / 12 * 8);left:-moz-calc(-100% / 12 * 8)}.push-9,.push-3-4{left:75%;left:calc(100% / 12 * 9);left:-webkit-calc(100% / 12 * 9);left:-moz-calc(100% / 12 * 9)}.pull-9,.pull-3-4{left:-75%;left:calc(-100% / 12 * 9);left:-webkit-calc(-100% / 12 * 9);left:-moz-calc(-100% / 12 * 9)}.push-10{left:83.33333%;left:calc(100% / 12 * 10);left:-webkit-calc(100% / 12 * 10);left:-moz-calc(100% / 12 * 10)}.pull-10{left:-83.33333%;left:calc(-100% / 12 * 10);left:-webkit-calc(-100% / 12 * 10);left:-moz-calc(-100% / 12 * 10)}.push-11{left:91.66666%;left:calc(100% / 12 * 11);left:-webkit-calc(100% / 12 * 11);left:-moz-calc(100% / 12 * 11)}.pull-11{left:-91.66666%;left:calc(-100% / 12 * 11);left:-webkit-calc(-100% / 12 * 11);left:-moz-calc(-100% / 12 * 11)}.row{padding-top:1em;padding-bottom:1em}.no-desktop{display:none}.no-margin{margin:0}.no-padding{padding:0}@media only screen and (min-width: 660px) and (max-width: 959px){.container,.tablet-container{max-width:960px;padding-left:20px;padding-right:20px;margin-left:auto;margin-right:auto;float:none}.container:first-child,.tablet-container:first-child{margin-left:auto}.tablet-container-full{padding-left:0;padding-right:0;margin-left:auto;margin-right:auto;float:none}.tablet-container-full:first-child{margin-left:auto}.tablet-no-gutter{padding-left:0;padding-right:0}.tablet-col-1{width:8.33333%;width:calc(100% / 12 * 1);width:-webkit-calc(100% / 12 * 1);width:-moz-calc(100% / 12 * 1)}.tablet-col-2{width:16.66667%;width:calc(100% / 12 * 2);width:-webkit-calc(100% / 12 * 2);width:-moz-calc(100% / 12 * 2)}.tablet-col-3,.tablet-col-1-4{width:25%;width:calc(100% / 12 * 3);width:-webkit-calc(100% / 12 * 3);width:-moz-calc(100% / 12 * 3)}.tablet-col-4,.tablet-col-1-3{width:33.33333%;width:calc(100% / 12 * 4);width:-webkit-calc(100% / 12 * 4);width:-moz-calc(100% / 12 * 4)}.tablet-col-5{width:41.66665%;width:calc(100% / 12 * 5);width:-webkit-calc(100% / 12 * 5);width:-moz-calc(100% / 12 * 5)}.tablet-col-6,.tablet-col-1-2{width:50%;width:calc(100% / 12 * 6);width:-webkit-calc(100% / 12 * 6);width:-moz-calc(100% / 12 * 6)}.tablet-col-7{width:58.33333%;width:calc(100% / 12 * 7);width:-webkit-calc(100% / 12 * 7);width:-moz-calc(100% / 12 * 7)}.tablet-col-8{width:66.66666%;width:calc(100% / 12 * 8);width:-webkit-calc(100% / 12 * 8);width:-moz-calc(100% / 12 * 8)}.tablet-col-9,.tablet-col-3-4{width:75%;width:calc(100% / 12 * 9);width:-webkit-calc(100% / 12 * 9);width:-moz-calc(100% / 12 * 9)}.tablet-col-10{width:83.33333%;width:calc(100% / 12 * 10);width:-webkit-calc(100% / 12 * 10);width:-moz-calc(100% / 12 * 10)}.tablet-col-11{width:91.66666%;width:calc(100% / 12 * 11);width:-webkit-calc(100% / 12 * 11);width:-moz-calc(100% / 12 * 11)}.tablet-col-12{width:100%}.tablet-push-1{left:8.33333%;left:calc(100% / 12 * 1);left:-webkit-calc(100% / 12 * 1);left:-moz-calc(100% / 12 * 1)}.tablet-pull-1{left:-8.33333%;left:calc(-100% / 12 * 1);left:-webkit-calc(-100% / 12 * 1);left:-moz-calc(-100% / 12 * 1)}.tablet-push-2{left:16.66667%;left:calc(100% / 12 * 2);left:-webkit-calc(100% / 12 * 2);left:-moz-calc(100% / 12 * 2)}.tablet-pull-2{left:-16.66667%;left:calc(-100% / 12 * 2);left:-webkit-calc(-100% / 12 * 2);left:-moz-calc(-100% / 12 * 2)}.tablet-push-3,.tablet-push-1-4{left:25%;left:calc(100% / 12 * 3);left:-webkit-calc(100% / 12 * 3);left:-moz-calc(100% / 12 * 3)}.tablet-pull-3,.tablet-pull-1-4{left:-25%;left:calc(-100% / 12 * 3);left:-webkit-calc(-100% / 12 * 3);left:-moz-calc(-100% / 12 * 3)}.tablet-push-4,.tablet-push-1-3{left:33.33333%;left:calc(100% / 12 * 4);left:-webkit-calc(100% / 12 * 4);left:-moz-calc(100% / 12 * 4)}.tablet-pull-4,.tablet-pull-1-3{left:-33.33333%;left:calc(-100% / 12 * 4);left:-webkit-calc(-100% / 12 * 4);left:-moz-calc(-100% / 12 * 4)}.tablet-push-5{left:41.66665%;left:calc(100% / 12 * 5);left:-webkit-calc(100% / 12 * 5);left:-moz-calc(100% / 12 * 5)}.tablet-pull-5{left:-41.66665%;left:calc(-100% / 12 * 5);left:-webkit-calc(-100% / 12 * 5);left:-moz-calc(-100% / 12 * 5)}.tablet-push-6,.tablet-push-1-2{left:50%;left:calc(100% / 12 * 6);left:-webkit-calc(100% / 12 * 6);left:-moz-calc(100% / 12 * 6)}.tablet-pull-6,.tablet-pull-1-2{left:-50%;left:calc(-100% / 12 * 6);left:-webkit-calc(-100% / 12 * 6);left:-moz-calc(-100% / 12 * 6)}.tablet-push-7{left:58.33333%;left:calc(100% / 12 * 7);left:-webkit-calc(100% / 12 * 7);left:-moz-calc(100% / 12 * 7)}.tablet-pull-7{left:-58.33333%;left:calc(-100% / 12 * 7);left:-webkit-calc(-100% / 12 * 7);left:-moz-calc(-100% / 12 * 7)}.tablet-push-8{left:66.66666%;left:calc(100% / 12 * 8);left:-webkit-calc(100% / 12 * 8);left:-moz-calc(100% / 12 * 8)}.tablet-pull-8{left:-66.66666%;left:calc(-100% / 12 * 8);left:-webkit-calc(-100% / 12 * 8);left:-moz-calc(-100% / 12 * 8)}.tablet-push-9,.tablet-push-3-4{left:75%;left:calc(100% / 12 * 9);left:-webkit-calc(100% / 12 * 9);left:-moz-calc(100% / 12 * 9)}.tablet-pull-9,.tablet-pull-3-4{left:-75%;left:calc(-100% / 12 * 9);left:-webkit-calc(-100% / 12 * 9);left:-moz-calc(-100% / 12 * 9)}.tablet-push-10{left:83.33333%;left:calc(100% / 12 * 10);left:-webkit-calc(100% / 12 * 10);left:-moz-calc(100% / 12 * 10)}.tablet-pull-10{left:-83.33333%;left:calc(-100% / 12 * 10);left:-webkit-calc(-100% / 12 * 10);left:-moz-calc(-100% / 12 * 10)}.tablet-push-11{left:91.66666%;left:calc(100% / 12 * 11);left:-webkit-calc(100% / 12 * 11);left:-moz-calc(100% / 12 * 11)}.tablet-pull-11{left:-91.66666%;left:calc(-100% / 12 * 11);left:-webkit-calc(-100% / 12 * 11);left:-moz-calc(-100% / 12 * 11)}.tablet-no-push,.tablet-no-pull{left:auto}.tablet-row{padding-top:1em;padding-bottom:1em}.tablet-full{left:auto;clear:both;float:none;width:100%;margin:1em 0 0 0;display:block}.tablet-full:first-child{margin-top:0}.tablet-text-left{text-align:left}.tablet-text-right{text-align:right}.tablet-text-center{text-align:center}.tablet-left{float:left}.tablet-right{float:right}.tablet-no-float{float:none}.tablet-no-margin{margin:0}.tablet-no-padding{padding:0}.no-tablet{display:none}.show-tablet{display:block}}@media only screen and (max-width: 659px){.container,.mobile-container{padding-left:20px;padding-right:20px;margin-left:auto;margin-right:auto;float:none}.container:first-child,.mobile-container:first-child{margin-left:auto}.mobile-container-full{padding-left:0;padding-right:0;margin-left:auto;margin-right:auto;float:none}.mobile-container-full:first-child{margin-left:auto}.mobile-no-gutter{padding-left:0;padding-right:0}.mobile-col-1-2{width:50%;width:calc(100% / 12 * 6);width:-webkit-calc(100% / 12 * 6);width:-moz-calc(100% / 12 * 6)}.mobile-col-1-3{width:33.33333%;width:calc(100% / 12 * 4);width:-webkit-calc(100% / 12 * 4);width:-moz-calc(100% / 12 * 4)}.mobile-col-1-4{width:25%;width:calc(100% / 12 * 3);width:-webkit-calc(100% / 12 * 3);width:-moz-calc(100% / 12 * 3)}.mobile-col-3-4{width:75%;width:calc(100% / 12 * 9);width:-webkit-calc(100% / 12 * 9);width:-moz-calc(100% / 12 * 9)}.mobile-push-1-2{left:50%;left:calc(100% / 12 * 6);left:-webkit-calc(100% / 12 * 6);left:-moz-calc(100% / 12 * 6)}.mobile-pull-1-2{left:-50%;left:calc(-100% / 12 * 6);left:-webkit-calc(-100% / 12 * 6);left:-moz-calc(-100% / 12 * 6)}.mobile-push-1-3{left:25%;left:calc(100% / 12 * 3);left:-webkit-calc(100% / 12 * 3);left:-moz-calc(100% / 12 * 3)}.mobile-pull-1-3{left:-25%;left:calc(-100% / 12 * 3);left:-webkit-calc(-100% / 12 * 3);left:-moz-calc(-100% / 12 * 3)}.mobile-push-1-4{left:33.33333%;left:calc(100% / 12 * 4);left:-webkit-calc(100% / 12 * 4);left:-moz-calc(100% / 12 * 4)}.mobile-pull-1-4{left:-33.33333%;left:calc(-100% / 12 * 4);left:-webkit-calc(-100% / 12 * 4);left:-moz-calc(-100% / 12 * 4)}.mobile-push-3-4{left:75%;left:calc(100% / 12 * 9);left:-webkit-calc(100% / 12 * 9);left:-moz-calc(100% / 12 * 9)}.mobile-pull-3-4{left:-75%;left:calc(-100% / 12 * 9);left:-webkit-calc(-100% / 12 * 9);left:-moz-calc(-100% / 12 * 9)}.mobile-no-push,.mobile-no-pull{left:auto}.mobile-row{padding-top:1em;padding-bottom:1em}.mobile-full{left:auto;clear:both;float:none;width:100%;margin:0.2em 0 0 0;display:block}.mobile-full:first-child{margin-top:0}.mobile-text-left{text-align:left}.mobile-text-right{text-align:right}.mobile-text-center{text-align:center}.mobile-left{float:left}.mobile-right{float:right}.mobile-no-float{float:none}.mobile-no-margin{margin:0}.mobile-no-padding{padding:0}.no-mobile{display:none}.show-mobile{display:block}}@media print{*{background:transparent}a,a:visited{text-decoration:underline}abbr[title]:after{content:" (" attr(title) ")"}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%}@page {margin:0.5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}@font-face{font-family:'Source Sans Pro';src:url('dapp-styles/fonts/SourceSansPro-ExtraLight.otf');font-weight:100;font-style:normal}@font-face{font-family:'Source Sans Pro';src:url('dapp-styles/fonts/SourceSansPro-ExtraLightIt.otf');font-weight:100;font-style:italic}@font-face{font-family:'Source Sans Pro';src:url('dapp-styles/fonts/SourceSansPro-Light.otf');font-weight:300;font-style:normal}@font-face{font-family:'Source Sans Pro';src:url('dapp-styles/fonts/SourceSansPro-Regular.otf');font-weight:400;font-style:normal}@font-face{font-family:'Source Sans Pro';src:url('dapp-styles/fonts/SourceSansPro-Semibold.otf');font-weight:500;font-style:normal}@font-face{font-family:'Source Sans Pro';src:url('dapp-styles/fonts/SourceSansPro-Bold.otf');font-weight:700;font-style:normal}@font-face{font-family:'Montserrat';src:url('dapp-styles/fonts/Montserrat-Regular.otf');font-weight:400;font-style:normal}.dapp-clear-fix{clear:both}.dapp-overflow{overflow:auto;-webkit-overflow-scrolling:touch}.dapp-shorten-text{display:inline-block;-o-text-overflow:ellipsis;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%}.dapp-button-reset{background:none;border:0;padding:0;margin:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.dapp-button-reset:hover,.dapp-button-reset:focus{outline:0}.dapp-shadow-none{-webkit-box-shadow:0 0 0 rgba(0, 0, 0, 0);-moz-box-shadow:0 0 0 rgba(0, 0, 0, 0);box-shadow:0 0 0 rgba(0, 0, 0, 0)}.dapp-shadow-small{-webkit-box-shadow:0 0px 1px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 0px 1px rgba(0, 0, 0, 0.3);box-shadow:0 0px 1px rgba(0, 0, 0, 0.3)}.dapp-shadow-medium{-webkit-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3);box-shadow:0 1px 4px rgba(0, 0, 0, 0.3)}.dapp-shadow-large{-webkit-box-shadow:0 1px 16px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 1px 16px rgba(0, 0, 0, 0.3);box-shadow:0 1px 16px rgba(0, 0, 0, 0.3)}.dapp-horizontal-menu,.dapp-vertical-menu{padding:0;margin:0;list-style:none}.dapp-horizontal-menu li{display:inline-block;padding:0;margin:0}.dapp-vertical-menu li{display:block;padding:0;margin:0}.cubic-bezier{-webkit-transition-timing-function:cubic-bezier(0.15, 0.3, 0.1, 1);-moz-transition-timing-function:cubic-bezier(0.15, 0.3, 0.1, 1);-o-transition-timing-function:cubic-bezier(0.15, 0.3, 0.1, 1);transition-timing-function:cubic-bezier(0.15, 0.3, 0.1, 1)}.cubic-bezier.animate{-webkit-transition-timing-function:cubic-bezier(0.5, 0.1, 0.2, 1);-moz-transition-timing-function:cubic-bezier(0.5, 0.1, 0.2, 1);-o-transition-timing-function:cubic-bezier(0.5, 0.1, 0.2, 1);transition-timing-function:cubic-bezier(0.5, 0.1, 0.2, 1)}#dapp-form-helper-iframe{display:none}.dapp-message{position:relative;max-width:512px;margin:48px 0;font-size:1.5em;font-weight:100;line-height:27pt}.dapp-count{display:-webkit-box;display:-moz-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-moz-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;position:absolute;top:0;bottom:0;right:0;padding:0 8px;color:#fafafa;font-weight:100;zoom:1;filter:alpha(opacity=70);-webkit-opacity:0.7;-moz-opacity:0.7;opacity:0.7;-webkit-transition:opacity 400ms;-moz-transition:opacity 400ms;-o-transition:opacity 400ms;transition:opacity 400ms}.dapp-count.animate{zoom:1;filter:alpha(opacity=0);-webkit-opacity:0;-moz-opacity:0;opacity:0}.active .dapp-count{background-color:#f5f4f2;color:#9c9090}.dapp-url-bar{display:block;text-align:center;width:100%;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;-webkit-border-radius:8px;-moz-border-radius:8px;border-radius:8px}.dapp-big-number{font-size:2em;display:inline-block;width:192px;margin-right:16px;padding-top:18.4px}.dapp-big-number dd{margin:0;font-size:50%;font-weight:600;text-transform:uppercase;color:#695e5e}.dapp-big-number dt{color:#02a8f3}a,a:visited,button{text-decoration:none;color:#02a8f3;outline:0}a:hover,a:visited:hover,button:hover,a:focus,a:visited:focus,button:focus{outline:0}a:active,a:visited:active,button:active{-webkit-transform:scale(0.95);-moz-transform:scale(0.95);-o-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95)}button{background:none;border:0;padding:0;margin:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;font-weight:inherit}button:hover,button:focus{outline:0}hr{border:0;height:0;margin:32px 0;background-color:transparent;border-bottom:1px solid #ccc6c6}h1{margin:16px 0;margin-bottom:48px;font-weight:100;font-size:2.2em;color:#827a7a}h1 span{font-weight:500}h1+h2{margin-top:0}h1 strong{font-weight:400}h2{display:inline-block;padding:0 8px;padding-bottom:1px;margin:64px 0 16px;font-weight:500;font-size:1em;text-transform:uppercase;background:#827a7a;color:#fafafa;font-family:'Montserrat';font-weight:400}h2+table{margin-top:0}h3{margin:16px 0;padding:0;color:rgba(130, 122, 122, 0.7);text-transform:uppercase;font-weight:500;font-size:1em}h4{margin:16px 0;padding:0;color:rgba(130, 122, 122, 0.7);font-weight:500;font-size:1em}table{width:100%;margin:16px 0}table+h2,table+h3{margin-top:32px}table tbody tr:nth-child(odd){background-color:rgba(204, 198, 198, 0.3)}table tbody tr td{padding:2px 0}table tbody tr td span{display:inline-block;-o-text-overflow:ellipsis;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%}.dapp-input{border:0;border-bottom:solid 2px #ccc6c6;background-color:#f5f4f2;color:#02a8f3}.dapp-input::-webkit-input-placeholder{color:#ccc6c6}.dapp-input:-moz-placeholder{color:#ccc6c6}.dapp-input::-moz-placeholder{color:#ccc6c6}.dapp-input:-ms-input-placeholder{color:#ccc6c6}.dapp-input:disabled{color:#695e5e}.dapp-address-input input{border:0;border-bottom:solid 2px #ccc6c6;background-color:#f5f4f2;color:#02a8f3}.dapp-address-input input::-webkit-input-placeholder{color:#ccc6c6}.dapp-address-input input:-moz-placeholder{color:#ccc6c6}.dapp-address-input input::-moz-placeholder{color:#ccc6c6}.dapp-address-input input:-ms-input-placeholder{color:#ccc6c6}.dapp-address-input input:disabled{color:#695e5e}.dapp-address-input .dapp-error+.dapp-identicon{display:none}.dapp-address-input .icon-shield{display:none;position:absolute;top:9px;left:13px;font-size:1.4em;color:#c20e25}.dapp-address-input .dapp-error+.dapp-identicon+.icon-shield{display:block}input,select,textarea{border:0;border-bottom:solid 2px #ccc6c6;background-color:#f5f4f2;color:#02a8f3;display:inline-block;width:300px;max-width:100%;margin-top:18.4px;padding:9.2px 16px;padding-bottom:6.13333333px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-size:1em;font-weight:300}input::-webkit-input-placeholder,select::-webkit-input-placeholder,textarea::-webkit-input-placeholder{color:#ccc6c6}input:-moz-placeholder,select:-moz-placeholder,textarea:-moz-placeholder{color:#ccc6c6}input::-moz-placeholder,select::-moz-placeholder,textarea::-moz-placeholder{color:#ccc6c6}input:-ms-input-placeholder,select:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#ccc6c6}input:disabled,select:disabled,textarea:disabled{color:#695e5e}input:focus,select:focus,textarea:focus{outline:0}input.dapp-large,select.dapp-large,textarea.dapp-large{font-size:1.5em}input.dapp-error,select.dapp-error,textarea.dapp-error{color:#c20e25;background:#f2d7d7;border-color:#f5b6b6}:disabled{color:#695e5e}input[type="checkbox"],input[type="radio"]{display:inline-block;position:relative;margin:0;outline:none !important;-webkit-appearance:none;width:auto;width:24px;height:24px}input[type="checkbox"]::before,input[type="radio"]::before{content:'';position:relative;top:0;left:0;display:block;background:#f5f4f2;border:1px solid #f5f4f2;-webkit-box-shadow:inset 0 0 2px rgba(0, 0, 0, 0.2);-moz-box-shadow:inset 0 0 2px rgba(0, 0, 0, 0.2);box-shadow:inset 0 0 2px rgba(0, 0, 0, 0.2);width:24px;height:24px}input[type="checkbox"]:focus::before,input[type="radio"]:focus::before{border-color:rgba(2, 168, 243, 0.4)}input[type="checkbox"]:disabled::before,input[type="radio"]:disabled::before{cursor:not-allowed;background-color:rgba(245, 244, 242, 0.8);border-color:#f5f4f2}input[type="checkbox"]:after,input[type="radio"]:after{content:'';display:inline-block;position:absolute;top:6px;left:6px;background:#02a8f3;-webkit-box-shadow:0 0px 1px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 0px 1px rgba(0, 0, 0, 0.3);box-shadow:0 0px 1px rgba(0, 0, 0, 0.3);width:12px;height:12px;-webkit-transition:-webkit-transform 400ms;-moz-transition:-moz-transform 400ms;-o-transition:-o-transform 400ms;transition:-webkit-transform 400ms,-moz-transform 400ms,-o-transform 400ms,transform 400ms;-webkit-transform:scale(0);-moz-transform:scale(0);-o-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}input[type="checkbox"]:checked:after,input[type="radio"]:checked:after{-webkit-transform:scale(1);-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}input[type="checkbox"]:disabled:after,input[type="radio"]:disabled:after{background:rgba(2, 168, 243, 0.4)}input[type="radio"]{-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%}input[type="radio"]:before{-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%}input[type="radio"]:after{-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%}input[type="range"]{-webkit-appearance:none;padding:0;border:0;background-color:transparent;overflow:hidden;height:18.4px}input[type="range"]::-webkit-slider-runnable-track{height:5px;background-color:#ccc6c6;border:none;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}input[type="range"]::-webkit-slider-thumb{-webkit-appearance:none;border:none;height:16px;width:16px;border-radius:50%;background-color:#02a8f3;margin-top:-6px;z-index:30}input[type="range"]::-webkit-slider-thumb:after{content:" ";width:500px;height:5px;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMSAxIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48bGluZWFyR3JhZGllbnQgaWQ9Imxlc3NoYXQtZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjEwMCUiIHkxPSIwJSIgeDI9IjAlIiB5Mj0iMCUiPjxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiMwMmE4ZjMiIHN0b3Atb3BhY2l0eT0iMSIvPjxzdG9wIG9mZnNldD0iNTAlIiBzdG9wLWNvbG9yPSIjMDJhOGYzIiBzdG9wLW9wYWNpdHk9IjEiLz48c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9InJnYigwLDAsMCkiIHN0b3Atb3BhY2l0eT0iMCIvPjwvbGluZWFyR3JhZGllbnQ+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNsZXNzaGF0LWdlbmVyYXRlZCkiIC8+PC9zdmc+);background-image:-webkit--webkit-linear-gradient(right, #02a8f3 0%, #02a8f3 50%, transparent 100%);background-image:-webkit--moz-linear-gradient(right, #02a8f3 0%, #02a8f3 50%, transparent 100%);background-image:-webkit--o-linear-gradient(right, #02a8f3 0%, #02a8f3 50%, transparent 100%);background-image:-webkit-linear-gradient(to left, #02a8f3 0%, #02a8f3 50%, transparent 100%);display:block;position:relative;left:-500px;top:6px;z-index:20}input[type="range"]:focus{outline:none}input[type="range"]::-moz-range-track{height:5px;background-color:#02a8f3;border:none;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}input[type="range"]::-moz-range-thumb{-webkit-appearance:none;border:none;height:16px;width:16px;border-radius:50%;background-color:#695e5e;margin-top:-4px}input[type="range"]:focus{outline:none}input[type="range"].slider-vertical{transform:rotate(-90deg);width:73.6px}label{font-weight:300}fieldset{border:0;padding:0;margin:16px}select{height:45px}body{display:-webkit-box;display:-moz-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-direction:normal;-moz-box-direction:normal;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;min-height:100vh;padding:0;margin:0;background-color:#fafafa;font:100 16px 'Source Sans Pro', 'Helvetica Neue', arial, sans-serif;color:#111111}body.disable-scroll{overflow:hidden}body.blur .dapp-flex-content,body.blur .dapp-footer,body.blur .dapp-header{-webkit-filter:blur(4px);-moz-filter:blur(4px);-ms-filter:blur(4px);filter:blur(4px)}.ethereum-dapp-url-bar-style-transparent .dapp-header{padding-top:73.6px}.dapp-grid{z-index:999;background:#ffffff url('dapp-styles/hex-grid-tile.png');background-size:64px 111px;position:absolute;min-height:100%;left:0;right:0;opacity:0.05;pointer-events:none}.dapp-container{display:block;position:relative;margin:0 auto;max-width:960px}.dapp-header,.dapp-aside,.dapp-content,.dapp-footer{position:relative;padding:18.4px 32px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.dapp-header{height:64px;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMSAxIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48bGluZWFyR3JhZGllbnQgaWQ9Imxlc3NoYXQtZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPjxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNmYmZhZmEiIHN0b3Atb3BhY2l0eT0iMSIvPjxzdG9wIG9mZnNldD0iOTAlIiBzdG9wLWNvbG9yPSIjZDlkMGQwIiBzdG9wLW9wYWNpdHk9IjEiLz48L2xpbmVhckdyYWRpZW50PjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9InVybCgjbGVzc2hhdC1nZW5lcmF0ZWQpIiAvPjwvc3ZnPg==);background-image:-webkit-linear-gradient(top, #fbfafa 0, #d9d0d0 90%);background-image:-moz-linear-gradient(top, #fbfafa 0, #d9d0d0 90%);background-image:-o-linear-gradient(top, #fbfafa 0, #d9d0d0 90%);background-image:linear-gradient(to bottom, #fbfafa 0, #d9d0d0 90%)}.dapp-header nav{position:absolute;bottom:0}.dapp-header nav ul{padding:0;margin:0;list-style:none}.dapp-header nav ul li{display:inline-block;padding:0;margin:0}.dapp-header nav ul a{display:inline-block;padding:9.2px 32px;text-align:center;border-bottom:5px solid transparent;color:#0285c0}.dapp-header nav ul a.active{color:#ab9898;border-bottom:5px solid #fafafa}.dapp-header nav ul a.active{-webkit-transform-origin:50% 100%;-moz-transform-origin:50% 100%;-o-transform-origin:50% 100%;-ms-transform-origin:50% 100%;transform-origin:50% 100%}.dapp-header nav ul a i{font-size:1.5em}.dapp-header nav ul a span{display:block;text-transform:uppercase;font-weight:400}.dapp-footer{height:96px;background-color:#111111}.dapp-flex-content{display:-webkit-box;display:-moz-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.dapp-content{-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;background:#fafafa}.dapp-content.dapp-has-header{padding-top:175.2px}.dapp-content .dapp-content-header{position:fixed;top:0;width:80%;min-height:36.8px;padding:18.4px 16px;margin-left:-32px;background:rgba(245, 244, 242, 0.8);z-index:10;line-height:36.8px;-webkit-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3);box-shadow:0 1px 4px rgba(0, 0, 0, 0.3);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.dapp-aside{-webkit-box-flex:0;-moz-box-flex:0;-webkit-flex:0 0 224px;-ms-flex:0 0 224px;flex:0 0 224px;padding-right:0;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMSAxIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48bGluZWFyR3JhZGllbnQgaWQ9Imxlc3NoYXQtZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPjxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNmMGVlZWUiIHN0b3Atb3BhY2l0eT0iMSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2NjYzZjNiIgc3RvcC1vcGFjaXR5PSIxIi8+PC9saW5lYXJHcmFkaWVudD48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2xlc3NoYXQtZ2VuZXJhdGVkKSIgLz48L3N2Zz4=);background-image:-webkit-linear-gradient(top, #f0eeee 0, #ccc6c6 100px);background-image:-moz-linear-gradient(top, #f0eeee 0, #ccc6c6 100px);background-image:-o-linear-gradient(top, #f0eeee 0, #ccc6c6 100px);background-image:linear-gradient(to bottom, #f0eeee 0, #ccc6c6 100px);-webkit-transition:flex 400ms;-moz-transition:flex 400ms;-o-transition:flex 400ms;transition:flex 400ms}.dapp-aside nav ul{padding:0;margin:0;list-style:none;padding-top:18.4px}.dapp-aside nav ul li{display:block;padding:0;margin:0}.dapp-aside nav ul li a,.dapp-aside nav ul li a:visited,.dapp-aside nav ul li button{display:-webkit-box;display:-moz-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-moz-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;position:relative;min-height:73.6px;max-height:92px;padding:18.4px 32px;padding-left:10.66666667px;overflow:hidden;border-top:#b9b0b0 solid 1px;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;color:#111111;font-weight:300;line-height:20px}.dapp-aside nav ul li a:active,.dapp-aside nav ul li a:visited:active,.dapp-aside nav ul li button:active{-webkit-transform-origin:100% 50%;-moz-transform-origin:100% 50%;-o-transform-origin:100% 50%;-ms-transform-origin:100% 50%;transform-origin:100% 50%;-webkit-transform:scale(0.98);-moz-transform:scale(0.98);-o-transform:scale(0.98);-ms-transform:scale(0.98);transform:scale(0.98)}.dapp-aside nav ul li a>i,.dapp-aside nav ul li a:visited>i,.dapp-aside nav ul li button>i{margin-right:4px}.dapp-aside nav ul li a>span,.dapp-aside nav ul li a:visited>span,.dapp-aside nav ul li button>span{max-width:115px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}.dapp-aside nav ul li .dapp-main-button{position:relative;width:100%;margin-bottom:73.6px;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;background:#665f5f;color:#fafafa;border-top:none}.dapp-aside nav ul li .dapp-main-button i{position:absolute;right:8px;top:27.6px}.dapp-aside nav ul li.active a{background:#fafafa;border-top:none;color:#111111;font-weight:500}.dapp-aside nav ul li:first-child a,.dapp-aside nav ul li.active+li>a,.dapp-aside nav ul li.dapp-main-button+li{border-top:0}.dapp-actionbar{z-index:20;-webkit-box-flex:0;-moz-box-flex:0;-webkit-flex:0 0 64px;-ms-flex:0 0 64px;flex:0 0 64px;background:#fafafa}.dapp-actionbar nav ul{padding:0;margin:0;list-style:none}.dapp-actionbar nav ul li{display:block;padding:0;margin:0}.dapp-actionbar nav ul li{margin:16px 0;color:#02a8f3;position:relative;overflow:hidden;text-align:center;-webkit-transition:height 400ms;-moz-transition:height 400ms;-o-transition:height 400ms;transition:height 400ms}.dapp-actionbar nav ul li button,.dapp-actionbar nav ul li a,.dapp-actionbar nav ul li a:visited{background:none;border:0;padding:0;margin:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:inline-block;color:#111111;color:#0e73b8;font-size:0.8em;font-weight:400}.dapp-actionbar nav ul li button:hover,.dapp-actionbar nav ul li a:hover,.dapp-actionbar nav ul li a:visited:hover,.dapp-actionbar nav ul li button:focus,.dapp-actionbar nav ul li a:focus,.dapp-actionbar nav ul li a:visited:focus{outline:0}.dapp-actionbar nav ul li button:active,.dapp-actionbar nav ul li a:active,.dapp-actionbar nav ul li a:visited:active{-webkit-transform:scale(0.95);-moz-transform:scale(0.95);-o-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95)}.dapp-actionbar nav ul li button:hover,.dapp-actionbar nav ul li a:hover,.dapp-actionbar nav ul li a:visited:hover{opacity:0.9}.dapp-actionbar nav ul li button i,.dapp-actionbar nav ul li a i,.dapp-actionbar nav ul li a:visited i{font-size:2em;display:block}.dapp-box{display:inline-block;float:left;width:192px;height:220.8px;padding-top:18.4px;padding-left:16px;padding-bottom:9.2px;padding-right:16px;margin-bottom:9.2px;margin-right:16px;background-color:#fafafa;-webkit-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3);box-shadow:0 1px 4px rgba(0, 0, 0, 0.3)}.dapp-box h2{margin:0;padding:0;background-color:transparent;color:#827a7a;font-family:'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, Sans;text-transform:none;font-size:1.5em;font-weight:100}.dapp-box.card{padding-left:96px;padding-right:64px;width:512px;max-width:none;height:auto;border-radius:4px;background-repeat-x:no-repeat;background-repeat:repeat-y;background-size:64px}.dapp-box.card h1{margin-bottom:0}.dapp-box.card h3{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-transform:lowercase;margin-top:0}.dapp-box.card dd,.dapp-box.card dt{display:block;height:36.8px;font-size:1.1em;float:left}.dapp-box.card dd{margin:0;width:128px;clear:both;text-align:right}.dapp-box.card dt{font-weight:500;padding-left:16px}.dapp-modal-overlay{background:rgba(17, 17, 17, 0.5)}.dapp-modal-container{background:#fafafa}.dapp-icon-button{background:none;border:0;padding:0;margin:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:inline-block;color:#111111}.dapp-icon-button:hover,.dapp-icon-button:focus{outline:0}.dapp-icon-button:active{-webkit-transform:scale(0.95);-moz-transform:scale(0.95);-o-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95)}.dapp-icon-button:hover{opacity:0.9}.dapp-block-button,.dapp-block-button:visited{background:none;border:0;padding:0;margin:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;height:36.8px;min-width:100px;padding:4.6px 10.66666667px;background:#02a8f3;color:#fafafa;border-bottom:solid 3px #0297da;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;display:inline-block;-o-text-overflow:ellipsis;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%;font-family:'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, Sans;font-size:1em;font-weight:400;text-transform:uppercase}.dapp-block-button:hover,.dapp-block-button:visited:hover,.dapp-block-button:focus,.dapp-block-button:visited:focus{outline:0}.dapp-block-button:active,.dapp-block-button:visited:active{border-bottom-width:3px}.dapp-block-button i,.dapp-block-button:visited i{position:relative;top:2px}.dapp-tag-button{background:none;border:0;padding:0;margin:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;padding:4.6px 8px;background:#ccc6c6;color:#111111;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;display:inline-block;-o-text-overflow:ellipsis;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%;font-size:0.7em}.dapp-tag-button:hover,.dapp-tag-button:focus{outline:0}.dapp-tag-button.active{background:#02a8f3;color:#fafafa}@media screen and (max-width: 576px){aside.dapp-main{-webkit-box-flex:0;-moz-box-flex:0;-webkit-flex:0 0 64px;-ms-flex:0 0 64px;flex:0 0 64px}}@media screen and (max-device-width: 480px) and (orientation: portrait){body{font-size:14px}}@media screen and (max-device-width: 640px) and (orientation: landscape){body{font-size:15px}}.page-title{position:-webkit-sticky;top:15px;left:0;right:0;background:transparent;color:#ccc6c6;display:block;text-align:center;margin:9.2px 0 73.6px}.block-chain{margin:0 -40px;height:331.2px;padding:9.2px 16px;overflow:auto;-webkit-overflow-scrolling:touch}.block-chain .wrapper{padding-right:160px}.block-chain .wrapper .card{position:relative}.block-chain .wrapper .card .dapp-identicon{position:absolute;width:40px;height:40px;left:44px;top:38.2px;border:solid 2px #fafafa}.mining-slider{position:relative;padding-left:16px}.mining-slider .slider-vertical{position:absolute;top:18.4px;left:-40px}
\ No newline at end of file diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Black.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Black.otf Binary files differnew file mode 100644 index 000000000..5e04cf3f7 --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Black.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Bold.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Bold.otf Binary files differnew file mode 100644 index 000000000..eaf99a571 --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Bold.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Hairline.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Hairline.otf Binary files differnew file mode 100644 index 000000000..1ee11cede --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Hairline.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Light.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Light.otf Binary files differnew file mode 100644 index 000000000..a01805ff0 --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Light.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Regular.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Regular.otf Binary files differnew file mode 100644 index 000000000..85d0c1e8f --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/Montserrat-Regular.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SIL Open Font License.txt b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SIL Open Font License.txt new file mode 100644 index 000000000..295975a5d --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SIL Open Font License.txt @@ -0,0 +1,43 @@ +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the copyright statement(s). + +"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. + +5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
\ No newline at end of file diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Black.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Black.otf Binary files differnew file mode 100644 index 000000000..492661cba --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Black.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-BlackIt.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-BlackIt.otf Binary files differnew file mode 100644 index 000000000..2fbb1d1a1 --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-BlackIt.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Bold.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Bold.otf Binary files differnew file mode 100644 index 000000000..597072f58 --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Bold.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-BoldIt.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-BoldIt.otf Binary files differnew file mode 100644 index 000000000..56bdfaccd --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-BoldIt.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-ExtraLight.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-ExtraLight.otf Binary files differnew file mode 100644 index 000000000..20a21c630 --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-ExtraLight.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-ExtraLightIt.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-ExtraLightIt.otf Binary files differnew file mode 100644 index 000000000..787bfcfae --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-ExtraLightIt.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-It.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-It.otf Binary files differnew file mode 100644 index 000000000..7ab613d4d --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-It.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Light.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Light.otf Binary files differnew file mode 100644 index 000000000..4a8eafd78 --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Light.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-LightIt.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-LightIt.otf Binary files differnew file mode 100644 index 000000000..c5b8ca860 --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-LightIt.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Regular.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Regular.otf Binary files differnew file mode 100644 index 000000000..38941ae72 --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Regular.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Semibold.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Semibold.otf Binary files differnew file mode 100644 index 000000000..fd41bcf1c --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-Semibold.otf diff --git a/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-SemiboldIt.otf b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-SemiboldIt.otf Binary files differnew file mode 100644 index 000000000..447ff80bf --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/dapp-styles/fonts/SourceSansPro-SemiboldIt.otf diff --git a/cmd/mist/assets/qml/views/network-health/index.html b/cmd/mist/assets/qml/views/network-health/index.html new file mode 100755 index 000000000..96c958a35 --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/index.html @@ -0,0 +1,30 @@ +<html> + <meta charset="utf-8"> + <title>Network</title> + + <!-- <base href="/"> --> + + <meta name="description" content=""> + <meta name="keywords" content="dapp, ethereum"> + + <!-- <link rel="icon" href="/favicon.ico" type="image/x-icon"> --> + <!-- <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"> --> + + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no"> + <meta name="apple-mobile-web-app-capable" content="yes"> + <meta name="apple-mobile-web-app-status-bar-style" content="black"> + + <!-- <link rel="apple-touch-icon" href="/apple-touch-icon-precomposed.png"> --> + <!-- <link rel="apple-touch-startup-image" href="/startup.png"> --> + + + <link rel="stylesheet" type="text/css" class="__meteor-css__" href="529f30ee0ee386c5143b4ccb62073179ca8253c3.css?meteor_css_resource=true"> +<body> + + + <script type="text/javascript">__meteor_runtime_config__ = {"meteorRelease":"METEOR@1.0.3.1","ROOT_URL":"http://localhost:3000/","ROOT_URL_PATH_PREFIX":"","appId":"e350zy16p3kznipbx5o","autoupdateVersion":"df83a37bd2952ddbb9ba6c5f2a59e9caba02642b","autoupdateVersionRefreshable":"81118ed5fac9ef5f8d55835426179e1e058da42b","autoupdateVersionCordova":"none"};</script> + + <script type="text/javascript" src="205f39107b64acf34cb35d7edb57f47893187a12.js"></script> + +</body> +</html>
\ No newline at end of file diff --git a/cmd/mist/assets/qml/views/network-health/loading.css b/cmd/mist/assets/qml/views/network-health/loading.css new file mode 100644 index 000000000..1b3f4bd65 --- /dev/null +++ b/cmd/mist/assets/qml/views/network-health/loading.css @@ -0,0 +1,92 @@ +body { + background-color: #000; + font: 16px solid 'Helvetica Neue', sans-serif; +} + +.inject-loading-container { + position: relative; + padding-top: 20%; + /*left: 50%;*/ + margin: 0 auto; + /*max-width: 600px;*/ + /*margin-left: -300px;*/ + text-align: center; + +} +.inject-loading-container h1 { + text-align: center; + font-weight: 300; + font-size: 2em; +} + +img.loading-circle { + width: 24px; + height: 24px; + + animation: rotate 1s linear infinite; + -moz-animation: rotate 1s linear infinite; + -webkit-animation: rotate 1s linear infinite; + -ms-animation: rotate 1s linear infinite; + + transform-origin:50% 49.5%; + -ms-transform-origin:50% 49.5%; /* IE 9 */ + -moz-transform-origin:50% 49.5%; /* Chrome, Safari, Opera */ + -webkit-transform-origin:50% 49.5%; /* Chrome, Safari, Opera */ +} + +/* Keyframes */ +@-webkit-keyframes rotate { + 0% { + -webkit-transform: rotate(0deg); + } + 50% { + opacity: 0.2; + } + 100% { + -webkit-transform: rotate(360deg); + } +} +@-moz-keyframes rotate { + 0% { + -moz-transform: rotate(0deg); + } + 50% { + opacity: 0.2; + } + 100% { + -moz-transform: rotate(360deg); + } +} +@-o-keyframes rotate { + 0% { + -o-transform: rotate(0deg); + } + 50% { + opacity: 0.2; + } + 100% { + -o-transform: rotate(360deg); + } +} +@-ms-keyframes rotate { + 0% { + -ms-transform: rotate(0deg); + } + 50% { + opacity: 0.2; + } + 100% { + -ms-transform-origin: rotate(360deg); + } +} +@keyframes rotate { + 0% { + transform: rotate(0deg); + } + 50% { + opacity: 0.2; + } + 100% { + transform: rotate(360deg); + } +}
\ No newline at end of file diff --git a/cmd/mist/assets/qml/views/network.qml b/cmd/mist/assets/qml/views/network.qml new file mode 100644 index 000000000..d33b5773c --- /dev/null +++ b/cmd/mist/assets/qml/views/network.qml @@ -0,0 +1,160 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.0; +import QtQuick.Controls.Styles 1.0 +import QtQuick.Layouts 1.0; +import QtWebEngine 1.0 +import QtWebEngine.experimental 1.0 +import QtQuick.Window 2.0; +import Ethereum 1.0 +import Qt.WebSockets 1.0 +//import "qwebchannel.js" as WebChannel + + + +Rectangle { + id: window + anchors.fill: parent + color: "#00000000" + + property var title: "Network" + property var iconSource: "../mining-icon.png" + property var menuItem + property var hideUrl: true + + property alias url: webview.url + property alias windowTitle: webview.title + property alias webView: webview + + property var cleanPath: false + property var open: function(url) { + if(!window.cleanPath) { + var uri = url; + if(!/.*\:\/\/.*/.test(uri)) { + uri = "http://" + uri; + } + + var reg = /(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.eth)(.*)/ + + if(reg.test(uri)) { + uri.replace(reg, function(match, pre, domain, path) { + uri = pre; + + var lookup = eth.lookupDomain(domain.substring(0, domain.length - 4)); + var ip = []; + for(var i = 0, l = lookup.length; i < l; i++) { + ip.push(lookup.charCodeAt(i)) + } + + if(ip.length != 0) { + uri += lookup; + } else { + uri += domain; + } + + uri += path; + }); + } + + window.cleanPath = true; + + webview.url = uri; + + //uriNav.text = uri.text.replace(/(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.\w{2,3})(.*)/, "$1$2<span style='color:#CCC'>$3</span>"); + uriNav.text = uri; + + } else { + // Prevent inf loop. + window.cleanPath = false; + } + } + + Label { + objectName: "miningLabel" + visible: false + font.pixelSize: 10 + anchors.right: lastBlockLabel.left + anchors.rightMargin: 5 + onTextChanged: { + menuItem.secondaryTitle = eth.miner().mining()? eth.miner().hashRate() + " Khash" : "" + } + } + + Item { + objectName: "root" + id: root + anchors.fill: parent + state: "inspectorShown" + + Timer { + interval: 1000; running: true; repeat: true + onTriggered: { + webview.runJavaScript("Miner.mining", function(miningSliderValue) { + + // Check if it's mining and set it accordingly + if (miningSliderValue > 0 && !eth.miner().mining()) { + // If the + eth.setGasPrice("10000000000000"); + eth.miner().start(); + } else if (miningSliderValue == 0 && eth.miner().mining()) { + eth.miner().stop(); + } else if (eth.miner().mining()) { + + webview.runJavaScript('var miningData = MiningData.findOne(); MiningData.update(miningData._id, {$inc: {totalTimeSpent: 1}}); Miner.hashrate = ' + eth.miner().hashRate() ); + + //var miningData = MiningData.findOne(); MiningData.update(miningData._id, {$inc: {totalTimeSpent: 1}}); + + } else if (miningSliderValue == "undefined") { + + webview.runJavaScript('Miner.mining = 0' ); + + } + }); + + } + } + + WebEngineView { + objectName: "webView" + id: webview + anchors.fill: parent + + url: "network-health/index.html" + //url: "http://localhost:3000/" + + experimental.settings.javascriptCanAccessClipboard: true + + + onJavaScriptConsoleMessage: { + console.log(sourceID + ":" + lineNumber + ":" + JSON.stringify(message)); + } + + onLoadingChanged: { + if (loadRequest.status == WebEngineView.LoadSucceededStatus) { + webview.runJavaScript(eth.readFile("mist.js")); + } + } + } + + WebEngineView { + id: inspector + visible: false + z:10 + anchors { + left: root.left + right: root.right + top: root.top + bottom: root.bottom + } + + } + + states: [ + State { + name: "inspectorShown" + PropertyChanges { + target: inspector + } + } + ] + } +} diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 5f444dd95..869b689dd 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -32,7 +32,6 @@ import ( "path" "runtime" "sort" - "strconv" "time" "github.com/ethereum/go-ethereum/core" @@ -386,7 +385,7 @@ func (gui *Gui) update() { statsUpdateTicker := time.NewTicker(5 * time.Second) lastBlockLabel := gui.getObjectByName("lastBlockLabel") - miningLabel := gui.getObjectByName("miningLabel") + //miningLabel := gui.getObjectByName("miningLabel") events := gui.eth.EventMux().Subscribe( core.ChainEvent{}, @@ -417,8 +416,7 @@ func (gui *Gui) update() { case <-generalUpdateTicker.C: statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number().String() lastBlockLabel.Set("text", statusText) - miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.Miner().HashRate(), 10)+"/Khash") - + //miningLabel.Set("text", strconv.FormatInt(gui.uiLib.Miner().HashRate(), 10)) case <-statsUpdateTicker.C: gui.setStatsPane() } diff --git a/core/chain_manager.go b/core/chain_manager.go index d2a6560c1..1152e3fa2 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -234,6 +234,21 @@ func (bc *ChainManager) Reset() { bc.setTotalDifficulty(ethutil.Big("0")) } +func (bc *ChainManager) ResetWithGenesisBlock(gb *types.Block) { + bc.mu.Lock() + defer bc.mu.Unlock() + + for block := bc.currentBlock; block != nil; block = bc.GetBlock(block.Header().ParentHash) { + bc.db.Delete(block.Hash()) + } + + // Prepare the genesis block + bc.genesisBlock = gb + bc.write(bc.genesisBlock) + bc.insert(bc.genesisBlock) + bc.currentBlock = bc.genesisBlock +} + func (self *ChainManager) Export() []byte { self.mu.RLock() defer self.mu.RUnlock() diff --git a/core/error.go b/core/error.go index fb1eaed84..514cd076b 100644 --- a/core/error.go +++ b/core/error.go @@ -22,7 +22,7 @@ func (err *ParentErr) Error() string { } func ParentError(hash []byte) error { - return &ParentErr{Message: fmt.Sprintf("Block's parent unkown %x", hash)} + return &ParentErr{Message: fmt.Sprintf("Block's parent unknown %x", hash)} } func IsParentErr(err error) bool { diff --git a/eth/backend.go b/eth/backend.go index 7351b4168..1c711a775 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -107,11 +107,9 @@ func (cfg *Config) nodeKey() (*ecdsa.PrivateKey, error) { type Ethereum struct { // Channel for shutting down the ethereum shutdownChan chan bool - quit chan bool // DB interface - db ethutil.Database - blacklist p2p.Blacklist + db ethutil.Database //*** SERVICES *** // State manager for processing new blocks and managing the over all states @@ -171,10 +169,8 @@ func New(config *Config) (*Ethereum, error) { eth := &Ethereum{ shutdownChan: make(chan bool), - quit: make(chan bool), db: db, keyManager: keyManager, - blacklist: p2p.NewBlacklist(), eventMux: &event.TypeMux{}, logger: ethlogger, DataDir: config.DataDir, @@ -208,7 +204,6 @@ func New(config *Config) (*Ethereum, error) { Name: config.Name, MaxPeers: config.MaxPeers, Protocols: protocols, - Blacklist: eth.blacklist, NAT: config.NAT, NoDial: !config.Dial, BootstrapNodes: config.parseBootNodes(), @@ -282,8 +277,6 @@ func (s *Ethereum) Stop() { // Close the database defer s.db.Close() - close(s.quit) - s.txSub.Unsubscribe() // quits txBroadcastLoop s.blockSub.Unsubscribe() // quits blockBroadcastLoop diff --git a/eth/protocol.go b/eth/protocol.go index c887af129..b52c7db42 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -3,7 +3,6 @@ package eth import ( "bytes" "fmt" - "io" "math/big" "github.com/ethereum/go-ethereum/core/types" @@ -188,33 +187,37 @@ func (self *ethProtocol) handle() error { case BlockHashesMsg: msgStream := rlp.NewStream(msg.Payload) - var err error - var i int + if _, err := msgStream.List(); err != nil { + return err + } + var i int iter := func() (hash []byte, ok bool) { - hash, err = msgStream.Bytes() - if err == nil { - i++ - ok = true - } else { - if err != io.EOF { - self.protoError(ErrDecode, "msg %v: after %v hashes : %v", msg, i, err) - } + hash, err := msgStream.Bytes() + if err == rlp.EOL { + return nil, false + } else if err != nil { + self.protoError(ErrDecode, "msg %v: after %v hashes : %v", msg, i, err) + return nil, false } - return + i++ + return hash, true } - self.blockPool.AddBlockHashes(iter, self.id) case GetBlocksMsg: msgStream := rlp.NewStream(msg.Payload) + if _, err := msgStream.List(); err != nil { + return err + } + var blocks []interface{} var i int for { i++ var hash []byte if err := msgStream.Decode(&hash); err != nil { - if err == io.EOF { + if err == rlp.EOL { break } else { return self.protoError(ErrDecode, "msg %v: %v", msg, err) @@ -232,10 +235,13 @@ func (self *ethProtocol) handle() error { case BlocksMsg: msgStream := rlp.NewStream(msg.Payload) + if _, err := msgStream.List(); err != nil { + return err + } for { var block types.Block if err := msgStream.Decode(&block); err != nil { - if err == io.EOF { + if err == rlp.EOL { break } else { return self.protoError(ErrDecode, "msg %v: %v", msg, err) diff --git a/ethutil/big.go b/ethutil/big.go index 1716a7ce3..b77e0af8c 100644 --- a/ethutil/big.go +++ b/ethutil/big.go @@ -33,6 +33,12 @@ func Bytes2Big(data []byte) *big.Int { } func BigD(data []byte) *big.Int { return Bytes2Big(data) } +func String2Big(num string) *big.Int { + n := new(big.Int) + n.SetString(num, 0) + return n +} + func BitTest(num *big.Int, i int) bool { return num.Bit(i) > 0 } diff --git a/ethutil/math/dist.go b/ethutil/math/dist.go new file mode 100644 index 000000000..262aa8591 --- /dev/null +++ b/ethutil/math/dist.go @@ -0,0 +1,80 @@ +package math + +import ( + "math/big" + "sort" + + "github.com/ethereum/go-ethereum/ethutil" +) + +type Summer interface { + Sum(i int) *big.Int + Len() int +} + +func Sum(slice Summer) (sum *big.Int) { + sum = new(big.Int) + + for i := 0; i < slice.Len(); i++ { + sum.Add(sum, slice.Sum(i)) + } + return +} + +type Vector struct { + Gas, Price *big.Int +} + +type VectorsBy func(v1, v2 Vector) bool + +func (self VectorsBy) Sort(vectors []Vector) { + bs := vectorSorter{ + vectors: vectors, + by: self, + } + sort.Sort(bs) +} + +type vectorSorter struct { + vectors []Vector + by func(v1, v2 Vector) bool +} + +func (v vectorSorter) Len() int { return len(v.vectors) } +func (v vectorSorter) Less(i, j int) bool { return v.by(v.vectors[i], v.vectors[j]) } +func (v vectorSorter) Swap(i, j int) { v.vectors[i], v.vectors[j] = v.vectors[j], v.vectors[i] } + +func PriceSort(v1, v2 Vector) bool { return v1.Price.Cmp(v2.Price) < 0 } +func GasSort(v1, v2 Vector) bool { return v1.Gas.Cmp(v2.Gas) < 0 } + +type vectorSummer struct { + vectors []Vector + by func(v Vector) *big.Int +} + +type VectorSum func(v Vector) *big.Int + +func (v VectorSum) Sum(vectors []Vector) *big.Int { + vs := vectorSummer{ + vectors: vectors, + by: v, + } + return Sum(vs) +} + +func (v vectorSummer) Len() int { return len(v.vectors) } +func (v vectorSummer) Sum(i int) *big.Int { return v.by(v.vectors[i]) } + +func GasSum(v Vector) *big.Int { return v.Gas } + +var etherInWei = new(big.Rat).SetInt(ethutil.String2Big("1000000000000000000")) + +func GasPrice(bp, gl, ep *big.Int) *big.Int { + BP := new(big.Rat).SetInt(bp) + GL := new(big.Rat).SetInt(gl) + EP := new(big.Rat).SetInt(ep) + GP := new(big.Rat).Quo(BP, GL) + GP = GP.Quo(GP, EP) + + return GP.Mul(GP, etherInWei).Num() +} diff --git a/ethutil/math/dist_test.go b/ethutil/math/dist_test.go new file mode 100644 index 000000000..90e302f44 --- /dev/null +++ b/ethutil/math/dist_test.go @@ -0,0 +1,66 @@ +package math + +import ( + "fmt" + "math/big" + "testing" +) + +type summer struct { + numbers []*big.Int +} + +func (s summer) Len() int { return len(s.numbers) } +func (s summer) Sum(i int) *big.Int { + return s.numbers[i] +} + +func TestSum(t *testing.T) { + summer := summer{numbers: []*big.Int{big.NewInt(1), big.NewInt(2), big.NewInt(3)}} + sum := Sum(summer) + if sum.Cmp(big.NewInt(6)) != 0 { + t.Errorf("not 6", sum) + } +} + +func TestDist(t *testing.T) { + var vectors = []Vector{ + Vector{big.NewInt(1000), big.NewInt(1234)}, + Vector{big.NewInt(500), big.NewInt(10023)}, + Vector{big.NewInt(1034), big.NewInt(1987)}, + Vector{big.NewInt(1034), big.NewInt(1987)}, + Vector{big.NewInt(8983), big.NewInt(1977)}, + Vector{big.NewInt(98382), big.NewInt(1887)}, + Vector{big.NewInt(12398), big.NewInt(1287)}, + Vector{big.NewInt(12398), big.NewInt(1487)}, + Vector{big.NewInt(12398), big.NewInt(1987)}, + Vector{big.NewInt(12398), big.NewInt(128)}, + Vector{big.NewInt(12398), big.NewInt(1987)}, + Vector{big.NewInt(1398), big.NewInt(187)}, + Vector{big.NewInt(12328), big.NewInt(1927)}, + Vector{big.NewInt(12398), big.NewInt(1987)}, + Vector{big.NewInt(22398), big.NewInt(1287)}, + Vector{big.NewInt(1370), big.NewInt(1981)}, + Vector{big.NewInt(12398), big.NewInt(1957)}, + Vector{big.NewInt(42198), big.NewInt(1987)}, + } + + VectorsBy(GasSort).Sort(vectors) + fmt.Println(vectors) + + BP := big.NewInt(15) + GL := big.NewInt(1000000) + EP := big.NewInt(100) + fmt.Println("BP", BP, "GL", GL, "EP", EP) + GP := GasPrice(BP, GL, EP) + fmt.Println("GP =", GP, "Wei per GU") + + S := len(vectors) / 4 + fmt.Println("L", len(vectors), "S", S) + for i := 1; i <= S*4; i += S { + fmt.Printf("T%d = %v\n", i, vectors[i]) + } + + g := VectorSum(GasSum).Sum(vectors) + fmt.Printf("G = ∑g* (%v)\n", g) +} diff --git a/p2p/discover/node.go b/p2p/discover/node.go index c6d2e9766..de2588258 100644 --- a/p2p/discover/node.go +++ b/p2p/discover/node.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "io" + "math/big" "math/rand" "net" "net/url" @@ -14,6 +15,7 @@ import ( "strings" "time" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto/secp256k1" "github.com/ethereum/go-ethereum/rlp" ) @@ -187,6 +189,19 @@ func PubkeyID(pub *ecdsa.PublicKey) NodeID { return id } +// Pubkey returns the public key represented by the node ID. +// It returns an error if the ID is not a point on the curve. +func (id NodeID) Pubkey() (*ecdsa.PublicKey, error) { + p := &ecdsa.PublicKey{Curve: crypto.S256(), X: new(big.Int), Y: new(big.Int)} + half := len(id) / 2 + p.X.SetBytes(id[:half]) + p.Y.SetBytes(id[half:]) + if !p.Curve.IsOnCurve(p.X, p.Y) { + return nil, errors.New("not a point on the S256 curve") + } + return p, nil +} + // recoverNodeID computes the public key used to sign the // given hash from the signature. func recoverNodeID(hash, sig []byte) (id NodeID, err error) { diff --git a/p2p/discover/node_test.go b/p2p/discover/node_test.go index ae82ae4f1..60b01b6ca 100644 --- a/p2p/discover/node_test.go +++ b/p2p/discover/node_test.go @@ -133,6 +133,24 @@ func TestNodeID_recover(t *testing.T) { if pub != recpub { t.Errorf("recovered wrong pubkey:\ngot: %v\nwant: %v", recpub, pub) } + + ecdsa, err := pub.Pubkey() + if err != nil { + t.Errorf("Pubkey error: %v", err) + } + if !reflect.DeepEqual(ecdsa, &prv.PublicKey) { + t.Errorf("Pubkey mismatch:\n got: %#v\n want: %#v", ecdsa, &prv.PublicKey) + } +} + +func TestNodeID_pubkeyBad(t *testing.T) { + ecdsa, err := NodeID{}.Pubkey() + if err == nil { + t.Error("expected error for zero ID") + } + if ecdsa != nil { + t.Error("expected nil result") + } } func TestNodeID_distcmp(t *testing.T) { diff --git a/p2p/handshake.go b/p2p/handshake.go index 614711eaf..7fc497517 100644 --- a/p2p/handshake.go +++ b/p2p/handshake.go @@ -2,15 +2,18 @@ package p2p import ( "crypto/ecdsa" + "crypto/elliptic" "crypto/rand" "errors" "fmt" + "hash" "io" "net" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto/ecies" "github.com/ethereum/go-ethereum/crypto/secp256k1" + "github.com/ethereum/go-ethereum/crypto/sha3" "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/rlp" ) @@ -24,27 +27,33 @@ const ( authMsgLen = sigLen + shaLen + pubLen + shaLen + 1 authRespLen = pubLen + shaLen + 1 - eciesBytes = 65 + 16 + 32 - iHSLen = authMsgLen + eciesBytes // size of the final ECIES payload sent as initiator's handshake - rHSLen = authRespLen + eciesBytes // size of the final ECIES payload sent as receiver's handshake + eciesBytes = 65 + 16 + 32 + encAuthMsgLen = authMsgLen + eciesBytes // size of the final ECIES payload sent as initiator's handshake + encAuthRespLen = authRespLen + eciesBytes // size of the final ECIES payload sent as receiver's handshake ) +// conn represents a remote connection after encryption handshake +// and protocol handshake have completed. +// +// The MsgReadWriter is usually layered as follows: +// +// netWrapper (I/O timeouts, thread-safe ReadMsg, WriteMsg) +// rlpxFrameRW (message encoding, encryption, authentication) +// bufio.ReadWriter (buffering) +// net.Conn (network I/O) +// type conn struct { - *frameRW + MsgReadWriter *protoHandshake } -func newConn(fd net.Conn, hs *protoHandshake) *conn { - return &conn{newFrameRW(fd, msgWriteTimeout), hs} -} - -// encHandshake represents information about the remote end -// of a connection that is negotiated during the encryption handshake. -type encHandshake struct { - ID discover.NodeID - IngressMAC []byte - EgressMAC []byte - Token []byte +// secrets represents the connection secrets +// which are negotiated during the encryption handshake. +type secrets struct { + RemoteID discover.NodeID + AES, MAC []byte + EgressMAC, IngressMAC hash.Hash + Token []byte } // protoHandshake is the RLP structure of the protocol handshake. @@ -68,15 +77,21 @@ func setupConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake, dial *di } func setupInboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake) (*conn, error) { - // var remotePubkey []byte - // sessionToken, remotePubkey, err = inboundEncHandshake(fd, prv, nil) - // copy(remoteID[:], remotePubkey) + secrets, err := receiverEncHandshake(fd, prv, nil) + if err != nil { + return nil, fmt.Errorf("encryption handshake failed: %v", err) + } - rw := newFrameRW(fd, msgWriteTimeout) + // Run the protocol handshake using authenticated messages. + rw := newRlpxFrameRW(fd, secrets) rhs, err := readProtocolHandshake(rw, our) if err != nil { return nil, err } + if rhs.ID != secrets.RemoteID { + return nil, errors.New("node ID in protocol handshake does not match encryption handshake") + } + // TODO: validate that handshake node ID matches if err := writeProtocolHandshake(rw, our); err != nil { return nil, fmt.Errorf("protocol write error: %v", err) } @@ -84,10 +99,13 @@ func setupInboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake) ( } func setupOutboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake, dial *discover.Node) (*conn, error) { - // remoteID = dial.ID - // sessionToken, err = outboundEncHandshake(fd, prv, remoteID[:], nil) + secrets, err := initiatorEncHandshake(fd, prv, dial.ID, nil) + if err != nil { + return nil, fmt.Errorf("encryption handshake failed: %v", err) + } - rw := newFrameRW(fd, msgWriteTimeout) + // Run the protocol handshake using authenticated messages. + rw := newRlpxFrameRW(fd, secrets) if err := writeProtocolHandshake(rw, our); err != nil { return nil, fmt.Errorf("protocol write error: %v", err) } @@ -101,273 +119,256 @@ func setupOutboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake, return &conn{rw, rhs}, nil } -// outboundEncHandshake negotiates a session token on conn. +// encHandshake contains the state of the encryption handshake. +type encHandshake struct { + initiator bool + remoteID discover.NodeID + + remotePub *ecies.PublicKey // remote-pubk + initNonce, respNonce []byte // nonce + randomPrivKey *ecies.PrivateKey // ecdhe-random + remoteRandomPub *ecies.PublicKey // ecdhe-random-pubk +} + +// secrets is called after the handshake is completed. +// It extracts the connection secrets from the handshake values. +func (h *encHandshake) secrets(auth, authResp []byte) (secrets, error) { + ecdheSecret, err := h.randomPrivKey.GenerateShared(h.remoteRandomPub, sskLen, sskLen) + if err != nil { + return secrets{}, err + } + + // derive base secrets from ephemeral key agreement + sharedSecret := crypto.Sha3(ecdheSecret, crypto.Sha3(h.respNonce, h.initNonce)) + aesSecret := crypto.Sha3(ecdheSecret, sharedSecret) + s := secrets{ + RemoteID: h.remoteID, + AES: aesSecret, + MAC: crypto.Sha3(ecdheSecret, aesSecret), + Token: crypto.Sha3(sharedSecret), + } + + // setup sha3 instances for the MACs + mac1 := sha3.NewKeccak256() + mac1.Write(xor(s.MAC, h.respNonce)) + mac1.Write(auth) + mac2 := sha3.NewKeccak256() + mac2.Write(xor(s.MAC, h.initNonce)) + mac2.Write(authResp) + if h.initiator { + s.EgressMAC, s.IngressMAC = mac1, mac2 + } else { + s.EgressMAC, s.IngressMAC = mac2, mac1 + } + + return s, nil +} + +func (h *encHandshake) ecdhShared(prv *ecdsa.PrivateKey) ([]byte, error) { + return ecies.ImportECDSA(prv).GenerateShared(h.remotePub, sskLen, sskLen) +} + +// initiatorEncHandshake negotiates a session token on conn. // it should be called on the dialing side of the connection. // -// privateKey is the local client's private key -// remotePublicKey is the remote peer's node ID -// sessionToken is the token from a previous session with this node. -func outboundEncHandshake(conn io.ReadWriter, prvKey *ecdsa.PrivateKey, remotePublicKey []byte, sessionToken []byte) ( - newSessionToken []byte, - err error, -) { - auth, initNonce, randomPrivKey, err := authMsg(prvKey, remotePublicKey, sessionToken) +// prv is the local client's private key. +// token is the token from a previous session with this node. +func initiatorEncHandshake(conn io.ReadWriter, prv *ecdsa.PrivateKey, remoteID discover.NodeID, token []byte) (s secrets, err error) { + h, err := newInitiatorHandshake(remoteID) if err != nil { - return nil, err + return s, err + } + auth, err := h.authMsg(prv, token) + if err != nil { + return s, err } if _, err = conn.Write(auth); err != nil { - return nil, err + return s, err } - response := make([]byte, rHSLen) + response := make([]byte, encAuthRespLen) if _, err = io.ReadFull(conn, response); err != nil { + return s, err + } + if err := h.decodeAuthResp(response, prv); err != nil { + return s, err + } + return h.secrets(auth, response) +} + +func newInitiatorHandshake(remoteID discover.NodeID) (*encHandshake, error) { + // generate random initiator nonce + n := make([]byte, shaLen) + if _, err := rand.Read(n); err != nil { return nil, err } - recNonce, remoteRandomPubKey, _, err := completeHandshake(response, prvKey) + // generate random keypair to use for signing + randpriv, err := ecies.GenerateKey(rand.Reader, crypto.S256(), nil) if err != nil { return nil, err } - - return newSession(initNonce, recNonce, randomPrivKey, remoteRandomPubKey) -} - -// authMsg creates the initiator handshake. -func authMsg(prvKey *ecdsa.PrivateKey, remotePubKeyS, sessionToken []byte) ( - auth, initNonce []byte, - randomPrvKey *ecdsa.PrivateKey, - err error, -) { - // session init, common to both parties - remotePubKey, err := importPublicKey(remotePubKeyS) + rpub, err := remoteID.Pubkey() if err != nil { - return + return nil, fmt.Errorf("bad remoteID: %v", err) + } + h := &encHandshake{ + initiator: true, + remoteID: remoteID, + remotePub: ecies.ImportECDSAPublic(rpub), + initNonce: n, + randomPrivKey: randpriv, } + return h, nil +} - var tokenFlag byte // = 0x00 - if sessionToken == nil { +// authMsg creates an encrypted initiator handshake message. +func (h *encHandshake) authMsg(prv *ecdsa.PrivateKey, token []byte) ([]byte, error) { + var tokenFlag byte + if token == nil { // no session token found means we need to generate shared secret. // ecies shared secret is used as initial session token for new peers // generate shared key from prv and remote pubkey - if sessionToken, err = ecies.ImportECDSA(prvKey).GenerateShared(ecies.ImportECDSAPublic(remotePubKey), sskLen, sskLen); err != nil { - return + var err error + if token, err = h.ecdhShared(prv); err != nil { + return nil, err } - // tokenFlag = 0x00 // redundant } else { // for known peers, we use stored token from the previous session tokenFlag = 0x01 } - //E(remote-pubk, S(ecdhe-random, ecdh-shared-secret^nonce) || H(ecdhe-random-pubk) || pubk || nonce || 0x0) - // E(remote-pubk, S(ecdhe-random, token^nonce) || H(ecdhe-random-pubk) || pubk || nonce || 0x1) - // allocate msgLen long message, - var msg []byte = make([]byte, authMsgLen) - initNonce = msg[authMsgLen-shaLen-1 : authMsgLen-1] - if _, err = rand.Read(initNonce); err != nil { - return + // sign known message: + // ecdh-shared-secret^nonce for new peers + // token^nonce for old peers + signed := xor(token, h.initNonce) + signature, err := crypto.Sign(signed, h.randomPrivKey.ExportECDSA()) + if err != nil { + return nil, err } - // create known message - // ecdh-shared-secret^nonce for new peers - // token^nonce for old peers - var sharedSecret = xor(sessionToken, initNonce) - // generate random keypair to use for signing - if randomPrvKey, err = crypto.GenerateKey(); err != nil { - return - } - // sign shared secret (message known to both parties): shared-secret - var signature []byte - // signature = sign(ecdhe-random, shared-secret) - // uses secp256k1.Sign - if signature, err = crypto.Sign(sharedSecret, randomPrvKey); err != nil { - return - } - - // message - // signed-shared-secret || H(ecdhe-random-pubk) || pubk || nonce || 0x0 - copy(msg, signature) // copy signed-shared-secret - // H(ecdhe-random-pubk) - var randomPubKey64 []byte - if randomPubKey64, err = exportPublicKey(&randomPrvKey.PublicKey); err != nil { - return - } - var pubKey64 []byte - if pubKey64, err = exportPublicKey(&prvKey.PublicKey); err != nil { - return - } - copy(msg[sigLen:sigLen+shaLen], crypto.Sha3(randomPubKey64)) - // pubkey copied to the correct segment. - copy(msg[sigLen+shaLen:sigLen+shaLen+pubLen], pubKey64) - // nonce is already in the slice - // stick tokenFlag byte to the end - msg[authMsgLen-1] = tokenFlag + // encode auth message + // signature || sha3(ecdhe-random-pubk) || pubk || nonce || token-flag + msg := make([]byte, authMsgLen) + n := copy(msg, signature) + n += copy(msg[n:], crypto.Sha3(exportPubkey(&h.randomPrivKey.PublicKey))) + n += copy(msg[n:], crypto.FromECDSAPub(&prv.PublicKey)[1:]) + n += copy(msg[n:], h.initNonce) + msg[n] = tokenFlag - // encrypt using remote-pubk - // auth = eciesEncrypt(remote-pubk, msg) - if auth, err = crypto.Encrypt(remotePubKey, msg); err != nil { - return - } - return + // encrypt auth message using remote-pubk + return ecies.Encrypt(rand.Reader, h.remotePub, msg, nil, nil) } -// completeHandshake is called when the initiator receives an -// authentication response (aka receiver handshake). It completes the -// handshake by reading off parameters the remote peer provides needed -// to set up the secure session. -func completeHandshake(auth []byte, prvKey *ecdsa.PrivateKey) ( - respNonce []byte, - remoteRandomPubKey *ecdsa.PublicKey, - tokenFlag bool, - err error, -) { - var msg []byte - // they prove that msg is meant for me, - // I prove I possess private key if i can read it - if msg, err = crypto.Decrypt(prvKey, auth); err != nil { - return - } - - respNonce = msg[pubLen : pubLen+shaLen] - var remoteRandomPubKeyS = msg[:pubLen] - if remoteRandomPubKey, err = importPublicKey(remoteRandomPubKeyS); err != nil { - return - } - if msg[authRespLen-1] == 0x01 { - tokenFlag = true - } - return +// decodeAuthResp decode an encrypted authentication response message. +func (h *encHandshake) decodeAuthResp(auth []byte, prv *ecdsa.PrivateKey) error { + msg, err := crypto.Decrypt(prv, auth) + if err != nil { + return fmt.Errorf("could not decrypt auth response (%v)", err) + } + h.respNonce = msg[pubLen : pubLen+shaLen] + h.remoteRandomPub, err = importPublicKey(msg[:pubLen]) + if err != nil { + return err + } + // ignore token flag for now + return nil } -// inboundEncHandshake negotiates a session token on conn. +// receiverEncHandshake negotiates a session token on conn. // it should be called on the listening side of the connection. // -// privateKey is the local client's private key -// sessionToken is the token from a previous session with this node. -func inboundEncHandshake(conn io.ReadWriter, prvKey *ecdsa.PrivateKey, sessionToken []byte) ( - token, remotePubKey []byte, - err error, -) { - // we are listening connection. we are responders in the - // handshake. Extract info from the authentication. The initiator - // starts by sending us a handshake that we need to respond to. so - // we read auth message first, then respond. - auth := make([]byte, iHSLen) +// prv is the local client's private key. +// token is the token from a previous session with this node. +func receiverEncHandshake(conn io.ReadWriter, prv *ecdsa.PrivateKey, token []byte) (s secrets, err error) { + // read remote auth sent by initiator. + auth := make([]byte, encAuthMsgLen) if _, err := io.ReadFull(conn, auth); err != nil { - return nil, nil, err + return s, err } - response, recNonce, initNonce, remotePubKey, randomPrivKey, remoteRandomPubKey, err := authResp(auth, sessionToken, prvKey) + h, err := decodeAuthMsg(prv, token, auth) if err != nil { - return nil, nil, err + return s, err } - if _, err = conn.Write(response); err != nil { - return nil, nil, err - } - token, err = newSession(initNonce, recNonce, randomPrivKey, remoteRandomPubKey) - return token, remotePubKey, err -} -// authResp is called by peer if it accepted (but not -// initiated) the connection from the remote. It is passed the initiator -// handshake received and the session token belonging to the -// remote initiator. -// -// The first return value is the authentication response (aka receiver -// handshake) that is to be sent to the remote initiator. -func authResp(auth, sessionToken []byte, prvKey *ecdsa.PrivateKey) ( - authResp, respNonce, initNonce, remotePubKeyS []byte, - randomPrivKey *ecdsa.PrivateKey, - remoteRandomPubKey *ecdsa.PublicKey, - err error, -) { - // they prove that msg is meant for me, - // I prove I possess private key if i can read it - msg, err := crypto.Decrypt(prvKey, auth) + // send auth response + resp, err := h.authResp(prv, token) if err != nil { - return + return s, err + } + if _, err = conn.Write(resp); err != nil { + return s, err } - remotePubKeyS = msg[sigLen+shaLen : sigLen+shaLen+pubLen] - remotePubKey, _ := importPublicKey(remotePubKeyS) + return h.secrets(auth, resp) +} - var tokenFlag byte - if sessionToken == nil { - // no session token found means we need to generate shared secret. - // ecies shared secret is used as initial session token for new peers - // generate shared key from prv and remote pubkey - if sessionToken, err = ecies.ImportECDSA(prvKey).GenerateShared(ecies.ImportECDSAPublic(remotePubKey), sskLen, sskLen); err != nil { - return - } - // tokenFlag = 0x00 // redundant - } else { - // for known peers, we use stored token from the previous session - tokenFlag = 0x01 +func decodeAuthMsg(prv *ecdsa.PrivateKey, token []byte, auth []byte) (*encHandshake, error) { + var err error + h := new(encHandshake) + // generate random keypair for session + h.randomPrivKey, err = ecies.GenerateKey(rand.Reader, crypto.S256(), nil) + if err != nil { + return nil, err + } + // generate random nonce + h.respNonce = make([]byte, shaLen) + if _, err = rand.Read(h.respNonce); err != nil { + return nil, err } - // the initiator nonce is read off the end of the message - initNonce = msg[authMsgLen-shaLen-1 : authMsgLen-1] - // I prove that i own prv key (to derive shared secret, and read - // nonce off encrypted msg) and that I own shared secret they - // prove they own the private key belonging to ecdhe-random-pubk - // we can now reconstruct the signed message and recover the peers - // pubkey - var signedMsg = xor(sessionToken, initNonce) - var remoteRandomPubKeyS []byte - if remoteRandomPubKeyS, err = secp256k1.RecoverPubkey(signedMsg, msg[:sigLen]); err != nil { - return + msg, err := crypto.Decrypt(prv, auth) + if err != nil { + return nil, fmt.Errorf("could not decrypt auth message (%v)", err) } - // convert to ECDSA standard - if remoteRandomPubKey, err = importPublicKey(remoteRandomPubKeyS); err != nil { - return + + // decode message parameters + // signature || sha3(ecdhe-random-pubk) || pubk || nonce || token-flag + h.initNonce = msg[authMsgLen-shaLen-1 : authMsgLen-1] + copy(h.remoteID[:], msg[sigLen+shaLen:sigLen+shaLen+pubLen]) + rpub, err := h.remoteID.Pubkey() + if err != nil { + return nil, fmt.Errorf("bad remoteID: %#v", err) } + h.remotePub = ecies.ImportECDSAPublic(rpub) - // now we find ourselves a long task too, fill it random - var resp = make([]byte, authRespLen) - // generate shaLen long nonce - respNonce = resp[pubLen : pubLen+shaLen] - if _, err = rand.Read(respNonce); err != nil { - return + // recover remote random pubkey from signed message. + if token == nil { + // TODO: it is an error if the initiator has a token and we don't. check that. + + // no session token means we need to generate shared secret. + // ecies shared secret is used as initial session token for new peers. + // generate shared key from prv and remote pubkey. + if token, err = h.ecdhShared(prv); err != nil { + return nil, err + } } - // generate random keypair for session - if randomPrivKey, err = crypto.GenerateKey(); err != nil { - return + signedMsg := xor(token, h.initNonce) + remoteRandomPub, err := secp256k1.RecoverPubkey(signedMsg, msg[:sigLen]) + if err != nil { + return nil, err } + h.remoteRandomPub, _ = importPublicKey(remoteRandomPub) + return h, nil +} + +// authResp generates the encrypted authentication response message. +func (h *encHandshake) authResp(prv *ecdsa.PrivateKey, token []byte) ([]byte, error) { // responder auth message // E(remote-pubk, ecdhe-random-pubk || nonce || 0x0) - var randomPubKeyS []byte - if randomPubKeyS, err = exportPublicKey(&randomPrivKey.PublicKey); err != nil { - return + resp := make([]byte, authRespLen) + n := copy(resp, exportPubkey(&h.randomPrivKey.PublicKey)) + n += copy(resp[n:], h.respNonce) + if token == nil { + resp[n] = 0 + } else { + resp[n] = 1 } - copy(resp[:pubLen], randomPubKeyS) - // nonce is already in the slice - resp[authRespLen-1] = tokenFlag - // encrypt using remote-pubk - // auth = eciesEncrypt(remote-pubk, msg) - // why not encrypt with ecdhe-random-remote - if authResp, err = crypto.Encrypt(remotePubKey, resp); err != nil { - return - } - return -} - -// newSession is called after the handshake is completed. The -// arguments are values negotiated in the handshake. The return value -// is a new session Token to be remembered for the next time we -// connect with this peer. -func newSession(initNonce, respNonce []byte, privKey *ecdsa.PrivateKey, remoteRandomPubKey *ecdsa.PublicKey) ([]byte, error) { - // 3) Now we can trust ecdhe-random-pubk to derive new keys - //ecdhe-shared-secret = ecdh.agree(ecdhe-random, remote-ecdhe-random-pubk) - pubKey := ecies.ImportECDSAPublic(remoteRandomPubKey) - dhSharedSecret, err := ecies.ImportECDSA(privKey).GenerateShared(pubKey, sskLen, sskLen) - if err != nil { - return nil, err - } - sharedSecret := crypto.Sha3(dhSharedSecret, crypto.Sha3(respNonce, initNonce)) - sessionToken := crypto.Sha3(sharedSecret) - return sessionToken, nil + return ecies.Encrypt(rand.Reader, h.remotePub, resp, nil, nil) } // importPublicKey unmarshals 512 bit public keys. -func importPublicKey(pubKey []byte) (pubKeyEC *ecdsa.PublicKey, err error) { +func importPublicKey(pubKey []byte) (*ecies.PublicKey, error) { var pubKey65 []byte switch len(pubKey) { case 64: @@ -378,14 +379,15 @@ func importPublicKey(pubKey []byte) (pubKeyEC *ecdsa.PublicKey, err error) { default: return nil, fmt.Errorf("invalid public key length %v (expect 64/65)", len(pubKey)) } - return crypto.ToECDSAPub(pubKey65), nil + // TODO: fewer pointless conversions + return ecies.ImportECDSAPublic(crypto.ToECDSAPub(pubKey65)), nil } -func exportPublicKey(pubKeyEC *ecdsa.PublicKey) (pubKey []byte, err error) { - if pubKeyEC == nil { - return nil, fmt.Errorf("no ECDSA public key given") +func exportPubkey(pub *ecies.PublicKey) []byte { + if pub == nil { + panic("nil pubkey") } - return crypto.FromECDSAPub(pubKeyEC)[1:], nil + return elliptic.Marshal(pub.Curve, pub.X, pub.Y)[1:] } func xor(one, other []byte) (xor []byte) { diff --git a/p2p/handshake_test.go b/p2p/handshake_test.go index 06c6a6932..19423bb82 100644 --- a/p2p/handshake_test.go +++ b/p2p/handshake_test.go @@ -2,53 +2,18 @@ package p2p import ( "bytes" - "crypto/ecdsa" "crypto/rand" + "fmt" "net" "reflect" "testing" + "time" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto/ecies" "github.com/ethereum/go-ethereum/p2p/discover" ) -func TestPublicKeyEncoding(t *testing.T) { - prv0, _ := crypto.GenerateKey() // = ecdsa.GenerateKey(crypto.S256(), rand.Reader) - pub0 := &prv0.PublicKey - pub0s := crypto.FromECDSAPub(pub0) - pub1, err := importPublicKey(pub0s) - if err != nil { - t.Errorf("%v", err) - } - eciesPub1 := ecies.ImportECDSAPublic(pub1) - if eciesPub1 == nil { - t.Errorf("invalid ecdsa public key") - } - pub1s, err := exportPublicKey(pub1) - if err != nil { - t.Errorf("%v", err) - } - if len(pub1s) != 64 { - t.Errorf("wrong length expect 64, got", len(pub1s)) - } - pub2, err := importPublicKey(pub1s) - if err != nil { - t.Errorf("%v", err) - } - pub2s, err := exportPublicKey(pub2) - if err != nil { - t.Errorf("%v", err) - } - if !bytes.Equal(pub1s, pub2s) { - t.Errorf("exports dont match") - } - pub2sEC := crypto.FromECDSAPub(pub2) - if !bytes.Equal(pub0s, pub2sEC) { - t.Errorf("exports dont match") - } -} - func TestSharedSecret(t *testing.T) { prv0, _ := crypto.GenerateKey() // = ecdsa.GenerateKey(crypto.S256(), rand.Reader) pub0 := &prv0.PublicKey @@ -69,103 +34,85 @@ func TestSharedSecret(t *testing.T) { } } -func TestCryptoHandshake(t *testing.T) { - testCryptoHandshake(newkey(), newkey(), nil, t) -} - -func TestCryptoHandshakeWithToken(t *testing.T) { - sessionToken := make([]byte, shaLen) - rand.Read(sessionToken) - testCryptoHandshake(newkey(), newkey(), sessionToken, t) -} - -func testCryptoHandshake(prv0, prv1 *ecdsa.PrivateKey, sessionToken []byte, t *testing.T) { - var err error - // pub0 := &prv0.PublicKey - pub1 := &prv1.PublicKey - - // pub0s := crypto.FromECDSAPub(pub0) - pub1s := crypto.FromECDSAPub(pub1) - - // simulate handshake by feeding output to input - // initiator sends handshake 'auth' - auth, initNonce, randomPrivKey, err := authMsg(prv0, pub1s, sessionToken) - if err != nil { - t.Errorf("%v", err) - } - // t.Logf("-> %v", hexkey(auth)) - - // receiver reads auth and responds with response - response, remoteRecNonce, remoteInitNonce, _, remoteRandomPrivKey, remoteInitRandomPubKey, err := authResp(auth, sessionToken, prv1) - if err != nil { - t.Errorf("%v", err) - } - // t.Logf("<- %v\n", hexkey(response)) - - // initiator reads receiver's response and the key exchange completes - recNonce, remoteRandomPubKey, _, err := completeHandshake(response, prv0) - if err != nil { - t.Errorf("completeHandshake error: %v", err) - } - - // now both parties should have the same session parameters - initSessionToken, err := newSession(initNonce, recNonce, randomPrivKey, remoteRandomPubKey) - if err != nil { - t.Errorf("newSession error: %v", err) - } - - recSessionToken, err := newSession(remoteInitNonce, remoteRecNonce, remoteRandomPrivKey, remoteInitRandomPubKey) - if err != nil { - t.Errorf("newSession error: %v", err) +func TestEncHandshake(t *testing.T) { + for i := 0; i < 20; i++ { + start := time.Now() + if err := testEncHandshake(nil); err != nil { + t.Fatalf("i=%d %v", i, err) + } + t.Logf("(without token) %d %v\n", i+1, time.Since(start)) } - // fmt.Printf("\nauth (%v) %x\n\nresp (%v) %x\n\n", len(auth), auth, len(response), response) - - // fmt.Printf("\nauth %x\ninitNonce %x\nresponse%x\nremoteRecNonce %x\nremoteInitNonce %x\nremoteRandomPubKey %x\nrecNonce %x\nremoteInitRandomPubKey %x\ninitSessionToken %x\n\n", auth, initNonce, response, remoteRecNonce, remoteInitNonce, remoteRandomPubKey, recNonce, remoteInitRandomPubKey, initSessionToken) - - if !bytes.Equal(initNonce, remoteInitNonce) { - t.Errorf("nonces do not match") - } - if !bytes.Equal(recNonce, remoteRecNonce) { - t.Errorf("receiver nonces do not match") - } - if !bytes.Equal(initSessionToken, recSessionToken) { - t.Errorf("session tokens do not match") + for i := 0; i < 20; i++ { + tok := make([]byte, shaLen) + rand.Reader.Read(tok) + start := time.Now() + if err := testEncHandshake(tok); err != nil { + t.Fatalf("i=%d %v", i, err) + } + t.Logf("(with token) %d %v\n", i+1, time.Since(start)) } } -func TestEncHandshake(t *testing.T) { - defer testlog(t).detach() - - prv0, _ := crypto.GenerateKey() - prv1, _ := crypto.GenerateKey() - pub0s, _ := exportPublicKey(&prv0.PublicKey) - pub1s, _ := exportPublicKey(&prv1.PublicKey) - rw0, rw1 := net.Pipe() - tokens := make(chan []byte) +func testEncHandshake(token []byte) error { + type result struct { + side string + s secrets + err error + } + var ( + prv0, _ = crypto.GenerateKey() + prv1, _ = crypto.GenerateKey() + rw0, rw1 = net.Pipe() + output = make(chan result) + ) go func() { - token, err := outboundEncHandshake(rw0, prv0, pub1s, nil) - if err != nil { - t.Errorf("outbound side error: %v", err) + r := result{side: "initiator"} + defer func() { output <- r }() + + pub1s := discover.PubkeyID(&prv1.PublicKey) + r.s, r.err = initiatorEncHandshake(rw0, prv0, pub1s, token) + if r.err != nil { + return + } + id1 := discover.PubkeyID(&prv1.PublicKey) + if r.s.RemoteID != id1 { + r.err = fmt.Errorf("remote ID mismatch: got %v, want: %v", r.s.RemoteID, id1) } - tokens <- token }() go func() { - token, remotePubkey, err := inboundEncHandshake(rw1, prv1, nil) - if err != nil { - t.Errorf("inbound side error: %v", err) + r := result{side: "receiver"} + defer func() { output <- r }() + + r.s, r.err = receiverEncHandshake(rw1, prv1, token) + if r.err != nil { + return } - if !bytes.Equal(remotePubkey, pub0s) { - t.Errorf("inbound side returned wrong remote pubkey\n got: %x\n want: %x", remotePubkey, pub0s) + id0 := discover.PubkeyID(&prv0.PublicKey) + if r.s.RemoteID != id0 { + r.err = fmt.Errorf("remote ID mismatch: got %v, want: %v", r.s.RemoteID, id0) } - tokens <- token }() - t1, t2 := <-tokens, <-tokens - if !bytes.Equal(t1, t2) { - t.Error("session token mismatch") + // wait for results from both sides + r1, r2 := <-output, <-output + + if r1.err != nil { + return fmt.Errorf("%s side error: %v", r1.side, r1.err) + } + if r2.err != nil { + return fmt.Errorf("%s side error: %v", r2.side, r2.err) + } + + // don't compare remote node IDs + r1.s.RemoteID, r2.s.RemoteID = discover.NodeID{}, discover.NodeID{} + // flip MACs on one of them so they compare equal + r1.s.EgressMAC, r1.s.IngressMAC = r1.s.IngressMAC, r1.s.EgressMAC + if !reflect.DeepEqual(r1.s, r2.s) { + return fmt.Errorf("secrets mismatch:\n t1: %#v\n t2: %#v", r1.s, r2.s) } + return nil } func TestSetupConn(t *testing.T) { diff --git a/p2p/message.go b/p2p/message.go index 7adad4b09..f88c31d1d 100644 --- a/p2p/message.go +++ b/p2p/message.go @@ -1,14 +1,11 @@ package p2p import ( - "bufio" "bytes" - "encoding/binary" "errors" "fmt" "io" "io/ioutil" - "math/big" "net" "sync" "sync/atomic" @@ -18,28 +15,6 @@ import ( "github.com/ethereum/go-ethereum/rlp" ) -// parameters for frameRW -const ( - // maximum time allowed for reading a message header. - // this is effectively the amount of time a connection can be idle. - frameReadTimeout = 1 * time.Minute - - // maximum time allowed for reading the payload data of a message. - // this is shorter than (and distinct from) frameReadTimeout because - // the connection is not considered idle while a message is transferred. - // this also limits the payload size of messages to how much the connection - // can transfer within the timeout. - payloadReadTimeout = 5 * time.Second - - // maximum amount of time allowed for writing a complete message. - msgWriteTimeout = 5 * time.Second - - // messages smaller than this many bytes will be read at - // once before passing them to a protocol. this increases - // concurrency in the processing. - wholePayloadSize = 64 * 1024 -) - // Msg defines the structure of a p2p message. // // Note that a Msg can only be sent once since the Payload reader is @@ -55,19 +30,8 @@ type Msg struct { // NewMsg creates an RLP-encoded message with the given code. func NewMsg(code uint64, params ...interface{}) Msg { - buf := new(bytes.Buffer) - for _, p := range params { - buf.Write(ethutil.Encode(p)) - } - return Msg{Code: code, Size: uint32(buf.Len()), Payload: buf} -} - -func encodePayload(params ...interface{}) []byte { - buf := new(bytes.Buffer) - for _, p := range params { - buf.Write(ethutil.Encode(p)) - } - return buf.Bytes() + p := bytes.NewReader(ethutil.Encode(params)) + return Msg{Code: code, Size: uint32(p.Len()), Payload: p} } // Decode parse the RLP content of a message into @@ -75,8 +39,7 @@ func encodePayload(params ...interface{}) []byte { // // For the decoding rules, please see package rlp. func (msg Msg) Decode(val interface{}) error { - s := rlp.NewListStream(msg.Payload, uint64(msg.Size)) - if err := s.Decode(val); err != nil { + if err := rlp.Decode(msg.Payload, val); err != nil { return newPeerError(errInvalidMsg, "(code %#x) (size %d) %v", msg.Code, msg.Size, err) } return nil @@ -119,138 +82,28 @@ func EncodeMsg(w MsgWriter, code uint64, data ...interface{}) error { return w.WriteMsg(NewMsg(code, data...)) } -// frameRW is a MsgReadWriter that reads and writes devp2p message frames. -// As required by the interface, ReadMsg and WriteMsg can be called from -// multiple goroutines. -type frameRW struct { - net.Conn // make Conn methods available. be careful. - bufconn *bufio.ReadWriter - - // this channel is used to 'lend' bufconn to a caller of ReadMsg - // until the message payload has been consumed. the channel - // receives a value when EOF is reached on the payload, unblocking - // a pending call to ReadMsg. - rsync chan struct{} - - // this mutex guards writes to bufconn. - writeMu sync.Mutex -} - -func newFrameRW(conn net.Conn, timeout time.Duration) *frameRW { - rsync := make(chan struct{}, 1) - rsync <- struct{}{} - return &frameRW{ - Conn: conn, - bufconn: bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriter(conn)), - rsync: rsync, - } -} - -var magicToken = []byte{34, 64, 8, 145} - -func (rw *frameRW) WriteMsg(msg Msg) error { - rw.writeMu.Lock() - defer rw.writeMu.Unlock() - rw.SetWriteDeadline(time.Now().Add(msgWriteTimeout)) - if err := writeMsg(rw.bufconn, msg); err != nil { - return err - } - return rw.bufconn.Flush() -} - -func writeMsg(w io.Writer, msg Msg) error { - // TODO: handle case when Size + len(code) + len(listhdr) overflows uint32 - code := ethutil.Encode(uint32(msg.Code)) - listhdr := makeListHeader(msg.Size + uint32(len(code))) - payloadLen := uint32(len(listhdr)) + uint32(len(code)) + msg.Size - - start := make([]byte, 8) - copy(start, magicToken) - binary.BigEndian.PutUint32(start[4:], payloadLen) - - for _, b := range [][]byte{start, listhdr, code} { - if _, err := w.Write(b); err != nil { - return err - } - } - _, err := io.CopyN(w, msg.Payload, int64(msg.Size)) - return err -} - -func makeListHeader(length uint32) []byte { - if length < 56 { - return []byte{byte(length + 0xc0)} - } - enc := big.NewInt(int64(length)).Bytes() - lenb := byte(len(enc)) + 0xf7 - return append([]byte{lenb}, enc...) -} - -func (rw *frameRW) ReadMsg() (msg Msg, err error) { - <-rw.rsync // wait until bufconn is ours - - rw.SetReadDeadline(time.Now().Add(frameReadTimeout)) - - // read magic and payload size - start := make([]byte, 8) - if _, err = io.ReadFull(rw.bufconn, start); err != nil { - return msg, err - } - if !bytes.HasPrefix(start, magicToken) { - return msg, fmt.Errorf("bad magic token %x", start[:4]) - } - size := binary.BigEndian.Uint32(start[4:]) - - // decode start of RLP message to get the message code - posr := &postrack{rw.bufconn, 0} - s := rlp.NewStream(posr) - if _, err := s.List(); err != nil { - return msg, err - } - msg.Code, err = s.Uint() - if err != nil { - return msg, err - } - msg.Size = size - posr.p - - rw.SetReadDeadline(time.Now().Add(payloadReadTimeout)) +// netWrapper wrapsa MsgReadWriter with locks around +// ReadMsg/WriteMsg and applies read/write deadlines. +type netWrapper struct { + rmu, wmu sync.Mutex - if msg.Size <= wholePayloadSize { - // msg is small, read all of it and move on to the next message. - pbuf := make([]byte, msg.Size) - if _, err := io.ReadFull(rw.bufconn, pbuf); err != nil { - return msg, err - } - rw.rsync <- struct{}{} // bufconn is available again - msg.Payload = bytes.NewReader(pbuf) - } else { - // lend bufconn to the caller until it has - // consumed the payload. eofSignal will send a value - // on rw.rsync when EOF is reached. - pr := &eofSignal{rw.bufconn, msg.Size, rw.rsync} - msg.Payload = pr - } - return msg, nil + rtimeout, wtimeout time.Duration + conn net.Conn + wrapped MsgReadWriter } -// postrack wraps an rlp.ByteReader with a position counter. -type postrack struct { - r rlp.ByteReader - p uint32 +func (rw *netWrapper) ReadMsg() (Msg, error) { + rw.rmu.Lock() + defer rw.rmu.Unlock() + rw.conn.SetReadDeadline(time.Now().Add(rw.rtimeout)) + return rw.wrapped.ReadMsg() } -func (r *postrack) Read(buf []byte) (int, error) { - n, err := r.r.Read(buf) - r.p += uint32(n) - return n, err -} - -func (r *postrack) ReadByte() (byte, error) { - b, err := r.r.ReadByte() - if err == nil { - r.p++ - } - return b, err +func (rw *netWrapper) WriteMsg(msg Msg) error { + rw.wmu.Lock() + defer rw.wmu.Unlock() + rw.conn.SetWriteDeadline(time.Now().Add(rw.wtimeout)) + return rw.wrapped.WriteMsg(msg) } // eofSignal wraps a reader with eof signaling. the eof channel is diff --git a/p2p/message_test.go b/p2p/message_test.go index 4b94ebb5f..31ed61d87 100644 --- a/p2p/message_test.go +++ b/p2p/message_test.go @@ -2,10 +2,12 @@ package p2p import ( "bytes" + "encoding/hex" "fmt" "io" "io/ioutil" "runtime" + "strings" "testing" "time" ) @@ -15,62 +17,16 @@ func TestNewMsg(t *testing.T) { if msg.Code != 3 { t.Errorf("incorrect code %d, want %d", msg.Code) } - if msg.Size != 5 { - t.Errorf("incorrect size %d, want %d", msg.Size, 5) + expect := unhex("c50183303030") + if msg.Size != uint32(len(expect)) { + t.Errorf("incorrect size %d, want %d", msg.Size, len(expect)) } pl, _ := ioutil.ReadAll(msg.Payload) - expect := []byte{0x01, 0x83, 0x30, 0x30, 0x30} if !bytes.Equal(pl, expect) { t.Errorf("incorrect payload content, got %x, want %x", pl, expect) } } -// func TestEncodeDecodeMsg(t *testing.T) { -// msg := NewMsg(3, 1, "000") -// buf := new(bytes.Buffer) -// if err := writeMsg(buf, msg); err != nil { -// t.Fatalf("encodeMsg error: %v", err) -// } -// // t.Logf("encoded: %x", buf.Bytes()) - -// decmsg, err := readMsg(buf) -// if err != nil { -// t.Fatalf("readMsg error: %v", err) -// } -// if decmsg.Code != 3 { -// t.Errorf("incorrect code %d, want %d", decmsg.Code, 3) -// } -// if decmsg.Size != 5 { -// t.Errorf("incorrect size %d, want %d", decmsg.Size, 5) -// } - -// var data struct { -// I uint -// S string -// } -// if err := decmsg.Decode(&data); err != nil { -// t.Fatalf("Decode error: %v", err) -// } -// if data.I != 1 { -// t.Errorf("incorrect data.I: got %v, expected %d", data.I, 1) -// } -// if data.S != "000" { -// t.Errorf("incorrect data.S: got %q, expected %q", data.S, "000") -// } -// } - -// func TestDecodeRealMsg(t *testing.T) { -// data := ethutil.Hex2Bytes("2240089100000080f87e8002b5457468657265756d282b2b292f5065657220536572766572204f6e652f76302e372e382f52656c656173652f4c696e75782f672b2bc082765fb84086dd80b7aefd6a6d2e3b93f4f300a86bfb6ef7bdc97cb03f793db6bb") -// msg, err := readMsg(bytes.NewReader(data)) -// if err != nil { -// t.Fatalf("unexpected error: %v", err) -// } - -// if msg.Code != 0 { -// t.Errorf("incorrect code %d, want %d", msg.Code, 0) -// } -// } - func ExampleMsgPipe() { rw1, rw2 := MsgPipe() go func() { @@ -185,3 +141,11 @@ func TestEOFSignal(t *testing.T) { default: } } + +func unhex(str string) []byte { + b, err := hex.DecodeString(strings.Replace(str, "\n", "", -1)) + if err != nil { + panic(fmt.Sprintf("invalid hex string: %q", str)) + } + return b +} diff --git a/p2p/peer.go b/p2p/peer.go index fb027c834..c2c83abfc 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -20,8 +20,8 @@ const ( baseProtocolLength = uint64(16) baseProtocolMaxMsgSize = 10 * 1024 * 1024 - disconnectGracePeriod = 2 * time.Second pingInterval = 15 * time.Second + disconnectGracePeriod = 2 * time.Second ) const ( @@ -40,6 +40,7 @@ type Peer struct { // Use them to display messages related to the peer. *logger.Logger + conn net.Conn rw *conn running map[string]*protoRW @@ -52,8 +53,9 @@ type Peer struct { // NewPeer returns a peer for testing purposes. func NewPeer(id discover.NodeID, name string, caps []Cap) *Peer { pipe, _ := net.Pipe() - conn := newConn(pipe, &protoHandshake{ID: id, Name: name, Caps: caps}) - peer := newPeer(conn, nil) + msgpipe, _ := MsgPipe() + conn := &conn{msgpipe, &protoHandshake{ID: id, Name: name, Caps: caps}} + peer := newPeer(pipe, conn, nil) close(peer.closed) // ensures Disconnect doesn't block return peer } @@ -76,12 +78,12 @@ func (p *Peer) Caps() []Cap { // RemoteAddr returns the remote address of the network connection. func (p *Peer) RemoteAddr() net.Addr { - return p.rw.RemoteAddr() + return p.conn.RemoteAddr() } // LocalAddr returns the local address of the network connection. func (p *Peer) LocalAddr() net.Addr { - return p.rw.LocalAddr() + return p.conn.LocalAddr() } // Disconnect terminates the peer connection with the given reason. @@ -98,10 +100,11 @@ func (p *Peer) String() string { return fmt.Sprintf("Peer %.8x %v", p.rw.ID[:], p.RemoteAddr()) } -func newPeer(conn *conn, protocols []Protocol) *Peer { - logtag := fmt.Sprintf("Peer %.8x %v", conn.ID[:], conn.RemoteAddr()) +func newPeer(fd net.Conn, conn *conn, protocols []Protocol) *Peer { + logtag := fmt.Sprintf("Peer %.8x %v", conn.ID[:], fd.RemoteAddr()) p := &Peer{ Logger: logger.NewLogger(logtag), + conn: fd, rw: conn, running: matchProtocols(protocols, conn.Caps, conn), disc: make(chan DiscReason), @@ -138,7 +141,7 @@ loop: // We rely on protocols to abort if there is a write error. It // might be more robust to handle them here as well. p.DebugDetailf("Read error: %v\n", err) - p.rw.Close() + p.conn.Close() return DiscNetworkError case err := <-p.protoErr: reason = discReasonForError(err) @@ -161,18 +164,19 @@ func (p *Peer) politeDisconnect(reason DiscReason) { EncodeMsg(p.rw, discMsg, uint(reason)) // Wait for the other side to close the connection. // Discard any data that they send until then. - io.Copy(ioutil.Discard, p.rw) + io.Copy(ioutil.Discard, p.conn) close(done) }() select { case <-done: case <-time.After(disconnectGracePeriod): } - p.rw.Close() + p.conn.Close() } func (p *Peer) readLoop() error { for { + p.conn.SetDeadline(time.Now().Add(frameReadTimeout)) msg, err := p.rw.ReadMsg() if err != nil { return err @@ -190,12 +194,12 @@ func (p *Peer) handle(msg Msg) error { msg.Discard() go EncodeMsg(p.rw, pongMsg) case msg.Code == discMsg: - var reason DiscReason + var reason [1]DiscReason // no need to discard or for error checking, we'll close the // connection after this. rlp.Decode(msg.Payload, &reason) p.Disconnect(DiscRequested) - return discRequestedError(reason) + return discRequestedError(reason[0]) case msg.Code < baseProtocolLength: // ignore other base protocol messages return msg.Discard() diff --git a/p2p/peer_test.go b/p2p/peer_test.go index a1260adbd..cc9f1f0cd 100644 --- a/p2p/peer_test.go +++ b/p2p/peer_test.go @@ -3,6 +3,7 @@ package p2p import ( "bytes" "fmt" + "io" "io/ioutil" "net" "reflect" @@ -29,8 +30,8 @@ var discard = Protocol{ }, } -func testPeer(protos []Protocol) (*conn, *Peer, <-chan DiscReason) { - fd1, fd2 := net.Pipe() +func testPeer(protos []Protocol) (io.Closer, *conn, *Peer, <-chan DiscReason) { + fd1, _ := net.Pipe() hs1 := &protoHandshake{ID: randomID(), Version: baseProtocolVersion} hs2 := &protoHandshake{ID: randomID(), Version: baseProtocolVersion} for _, p := range protos { @@ -38,11 +39,12 @@ func testPeer(protos []Protocol) (*conn, *Peer, <-chan DiscReason) { hs2.Caps = append(hs2.Caps, p.cap()) } - peer := newPeer(newConn(fd1, hs1), protos) + p1, p2 := MsgPipe() + peer := newPeer(fd1, &conn{p1, hs1}, protos) errc := make(chan DiscReason, 1) go func() { errc <- peer.run() }() - return newConn(fd2, hs2), peer, errc + return p1, &conn{p2, hs2}, peer, errc } func TestPeerProtoReadMsg(t *testing.T) { @@ -67,8 +69,8 @@ func TestPeerProtoReadMsg(t *testing.T) { }, } - rw, _, errc := testPeer([]Protocol{proto}) - defer rw.Close() + closer, rw, _, errc := testPeer([]Protocol{proto}) + defer closer.Close() EncodeMsg(rw, baseProtocolLength+2, 1) EncodeMsg(rw, baseProtocolLength+3, 2) @@ -83,41 +85,6 @@ func TestPeerProtoReadMsg(t *testing.T) { } } -func TestPeerProtoReadLargeMsg(t *testing.T) { - defer testlog(t).detach() - - msgsize := uint32(10 * 1024 * 1024) - done := make(chan struct{}) - proto := Protocol{ - Name: "a", - Length: 5, - Run: func(peer *Peer, rw MsgReadWriter) error { - msg, err := rw.ReadMsg() - if err != nil { - t.Errorf("read error: %v", err) - } - if msg.Size != msgsize+4 { - t.Errorf("incorrect msg.Size, got %d, expected %d", msg.Size, msgsize) - } - msg.Discard() - close(done) - return nil - }, - } - - rw, _, errc := testPeer([]Protocol{proto}) - defer rw.Close() - - EncodeMsg(rw, 18, make([]byte, msgsize)) - select { - case <-done: - case err := <-errc: - t.Errorf("peer returned: %v", err) - case <-time.After(2 * time.Second): - t.Errorf("receive timeout") - } -} - func TestPeerProtoEncodeMsg(t *testing.T) { defer testlog(t).detach() @@ -134,8 +101,8 @@ func TestPeerProtoEncodeMsg(t *testing.T) { return nil }, } - rw, _, _ := testPeer([]Protocol{proto}) - defer rw.Close() + closer, rw, _, _ := testPeer([]Protocol{proto}) + defer closer.Close() if err := expectMsg(rw, 17, []string{"foo", "bar"}); err != nil { t.Error(err) @@ -145,8 +112,8 @@ func TestPeerProtoEncodeMsg(t *testing.T) { func TestPeerWriteForBroadcast(t *testing.T) { defer testlog(t).detach() - rw, peer, peerErr := testPeer([]Protocol{discard}) - defer rw.Close() + closer, rw, peer, peerErr := testPeer([]Protocol{discard}) + defer closer.Close() // test write errors if err := peer.writeProtoMsg("b", NewMsg(3)); err == nil { @@ -181,8 +148,8 @@ func TestPeerWriteForBroadcast(t *testing.T) { func TestPeerPing(t *testing.T) { defer testlog(t).detach() - rw, _, _ := testPeer(nil) - defer rw.Close() + closer, rw, _, _ := testPeer(nil) + defer closer.Close() if err := EncodeMsg(rw, pingMsg); err != nil { t.Fatal(err) } @@ -194,15 +161,15 @@ func TestPeerPing(t *testing.T) { func TestPeerDisconnect(t *testing.T) { defer testlog(t).detach() - rw, _, disc := testPeer(nil) - defer rw.Close() + closer, rw, _, disc := testPeer(nil) + defer closer.Close() if err := EncodeMsg(rw, discMsg, DiscQuitting); err != nil { t.Fatal(err) } if err := expectMsg(rw, discMsg, []interface{}{DiscRequested}); err != nil { t.Error(err) } - rw.Close() // make test end faster + closer.Close() // make test end faster if reason := <-disc; reason != DiscRequested { t.Errorf("run returned wrong reason: got %v, want %v", reason, DiscRequested) } @@ -244,13 +211,9 @@ func expectMsg(r MsgReader, code uint64, content interface{}) error { if err != nil { panic("content encode error: " + err.Error()) } - // skip over list header in encoded value. this is temporary. - contentEncR := bytes.NewReader(contentEnc) - if k, _, err := rlp.NewStream(contentEncR).Kind(); k != rlp.List || err != nil { - panic("content must encode as RLP list") + if int(msg.Size) != len(contentEnc) { + return fmt.Errorf("message size mismatch: got %d, want %d", msg.Size, len(contentEnc)) } - contentEnc = contentEnc[len(contentEnc)-contentEncR.Len():] - actualContent, err := ioutil.ReadAll(msg.Payload) if err != nil { return err diff --git a/p2p/rlpx.go b/p2p/rlpx.go new file mode 100644 index 000000000..6b533e275 --- /dev/null +++ b/p2p/rlpx.go @@ -0,0 +1,174 @@ +package p2p + +import ( + "bytes" + "crypto/aes" + "crypto/cipher" + "crypto/hmac" + "errors" + "hash" + "io" + + "github.com/ethereum/go-ethereum/rlp" +) + +var ( + // this is used in place of actual frame header data. + // TODO: replace this when Msg contains the protocol type code. + zeroHeader = []byte{0xC2, 0x80, 0x80} + + // sixteen zero bytes + zero16 = make([]byte, 16) + + maxUint24 = ^uint32(0) >> 8 +) + +// rlpxFrameRW implements a simplified version of RLPx framing. +// chunked messages are not supported and all headers are equal to +// zeroHeader. +// +// rlpxFrameRW is not safe for concurrent use from multiple goroutines. +type rlpxFrameRW struct { + conn io.ReadWriter + enc cipher.Stream + dec cipher.Stream + + macCipher cipher.Block + egressMAC hash.Hash + ingressMAC hash.Hash +} + +func newRlpxFrameRW(conn io.ReadWriter, s secrets) *rlpxFrameRW { + macc, err := aes.NewCipher(s.MAC) + if err != nil { + panic("invalid MAC secret: " + err.Error()) + } + encc, err := aes.NewCipher(s.AES) + if err != nil { + panic("invalid AES secret: " + err.Error()) + } + // we use an all-zeroes IV for AES because the key used + // for encryption is ephemeral. + iv := make([]byte, encc.BlockSize()) + return &rlpxFrameRW{ + conn: conn, + enc: cipher.NewCTR(encc, iv), + dec: cipher.NewCTR(encc, iv), + macCipher: macc, + egressMAC: s.EgressMAC, + ingressMAC: s.IngressMAC, + } +} + +func (rw *rlpxFrameRW) WriteMsg(msg Msg) error { + ptype, _ := rlp.EncodeToBytes(msg.Code) + + // write header + headbuf := make([]byte, 32) + fsize := uint32(len(ptype)) + msg.Size + if fsize > maxUint24 { + return errors.New("message size overflows uint24") + } + putInt24(fsize, headbuf) // TODO: check overflow + copy(headbuf[3:], zeroHeader) + rw.enc.XORKeyStream(headbuf[:16], headbuf[:16]) // first half is now encrypted + + // write header MAC + copy(headbuf[16:], updateMAC(rw.egressMAC, rw.macCipher, headbuf[:16])) + if _, err := rw.conn.Write(headbuf); err != nil { + return err + } + + // write encrypted frame, updating the egress MAC hash with + // the data written to conn. + tee := cipher.StreamWriter{S: rw.enc, W: io.MultiWriter(rw.conn, rw.egressMAC)} + if _, err := tee.Write(ptype); err != nil { + return err + } + if _, err := io.Copy(tee, msg.Payload); err != nil { + return err + } + if padding := fsize % 16; padding > 0 { + if _, err := tee.Write(zero16[:16-padding]); err != nil { + return err + } + } + + // write frame MAC. egress MAC hash is up to date because + // frame content was written to it as well. + fmacseed := rw.egressMAC.Sum(nil) + mac := updateMAC(rw.egressMAC, rw.macCipher, fmacseed) + _, err := rw.conn.Write(mac) + return err +} + +func (rw *rlpxFrameRW) ReadMsg() (msg Msg, err error) { + // read the header + headbuf := make([]byte, 32) + if _, err := io.ReadFull(rw.conn, headbuf); err != nil { + return msg, err + } + // verify header mac + shouldMAC := updateMAC(rw.ingressMAC, rw.macCipher, headbuf[:16]) + if !hmac.Equal(shouldMAC, headbuf[16:]) { + return msg, errors.New("bad header MAC") + } + rw.dec.XORKeyStream(headbuf[:16], headbuf[:16]) // first half is now decrypted + fsize := readInt24(headbuf) + // ignore protocol type for now + + // read the frame content + var rsize = fsize // frame size rounded up to 16 byte boundary + if padding := fsize % 16; padding > 0 { + rsize += 16 - padding + } + framebuf := make([]byte, rsize) + if _, err := io.ReadFull(rw.conn, framebuf); err != nil { + return msg, err + } + + // read and validate frame MAC. we can re-use headbuf for that. + rw.ingressMAC.Write(framebuf) + fmacseed := rw.ingressMAC.Sum(nil) + if _, err := io.ReadFull(rw.conn, headbuf[:16]); err != nil { + return msg, err + } + shouldMAC = updateMAC(rw.ingressMAC, rw.macCipher, fmacseed) + if !hmac.Equal(shouldMAC, headbuf[:16]) { + return msg, errors.New("bad frame MAC") + } + + // decrypt frame content + rw.dec.XORKeyStream(framebuf, framebuf) + + // decode message code + content := bytes.NewReader(framebuf[:fsize]) + if err := rlp.Decode(content, &msg.Code); err != nil { + return msg, err + } + msg.Size = uint32(content.Len()) + msg.Payload = content + return msg, nil +} + +// updateMAC reseeds the given hash with encrypted seed. +// it returns the first 16 bytes of the hash sum after seeding. +func updateMAC(mac hash.Hash, block cipher.Block, seed []byte) []byte { + aesbuf := make([]byte, aes.BlockSize) + block.Encrypt(aesbuf, mac.Sum(nil)) + for i := range aesbuf { + aesbuf[i] ^= seed[i] + } + mac.Write(aesbuf) + return mac.Sum(nil)[:16] +} + +func readInt24(b []byte) uint32 { + return uint32(b[2]) | uint32(b[1])<<8 | uint32(b[0])<<16 +} + +func putInt24(v uint32, b []byte) { + b[0] = byte(v >> 16) + b[1] = byte(v >> 8) + b[2] = byte(v) +} diff --git a/p2p/rlpx_test.go b/p2p/rlpx_test.go new file mode 100644 index 000000000..49354c7ed --- /dev/null +++ b/p2p/rlpx_test.go @@ -0,0 +1,124 @@ +package p2p + +import ( + "bytes" + "crypto/rand" + "io/ioutil" + "strings" + "testing" + + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/crypto/sha3" + "github.com/ethereum/go-ethereum/rlp" +) + +func TestRlpxFrameFake(t *testing.T) { + buf := new(bytes.Buffer) + hash := fakeHash([]byte{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) + rw := newRlpxFrameRW(buf, secrets{ + AES: crypto.Sha3(), + MAC: crypto.Sha3(), + IngressMAC: hash, + EgressMAC: hash, + }) + + golden := unhex(` +00828ddae471818bb0bfa6b551d1cb42 +01010101010101010101010101010101 +ba628a4ba590cb43f7848f41c4382885 +01010101010101010101010101010101 +`) + + // Check WriteMsg. This puts a message into the buffer. + if err := EncodeMsg(rw, 8, 1, 2, 3, 4); err != nil { + t.Fatalf("WriteMsg error: %v", err) + } + written := buf.Bytes() + if !bytes.Equal(written, golden) { + t.Fatalf("output mismatch:\n got: %x\n want: %x", written, golden) + } + + // Check ReadMsg. It reads the message encoded by WriteMsg, which + // is equivalent to the golden message above. + msg, err := rw.ReadMsg() + if err != nil { + t.Fatalf("ReadMsg error: %v", err) + } + if msg.Size != 5 { + t.Errorf("msg size mismatch: got %d, want %d", msg.Size, 5) + } + if msg.Code != 8 { + t.Errorf("msg code mismatch: got %d, want %d", msg.Code, 8) + } + payload, _ := ioutil.ReadAll(msg.Payload) + wantPayload := unhex("C401020304") + if !bytes.Equal(payload, wantPayload) { + t.Errorf("msg payload mismatch:\ngot %x\nwant %x", payload, wantPayload) + } +} + +type fakeHash []byte + +func (fakeHash) Write(p []byte) (int, error) { return len(p), nil } +func (fakeHash) Reset() {} +func (fakeHash) BlockSize() int { return 0 } + +func (h fakeHash) Size() int { return len(h) } +func (h fakeHash) Sum(b []byte) []byte { return append(b, h...) } + +func TestRlpxFrameRW(t *testing.T) { + var ( + aesSecret = make([]byte, 16) + macSecret = make([]byte, 16) + egressMACinit = make([]byte, 32) + ingressMACinit = make([]byte, 32) + ) + for _, s := range [][]byte{aesSecret, macSecret, egressMACinit, ingressMACinit} { + rand.Read(s) + } + conn := new(bytes.Buffer) + + s1 := secrets{ + AES: aesSecret, + MAC: macSecret, + EgressMAC: sha3.NewKeccak256(), + IngressMAC: sha3.NewKeccak256(), + } + s1.EgressMAC.Write(egressMACinit) + s1.IngressMAC.Write(ingressMACinit) + rw1 := newRlpxFrameRW(conn, s1) + + s2 := secrets{ + AES: aesSecret, + MAC: macSecret, + EgressMAC: sha3.NewKeccak256(), + IngressMAC: sha3.NewKeccak256(), + } + s2.EgressMAC.Write(ingressMACinit) + s2.IngressMAC.Write(egressMACinit) + rw2 := newRlpxFrameRW(conn, s2) + + // send some messages + for i := 0; i < 10; i++ { + // write message into conn buffer + wmsg := []interface{}{"foo", "bar", strings.Repeat("test", i)} + err := EncodeMsg(rw1, uint64(i), wmsg...) + if err != nil { + t.Fatalf("WriteMsg error (i=%d): %v", i, err) + } + + // read message that rw1 just wrote + msg, err := rw2.ReadMsg() + if err != nil { + t.Fatalf("ReadMsg error (i=%d): %v", i, err) + } + if msg.Code != uint64(i) { + t.Fatalf("msg code mismatch: got %d, want %d", msg.Code, i) + } + payload, _ := ioutil.ReadAll(msg.Payload) + wantPayload, _ := rlp.EncodeToBytes(wmsg) + if !bytes.Equal(payload, wantPayload) { + t.Fatalf("msg payload mismatch:\ngot %x\nwant %x", payload, wantPayload) + } + } +} diff --git a/p2p/server.go b/p2p/server.go index 3ea2538d1..34000cb4c 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -10,15 +10,24 @@ import ( "sync" "time" + "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/p2p/nat" ) const ( - handshakeTimeout = 5 * time.Second defaultDialTimeout = 10 * time.Second refreshPeersInterval = 30 * time.Second + + // total timeout for encryption handshake and protocol + // handshake in both directions. + handshakeTimeout = 5 * time.Second + // maximum time allowed for reading a complete message. + // this is effectively the amount of time a connection can be idle. + frameReadTimeout = 1 * time.Minute + // maximum amount of time allowed for writing a complete message. + frameWriteTimeout = 5 * time.Second ) var srvlog = logger.NewLogger("P2P Server") @@ -57,10 +66,6 @@ type Server struct { // each peer. Protocols []Protocol - // If Blacklist is set to a non-nil value, the given Blacklist - // is used to verify peer connections. - Blacklist Blacklist - // If ListenAddr is set to a non-nil address, the server // will listen for incoming connections. // @@ -135,7 +140,7 @@ func (srv *Server) SuggestPeer(n *discover.Node) { func (srv *Server) Broadcast(protocol string, code uint64, data ...interface{}) { var payload []byte if data != nil { - payload = encodePayload(data...) + payload = ethutil.Encode(data) } srv.lock.RLock() defer srv.lock.RUnlock() @@ -174,9 +179,6 @@ func (srv *Server) Start() (err error) { if srv.setupFunc == nil { srv.setupFunc = setupConn } - if srv.Blacklist == nil { - srv.Blacklist = NewBlacklist() - } // node table ntab, err := discover.ListenUDP(srv.PrivateKey, srv.ListenAddr, srv.NAT) @@ -365,7 +367,12 @@ func (srv *Server) startPeer(fd net.Conn, dest *discover.Node) { srvlog.Debugf("Handshake with %v failed: %v", fd.RemoteAddr(), err) return } - p := newPeer(conn, srv.Protocols) + + conn.MsgReadWriter = &netWrapper{ + wrapped: conn.MsgReadWriter, + conn: fd, rtimeout: frameReadTimeout, wtimeout: frameWriteTimeout, + } + p := newPeer(fd, conn, srv.Protocols) if ok, reason := srv.addPeer(conn.ID, p); !ok { srvlog.DebugDetailf("Not adding %v (%v)\n", p, reason) p.politeDisconnect(reason) @@ -375,7 +382,7 @@ func (srv *Server) startPeer(fd net.Conn, dest *discover.Node) { srvlog.Debugf("Added %v\n", p) srvjslog.LogJson(&logger.P2PConnected{ RemoteId: fmt.Sprintf("%x", conn.ID[:]), - RemoteAddress: conn.RemoteAddr().String(), + RemoteAddress: fd.RemoteAddr().String(), RemoteVersionString: conn.Name, NumConnections: srv.PeerCount(), }) @@ -403,8 +410,6 @@ func (srv *Server) addPeer(id discover.NodeID, p *Peer) (bool, DiscReason) { return false, DiscTooManyPeers case srv.peers[id] != nil: return false, DiscAlreadyConnected - case srv.Blacklist.Exists(id[:]): - return false, DiscUselessPeer case id == srv.ntab.Self(): return false, DiscSelf } @@ -418,53 +423,3 @@ func (srv *Server) removePeer(p *Peer) { srv.lock.Unlock() srv.peerWG.Done() } - -type Blacklist interface { - Get([]byte) (bool, error) - Put([]byte) error - Delete([]byte) error - Exists(pubkey []byte) (ok bool) -} - -type BlacklistMap struct { - blacklist map[string]bool - lock sync.RWMutex -} - -func NewBlacklist() *BlacklistMap { - return &BlacklistMap{ - blacklist: make(map[string]bool), - } -} - -func (self *BlacklistMap) Get(pubkey []byte) (bool, error) { - self.lock.RLock() - defer self.lock.RUnlock() - v, ok := self.blacklist[string(pubkey)] - var err error - if !ok { - err = fmt.Errorf("not found") - } - return v, err -} - -func (self *BlacklistMap) Exists(pubkey []byte) (ok bool) { - self.lock.RLock() - defer self.lock.RUnlock() - _, ok = self.blacklist[string(pubkey)] - return -} - -func (self *BlacklistMap) Put(pubkey []byte) error { - self.lock.Lock() - defer self.lock.Unlock() - self.blacklist[string(pubkey)] = true - return nil -} - -func (self *BlacklistMap) Delete(pubkey []byte) error { - self.lock.Lock() - defer self.lock.Unlock() - delete(self.blacklist, string(pubkey)) - return nil -} diff --git a/p2p/server_test.go b/p2p/server_test.go index c109fffb9..30447050c 100644 --- a/p2p/server_test.go +++ b/p2p/server_test.go @@ -11,6 +11,7 @@ import ( "time" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/crypto/sha3" "github.com/ethereum/go-ethereum/p2p/discover" ) @@ -23,8 +24,14 @@ func startTestServer(t *testing.T, pf newPeerHook) *Server { newPeerHook: pf, setupFunc: func(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake, dial *discover.Node) (*conn, error) { id := randomID() + rw := newRlpxFrameRW(fd, secrets{ + MAC: zero16, + AES: zero16, + IngressMAC: sha3.NewKeccak256(), + EgressMAC: sha3.NewKeccak256(), + }) return &conn{ - frameRW: newFrameRW(fd, msgWriteTimeout), + MsgReadWriter: rw, protoHandshake: &protoHandshake{ID: id, Version: baseProtocolVersion}, }, nil }, @@ -143,9 +150,7 @@ func TestServerBroadcast(t *testing.T) { // broadcast one message srv.Broadcast("discard", 0, "foo") - goldbuf := new(bytes.Buffer) - writeMsg(goldbuf, NewMsg(16, "foo")) - golden := goldbuf.Bytes() + golden := unhex("66e94d166f0a2c3b884cfa59ca34") // check that the message has been written everywhere for i, conn := range conns { diff --git a/trie/iterator.go b/trie/iterator.go index 3b3ddd751..fda7c6cbe 100644 --- a/trie/iterator.go +++ b/trie/iterator.go @@ -1,6 +1,8 @@ package trie -import "bytes" +import ( + "bytes" +) type Iterator struct { trie *Trie @@ -10,22 +12,28 @@ type Iterator struct { } func NewIterator(trie *Trie) *Iterator { - return &Iterator{trie: trie, Key: make([]byte, 32)} + return &Iterator{trie: trie, Key: nil} } func (self *Iterator) Next() bool { self.trie.mu.Lock() defer self.trie.mu.Unlock() + isIterStart := false + if self.Key == nil { + isIterStart = true + self.Key = make([]byte, 32) + } + key := RemTerm(CompactHexDecode(string(self.Key))) - k := self.next(self.trie.root, key) + k := self.next(self.trie.root, key, isIterStart) self.Key = []byte(DecodeCompact(k)) return len(k) > 0 } -func (self *Iterator) next(node Node, key []byte) []byte { +func (self *Iterator) next(node Node, key []byte, isIterStart bool) []byte { if node == nil { return nil } @@ -33,7 +41,7 @@ func (self *Iterator) next(node Node, key []byte) []byte { switch node := node.(type) { case *FullNode: if len(key) > 0 { - k := self.next(node.branch(key[0]), key[1:]) + k := self.next(node.branch(key[0]), key[1:], isIterStart) if k != nil { return append([]byte{key[0]}, k...) } @@ -54,7 +62,13 @@ func (self *Iterator) next(node Node, key []byte) []byte { case *ShortNode: k := RemTerm(node.Key()) if vnode, ok := node.Value().(*ValueNode); ok { - if bytes.Compare([]byte(k), key) > 0 { + switch bytes.Compare([]byte(k), key) { + case 0: + if isIterStart { + self.Value = vnode.Val() + return k + } + case 1: self.Value = vnode.Val() return k } @@ -64,7 +78,7 @@ func (self *Iterator) next(node Node, key []byte) []byte { var ret []byte skey := key[len(k):] if BeginsWith(key, k) { - ret = self.next(cnode, skey) + ret = self.next(cnode, skey, isIterStart) } else if bytes.Compare(k, key[:len(k)]) > 0 { return self.key(node) } diff --git a/trie/trie_test.go b/trie/trie_test.go index 92e0df8e2..b6a260483 100644 --- a/trie/trie_test.go +++ b/trie/trie_test.go @@ -271,7 +271,7 @@ func TestLargeData(t *testing.T) { trie := NewEmpty() vals := make(map[string]*kv) - for i := byte(1); i < 255; i++ { + for i := byte(0); i < 255; i++ { value := &kv{ethutil.LeftPadBytes([]byte{i}, 32), []byte{i}, false} value2 := &kv{ethutil.LeftPadBytes([]byte{10, i}, 32), []byte{i}, false} trie.Update(value.k, value.v) diff --git a/whisper/peer.go b/whisper/peer.go index 332ddd22a..66cfec88c 100644 --- a/whisper/peer.go +++ b/whisper/peer.go @@ -2,10 +2,10 @@ package whisper import ( "fmt" - "io/ioutil" "time" "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/rlp" "gopkg.in/fatih/set.v0" ) @@ -77,8 +77,7 @@ func (self *peer) broadcast(envelopes []*Envelope) error { } if i > 0 { - msg := p2p.NewMsg(envelopesMsg, envs[:i]...) - if err := self.ws.WriteMsg(msg); err != nil { + if err := p2p.EncodeMsg(self.ws, envelopesMsg, envs[:i]...); err != nil { return err } self.peer.DebugDetailln("broadcasted", i, "message(s)") @@ -93,34 +92,28 @@ func (self *peer) addKnown(envelope *Envelope) { func (self *peer) handleStatus() error { ws := self.ws - if err := ws.WriteMsg(self.statusMsg()); err != nil { return err } - msg, err := ws.ReadMsg() if err != nil { return err } - if msg.Code != statusMsg { return fmt.Errorf("peer send %x before status msg", msg.Code) } - - data, err := ioutil.ReadAll(msg.Payload) - if err != nil { - return err + s := rlp.NewStream(msg.Payload) + if _, err := s.List(); err != nil { + return fmt.Errorf("bad status message: %v", err) } - - if len(data) == 0 { - return fmt.Errorf("malformed status. data len = 0") + pv, err := s.Uint() + if err != nil { + return fmt.Errorf("bad status message: %v", err) } - - if pv := data[0]; pv != protocolVersion { + if pv != protocolVersion { return fmt.Errorf("protocol version mismatch %d != %d", pv, protocolVersion) } - - return nil + return msg.Discard() // ignore anything after protocol version } func (self *peer) statusMsg() p2p.Msg { |